Each test cases consists of $T$ cases.
Given $Y, P(P: \textrm{prime})$.
Print $X$ s.t. $X^ 2 \equiv Y (\bmod P)$, or $-1$ if there is no such $X$.
$T$
$Y_ 0$ $P_ 0$
$Y_ 1$ $P_ 1$
:
$Y_ {T-1}$ $P_ {T-1}$
For each line, print $X$ or $-1$.
5 0 5 1 5 2 5 3 5 4 5
0 1 -1 -1 2
No. | Testdata Range | Score |
---|