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+1)*(n-1)*n)/2;

	    cout<<sum<<endl;
	}
	return 0;
}
Copy
Ali's Game lanooshkh
GNU G++17
0 ms
0 KB
Compilation Error