Source Code
#include <iostream>
#include<bits/stdc++.h>
#include<unordered_map>
#define ll long long
using namespace std;
int main() {
    std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    int t; cin >> t;
    while (t--) {
        ll n; cin >> n;
        cout <<(ll) n*(n*n+1)/2 << "\n";
    }
    return 0;
}
Copy
Ali's Game Walaa Abd Elhady
GNU G++17
52 ms
2.2 MB
Accepted