Skip to main content
3 of 4
added 3 characters in body
TanMath
  • 1.4k
  • 11
  • 25

##Python, 133 129 bytes

from itertools import*
n=input()
l=[];s=0
for i in range(-n,n+1):l.append(i**2)
for j in product(l,l):
 if sum(j)==n:s+=1
print s

This demonstrates the use of itertools cartesian product. Try it online

TanMath
  • 1.4k
  • 11
  • 25