#include using namespace std; bool stB; namespace SOL { void debug(const char *msg, ...) { #ifdef CLESIP va_list arg; static char pbString[512]; va_start(arg,msg); vsprintf(pbString,msg,arg); cerr << "[DEBUG] " << pbString << "\n"; va_end(arg); #endif } using i64 = long long; using i128 = __int128_t; template bool chkmax(T &x, L y) { if (x < y) return x = y, true; return false; } template bool chkmin(T &x, L y) { if (y < x) return x = y, true; return false; } const int N = 2e5 + 10; const int maxv = 2e5; int n, mx[N]; vector val[N]; void ___solve() { cin >> n; for (int i = 1, a, b; i <= n; i ++) { cin >> a >> b; val[a].push_back(b); } i64 ans = 0; for (int i = 1; i <= maxv; i ++) if (!val[i].empty()) { sort(begin(val[i]), end(val[i]), greater()); if ((int) val[i].size() >= 2) chkmax(ans, val[i][1]); mx[i] = val[i][0]; } for (int d = 1; d <= maxv; d ++) { vector> vec; for (int i = d; i <= maxv; i += d) if (mx[i]) vec.push_back({ i / d, mx[i] }); if (vec.empty()) continue; sort(begin(vec), end(vec), [&](array lhs, array rhs) { return 1ll * lhs[0] * lhs[1] < 1ll * rhs[0] * rhs[1]; }); int mxv = 0; for (auto [x, y] : vec) { chkmax(ans, mxv / x); chkmax(mxv, y); } // for (int i = 0; i < (int) vec.size(); i ++) // for (int j = i + 1; j < (int) vec.size(); j ++) // chkmax(ans, min(vec[i][1] / vec[j][0], vec[j][1] / vec[i][0])); } cout << ans << "\n"; } } bool edB; signed main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); SOL::___solve(); #ifdef CLESIP // cerr << "Memory: " << (&stB - &edB) / 1024.0 / 1024.0 << "MB\n"; // cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n"; #endif return 0; } /* Aix = Ajy d = gcd(Ai, Aj) min( Bi / (Aj / d) ,Bj / (Ai / d) ) is max n log n (x, y) min(x1 / y2, x2 / y1) is max x1 / y2 > x2 / y1 x1 * y1 > x2 * y2 sort by x1 * y1 and remove the min limitation then the problem is to find the maximum x2, which is quite simple */