Source Code
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
	    int n;
	    scanf("%d",&n);
	    long long  sum=0;
	    sum= (n*n*n )-((n+1)*(n-1)*n)/2;

	    printf("%I64d",sum);
	    printf("\n");
	}
	return 0;
}
Copy
Ali's Game lanooshkh
GNU G++17
51 ms
7.0 MB
Wrong Answer