criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
 
struct LCA {
  int N, logN; // logN-1 == floor(lg(N-1))
  vector<vector<int>> G;
  vector<int> depth;
  // vから根の方向に2^k回登ったときのノード parent[k][v]
  vector<vector<int>> parent;
 
  LCA(int size) : N(size), G(size), depth(size) {
    logN = 0;
    for(int x = 1; x < N; x *= 2) logN++;
    parent.assign(max(logN, 1), vector<int>(N));
  }
 
  // どちらが根であってもOK
  void add_edge(int u, int v) {
    G[u].push_back(v);
    G[v].push_back(u);
  }
 
  void dfs(int v, int par, int dep) {
    depth[v] = dep;
    parent[0][v] = par;
    for(int next : G[v]) {
      if(next != par) dfs(next, v, dep + 1);
    }
  }
 
  void init(int root) {
    dfs(root, -1, 0);
    for(int k = 1; k < logN; k++) {
      for(int v = 0; v < N; v++) {
        if(parent[k - 1][v] == -1) parent[k][v] = -1;
        else parent[k][v] = parent[k - 1][parent[k - 1][v]];
      }
    }
  }
 
  int lca(int u, int v) {
    if(depth[u] > depth[v]) swap(u, v); // vのほうが深くなる
    // uとvの深さが同じになるまでvを根の方向に移動する
    for(int k = 0; k < logN; k++) {
      if(((depth[v] - depth[u]) >> k) & 1) {
        v = parent[k][v];
      }
    }
    if(u == v) return u;
    for(int k = logN - 1; k >= 0; k--) {
      if(parent[k][u] != parent[k][v]) {
        u = parent[k][u];
        v = parent[k][v];
      }
    }
    return parent[0][u];
  }
};
 
int main() {
  ios::tie(nullptr);
  int N; cin >> N;
  LCA lca(N);
  for(int u = 0; u < N; u++) {
    int k; cin >> k;
    while(k--) {
      int v; cin >> v;
      lca.add_edge(u, v);
    }
  }
  lca.init(0);
  int Q; cin >> Q;
  while(Q--) {
    int u, v; cin >> u >> v;
    cout << lca.lca(u, v) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:11: error: cannot call member function 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]' without object
   63 |   ios::tie(nullptr);
      |   ~~~~~~~~^~~~~~~~~
Language: C++

using namespace std;
vector<int> G[100010];

#define MAX_N 1<<17
int n,dat[2*(MAX_N)-1];

void init(int n_){
  n=1;
  while(n<n_)n*=2;
  for(int i=0;i<2*n-1;i++)dat[i]=0;
}

int find(int k){
  k+=n-1;
  int ans=dat[k];
  while(k>0){
    k=(k-1)/2;
    ans+=dat[k];
  }
  return ans;
}


void update(int a,int b,int x,int k=0,int l=0,int r=n){
  if(r<=a||b<=l)return;
  if(a<=l&&r<=b){
    dat[k]+=x;
  }else{
    update(a,b,x,k*2+1,l,(l+r)/2);
    update(a,b,x,k*2+2,(l+r)/2,r);
  }
}

int num[2][200010];
int dfs(int k=0,int a=0){
  num[0][k]=a;
  for(int i=0;i<G[k].size();i++){
    a=dfs(G[k][i],a+1);
  }
  num[1][k]=a;
  return a+1;
}

int main(){
  int N;
  cin>>N;
  for(int i=0;i<N;i++){
    int k;
    cin>>k;
    for(int j=0;j<k;j++){
      int a;
      cin>>a;
      G[i].push_back(a);
    }
  }
  n=dfs();
  init(n);
  //cout<<n<<" happy"<<endl;
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int x;
    cin>>x;
    if(x==0){
      int w,v;
      cin>>v>>w;
      update(num[0][v],num[1][v]+1,w);
    }else{
      int u;
      cin>>u;
      cout<<find(num[0][u])<<endl;
    }
  }
  return 0;
}



Compiler output:
a.cc:2:1: error: 'vector' does not name a type
    2 | vector<int> G[100010];
      | ^~~~~~
a.cc: In function 'int dfs(int, int)':
a.cc:37:17: error: 'G' was not declared in this scope
   37 |   for(int i=0;i<G[k].size();i++){
      |                 ^
a.cc: In function 'int main()':
a.cc:46:3: error: 'cin' was not declared in this scope
   46 |   cin>>N;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:53:7: error: 'G' was not declared in this scope
   53 |       G[i].push_back(a);
      |       ^
a.cc:71:7: error: 'cout' was not declared in this scope
   71 |       cout<<find(num[0][u])<<endl;
      |       ^~~~
a.cc:71:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:71:30: error: 'endl' was not declared in this scope
   71 |       cout<<find(num[0][u])<<endl;
      |                              ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: Java

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Queue;
import java.util.Scanner;

public class DinicTest {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int v = sc.nextInt();
		int e = sc.nextInt();
		Dinic mf = new Dinic(v);
		for(int i=0;i<e;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			mf.addEdge(a, b, c);
		}
		System.out.println(mf.maximumFlow(0, v-1));
	}
}


