Language: C++

#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#include<random>
#pragma warning(disable:4996)
using namespace std;




#define _GLIBCXX_DEBUG

using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(auto i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()


//const int INF = 2147483647;
//const long long int L_INF = 9223372036854775807;

typedef int Weight;

const Weight INF = 1e9;
const Weight ZERO =0;
struct Edge {
	int src, dst;
	Weight weight;
	int id;
	Edge(int src_, int dst_, Weight weight_, const int id_) :
		src(src_), dst(dst_), weight(weight_), id(id_) { }
	Edge(int src, int dst, Weight weight) :
		src(src), dst(dst), weight(weight) { }
	Edge() :src(0), dst(0), weight(0) {

	}
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;
#define RESIDUE(s,t) (capacity[s][t]-flow[s][t])

//流量0の逆辺も張らないと正しく求まらないので注意
Weight maximumFlow(const Graph &ag, int s, int t) {

	Graph g(ag);
	for (int i = 0; i < ag.size(); ++i) {
		for (int j = 0; j < ag[i].size(); ++j) {
			int d = ag[i][j].dst;
			int s = ag[i][j].src;

			bool ok = false;
			for (int k = 0; k < ag[d].size(); ++k) {
				if (ag[d][k].src == s) {
					ok = true;
					break;
				}
			}
			if (!ok) {
				g[d].push_back(Edge(d, s, ZERO));
			}
		}
	}
	int n = g.size();
	Matrix flow(n, Array(n,ZERO)), capacity(n, Array(n,ZERO));
	REP(u, n) FOR(e, g[u]) capacity[e->src][e->dst] =capacity[e->src][e->dst]+ e->weight;


	Weight total = ZERO;
	while (1) {
		queue<int> Q; Q.push(s);
		vector<int> prev(n, -1); prev[s] = s;
		while (!Q.empty() && prev[t] < 0) {
			int u = Q.front(); Q.pop();
			FOR(e, g[u]) if (prev[e->dst] < 0 && RESIDUE(u, e->dst) > ZERO) {
				prev[e->dst] = u;
				Q.push(e->dst);
			}
		}
		if (prev[t] < 0)break; // prev[x] == -1 <=> t-side
		Weight inc = INF;
		for (int j = t; prev[j] != j; j = prev[j]){
			auto v(RESIDUE(prev[j], j));
			if (inc > v) {
				inc = v;
			}
		}
		for (int j = t; prev[j] != j; j = prev[j])
			flow[prev[j]][j] =flow[prev[j]][j]+inc, flow[j][prev[j]] =flow[j][prev[j]]- inc;;
		total += inc;
	}

	return total;
}
int main() {
	int H,W;cin>>H>>W;
	vector<vector<int>>edges(H+W+2);
	vector<string>sts;
	for (int i = 0; i < H; ++i) {
		string st;cin>>st;
		sts.emplace_back(st);
		
	}
	int ans=0;
	Graph g(H+W+2);
	
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			char ch = sts[i][j];
			vector<int>v;
			
			if (ch == 'o') {
				g[i].push_back(Edge(i,H+j,1));
				g[H+j].push_back(Edge(H+j,i,1));
				
			}
			else if (ch == 'S') {
				g[H+W].push_back(Edge(H+W,i,10000));
				g[H+W].push_back(Edge(H+W,H+j,10000));
			}
			else if (ch == 'T') {
				g[i].push_back(Edge(i,H+W+1,10099));
				g[H+j].push_back(Edge(H+j,H+W+1,10099));
			}
		}
	}
	ans=maximumFlow(g,H+W,H+W+1);
	if(ans>1000)ans=-1
	cout<<ans<<endl;
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:135:27: error: expected ';' before 'cout'
  135 |         if(ans>1000)ans=-1
      |                           ^
      |                           ;
  136 |         cout<<ans<<endl;
      |         ~~~~