Language: C++

#include <bits/stdc++.h>

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define rep(i, n) for(LL i = 0;i < n;i++)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

//#define int T

/*************** using variables ***************/

/**********************************************/

template <typename T>
struct Edge {
  int from, to;
  T cost;
  Edge(int to, T cost) : from(-1), to(to), cost(cost) {}
  Edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
};

template <typename T>
using Edges = vector<Edge<T>>;
template <typename T>
using AdjList = vector<Edges<T>>;template <typename T>

class Dinic {
 private:
  int V;  // 頂点数
  vector<T> minCost;
  vector<int> iter;
  AdjList<T> graph;
  const T INF = numeric_limits<T>::max() / 10;
  bool Bfs(int s, int t);
  T Dfs(int idx, const int t, T flow);

 public:
  explicit Dinic(int n);
  void AddEdge(int from, int to, T cost);
  T Run(int s, int t);
};

template <typename T>
Dinic<T>::Dinic(int n) : V(n), graph(n) {}

template <typename T>
void Dinic<T>::AddEdge(int from, int to, T cost) {
  graph[from].push_back(Edge<T>(static_cast<int>(graph[to].size()), to, cost));
  graph[to].push_back(
      Edge<T>(static_cast<int>(graph[from].size() - 1)), from, 0);
}

template <typename T>
bool Dinic<T>::Bfs(int s, int t) {
  minCost.assign(graph.size(), -1);
  queue<int> que;
  minCost[s] = 0;
  que.push(s);
  while (!que.empty()) {
    int p = que.front();
    que.pop();
    for (auto &e : graph[p]) {
      if (e.cost > 0 && minCost[e.to] < 0) {
        minCost[e.to] = minCost[p] + 1;
        que.push(e.to);
      }
    }
  }
  return (minCost[t] != -1);
}

template <typename T>
T Dinic<T>::Dfs(int idx, const int t, T flow) {
  if (idx == t) return flow;
  for (int &i = iter[idx]; i < static_cast<int>(graph[idx].size()); ++i) {
    Edge<T> &e = graph[idx][i];
    if (e.cost > 0 && minCost[idx] < minCost[e.to]) {
      T d = Dfs(e.to, t, min(flow, e.cost));
      if (d > 0) {
        e.cost -= d;
        graph[e.to][e.from].cost += d;
        return d;
      }
    }
  }
  return 0;
}

template <typename T>
T Dinic<T>::Run(int s, int t) {
  T flow = 0;
  while (Bfs(s, t)) {
    iter.assign(graph.size(), 0);
    T f = 0;
    while ((f = Dfs(s, t, INF)) > 0) {
      flow += f;
    }
  }
  return flow;
}
signed main(){
    int n;
    vector<P> blue, red;

    cin >> n;
    rep(i, n){
        int a, b;
        cin >> a >> b;
        red.pb(P(a, b));
    }
    rep(i, n){
        int c, d;
        cin >> c >> d;
        blue.pb(P(c, d));
    }

    Dinic<LL> f(n*2 + 2);
    rep(i, n){
        f.AddEdge(0, i+1, 1);
        f.AddEdge(n+1+i, n*2+1, 1);
    }
    rep(i, n){
        rep(j, n){
            if(red[i].first < blue[j].first && red[i].second < blue[j].second){
                f.AddEdge(i+1, j+n+1, 1);
            }
        }
    }

    cout << f.Run(0, n*2+1) << endl;
}


Compiler output:
a.cc: In instantiation of 'void Dinic<T>::AddEdge(int, int, T) [with T = long long int]':
a.cc:130:18:   required from here
  130 |         f.AddEdge(0, i+1, 1);
      |         ~~~~~~~~~^~~~~~~~~~~
a.cc:61:7: error: no matching function for call to 'Edge<long long int>::Edge(int)'
   61 |       Edge<T>(static_cast<int>(graph[from].size() - 1)), from, 0);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:30:3: note: candidate: 'Edge<T>::Edge(int, int, T) [with T = long long int]'
   30 |   Edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
      |   ^~~~
a.cc:30:3: note:   candidate expects 3 arguments, 1 provided
a.cc:29:3: note: candidate: 'Edge<T>::Edge(int, T) [with T = long long int]'
   29 |   Edge(int to, T cost) : from(-1), to(to), cost(cost) {}
      |   ^~~~
a.cc:29:3: note:   candidate expects 2 arguments, 1 provided
a.cc:26:8: note: candidate: 'constexpr Edge<long long int>::Edge(const Edge<long long int>&)'
   26 | struct Edge {
      |        ^~~~
a.cc:26:8: note:   no known conversion for argument 1 from 'int' to 'const Edge<long long int>&'
a.cc:26:8: note: candidate: 'constexpr Edge<long long int>::Edge(Edge<long long int>&&)'
a.cc:26:8: note:   no known conversion for argument 1 from 'int' to 'Edge<long long int>&&'