func_code_string: #include <bits/stdc++.h>   using namespace std;   struct Hungary {     vector<int> g[1005];     int from[1005], mx[1005], ans;     bool use[1005];     int n, sume;     int nume[1005];     bool match(int x, int exp) {       for (int i = int(0); i < int(g[x].size()); ++i) {         if (g[x][i] == exp) continue;         if (!use[g[x][i]]) {           use[g[x][i]] = true;           if (from[g[x][i]] == -1 || match(from[g[x][i]], exp)) {             from[g[x][i]] = x;             mx[x] = g[x][i];             return true;           }         }       }       return false;     }     void matching(int exp) {       ans = 0;       memset(from, -1, sizeof(from));       memset(mx, 0, sizeof(mx));       for (int i = int(1); i < int(n + 1); ++i) {         if (i == exp) continue;         memset(use, 0, sizeof(use));         if (match(i, exp)) ans++;       }     }     void init(int nn) {       n = nn;       for (int i = int(1); i < int(n + 1); ++i) g[i].clear();       sume = 0;       memset(nume, 0, sizeof(nume));     }     void AddEdge(int u, int v) {       g[u].push_back(v);       sume++;       nume[u]++;       if (u != v) nume[v]++;     }   } H;   bool mp[1005][1005];   int main() {     int n, m;     while (scanf( %d%d , &n, &m) == 2) {       memset(mp, 0, sizeof(mp));       H.init(n);       for (int i = int(0); i < int(m); ++i) {         int u, v;         scanf( %d%d , &u, &v);         mp[u][v] = true;         H.AddEdge(u, v);       }       int ans = n * n * n;       for (int i = int(1); i < int(n + 1); ++i) {         int pans = 0;         if (!mp[i][i]) pans++;         for (int j = int(1); j < int(n + 1); ++j) {           if (j == i) continue;           if (!mp[i][j]) pans++;           if (!mp[j][i]) pans++;         }         H.matching(i);         pans += (H.sume - H.nume[i] - H.ans);         pans += (n - 1 - H.ans);         ans = min(ans, pans);       }       printf( %d n , ans);     }     return 0;   }   