<commit_before>const int MAX = 400;
vector<vector<int> > adjlist;
int res[MAX][MAX], n, s, t;

int find_path() {
  const int inf = int(1e9 + 7);
  vector<int> visited(n, 0), from(n, -1);
  queue<int> q;
  int u, v, f;

  q.push(s);
  visited[s] = true;
  while (!visited[t] && !q.empty()) {
    u = q.front();
    q.pop();
    for (int i = 0; i < (int)adjlist[u].size(); ++i) {
      v = adjlist[u][i];
      if (res[u][v] > 0 && !visited[v]) {
        from[v] = u;
        q.push(v);
        visited[v] = true;
        if (v == t) {
          break;
        }
      }
    }
  }

  f = inf;
  if (visited[t]) {
    for (v = t; from[v] > -1; v = from[v]) f = min(res[from[v]][v], f);
    for (v = t; from[v] > -1; v = from[v])
      u = from[v], res[u][v] -= f, res[v][u] += f;
  }

  return (f == inf ? 0 : f);
}

int maxflow() {
  int mf = 0, d;
  while ((d = find_path())) mf += d;
  return mf;
}<commit_msg>Improved Edmonds-Karp support for multiple edges by replacing the matrix representation with an edge list<commit_after>struct MfEdge {
  int v, cap;
  int backid; // id to the back edge
};

struct MaxFlow {
  vector<vector<int>> g;  // integers represent edges' ids
  vector<MfEdge> edges;   // edges.size() should always be even
  int n, s, t;            // n = # vertices, s = src vertex, t = sink vertex

  int find_path() {
    const int inf = int(1e9 + 7);
    vector<int> visited(n, 0), from(n, -1), used_edge(n, -1);
    queue<int> q;
    int u, v, f;

    q.push(s);
    visited[s] = true;
    while (!visited[t] && !q.empty()) {
      u = q.front();
      q.pop();
      for (int eid : g[u]) {
        int v = edges[eid].v;
        if (edges[eid].cap > 0 && !visited[v]) {
          from[v] = u, used_edge[v] = eid;
          q.push(v);
          visited[v] = true;
          if (v == t) {
            break;
          }
        }
      }
    }

    f = inf;
    if (visited[t]) {
      for (v = t; from[v] > -1; v = from[v]) {
        f = min(edges[used_edge[v]].cap, f);
      }
      for (v = t; from[v] > -1; v = from[v]) {
        int backid = edges[used_edge[v]].backid;
        edges[used_edge[v]].cap -= f;
        edges[backid].cap += f;
      }
    }

    return (f == inf ? 0 : f);
  }

  int get() {
    int mf = 0, d;
    while ((d = find_path())) mf += d;
    return mf;
  }
};
{'fraction_non_alphanumeric': 0.1987012987012987, 'fraction_numerical': 0.010822510822510822, 'mean_word_length': 1.914249684741488, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5601278', 'n_tokens_mistral': 967, 'n_tokens_neox': 945, 'n_words': 255}