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


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

class dinic
{
private:
	struct edge
	{
		int to;
		long long cap;
		int rev;
		edge(int t_, long long c_, int r_) :to(t_), cap(c_), rev(r_) {}
	};
	std::vector<std::vector<edge> >G;
	std::vector<int>level, iter;
	//source??????BFS?????????
	void bfs(int s_)
	{
		fill(level.begin(), level.end(), -1);
		std::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);
				}
			}
		}
	}
	//DFS??§?¢?????????????????????????????????????
	long long dfs(int v_, int t_, long long 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])
			{
				long long d = dfs(e.to, t_, std::min(f_, e.cap));
				if (d > 0)
				{
					e.cap -= d;
					G[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}
public:
	//vec=????????°
	dinic(int vec_) :G(vec_), level(vec_), iter(vec_)
	{}
	//from??????to?????????cap???????????????
	void add_edge(int from_, int to_, long long cap_)
	{
		G[from_].push_back(edge(to_, cap_, G[to_].size()));
		G[to_].push_back(edge(from_, 0ll, G[from_].size() - 1));
	}
	//Dinic?????§?????°???????????????source??????sink?????§????????§??????????¨??????????
	//???????¨???????O(V^2*E)
	long long max_flow(int source_, int sink_)
	{
		int flow = 0;
		for (;;)
		{
			bfs(source_);
			if (level[sink_] < 0)return flow;
			fill(iter.begin(), iter.end(), 0);
			for (;;)
			{
				long long f = dfs(source_, sink_, LLONG_MAX);
				if (f > 0)flow += f;
				else break;
			}
		}
		return flow;
	}
};

#include <iostream>
using namespace std;

int main()
{
	int v, e;
	cin >> v >> e;
	dinic water(v);
	for (int i = 0; i < e; ++i)
	{
		int s, t, c;
		cin >> s >> t >> c;
		water.add_edge(s, t, c);
	}
	long long ans = water.max_flow(0, v - 1);
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In member function 'long long int dinic::max_flow(int, int)':
a.cc:81:67: error: 'LLONG_MAX' was not declared in this scope
   81 |                                 long long f = dfs(source_, sink_, LLONG_MAX);
      |                                                                   ^~~~~~~~~
a.cc:5:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <algorithm>
  +++ |+#include <climits>
    5 |
Language: C++

#include <bits/stdc++.h>

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
// #define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      long a, b;
      scan(a, b);
      for(long i = 61; i >= 0; ++i) {
         long x = ~((1LL << i) - 1)
      }
      long x = (~(a ^ b)) + 1;
      long y = x & ~(x - 1);
      printf("%ld\n", y);
      // std::set<long> set;
      // set.insert(0);
      // for(long i = a; i <= b; ++i) {
      //    std::set<long> temp = set;
      //    for(long x : temp) {
      //       set.insert(x | i);
      //    }
      // }
      // for(long x : set) {
      //    printf("%ld\n", x);
      // }
   }
};

int main() {
  loop std::unique_ptr<Solver>(new Solver())->solve();
}

Compiler output:
a.cc: In member function 'void Solver::solve()':
a.cc:31:7: error: expected ',' or ';' before '}' token
   31 |       }
      |       ^
Language: C++

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

struct edge{ int to, cap, rev;};
vector< vector <edge> > G(100);
int INF = 100000000;
bool used[100];

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;
}

int max_flow(int s, int t){
  int flow = 0;
  for(;;){
    memset(used, 0, sizeof(used));
    int f = dfs(s, t, INF);
    if(!f) return flow;
    flow += f;
  }
}


int main(){
  int V, E;
  cin >> V >> E;

  int u, v, c;
  for(int i = 0; i < E; ++i){
    cin >> u >> v >> c;
    G[u].push_back((edge){v,c,G[v].size()});
    G[v].push_back((edge){u,c,G[u].size()-1});
  }
  cout << max_flow(0,V-1) << endl;;
  return 0;
}

Compiler output:
a.cc: In function 'int max_flow(int, int)':
a.cc:30:5: error: 'memset' was not declared in this scope
   30 |     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;
a.cc: In function 'int main()':
a.cc:45:40: warning: narrowing conversion of '(& G.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)v)))->std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   45 |     G[u].push_back((edge){v,c,G[v].size()});
      |                               ~~~~~~~~~^~
a.cc:46:42: warning: narrowing conversion of '((& G.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)u)))->std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   46 |     G[v].push_back((edge){u,c,G[u].size()-1});
      |                               ~~~~~~~~~~~^~
Language: C++

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

struct edge{ int to, cap, rev;};
vector< vector <edge> > G(100);
int INF = 100000000;
bool used[100];

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;
}

int max_flow(int s, int t){
  int flow = 0;
  for(;;){
    memset(used, 0, sizeof(used));
    int f = dfs(s, t, INF);
    if(!f) return flow;
    flow += f;
  }
}


int main(){
  int V, E;
  cin >> V >> E;

  int u, v, c;
  for(int i = 0; i < E; ++i){
    cin >> u >> v >> c;
    G[u].push_back((edge){v,c,G[v].size()});
    G[v].push_back((edge){u,c,G[u].size()-1});
  }
  cout << max_flow(0,V-1) << endl;;
  return 0;
}

Compiler output:
a.cc: In function 'int max_flow(int, int)':
a.cc:31:5: error: 'memset' was not declared in this scope
   31 |     memset(used, 0, sizeof(used));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc: In function 'int main()':
