#include using namespace std; const long double EPS = 1e-14; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; while(n--){ int a, b; cin >> a >> b; int ok = 65000, ng = 0; while(ok - ng > 1){ int mid = (ok + ng) / 2; if(sqrtl(a) + sqrt(b) < mid - EPS){ ok = mid; }else{ ng = mid; } } cout << ok << endl; } }