Source Code
#include <iostream>
using namespace std;


long long X, Y, Z, sum = 0;


void solve() {
	cin >> Y;
	sum = 0;
	sum = (((Y) * (1 + (Y * Y))) / 2);
	//make = (((n) * (1 + (n * n))) / 2);
	cout << sum << endl;
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> X;
	for (int i = 0; i < X; i++) solve();
}

Copy
Ali's Game YousefShaheen
GNU G++17
339 ms
2.2 MB
Accepted