SUMOFTWOSQUARES - Sum of Two Squares

Which integer numbers can be represented by a sum of two integer squares?

That is the question that your program must answer!

For example, the number 41 can be represented as (-4)2 + 52 = 41, but 7 cannot be represented in the same way.

Input

The input consists of several lines, each line contains an integer with absolute value less than or equal to 10000.

Output

For each line, print "YES" if the number can be represented by a sum of two integer squares, otherwise print "NO".

Example 1

Input:
41
7
2

Output:
YES
NO
YES

Added by:Coach UTN FRSF
Date:2015-09-12
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY

hide comments
2023-04-28 21:50:56 Simes
Come on @nadstratosfer, surely you realised 52 = 5^2? (now fixed btw).
There are negative and zero inputs - confirmed with asserts.
2018-09-26 00:25:16
52 is not an integer square, 41 = 25 + 16 though. Input description along with the wrong example hint that difference of squares should be considered as well, but there are no negative inputs, and every combination of guesses gave me WA anyway. Finally, I hardcoded A001481 and got WA too. Apparently psetter has an own definition of sum, integer or square here.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.