Language: C++


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)

const int N = 4;

struct edge {
	int to;
	int cap;
	int rev;
	edge(int _to, int _cap, int _rev) : to(_to), cap(_cap), rev(_rev) {};
};

int level[N], del[N];
using node = vector<edge>;
using graph = vector<node>;


int bfs(graph &g, int s, int t) {
	memset(level, -1, sizeof(level));
	level[s] = 0;
	deque<int> q;
	q.push_back(s);
	while (!q.empty()) {
		auto i = q.front();
		q.pop_front();
		for (auto &e : g[i]) {
			if (e.cap > 0 && level[e.to] == -1) {
				level[e.to] = level[i] + 1;
				q.push_back(e.to);
			}
		}
	}
	return level[t];
}

int dfs(graph &g, int s, int t, int f) {
	int ret = 0;
	if (s == t)return f;
	FOR(i, del[s], g[s].size()) {
		del[s] = i;
		auto &e = g[s][i];
		if (e.cap == 0 || level[s] >= level[e.to])continue;
		auto df = dfs(g, e.to, t, min(f, e.cap));
		e.cap -= df;
		g[e.to][e.rev].cap += df;
		f -= df;
		ret += df;
		if (f == 0)return ret;
	}
	return ret;
}

int maximum_flow(graph &g, int s, int t) {
	int df;
	int flow = 0;
	do {
		if (-1 == bfs(g, s, t))break;
		memset(del, 0, sizeof(del));
		df = dfs(g, s, t, 1e9);
		flow += df;
	} while (df != 0);
	return flow;
}

void addedge(graph &g, 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));
}

void main() {
	int v, e;
	scanf("%d%d", &v, &e); 
	graph g(v);
	REP(i, e) {
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		addedge(g, x, y, z);
	}
	cout << maximum_flow(g, 0, v-1) << endl;
	return;
}


Compiler output:
a.cc:134:1: error: '::main' must return 'int'
  134 | void main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:144:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
  144 |         return;
      |         ^~~~~~