Language: C++

#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<pair<int, int>> red(N), blue(N);
  for(int i = 0; i < N; i++) {
    cin >> red.at(i).first >> red.at(i).last;
  }
  for(int i = 0; i < N; i++) {
    cin >> blue.at(i).first >> blue.at(i).last;
  }
  sort(red.begin(), red.end());
  sort(blue.begin(), blue.end());
  int count = 0;
  for(int i = N; i >= 0; i--) {
    for(int j = red.size(); j >= 0; j--) {
      if(blue.at(i).first == red.at(j).first && blue.at(i).last == red.at(j).last) {
        count++;
        red.erase(j);
        break;
      }
    }
  }
  
  cout << count << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:41: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'last'
    8 |     cin >> red.at(i).first >> red.at(i).last;
      |                                         ^~~~
a.cc:11:43: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'last'
   11 |     cin >> blue.at(i).first >> blue.at(i).last;
      |                                           ^~~~
a.cc:18:60: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'last'
   18 |       if(blue.at(i).first == red.at(j).first && blue.at(i).last == red.at(j).last) {
      |                                                            ^~~~
a.cc:18:78: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'last'
   18 |       if(blue.at(i).first == red.at(j).first && blue.at(i).last == red.at(j).last) {
      |                                                                              ^~~~
a.cc:20:18: error: no matching function for call to 'std::vector<std::pair<int, int> >::erase(int&)'
   20 |         red.erase(j);
      |         ~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; iterator = std::vector<std::pair<int, int> >::iterator; const_iterator = std::vector<std::pair<int, int> >::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::pair<int, int> >::const_iterator'
 1536 |       erase(const_iterator __position)
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; iterator = std::vector<std::pair<int, int> >::iterator; const_iterator = std::vector<std::pair<int, int> >::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note:   candidate expects 2 arguments, 1 provided