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

using namespace std;
#define pb push_back
typedef long long ll;

int main(){

	ll T,n;
       cin>>T;
       while(T--){
        cin>>n;
          cout<<((n*(n-1))/2)*(n+1)+n<<"\n";
       }

}
Copy
Ali's Game mohammed_mraish
GNU G++17
362 ms
2.1 MB
Accepted