Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;


struct edge{int to, cap, rev;};
int level[300];
int iter[300];
int INF = 100000000;

void bfs(vector< vector<edge> > &G, int s){
  memset(level, -1, sizeof(level));
  queue<int> que;
  level[s] = 0;
  que.push(s);
  while(!que.empty()){
    int v = que.front();
    que.pop();
    for(int i = 0; i < G[v].size(); ++i){
      edge &e = G[v][i];
      if(e.cap > 0 && level[e.to] < 0){
        level[e.to] = level[v] + 1;
        que.push(e.to);
      }
    }
  }
}


int dfs(vector< vector<edge> > &G, int v, int t, int f){
  if(v == t) return f;
  for(int &i = iter[v]; i < G[v].size(); ++i){
    edge &e = G[v][i];
    if(e.cap > 0 && level[v] < level[e.to]){
      int d = dfs(G,e.to,t,min(f,e.cap));
      if(d > 0){
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

int max_flow(vector< vector<edge> > G, int s, int t){
  int flow = 0;
  for(;;){
    bfs(G,s);
    if(level[t] < 0) return flow;
    memset(iter,0,sizeof(iter));
    int f;
    while((f = dfs(G,s,t,INF)) > 0){
      flow += f;
    }
  }
}

int main(){
  int N;
  cin >> N;
  vector<int> A(N), B(N), C(N), D(N);
  for(int i = 0; i < N; ++i) cin >> A[i] >> B[i];
  for(int i = 0; i < N; ++i) cin >> C[i] >> D[i];
  int V = 2*N + 2;
  vector< vector<edge> > G(V);
  for(int i = 0; i < N; ++i){
    G[2*N].push_back((edge){i,1,G[i].size()});
    G[i].push_back((edge){2*N,0,G[2*N].size()-1});
    G[N+i].push_back((edge){2*N+1,1,G[2*N+1].size()});
    G[2*N+1].push_back((edge){N+i,0,G[N+i].size()-1});
    for(int j = 0; j < N; ++j){
      if(A[i] < C[j] && B[i] < D[j]){
        G[i].push_back((edge){N+j,1,G[N+j].size()});
        G[N+j].push_back((edge){i,0,G[i].size()-1});
      }
    }
  }
  cout << max_flow(G,2*N,2*N+1) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'void bfs(std::vector<std::vector<edge> >&, int)':
a.cc:14:3: error: 'memset' was not declared in this scope
   14 |   memset(level, -1, sizeof(level));
      |   ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <queue>
  +++ |+#include <cstring>
    5 | using namespace std;
a.cc: In function 'int max_flow(std::vector<std::vector<edge> >, int, int)':
a.cc:53:5: error: 'memset' was not declared in this scope
   53 |     memset(iter,0,sizeof(iter));
      |     ^~~~~~
a.cc:53:5: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc: In function 'int main()':
a.cc:70:42: warning: narrowing conversion of '(& G.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)i)))->std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   70 |     G[2*N].push_back((edge){i,1,G[i].size()});
      |                                 ~~~~~~~~~^~
a.cc:71:46: warning: narrowing conversion of '((& G.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)(2 * N))))->std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   71 |     G[i].push_back((edge){2*N,0,G[2*N].size()-1});
      |                                 ~~~~~~~~~~~~~^~
a.cc:72:50: warning: narrowing conversion of '(& G.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)((2 * N) + 1))))->std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   72 |     G[N+i].push_back((edge){2*N+1,1,G[2*N+1].size()});
      |                                     ~~~~~~~~~~~~~^~
a.cc:73:50: warning: narrowing conversion of '((& G.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)(N + i))))->std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   73 |     G[2*N+1].push_back((edge){N+i,0,G[N+i].size()-1});
      |                                     ~~~~~~~~~~~~~^~
a.cc:76:48: warning: narrowing conversion of '(& G.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)(N + j))))->std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   76 |         G[i].push_back((edge){N+j,1,G[N+j].size()});
      |                                     ~~~~~~~~~~~^~
a.cc:77:48: warning: narrowing conversion of '((& G.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)i)))->std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   77 |         G[N+j].push_back((edge){i,0,G[i].size()-1});
      |                                     ~~~~~~~~~~~^~