//O(V E^2)
class Dinic {
	public static final int INF = 1 << 29;
	private ArrayList<Edge>[] g;
	private int[] it;
	private int[] level;
	@SuppressWarnings("unchecked")
	public Dinic(int n) {
		g = new ArrayList[n];
		for(int i=0;i<n;i++) {
			g[i] = new ArrayList<>();
		}
		it = new int[n];
		level = new int[n];
	}
	public void addEdge(int from,int to,int cap) {
		g[from].add(new Edge(to,cap,g[to].size()));
		g[to].add(new Edge(from,0,g[from].size()-1));
	}
	public void addBidirectionalEdge(int from,int to,int cap) {
		addEdge(from,to,cap);
		addEdge(to,from,cap);
	}
	private void bfs(int s) {
		Arrays.fill(level, -1);
		Queue<Integer> q = new ArrayDeque<>();
		level[s] = 0;
		q.offer(s);
		while(!q.isEmpty()) {
			int v = q.poll();
			for(Edge e: g[v]) {
				if (e.cap > 0 && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					q.offer(e.to);
				}
			}
		}
	}
	private int dfs(int v,int t,int f) {
		if (v == t) {
			return f;
		}
		for(;it[v]<g[v].size();it[v]++) {
			Edge e = g[v].get(it[v]);
			if (e.cap <= 0 || level[v] >= level[e.to]) {
				continue;
			}
			int d = dfs(e.to,t,Math.min(f,e.cap));
			if (d <= 0) {
				continue;
			}
			e.cap -= d;
			g[e.to].get(e.rev).cap += d;
			return d;
		}
		return 0;
	}
	public int maximumFlow(int s,int t) {
		int flow = 0;
		while(true) {
			bfs(s);
			if (level[t] < 0) {
				return flow;
			}
			Arrays.fill(it, 0);
			int f;
			while((f = dfs(s,t,INF)) > 0) {
				flow += f;
			}
		}
	}
	class Edge {
		int to,cap,rev;
		public Edge(int to,int cap,int rev) {
			this.to = to;
			this.cap = cap;
			this.rev = rev;
		}
	}
}

Compiler output:
Main.java:7: error: class DinicTest is public, should be declared in a file named DinicTest.java
public class DinicTest {
       ^
1 error
Language: Java

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

@SuppressWarning("unchecked")
class MaxFlow{
    class Edge{
        int to,cap,revIndex;
        Edge(int to,int cap,int rev){
            this.to = to;
            this.cap = cap;
            revIndex = rev;
        }
    }

    List<Edge>[] edgeList;
    int N;
    int[] index;
    int[] level;

    MaxFlow(int N){
        this.N = N;
        edgeList = new ArrayList[N];
        index = new int[N];
        level = new int[N];
        for(int i=0;i<N;++i)edgeList[i]=new ArrayList<>();
    }

    void addEdge(int from,int to,int cap){
        edgeList[from].add(new Edge(to,cap,edgeList[to].size()));
        edgeList[to].add(new Edge(from,0,edgeList[from].size()-1));
    }

    

    
    int dfs(int v,int t,int f){
        if(v==t)return f;
        for(;index[v]<edgeList[v].size();++index[v]){
            Edge e = edgeList[v].get(index[v]);
            if(e.cap<=0 || level[e.to] <= level[v])continue;
            int u = e.to;
            int F = dfs(u,t,Math.min(f,e.cap));
            if(F>0){
                e.cap -= F;
                edgeList[u].get(e.revIndex).cap += F;
                return F;
            }
        }
        return 0;
    }

    void bfs(int s){
        Arrays.fill(level,-1);
        level[s]=0;
        Deque<Integer> que = new ArrayDeque<>();
        que.add(s);
        while(!que.isEmpty()){
            int v = que.poll();
            for(Edge e : edgeList[v]){
                if(level[e.to]<0 && e.cap>0){
                    level[e.to]=level[v]+1;
                    que.add(e.to);
                }
            }
        }
    }

    int getMaxFlow(int s,int t){
        int res = 0;
        while(true){
            Arrays.fill(index,0);
            bfs(s);
            if(level[t]<0)break;
            while(true){
                int f = dfs(s,t,Integer.MAX_VALUE);
                if(f<=0)break;
                res+=f;

            }
        }
        return res;
    }
}

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        MaxFlow mf = new MaxFlow(n);
        while(m-->0){
            int from = scan.nextInt();
            int to = scan.nextInt();
            int cap = scan.nextInt();
            mf.addEdge(from, to, cap);
        }
        System.out.println(mf.getMaxFlow(0, n-1));

    }
}




Compiler output:
Main.java:8: error: cannot find symbol
@SuppressWarning("unchecked")
 ^
  symbol: class SuppressWarning
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

class MaxFlow{
    class Edge{
        int to,cap,revIndex;
        Edge(int to,int cap,int rev){
            this.to = to;
            this.cap = cap;
            revIndex = rev;
        }
    }

@SuppressWarning("unchecked")
    List<Edge>[] edgeList;
    int N;
    int[] index;
    int[] level;

    MaxFlow(int N){
        this.N = N;
        edgeList = new ArrayList[N];
        index = new int[N];
        level = new int[N];
        for(int i=0;i<N;++i)edgeList[i]=new ArrayList<>();
    }

    void addEdge(int from,int to,int cap){
        edgeList[from].add(new Edge(to,cap,edgeList[to].size()));
        edgeList[to].add(new Edge(from,0,edgeList[from].size()-1));
    }

    

    
    int dfs(int v,int t,int f){
        if(v==t)return f;
        for(;index[v]<edgeList[v].size();++index[v]){
            Edge e = edgeList[v].get(index[v]);
            if(e.cap<=0 || level[e.to] <= level[v])continue;
            int u = e.to;
            int F = dfs(u,t,Math.min(f,e.cap));
            if(F>0){
                e.cap -= F;
                edgeList[u].get(e.revIndex).cap += F;
                return F;
            }
        }
        return 0;
    }

    void bfs(int s){
        Arrays.fill(level,-1);
        level[s]=0;
        Deque<Integer> que = new ArrayDeque<>();
        que.add(s);
        while(!que.isEmpty()){
            int v = que.poll();
            for(Edge e : edgeList[v]){
                if(level[e.to]<0 && e.cap>0){
                    level[e.to]=level[v]+1;
                    que.add(e.to);
                }
            }
        }
    }

