Source Code
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

typedef long long int ll;

ll mod=1e9+7;
ll a[200010];
ll b[200010];
ll tc,i,j,k,n,m,x;
string s,s1,s2;

vector< pair<ll,ll> > v;

int main(){

    IOS

    cin>>tc;

    while(tc--){

            cin>>n;

            if(n==1){
                cout<<1<<endl;
                continue;
            }

            ll r=1+(n-1)*(n+1);
            ll ans=(1+r)*n/2;

            cout<<ans<<endl;

    }

}
Copy
Ali's Game AshcoOoOdel
GNU G++17
34 ms
2.3 MB
Accepted