Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    array<int,2> red(2*n),blue(2*n);
    for(int i=0;i<n;i++)cin >> red[i][0] >> red[i][1];
    for(int i=0;i<n;i++)cin >> blue[i][0] >> blue[i][1];
    sort(red.begin(),red.end());
    sort(blue.begin(),red.end());

    int ans;
    int red_max_y=0;
    int i,j;
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            if(red[j][0]<blue[i][0]&&red[j][1]<blue[i][1])
            {
                if(red_max_y<red[j][1])ans=j;
                red_max_y=max(red_max_y,red[j][1]);
            }
        }
        blue[ans][1]=-1;
    }

    ans=0
    for(i=0;i<n;i++)
    {
        if(blue[i]==-1)
        {
        ans++;
        }
    }

    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:7:25: error: no matching function for call to 'std::array<int, 2>::array(int)'
    7 |     array<int,2> red(2*n),blue(2*n);
      |                         ^
In file included from /usr/include/c++/14/functional:65,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/array:100:12: note: candidate: 'std::array<int, 2>::array()'
  100 |     struct array
      |            ^~~~~
/usr/include/c++/14/array:100:12: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/array:100:12: note: candidate: 'constexpr std::array<int, 2>::array(const std::array<int, 2>&)'
/usr/include/c++/14/array:100:12: note:   no known conversion for argument 1 from 'int' to 'const std::array<int, 2>&'
/usr/include/c++/14/array:100:12: note: candidate: 'constexpr std::array<int, 2>::array(std::array<int, 2>&&)'
/usr/include/c++/14/array:100:12: note:   no known conversion for argument 1 from 'int' to 'std::array<int, 2>&&'
a.cc:7:35: error: no matching function for call to 'std::array<int, 2>::array(int)'
    7 |     array<int,2> red(2*n),blue(2*n);
      |                                   ^
/usr/include/c++/14/array:100:12: note: candidate: 'std::array<int, 2>::array()'
  100 |     struct array
      |            ^~~~~
/usr/include/c++/14/array:100:12: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/array:100:12: note: candidate: 'constexpr std::array<int, 2>::array(const std::array<int, 2>&)'
/usr/include/c++/14/array:100:12: note:   no known conversion for argument 1 from 'int' to 'const std::array<int, 2>&'
/usr/include/c++/14/array:100:12: note: candidate: 'constexpr std::array<int, 2>::array(std::array<int, 2>&&)'
/usr/include/c++/14/array:100:12: note:   no known conversion for argument 1 from 'int' to 'std::array<int, 2>&&'
a.cc:8:38: error: invalid types 'std::array<int, 2>::value_type {aka int}[int]' for array subscript
    8 |     for(int i=0;i<n;i++)cin >> red[i][0] >> red[i][1];
      |                                      ^
a.cc:8:51: error: invalid types 'std::array<int, 2>::value_type {aka int}[int]' for array subscript
    8 |     for(int i=0;i<n;i++)cin >> red[i][0] >> red[i][1];
      |                                                   ^
a.cc:9:39: error: invalid types 'std::array<int, 2>::value_type {aka int}[int]' for array subscript
    9 |     for(int i=0;i<n;i++)cin >> blue[i][0] >> blue[i][1];
      |                                       ^
a.cc:9:53: error: invalid types 'std::array<int, 2>::value_type {aka int}[int]' for array subscript
    9 |     for(int i=0;i<n;i++)cin >> blue[i][0] >> blue[i][1];
      |                                                     ^
a.cc:20:22: error: invalid types 'std::array<int, 2>::value_type {aka int}[int]' for array subscript
   20 |             if(red[j][0]<blue[i][0]&&red[j][1]<blue[i][1])
      |                      ^
a.cc:20:33: error: invalid types 'std::array<int, 2>::value_type {aka int}[int]' for array subscript
   20 |             if(red[j][0]<blue[i][0]&&red[j][1]<blue[i][1])
      |                                 ^
a.cc:20:44: error: invalid types 'std::array<int, 2>::value_type {aka int}[int]' for array subscript
   20 |             if(red[j][0]<blue[i][0]&&red[j][1]<blue[i][1])
      |                                            ^
a.cc:20:55: error: invalid types 'std::array<int, 2>::value_type {aka int}[int]' for array subscript
   20 |             if(red[j][0]<blue[i][0]&&red[j][1]<blue[i][1])
      |                                                       ^
a.cc:22:36: error: invalid types 'std::array<int, 2>::value_type {aka int}[int]' for array subscript
   22 |                 if(red_max_y<red[j][1])ans=j;
      |                                    ^
a.cc:23:47: error: invalid types 'std::array<int, 2>::value_type {aka int}[int]' for array subscript
   23 |                 red_max_y=max(red_max_y,red[j][1]);
      |                                               ^
a.cc:26:18: error: invalid types 'std::array<int, 2>::value_type {aka int}[int]' for array subscript
   26 |         blue[ans][1]=-1;
      |                  ^
a.cc:29:10: error: expected ';' before 'for'
   29 |     ans=0
      |          ^
      |          ;
   30 |     for(i=0;i<n;i++)
      |     ~~~   
a.cc:30:20: error: expected ';' before ')' token
   30 |     for(i=0;i<n;i++)
      |                    ^
      |                    ;