#include using namespace std; using ll = unsigned long long; using P = pair; #define fix(x) fixed << setprecision(x) #define asc(x) x, vector, greater #define rep(i, n) for(ll i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> n; rep(i,n){ ll a,b; cin >> a >> b; ll ng = 0, ok = 64000; while(ok-ng>1){ ll md = (ok+ng)/2; if((md*md-a-b)<0) ng = md; else if(4*a*b<(md*md-a-b)*(md*md-a-b)) ok = md; else ng = md; } cout << ok << '\n'; } return 0; }