Source Code
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t;
	cin>>t;
	while(t--)
	{
	    long long n;
	    cin>>n;
	    long long  s=(n*n*n + n)/2;;
	    cout<<s<<endl;
	}
    return 0;
}
Copy
Ali's Game Mohamedmaher
GNU G++17
230 ms
3.0 MB
Accepted