#include #include #include #include template std::map compress(std::vector& v) { std::sort(v.begin(), v.end()); v.erase(std::unique(v.begin(), v.end()), v.end()); std::map rev; for (int i = 0; i < (int)v.size(); ++i) rev[v[i]] = i; return rev; } void solve() { int n; std::cin >> n; std::vector> ps(n); std::vector xs; for (auto& p : ps) { int x, r; std::cin >> x >> r; x *= 2, r *= 2; p.first = x - r + 1; p.second = x + r; xs.push_back(p.first); xs.push_back(p.second); } auto revx = compress(xs); int m = xs.size(); std::vector imos(m + 1, 0); for (auto& p : ps) { ++imos[revx[p.first]]; --imos[revx[p.second]]; } for (int i = 0; i < m; ++i) { imos[i + 1] += imos[i]; } std::cout << *std::max_element(imos.begin(), imos.end()) << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }