func_code_string: #include <bits/stdc++.h>   using namespace std;   int m, n, cn, nw, res, ans;   int used[533];   int x[1020], y[1020];   int a[1020][1020];   int asjkjas[1020];   bool kuhn(int x) {     if (used[x] == nw) return false;     used[x] = nw;     for (int i = (0); i < (n); ++i)       if (a[x][i] && i != cn && (asjkjas[i] == -1 || kuhn(asjkjas[i]))) {         asjkjas[i] = x;         return true;       }     return false;   }   int main() {     ios::sync_with_stdio(false);     cin >> n >> m;     for (int i = (0); i < (m); ++i) {       cin >> x[i] >> y[i];       x[i]--;       y[i]--;       a[x[i]][y[i]] = 1;     }     int res = 1000000000;     for (int c = (0); c < (n); ++c) {       cn = c;       int ans = 0;       for (int i = (0); i < (n); ++i) {         if (i != c)           ans += 2 - a[i][c] - a[c][i];         else           ans += 1 - a[i][i];       }       for (int i = (0); i < (n); ++i) used[i] = -1, asjkjas[i] = -1;       int ep = 0;       for (int i = (0); i < (n); ++i) {         if (i != c) {           nw = i;           if (kuhn(i)) ++ep;         }       }       ans += (n - 1) - ep;       for (int i = (0); i < (m); ++i)         if (x[i] != c && y[i] != c) ans += 1;       ans -= ep;       res = min(res, ans);     }     cout << res << endl;   }   