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

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

typedef long long ll;
typedef pair<int,int> P;

int dp[303][303][303];

void modadd(ll &a, ll b){
	a += b;
	a %= MOD;
}

vector<vector<P>> que(303);

int main(){
	
	ll n,m;cin >> n >> m;
	REP(i,m){
		ll a,b,c;cin >> a >> b >> c;
		que[b].EB(a,c);
	}
	
	dp[0][0][0] = 1;
	
	REP(i,n+1){
		REP(j,n+1){
			REP(k,n+1){
				if(dp[i][j][k] == 0)continue;
				int r = max(i,max(j,k));
				REP(ii,que[r].size()){
					int cou = 0;
					if(i >= que[r][ii].FI)cou++;
					if(j >= que[r][ii].FI)cou++;
					if(k >= que[r][ii].FI)cou++;
					if(cou != que[r][ii].SE)dp[i][j][k] = 0;
				}
				modadd(dp[r+1][j][k], dp[i][j][k]);
				modadd(dp[i][r+1][k], dp[i][j][k]);
				modadd(dp[i][j][r+1], dp[i][j][k]);
			}
		}
	}
	
	ll ans = 0;
	REP(i,n+1){
		REP(j,n+1){
			REP(k,n+1){
				int r = max(i,max(j,k));
				if(r == n){
					//cout << "seica " << i << " " << j << " " << k << " " << dp[i][j][k] << endl;
					modadd(ans,dp[i][j][k]);
				}
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:52: error: cannot bind non-const lvalue reference of type 'll&' {aka 'long long int&'} to a value of type 'int'
   55 |                                 modadd(dp[r+1][j][k], dp[i][j][k]);
      |                                        ~~~~~~~~~~~~^
a.cc:26:17: note:   initializing argument 1 of 'void modadd(ll&, ll)'
   26 | void modadd(ll &a, ll b){
      |             ~~~~^
a.cc:56:52: error: cannot bind non-const lvalue reference of type 'll&' {aka 'long long int&'} to a value of type 'int'
   56 |                                 modadd(dp[i][r+1][k], dp[i][j][k]);
      |                                        ~~~~~~~~~~~~^
a.cc:26:17: note:   initializing argument 1 of 'void modadd(ll&, ll)'
   26 | void modadd(ll &a, ll b){
      |             ~~~~^
a.cc:57:52: error: cannot bind non-const lvalue reference of type 'll&' {aka 'long long int&'} to a value of type 'int'
   57 |                                 modadd(dp[i][j][r+1], dp[i][j][k]);
      |                                        ~~~~~~~~~~~~^
a.cc:26:17: note:   initializing argument 1 of 'void modadd(ll&, ll)'
   26 | void modadd(ll &a, ll b){
      |             ~~~~^
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAX 330
#define MOD 1000000007
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
void add(int &x,int y){x+=y;if(x>=MOD)x-=MOD;}
int n,m,f[MAX][MAX][MAX],ans;
struct Node{int l,x;};
vector<Node> e[MAX];
bool check(int a,int b,int c)
{
	int r=max(a,max(b,c));
	for(int i=0,t=e[r].size();i<t;++i)
	{
		int l=e[r][i].l,x=e[r][i].x,s=0;
		s=(a>=l)+(b>=l)+(c>=l);
		if(s!=x)return false;
	}
	return true;
}
int main()
{
	n=read();m=read();
	for(int i=1;i<=m;++i)
	{
		int l=read(),r=read(),x=read();
		e[r].push_back((Node){l,x});
	}
	f[0][0][0]=1;
	for(int i=0;i<=n;++i)
		for(int j=0;j<=n;++j)
			for(int k=0;k<=n;++k)
			{
				if(!f[i][j][k])continue;
				if((i&&k&&i==k)||(i&&j&&i==j)||(j&&k&&j==k))continue;
				if(!check(i,j,k)){f[i][j][k]=0;continue;}
				int r=max(i,max(j,k));
				add(f[r+1][j][k],f[i][j][k]);
				add(f[i][r+1][k],f[i][j][k]);
				add(f[i][j][r+1],f[i][j][k]);
				if(r==n)add(ans,f[i][j][k]);
			}
	printf("%d\n",ans);
	return 0;
}


Compiler output:
a.cc:18:1: error: 'vector' does not name a type
   18 | vector<Node> e[MAX];
      | ^~~~~~
a.cc: In function 'bool check(int, int, int)':
a.cc:22:23: error: 'e' was not declared in this scope
   22 |         for(int i=0,t=e[r].size();i<t;++i)
      |                       ^
a.cc:25:17: error: 's' was not declared in this scope
   25 |                 s=(a>=l)+(b>=l)+(c>=l);
      |                 ^
a.cc:26:23: error: 'x' was not declared in this scope
   26 |                 if(s!=x)return false;
      |                       ^
a.cc: In function 'int main()':
a.cc:36:17: error: 'e' was not declared in this scope
   36 |                 e[r].push_back((Node){l,x});
      |                 ^
Language: C++

#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int n;
struct CHECK {
	int	l;
	int	r;
	int	x;
};
CHECK check_roules[301][300];
int m[301] = {0};
int c[301][301][301];

int new_chk(int i, int r, int g, int b)
{
	vector<int> v;
	v.push_back(r);
	v.push_back(g);
	v.push_back(b);
	sort(v.begin(), v.end());
	int* ret = &c[i][v[0]][v[1]];
	if (*ret != -1) {
		return *ret;
	}
	for (int j = 0 ; j < m[i] ; j++) {
		if (check_roules[i][j].l <= v[0]) {
			if (check_roules[i][j].x != 3) {
				return *ret = 0;
			}
		} else if (check_roules[i][j].l <= v[1]) {
			if (check_roules[i][j].x != 2) {
				return *ret = 0;
			}
		} else {
			if (check_roules[i][j].x != 1) {
				return *ret = 0;
			}
		}
	}
	if (i == n) {
		return *ret = 1;
	}

	return *ret = ((new_chk(i + 1, i + 1, g, b) + new_chk(i + 1, r, i + 1, b) + new_chk(i + 1, r, g, i + 1)) % 1000000007);
}

int main()
{
	cin >> n;

	int M;
	cin >> M;

	for (int i = 0 ; i < M ; i++) {
		CHECK check_roule;
		cin >> check_roule.l;
		cin >> check_roule.r;
		cin >> check_roule.x;
		check_roules[check_roule.r][m[check_roule.r]] = check_roule;
		(m[check_roule.r])++;
	}

	memset(c, -1, sizeof(c));
	cout << new_chk(0, 0, 0, 0) << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:9: error: 'memset' was not declared in this scope
   72 |         memset(c, -1, sizeof(c));
      |         ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <algorithm>
  +++ |+#include <cstring>
   11 | using namespace std;
Language: C++

#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int n;
struct CHECK {
	int	l;
	int	r;
	int	x;
};
CHECK check_roules[301][300];
int m[301] = {0};
int c[301][301][301];

int new_chk(int i, int r, int g, int b)
{
	vector<int> v;
	v.push_back(r);
	v.push_back(g);
	v.push_back(b);
	sort(v.begin(), v.end());
	int& ret = c[i][v[0]][v[1]];
	if (ret != -1) {
		return ret;
	}
	for (int j = 0 ; j < m[i] ; j++) {
		if (check_roules[i][j].l <= v[0]) {
			if (check_roules[i][j].x != 3) {
				return ret = 0;
			}
		} else if (check_roules[i][j].l <= v[1]) {
			if (check_roules[i][j].x != 2) {
				return ret = 0;
			}
		} else {
			if (check_roules[i][j].x != 1) {
				return ret = 0;
			}
		}
	}
	if (i == n) {
		return ret = 1;
	}

	return ret = ((new_chk(i + 1, i + 1, g, b) + new_chk(i + 1, r, i + 1, b) + new_chk(i + 1, r, g, i + 1)) % 1000000007);
}

int main()
{
	cin >> n;

	int M;
	cin >> M;

	for (int i = 0 ; i < M ; i++) {
		CHECK check_roule;
		cin >> check_roule.l;
		cin >> check_roule.r;
		cin >> check_roule.x;
		check_roules[check_roule.r][m[check_roule.r]] = check_roule;
		(m[check_roule.r])++;
	}

	memset(c, -1, sizeof(c));
	cout << new_chk(0, 0, 0, 0) << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:9: error: 'memset' was not declared in this scope
   72 |         memset(c, -1, sizeof(c));
      |         ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <algorithm>
  +++ |+#include <cstring>
   11 | using namespace std;
Language: C++

#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int n;
struct CHECK {
	int	l;
	int	r;
	int	x;
};
CHECK check_roules[301][300];
int m[301] = {0};
int c[301][301][301];

int new_chk(int i, int r, int g, int b)
{
	vector<int> v;
	v.push_back(r);
	v.push_back(g);
	v.push_back(b);
	sort(v.begin(), v.end());
	int& ret = c[i][v[0]][v[1]];
	if (ret != -1) {
		return ret;
	}
	for (int j = 0 ; j < m[i] ; j++) {
		if (check_roules[i][j].l <= v[0]) {
			if (check_roules[i][j].x != 3) {
				return ret = 0;
			}
		}
		if (check_roules[i][j].l <= v[0]) {
			if (check_roules[i][j].x != 2) {
				return ret = 0;
			}
		}
		if (check_roules[i][j].l <= v[0]) {
			if (check_roules[i][j].x != 1) {
				return ret = 0;
			}
		}
	}
	if (i == n) {
		return ret = 1;
	}

	return ret = ((new_chk(i + 1, i + 1, g, b) + new_chk(i + 1, r, i + 1, b) + new_chk(i + 1, r, g, i + 1)) % 1000000007);
}

int main()
{
	cin >> n;

	int M;
	cin >> M;

	for (int i = 0 ; i < M ; i++) {
		CHECK check_roule;
		cin >> check_roule.l;
		cin >> check_roule.r;
		cin >> check_roule.x;
		check_roules[check_roule.r][m[check_roule.r]] = check_roule;
		(m[check_roule.r])++;
	}

	memset(c, -1, sizeof(c));
	cout << new_chk(0, 0, 0, 0) << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:9: error: 'memset' was not declared in this scope
   74 |         memset(c, -1, sizeof(c));
      |         ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <algorithm>
  +++ |+#include <cstring>
   11 | using namespace std;
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{int from, to; ll cost;};

signed main(){
	int N, M;
	cin >> N >> M;
	vector< pair<int, int> > conds[N+1];
	rep(M){
		int l, r, x;
		cin >> l >> r >> x;
		conds[r].emplace_back(l, x);
	}

	vector< vector< vector<int> > > dp(N+1, vector< vector<int> >(N+1, vector<int>(N+1, 0)));

	dp[0][0][0] = 1;
	rep(N){
		repp(j, N){
			repp(k, N){
				int r = max(i, max(j, k));
				dp[r+1][j][k] += dp[i][j][k];
				dp[i][r+1][k] += dp[i][j][k];
				dp[i][j][r+1] += dp[i][j][k];

				for(auto p : conds[r+1]){
					int l = p.first, x = p.second;
					vector<int> comp(3,0);
					if(l <= i) comp[0] = 1;
					if(l <= j) comp[1] = 1;
					if(l <= k) comp[2] = 1;
					if(comp[1] + comp[2] + 1 != x) dp[r+1][j][k] = 0;
					if(comp[0] + comp[2] + 1 != x) dp[i][r+1][k] = 0;
					if(comp[0] + comp[1] + 1 != x) dp[i][j][r+1] = 0;
				}
			}
		}
	}

	ll ans = 0;
	repp(i, N){
		ll tmp = 0;
		reppp(j, N){
			tmp += dp[i][j][N] % MOD;
			tmp += dp[j][i][N] % MOD;
			tmp += dp[i][N][j] % MOD;
			tmp += dp[j][N][i] % MOD;
			tmp += dp[N][i][j] % MOD;
			tmp += dp[N][j][i] % MOD;
		}
		ans += tmp % MOD;
	}
	cout << ans % MOD << endl;
	return 0;
}



Compiler output:
a.cc:68:27: error: macro "reppp" requires 3 arguments, but only 2 given
   68 |                 reppp(j, N){
      |                           ^
a.cc:15:9: note: macro "reppp" defined here
   15 | #define reppp(i, m, n) for(int i=m;i<=n;i++)
      |         ^~~~~
a.cc: In function 'int main()':
a.cc:68:17: error: 'reppp' was not declared in this scope
   68 |                 reppp(j, N){
      |                 ^~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
const int MAXN = 305;
const int MOD = 1000000007;
vector < pair<int,int> > A[MAXN];
int dp[MAXN][MAXN][MAXN];
void mod_add(int &x, int y)
{
	x = (x + y)%MOD;
}
int main()
{
	int n,m;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; ++i)
	{
		int ty, l, r;
		scanf("%d %d %d", &l, &r, &ty);
		A[r].push_back(make_pair(l,ty));
	}
	dp[0][0][0] = 1;
	int ans = 0;
	for (int i = 0; i <= n; ++i)
	{
		for (int j = 0; j <= n; ++j)
		{
			for (int k = 0; k <= n; ++k)
			{
				int pos[] = {i,j,k};
				sort(pos, pos+3);
				for (int ii = 0; ii < A[pos[2]].size(); ++ii)
				{
					int l = A[pos[2]][ii].first;
					int num = A[pos[2]][ii].second;
					if(num == 1 && pos[1] >= l)
						dp[i][j][k] = 0;
					if(num == 2 && (pos[0] >= l || pos[1] < l))
						dp[i][j][k] = 0;
					if(num == 3 && pos[0] < l)
						dp[i][j][k] = 0;
				}
				mod_add(dp[pos[2] + 1][j][k], dp[i][j][k]);
				mod_add(dp[i][pos[2] + 1][k], dp[i][j][k]);
				mod_add(dp[i][j][pos[2] + 1], dp[i][j][k]);
				if(pos[2] == n)
					mod_add(ans, dp[i][j][k]);
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:33: error: 'sort' was not declared in this scope; did you mean 'short'?
   31 |                                 sort(pos, pos+3);
      |                                 ^~~~
      |                                 short
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef std::pair<int, int> ii;
typedef tuple<int,int,int> i3;
typedef std::pair<int, ii> iii;
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::vector<ii> vii;
typedef std::vector<iii> viii;
const int INF = 1001001000;
const ll mod = 1e9 + 7;
const ld pi=acos(-1);
#define pb(a) push_back(a)
#define m0(x,n) memset(x,n,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);  // greater than or equal
#define ub(v,n) upper_bound(v.begin(), v.end(), n);  // greater than
#define all(x) (x).begin(), (x).end();
#define fi first;
#define se second;
#define endl '\n';
#define loop(i,n) for(int i=0;i<(n);i++);
#define FOR(i, m, n) for(int i = m; i < n; i++);

int h,w;
string a[101];


struct flow_network {
  int n, s, t, *par, **c, **f;
  vi *adj;
  flow_network(int n, int s, int t) : n(n), s(s), t(t) {
    adj = new std::vector<int>[n];
    par = new int[n];
    c = new int*[n];
    f = new int*[n];
    for (int i = 0; i < n; ++i) { 
      c[i] = new int[n];
      f[i] = new int[n];
      for (int j = 0; j < n; ++j)
        c[i][j] = f[i][j] = 0;
    }
  }
  void add_edge(int u, int v, int w) {
    adj[u].push_back(v);
    adj[v].push_back(u);
    c[u][v] += w;
  }
  int res(int i, int j) { return c[i][j] - f[i][j]; }
  bool bfs() {
    std::queue<int> q;
    q.push(this->s);
    while (!q.empty()) {
      int u = q.front();  q.pop();
      for (int v : adj[u]) {
        if (res(u, v) > 0 and par[v] == -1) {
          par[v] = u;
          if (v == this->t)
            return true;
          q.push(v);
        }
      }
    }
    return false;
  }
  bool aug_path() {
    for (int u = 0; u < n; ++u)
      par[u] = -1;
    par[s] = s;
    return bfs();
  }
  int calc_max_flow() {
    int ans = 0;
    while (aug_path()) {
      int flow = INF;
      for (int u = t; u != s; u = par[u])
        flow = std::min(flow, res(par[u], u));
      for (int u = t; u != s; u = par[u])
        f[par[u]][u] += flow, f[u][par[u]] -= flow;
      ans += flow;
    }
    return ans;
  }
};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> h >> w;
  for (int i=0; i<h; i++) cin >> a[i];
  ii t,s;
  flow_network G(h+w+3,0,h+w+2);
  for (int i=1; i<=h; i++){
    for (int j=1; j<=w; j++){
      if (a[i-1][j-1]=='S') {G.add_edge(0,i,INF); G.add_edge(0,j+h,INF);}
      if (a[i-1][j-1]=='T') {G.add_edge(i,h+w+2,INF); G.add_edge(j+h,h+w+2,INF);}
      if (a[i-1][j-1]=='o') {G.add_edge(i,j+h,1); G.add_edge(j+h,i,1);}
    }
  }


  if (s.first==t.first or s.second==t.second) cout<<-1<<endl;
  else cout<<G.calc_max_flow();




  


}


Compiler output:
a.cc: In function 'int main()':
a.cc:106:3: error: 'else' without a previous 'if'
  106 |   else cout<<G.calc_max_flow();
      |   ^~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits.h>
#include <cmath>
#include <map>
using namespace std;
using ll=long long;
#define int long long
const int INF=INT_MAX/3;
struct edge{
    int to,cap,rev;
};
vector<edge> G[210];
vector<bool> used(210);
void add_edge(int from,int to,int cap){
    G[from].emplace_back((edge){to,cap,(int)G[to].size()});
    G[to].emplace_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;
    while(1){
        fill(used.begin(),used.end(),false);
        int f=dfs(s,t,INF);
        if(f==0)return flow;
        flow+=f;
    }
}
int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<char>> a(h,vector<char>(w));
    pair<int,int> s,t;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>a[i][j];
            if(a[i][j]=='S'){
                add_edge(0,i+1,INF);
                add_edge(0,h+j+1,INF);
                s.first=i,s.second=j;
            }
            if(a[i][j]=='T'){
                add_edge(i+1,h+w+1,INF);
                add_edge(h+j+1,h+w+1,INF);
                t.first=i,t.second=j;
            }
            if(a[i][j]=='o'){
                add_edge(i+1,h+j+1,1);
                add_edge(h+j+1,i+1,1);
            }
        }
    }
    int ret=max_flow(0,h+w+1);
    if(ret==INF)ret=-1;
    cout<<ret<<endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <limits>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
constexpr lnt INF = 2e18;
/*-*/

template <typename T = lnt, T INF = std::numeric_limits<T>::max()>
struct Dinic
{
	struct Edge
	{
		int a,b; T c,f;
		Edge(int a, int b, T c) : a(a),b(b),c(c),f(0) {}
	};
	int n,m;
	std::vector<Edge> E;
	std::vector<std::vector<int> > G,Gf;
	Dinic(int n) : n(n),m(0),G(n),Gf(n) {}
	void add_edge(int i, int j, int c) {
		E.emplace_back(i,j,c);
		E.emplace_back(j,i,0);
		G[i].emplace_back(m++);
		G[j].emplace_back(m++);
	}
	bool bfs(int s, int t) {
		Gf.assign(n,std::vector<int>());
		std::queue<int> que; que.emplace(s);
		std::vector<int> dist(n,-1); dist[s]=0;
		while(!que.empty()) {
			int i=que.front(); que.pop();
			for(int to:G[i]) {
				if(dist[E[to].b]!=-1 || E[to].c==E[to].f) continue;
				dist[E[to].b]=dist[E[to].a]+1;
				que.emplace(E[to].b);
			}
		}
		if(dist[t]==-1) return false;
		for(int i=0;i<m;i++) {
			if(dist[E[i].a]+1!=dist[E[i].b] || E[i].c==E[i].f) continue;
			Gf[E[i].a].emplace_back(i);
		}
		return true;
	}
	T dfs(int i, T a_f, const int& t) {
		if(i==t || a_f==0) {
			return a_f;
		}
		T v_f=0;
		for(int to:Gf[i]) {
			if(max_flow==0) break;
			T f=dfs(E[to].b,std::min(a_f-v_f,E[to].c-E[to].f),t);
			E[to].f+=f;
			E[to^1].f-=f;
			v_f+=f;
		}
		return v_f;
	}
	T flow(int s, int t) {
		T max_flow=0;
		while(bfs(s,t)) {
			T f = dfs(s,INF,t);
			if(f==0) break;
			max_flow+=f;
		}
		return max_flow;
	}
};

int main() {
	int h,w;
	std::cin >> h >> w;
	std::vector<std::string> g(h);
	rep(i,h) std::cin >> g[i];
	std::vector<std::vector<int> > X(h),Y(w);
	int sx,sy,tx,ty;
	rep(i,h) {
		rep(j,w) {
			if(g[i][j]=='o'||g[i][j]=='S'||g[i][j]=='T') {
				if(g[i][j]=='S') {
					sx=i; sy=j;
				}
				if(g[i][j]=='T') {
					tx=i; ty=j;
				}
				X[i].emplace_back(j);
				Y[j].emplace_back(i);
			}
		}
	}
	if(sx==tx||sy==ty) {
		print(-1);
		return 0;
	}
	auto enc = [&] (int i, int j) {
		return i*w+j;
	};
	debug(sx,sy,tx,ty);
	Dinic<int> flow(2*h*w);
	rep(i,h) {
		for(auto y1:X[i]) for(auto y2:X[i]) {
			if(y1==y2) continue;
			flow.add_edge(enc(i,y1),h*w+enc(i,y2),1);
		}
	}
	rep(i,w) {
		for(auto x1:Y[i]) for(auto x2:Y[i]) {
			if(x1==x2) continue;
			flow.add_edge(enc(x1,i),h*w+enc(x2,i),1);
		}
	}
	rep(i,h) rep(j,w) flow.add_edge(enc(i,j)+h*w,enc(i,j),1);
	print(flow.flow(enc(sx,sy),enc(tx,ty)+h*w));
}


Compiler output:
a.cc: In member function 'T Dinic<T, INF>::dfs(int, T, const int&)':
a.cc:76:28: error: 'max_flow' was not declared in this scope
   76 |                         if(max_flow==0) break;
      |                            ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=1;i<=(n);++i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define DUMP(x) cout<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

const int INF = (int)1e9;
struct edge{int to, cap, rev;};

int used[105];
vector<edge> G[105];

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

int dfs(int v, int t, int f){
    if(v==t) return f;
    used[v] = 1;
    for(auto &e : G[v]){
        if(!used[e.to] and 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(true){
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, INF);
        if(f==0) return flow;
        flow += f;
    }
}

class FLotusLeaves {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ios_base::sync_with_stdio(false);
	    int H, W;
	    in>>H>>W;
	    RREP(i, H){
	        RREP(j, W){
	            char c;
	            in>>c;
	            if(c=='S') add_edge(0, i, INF), add_edge(0, H+j, INF);
	            else if(c=='T') add_edge(i, H+W+1, INF), add_edge(H+j, H+W+1, INF);
	            else if(c=='o') add_edge(i, H+j, 1);
	        }
	    }
	    int ans = max_flow(0, H+W+1);
	    if(ans>=INF) out<<"-1\n";
	    else out<<ans<<'\n';
	}
};


Compiler output:
/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 <bits/stdc++.h>
using namespace std;
template<typename T>
class fixed_point : T {
  public:
    explicit constexpr fixed_point (
        T&& t
      ) noexcept
      : T(forward<T>(t))
      {
      }
    template<typename... Args>
    constexpr decltype(auto)
    operator()(
        Args&&... args
      ) const
      {
        return T::operator()(*this, forward<Args>(args)...);
      }
};
template<typename T>
static inline constexpr decltype(auto) fix (T&& t) noexcept {
  return fixed_point<T>{forward<T>(t)};
}
int main() {
  cin.tie(0); cin.sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  vector<string> str(h, string(w, '$'));
  int si, sj, ti, tj;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> str[i][j];
      if (str[i][j] == 'S') si = i, sj = j;
      if (str[i][j] == 'T') ti = i, tj = j;
    }
  }
  if (si == ti || sj == ti) {
    cout << -1 << endl;
    return -;
  }
  int source = si, sink = ti;
  vector<vector<int>> grh(h + w);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      char c = str[i][j];
      if (c != '.') {
        grh[i    ].push_back(h + j);
        grh[h + j].push_back(i    );
      }
    }
  }
  int ret = 0;
  while (true) {
    vector<bool> ckd(h + w, false);
    int d = fix ([&](auto dfs, int crr) -> int   {
      if (crr == sink) return 1;
      if (ckd[crr]) return 0;
      ckd[crr] = true;
      for (auto const& nxt : grh[crr]) {
        if (dfs(nxt)) {
          int i = crr, j = nxt;
          if (i > j) swap(i, j);
          j -= h;
          if (
              (i == si && j == sj) ||
              (i == ti && j == tj)
            )
            {
              grh[crr].erase(find(grh[crr].begin(), grh[crr].end(), nxt));
              grh[nxt].push_back(crr);
            }
          return 1;
        }
      }
      return 0;
    })(source);
    if (d == 0) break;
    ret++;
  }
  if (si == ti || sj == tj) {
    cout << -1 << endl;
    return 0;
  }
  cout << ret << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:13: error: expected primary-expression before ';' token
   40 |     return -;
      |             ^
Language: C++

#include<iostream>
#include<ctime>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<climits>
#include<cstring>
#include<iomanip>
#include<string>
#include<bitset>
#include<unordered_map>
#include<unordered_set>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<algorithm>
#include<functional>
#include<chrono>
#include<windows.h>
#include<direct.h>
#include<random>
#include<sstream>

#define y0 asdahsdlkahsdad
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define taskname "LotusLeaves"
//#define BeztDonkey

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

const int maxV = 202, maxE = 1e4, maxC = maxV;

struct TEdge
{
    int u, v, cf;
} e[maxE << 1];
vector<int> adj[maxV];
int trace[maxV], h, w, s, t, E, flowVal;

inline void AddEdge(int u, int v, int c)
{
    adj[u].push_back(E); e[E++] = {u, v, c};
    adj[v].push_back(E); e[E++] = {v, u, c};
}

void Inp()
{
    cin >> h >> w;
    s = h + w;
    t = s + 1;
    E = 0;
    for (int i = 0; i < h; ++i)
    {
        string tmp;
        cin >> tmp;
        for (int j = 0; j < w; ++j)
            if (tmp[j] == 'o') AddEdge(i, j + h, 1);
            else if (tmp[j] == 'S') AddEdge(s, i, maxC), AddEdge(s, j + h, maxC);
            else if (tmp[j] == 'T') AddEdge(i, t, maxC), AddEdge(j + h, t, maxC);
    }
}

inline bool FindAumentingPath()
{
    memset(trace, -1, sizeof trace);
    queue<int> q({s});
    trace[s] = -2;
    while (!q.empty())
    {
        int u = q.front(), v; q.pop();
        for (int i : adj[u])
        {
            if (e[i].cf == 0 || trace[v = e[i].v] != -1) continue;
            trace[v] = i;
            if (v == t) return 1;
            q.push(v);
        }
    }
    return 0;
}

inline void AugmentFlow()
{
    int del = maxC, i;
    for (int u = t; (i = trace[u]) != -2; u = e[i].u) del = min(del, e[i].cf);
    for (int u = t; (i = trace[u]) != -2; u = e[i].u)
        e[i].cf -= del, e[i ^ 1].cf += del;
    flowVal += del;
}

void Solve()
{
    flowVal = 0;
    while (FindAumentingPath()) AugmentFlow();
    cout << (flowVal >= maxC ? -1 : flowVal);
}

int main()
{
    #ifdef BeztDonkey
    auto start = chrono::steady_clock::now();
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen(taskname".inp", "r", stdin);
    //freopen(taskname".out", "w", stdout);

    Inp();
    Solve();

    #ifdef BeztDonkey
    auto end = chrono::steady_clock::now();
    cerr << "In milliseconds : "
         << chrono::duration_cast<chrono::milliseconds>(end - start).count();
    cerr << '\n' << "In seconds : "
         << chrono::duration_cast<chrono::seconds>(end - start).count() << '\n';
    #endif
    return 0;

}


Compiler output:
a.cc:22:9: fatal error: windows.h: No such file or directory
   22 | #include<windows.h>
      |         ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
3 2
acp
ae
)");
#define cin input
#endif

bool bfs(int rGraph[202][202], int s, int t, int parent[])
{
    using namespace std;
    bool visited[202] = {};
    queue <int> q;
    q.push(s);
    visited[s] = true;
    parent[s] = -1;
 
    while (!q.empty())
    {
        int u = q.front();
        q.pop();
        for (int v = 0; v < 202; v++)
        {
            if (visited[v] == false && rGraph[u][v] > 0)
            {
                q.push(v);
                parent[v] = u;
                visited[v] = true;
            }
        }
    }
    return (visited[t] == true);
}
 
int fordFulkerson(int graph[202][202], int s, int t)
{
    int u, v;
    int rGraph[202][202];  
    for (u = 0; u < 202; u++)
    {
        for (v = 0; v < 202; v++)
        {
            rGraph[u][v] = graph[u][v];
        }
    }
    int parent[202];
    int max_flow = 0;
    while (bfs(rGraph, s, t, parent))
    {
        int path_flow = INT_MAX;
        for (v = t; v != s; v = parent[v])
        {
            u = parent[v];
            path_flow = min(path_flow, rGraph[u][v]);
        }
        for (v = t; v != s; v = parent[v])
        {
            u = parent[v];
            rGraph[u][v] -= path_flow;
            rGraph[v][u] += path_flow;
        }
        max_flow += path_flow;
    }
    return max_flow;
}

int main()
{
    int graph[202][202] = {}; 
	int h, w;
	cin >> h >> w;
    int xs, ys, xt, yt;
    REP (i, h)
    {
        string s;
        cin >> s;
        REP (j, w)
        {
            switch (s[j])
            {
            case 'o':
                graph[i][j + 100] = 1;
                graph[j + 100][i] = 1;
                break;
            case 'S':
                graph[200][j + 100] = 100000;
                graph[200][i] = 100000;
                xs = j;
                ys = i;
                break;
            case 'T':
                graph[i][201] = 100000;
                graph[j + 100][201] = 100000;
                xt = j;
                yt = j;
                break;
            }
        }
    }

    if (xs == xt || ys == yt)
        cout << -1 << endl;
    else
        cout << fordFulkerson(graph, 200, 201) << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int fordFulkerson(int (*)[202], int, int)':
a.cc:74:25: error: 'INT_MAX' was not declared in this scope
   74 |         int path_flow = INT_MAX;
      |                         ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include <iomanip>
  +++ |+#include <climits>
   13 |
Language: C++

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#define fo(i,a,b) for(i=a;i<=b;i++)
#define min(x,y) ((x)<(y)?(x):(y))
using namespace std;

const int maxn=3e6+5;

int fi[maxn],ne[maxn*2],dui[maxn*2],dui1[maxn*2],qc[maxn];
int a[105][105],de[20005],h[maxn];
char s[105];
int i,j,k,l,m,n,x,y,now,p,be,ed,ans;
bool bq;

void add(int x,int y,int z){
    if (fi[x]==0) fi[x]=++now; else ne[qc[x]]=++now;
    dui[now]=y; dui1[now]=z; qc[x]=now;
}
bool bfs(){
    memset(de,255,sizeof(de));
    de[be]=0;
    h[1]=be; i=1; j=0;
    while (i>j){
        x=h[++j];
        for(int k=fi[x];k;k=ne[k]){
            if (de[dui[k]]!=-1 || dui1[k]==0) continue;
            de[dui[k]]=de[x]+1;
            h[++i]=dui[k];
        }
    }
    if (de[ed]==-1) return false; else return true;
}
int dinic(int x,int w){
    int i=fi[x],now=0,p;
    if (x==ed) return w;
    for(;i;i=ne[i]){
        if (dui1[i]==0 || de[dui[i]]!=de[x]+1) continue;
        p=dinic(dui[i],min(w-now,dui1[i]));
        if (p){
            dui1[i]-=p; dui1[i xor 1]+=p; now+=p;
        }
    }
    return now;
}
int main(){
//  freopen("074f.in","r",stdin);
    scanf("%d%d",&n,&m);
    fo(i,1,n){
        scanf("%s",&s);
        fo(j,0,m-1){
            if (s[j]=='.') continue;
            a[i][j+1]=++p;
            if (s[j]=='S') be=p;
            if (s[j]=='T') ed=p;
        }
    }
    now=1;
    fo(i,1,n)
        fo(j,1,m) if (a[i][j]>0 && a[i][j]!=ed){
            fo(k,1,m) if (a[i][k]>0 && a[i][k]!=a[i][j] && a[i][k]!=be){
                add(a[i][j]+p,a[i][k],1234567);
                if (a[i][j]==be && a[i][k]==ed){
                    printf("-1\n"); return 0;
                }
            }
            fo(k,1,n) if (a[k][j]>0 && a[k][j]!=a[i][j] && a[k][j]!=be){
                add(a[i][j]+p,a[k][j],1234567);
                if (a[i][j]==be && a[k][j]==ed){
                    printf("-1\n"); return 0;
                }
            }
        }
    fo(i,1,p){
        if (i==be || i==ed) add(i,i+p,1234567); else add(i,i+p,1);
        add(i+p,i,0);
    }
    ed=ed+p;
    while (bfs()) 
        ans=ans+dinic(be,1234567);
    printf("%d\n",ans);
    return 0;
}

---------------------

本文来自 Fate_Zero_Saber 的CSDN 博客 ，全文地址请点击：https://blog.csdn.net/Fate_Zero_Saber/article/details/79415307?utm_source=copy 

Compiler output:
a.cc:87:1: error: expected unqualified-id before '--' token
   87 | ---------------------
      | ^~
Language: Java

import java.util.*;

public class edge {
	
	int to;
	int cap;
	int rev;//逆辺にアクセスする
	
	edge(int to,int cap,int rev){
		this.to =to;
		this.cap =cap;
		this.rev =rev;
	}
}


public class Main {
	static final int INF=Integer.MAX_VALUE;
	static boolean[] used;
	static int flow;
	
	static int V;//頂点
	static int E;//辺
	
	static int H;
	static int W;
	static int s;
	static int t;
	
	static char[][]S;
	
	static List<List<edge>> G;//listの二重構造で隣接リスト実現
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc= new Scanner(System.in);
		
		H= sc.nextInt();
		W= sc.nextInt();
		V= H+W+2;
		
		s= 0;
		t=H+W+1;
		
		S= new char[H][W];
		
		G= new ArrayList<>();
		for(int i=0;i<V;i++)G.add(new ArrayList<>());
		
		
		for(int i=0;i<H;i++)	S[i]= sc.next().toCharArray();
		
		sc.close();
		
		if(check(S)){//sからtまでひと飛びで行ける位置関係なら−１
			System.out.println(-1);
		}
		else{
			
		
		//Gの作成。S[]が0originだから、x,yそれぞれ+1することに注意 
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				char com= S[i][j];
				
				int y=i+1;
				int x=H+ j+1;
				
				switch(com){
				case '.':
					break;
				case 'o'://無向グラフだから双方向に繋ぐ
					addedge(y,x,1);
					addedge(x,y,1);
					break;
				case 'S':
					addedge(s,y,INF);
					addedge(s,x,INF);
					break;
				case 'T':
					addedge(y,t,INF);
					addedge(x,t,INF);
					break;
				}
			}
		}
		
		
		
		int ans= max_flow(s,t);
		
		
		System.out.println(ans);
		
		}
		
	}
	
	
	static void addedge(int from,int to,int cap){
		G.get(from).add(new edge(to,cap,G.get(to).size()));
		//同時に逆辺も辿れるようにするため、に双方向に紐をつける。
		G.get(to).add(new edge(from,0,G.get(from).size()-1));
	}
	
	static boolean check(char[][]S){
		boolean res=false;
		int Sx= 0;
		int Sy= 0;
		int Tx= 0;
		int Ty= 0;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				char com= S[i][j];
				
				if(com=='S'){
					Sy=i;
					Sx=j;
				}
				if(com=='T'){
					Ty= i;	
					Tx= j;
			}	
		}
	}
		if(Sy ==Ty ||Sx== Tx)res= true;
		
		return res;
}
	
	static int dfs(int v,int t,int f){
		if(v == t)return f;//tまでたどり着いた
		
		used[v] = true;
		
		for(int i=0;i<G.get(v).size();i++){
			edge e =G.get(v).get(i);
			
			if(used[e.to] != true && e.cap >0){
				int d= dfs(e.to,t,Math.min(f, e.cap));
				//min(f,e.cap)はまだ流す量を決めている段階。暫定の流量
				
				if(d>0){//tまでたどり着いた(流せる)時
				//v==tのreturn fを受けて、ここで初めてf(=d)を流す
					e.cap-= d;
					G.get(e.to).get(e.rev).cap += d;//直接逆辺のcを変化させて、
					return d;//各辺でdを流すために戻る。　
				}	
			}	
		}
			return 0;
			
	}
		

	static int max_flow(int s,int t) {
		int flow= 0;
		
		
		while(true){
			used =new boolean[V];
			
			int f= dfs(s,t,INF);
			if(f == 0){
				//if(arrive= false)return -1;
				return flow;//if(もうこれ以上流せない)return
			}
			flow +=f;
		}
		
	}

}

Compiler output:
Main.java:3: error: class edge is public, should be declared in a file named edge.java
public class edge {
       ^
1 error
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

struct edge{int to;int cap;int rev;};
struct Dinic{
private:
    int n;
    vector<vector<edge>> v;
    vector<int> dist,iter;
public:
    Dinic(int sz):n(sz),v(sz),dist(sz),iter(sz){}
    
    void addedge(int from,int to,int cap){
        int x=v[to].size(),y=v[from].size();
        v[from].push_back({to,cap,x});
        v[to].push_back({from,0,y});
    }
    
    void bfs(int s){
        fill(dist.begin(),dist.end(),-1);
        queue<int> q;
        dist[s]=0;
        q.push(s);
        while(q.size()){
            int x=q.front();q.pop();
            rep(i,v[x].size()){
                edge &e=v[x][i];
                if(e.cap>0&&dist[e.to]<0){
                    dist[e.to]=dist[x]+1;
                    q.push(e.to);
                }
            }
        }
    }
    
    int dfs(int x,int t,int f){
        if(x==t)return f;
        for(int& i=iter[x];i<(int)v[x].size();++i){
            edge& e=v[x][i];
            if(e.cap>0&&dist[x]<dist[e.to]){
                int d=dfs(e.to,t,min(f,e.cap));
                if(d>0){
                    e.cap-=d;
                    v[e.to][e.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }

    int max_flow(int s,int t){
        int flow=0;
        while(1){
            bfs(s);
            if(dist[t]<0)return flow;
            fill(iter.begin(),iter.end(),0);
            int f;
            while((f=dfs(s,t,inf)>0)flow+=f;
        }
    }
};

int main(){
    int h,w;
    cin>>h>>w;
    Dinic dn(h+w+2);
    string s[h];
    rep(i,h){
        cin>>s[i];
        rep(j,w){
            if(s[i][j]=='S'){
                dn.addedge(h+w, i, inf);
                dn.addedge(h+w, h+j, inf);
            }
            if(s[i][j]=='T'){
                dn.addedge(i,h+w+1, inf);
                dn.addedge(h+j,h+w+1, inf);
            }
            if(s[i][j]=='o'){
                dn.addedge(i, h+j, 1);
                dn.addedge(h+j, i, 1);
            }
        }
    }
    int ans=dn.max_flow(h+w, h+w+1);
    cout<<(ans>=inf?-1:ans)<<endl;
   return 0;
}


Compiler output:
a.cc: In member function 'int Dinic::max_flow(int, int)':
a.cc:80:37: error: expected ')' before 'flow'
   80 |             while((f=dfs(s,t,inf)>0)flow+=f;
      |                                     ^~~~
a.cc:80:18: note: to match this '('
   80 |             while((f=dfs(s,t,inf)>0)flow+=f;
      |                  ^
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<queue>
#include<utility>
#include<cstdio>
#include<cstring>
#include<new>
#include<new.h>
#include<float.h>
#include<ctype.h>
#include<cfloat>
#include<cmath>
#include<cctype>
#include<errno.h>
#include<cerrno>
#include<memory>
#include<memory.h>
#include<assert.h>
#include<cassert>
#include<deque>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qui queue<int>
#define vit vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define prq priority_queue
#define pii pair<int,int>
#define mp make_pair
#define sz size()
#define em empty()
#define ct continue
#define ms multiset
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define ppf pop_front()
using namespace std;
int n,m,way=0,h[101][101];
char a[101][101];
bool used[202][101][101];
void dfs(int x,int y){
	used[way][x][y]=1;
	fo(i,0,m){
		if(a[x][i]=='T'){
			way++;
			return;
		}
		if(!used[way][x][i]&&a[x][i]=='o')dfs(x,i);
		used[way][x][i]=0;
	}
	fo(i,0,n){
		if(a[i][y]=='T'){
			way++;
			return;
		}
		if(!used[way][i][y]&&a[i][y]=='o')dfs(i,y);
		used[way][i][y]=0;
	}
}
int main()
{
	int s1,s2,t1,t2,w=0,ans=0;
	cin>>n>>m;
	fo(i,0,n){
		cin>>a[i];
		fo(j,0,m){
			if(a[i][j]=='S')s1=i,s2=j;
			if(a[i][j]=='T')t1=i,t2=j;
		}
	}
	if(s1==t1||s2==t2){
		cout<<"-1"<<endl;
		return 0;
	}
	dfs(s1,s2);
	fo(i,0,n) fo(j,0,m) fo(k,0,way)if(used[k][i][j])h[i][j]++;
	while(w<way){
		ans++;
		int fd=0,o,p;
		fo(i,0,n) fo(j,0,m){
			if(h[i][j]>fd){
				fd=h[i][j];
				o=i;
				p=j;
			}
		}
		w+=fd;
		h[o][p]=0;
		fo(i,0,way) fo(j,0,n) fo(k,0,m)if(used[i][k][j]&&used[i][o][p])h[j][k]--;
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc:16:9: fatal error: new.h: No such file or directory
   16 | #include<new.h>
      |         ^~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
int H,W;
char str[102];
int Sx,Sy,Tx,Ty;
int fk[101][101];
int h[100001],nxt[100001],to[100001],w[100001],tot=-1;
void ins(int x,int y,int z){nxt[++tot]=h[x];to[tot]=y;w[tot]=z;h[x]=tot;}
void insw(int x,int y,int z1,int z2){ins(x,y,z1);ins(y,x,z2);}

int lv[100001],que[100001],l,r;

bool lvl(){
	memset(lv,0,sizeof lv);
	lv[que[l=r=1]=0]=1;
	while(l<=r){
		int u=que[l++];
		for(int i=h[u];~i;i=nxt[i]) if(w[i])
			if(!lv[to[i]]) lv[to[i]]=lv[u]+1, que[++r]=to[i];
	}
	return lv[2*H*W+H+W+1]!=0;
}

int flow(int u,int f){
//	if(u==0) printf("u=S ");
//	else if(u==2*H*W+H+W+1) printf("u=T ");
//	else if(u<=2*H*W) printf("u=%d,%d,%d ",((u+1)/2-1)/W+1,((u+1)/2-1)%W+1,u%2==0);
//	else if(u<=2*H*W+H) printf("u=Row#%d ",u-2*H*W);
//	else printf("u=Col#%d ",u-2*H*W-H);
//	printf("%d\n",f);
	if(u==2*H*W+H+W+1) return f;
	int sum=0,d;
	for(int i=h[u];~i;i=nxt[i]) if(lv[to[i]]>lv[u]&&w[i]){
		d=flow(to[i],min(f,w[i]));
		sum+=d, f-=d;
		w[i]-=d, w[i^1]+=d;
		if(!f) break;
	} return sum;
}

int Dinic(){
	int ans=0;
	while(lvl())
		ans+=flow(0,INF);
	return ans;
}

int main(){
	memset(h,-1,sizeof h);
	scanf("%d%d",&H,&W);
	for(int i=1;i<=H;++i){
		scanf("%s",str+1);
		for(int j=1;j<=W;++j){
			if(str[j]=='o') fk[i][j]=1;
			if(str[j]=='S') Sx=i, Sy=j;
			if(str[j]=='T') Tx=i, Ty=j;
		}
	}
	if(Sx==Tx||Sy==Ty) return 0*puts("-1");
	for(int i=1;i<=H;++i)
		for(int j=1;j<=W;++j)
			if(fk[i][j]){
				int id = 2*((i-1)*W+j);
				int Rid = 2*H*W+i;
				int Cid = 2*H*W+H+j;
				insw(id-1,id,1,0);
				insw(Rid,id-1,INF,0);
				insw(Cid,id-1,INF,0);
				insw(id,Rid,INF,0);
				insw(id,Cid,INF,0);
			}
	int RidS = 2*H*W+Sx;
	int CidS = 2*H*W+H+Sy;
	int RidT = 2*H*W+Tx;
	int CidT = 2*H*W+H+Ty;
	insw(0,RidS,INF,INF);
	insw(0,CidS,INF,INF);
	insw(RidT,2*H*W+H+W+1,INF,INF);
	insw(CidT,2*H*W+H+W+1,INF, INF);
	printf("%d",Dinic());
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#define HMAX 102
#define WMAX 10210 10
.o...o..o.
....o.....
....oo.oo.
..oooo..o.
....oo....
..o..o....
o..o....So
o....T....
....o.....
........oo

Compiler output:
a.cc:3:1: error: expected unqualified-id before '.' token
    3 | .o...o..o.
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;

#define X first
#define Y second

const int M=3e4+10;
const int inf=1e9;
const int MOD=1e9+7;

priority_queue <int> pq;


struct maxflow{
    int m;
    int st,en;
    int v[M][2],flow[M][2],cap[M];

    int f[M],tr[M];
    vector <int> e[M];
    maxflow(){
        m=st=en=0;
    }
    void add_edge(int x,int y,int _cap){
//        cout<<x<<"->"<<y<<'\n';
        ++m;
        v[m][0]=x;v[m][1]=y;
        e[x].push_back(m);
        e[y].push_back(m);
        cap[m]=_cap;
        flow[m][1]=_cap;
        flow[m][0]=0;
    }

    int q[N];
    bool BFS(int st){

        memset(tr,0,sizeof(tr));
        int top=1,bot=1;
        q[1]=st;
        while (top<=bot){
            int x=q[top++];

            if (x==en) return 1;
            for(auto i:e[x]){
                int dir=(x==v[i][1]);
                int y=v[i][dir^1];
                if (flow[i][dir]==cap[i]||tr[y]) continue;
                tr[y]=i;
                f[y]=min(f[x],cap[i]-flow[i][dir]);
                q[++bot]=y;
            }
        }
        return 0;
    }
    void inc_flow(){
        int cur=en;
        int ans=f[en];
        while (cur!=st){
            int use=tr[cur];
            int dir=(cur==v[use][0]);
            flow[use][dir]+=ans;
            flow[use][dir^1]-=ans;
            cur=v[use][dir];
        }
    }
    int answer(){
        int ans=0;
        f[st]=inf;
        while (BFS(st)){
            ans+=f[en];
            inc_flow();
        }
        return ans;
    }
}mflow;

int n,m;
string s[105];
void prepare(){
    cin>>n>>m;
    for(int i=0;i<n;i++) cin>>s[i];
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++){
            if (s[i][j]=='S') mflow.st=n*m+i*m+j;
            if (s[i][j]=='T') mflow.en=i*m+j;
            if (s[i][j]!='.'){
                mflow.add_edge(i*m+j,i*m+j+n*m,1);
                mflow.add_edge(2*n*m+i,i*m+j,inf);
                mflow.add_edge(i*m+j+n*m,2*n*m+i,inf);
                mflow.add_edge(2*n*m+n+j,i*m+j,inf);
                mflow.add_edge(i*m+j+n*m,2*n*m+n+j,inf);
            }
        }
}
int main(){
    prepare();
    int ans=mflow.answer();
    if (ans==inf) cout<<"-1";
    else cout<<ans;
}


Compiler output:
a.cc:39:11: error: 'N' was not declared in this scope
   39 |     int q[N];
      |           ^
a.cc: In member function 'bool maxflow::BFS(int)':
a.cc:44:9: error: 'q' was not declared in this scope; did you mean 'pq'?
   44 |         q[1]=st;
      |         ^
      |         pq
Language: C++

10 10
.o...o..o.
....o.....
....oo.oo.
..oooo..o.
....oo....
..o..o....
o..o....So
o....T....
....o.....
........oo

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 10 10
      | ^~