c[1<<25];i,j,k,t,s; main(n,d){ scanf("%d%d",&n,&d); for(;i++0&&c[t]++)t=i*i-j*j+d; for(;k++