func_code_string: #include <bits/stdc++.h>   using namespace std;   using namespace std;   vector<int> adj[100005];   vector<int>::iterator it;   int con[100005];   bool visited[100005];   int bfs(int root) {     int j, i, u, v, mn = 10000000, temp;     queue<int> Q;     Q.push(root);     visited[root] = true;     while (!Q.empty()) {       u = Q.front();       Q.pop();       for (i = 0; i < adj[u].size(); i++) {         v = adj[u][i];         if (!visited[v]) {           Q.push(v);           visited[v] = true;         } else {           for (j = 0; j < adj[u].size(); j++) {             if (adj[u][j] != v) {               it = lower_bound(adj[v].begin(), adj[v].end(), adj[u][j]);               if (it != adj[v].end() && ((*it) == adj[u][j])) {                 temp = con[u] + con[v] + con[adj[u][j]] - 6;                 if (temp < mn) mn = temp;               }             }           }         }       }     }     return mn;   }   int main() {     int j, t, i, t1, t2, n, m, ans;     t = 1;     while (t--) {       scanf( %d , &n);       scanf( %d , &m);       memset(visited, 0, sizeof(visited));       for (i = 0; i < m; i++) {         scanf( %d%d , &t1, &t2);         adj[t1].push_back(t2);         adj[t2].push_back(t1);       }       for (i = 1; i <= n; i++) {         sort(adj[i].begin(), adj[i].end());       }       for (i = 1; i <= n; i++) {         con[i] = adj[i].size();       }       ans = 10000000;       for (i = 1; i <= n; i++) {         if (!visited[i]) {           t1 = bfs(i);           if (t1 < ans) ans = t1;         }       }       if (ans == 10000000)         printf( -1 n );       else         printf( %d n , ans);     }     return 0;   }   