#B4002. Expressing a Number as Sum of Two Squares

    ID: 11659 Type: Default 1000ms 256MiB

Expressing a Number as Sum of Two Squares

Expressing a Number as Sum of Two Squares

You are given n positive integers \(a_1, a_2, \dots, a_n\). For each integer \(a_i\), determine whether there exist two positive integers \(x\) and \(y\) such that:

\[ x^2 + y^2 = a_i \]

If such a pair exists, print Yes; otherwise, print No for that integer.

inputFormat

The first line contains a single integer \(n\) indicating the number of test cases.

The following line (or lines) contains \(n\) positive integers \(a_1, a_2, \dots, a_n\) separated by spaces or newlines.

outputFormat

For each integer \(a_i\), output a line with either Yes if there exists a pair of positive integers \(x, y\) satisfying \(x^2+y^2=a_i\), or No if no such pair exists.

sample

3
5 3 10
Yes

No Yes

</p>