#if !__INCLUDE_LEVEL__ #include __FILE__ using mint = modint1000000007; //using mint = modint998244353; int main(){ LL(n); rep(_,n){ LL(a,b); ll l=0,r=70000; while(l+1!=r){ ll mid=(l+r)/2; if(mid*mid-a-b>=0){ if(4*a*b<(mid*(mid*mid*mid-2*mid*(a+b))+(a+b)*(a+b)))r=mid; else l=mid; }else { l=mid; } } print(r); } } #else #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; #if __has_include() #include using namespace atcoder; void output(modint1000000007 x){cout << x.val();} void output(modint998244353 x){cout << x.val();} void debug_out(modint1000000007 x){cerr << x.val();} void debug_out(modint998244353 x){cerr << x.val();} #endif #ifdef LOCAL #define debug(...) {cerr << "\033[33mline:" << __LINE__ << endl; debug_func(0, #__VA_ARGS__, __VA_ARGS__);} templatevoid debug_out(T &x){cerr << x;} void debug_tmp(auto &x); templatevoid debug_out(pair&x){cerr<<"< ";debug_tmp(x.first);cerr << " , ";debug_tmp(x.second);cerr << " >";} templatevoid debug_out(vector&x){long long cnt=0;for(auto &i:x){cnt++;debug_out(i);if(cnt!=(long long)x.size())cerr << ' ';}} templatevoid debug_out(vector>&x){cerr << endl;long long cnt=0;for(auto &i:x){cnt++;debug_out(i);if(cnt!=(long long)x.size())cerr << endl;}} void debug_tmp(auto &x){debug_out(x);} void debug_map(auto &x){ cerr << endl;long long cnt=0;for(auto &t:x){cnt++;cerr << "Key:";debug_out(t.first);cerr << " Val:";debug_out(t.second);if(cnt!=(long long)x.size())cerr << endl;} } void debug_set(auto &x){ long long cnt=0;for(auto &t:x){cnt++;debug_out(t);if(cnt!=(long long)x.size())cerr << " ";} } templatevoid debug_out(queuex){while(!x.empty()){auto t=x.front();x.pop();debug_out(t);if(!x.empty())cerr << " ";}} templatevoid debug_out(priority_queuex){while(!x.empty()){auto t=x.top();x.pop();debug_out(t);if(!x.empty())cerr << " ";}} templatevoid debug_out(priority_queue,greater>x){while(!x.empty()){auto t=x.top();x.pop();debug_out(t);if(!x.empty())cerr << " ";}} templatevoid debug_out(map&x){debug_map(x);} templatevoid debug_out(unordered_map&x){debug_map(x);} templatevoid debug_out(set&x){debug_set(x);} templatevoid debug_out(unordered_set&x){debug_set(x);} templatevoid debug_out(multiset&x){debug_set(x);} template void debug_func(int _,T name){cerr << "\033[m";(void)_;(void)name;} template void debug_func(int _,T &name,Y &a,Z &...b){ for(;name[_]!=','&&name[_]!='\0';_++)cerr << name[_]; cerr << " : ";debug_out(a);cerr << endl;debug_func(_+1,name,b...); } #else #define debug(...) ; #endif struct cin_init{cin_init(){ios::sync_with_stdio(false);std::cin.tie(nullptr);cout << fixed << setprecision(16);}}_cin_init; using ll = long long; using ull = unsigned long long; using vi = vector; using vll = vector; using vvi = vector; using vvvi = vector; using vvll = vector; using vvvll = vector; using vs = vector; using pii = pair; using pll = pair; using vcc = vector; using vvcc = vector; using mii = map; using mll = map; template using vc = vector; template using vvc = vector>; template using uomap = unordered_map; template using uoset = unordered_set; template using revpriority_queue = priority_queue,greater>; int dx[4] = { 1,0,-1,0 }; int dy[4] = { 0,1,0,-1 }; int ddx[8] = { -1,0,1,1,1,0,-1,-1 }; int ddy[8] = { 1,1,1,0,-1,-1,-1,0 }; constexpr long double lpi = 3.141592653589793238; constexpr double pi = 3.141592653589793; ll mod = 1000000007; constexpr int inf = 1073741824;//2^30 constexpr ll llinf = 1152921504606846976;//2^60 void set_mod(){mod = 998244353;} #define F first #define S second #define pb emplace_back #define mp make_pair templatevoid input(pair&x){cin >> x.F >> x.S;} templatevoid input(T &x){cin >> x;} templatevoid input(vector&x){for(auto &i:x)input(i);} templatevoid input(vector>&x){for(auto &i:x)input(i);} templatevoid input(T& x,Y&...k){input(x);input(k...);} void output_tmp(auto &x); templatevoid output(T &x){cout << x;} templatevoid output(pair&x){output_tmp(x.first);cout << ' ' ;output_tmp(x.second);} templatevoid output(vector&x){ll cnt=0;for(auto &i:x){cnt++;output(i);if(cnt!=(long long)x.size())cout << ' ';}} templatevoid output(vector>&x){ll cnt=0;for(auto &i:x){cnt++;output(i);if(cnt!=(long long)x.size())cout << endl;}} void output_tmp(auto &x){output(x);} templatevoid print(T x){output(x);cout << endl;} templatevoid print_buffer(T &x){output(x);cout << endl;} templatevoid print_buffer(T& x,Y&...k){output(x);cout << endl;print_buffer(k...);} templatevoid print(T x,Y...k){output(x);cout << endl;print_buffer(k...);} template auto min(const T& x){ return *min_element(x.begin(),x.end()); } template auto max(const T& x){ return *max_element(x.begin(),x.end()); } template inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;} template inline bool chmax(T &a,T b){if(a void yesno(T x){if(x)cout << "Yes" << endl;else cout << "No" << endl;} #define overload4(a,b,c,d,e,...)e #define overload8(a,b,c,d,e,f,g,h,i,...)i #define rep1(end) for(ll i=0;i<(ll)end;i++) #define rep2(i,end) for(ll i=0;i<(ll)end;i++) #define rep3(i,start,end) for(ll i=start;i<(ll)end;i++) #define rep4(i,start,end,plus) for(ll i=start;i<(ll)end;i+=plus) #define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__) #define LL(...) ll __VA_ARGS__; input(__VA_ARGS__); #define STR(...) string __VA_ARGS__; input(__VA_ARGS__); #define INT(...) int __VA_ARGS__; input(__VA_ARGS__); #define VLL0(...) ; #define VLL1(a,x,...) vll a(x);input(a); #define VLL2(a,x,b,x_,...)vll a(x),b(x_);input(a,b); #define VLL3(a,x,b,x_,c,x__,...)vll a(x),b(x_),c(x__);input(a,b,c); #define VLL4(a,x,b,x_,c,x__,d,x___,...)vll a(x),b(x_),c(x__),d(x___);input(a,b,c,d); #define VLL(...) overload8(__VA_ARGS__,VLL4,VLL0,VLL3,VLL0,VLL2,VLL0,VLL1)(__VA_ARGS__); #define vrep(i,x) for(auto i:x) #define vsrep(i,x) for(auto &i:x) #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define Endl endl #define endl "\n" #endif