a.cc:46:40: warning: narrowing conversion of '(& G.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)v)))->std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   46 |     G[u].push_back((edge){v,c,G[v].size()});
      |                               ~~~~~~~~~^~
a.cc:47:42: warning: narrowing conversion of '((& G.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)u)))->std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   47 |     G[v].push_back((edge){u,c,G[u].size()-1});
      |                               ~~~~~~~~~~~^~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

using namespace std;

void solve(int v, int e) {
	vector<vector<int>> capacities(v, vector<int>(v, 0));
	auto residual = [&](int from, int to) {
		return capacities[from][to];
	};

	for (int i = 0; i < e; i++) {
		int from, to, capacity;
		cin >> from >> to >> capacity;
		capacities[from][to] = capacity;
	}

	int max_flow = 0;
	while (true) {
		stack<vector<int>> paths;
		vector<int> visited(v, 0);
		paths.push({0});
		bool traveresed_all = false;
		while (!traveresed_all) {
			auto path = paths.front();
			paths.pop();
			auto last = path.back();
			if (!visited[last]) {
				visited[last] = 1;
				if (last == v - 1) {
					for (int i = 0; i < path.size() - 1; i++) {
						capacities[path[i]][path[i + 1]]--;
						capacities[path[i + 1]][path[i]]++;
					}
					max_flow++;
					break;
				}
				for (int i = 0; i < v; i++) {
					if (!visited[i] && residual(last, i) > 0) {
						auto new_path = path;
						new_path.push_back(i);
						paths.push(new_path);
					}
				}
			}
			traveresed_all = paths.empty();
		}
		if (traveresed_all) {
			cout << max_flow << endl;
			return;
		}
	}
}

int main() {
	int v, e;
	cin >> v >> e;
	solve(v, e);
}

Compiler output:
a.cc: In function 'void solve(int, int)':
a.cc:32:43: error: 'class std::stack<std::vector<int> >' has no member named 'front'
   32 |                         auto path = paths.front();
      |                                           ^~~~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define rrep(i,n) for(ll i=(n)-1;i>=0;--i)
#define rep1(i,n) for(ll i=1;i<=(n);++i)
#define rrep1(i,n) for(ll i=(n);i>=1;--i)
#define fr first
#define sc second
#define pb push_back
#define INF 0xfffffff
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
struct edge{ll to,cap,rev; }; // ????????????????????????

vector<edge> G[100];
vector<edge> rG[100];
ll d[100];
ll a[100];
ll cnt=0;
void add_edge(ll from,ll to,ll cap){
	G[from].pb((edge){to, cap, rG[to].size() });
	rG[to].pb((edge){from, 0, G[from].size()-1} );
}

ll calc(ll t){
	ll res = 0;
	rep(i,rG[t].size()){
		res+=rG[t][i].cap;
	}
	return res;
}

ll max_flow(ll V,ll E,ll s,ll t){
	ll res=0;
	memset( d, 0, sizeof(d) );
	memset( a, 0, sizeof(a) );
	d[s] = V;
	a[s]=-1;
	a[t]=-1;
	rep(i,G[s].size()){
		if(G[s][i].to!=t){
			edge &e = G[s][i];
			a[e.to] += e.cap;
			rG[e.to][e.rev].cap = e.cap;
			e.cap = 0;
		}
		else{
			res+=G[s][i].cap;
		}
	}

	for(;;){
		ll v = -1;  //1
		rep(i,V){
			if( a[i]>0 ){
				v = i;
				break;
			}
		}
		if(v < 0) return res+calc(t);
		ll J=0; //2
		ll id;
		rep(i,G[v].size()){
			if( G[v][i].cap>0 && d[v] - d[G[v][i].to] == 1 ){
				id = i;
				J=1;
				break;
			}
		}
		if(!J) rep(i,rG[v].size()){
			if( rG[v][i].cap>0 && d[v] - d[rG[v][i].to] == 1 ){
				id = i;
				J=2;
				break;
			}
		}
	
		if(J){  //3
			edge &e = (J==1?G[v][id]:rG[v][id]);
			if(J==1){
				ll f = min(a[v], e.cap );
				a[v] -= f;
				e.cap -= f;
				rG[e.to][e.rev].cap += f;
				if(a[e.to]>=0) a[e.to] += f;
			}
			else{
				edge &efor = G[e.to][e.rev];
				ll f = min(a[v], e.cap);
				a[v] -= f;
				e.cap -= f;
				efor.cap += f;
				if(a[e.to]>=0) a[e.to] += f;
			}
		}

		else{  //4
			ll dmin=0xfffffff;
			rep(i,G[v].size()){
				if(G[v][i].cap>0) dmin = min(dmin,d[G[v][i].to]);
			}
			rep(i,rG[v].size()){
				if(rG[v][i].cap>0) dmin = min(dmin,d[rG[v][i].to]);
			}
			d[v] = dmin + 1;
		}
	}
}

ll V,E,A[1000],B[1000],C[1000];

void input(){
	scanf("%lld%lld",&V,&E);
	rep(i,E){
		scanf("%lld%lld%lld",&A[i],&B[i],&C[i]);
	}
}

Compiler output:
a.cc: In function 'void add_edge(ll, ll, ll)':
a.cc:24:47: warning: narrowing conversion of 'rG[to].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'll' {aka 'long long int'} [-Wnarrowing]
   24 |         G[from].pb((edge){to, cap, rG[to].size() });
      |                                    ~~~~~~~~~~~^~
