TRICOUNT  Counting Triangles
We define the LEVEL of a triangle as in the following illustrative image:
Task: Your task is very easy. All you have to do is to count all triangles in the biggest one (Level N).
Input
The first line of the input contains an integer T (T ≤ 10000)  the number of test cases and T lines follow. Each line contains an integer N (1 ≤ N ≤ 10^{6}) which is the level of the triangle in that test case.
Output
For each test case, you should write a seperate line: the number of triangles in the biggest one (Level N). (All answers will fit within the range of a 64bit integer)
Example
Input:
3
1
2
3
Output:
1
5
13
Source limit is 500 bytes.
hide comments
knir0103:
20190320 08:54:34
can calculate upwards and downwards separately, not necessarily using formula :) 

rahul11197:
20190319 12:49:39
ans=ceil ( (n*(n+2)*(2*n+1) ) / 2 ) 

vaibhav18_:
20190101 16:30:53
easy one if u know the formula


knakul853:
20181101 11:13:34
just find formula : ) 

masterchef2209:
20181018 14:52:35
costed too many WAs :( 

rohitjain00:
20180927 16:14:29
Java Users use Buffered Reader Instead of Scanner 

bloodgreed99:
20180830 16:10:59
cout<<pow(2,n+1)3<<endl; 

deceptiveuser1:
20180824 12:36:25
for the intuition of the formula: https://www.youtube.com/watch?v=9EU3FlKj3M Last edit: 20180824 12:36:46 

m2do:
20180630 19:29:36
What is the pattern here? missing 3rd level figure makes it hard to understand it. Can anybody explain the pattern? 

thisistia:
20180622 17:53:46
Is using the formula necessary? I wrote the program using functions separately for upwards and downwards(oddeven), and it's working fine.. But the file size is exceeding 500B, in C++. How to fix this? Last edit: 20180811 17:11:23 
Added by:  nha.duong 
Date:  20070805 
Time limit:  0.237s 
Source limit:  500B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 ERL JSRHINO NODEJS OBJC PERL6 SQLITE VB.NET 
Resource:  Trần Huy Hưng 