"""
print the series
0 1 3 6 10 15..........
"""
import sys
sys.setrecursionlimit(10**6)
def handshake(n):
if(n==1):
return 0
return (n-1)+handshake(n-1)
t=int(input())
for i in range(t):
n=int(input())
print(handshake(n))
To embed this program on your website, copy the following code and paste it into your website's HTML: