Source Code
#include<bits/stdc++.h>
using namespace std;
void xarr(int n){
    int q = 0, sum = 0;
    while(q<n){
          sum+= (n*n) - q*(n+1);
          q++;
    }
    cout << sum << endl;
}
int main(){
      int t;
      cin >> t;
      for(int i =0; i <t; i++){
          int n, sum = 0;
          cin >> n;
          xarr(n);
      }
}
Copy
Ali's Game Oj3far
GNU G++17
2079 ms
1.0 MB
Time Limit Exceeded