// TLE // #pragma GCC target("avx2") // Compile Error? #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #include constexpr int M = 1000010; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::vector> ps(n); for (auto &[a, b] : ps) { std::cin >> a >> b; } int max_num = -1; int argmax = -1; for (int mod = 1; mod <= M; ++mod) { int num = 0; for (const auto &[a, b] : ps) { num += (a % mod) < (b % mod); } if (num > max_num) { max_num = num; argmax = mod; } } std::cout << argmax << '\n'; }