Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
  int n; cin >> n;
  vector<pair<int,int>> a(n), b(n);
  rep(i,n) cin >> a[i].first >> a[i].second;
  rep(i,n) cin >> b[i].first >> b[i].second;
  sort(all(a)); sort(all(b));
  int ans=0;
  rep(i,n){
    rep(j,n){
      if(a[j].first < b[i].first){
        if(a[j].second < b[i].second){
          a.erase(a.begin()+j);
          b.erase(b.begin()+i);
          ans++;
          break;
        }
      }
    }
  }     
  cout << ans;
  
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
  int n; cin >> n;
  vector<pair<int,int>> a(n), b(n);
  rep(i,n) cin >> a[i].first >> a[i].second;
  rep(i,n) cin >> b[i].first >> b[i].second;
  sort(all(a)); sort(all(b));
  int ans=0;
  rep(i,n){
    int j=0;
    while(j!=(int)a.size()){
      if(a[j].first < b[i].first){
        if(a[j].second < b[i].second){
          a.erase(a.begin()+j);
          ans++;
          break;
        }
      }
      j++;
    }
  }     
  cout << ans;
  
  return 0;
}


Compiler output:
a.cc:67:31: error: redefinition of 'template<class T> bool print(T&)'
   67 | template<class T> inline bool print(T& x){ cout << x << endl; return true; }
      |                               ^~~~~
a.cc:15:31: note: 'template<class T> bool print(T&)' previously declared here
   15 | template<class T> inline bool print(T& x){ cout << x << endl; return true; }
      |                               ^~~~~
a.cc:68:31: error: redefinition of 'template<class T> bool print_(T&)'
   68 | template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
      |                               ^~~~~~
a.cc:16:31: note: 'template<class T> bool print_(T&)' previously declared here
   16 | template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
      |                               ^~~~~~
a.cc:69:31: error: redefinition of 'template<class T> bool chmax(T&, T)'
   69 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
      |                               ^~~~~
a.cc:17:31: note: 'template<class T> bool chmax(T&, T)' previously declared here
   17 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
      |                               ^~~~~
a.cc:70:31: error: redefinition of 'template<class T> bool chmin(T&, T)'
   70 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
      |                               ^~~~~
a.cc:18:31: note: 'template<class T> bool chmin(T&, T)' previously declared here
   18 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
      |                               ^~~~~
a.cc:71:4: error: redefinition of 'll gcd(ll, ll)'
   71 | ll gcd(ll x, ll y){
      |    ^~~
a.cc:19:4: note: 'll gcd(ll, ll)' previously defined here
   19 | ll gcd(ll x, ll y){
      |    ^~~
a.cc:75:4: error: redefinition of 'll lcm(ll, ll)'
   75 | ll lcm(ll x, ll y){
      |    ^~~
a.cc:23:4: note: 'll lcm(ll, ll)' previously defined here
   23 | ll lcm(ll x, ll y){
      |    ^~~
a.cc:78:11: error: redefinition of 'const int INF'
   78 | const int INF = 1e9;
      |           ^~~
a.cc:26:11: note: 'const int INF' previously defined here
   26 | const int INF = 1e9;
      |           ^~~
a.cc:79:10: error: redefinition of 'const ll llINF'
   79 | const ll llINF = 1LL<<60;
      |          ^~~~~
a.cc:27:10: note: 'const ll llINF' previously defined here
   27 | const ll llINF = 1LL<<60;
      |          ^~~~~
a.cc:80:11: error: redefinition of 'const int MOD'
   80 | const int MOD = 1e9+7;
      |           ^~~
a.cc:28:11: note: 'const int MOD' previously defined here
   28 | const int MOD = 1e9+7;
      |           ^~~
a.cc:81:14: error: redefinition of 'const double EPS'
   81 | const double EPS = 1e-9;
      |              ^~~
a.cc:29:14: note: 'const double EPS' previously defined here
   29 | const double EPS = 1e-9;
      |              ^~~
a.cc:82:5: error: redefinition of 'int main()'
   82 | int main(){
      |     ^~~~
a.cc:30:5: note: 'int main()' previously defined here
   30 | int main(){
      |     ^~~~