Language: C++

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

int main(){
    int n;
    cin >> n;
    vector<vector<int,int>> red(n*2),blue(n*2);
    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]==-1)
        {
        ans++;
        }
    }

    cout << ans << endl;
}

Compiler output:
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: In instantiation of 'struct std::_Vector_base<int, int>':
/usr/include/c++/14/bits/stl_vector.h:428:11:   required from 'class std::vector<int, int>'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:8:40:   required from here
    8 |     for(int i=0;i<n;i++)cin >> red[i][0] >> red[i][1];
      |                                        ^
/usr/include/c++/14/bits/stl_vector.h:87:28: error: 'int' is not a class, struct, or union type
   87 |         rebind<_Tp>::other _Tp_alloc_type;
      |                            ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:89:9: error: 'int' is not a class, struct, or union type
   89 |         pointer;
      |         ^~~~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<int, int>':
a.cc:8:40:   required from here
    8 |     for(int i=0;i<n;i++)cin >> red[i][0] >> red[i][1];
      |                                        ^
/usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<int, int>::_Base'
  518 |       using _Base::_M_allocate;
      |                    ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<int, int>::_Base'
  519 |       using _Base::_M_deallocate;
      |                    ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<int, int>::_Base'
  521 |       using _Base::_M_get_Tp_allocator;
      |                    ^~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:8:38: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
    8 |     for(int i=0;i<n;i++)cin >> red[i][0] >> red[i][1];
      |                                      ^
a.cc:8:51: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
    8 |     for(int i=0;i<n;i++)cin >> red[i][0] >> red[i][1];
      |                                                   ^
a.cc:9:39: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
    9 |     for(int i=0;i<n;i++)cin >> blue[i][0] >> blue[i][1];
      |                                       ^
a.cc:9:53: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
    9 |     for(int i=0;i<n;i++)cin >> blue[i][0] >> blue[i][1];
      |                                                     ^
a.cc:20:22: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
   20 |             if(red[j][0]<blue[i][0]&&red[j][1]<blue[i][1])
      |                      ^
a.cc:20:33: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
   20 |             if(red[j][0]<blue[i][0]&&red[j][1]<blue[i][1])
      |                                 ^
a.cc:20:44: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
   20 |             if(red[j][0]<blue[i][0]&&red[j][1]<blue[i][1])
      |                                            ^
a.cc:20:55: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
   20 |             if(red[j][0]<blue[i][0]&&red[j][1]<blue[i][1])
      |                                                       ^
a.cc:22:36: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
   22 |                 if(red_max_y<red[j][1])ans=j;
      |                                    ^
a.cc:23:47: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
   23 |                 red_max_y=max(red_max_y,red[j][1]);
      |                                               ^
a.cc:26:18: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
   26 |         blue[ans][1]=-1;
      |                  ^
a.cc:32:19: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int, int> >, std::vector<int, int> >::value_type' {aka 'std::vector<int, int>'} and 'int')
   32 |         if(blue[i][1]==-1)
      |                   ^
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl(std::_Vector_base<_Tp, _Alloc>::_Vector_impl&&) [with _Tp = int; _Alloc = int]':
/usr/include/c++/14/bits/stl_vector.h:337:7:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<vector<int, int>*, vector<vector<int, int> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
  337 |       _Vector_base(_Vector_base&&) = default;
      |       ^~~~~~~~~~~~
/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<vector<int, int>*, vector<vector<int, int> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<vector<int, int>*, vector<vector<int, int> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 1908 |           std::__final_insertion_sort(__first, __last, __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<vector<int, int>*, vector<vector<int, int> > >]'
 4772 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:9:   required from here
   10 |     sort(red.begin(),red.end());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:154:75: error: 'int' is not a class, struct, or union type
  154 |         : _Tp_alloc_type(std::move(__x)), _Vector_impl_data(std::move(__x))
      |                                                                           ^
In file included from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = int]':
/usr/include/c++/14/bits/stl_construct.h:119:7:   required from 'void std::_Construct(_Tp*, _Args&& ...) [with _Tp = vector<int, int>; _Args = {}]'
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:643:18:   required from 'static _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = std::vector<int, int>*; _Size = long unsigned int; bool _TrivialValueType = false]'
  643 |                 std::_Construct(std::__addressof(*__cur));
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:712:20:   required from '_ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = vector<int, int>*; _Size = long unsigned int]'
  710 |       return __uninitialized_default_n_1<__is_trivial(_ValueType)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  711 |                                          && __can_fill>::
      |                                          ~~~~~~~~~~~~~~~~
  712 |         __uninit_default_n(__first, __n);
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:779:44:   required from '_ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = vector<int, int>*; _Size = long unsigned int; _Tp = vector<int, int>]'
  779 |     { return std::__uninitialized_default_n(__first, __n); }
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1720:36:   required from 'void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = std::vector<int, int>; _Alloc = std::allocator<std::vector<int, int> >; size_type = long unsigned int]'
 1720 |           std::__uninitialized_default_n_a(this->_M_impl._M_start, __n,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~