Language: C++

#include <iostream>
#include <vector>

#define INF (1<<20)

using namespace std;

struct edge{
	int to;
	int cap;
	int rev_id;
};

class FordFulkerson
{
private:
	vector<vector<edge> > adj;
	int v;
	int e;
	vector<bool> visited;
public:
	FordFulkerson() {
		cin >> v;
		cin >> e;
		adj.resize(v);
		for (int i = 0; i < e; ++i)
		{
			int u;
			int v;
			int c;
			cin >> u >> v >> c;
			adj[u].push_back((edge){v, c, adj[v].size()});
			adj[v].push_back((edge){u, 0, adj[u].size() - 1});
		}
	}


	int dfs(int from, int goal, int flow) {
		if(from == goal) return flow;
		visited[from] = true;
		for (int i = 0; i < adj[from].size(); ++i)
		{
			edge &e = adj[from][i];
			if(!visited[e.to] && e.cap > 0) {
				int d = dfs(e.to, goal, min(e.cap, flow));
				if(d > 0) {
					e.cap -= d;
					adj[e.rev_id][from].cap += d;
					return d;
				}
			}
		}
		return 0;
	}



	void exec() {
		int flow_sum = 0;
		while(true) {
			visited = vector<int>(v, false);
			int flow = dfs(0, v - 1, INF);
			if(flow == 0) {
				cout << flow_sum << endl;
				return;
			}
			flow_sum += flow;
		}
	}
};

int main() {
	FordFulkerson ff = FordFulkerson();
	ff.exec();
}





Compiler output:
a.cc: In constructor 'FordFulkerson::FordFulkerson()':
a.cc:32:66: warning: narrowing conversion of '(&((FordFulkerson*)this)->FordFulkerson::adj.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]
   32 |                         adj[u].push_back((edge){v, c, adj[v].size()});
      |                                                       ~~~~~~~~~~~^~
a.cc:33:69: warning: narrowing conversion of '((&((FordFulkerson*)this)->FordFulkerson::adj.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]
   33 |                         adj[v].push_back((edge){u, 0, adj[u].size() - 1});
      |                                                       ~~~~~~~~~~~~~~^~~
a.cc: In member function 'void FordFulkerson::exec()':
a.cc:61:55: error: no match for 'operator=' (operand types are 'std::vector<bool>' and 'std::vector<int>')
   61 |                         visited = vector<int>(v, false);
      |                                                       ^
In file included from /usr/include/c++/14/vector:67,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_bvector.h:894:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(const std::vector<bool, _Alloc>&) [with _Alloc = std::allocator<bool>]'
  894 |       operator=(const vector& __x)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:894:31: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<bool>&'
  894 |       operator=(const vector& __x)
      |                 ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:926:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::vector<bool, _Alloc>&&) [with _Alloc = std::allocator<bool>]'
  926 |       operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:926:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<bool>&&'
  926 |       operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:952:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::initializer_list<bool>) [with _Alloc = std::allocator<bool>]'
  952 |       operator=(initializer_list<bool> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:952:40: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<bool>'
  952 |       operator=(initializer_list<bool> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~