func_code_string: #include <bits/stdc++.h>   using namespace std;   namespace dinic {   using ll = int;   const ll oo = 1e6;   const int N = 202 * 202 * 2;   const int E = 202 * 202 * 6 * 2 * 2;   vector<int> g[N];   int ne;   struct Edge {     int from, to;     ll flow, cap;   } edge[E];   int lvl[N], vis[N], pass, start = N - 2, target = N - 1;   int qu[N], qt, px[N];   ll run(int s, int sink, ll minE) {     if (s == sink) return minE;     ll ans = 0;     for (; px[s] < (int)g[s].size(); px[s]++) {       int e = g[s][px[s]];       auto &v = edge[e], &rev = edge[e ^ 1];       if (lvl[v.to] != lvl[s] + 1 || v.flow >= v.cap) continue;       ll tmp = run(v.to, sink, min(minE, v.cap - v.flow));       v.flow += tmp, rev.flow -= tmp;       ans += tmp, minE -= tmp;       if (minE == 0) break;     }     return ans;   }   bool bfs(int source, int sink) {     qt = 0;     qu[qt++] = source;     lvl[source] = 1;     vis[source] = ++pass;     for (int i = 0; i < qt; i++) {       int u = qu[i];       px[u] = 0;       if (u == sink) return true;       for (auto& ed : g[u]) {         auto v = edge[ed];         if (v.flow >= v.cap || vis[v.to] == pass) continue;         vis[v.to] = pass;         lvl[v.to] = lvl[u] + 1;         qu[qt++] = v.to;       }     }     return false;   }   ll flow(int source = start, int sink = target) {     ll ans = 0;     while (bfs(source, sink)) ans += run(source, sink, oo);     return ans;   }   void addEdge(int u, int v, ll c = 1, ll rc = 0) {     edge[ne] = {u, v, 0, c};     g[u].push_back(ne++);     edge[ne] = {v, u, 0, rc};     g[v].push_back(ne++);   }   };  // namespace dinic   const int N = 205;   int n, m;   char mat[N][N];   int main() {     scanf( %d %d , &n, &m);     for (int i = 0; i < n; i++) scanf( %s , mat[i]);     const int s = dinic::start;     const int t = dinic::target;     const int add = n * m;     int tot = 0;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         if (mat[i][j] !=  # ) continue;         tot++;         if (mat[i + 1][j] !=  # ) continue;         if (j - 1 >= 0 and mat[i][j - 1] ==  # ) {           dinic::addEdge(i * m + j, add + i * m + j - 1);         }         if (mat[i][j + 1] ==  # ) {           dinic::addEdge(i * m + j, add + i * m + j);         }         if (j - 1 >= 0 and mat[i + 1][j - 1] ==  # ) {           dinic::addEdge(i * m + j, add + (i + 1) * m + j - 1);         }         if (mat[i + 1][j + 1] ==  # ) {           dinic::addEdge(i * m + j, add + (i + 1) * m + j);         }       }     int ver = 0;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         if (mat[i][j] !=  # ) continue;         if (mat[i][j + 1] ==  # ) {           ver++;           dinic::addEdge(add + i * m + j, t);         }         if (mat[i + 1][j] ==  # ) {           ver++;           dinic::addEdge(s, i * m + j);         }       }     printf( %d n , tot - (ver - dinic::flow(s, t)));   }   