a.cc:25:49: warning: narrowing conversion of '(G[from].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'll' {aka 'long long int'} [-Wnarrowing]
   25 |         rG[to].pb((edge){from, 0, G[from].size()-1} );
      |                                   ~~~~~~~~~~~~~~^~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>t s, int t){
#include<vector>
using namespace std;
  while(true){
const int MAX_V = 1111; << flow << endl;
const int INF = (1 << 27);
    if(nnode[t] < 0)return flow;
typedef struct{iter+MAX_V, 0); 
  int to;;
  int cap, rev;dfs(s, t, INF)) > 0){
}edge;flow += f;
    }
vector<edge> node[MAX_V];
queue<int> que;
int v, e;
int nnode[MAX_V];
int iter[MAX_V];

void input();
int dfs(int s, int t, int f);
void bfs(int s);
int max_flow(int s, int t);

int main(){
  ios_base::sync_with_stdio(false);

  input();

  cout << max_flow(0, v-1) << endl;

  return 0;
}


void input(){

  cin >> v >> e;

  for(int i=0;i<e;i++){
    int from, to, cap;
    cin >> from >> to >> cap;
    node[from].push_back((edge){to, cap, node[to].size()});
    node[to].push_back((edge){from, cap, node[from].size() - 1});
  }

  return;
}

int dfs(int s, int t, int f){
  //cout << s << " " << t << " " << f << endl;
  if(s == t)return f;

  for(int &i=iter[s];i<node[s].size();i++){
    edge &now = node[s][i];

    if(now.cap > 0 && nnode[s] < nnode[now.to]){
      int d = dfs(now.to , t, min(f, now.cap));
      //cout << "d = " << d << endl;
      if(d > 0){
        now.cap -= d;
        node[now.to][now.rev].cap += d;
        return d;
      }
    }
  } 

  return 0; 
}

void bfs(int s){

  fill(nnode, nnode+MAX_V, -1); 

  que.push(s);  
  nnode[s] = 0;
  while(!que.empty()){
    int now = que.front(); que.pop();

    //cout << "node[now].size() = " << node[now].size() << endl; 

    for(int i=0;i<node[now].size();i++){
      edge &now_node = node[now][i];

      //cout << now_node.cap << " " << nnode[now_node.to] << endl;

      if(now_node.cap > 0 && nnode[now_node.to] == -1){
        que.push(now_node.to);
        nnode[now_node.to] = nnode[now] + 1;
      }
    }
  }
  //cout << endl;
  return;
}

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

  while(true){
    //cout << "flow = " << flow << endl;
    bfs(s);  
    if(nnode[t] < 0)return flow;
    fill(iter, iter+MAX_V, 0); 
    int f;
    while((f = dfs(s, t, INF)) > 0){
      flow += f;
    }
  }
}

Compiler output:
a.cc:3:18: warning: extra tokens at end of #include directive
    3 | #include<queue>t s, int t){
      |                  ^
a.cc:3:9: fatal error: queue>: No such file or directory
    3 | #include<queue>t s, int t){
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define reps(i, n) for(int i = 1; i <= n; i++)
#define pb push_back

const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;

int MAX_V=100010; //????????????

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

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

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

