Language: C++

#include <iostream>
#include <algorithm>
#include <list>

struct Point{
  int x;
  int y;
}
struct Pair{
  point red;
  point blue;
}

int N;
std::list<Point> reds;
std::list<Point> blues;
std::list<Pair> pairs;
typedef std::list<Point>::iterator ItP;

bool cmpYDescendant(const Point &left, const Point &right) {
    return left.y > right.y;
}
 
bool cmpXAscendant(const Point &left, const Point &right) {
    return left.x < right.x;
}

int main(){
	point p;
  	cin>>N;
  	for(int i=0;i<N;i++){
      std::cin>>p.x>>p.y;
      reds.push_back(p)
    }
  	for(int i=0;i<N;i++){
		std::cin>>p.x>>p.y;
      	blues.push_back(p)
    }
  	reds.sort(cmpYDescendant);
  	blue.sort(cmpXAscendant);
  	ItP it_b = blues.begin();
  	while(it_b != blues.end()) {
        bool found = false;
        ItP it_r = reds.begin();
 
        while(it_r != reds.end()) {
            if ((*it_r).x < (*it_b).x && (*it_r).y < (*it_b).y) {
                Pair p;
 
                found = true;
                p.red = *it_r;
                p.blue = *it_b;
                pairs.push_back(p);
                reds.erase(it_r);
                break;
            }
 
            ++it_r;
        }
 
        ++it_b
    }
 
    std::cout << pairs.size() << endl;
}
        



Compiler output:
a.cc:8:2: error: expected ';' after struct definition
    8 | }
      |  ^
      |  ;
a.cc:10:3: error: 'point' does not name a type; did you mean 'Point'?
   10 |   point red;
      |   ^~~~~
      |   Point
a.cc:11:3: error: 'point' does not name a type; did you mean 'Point'?
   11 |   point blue;
      |   ^~~~~
      |   Point
a.cc:12:2: error: expected ';' after struct definition
   12 | }
      |  ^
      |  ;
a.cc: In function 'int main()':
a.cc:29:9: error: 'point' was not declared in this scope; did you mean 'Point'?
   29 |         point p;
      |         ^~~~~
      |         Point
a.cc:30:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   30 |         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:32:17: error: 'p' was not declared in this scope
   32 |       std::cin>>p.x>>p.y;
      |                 ^
a.cc:36:27: error: 'p' was not declared in this scope
   36 |                 std::cin>>p.x>>p.y;
      |                           ^
a.cc:40:9: error: 'blue' was not declared in this scope; did you mean 'blues'?
   40 |         blue.sort(cmpXAscendant);
      |         ^~~~
      |         blues
a.cc:51:19: error: 'struct Pair' has no member named 'red'
   51 |                 p.red = *it_r;
      |                   ^~~
a.cc:52:19: error: 'struct Pair' has no member named 'blue'
   52 |                 p.blue = *it_b;
      |                   ^~~~
a.cc:61:15: error: expected ';' before '}' token
   61 |         ++it_b
      |               ^
      |               ;
   62 |     }
      |     ~          
a.cc:64:34: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   64 |     std::cout << pairs.size() << endl;
      |                                  ^~~~
      |                                  std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~