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
blackhat_130:
20200327 22:19:48
use long long also during accepting input than only in writing answer otherwise you'll get wrong answer.


aryan__0406:
20200320 19:55:10
Nothing is impossible friends,use your mind and solve this problem. I am also trying this problem from the previous one year and i am confident that one day i will be able to solve this problem efficiently.


savage_19:
20200205 08:17:35
Use long data type.. costed many WAs. 

rushout09:
20190912 17:38:58
This video will help you understand the concept:


quannguyenlhp:
20190812 11:02:59
Don't use the formula, try to come up with another solution less than 500b, it's more challenge. Last edit: 20190812 11:03:26 

hetp111:
20190524 21:59:35
For those who think 4th level should be 3rd level... here we are adding 2n1 triangles to the base of n1th level to find the nth level, so nth_lvl=(n1)th_lvl + (2n1)smalltrianglesOnBase Last edit: 20190524 22:02:33 

klmo:
20190426 16:31:12
Whats the deal with the source code size limit!!! 

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

Added by:  nha.duong 
Date:  20070805 
Time limit:  1s 
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 