Source Code
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
	   long long n;
	   cin>>n;
	    long long  sum=0;
	    sum=(n*n*n + n)/2;

	    cout<<sum<<endl;
	}
	return 0;
}
Copy
Ali's Game lanooshkh
GNU G++17
278 ms
2.9 MB
Accepted