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

void solve(){
    long long n;
    cin>>n;
    double long sum = (n*n + 1) / 2.0 * n;
    
    
    cout<<(long long)sum<<endl;
}

int main(){  
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    // freopen("input.txt", "r", stdin);

    int t = 1;
    cin>>t;
    while(t--)
        solve(); 
}
Copy
Ali's Game hashemtb
GNU G++17
336 ms
1.9 MB
Wrong Answer