Source Code
#include <iostream>


using namespace std;
int main() {
int t ; 
  cin>>t;
  
  
  while(t--)
    {
      
      int n ;
      cin>>n; 
      long long  j =((n-1)*n)/2;
      long long  r = (n*(n+1))/2;
      cout<<(j)*n +r<<endl;
      
      
    }
  


}
Copy
Ali's Game Tala_Ibraheem
GNU G++17
452 ms
1.7 MB
Wrong Answer