#include "iostream" #include "climits" #include "list" #include "queue" #include "stack" #include "set" #include "functional" #include "algorithm" #include "string" #include "map" #include "unordered_map" #include "unordered_set" #include "iomanip" #include "cmath" #include "random" #include "bitset" #include "cstdio" #include "numeric" #include "cassert" using namespace std; const long long int MOD = 1000000007; //const int MOD = 998244353; long long int N, M, K, H, W, L, R; //int N, M, K, H, W, L, R; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> N >> K; vectorm(10000000); for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { m[i*i - j * j+5000000]++; } } long long int ans = 0; for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { int box = i * i + j * j - K; ans += m[box+5000000]; } } cout << ans << endl; return 0; }