#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; using mint = modint998244353; void solve() { u_int64_t A, B; cin >> A >> B; int ok = 70000, ng = 2; while (abs(ok - ng) > 1) { int mid = (ok + ng) / 2; u_int64_t Y = ((mid * mid) - A - B); if (4 * A * B < Y * Y && mid * mid > A + B) { ok = mid; } else { ng = mid; } } cout << ok << endl; } int main() { int N; cin >> N; while (N--) { solve(); } return 0; }