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
Michal Idzikowski:
20160303 03:49:57
Can you tell me what is wrong with my answers #16411672 #16411678?


Vicky:
20160221 13:31:27
Don't think too much :p 

hulk_baba:
20160213 19:33:27
one important properties of such number is key to problem,


uday pratap verma:
20160207 11:27:18
using seive algorithm to solve it.....


dokz:
20160115 12:17:52
NVM Wrong comment. Last edit: 20160115 12:18:33 

code_astra1:
20160102 11:28:41
Last edit: 20160102 12:12:00 

refresh:
20151230 12:38:50
my id is 15973062...can anyone tell me the error in my code or some testcases would be better! Last edit: 20151231 03:43:55 

ashu05:
20151222 06:00:57
tried using fermat's theorem but costed me 1 WA


ankitch6:
20151218 16:16:37
using int cost me 4 four wrong answers:( 

norhh:
20151022 10:55:31
0.14 s AC by brute force with 30 lines.using theorem i think its a bit hard to implement. 
Added by:  gawry 
Date:  20040629 
Time limit:  2s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 