#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; long double m=2*sqrt(a*b); ll small=0,big=70000; while(big-small>1){ ll x=(big+small)/2; if(a+b+2