Source Code
#include <cstring>
#include <vector>
#include <stdio.h>
#include <bitset>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include<sstream>
#include <iomanip>
#include<utility>
#include <iostream>
#define ll long long
double pi = 3.14159;
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	ll t; cin >> t;
	while (t--) {
		ll n; cin >> n;
		ll sum = 1; ll x = n + 1;
		ll sum1 = 1;
		for (int i = 2; i <= n; i++) {
			sum += x;
			sum1 += sum;
		}
		cout << sum1 << "\n";
	}

}
Copy
Ali's Game makamkh899
GNU G++17
2033 ms
1.3 MB
Time Limit Exceeded