#include using namespace std; typedef long long ll; #define rep(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++) #define rrep(i,a,b) for(ll i=(ll)(a-1);i>=(ll)(b);i--) #define MOD 998244353 //#define MOD 1e9+7 #define INF 1e16 //#define PI numbers::pi //#define E numbers::e template bool chmax(T& a,T b){if(a bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} int main(){ ll n; cin >> n; while(n--){ ll a,b; cin >> a >> b; double m=2*sqrt(a*b); ll x=sqrt(a+b+m); cout << x+1 << endl; } }