ll U[1000100]; ll D[1000100]; void preprocess() { REP(_n, 2, 1000001) { ll n = _n; U[n] = (n-1)*( (n-1)*(n-2)/2 ); D[n] = D[n-1] + (n-2)*(n-3)/2; } } ll solve3() { ll n; rd(n); return 2ll*(U[n] - D[n]); } { preprocess(); int t; rd(t); REP(_, t) wt(solve3()); }