Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef std::pair<ll,ll> P;
using namespace std;
using ll = long long;





// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
// combination mod prime
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};


int main(){
    int n;
    vector<vector<int>> graph;
    vector<P> counter;
    cin >> n;
    vector<P> xl;
    rep(i,n){
        ll x,l;
        cin >> x >> l;
        xl.pb(P(x,l));
    }
    SORT(xl);
    
    rep(i,n){
        int cnt = 0;
        vector<int> to;
        int j = i + 1;
        while(xl[i].fi + xl[i].se > xl[j].fi - xl[j].se && j < n){
            cnt++;
            to.pb(j);
            j++;
        }
        j = i - 1;
        while(xl[i].fi - xl[i].se < xl[j].fi+ xl[j].se && j >= 0){
            cnt++;
            to.pb(j);
            j--;
        }
        graph.pb(to);
        counter.pb(mp(cnt,i));
    }
    
    SORTR(counter);
    int ans = 0;
    vector<int> NOTcleared(n,1);
    rep(i,n){
        if (counter[i].fi > 0 && NOTcleared[i]){
            ans++;
            int index = counter[i].se;
            NOTcleared[index] = 0;
            rep(j,graph[index].size()){
                NOTcleared[graph[index][j]] = 0;
            }
        }
    }
    cout << n-ans;
    
}


Compiler output:
a.cc:30:19: error: 'll' was not declared in this scope
   30 | typedef std::pair<ll,ll> P;
      |                   ^~
a.cc:30:22: error: 'll' was not declared in this scope
   30 | typedef std::pair<ll,ll> P;
      |                      ^~
a.cc:30:24: error: template argument 1 is invalid
   30 | typedef std::pair<ll,ll> P;
      |                        ^
a.cc:30:24: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:116:20: error: expression list treated as compound expression in functional cast [-fpermissive]
  116 |         xl.pb(P(x,l));
      |                    ^
a.cc:24:12: error: request for member 'first' in 'xl.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   24 | #define fi first
      |            ^~~~~
a.cc:124:21: note: in expansion of macro 'fi'
  124 |         while(xl[i].fi + xl[i].se > xl[j].fi - xl[j].se && j < n){
      |                     ^~
a.cc:25:12: error: request for member 'second' in 'xl.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 | #define se second
      |            ^~~~~~
a.cc:124:32: note: in expansion of macro 'se'
  124 |         while(xl[i].fi + xl[i].se > xl[j].fi - xl[j].se && j < n){
      |                                ^~
a.cc:24:12: error: request for member 'first' in 'xl.std::vector<int>::operator[](((std::vector<int>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   24 | #define fi first
      |            ^~~~~
a.cc:124:43: note: in expansion of macro 'fi'
  124 |         while(xl[i].fi + xl[i].se > xl[j].fi - xl[j].se && j < n){
      |                                           ^~
a.cc:25:12: error: request for member 'second' in 'xl.std::vector<int>::operator[](((std::vector<int>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 | #define se second
      |            ^~~~~~
a.cc:124:54: note: in expansion of macro 'se'
  124 |         while(xl[i].fi + xl[i].se > xl[j].fi - xl[j].se && j < n){
      |                                                      ^~
a.cc:24:12: error: request for member 'first' in 'xl.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   24 | #define fi first
      |            ^~~~~
a.cc:130:21: note: in expansion of macro 'fi'
  130 |         while(xl[i].fi - xl[i].se < xl[j].fi+ xl[j].se && j >= 0){
      |                     ^~
a.cc:25:12: error: request for member 'second' in 'xl.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 | #define se second
      |            ^~~~~~
a.cc:130:32: note: in expansion of macro 'se'
  130 |         while(xl[i].fi - xl[i].se < xl[j].fi+ xl[j].se && j >= 0){
      |                                ^~
a.cc:24:12: error: request for member 'first' in 'xl.std::vector<int>::operator[](((std::vector<int>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   24 | #define fi first
      |            ^~~~~
a.cc:130:43: note: in expansion of macro 'fi'
  130 |         while(xl[i].fi - xl[i].se < xl[j].fi+ xl[j].se && j >= 0){
      |                                           ^~
a.cc:25:12: error: request for member 'second' in 'xl.std::vector<int>::operator[](((std::vector<int>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 | #define se second
      |            ^~~~~~
a.cc:130:53: note: in expansion of macro 'se'
  130 |         while(xl[i].fi - xl[i].se < xl[j].fi+ xl[j].se && j >= 0){
      |                                                     ^~
a.cc:136:19: error: no matching function for call to 'std::vector<int>::push_back(std::pair<int, int>)'
  136 |         counter.pb(mp(cnt,i));
      |         ~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:24:12: error: request for member 'first' in 'counter.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   24 | #define fi first
      |            ^~~~~
a.cc:143:24: note: in expansion of macro 'fi'
  143 |         if (counter[i].fi > 0 && NOTcleared[i]){
      |                        ^~
a.cc:25:12: error: request for member 'second' in 'counter.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 | #define se second
      |            ^~~~~~
a.cc:145:36: note: in expansion of macro 'se'
  145 |             int index = counter[i].se;
      |                                    ^~