#include using namespace std; int main(void) { int N; cin >> N; for(int i = 0; i < N; i++){ uint64_t A, B, mid; cin >> A >> B; int ok = 1e5, ng = 2; while (abs(ok - ng) > 1) { mid = (ok + ng) / 2; uint64_t Y = ((mid * mid) - A - B); if (4 * A * B < Y * Y && mid * mid > A + B) { ok = mid; } else { ng = mid; } } cout << ok << endl; } }