Language: C++

#include <iostream>
#include <string>
#include <vector>

int main()
{    
    int n, x, y;
    cin >> n;
    vector<pair<int, int>> p;
    for (int i = 0; i < n; i++) {
        cin >> x >> y;
        p.push_back(pair<int, int>(x, y));
    }
    vector<int> arr(n);
    vector<int> skip;
    for (int i = 0; i < n - 1; i++) {
        if (count(skip.begin(), skip.end(), i))
            continue;
        vector<int> group;
        int count = 1;
        group.push_back(i);
        for (int j = i + 1; j < n; j++) {
            if ((p[i].first > p[j].first && p[i].second > p[j].second) || (p[i].first < p[j].first && p[i].second < p[j].second)) {
                count++;
                group.push_back(j);
                skip.push_back(j);
            }
        }
        for (int k : group) {
            arr[k] = count;
        }
    }
    for (int i = 0; i < arr.size(); i++) {
        cout << arr[i] << "\n";
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |     cin >> n;
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<pair<int, int>> p;
      |     ^~~~~~
a.cc:9:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:9:12: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    9 |     vector<pair<int, int>> p;
      |            ^~~~
      |            std::pair
In file included from /usr/include/c++/14/string:48,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stl_iterator.h:3013:12: note: 'std::pair' declared here
 3013 |     struct pair;
      |            ^~~~
a.cc:9:17: error: expected primary-expression before 'int'
    9 |     vector<pair<int, int>> p;
      |                 ^~~
a.cc:12:9: error: 'p' was not declared in this scope
   12 |         p.push_back(pair<int, int>(x, y));
      |         ^
a.cc:12:26: error: expected primary-expression before 'int'
   12 |         p.push_back(pair<int, int>(x, y));
      |                          ^~~
a.cc:12:31: error: expected primary-expression before 'int'
   12 |         p.push_back(pair<int, int>(x, y));
      |                               ^~~
a.cc:14:12: error: expected primary-expression before 'int'
   14 |     vector<int> arr(n);
      |            ^~~
a.cc:15:12: error: expected primary-expression before 'int'
   15 |     vector<int> skip;
      |            ^~~
a.cc:17:19: error: 'skip' was not declared in this scope
   17 |         if (count(skip.begin(), skip.end(), i))
      |                   ^~~~
a.cc:17:13: error: 'count' was not declared in this scope
   17 |         if (count(skip.begin(), skip.end(), i))
      |             ^~~~~
a.cc:19:16: error: expected primary-expression before 'int'
   19 |         vector<int> group;
      |                ^~~
a.cc:21:9: error: 'group' was not declared in this scope
   21 |         group.push_back(i);
      |         ^~~~~
a.cc:23:18: error: 'p' was not declared in this scope
   23 |             if ((p[i].first > p[j].first && p[i].second > p[j].second) || (p[i].first < p[j].first && p[i].second < p[j].second)) {
      |                  ^
a.cc:26:17: error: 'skip' was not declared in this scope
   26 |                 skip.push_back(j);
      |                 ^~~~
a.cc:30:13: error: 'arr' was not declared in this scope
   30 |             arr[k] = count;
      |             ^~~
a.cc:33:25: error: 'arr' was not declared in this scope
   33 |     for (int i = 0; i < arr.size(); i++) {
      |                         ^~~
a.cc:34:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   34 |         cout << arr[i] << "\n";
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~