#ifdef SENJAN #define _GLIBCXX_DEBUG #else #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #endif #include #include #include using namespace std; using namespace atcoder; using ll=long long; using ull=unsigned long long; using ld=long double; using bint = boost::multiprecision::cpp_int; using graph=vector>; template using min_priority_queue=priority_queue,greater>; constexpr int INF32=INT_MAX/2; constexpr ll INF64=LLONG_MAX/2; constexpr ld PI=3.14159265358979323846; constexpr int dx[]={0,0,-1,1,-1,-1,1,1},dy[]={-1,1,0,0,-1,1,-1,1}; template inline bool chmax(T &a,T b){return a inline bool chmin(T &a,T b){return a>b?a=b,true:false;} inline void dispYN(bool a){cout<<(a?"YES":"NO")<sync_with_stdio(0);cout<> n; while(n--){ ll a, b; cin >> a >> b; // square = a+b+2*sqrt(a*b) ll l1=0, r1=1LL<<30; while(r1-l1>1){ ll m = (l1+r1)/2; if(m*m<=4*a*b) l1=m; else r1=m; } // sqare < a+b+r1 ll l2=0, r2=1LL<<30; while(r2-l2>1){ ll m=(l2+r2)/2; if(m*m