#include using namespace std; #define ll long long #define FOR(i,n,m) for(int i=(n);i<(m);i++) #define REP(i,n) for(int i=0;i<(n);i++) #define REPR(i,n) for(int i=(n);i>=0;i--) #define all(vec) vec.begin(),vec.end() using vi=vector; using vvi=vector; using vl=vector; using vvl=vector; using P=pair; using PP=pair; using vp=vector

; using vpp=vector; using vs=vector; #define fi first #define se second #define pb push_back templatebool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} templateistream&operator>>(istream&is,pair &p){is>>p.fi>>p.se;return is;} templateostream&operator<<(ostream&os,const pair &p){os<<"("<istream&operator>>(istream&is,vector &t){REP(i,t.size())is>>t[i];return is;} templateostream&operator<<(ostream&os,const vector&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<>N>>D; map ma; FOR(i,1,N+1){ FOR(j,1,N+1){ ma[i*i+j*j]++; } } int ans=0; FOR(i,1,N+1){ FOR(j,1,N+1){ int x=i*i+D-j*j; if(!ma.count(x)){ continue; } ans+=ma[x]; } } cout<