func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, a, b, fr, k1, k2;   int dist[3005][3005];   bool flag[3005][3005];   vector<int> v[3005];   queue<int> q;   int main() {     scanf( %d %d , &n, &m);     for (int i = 1; i <= m; i++) {       scanf( %d %d , &a, &b);       v[a].push_back(b);       v[b].push_back(a);     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) dist[i][j] = 1e9;     memset(flag, 1, sizeof(flag));     for (int k = 1; k <= n; k++) {       while (!q.empty()) q.pop();       q.push(k);       dist[k][k] = 0;       while (!q.empty()) {         fr = q.front();         q.pop();         flag[fr][fr] = false;         for (int i = 0; i < v[fr].size(); i++) {           if (flag[k][v[fr][i]]) {             flag[k][v[fr][i]] = false;             dist[k][v[fr][i]] = dist[k][fr] + 1;             q.push(v[fr][i]);           }         }       }     }     int s1, t1, l1, s2, t2, l2, ans = -1;     scanf( %d %d %d , &s1, &t1, &l1);     scanf( %d %d %d , &s2, &t2, &l2);     for (int i = 1; i < n; i++) {       for (int j = i + 1; j <= n; j++) {         k1 = min(dist[s1][i] + dist[i][j] + dist[j][t1],                  dist[s1][j] + dist[i][j] + dist[i][t1]);         k2 = min(dist[s2][i] + dist[i][j] + dist[j][t2],                  dist[s2][j] + dist[i][j] + dist[i][t2]);         if (k1 <= l1 && k2 <= l2) {           ans = max(ans, m - k1 - k2 + dist[i][j]);         }       }     }     if (dist[s1][t1] <= l1 && dist[s2][t2] <= l2) {       ans = max(ans, m - dist[s1][t1] - dist[s2][t2]);     }     printf( %d n , ans);   }   