The chef was searching for his pen in the garage but he found his old machine with a display and some numbers on it. If some numbers entered then some different output occurs on the display. Chef wants to crack the algorithm that the machine is following.
Example to identify the pattern :
Input                            Output
9                                   36
5                                   10
1                                    0
2                                    1

-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- Each test case contains a single line of input, $N$. 

-----Output:-----
For each test case, output in a single line answer as displayed on the screen.

-----Constraints-----
- $1 \leq T \leq 10^6$
- $1 \leq N \leq 10^6$

-----Sample Input:-----
1
7

-----Sample Output:-----
21

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
T = int(input())

for t in range(T):
    N = int(input())
    
    print(int(((N-1)*(N))/2))

# cook your dish here
T = int(input())

for t in range(T):
    N = int(input())
    
    print(int(((N-1)*(N))/2))

T = int(input())

for t in range(T):
    N = int(input())
    
    print(int(((N-1)*(N))/2))

# cook your dish here
t = int(input())

for _ in range(t):
    n = int(input())
    sum = int((n*(n-1) )/ 2)
    print(sum)

from sys import stdin, stdout
n = int(stdin.readline())
#l = list(map(int, stdin.readline().split()))
#l = [int(stdin.readline()) for _ in range(n)]
#a, b = map(int, stdin.readline().split())
for _ in range(n):
    n1 = int(stdin.readline())
    abd = (n1*(n1-1))//2
    print(abd)