int dfs(int s, int t, int f)
{
	if(s==t) return f;
	rep(i, G[s].size())
	{
		edge &e=G[s][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;
}

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

int main()
{
	int v, e;
	cin >> v >> e;
	int a, b, c;
	rep(i, e)
	{
		cin >> a >> b >> c;
		add_edge(a, b, c);
	}
	cout << max_flow(0, v-1) << endl;
	return 0;
}

Compiler output:
a.cc:21:16: error: size of array 'G' is not an integral constant-expression
   21 | vector<edge> G[MAX_V];
      |                ^~~~~
a.cc:22:11: error: size of array 'used' is not an integral constant-expression
   22 | bool used[MAX_V];
      |           ^~~~~
a.cc: In function 'void add_edge(int, int, int)':
a.cc:26:46: warning: narrowing conversion of 'G[to].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   26 |         G[from].pb((edge){to, cap, G[to].size()});
      |                                    ~~~~~~~~~~^~
a.cc:27:48: warning: narrowing conversion of '(G[from].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   27 |         G[to].pb((edge){from, 0, G[from].size()-1});
      |                                  ~~~~~~~~~~~~~~^~
Language: C++

#include<iostream>
#include<vector>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define INF 1e7
using namespace std;

const int MAX_V=200;

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

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

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

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;
}

int max_flow(int s,int t){
	int flow=0;
	for(;;){
		memset(used,0,sizeof(used));
		int f=dfs(s,t,INF);
		if(f==0)return flow;
		flow+=f;
	}
}

int main(){
	int n,m,u,v,c;
	cin>>n>>m;
	rep(i,m){
		cin>>u>>v>>c;
		add_edge(u,v,c);
	}
	cout<<max_flow(0,n-1)<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void add_edge(int, int, int)':
a.cc:17:44: warning: narrowing conversion of 'G[to].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   17 |         G[from].pb((edge){to,cap,G[to].size()});
      |                                  ~~~~~~~~~~^~
a.cc:18:46: warning: narrowing conversion of '(G[from].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   18 |         G[to].pb((edge){from,0,G[from].size()-1});
      |                                ~~~~~~~~~~~~~~^~
a.cc: In function 'int max_flow(int, int)':
a.cc:41:17: error: 'memset' was not declared in this scope
   41 |                 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 | #define loop(i,a,b) for(int i=a;i<b;i++)
Language: C++

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

int way[1001];
int max = 0;
int m;
int n;
int gr[100][100];

int minF(int a, int b) {
	if (a < b) return a;
	else return b;
}

void flow(int step, int v, int min) {
	if (v == n - 1) {
		for (int i = 0; i < step - 1; ++i) {
			gr[way[i]][way[i + 1]] -= min;
		}
		max += min;
		return;
	}
	
	for (int i = 0; i < n; ++i) {
		if (gr[v][i]) {
			flow(step + 1, i, minF(min, gr[v][i]));
		}
	}
}

int main() {
	cin >> n;
	
	cin >> m;
	int u, v, c;
	for (int i = 0; i < m; ++i)
	{
		cin >> u >> v >> c;
		gr[u][v] = c;
	}

	flow(0, 0, 10000000);

	cout << max;

    return 0;
}

Compiler output:
a.cc: In function 'void flow(int, int, int)':
a.cc:21:17: error: reference to 'max' is ambiguous
   21 |                 max += min;
      |                 ^~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:5: note:                 'int max'
    6 | int max = 0;
      |     ^~~
a.cc: In function 'int main()':
a.cc:45:17: error: reference to 'max' is ambiguous
   45 |         cout << max;
      |                 ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:5: note:                 'int max'
    6 | int max = 0;
      |     ^~~
Language: C++

#include <iostream>
#include <stdlib.h>
using namespace std;

int way[1001];
int maxFlow = 0;
int m;
int n;
int gr[100][100];
int f = 0;
int used[100];

int minF(int a, int b) {
	if (a < b) return a;
	else return b;
}

void flow(int step, int v, int min) {
	way[step] = v;
	if (v == n - 1) {
		for (int i = 0; i < step; ++i) {
			gr[way[i]][way[i + 1]] -= min;
		}
		maxFlow += min;
		f = 1;
		return;
	}
	
	for (int i = n - 1; i >= 0 && !f; --i) {
		if (gr[v][i] && !used[i]) {
			used[i] = 1;
			flow(step + 1, i, minF(min, gr[v][i]));
		}
	}
	return;
}

int main() {
	cin >> n;
	
	cin >> m;
	int u, v, c;
	for (int i = 0; i < m; ++i)
	{
		cin >> u >> v >> c;
		gr[u][v] = c;
	}
	while (true) {
		memset(used, 0 , 100 * 4);
		flow(0, 0, 10000000);
		if (f) 
			f = 0;
		else
			break;
	}
	cout << maxFlow << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:17: error: 'memset' was not declared in this scope
   49 |                 memset(used, 0 , 100 * 4);
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <stdlib.h>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007
struct edge{int to,cap,rev;};

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[from].size()-1});
}

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){
	c.cap-=d;
	G[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  for(;;){
    memset(used,0,sizeof(used));
    int f=dfs(s,t,INF);
    if(f==0)return flow;
    flow+=f;
  }
}

int main(){
  int V,E;
  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;
  return 0;
}



Compiler output:
a.cc:6:16: error: 'MAX_V' was not declared in this scope
    6 | vector<edge> G[MAX_V];
      |                ^~~~~
a.cc:7:11: error: 'MAX_V' was not declared in this scope
    7 | bool used[MAX_V];
      |           ^~~~~
a.cc: In function 'void add_edge(int, int, int)':
a.cc:10:3: error: 'G' was not declared in this scope
   10 |   G[from].push_back((edge){to,cap,G[to].size()});
      |   ^
a.cc: In function 'int dfs(int, int, int)':
a.cc:16:3: error: 'used' was not declared in this scope
   16 |   used[v]=true;
      |   ^~~~
a.cc:17:17: error: 'G' was not declared in this scope
   17 |   for(int i=0;i<G[v].size();i++){
      |                 ^
a.cc:22:9: error: 'c' was not declared in this scope
   22 |         c.cap-=d;
      |         ^
a.cc: In function 'int max_flow(int, int)':
a.cc:34:12: error: 'used' was not declared in this scope
   34 |     memset(used,0,sizeof(used));
      |            ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define INF 1000000007
#define MAX_V 1000
struct edge{int to,cap,rev;};

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[from].size()-1});
}

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){
	c.cap-=d;
	G[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  for(;;){
    memset(used,0,sizeof(used));
    int f=dfs(s,t,INF);
    if(f==0)return flow;
    flow+=f;
  }
}

int main(){
  int V,E;
  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;
  return 0;
}



Compiler output:
a.cc: In function 'void add_edge(int, int, int)':
a.cc:11:45: warning: narrowing conversion of 'G[to].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   11 |   G[from].push_back((edge){to,cap,G[to].size()});
      |                                   ~~~~~~~~~~^~
a.cc:12:47: warning: narrowing conversion of '(G[from].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   12 |   G[to].push_back((edge){from,0,G[from].size()-1});
      |                                 ~~~~~~~~~~~~~~^~
a.cc: In function 'int dfs(int, int, int)':
a.cc:23:9: error: 'c' was not declared in this scope
   23 |         c.cap-=d;
      |         ^
Language: C++

#include <iostream>
#include <vector>
#define MAX_V 102
#define INF (int)1e9

using namespace std;


struct edge{int to,cap,rev;};
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,(int)G[to].size()});
	G[to].push_back((edge){from,0,(int)G[from].size()-1});
}

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;
}
int max_flow(int s, int t){
	int flow = 0;
	for(;;){
		memset(used,0,sizeof(used));
		int f = dfs(s,t,INF);
		if(f == 0) return flow;
		flow += f;
	}
}
int main(){
	int V,E,c[3][E];
	cin >> V >> E;
	for (int i = 0; i < E; ++i)
	{
		int from,to,cap;
		cin >> from >> to >> cap;
		add_edge(from,to,cap);
	}
	int ans = max_flow(0,V-1);
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int max_flow(int, int)':
a.cc:38:17: error: 'memset' was not declared in this scope
   38 |                 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 | #define MAX_V 102
Language: C++

#include <iostream>
#include <vector>
#define MAX_V 102
#define INF (int)1e9

using namespace std;


struct edge{int to,cap,rev;};
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,(int)G[to].size()});
	G[to].push_back((edge){from,0,(int)G[from].size()-1});
}

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;
}
int max_flow(int s, int t){
	int flow = 0;
	for(;;){
		memset(used,0,sizeof(used));
		int f = dfs(s,t,INF);
		if(f == 0) return flow;
		flow += f;
	}
}
int main(){
	int V,E,c[3][E];
	cin >> V >> E;
	for (int i = 0; i < E; ++i)
	{
		int from,to,cap;
		cin >> from >> to >> cap;
		add_edge(from,to,cap);
	}
	int ans = max_flow(0,V-1);
	cout << ans << endl;
	return 0;
samemset c++ includeinclude <>cstring


Compiler output:
a.cc: In function 'int max_flow(int, int)':
a.cc:38:17: error: 'memset' was not declared in this scope
   38 |                 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 | #define MAX_V 102
a.cc: In function 'int main()':
a.cc:56:1: error: 'samemset' was not declared in this scope; did you mean 'wmemset'?
   56 | samemset c++ includeinclude <>cstring
      | ^~~~~~~~
      | wmemset
a.cc:56:38: error: expected '}' at end of input
   56 | samemset c++ includeinclude <>cstring
      |                                      ^
a.cc:44:11: note: to match this '{'
   44 | int main(){
      |           ^
Language: C++

#include <vector>
#include <list>
#include <algorithm>
using namespace std;

typedef vector<int> VInt;
typedef vector<VInt> VVInt;

typedef list<int> LInt;
typedef vector<LInt> VLInt;
typedef LInt::iterator LIter;
typedef vector<LIter> VLIter;

// Input: the network
int n, src, dest;
VVInt c;

// Output: the flow (preflow while the algo is running)
VVInt f;

// Additional data
VInt h, e;
VLInt nei;
VLIter current;

// Lift the vertex. Assumes that this is possible.
void lift(int u)
{
	int height = 2 * n;
	for (LIter it = nei[u].begin(); it != nei[u].end(); it++)
		if (c[u][*it] > f[u][*it])
			height = min(height, h[*it]);
	h[u] = height + 1;
}

// Push the flow along the given edge. Assumes that this is possible.
void push(int u, int v)
{
	int value = min(c[u][v] - f[u][v], e[u]);
	f[u][v] += value;
	f[v][u] = -f[u][v];
	e[u] -= value;
	e[v] += value;
}

// Discharge the given vertex. Returns true if lifting occurred.
bool discharge(int u)
{
	bool lifted = false;
	while (e[u] > 0) {
		if (current[u] == nei[u].end()) {
			lift(u);
			lifted = true;
			current[u] = nei[u].begin();
			continue;
		}
		int v = *current[u];
		if (c[u][v] > f[u][v] && h[u] == h[v] + 1)
			push(u, v);
		else
			current[u]++;
	}
	return lifted;
}

// The actual lift-to-front algo (with initialization)
// Returns the max flow value
int ltf()
{
	int u, v;

	// Build the neighbours lists
	nei.resize(n);
	current.resize(n);
	for (u = 0; u<n; u++) {
		for (v = 0; v<n; v++)
			if (c[u][v] > 0 || c[v][u] > 0)
				nei[u].push_back(v);
		current[u] = nei[u].begin();
	}

	// Initialize the preflow
	f.assign(n, VInt(n, 0));
	e.assign(n, 0);
	h.assign(n, 0);
	h[src] = n;
	for (u = 0; u<n; u++)
		if (c[src][u] > 0) {
			e[u] = c[src][u];
			f[src][u] = c[src][u];
			f[u][src] = -f[src][u];
		}

	// lift-to-front
	LInt theList;
	for (u = 0; u<n; u++)
		if (u != src && u != dest)
			theList.push_back(u);
	LIter cur = theList.begin();
	while (cur != theList.end()) {
		u = *cur;
		if (discharge(u)) {
			theList.erase(cur);
			cur = theList.insert(theList.begin(), u);
		}
		cur++;
	}
	return e[dest];
}

// A small demo
int main()
{
	int i, j, edgeCount;

	// read the input
	scanf("%d%d%d%d", &n, &edgeCount);
	src = 0;
	dest = n - 1;
	c.assign(n, VInt(n, 0));
	while (edgeCount--) {
		int val;
		scanf("%d%d%d", &i, &j, &val);
		c[i][j] = val;
	}

	// find the max. flow
	int result = ltf();

	// print the results
	printf("%d\n", result);
	/*for (i = 0; i<n; i++)
		for (j = 0; j<n; j++)
			if (f[i][j] > 0)
				printf("%d -> %d : %d\n", i, j, f[i][j]);*/
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:117:9: error: 'scanf' was not declared in this scope
  117 |         scanf("%d%d%d%d", &n, &edgeCount);
      |         ^~~~~
a.cc:131:9: error: 'printf' was not declared in this scope
  131 |         printf("%d\n", result);
      |         ^~~~~~
a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    3 | #include <algorithm>
  +++ |+#include <cstdio>
    4 | using namespace std;
Language: C++

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

#define MAX_N 108
#define MAX_M 216000
#define EPS (1e-13)
#define INF (1LL << 28)
template<typename T>
class MaxFlow{
private:
  struct Edge{
      int to, rev;
      T cap;
      Edge(int t, int r, T c){
        to = t;
        rev = r;
        cap = c;
      }
  };

  vector<Edge> edges[MAX_N];
  bool done[MAX_N];
public:
  void add_edge(int from, int to, T f){
    edges[from].push_back(Edge(to, edges[to].size(), f));
    edges[to].push_back(Edge(from, edges[from].size()-1, 0));
  }

  T dfs(int now, int t, T f){
    if(done[now])return 0;
    done[now] = true;
    if(now == t)return f;
    for(int i = 0;i < edges[now].size();i++){
      Edge &e = edges[now][i];
      if(e.cap == 0)exit(-190);
      if(e.cap < EPS)continue;
      T tmp = dfs(e.to, t, min(e.cap, f));
      if(tmp < EPS)continue;
      e.cap -= tmp;
      edges[e.to][e.rev].cap += tmp;
      break;
    }
    return tmp;
  }

  T max_flow(int s, int t){
    T res = 0;
    while(true){
      fill(done, done + MAX_N, false);
      T tmp = dfs(s, t, INF);
      if(tmp < EPS)return res;
      res += tmp;
    }
  }
};

int main(){
    int n, m, s, t, u, v, f;
    MaxFlow<int> mf;
    cin >> n >> m;
    s = 0;
    t = n-1;
    /*for(int i = 0;i < m;i++){
      cin >> u >> v >> f;
      mf.add_edge(u, v, f);
    }*/
    mf.add_edge(s,t,3);
    int tmp = mf.max_flow(s, t);
    cout << tmp << endl;
    return 0;
}



Compiler output:
a.cc: In member function 'T MaxFlow<T>::dfs(int, int, T)':
a.cc:45:12: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   45 |     return tmp;
      |            ^~~
      |            tm
Language: C++

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

#define MAX_N 108
#define MAX_M 216000
#define EPS (1e-13)
#define INF (1LL << 28)
template<typename T>
class MaxFlow{
private:
  struct Edge{
      int to, rev;
      T cap;
      Edge(int t, int r, T c){
        to = t;
        rev = r;
        cap = c;
      }
  };

  vector<Edge> edges[MAX_N];
  bool done[MAX_N];
public:
  void add_edge(int from, int to, T f){
    edges[from].push_back(Edge(to, edges[to].size(), f));
    edges[to].push_back(Edge(from, edges[from].size()-1, 0));
  }

  T dfs(int now, int t, T f){
    if(done[now])return 0;
    done[now] = true;
    if(now == t)return f;
    for(int i = 0;i < edges[now].size();i++){
      Edge &e = edges[now][i];
      if(e.cap < EPS)continue;
      T tmp = dfs(e.to, t, min(e.cap, f));
      if(tmp < EPS)continue;
      e.cap -= tmp;
      edges[e.to][e.rev].cap += tmp;
      return tmp;
    }
    return 0;
  }

  T max_flow(int s, int t){
    T res = 0;
    while(true){
      fill(done, done + MAX_N, false);
      T tmp = dfs(s, t, INF);
      if(tmp < EPS)return res;
      res += tmp;
    }
  }
};

int main(){
    int n, m, s, t, u, v, f;
    MaxFlow<int> mf;
    cin >> n >> m;
    s = 0;
    t = n-1;
    /*for(int i = 0;i < m;i++){
      cin >> u >> v >> f;
      mf.add_edge(u, v, f);
    }*/
    mf.add_edge(s,t,3);
    int tmp = mf.max_flow(s, t);
    cout << tmp << endl;
    return 0;
}


int main(){
    int n, m, s, t, u, v, f;
    MaxFlow<int> mf;
    cin >> n >> m;
    s = 0;
    t = n-1;
    /*for(int i = 0;i < m;i++){
      cin >> u >> v >> f;
      mf.add_edge(u, v, f);
    }*/
    mf.add_edge(s,t,3);
    int tmp = mf.max_flow(s, t);
    cout << tmp << endl;
    return 0;
}



Compiler output:
a.cc:75:5: error: redefinition of 'int main()'
   75 | int main(){
      |     ^~~~
a.cc:58:5: note: 'int main()' previously defined here
   58 | int main(){
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int INF=0x3f3f3f3f;
const int maxn=105;
const int maxq=1005;

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

int n,m,k;
int d[maxn];
int a[maxn];
int p1[maxn];
int p2[maxn];
bool inq[maxn];
vector<edge>G[maxn];

void add_edge(int u,int v,int c,int w) {
	G[u].pb(edge{v,c,w,int(G[v].size())});
	G[v].pb(edge{u,0,-w,int(G[u].size()-1)});
}

int mcmf(int s,int t) {
	int flow=0 , cost=0;
	while (1) {
		memset(d,0x3f,sizeof(d));
		memset(p1,0,sizeof(p1));
		memset(p2,0,sizeof(p2));
		d[s]=0; a[s]=max(0,k-flow);
		int qh=0,qt=0,q[maxq];
		q[qt++]=s; inq[s]=1;
		while (qh<qt) {
			int u=q[qh++];
			inq[u]=0;
			for (int i=0;i<G[u].size();i++) {
				edge e=G[u][i];
				if (d[e.to]>d[u]+e.cost && e.cap) {
					d[e.to]=d[u]+e.cost;
					a[e.to]=min(a[u],e.cap);
					p1[e.to]=u;
					p2[e.to]=i;
					if (!inq[e.to]) {
						q[qt++]=e.to;
						inq[e.to]=1;
					}
				}
			}
		}
		if (d[t]==INF || !a[t]) break;
		flow+=a[t];
		cost+=a[t]*d[t];
		for (int u=t;u!=s;) {
			edge e=G[p1[u]][p2[u]];
			G[p1[u]][p2[u]]-=d;
			G[e.to][e.rev]+=d;
		}
	}
	if (flow<k) return -1;
	else return cost;
}

int main() {
	cin>>n>>m>>k;
	for (int i=0;i<m;i++) {
		int u,v,c,w; cin>>u>>v>>c>>w;
		add_edge(u,v,c,w);
	}
	cout<<mcmf(0,n-1)<<'\n';
}



Compiler output:
a.cc: In function 'int mcmf(int, int)':
a.cc:54:40: error: no match for 'operator-=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<edge>, edge>::value_type' {aka 'edge'} and 'int [105]')
   54 |                         G[p1[u]][p2[u]]-=d;
a.cc:55:39: error: no match for 'operator+=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<edge>, edge>::value_type' {aka 'edge'} and 'int [105]')
   55 |                         G[e.to][e.rev]+=d;
Language: C++

#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int INF=0x3f3f3f3f;
const int maxn=105;
const int maxq=1005;

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

int n,m,k;
int d[maxn];
int a[maxn];
int p1[maxn];
int p2[maxn];
bool inq[maxn];
vector<edge>G[maxn];

void add_edge(int u,int v,int c,int w) {
	G[u].pb(edge{v,c,w,int(G[v].size())});
	G[v].pb(edge{u,0,-w,int(G[u].size()-1)});
}

int mcmf(int s,int t) {
	int flow=0 , cost=0;
	while (1) {
		memset(d,0x3f,sizeof(d));
		d[s]=0; a[s]=max(0,k-flow);
		int qh=0,qt=0,q[maxq];
		q[qt++]=s; inq[s]=1;
		while (qh<qt) {
			int u=q[qh++];
			inq[u]=0;
			for (int i=0;i<G[u].size();i++) {
				edge e=G[u][i];
				if (d[e.to]>d[u]+e.cost && e.cap) {
					d[e.to]=d[u]+e.cost;
					a[e.to]=min(a[u],e.cap);
					p1[e.to]=u;
					p2[e.to]=i;
					if (!inq[e.to]) {
						q[qt++]=e.to;
						inq[e.to]=1;
					}
				}
			}
		}
		if (d[t]==INF || !a[t]) break;
		flow+=a[t];
		cost+=a[t]*d[t];
		for (int u=t;u!=s;) {
			edge e=G[p1[u]][p2[u]];
			G[p1[u]][p2[u]].cap-=d;
			G[e.to][e.rev].cap+=d;
		}
	}
	if (flow<k) return -1;
	else return cost;
}

int main() {
	cin>>n>>m>>k;
	for (int i=0;i<m;i++) {
		int u,v,c,w; cin>>u>>v>>c>>w;
		add_edge(u,v,c,w);
	}
	cout<<mcmf(0,n-1)<<'\n';
}



Compiler output:
a.cc: In function 'int mcmf(int, int)':
a.cc:52:44: error: invalid operands of types 'int' and 'int*' to binary 'operator-'
   52 |                         G[p1[u]][p2[u]].cap-=d;
a.cc:52:44: note:   in evaluation of 'operator-=(int, int*)'
a.cc:53:43: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   53 |                         G[e.to][e.rev].cap+=d;
Language: C++

#include<vector>
#include<queue>
#include<algorithm>
#define MAX 101
#define inf 1<<29
using namespace std;

typedef pair<int,int> P;

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

int v;
vector<edge> e[MAX];
int h[MAX];
int dist[MAX];
int prevv[MAX],preve[MAX];

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

int min_cost_flow(int s,int t,int f){
  int res=0;
  fill(h,h+v,0);
  while(f>0){
    priority_queue<P,vector<P>,greater<P> > pq;
    fill(dist,dist+v,inf);
    dist[s]=0;
    pq.push(P(0,s));
    while(pq.size()){
      P p=pq.top();
      pq.pop();
      int u=p.second;
      if(dist[u]<p.first)continue;
      for(int i=0;i<e[u].size();i++){
        edge &E=e[u][i];
        if(E.cap>0 && dist[E.to]>dist[u]+E.cost+h[u]-h[E.to]){
          dist[E.to]=dist[u]+E.cost+h[u]-h[E.to];
          prevv[E.to]=u;
          preve[E.to]=i;
          pq.push(P(dist[E.to],E.to));
        }
      }
    }
    if(dist[t]==inf)return -1;
    for(int i=0;i<v;i++)h[i]+=dist[i];

    int d=f;
    for(int u=t;u!=s;u=prevv[u]){
      d=min(d,e[prevv[u]][preve[u]].cap);
    }
    f-=d;
    res+=d*h[t];
    for(int u=t;u!=s;u=prevv[u]){
      edge &E=e[prevv[u]][preve[u]];
      E.cap-=d;
      e[u][E.rev].cap+=d;
    }
  }
  return res;
}

int main()
{
  int m,f,a,b,c,d;
  
  cin>>v>>m>>f;
  for(int i=0;i<m;i++){
    cin>>a>>b>>c>>d;
    add_edge(a,b,c,d);
  }

  cout<<min_cost_flow(0,v-1,f)<<endl;

  return 0;
}

Compiler output:
a.cc: In function 'void add_edge(int, int, int, int)':
a.cc:19:50: warning: narrowing conversion of 'e[to].std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   19 |   e[from].push_back((edge){to,cap,cost,e[to].size()});
      |                                        ~~~~~~~~~~^~
a.cc:20:53: warning: narrowing conversion of '(e[from].std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   20 |   e[to].push_back((edge){from,0,-cost,e[from].size()-1});
      |                                       ~~~~~~~~~~~~~~^~
a.cc: In function 'int main()':
a.cc:68:3: error: 'cin' was not declared in this scope
   68 |   cin>>v>>m>>f;
      |   ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<algorithm>
  +++ |+#include <iostream>
    4 | #define MAX 101
a.cc:74:3: error: 'cout' was not declared in this scope
   74 |   cout<<min_cost_flow(0,v-1,f)<<endl;
      |   ^~~~
a.cc:74:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:74:33: error: 'endl' was not declared in this scope
   74 |   cout<<min_cost_flow(0,v-1,f)<<endl;
      |                                 ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include<algorithm>
  +++ |+#include <ostream>
    4 | #define MAX 101
Language: C++

import sys
import heapq

INF = sys.maxint/3

class Edge:
    def __init__(self, to, cap, cost, rev):
        self.to = to
        self.cap = cap
        self.cost = cost
        self.rev = rev

    def print_attributes(self):
        print "to: {0}, cap: {1}, cost: {2}, rev: {3}".format(self.to, self.cap, self.cost, self.rev)

class MinimumCostFlow:

    def __init__(self, V, E):
        self.V = V
        self.E = E
        self.G = [[] for i in range(V)]

    def add_edge(self, s, t, cap, cost):
        forward_edge = Edge(t, cap, cost, len(self.G[t]))
        self.G[s].append(forward_edge)
        backward_edge = Edge(s, 0, -cost, len(self.G[s])-1)
        self.G[t].append(backward_edge)

    def print_edges(self):
        print "==== print edges ===="
        for i in range(self.V):
            print "\nedges from {}".format(i)
            for e in self.G[i]:
                e.print_attributes()

    def minimum_cost_flow(self, s, t, f):
        res = 0
        h = [0] * self.V

        while f>0:
            pque = []
            dist = [INF for i in range(self.V)]
            prev_v = [0 for i in range(self.V)]
            prev_e = [0 for i in range(self.V)]

            dist[s] = 0
            heapq.heappush(pque, (0, s))
            while(len(pque)!=0):
                p = heapq.heappop(pque)
                v = p[1]
                if (dist[v] < p[0]):
                    continue
                for i in range(len(self.G[v])):
                    e = self.G[v][i]
                    if (e.cap>0 and dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]):
                        dist[e.to] = dist[v] + e.cost + h[v] - h[e.to]
                        prev_v[e.to] = v
                        prev_e[e.to] = i
                        heapq.heappush(pque, (dist[e.to], e.to))

            if dist[t] == INF:
                return -1

            for v in range(self.V):
                h[v] += dist[v]

            d = f

            v = t
            while v!=s:
                d = min(d, self.G[prev_v[v]][prev_e[v]].cap)
                v = prev_v[v]

            f -= d
            res += d * h[t]

            v = t
            while v!=s:
                e = self.G[prev_v[v]][prev_e[v]]
                e.cap -= d
                self.G[v][e.rev].cap += d
                v = prev_v[v]

        return res

def main():
    V, E, F = map(int, raw_input().split())
    mcf = MinimumCostFlow(V, E)
    for i in range(E):
        u, v, c, d = map(int, raw_input().split())
        mcf.add_edge(u, v, c, d)

    #print "minimum cost flow: {}".format(mcf.minimum_cost_flow(0, V-1, F))
    print mcf.minimum_cost_flow(0, V-1, F)

if __name__ == '__main__':
    main()


Compiler output:
a.cc:93:6: error: invalid preprocessing directive #print
   93 |     #print "minimum cost flow: {}".format(mcf.minimum_cost_flow(0, V-1, F))
      |      ^~~~~
a.cc:96:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   96 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
#include<vector>

using namespace std;

const int MAX_V = 205;
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

void add_edge(const int &u, const int &v) {
	G[u].emplace_back(v);
	G[v].emplace_back(u);
}

bool dfs(const int &v) {
	used[v] = true;
	for (int i = 0; i < G[v].size(); ++i) {
		int u = G[v][i], w = match[u];
		if (w < 0 || !used[w] && dfs(w)) {
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

//?????¨??????????????°????????§???????±?????????????
int bipartite_matching(const int &V) {
	int res = 0;
	memset(match, -1, sizeof(match));
	for (int v = 0; v < V; ++v) {
		if (match[v] < 0) {
			memset(used, 0, sizeof(used));
			if (dfs(v))++res;
		}
	}
	return --res;
}

int main()
{
	cin.tie(0);
	ios::ios_base::sync_with_stdio(false);
	int X, Y, E, s, t; cin >> X >> Y >> E;
	for (int i = 0; i < E; ++i) {
		cin >> s >> t;
		add_edge(s, t);
	}
	int ans = bipartite_matching(X + Y);
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int bipartite_matching(const int&)':
a.cc:32:9: error: 'memset' was not declared in this scope
   32 |         memset(match, -1, sizeof(match));
      |         ^~~~~~
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 |