P17222 [ICPC 2017 Nanning R] Twice Equation
Description
For given $L$, find the smallest $n$ no smaller than $L$ for which there exists an positive integer $m$ for which $2m(m + 1) = n(n + 1)$.
Input Format
This problem contains multiple test cases. The first line of a multiple input is an integer $T (1 \le T < 1000)$ followed by $T$ input lines. Each line contains an integer $L (1 \le L < 10^{190})$.
Output Format
For each given $L$, output the smallest $n$. If available $n$ does not exist, output $-1$.