SQUAREV1  Revenge of the squares (variation)
Given a number N calculate the number R of different presentations of N in the form A*A+B*B with A and B being positive integers including zero. 1*1+2*2 and 2*2+1*1 are not different presentations. So for input 5 the output is 1.
Input
Fifty tests with one positive integer < 10^9.
Output
Print the illustrated above number R for each test.
Example
Input: 5
7
986244509 Output: 1
0
2
hide comments
sonupmandal:
20160520 12:20:35
Simple logic + 249 bytes :) 

hodobox:
20150922 11:07:26
Source limit isn't too low even for C++. I got 270 bytes without even thinking about source length optimization. 

Mitch Schwartz:
20140716 22:05:46
81B in bash, with 0.00s as a bonus. :) Last edit: 20140717 00:17:42 

anurag garg:
20131218 12:15:30
good mathematics question...


praveen123:
20120618 02:02:04
You should think about C++ users they have to write using namespace std and for optimization also need cstdio ,,,,


aang*™*:
20120613 16:35:14
problems with cin.eof() but why?? 

Santiago Zubieta:
20110606 21:32:04
Yes yes I know they are enough, in the end my solution measured about 270~


HWK:
20110606 11:47:54
@Santiago Zubieta: I thought 300 bytes are more than enough.


Santiago Zubieta:
20110606 01:53:09
This damn thing TLEs on me on Test #4 hahahaha :(


HWK:
20110420 12:24:15
@Virgo: That's right. 
Added by:  HWK 
Date:  20110228 
Time limit:  1s 
Source limit:  300B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 