func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, k, src, dest, dist[100001], par[100001], mark[100001], vol[100001],       vis[100001];   vector<int> v[100001];   vector<pair<int, int> > edge;   vector<int> g[100001];   int reachable() {     memset(vis, 0, sizeof vis);     vis[src] = 1;     queue<int> q;     q.push(src);     while (!q.empty()) {       int x = q.front();       q.pop();       for (auto it : g[x]) {         int y = it;         if (vis[y]) continue;         vis[y] = 1;         q.push(y);       }     }     return vis[dest];   }   int ok(int val) {     int i, x, y, cur, dis, parent, nxt;     for (i = 1; i <= n; i++) dist[i] = 10000000;     priority_queue<pair<int, pair<int, int> > > q;     for (i = 1; i <= k; i++) {       dist[vol[i]] = 0;       par[vol[i]] = vol[i];       q.push({-dist[vol[i]], {par[vol[i]], vol[i]}});     }     while (!q.empty()) {       cur = q.top().second.second;       parent = q.top().second.first;       dis = -q.top().first;       q.pop();       if (dis != dist[cur] || parent != par[cur]) continue;       for (i = 0; i < v[cur].size(); i++) {         nxt = v[cur][i];         if (dist[nxt] > dist[cur] + 1) {           dist[nxt] = dist[cur] + 1;           par[nxt] = parent;           q.push({-dist[nxt], {par[nxt], nxt}});         }       }     }     for (i = 1; i <= n; i++) g[i].clear();     for (auto it : edge) {       x = it.first;       y = it.second;       if (par[x] == par[y]) continue;       if (dist[x] + dist[y] + 1 <= val) {         g[par[x]].push_back(par[y]);         g[par[y]].push_back(par[x]);       }     }     if (reachable()) return 1;     return 0;   }   int main() {     ios::sync_with_stdio(false);     ;     cin.tie(0);     ;     int i, j, x, y, lo, mid, hi;     cin >> n >> m >> k;     for (i = 1; i <= k; i++) {       cin >> vol[i];       mark[vol[i]] = 1;     }     for (i = 1; i <= m; i++) {       cin >> x >> y;       edge.push_back({x, y});       v[x].push_back(y);       v[y].push_back(x);     }     cin >> src >> dest;     if (!mark[dest]) {       mark[dest] = 1;       k++;       vol[k] = dest;     }     lo = 0;     hi = 10000000;     if (!ok(hi)) {       cout <<  -1 ;       return 0;     }     while (hi - lo > 1) {       mid = (lo + hi) / 2;       if (ok(mid))         hi = mid;       else         lo = mid;     }     cout << hi;     return 0;   }   