Language: C++

using namespace std;

int main()
{
	int N, count1 = 0, count2 = 0, ans;
	vector<int> X(10000),L(100000);
	cin >> N;
	vector<pair<int, int>> p(N);


	
	for (int i = 0; i < N; i++) {
		cin >> X[i] >> L[i];
	}

	for (int i = 0; i < N ; i++){
		p[i] = make_pair(X[i], L[i]);
}

	sort(p.begin(), p.end());

	for (int i = 0; i < N; i++) {
		X[i] = p[i].first;
		L[i] = p[i].second;
	}
	
	for (int i=1; i < N-1; i++) {
		if (X[i] - L[i]<X[i - 1] + L[i - 1] && X[i] + L[i] > X[i + 1] - L[i + 1]) {
			count2++;
			cout << count2 << endl;
		}
	}
	for (int i = 0; i < N-1; i++) {
		if (X[i] + L[i] > X[i + 1] - L[i + 1]) {
			count1++;
			cout << count1 << endl;
		}
	}
	ans = N-(count1 - count2);

	cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'vector' was not declared in this scope
    6 |         vector<int> X(10000),L(100000);
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:6:16: error: expected primary-expression before 'int'
    6 |         vector<int> X(10000),L(100000);
      |                ^~~
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> N;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:8:16: error: 'pair' was not declared in this scope
    8 |         vector<pair<int, int>> p(N);
      |                ^~~~
a.cc:1:1: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
  +++ |+#include <utility>
    1 | using namespace std;
a.cc:8:21: error: expected primary-expression before 'int'
    8 |         vector<pair<int, int>> p(N);
      |                     ^~~
a.cc:13:24: error: 'X' was not declared in this scope
   13 |                 cin >> X[i] >> L[i];
      |                        ^
a.cc:13:32: error: 'L' was not declared in this scope
   13 |                 cin >> X[i] >> L[i];
      |                                ^
a.cc:17:17: error: 'p' was not declared in this scope
   17 |                 p[i] = make_pair(X[i], L[i]);
      |                 ^
a.cc:17:34: error: 'X' was not declared in this scope
   17 |                 p[i] = make_pair(X[i], L[i]);
      |                                  ^
a.cc:17:40: error: 'L' was not declared in this scope
   17 |                 p[i] = make_pair(X[i], L[i]);
      |                                        ^
a.cc:17:24: error: 'make_pair' was not declared in this scope
   17 |                 p[i] = make_pair(X[i], L[i]);
      |                        ^~~~~~~~~
a.cc:17:24: note: 'std::make_pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>'
a.cc:20:14: error: 'p' was not declared in this scope
   20 |         sort(p.begin(), p.end());
      |              ^
a.cc:20:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   20 |         sort(p.begin(), p.end());
      |         ^~~~
      |         short
a.cc:23:17: error: 'X' was not declared in this scope
   23 |                 X[i] = p[i].first;
      |                 ^
a.cc:24:17: error: 'L' was not declared in this scope
   24 |                 L[i] = p[i].second;
      |                 ^
a.cc:28:21: error: 'X' was not declared in this scope
   28 |                 if (X[i] - L[i]<X[i - 1] + L[i - 1] && X[i] + L[i] > X[i + 1] - L[i + 1]) {
      |                     ^
a.cc:28:28: error: 'L' was not declared in this scope
   28 |                 if (X[i] - L[i]<X[i - 1] + L[i - 1] && X[i] + L[i] > X[i + 1] - L[i + 1]) {
      |                            ^
a.cc:30:25: error: 'cout' was not declared in this scope
   30 |                         cout << count2 << endl;
      |                         ^~~~
a.cc:30:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:43: error: 'endl' was not declared in this scope
   30 |                         cout << count2 << endl;
      |                                           ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:34:21: error: 'X' was not declared in this scope
   34 |                 if (X[i] + L[i] > X[i + 1] - L[i + 1]) {
      |                     ^
a.cc:34:28: error: 'L' was not declared in this scope
   34 |                 if (X[i] + L[i] > X[i + 1] - L[i + 1]) {
      |                            ^
a.cc:36:25: error: 'cout' was not declared in this scope
   36 |                         cout << count1 << endl;
      |                         ^~~~
a.cc:36:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:36:43: error: 'endl' was not declared in this scope
   36 |                         cout << count1 << endl;
      |                                           ^~~~
a.cc:36:43: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:41:9: error: 'cout' was not declared in this scope
   41 |         cout << ans << endl;
      |         ^~~~
a.cc:41:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:41:24: error: 'endl' was not declared in this scope
   41 |         cout << ans << endl;
      |                        ^~~~
a.cc:41:24: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'