#include #include using namespace std; int main() { int N ,D,a,b,c,d,s; cin >> N >> D; s = 0; a = 1; b = 1; c = 1; d = 1; while (a <= N) { while (b <= N) { while (c <= N) { while(d<=N){ if (a*a + b * b + c * c - d * d == D) { s++; } d++; }d = 1;c++; }c = 1;b++; }b = 1;a++; } cout << s << endl; return 0; }