Language: C++

#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define LL long long
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int N;
vector<pair<int,int>() > R,B;
bool used[100];
int main(){
  cin>>N;
  FOR(i,0,N){
    int a,b;
    cin>>a>>b;
    R.PB(make_pair(a,b));
  }
  FOR(i,0,N){
    int c,d;
    cin>>c>>d;
    B.PB(make_pair(c,d));
  }
  sort(R.begin(),R.end());
  sort(B.begin(),B.end());
  int ans=0;
  ROF(i,0,N){
    ROF(j,0,N){
      if(!used[j]&&R[i].FI<B[j].FI&&R[i].SE<B[j].SE){
        ans++;
        used[j]=true;
        break;
      }else if(R[i].FI>B[j].FI){
        break;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33,
                 from /usr/include/c++/14/bits/allocator.h:46,
                 from /usr/include/c++/14/string:43,
                 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,
                 from a.cc:1:
/usr/include/c++/14/bits/new_allocator.h: In instantiation of 'class std::__new_allocator<std::pair<int, int>()>':
/usr/include/c++/14/bits/allocator.h:128:11:   required from 'class std::allocator<std::pair<int, int>()>'
  128 |     class allocator : public __allocator_base<_Tp>
      |           ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:87:21:   required from 'struct std::_Vector_base<std::pair<int, int>(), std::allocator<std::pair<int, int>()> >'
   87 |         rebind<_Tp>::other _Tp_alloc_type;
      |                            ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:428:11:   required from 'class std::vector<std::pair<int, int>()>'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:23:26:   required from here
   23 | vector<pair<int,int>() > R,B;
      |                          ^
/usr/include/c++/14/bits/new_allocator.h:111:7: error: 'const _Tp* std::__new_allocator<_Tp>::address(const_reference) const [with _Tp = std::pair<int, int>(); const_pointer = std::pair<int, int> (*)(); const_reference = std::pair<int, int> (&)()]' cannot be overloaded with '_Tp* std::__new_allocator<_Tp>::address(reference) const [with _Tp = std::pair<int, int>(); pointer = std::pair<int, int> (*)(); reference = std::pair<int, int> (&)()]'
  111 |       address(const_reference __x) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~
/usr/include/c++/14/bits/new_allocator.h:107:7: note: previous declaration '_Tp* std::__new_allocator<_Tp>::address(reference) const [with _Tp = std::pair<int, int>(); pointer = std::pair<int, int> (*)(); reference = std::pair<int, int> (&)()]'
  107 |       address(reference __x) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~
a.cc: In function 'int main()':
a.cc:30:9: error: no matching function for call to 'std::vector<std::pair<int, int>()>::push_back(std::pair<int, int>)'
   30 |     R.PB(make_pair(a,b));
      |     ~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/queue:63,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>(); _Alloc = std::allocator<std::pair<int, int>()>; value_type = std::pair<int, int>()]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::pair<int, int> (&)()'
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<int, int>(); _Alloc = std::allocator<std::pair<int, int>()>; value_type = std::pair<int, int>()]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::pair<int, int> (&&)()'
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:35:9: error: no matching function for call to 'std::vector<std::pair<int, int>()>::push_back(std::pair<int, int>)'
   35 |     B.PB(make_pair(c,d));
      |     ~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>(); _Alloc = std::allocator<std::pair<int, int>()>; value_type = std::pair<int, int>()]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::pair<int, int> (&)()'
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<int, int>(); _Alloc = std::allocator<std::pair<int, int>()>; value_type = std::pair<int, int>()]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::pair<int, int> (&&)()'
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:10:12: error: request for member 'first' in 'R.std::vector<std::pair<int, int>()>::operator[](((std::vector<std::pair<int, int>()>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int>()>, std::pair<int, int>()>::value_type' {aka 'std::pair<int, int>()'}
   10 | #define FI first
      |            ^~~~~
a.cc:42:25: note: in expansion of macro 'FI'
   42 |       if(!used[j]&&R[i].FI<B[j].FI&&R[i].SE<B[j].SE){
      |                         ^~
a.cc:10:12: error: request for member 'first' in 'B.std::vector<std::pair<int, int>()>::operator[](((std::vector<std::pair<int, int>()>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int>()>, std::pair<int, int>()>::value_type' {aka 'std::pair<int, int>()'}
   10 | #define FI first
      |            ^~~~~
a.cc:42:33: note: in expansion of macro 'FI'
   42 |       if(!used[j]&&R[i].FI<B[j].FI&&R[i].SE<B[j].SE){
      |                                 ^~
a.cc:11:12: error: request for member 'second' in 'R.std::vector<std::pair<int, int>()>::operator[](((std::vector<std::pair<int, int>()>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int>()>, std::pair<int, int>()>::value_type' {aka 'std::pair<int, int>()'}
   11 | #define SE second
      |            ^~~~~~
a.cc:42:42: note: in expansion of macro 'SE'
   42 |       if(!used[j]&&R[i].FI<B[j].FI&&R[i].SE<B[j].SE){
      |                                          ^~
a.cc:11:12: error: request for member 'second' in 'B.std::vector<std::pair<int, int>()>::operator[](((std::vector<std::pair<int, int>()>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int>()>, std::pair<int, int>()>::value_type' {aka 'std::pair<int, int>()'}
   11 | #define SE second
      |            ^~~~~~
a.cc:42:50: note: in expansion of macro 'SE'
   42 |       if(!used[j]&&R[i].FI<B[j].FI&&R[i].SE<B[j].SE){
      |                                                  ^~
a.cc:10:12: error: request for member 'first' in 'R.std::vector<std::pair<int, int>()>::operator[](((std::vector<std::pair<int, int>()>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int>()>, std::pair<int, int>()>::value_type' {aka 'std::pair<int, int>()'}
   10 | #define FI first
      |            ^~~~~
a.cc:46:21: note: in expansion of macro 'FI'
   46 |       }else if(R[i].FI>B[j].FI){
      |                     ^~
a.cc:10:12: error: request for member 'first' in 'B.std::vector<std::pair<int, int>()>::operator[](((std::vector<std::pair<int, int>()>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int>()>, std::pair<int, int>()>::value_type' {aka 'std::pair<int, int>()'}
   10 | #define FI first
      |            ^~~~~
a.cc:46:29: note: in expansion of macro 'FI'
   46 |       }else if(R[i].FI>B[j].FI){
      |                             ^~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h: In instantiation of 'typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type __gnu_cxx::operator-(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&) [with _Iterator = std::pair<int, int> (*)(); _Container = std::vector<std::pair<int, int>()>; typename __normal_iterator<_Iterator, _Container>::difference_type = long int]':
/usr/include/c++/14/bits/stl_algo.h:1906:22:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<int, int> (*)(), vector<pair<int, int>()> >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 1906 |                                 std::__lg(__last - __first) * 2,
      |                                           ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<pair<int, int> (*)(), vector<pair<int, int>()> >]'
 4772 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:37:7:   required from here
   37 |   sort(R.begin(),R.end());
      |   ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1328:27: error: ISO C++ forbids using pointer to a function in subtraction [-fpermissive]
 1328 |     { return __lhs.base() - __rhs.base(); }
      |              ~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<int, int> (*)(), vector<pair<int, int>()> >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1817:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<int, int> (*)(), vector<pair<int,