Source Code
#include <iostream>
using namespace std;

int main() {
	int t;
	cin >> t;
	while ( t-- ) {
		long long n , b,m=1e9+7 ;
		cin >> n;
		b = ((n/2)+(n%2));
		b = b*(b-1)/2;
		n = n*(n-1)/2;
		cout << (n-b+1)%m << endl;
	}
	return 0;
}
Copy
Study Schedule SAAD
GNU G++17
244 ms
1.2 MB
Wrong Answer