Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <set>
using namespace std;

int main() {
  
	int N,i,j;
	cin >> N;
	
	// 2つの整数の組(座標)の配列
	vector< pair<int,int> > r(N),b(N);
	
	// 入力
	for(i=0;i<N;i++) cin >> r[i].second >> r[i].first;
	for(i=0;i<N;i++) cin >> b[i].first  >> b[i].second;
	
  // それぞれ昇順にソート
	sort(r.begin(),r.end());
	sort(b.begin(),b.end());
	
	// ペア用バケット
	vector<int> pair(N);
	
	int point, ans = 0;
	for(i = 0 ; i < N ; i++) {
	  
		bool f = false;
		for(j = 0 ; j < N ; j++) {
		  
			if( r[j].second < b[i].first && r[j].first < b[i].second) {
			// いま注目している青点より左下にある赤点に注目
			
				if(pair[j] == 0) {
				// r[j]がまだペアでないならj番目をペアに予約
					f = true;
					point = j;
				}
			}
		}
		if(f)
		{ans++; pair[point]=1;} //予約したjをバケットに追加
	}
	cout << ans << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'vector' was not declared in this scope
   13 |         vector< pair<int,int> > r(N),b(N);
      |         ^~~~~~
a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    4 | #include <set>
  +++ |+#include <vector>
    5 | using namespace std;
a.cc:13:31: error: expected primary-expression before '>' token
   13 |         vector< pair<int,int> > r(N),b(N);
      |                               ^
a.cc:13:33: error: 'r' was not declared in this scope
   13 |         vector< pair<int,int> > r(N),b(N);
      |                                 ^
a.cc:13:38: error: 'b' was not declared in this scope
   13 |         vector< pair<int,int> > r(N),b(N);
      |                                      ^
a.cc:24:16: error: expected primary-expression before 'int'
   24 |         vector<int> pair(N);
      |                ^~~
a.cc:35:40: error: expected unqualified-id before '[' token
   35 |                                 if(pair[j] == 0) {
      |                                        ^
a.cc:43:37: error: class template argument deduction failed:
   43 |                 {ans++; pair[point]=1;} //予約したjをバケットに追加
      |                                     ^
a.cc:43:37: error: no matching function for call to 'pair(int)'
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 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/stl_pair.h:1000:40: note: candidate: 'template<class _T1, class _T2> std::pair(_T1, _T2)-> pair<_T1, _T2>'
 1000 |   template<typename _T1, typename _T2> pair(_T1, _T2) -> pair<_T1, _T2>;
      |                                        ^~~~
/usr/include/c++/14/bits/stl_pair.h:1000:40: note:   candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:3013:12: note: candidate: 'template<class _T1, class _T2> pair(std::pair<_T1, _T2>)-> std::pair<_T1, _T2>'
 3013 |     struct pair;
      |            ^~~~
/usr/include/c++/14/bits/stl_iterator.h:3013:12: note:   template argument deduction/substitution failed:
a.cc:43:37: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
   43 |                 {ans++; pair[point]=1;} //予約したjをバケットに追加
      |                                     ^
/usr/include/c++/14/bits/stl_pair.h:294:17: note: candidate: 'template<class _T1, class _T2> pair(const std::pair<_T1, _T2>&)-> std::pair<_T1, _T2>'
  294 |       constexpr pair(const pair&) = default;    ///< Copy constructor
      |                 ^~~~
/usr/include/c++/14/bits/stl_pair.h:294:17: note:   template argument deduction/substitution failed:
a.cc:43:37: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
   43 |                 {ans++; pair[point]=1;} //予約したjをバケットに追加
      |                                     ^
/usr/include/c++/14/bits/stl_pair.h:295:17: note: candidate: 'template<class _T1, class _T2> pair(std::pair<_T1, _T2>&&)-> std::pair<_T1, _T2>'
  295 |       constexpr pair(pair&&) = default;         ///< Move constructor
      |                 ^~~~
/usr/include/c++/14/bits/stl_pair.h:295:17: note:   template argument deduction/substitution failed:
a.cc:43:37: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
   43 |                 {ans++; pair[point]=1;} //予約したjをバケットに追加
      |                                     ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2874:7: note: candidate: 'template<class _T1, class _T2, class ... _Args1, class ... _Args2> pair(std::piecewise_construct_t, std::tuple<_Tp ...>, std::tuple<_Args2 ...>)-> std::pair<_T1, _T2>'
 2874 |       pair<_T1, _T2>::
      |       ^~~~~~~~~~~~~~
/usr/include/c++/14/tuple:2874:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/tuple:2886:7: note: candidate: 'template<class _T1, class _T2, class ... _Args1, long unsigned int ..._Indexes1, class ... _Args2, long unsigned int ..._Indexes2> pair(std::tuple<_Tp ...>&, std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes2 ...>, std::_Index_tuple<_Indexes2 ...>)-> std::pair<_T1, _T2>'
 2886 |       pair<_T1, _T2>::
      |       ^~~~~~~~~~~~~~
/usr/include/c++/14/tuple:2886:7: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:725:17: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<std::__and_<std::__is_implicitly_default_constructible<_U1>, std::__is_implicitly_default_constructible<_U2> >::value, bool>::type <anonymous> > pair()-> std::pair<_T1, _T2>'
  725 |       constexpr pair()
      |                 ^~~~
/usr/include/c++/14/bits/stl_pair.h:725:17: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:752:17: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<true, _T1, _T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > pair(const _T1&, const _T2&)-> std::pair<_T1, _T2>'
  752 |       constexpr pair(const _T1& __a, const _T2& __b)
      |                 ^~~~
/usr/include/c++/14/bits/stl_pair.h:752:17: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:779:19: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > pair(const std::pair<_ForwardIterator1, _ForwardIterator2>&)-> std::pair<_T1, _T2>'
  779 |         constexpr pair(const pair<_U1, _U2>& __p)
      |                   ^~~~
/usr/include/c++/14/bits/stl_pair.h:779:19: note:   template argument deduction/substitution failed:
a.cc:43:37: note:   mismatched types 'const std::pair<_ForwardIterator1, _ForwardIterator2>' and 'int'
   43 |                 {ans++; pair[point]=1;} //予約したjをバケットに追加
      |                                     ^
/usr/include/c++/14/bits/stl_pair.h:830:9: note: candidate: 'template<class _T1, class _T2, class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_U2> >, std::is_pointer<_T2>, std::is_constructible<_T1, _U1>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U1, _T1> >::value, bool>::type <anonymous> > pair(_U1&&, typename std::pair<_T1, _T2>::__zero_as_null_pointer_constant, ...)-> std::pair<_T1, _T2>'
  830 |         pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
      |         ^~~~
/usr/include/c++/14/bits/stl_pair.h:830:9: note:   candidate expects at least 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate: 'template<class _T1, class _T2, class _U2, typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U2> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T2, const _U2&> >, std::is_convertible<_U2, _T2> >::value, bool>::type <anonymous> > pair(typename std::pair<_T1, _T2>::__zero_as_null_pointer_constant, _U2&&, ...)-> std::pair<_T1, _T2>'
  856 |         pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
      |         ^~~~
/usr/include/c++/14/bits/stl_pair.h:856:9: note:   candidate expects at least 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > pair(_U1&&, _U2&&)-> std::pair<_T1, _T2>'
  881 |         constexpr pair(_U1&& __x, _U2&& __y)
      |                   ^~~~
/usr/include/c++/14/bits/stl_pair.h:881:19: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate: 'template<class _T1, class _T2, class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > pair(std::pair<_ForwardIterator1, _ForwardIterator2>&&)-> std::pair<_T1, _T2>'
  902 |         constexpr pair(pair<_U1, _U2>&& __p)
      |                   ^~~~
/usr/include/c++/14/bits/stl_pair.h:902:19: note:   template argument deduction/substitution failed:
a.cc:43:37: note:   mismatched types 'std::pair<_ForwardIterator1, _ForwardIterator2>' and 'int'
   43 |                 {ans++; pair[point]=1;} //予約したjをバケットに追加
      |                                     ^
a.cc:43:37: note: explicit deduction guides not considered for copy-initialization