#include #include #include using namespace std; using ll = long long; using ull = unsigned long long; void solve() { ll a, b; cin >> a >> b; ull min_x = max(1, sqrt(a) + sqrt(b) - 1); ull x = min_x; while(1) { ull x4 = x * x * x * x; ull sb = 2 * x * x * (a + b); if (a == b) { if (x4 > sb) { // x4 - sb > 0 cout << x << endl; return; } } else { if (x4 >= sb) { // x4 - sb >= 0 cout << x << endl; return; } } x += 1; } } int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { solve(); } return 0; }