#include #include using namespace std; using namespace atcoder; using ll = long long; using P = pair; using mint = modint998244353; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int X, Y; cin >> X >> Y; int i = 1; unordered_map mp; vector L; while (i * i <= Y) { L.push_back(i * i); mp[i * i] += 1; i += 1; } int N = L.size(); for (int i = 0; i < N; i++) { for (int j = i; j < N; j++) { int a = L[i]; int b = L[j]; if (a == b) { if (X <= a + b && a + b <= Y) { mp[a + b] += 1; } } else{ if (X <= a + b && a + b <= Y) { mp[a + b] += 2; } } } } int ans = 0; for (P p : mp) { int k = p.first; int v = p.second; if (X <= k && k <= Y) { ans = max(ans, v); } } cout << ans * 4 << endl; }