    int getMaxFlow(int s,int t){
        int res = 0;
        while(true){
            Arrays.fill(index,0);
            bfs(s);
            if(level[t]<0)break;
            while(true){
                int f = dfs(s,t,Integer.MAX_VALUE);
                if(f<=0)break;
                res+=f;

            }
        }
        return res;
    }
}

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        MaxFlow mf = new MaxFlow(n);
        while(m-->0){
            int from = scan.nextInt();
            int to = scan.nextInt();
            int cap = scan.nextInt();
            mf.addEdge(from, to, cap);
        }
        System.out.println(mf.getMaxFlow(0, n-1));

    }
}




Compiler output:
Main.java:18: error: cannot find symbol
@SuppressWarning("unchecked")
 ^
  symbol:   class SuppressWarning
  location: class MaxFlow
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

struct edge{ int to, cap, rev;};

static const int MAX_V = 1e5;
static const int INF = (1<<30);

vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];
int V, E;

void add_edge(int from, int to, int cap){
	G[from].push_back((edge){to, cap, (int)G[to].size()});
	G[to].push_back((edge){from, 0, (int)G[from].size()-1});
}

void bfs(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(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(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(int s, int t){
	int flow = 0;
	for (; ;)
	{
		bfs(s);
		if (level[t] < 0) return flow;
		memset(iter, 0, sizeof(iter));
		int f;
		while((f = dfs(s, t, INF)) > 0){
			flow += f;
		}
	}
}

int main(int argc, char const *argv[])
{
	cin >> V >> E;
	for (int i = 0; i < E; ++i)
	{
		int s, t, c;
		cin >> s >> t >> c;
		add_edge(s, t, c);
	}
	cout << max_flow(0, V-1) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'void bfs(int)':
a.cc:24:9: error: 'memset' was not declared in this scope
   24 |         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 | 
a.cc: In function 'int max_flow(int, int)':
a.cc:68:17: error: 'memset' was not declared in this scope
   68 |                 memset(iter, 0, sizeof(iter));
      |                 ^~~~~~
a.cc:68:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

struct edge{ int to, cap, rev;};

static const int MAX_V = 1e5;
static const int INF = (1<<30);

vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];
int V, E;

void add_edge(int from, int to, int cap){
	G[from].push_back((edge){to, cap, (int)G[to].size()});
	G[to].push_back((edge){from, 0, (int)G[from].size()-1});
}

void bfs(int s){
	fill(level.begin(), level.end(), -1);
	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(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(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(int s, int t){
	int flow = 0;
	for (; ;)
	{
		bfs(s);
		if (level[t] < 0) return flow;
		fill(iter.begin(), iter.end(), 0);
		int f;
		while((f = dfs(s, t, INF)) > 0){
			flow += f;
		}
	}
}

int main(int argc, char const *argv[])
{
	cin >> V >> E;
	for (int i = 0; i < E; ++i)
	{
		int s, t, c;
		cin >> s >> t >> c;
		add_edge(s, t, c);
	}
	cout << max_flow(0, V-1) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'void bfs(int)':
a.cc:24:20: error: request for member 'begin' in 'level', which is of non-class type 'int [100000]'
   24 |         fill(level.begin(), level.end(), -1);
      |                    ^~~~~
a.cc:24:35: error: request for member 'end' in 'level', which is of non-class type 'int [100000]'
   24 |         fill(level.begin(), level.end(), -1);
      |                                   ^~~
a.cc: In function 'int max_flow(int, int)':
a.cc:68:27: error: request for member 'begin' in 'iter', which is of non-class type 'int [100000]'
   68 |                 fill(iter.begin(), iter.end(), 0);
      |                           ^~~~~
a.cc:68:41: error: request for member 'end' in 'iter', which is of non-class type 'int [100000]'
   68 |                 fill(iter.begin(), iter.end(), 0);
      |                                         ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

struct edge{ int to, cap, rev;};

static const int MAX_V = 110;
static const int INF = (1<<30);

vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];
int V, E;

void add_edge(int from, int to, int cap){
	G[from].push_back((edge){to, cap, (int)G[to].size()});
	G[to].push_back((edge){from, 0, (int)G[from].size()-1});
}

void bfs(int s){
	fill(level.begin(), level.end(), -1);
	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(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(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(int s, int t){
	int flow = 0;
	for (; ;)
	{
		bfs(s);
		if (level[t] < 0) return flow;
		fill(iter.begin(), iter.end(), 0);
		int f;
		while((f = dfs(s, t, INF)) > 0){
			flow += f;
		}
	}
}

int main(int argc, char const *argv[])
{
	cin >> V >> E;
	for (int i = 0; i < E; ++i)
	{
		int s, t, c;
		cin >> s >> t >> c;
		add_edge(s, t, c);
	}
	cout << max_flow(0, V-1) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'void bfs(int)':
a.cc:24:20: error: request for member 'begin' in 'level', which is of non-class type 'int [110]'
   24 |         fill(level.begin(), level.end(), -1);
      |                    ^~~~~
a.cc:24:35: error: request for member 'end' in 'level', which is of non-class type 'int [110]'
   24 |         fill(level.begin(), level.end(), -1);
      |                                   ^~~
a.cc: In function 'int max_flow(int, int)':
a.cc:68:27: error: request for member 'begin' in 'iter', which is of non-class type 'int [110]'
   68 |                 fill(iter.begin(), iter.end(), 0);
      |                           ^~~~~
a.cc:68:41: error: request for member 'end' in 'iter', which is of non-class type 'int [110]'
   68 |                 fill(iter.begin(), iter.end(), 0);
      |                                         ^~~
Language: C++

#include<iostream>
#include<vector>
#include<queue>

using namespace std;

const int MAX_V = 300;

struct edge {
	int to, cap, rev;
	edge(const int &_to, const int &_cap, const int &_rev) :to(_to), cap(_cap), rev(_rev) {}
};//to????????????cap???????????????????????????????§??????¨??????????????¢????????????G[to][rev]???????´?????????????????????¨????????????

vector<edge> G[MAX_V];	//?§????s,??????t??¨???????????§???????±???????????????¢???????????°????????¨????????£??\???????????§??¨???
vector<int> level(MAX_V);	//????????????s??????????????¢
vector<int> iter(MAX_V);	//???????????§?????§????????????????????£??????

					//from??????to??????????????????cap???????????°?????????????????????
void add_edge(const int &from, const int &to, const int &cap) {
	G[from].emplace_back(to,cap,G[to].size());
	G[to].emplace_back(from,0,G[from].size()-1);
}


//s????????????????????¢???BFS??§?±???????
void bfs(const int &s) {
	memset(level, -1, sizeof(level));
	queue<int> que;
	level[s] = 0;
	que.emplace(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.emplace(e.to);
			}
		}
	}
}

//?¢?????????????DFS??§??¢???
int dfs(const int &v, const int& t, const 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(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(const int &s, const int& t) {
	int flow = 0;
	while (true) {
		bfs(s);
		if (level[t] < 0)return flow;	//s??????t????????????????????¨????????????????????????????????¨?????§???????????´??????0?????????
		memset(iter, 0, sizeof(iter));
		int f;
		while ((f = dfs(s, t, INF))>0) {
			flow += f;
		}
	}
}

int main()
{
	cin.tie(0);
	ios::ios_base::sync_with_stdio(false);
	int V, E,s,t,c; cin >> V >> E;
	for (int i = 0; i < E; ++i) {
		cin >> s >> t >> c;
		add_edge(s, t, c);
	}
	cout << max_flow(0, V - 1);
}

Compiler output:
a.cc: In function 'void bfs(const int&)':
a.cc:27:9: error: 'memset' was not declared in this scope
   27 |         memset(level, -1, sizeof(level));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<queue>
  +++ |+#include <cstring>
    4 | 
a.cc: In function 'int max_flow(const int&, const int&)':
a.cc:65:17: error: 'memset' was not declared in this scope
   65 |                 memset(iter, 0, sizeof(iter));
      |                 ^~~~~~
a.cc:65:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:67:39: error: 'INF' was not declared in this scope
   67 |                 while ((f = dfs(s, t, INF))>0) {
      |                                       ^~~
Language: C++

#include<iostream>
#include<vector>
#include<queue>

using namespace std;

const int MAX_V = 300;
const int INF = (1 << 28);

struct edge {
	int to, cap, rev;
	edge(const int &_to, const int &_cap, const int &_rev) :to(_to), cap(_cap), rev(_rev) {}
};//to????????????cap???????????????????????????????§??????¨??????????????¢????????????G[to][rev]???????´?????????????????????¨????????????

vector<edge> G[MAX_V];	//?§????s,??????t??¨???????????§???????±???????????????¢???????????°????????¨????????£??\???????????§??¨???
vector<int> level(MAX_V);	//????????????s??????????????¢
vector<int> iter(MAX_V);	//???????????§?????§????????????????????£??????

							//from??????to??????????????????cap???????????°?????????????????????
void add_edge(const int &from, const int &to, const int &cap) {
	G[from].emplace_back(to, cap, G[to].size());
	G[to].emplace_back(from, 0, G[from].size() - 1);
}


//s????????????????????¢???BFS??§?±???????
void bfs(const int &s) {
	fill(level.begin(), level.end(), -1);
	queue<int> que;
	level[s] = 0;
	que.emplace(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.emplace(e.to);
			}
		}
	}
}

//?¢?????????????DFS??§??¢???
int dfs(const int &v, const int& t, const 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(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(const int &s, const int& t) {
	int flow = 0;
	while (true) {
		bfs(s);
		if (level[t] < 0)return flow;	//s??????t????????????????????¨????????????????????????????????¨?????§???????????´??????0?????????
		fill(iter.begin(), iter.end(), 0);
		int f;
		while ((f = dfs(s, t, INF))>0) {
			flow += f;
		}
	}
}



int max_flow(const int &s, const int& t) {
	int flow = 0;
	while (true) {
		bfs(s);
		if (level[t] < 0)return flow;	//s??????t????????????????????¨????????????????????????????????¨?????§???????????´??????0?????????
		fill(iter.begin(), iter.end(), 0);
		int f;
		while ((f = dfs(s, t, INF))>0) {
			flow += f;
		}
	}
}

int main()
{
	cin.tie(0);
	ios::ios_base::sync_with_stdio(false);
	int V, E,s,t,c; cin >> V >> E;
	for (int i = 0; i < E; ++i) {
		cin >> s >> t >> c;
		add_edge(s, t, c);
	}
	cout << max_flow(0, V - 1);
}

Compiler output:
a.cc:76:5: error: redefinition of 'int max_flow(const int&, const int&)'
   76 | int max_flow(const int &s, const int& t) {
      |     ^~~~~~~~
a.cc:61:5: note: 'int max_flow(const int&, const int&)' previously defined here
   61 | int max_flow(const int &s, const int& t) {
      |     ^~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
struct edge{int to,w,p;};
vector<edge>x[110];int N,M,a,b,c,used[110];
int dfs(int s,int t,int r){
	if(s==t)return r;used[s]=1;
	for(int i=0;i<x[s].size();i++){
		edge &u=x[s][i];
		if(used[u.to]==0 && u.w>0){
			int F=dfs(u.to,t,min(r,u.w));
			if(F>0){u.w-=F;x[u.to][u.p].w+=F;return F;}
		}
	}
	return 0;
}
int main(){
	cin>>N>>M;
	for(int i=0;i<M;i++){
		cin>>a>>b>>c;
		edge p={b,c,x[b].size()};x[a].push_back(p);
		edge q={a,0,x[a].size()-1};x[b].push_back(q);
	}
	int res=0;
	while(true){
		for(int i=0;i<110i++)used[i]=0;
		int P=dfs(0,N-1,1<<30);
		if(P==0)break;res+=P;
	}
	cout<<res<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:38: warning: narrowing conversion of 'x[b].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   22 |                 edge p={b,c,x[b].size()};x[a].push_back(p);
      |                             ~~~~~~~~~^~
a.cc:23:40: warning: narrowing conversion of '(x[a].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   23 |                 edge q={a,0,x[a].size()-1};x[b].push_back(q);
      |                             ~~~~~~~~~~~^~
a.cc:27:35: error: lvalue required as increment operand
   27 |                 for(int i=0;i<110i++)used[i]=0;
      |                                   ^~
a.cc:27:37: error: expected ';' before ')' token
   27 |                 for(int i=0;i<110i++)used[i]=0;
      |                                     ^
      |                                     ;
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
struct edge { int to, cap, rev; };
int V, E, used[109]; vector<edge> G[109];
void add_edge(int v1, int v2, int cap) {
	G[v1].push_back(edge{ v2, cap, G[v2].size() });
	G[v2].push_back(edge{ v1, cap, G[v1].size() - 1 });
}
int rec(int p, int t, int f) {
	if (p == t) return f;
	used[p] = 1;
	for (auto &e : G[p]) {
		if (used[e.to] || !e.cap) continue;
		int res = rec(e.to, t, min(e.cap, f));
		if (res) {
			e.cap -= res, G[e.to][e.rev].cap += res;
			return res;
		}
	}
	return 0;
}
int max_flow(int s, int t) {
	int ret = 0;
	while (true) {
		fill(used, used + V, 0);
		int res = rec(s, t, 2147483647);
		if (!res) break;
		ret += res;
	}
	return ret;
}
int main() {
	cin >> V >> E;
	for (int i = 0; i < E; i++) {
		int s, t, u;
		cin >> s >> t >> u;
		add_edge(s, t, u);
	}
	cout << max_flow() << endl;
}

Compiler output:
a.cc: In function 'void add_edge(int, int, int)':
a.cc:8:50: warning: narrowing conversion of 'G[v2].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
    8 |         G[v1].push_back(edge{ v2, cap, G[v2].size() });
      |                                        ~~~~~~~~~~^~
a.cc:9:53: warning: narrowing conversion of '(G[v1].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
    9 |         G[v2].push_back(edge{ v1, cap, G[v1].size() - 1 });
      |                                        ~~~~~~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:41:25: error: too few arguments to function 'int max_flow(int, int)'
   41 |         cout << max_flow() << endl;
      |                 ~~~~~~~~^~
a.cc:24:5: note: declared here
   24 | int max_flow(int s, int t) {
      |     ^~~~~~~~
Language: C++

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

#define MAX_V 100
#define INF 100000000

// ???????????????????????????
struct edge {
  int to, cap, rev;
};

int V, E;
vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from, int to, int cap) {
  G[from].push_back((edge){to, cap, G[to].size()});
  G[to].push_back((edge){from, 0, G[to].size() - 1});
}

// ?¢?????????????dfs??§??¢???
int dfs(int v, int t, int f) {
  if(v == t) return f;
  used[v] = true;
  for(int i = 0; i < G[v].size(); i++) {
    edge &e = G[v][i];
    if(!used[e.to] && e.cap > 0) {
      int d = dfs(e.to, t, min(f, e.cap));
      if(d > 0) {
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

// s??????t???????????§???????±???????
int max_flow(int s, int t) {
  int flow = 0;
  while(true) {
    memset(used, 0, sizeof(used));
    int f = dfs(s, t, INF);
    if(f == 0) return flow;
    flow += f;
  }
  return -1;
}

int main() {
  cin >> V >> E;
  for(int i = 0; i < E; i++) {
    int u, v, c;
    cin >> u >> v >> c;
    add_edge(u, v, c);
  }

  cout << max_flow(0, V-1) << endl;
}

Compiler output:
a.cc: In function 'void add_edge(int, int, int)':
a.cc:18:47: warning: narrowing conversion of 'G[to].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   18 |   G[from].push_back((edge){to, cap, G[to].size()});
      |                                     ~~~~~~~~~~^~
a.cc:19:48: warning: narrowing conversion of '(G[to].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   19 |   G[to].push_back((edge){from, 0, G[to].size() - 1});
      |                                   ~~~~~~~~~~~~~^~~
a.cc: In function 'int max_flow(int, int)':
a.cc:44:5: error: 'memset' was not declared in this scope
   44 |     memset(used, 0, sizeof(used));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <stack>
#include <utility>
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <cstdio>
using namespace std;
struct edge { int to, cap, rev; };
vector<edge>map[103];
bool used[103];
int dfs(int v,int t,int f){
	if (v == t)return f;
	used[v] = true;
	for (int i = 0; i < map[v].size(); i++) {
		edge &e = map[v][i];
		if (!used[e.to] && e.cap>0) {
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				map[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}
int main()
{
	int V, E;
	int a, b, c;
	cin >> V >> E;
	for (int i = 0; i < E; i++) {
		cin >> a >> b >> c;
		edge ed = { b,c,map[b].size() };
		map[a].push_back(ed);
		edge edg = { a,0,map[a].size() - 1 };
		map[b].push_back(edg);
	}int ans = 0;
	for (;;) {
		memset(used, 0, sizeof(used));
		int f = dfs(0, V - 1, 9999999);
		if (f == 0)break;
		ans += f;
	}
	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:44: warning: narrowing conversion of 'map[b].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   38 |                 edge ed = { b,c,map[b].size() };
      |                                 ~~~~~~~~~~~^~
a.cc:40:48: warning: narrowing conversion of '(map[a].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   40 |                 edge edg = { a,0,map[a].size() - 1 };
      |                                  ~~~~~~~~~~~~~~^~~
a.cc:44:17: error: 'memset' was not declared in this scope
   44 |                 memset(used, 0, sizeof(used));
      |                 ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <cstdio>
  +++ |+#include <cstring>
   11 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

#define rep(i,n) for(int i=0; i<(n); i++)

using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vc;

const int INF = 0x3fffffff;

class Flow{
	public:
		int N;
		vector<vc> F, C, edge;
		// ????????????????????? n:????????°
		Flow(int n): F(n,vc(n)), C(n,vc(n)), N(n), edge(n) {}

		// ??????????????????
		void addEdge(int f, int t, int c){
			F[f][t] = C[f][t] = c;
			edge[f].push_back(t);
			edge[t].push_back(f);
		}

		int flow(int n, int c, int T, vector<bool> &bf){
			if( n == T ) return c;
			bf[n] = true;
			for(int i: edge[n]) if( F[n][i] > 0 && !bf[i] ){
				int f = flow(i, min(c, F[n][i]), T, bf);
				F[n][i] -= f;
				F[i][n] += f;
				if( f > 0 ) return f;
			}
			return 0;
		}
		// ?????§???????±???????
		int maxFlow(int S, int T){
			int ret = 0;
			vector<bool> bf(N);
			for(int add; add = flow(0, INF, T, bf); bf.assign(N,0)) ret += add;
			return ret;
		}

		// ??°???????????????????????????
		void clear(){ rep(i,N) rep(j,N) F[i][j] = C[i][j]; }
};

int main(){
	int V, E;
	cin >> V >> E;
	Flow fl(V,E);
	for(int i=1; i<=E; i++){
		int u, v, c;
		cin >> u >> v >> c;
		fl.addEdge( u, v, c );
	}

	cout << fl.maxFlow(0, V-1) << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:20: error: no matching function for call to 'Flow::Flow(int&, int&)'
   53 |         Flow fl(V,E);
      |                    ^
a.cc:18:17: note: candidate: 'Flow::Flow(int)'
   18 |                 Flow(int n): F(n,vc(n)), C(n,vc(n)), N(n), edge(n) {}
      |                 ^~~~
a.cc:18:17: note:   candidate expects 1 argument, 2 provided
a.cc:13:7: note: candidate: 'Flow::Flow(const Flow&)'
   13 | class Flow{
      |       ^~~~
a.cc:13:7: note:   candidate expects 1 argument, 2 provided
a.cc:13:7: note: candidate: 'Flow::Flow(Flow&&)'
a.cc:13:7: note:   candidate expects 1 argument, 2 provided
Language: C++

// AOJ GRL_6_A
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

#define rep(i,n) for(int i=0; i<(n); i++)

using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vc;

const int INF = 0x3fffffff;

// ?????§???????±???????(Dinic??????bfs()??????????????¨Ford-Fulkerson???)
class Flow{
	public:
		int N;	// ????????°
		vector<vc> F, C, edge;	// F:????????°?????? C:???????????? edge:??£??\????????????
		vector<bool> bf;	// ??????????????£???????????????
		vector<int> lv;	// S??????????????¢

		// ????????????????????? n:????????°
		Flow(int n): F(n,vc(n)), C(n,vc(n)), N(n), edge(n) {}

		// ??????????????????
		void addEdge(int f, int t, int c){
			F[f][t] = C[f][t] = c;
			edge[f].push_back(t);
			edge[t].push_back(f);
		}

		// s????????????????????¢????±?????????????????????????????????¨DFS??§??????????????¢??????????????¢?´¢??????
		int bfs(int S, int T){
			lv.assign(N, 0);
			queue<int> que;
			que.push(S);
			lv[S] = 1;
			while( !que.empty() ){
				int n = que.front(); que.pop();
				for(auto v: edge[n]) if( !lv[t] && F[n][v] ){
					lv[v] = lv[n] + 1;
					que.push(v);
				}
			}
			return level[T];
		}

		// ?¢?????????????DFS??§??¢???
		int flow(int n, int c, int T){
			if( n == T ) return c;
			bf[n] = true;
			for(int v: edge[n]) if( F[n][v] && !bf[v] && lv[v] > lv[n] ){	// ??????????????¶??????????????¨bfs()?????????????????????
				int f = flow(v, min(c, F[n][v]), T);
				F[n][v] -= f;
				F[v][n] += f;
				if( f > 0 ) return f;
			}
			return 0;
		}

		// ?????§???????±???????
		int maxFlow(int S, int T){
			int ret = 0;
			while( bfs(S,T) )	// bfs()???????????´?????????????????????????????????
				for(int add; bf.assign(N,0), add = flow(0, INF, T);) ret += add;
			return ret;
		}

		// ??°???????????????????????????
		void clear(){ rep(i,N) rep(j,N) F[i][j] = C[i][j]; }
};

int main(){
	int V, E;
	cin >> V >> E;
	Flow fl(V);
	rep(i, E){
		int u, v, c;
		cin >> u >> v >> c;
		fl.addEdge( u, v, c );
	}

	cout << fl.maxFlow(0, V-1) << endl;

	return 0;
}

Compiler output:
a.cc: In member function 'int Flow::bfs(int, int)':
a.cc:41:62: error: 't' was not declared in this scope
   41 |                                 for(auto v: edge[n]) if( !lv[t] && F[n][v] ){
      |                                                              ^
a.cc:46:32: error: 'level' was not declared in this scope
   46 |                         return level[T];
      |                                ^~~~~
Language: C++

#include <stdio.h>
#include <vector>
#include <algorithm>
int v, e;
struct Edge {
  Edge() {}
  Edge(int from_, int to_, int capacity_, int rev_) : from(from_), to(to_), capacity(capacity_), rev(rev_) {}
  int from;
  int to;
  int capacity;
  int rev;
};

std::vector<Edge> edges[128];

void addEdge(int from, int to, int capacity) {
  int n1 = edges[from].size();
  int n2 = edges[to].size();
  edges[from].push_back(Edge(from, to, capacity, n2));
  edges[to].push_back(Edge(to, from, 0, n1));
}

bool checked[128];
void init_flow() {
  for(int i = 0; i < 128; ++i) {
	checked[i] = false;
  }
}
int flow(int from, int to, int v) {
  if( from == to ) return v;
  checked[from] = true;
  for(Edge& edge : edges[from]) {
	if( checked[edge.to] ) continue;
	int nv = std::min(v, edge.capacity);
	if( nv == 0 ) continue;
	int f = flow(edge.to, to, nv);
	if( f == 0 ) continue;
	edge.capacity -= f;
	edges[edge.to][edge.rev] += f;
	return f;
  }
  return 0;
}

int maximum_flow(int from, int to) {
  int res = 0;
  for(;;) {
	init_flow();
	int v = flow(from, to, (1 << 30));
	if( v == 0 ) break;
	res += v;
  }
  return res;
}

int main() {
  scanf("%d %d", &v, &e);
  for(int i = 0; i < e; ++i) {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	addEdge(a, b, c);
  }

  printf("%d\n", maximum_flow(0, v - 1));

  return 0;
}

Compiler output:
a.cc: In function 'int flow(int, int, int)':
a.cc:39:34: error: no match for 'operator+=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<Edge>, Edge>::value_type' {aka 'Edge'} and 'int')
   39 |         edges[edge.to][edge.rev] += f;
Language: C++

#include <iostream>
#include <vector>
#include <climits>
#include <array>
using namespace std;
static const int maxv = 100;
static const int maxe = 1000;
struct edge{
  int from,to,cap,rev;
};

vector<edge> g[maxv];
array<bool,maxv> used;

int dfs(int f,int v,int t){
  if(v == t) return f;
  used[v] = true;
  for(auto &e:g[v]){
    if(e.cap <= 0) continue;
    if(used[e.to]) continue;
    int d = dfs(min(f,e.cap),e.to,t);
    if (d > 0){
      e.cap -= d;
      g[e.to][e.rev].cap += d;
      return d;
    }
  }
  return 0;
}

int max_flow(int s,int d){
  int f = 0;
  const int inf = INT_MAX / 3;
  while(true){
    fill(used.begin(), used.end(), false);
    int df = dfs(inf,s,d);
    if(df == 0) break;
    f += df;
  }
  return f;
}

int main(){
  int v,e;
  cin >> v >> e;
  for(int i = 0;i < e;i++){
    int u,v,c;
    cin >> u >> v >> c;
    g[u].push_back((edge){.cap = c, .to = v, .rev = (int)g[v].size()});
    g[v].push_back((edge){.cap = 0, .to = u, .rev = (int)g[u].size() - 1});
  }
  cout << max_flow(0, v-1) << endl; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:69: error: designator order for field 'edge::to' does not match declaration order in 'edge'
   49 |     g[u].push_back((edge){.cap = c, .to = v, .rev = (int)g[v].size()});
      |                                                                     ^
a.cc:50:73: error: designator order for field 'edge::to' does not match declaration order in 'edge'
   50 |     g[v].push_back((edge){.cap = 0, .to = u, .rev = (int)g[u].size() - 1});
      |                                                                         ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include <math.h>
#include <set>
#include <map>
using namespace std;
#define rep(i,n) for(int i = 0; i < n ; i++)
#define pb push_back
static const int INF = 1000000;

typedef pair<int, int> P;
typedef pair<P, int> PP;

static const int MAX_V = 100;

struct edge { int to, cap, rev; };
vector<edge> G[MAX_V];
bool used[MAX_V];

int dfs(int st, int ed, int f){
  if ( st == ed ) return f;
  used[st] = true;

  rep(i,G[st].size()){
    edge &e = G[st][i];
    if ( !used[e.to] && e.cap > 0 ){
      int d = dfs(e.to, ed, min(f,e.cap));
      if(d > 0){
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

int main(void){
  int v,e; cin >> v >> e;
  int a,b,c;
  rep(i,e){
    cin >> a >> b >> c;
    G[a].pb((edge){b,c,G[b].size()});
    G[b].pb((edge){a,0,G[a].size()-1});
  }

  //int st,ed; cin >> st >> ed;
  int flow = 0;
  while(true){
    memset(used,0,sizeof(used));
    int f = dfs(0,v-1,INF);
    if ( f == 0 ) {
      cout << flow << endl;
      break;
    }
    flow += f;
  }


  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:33: warning: narrowing conversion of 'G[b].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   47 |     G[a].pb((edge){b,c,G[b].size()});
      |                        ~~~~~~~~~^~
a.cc:48:35: warning: narrowing conversion of '(G[a].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   48 |     G[b].pb((edge){a,0,G[a].size()-1});
      |                        ~~~~~~~~~~~^~
a.cc:54:5: error: 'memset' was not declared in this scope
   54 |     memset(used,0,sizeof(used));
      |     ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <map>
  +++ |+#include <cstring>
   10 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include <math.h>
#include <set>
#include <map>
using namespace std;
#define rep(i,n) for(int i = 0; i < n ; i++)
#define pb push_back
static const int INF = 1000000;

typedef pair<int, int> P;
typedef pair<P, int> PP;

static const int MAX_V = 100;

struct edge { int to, cap, rev; };
vector<edge> G[MAX_V];
bool used[MAX_V];

int dfs(int st, int ed, int f){
  if ( st == ed ) return f;
  used[st] = true;

  rep(i,G[st].size()){
    edge &e = G[st][i];
    if ( !used[e.to] && e.cap > 0 ){
      int d = dfs(e.to, ed, min(f,e.cap));
      if(d > 0){
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

int main(void){
  int v,e; cin >> v >> e;
  int a,b,c;
  rep(i,e){
    cin >> a >> b >> c;
    G[a].pb((edge){b,c,G[b].size()});
    G[b].pb((edge){a,0,G[a].size()-1});
  }

  //int st,ed; cin >> st >> ed;
  int flow = 0;
  while(true){
    rep(i,used.size()){
      used[i] = 0;
    }
    int f = dfs(0,v-1,INF);
    if ( f == 0 ) {
      cout << flow << endl;
      break;
    }
    flow += f;
  }


  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:33: warning: narrowing conversion of 'G[b].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   47 |     G[a].pb((edge){b,c,G[b].size()});
      |                        ~~~~~~~~~^~
a.cc:48:35: warning: narrowing conversion of '(G[a].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   48 |     G[b].pb((edge){a,0,G[a].size()-1});
      |                        ~~~~~~~~~~~^~
a.cc:54:16: error: request for member 'size' in 'used', which is of non-class type 'bool [100]'
   54 |     rep(i,used.size()){
      |                ^~~~
a.cc:11:37: note: in definition of macro 'rep'
   11 | #define rep(i,n) for(int i = 0; i < n ; i++)
      |                                     ^
Language: C++

// this program implements Dinitz's algorithm

#include <cstdio>
#include <cstdlib>
#include <algorithm>

const int N = 110;
const int M = 2010;

struct Edge {
	int to, cap, next;
} es[M];

int S, T;  // source, sink
int SIZE = 0; // number of edges
int h[N]; // pointer to edge list
int dist[N], queue[N]; // for calculating shortest path

// add forward and backtracked edge
void add(int u, int v, int cap) {
	int i = SIZE++;
	es[i].to = v;
	es[i].cap = cap;
	es[i].next = h[u];
	h[u] = i; 
	int j = SIZE++;
	es[j].to = u;
	es[j].cap = 0;
	es[j].next = h[v];
	h[v] = j; 
}

// returns whether find a path from S to T
bool bfs() {
	int front = 0, back = 0;
	memset(dist, -1, sizeof(dist));
	queue[back++] = S;
	dist[S] = 0;
	while (front < back) {
		int x = queue[front++];
		for (int i = h[x]; i != -1; i = es[i].next)
			if (es[i].cap > 0) {
				int y = es[i].to;
				if (dist[y] == -1) {
					dist[y] = dist[x] + 1;
					queue[back++] = y;
				}
			}
		if (dist[T] != -1)
			return true;
	}
	return false;
}

// returns the flow pushed from x to T
int dfs(int x, int flow) {
	if (x == T) return flow;
	int dy = dist[x] + 1, ret = 0;
	for (int i = h[x]; i != -1 && flow > 0; i = es[i].next) {
		int y = es[i].to;
		if (dist[y] != dy) continue;
		int f = dfs(y, std::min(flow, es[i].cap));
		if (f != 0) {
			es[i].cap -= f;
			es[i^1].cap += f;
			ret += f;
			flow -= f;
		}
	}
	if (flow > 0)
		dist[x] = -1;
	return ret;
}

void run() {
	int n, m, u, v, c;
	scanf("%d%d", &n, &m);
	memset(h, -1, sizeof(h));
	S = 0, T = n - 1;
	for (int i = 0; i < m; i++) {
		scanf("%d%d%d", &u, &v, &c);
		add(u, v, c);
	}
	int flow = 0;
	while (bfs())
		flow += dfs(S, 0x3fffffff);
	printf("%d\n", flow);
}

int main() {
	run();
}

Compiler output:
a.cc: In function 'bool bfs()':
a.cc:36:9: error: 'memset' was not declared in this scope
   36 |         memset(dist, -1, sizeof(dist));
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <algorithm>
  +++ |+#include <cstring>
    6 | 
a.cc: In function 'void run()':
a.cc:78:9: error: 'memset' was not declared in this scope
   78 |         memset(h, -1, sizeof(h));
      |         ^~~~~~
a.cc:78:9: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

const int INF = 1e9 + 10;


class MaxFlow {
#define MAX_V 101
  struct Edge {
    int to, cap, rev;
    Edge(int to, int cap, int rev) : to(to), cap(cap), rev(rev) { }
  };

  vector<Edge> G[MAX_V];
  bool used[MAX_V];

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

    return 0;
  }

public:
  
  void add_edge(int from, int to, int cap) {
    G[from].push_back(Edge(to, cap, G[to].size()));
    G[to].push_back(Edge(from, 0, G[from].size() - 1));
  }

  int solve(int s, int t) {
    int flow = 0;

    while (true) {
      memset(used, 0, MAX_V);
      int f = dfs(s, t, INF);
      if (f == 0) {
        break;
      }
      flow += f;
    }

    return flow;
  }


};

int main() {
  int V, E;
  cin >> V >> E;
  int s = 0, t = V - 1;

  MaxFlow mf;

  for (int i = 0; i < E; i++) {
    int u, v, c;
    cin >> u >> v >> c;
    mf.add_edge(u, v, c);
  }

  int ans = mf.solve(s, t);

  cout << ans << endl;

  return 0;
}

Compiler output:
a.cc: In member function 'int MaxFlow::solve(int, int)':
a.cc:53:7: error: 'memset' was not declared in this scope
   53 |       memset(used, 0, MAX_V);
      |       ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 |