#include using namespace std; #define all(v) (v).begin(),(v).end() #define rep(i, n) for(int i=0;i> n; vector B(N, 0); rep(i, n) { int a, b; cin >> a >> b; ans = max(ans, min(b, B[a])); B[a] = max(B[a], b); } vector> v; for(ll i = 1; i < N; i ++) if(B[i]) { v.push_back({i * B[i], i}); } sort(all(v)); reverse(all(v)); vector exist(M, 0); for(auto [Max, x] : v) { for(int i = x; i < M; i += x) if(exist[i]) { ans = max(ans, (int)(Max / i)); break; } for(int i = x; i < M; i += x) { exist[i] = 1; } } cout << ans << endl; return 0; }