#include #define rep(i,n) for (int i = 0; i < (n); i ++) using namespace std; typedef long long ll; typedef pair PL; typedef pair P; const int INF = 1e9; const ll MOD = 1e9 + 7; const vector dy = {-1,0,1,0}; const vector dx = {0,1,0,-1}; int main() { int x,y; cin >> x >> y; vector square; for (int i = 0;i * i <= y; i++) { square.push_back(i * i); } vector cnt(y + 1,0); for (int p1:square) { for (int p2:square) { if (p1 + p2 < x || p1 + p2 > y) continue; if (p1 == 0 || p2 == 0) cnt[p1 + p2] += 2; else cnt[p1 + p2] += 4; } } int ans = 0; for (int i = x; i < y + 1; i ++) { ans = max(ans,cnt[i]); } cout << ans << endl; return 0; }