#include #include using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) const int MAX = 7e6; bool quad[MAX]; int main(){ int n; cin>>n; int d; cin>>d; rep(i,n)quad[(i+1)*(i+1)+d]=1; int ans=0; REP(i,1,n+1)REP(j,1,n+1)REP(k,1,n+1){ if(quad[i*i+j*j+k*k]){ ++ans; } } cout<