Language: C++

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

#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
#define fir first
#define sec second
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n;
	cin >> n;

	vector<pair<int,int>> r(n),b(n);

	rep(i,0,n){
		int x,y;
		cin >> x >> y;
		r[i] = make_pair(x,y);
	}
	rep(i,0,n){
		int x,y;
		cin >> x >> y;
		b[i] = make_pair(x,y);
	}

	vsort(r);
	vsort(b);

	int cnt = 0;
	rep(i,0,n){
		auto itr = lower_bound( r.begin() , r.end() , b[i]);
		if( itr == r.begin()  ) continue;
		itr--;
		auto M = itr;
		while( itr >= r.begin() ){
			if( itr->sec > M->sec && M->sec < b[i].sec ) M = itr;
			itr--;
		}
		if( itr->fir < b[i].fir && itr->sec < b[i].sec ){
			r.erase(M);
			cnt++;
		}
	}
	cout << cnt << endl;
	ret 0;
}#include<bits/stdc++.h>
using namespace std;

#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
#define fir first
#define sec second
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n;
	cin >> n;

	vector<pair<int,int>> r(n),b(n);

	rep(i,0,n){
		int x,y;
		cin >> x >> y;
		r[i] = make_pair(x,y);
	}
	rep(i,0,n){
		int x,y;
		cin >> x >> y;
		b[i] = make_pair(x,y);
	}

	vsort(r);
	vsort(b);

	int cnt = 0;
	rep(i,0,n){
		auto itr = lower_bound( r.begin() , r.end() , b[i]);
		if( itr == r.begin()  ) continue;
		itr--;
		auto M = itr;
		while( itr >= r.begin() ){
			if( itr->sec > M->sec && M->sec < b[i].sec ) M = itr;
			itr--;
		}
		if( itr->fir < b[i].fir && itr->sec < b[i].sec ){
			r.erase(M);
			cnt++;
		}
	}
	cout << cnt << endl;
	ret 0;
}

Compiler output:
a.cc:64:2: error: stray '#' in program
   64 | }#include<bits/stdc++.h>
      |  ^
a.cc:64:3: error: 'include' does not name a type
   64 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:90:5: error: redefinition of 'int main()'
   90 | int main(){
      |     ^~~~
a.cc:27:5: note: 'int main()' previously defined here
   27 | int main(){
      |     ^~~~