#include using namespace std; using ll=long long; #define rep(i,n) for(int i=0;i=0;i--) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} vectorA={0,1,4,5,9,10,13,14,16,17,20,21,25,26,29,30,34,35,36,37,38,39,40,41,42,45,46,49,50,51,52,53,54,55,56,57,58,59,61,62,63,64,65,66,68,69,70,71,73,74,75,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,93,94,95,97,98,99,100,101,102,103,104,105,106,107,109,110,111,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,129}; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll R,B; cin>>R>>B; ll ok=0,ng=2e9; while(ng-ok>1){ ll mid=(ok+ng)/2; if(mid*(mid+1)>(R+B+2*mid)/(2*mid+1)*6)ng=mid; else{ ll al=mid*(mid+1)*(2*mid+1)/6; if(R>=129){ if(al-R<=B)ok=mid; else ng=mid; } else{ auto id=lower_bound(all(A),R); if(*id!=R)id--; if(al-*id<=B)ok=mid; else ng=mid; } } } cout<