DPSSPC02 (Beautiful Sequence) - Official Editorial

PROBLEM
Let’s say a number n first occurs at position p. In the range [1,\ p], there are n 1 s, (n-1) 2 s, ..., 1 n.
p = 1 + 2 + 3 + ... + n
\implies p = \dfrac{n(n + 1)}{2} \forall n \in Z^+

for i in range(int(input())):
    n = int(input())
    print((n*(n+1))//2)