This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC target("avx2,bmi2")
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define getchar_unlocked() getchar()
#endif
inline int read() {
  int x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    ch = getchar_unlocked();
  }
  while (ch >= '0' && ch <= '9') {
	x = (x << 3) + (x << 1) + ch - '0';
	ch = getchar_unlocked();
  }
  return x;
}
int x[10000000], y[10000000];
const int inf = 1e9;
using T = pair<int, int>;
int main() {
  int n = read();
  for (int i = 0; i < n; i++) {
	x[i] = read();
	y[i] = read();
  }
  vector<pair<int, int>> ds(n);
  for (int i = 0; i < n; i++) {
    ds[i] = make_pair(x[i] - y[i], x[i] + y[i]);
  }
  sort(ds.begin(), ds.end(), [](const T& a, const T& b) {
    if (a.first == b.first) {
      return (a.second > b.second);
    }
    return (a.first < b.first);
  });
  int mx = -inf, ans = 0;
  for (int i = 0; i < n; i++) {
    if (mx < ds[i].second) {
      ans++;
    }
    mx = max(mx, ds[i].second);
  }
  cout << ans << '\n';
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |