TWOSQRS  Two squares or not two squares
Given integer n decide if it is possible to represent it as a sum of two squares of integers.
Input
First line of input contains one integer c <= 100  number of test cases. Then c lines follow, each of them consisting of exactly one integer 0 <= n <= 10^12.
Output
For each test case output Yes if it is possible to represent given number as a sum of two squares and No if it is not possible.
Example
Input: 10 1 2 7 14 49 9 17 76 2888 27 Output: Yes Yes No No Yes Yes Yes No Yes No
hide comments
iit2015068:
20151020 21:31:29
I was trying to solve this using fermet's theorem, but got TLE.After changing my algo to brute force, solution got accepted.... So, this can be solved by brute force also. 

aditya1997:
20151010 08:52:18
finally ac,using wrong format specifier costed me too many TLEs.


Ravi Chandra:
20151004 05:23:35
In 0.52s...Thinking hw to optimize it 

Harsh Vardhan Ladha:
20150902 12:20:12
unsigned long long caused me one WA


dwij28:
20150830 21:45:09
I don't know why my python solution got a TLE, got an AC with almost the same code in c++ duh .. :/ 

rahulwahi:
20150827 20:27:37
print (No) not NO


prakash_reddy:
20150814 22:12:58
Take long long in for() loop it costs me several WA.... :) 

Shubhransh Srivastav:
20150810 16:01:04
my 50th.... long way to go..... 

Akash Goel:
20150804 12:24:01
Used a naive method and got AC in 0.54. 

shravinson:
20150715 07:42:14
he he

Added by:  gawry 
Date:  20040629 
Time limit:  2s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 