#include #include using namespace std; using ll = long long; using ld = long double; using st = string; using mint = atcoder::modint998244353; using Mint = atcoder::modint1000000007; #define vl vector #define vvl vector> #define vd vector #define vvd vector> #define vb vector #define vvb vector> #define vs vector #define vp vector> #define vvp vector>> #define vm vector #define vvm vector> #define vM vector #define vvM vector> #define chmax(n,v) n=nv?v:n #define all(n) begin(n),end(n) #define nxp(a) next_permutation(all(a)) #define rev(n) reverse(all(n)) #define sor(n) stable_sort(all(n)) #define rep(i,n) for(ll i=0;i<(n);++i) #define reprev(i,n) for(ll i=n-1;0<=i;--i) #define rrep(i,a,n) for(ll i=a;i<(n);++i) #define sz(n) n.size() #define bit(n,shift) ((n&(1< void input(T &a) { cin >> a; }; template void input(T1&a, T2 &...b) { cin >> a; input(b...); }; const ll inf = 1e18; //std::setprecision(13); 出力桁を増やす //2^29<10^9 ll di[8]={1,-1,0,0,1,1,-1,-1}; ll dj[8]={0,0,1,-1,1,-1,-1,1}; //ll da[4]={1,1,-1,-1}; //ll db[4]={1,-1,-1,1}; //ll na[4]={1,0,1,0}; //ll nb[4]={0,1,0,1}; template vector rd(size_t n) { vector ts(n); for (size_t i = 0; i < n; i++) cin >> ts[i]; return ts; } bool is_prime(ll N) { if (N == 1) return false; for (ll i = 2; i * i <= N; ++i) { if (N % i == 0) return false; } return true; } int calc_digit(ll N){ int res = 0; while(N>0){ res++; N/=10; } return res; } ll factorial(ll n, ll mod = 1e18) { ll ans = 1; for(ll i = n; i >= 2; i--) ans = (ans * i) % mod; return ans; } void printl(vl v){ ll vsz=v.size(); for(ll i=0;i par; vector size; UnionFind(ll n){ par.resize(2*(n+1),-1); size.resize(2*(n+1),1); } ll root(ll x){ if (par[x]==-1) return x; return par[x]=root(par[x]); } void unite(ll u,ll v){ ll uu=root(u),vv=root(v); if(uu==vv){ return; } if(size[uu]> prime_factorize(ll N){ vector > res; for (ll a = 2; a * a <= N; ++a) { if (N % a != 0) continue; ll ex = 0; while (N % a == 0) { ex++; N /= a; } res.push_back({a, ex}); } if (N != 1) res.push_back({N, 1}); return res; } vl p_list(ll n){ vl res; vb check(n+1); for(ll i=2;i<=n;i++){ if(check[i]) continue; res.push_back(i); ll ii=i; while(ii<=n){ check[ii]=true; ii+=i; } } return res; } ll sum_v(vl a){ ll res=0; ll n=sz(a); rep(i,n) res+=a[i]; return res; } vl cumulative_sum(vl a){ ll s=sz(a); vl b(s+1,0); for(ll i=0;ii;j--){ if(a[j-1]>a[j]){ swap(a[j-1],a[j]); res++; } } } return res; } ll bi_search(unsigned &a,unsigned &b){ unsigned ng=2,ok=70000; while(ok-ng>1){ unsigned mid=(ok+ng)/2; unsigned y=(mid*mid)-a-b; if(4*a*ba+b) ok=mid; else ng=mid; } return ok; } int main(){ unsigned n,a,b; cin >> n; rep(i,n){ cin >> a >> b; unsigned ng=2,ok=70000; while(ok-ng>1){ unsigned mid=(ok+ng)/2; unsigned y=(mid*mid)-a-b; if(4*a*ba+b) ok=mid; else ng=mid; } cout << ok << endl; } }