#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll N=1e5;
ll pre[N];
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
ll T;
cin>>T;
for(ll i=1;i<=N;i++){
if(i*i%2!=0)pre[i]=i*i/2+1;
else pre[i]=i*i/2;
}
while(T--){
ll a,b;
cin>>a>>b;
ll q=max(a,b);
ll p=min(a,b);
ll l=0,r=1e5;
while(l+1!=r){
ll m=(l+r)/2;
if(pre[m]<q){
l=m;
}else{
r=m;
}
}
if(a+b>r*r)cout<<r+1<<'\n';
else cout<<r<<'\n';
}
return 0;
}

京公网安备 11010502036488号