#include #include int main(){ int n,x=1,y=1,z=1,w,d,ans=0; scanf("%d%d",&n,&d); for(x=1;x*x+y*y+z*z-d<=n*n&&x<=n;x++){ for(y=1;x*x+y*y+z*z-d<=n*n&&y<=n;y++){ for(z=1;x*x+y*y+z*z-d<=n*n&&z<=n;z++){ int tmp=-d+x*x+y*y+z*z; tmp=sqrt(tmp); if(x*x+y*y+z*z==tmp*tmp+d){ ans++; // printf("%d,%d,%d,%d\n",x,y,z,tmp); } } z=1; } y=1; } printf("%d\n",ans); return 0; }