#include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define int long long typedef vector VI; #define REP(i,n) for(int i=0;i > dp; //vector > > vvvi; //dp=vector >(N, vector(M,0)); //vector > v; //v.push_back(make_pair(x,y)); signed main(){ cin.tie(0); ios::sync_with_stdio(false); int N, D; cin >> N >> D; mapA; mapB; int ans = 0; eFOR(i, 1, N) { eFOR(j, 1, N) { //A[i*i + j * j]++; B[i*i - j * j]++; } } eFOR(i, 1, N) { eFOR(j, 1, N) { ans+=B[D-(i*i + j * j)]; //ans+=A[D-(i*i - j * j)]; } } cout << ans << endl; return 0; }