func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, k, u, v, a[200005], el, ans;   vector<int> adj[200005];   queue<int> q;   bool vis[200005];   int depth[200005], depthn[200005];   int main() {     ios_base::sync_with_stdio(NULL);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> k;     for (int i = 1; i <= k; i++) {       cin >> a[i];     }     for (int i = 1; i <= m; i++) {       cin >> u >> v;       adj[u].push_back(v);       adj[v].push_back(u);     }     for (int i = 1; i <= n; i++) {       vis[i] = 0;     }     q.push(1);     vis[1] = 1;     depth[1] = 0;     int node;     while (!q.empty()) {       node = q.front();       q.pop();       for (int x : adj[node]) {         if (vis[x]) continue;         vis[x] = 1;         depth[x] = depth[node] + 1;         q.push(x);       }     }     for (int i = 1; i <= n; i++) {       vis[i] = 0;     }     q.push(n);     vis[n] = 1;     depthn[n] = 0;     while (!q.empty()) {       node = q.front();       q.pop();       for (int x : adj[node]) {         if (vis[x]) continue;         vis[x] = 1;         depthn[x] = depthn[node] + 1;         q.push(x);       }     }     vector<pair<int, int> > v;     int cek = 0, ee = 0, cekn = 0, een = 0;     for (int i = 1; i <= k; i++) {       if (depth[a[i]] >= depth[n]) {         cek++;         ee = a[i];       }       if (depthn[a[i]] >= depthn[1]) {         cekn++;         een = a[i];       }       if (cek == 2 || cekn == 2) {         cout << depth[n] << endl;         return 0;       }       if (ee != a[i] && een != a[i]) v.push_back(make_pair(depth[a[i]], a[i]));     }     sort(v.begin(), v.end());     int minn = 1e9;     for (int i = 1; i < v.size(); i++) {       minn = min(minn, v[i].first - v[i - 1].first);     }     if (minn < 1e9) ans = depth[n] - max(0, minn - 1);     if (cek == 0 && cekn == 0) {       cout << ans << endl;       return 0;     }     if (cek == 1 && cekn == 0) {       cout << max(ans, min(depth[n], v[k - 2].first + 1 + depthn[ee])) << endl;     } else if (cek == 0 && cekn == 1) {       cout << max(ans, min(depth[n], depthn[v[0].second] + 1 + depth[een]))            << endl;     } else {       ans = max(ans, min(depth[een] + 1 + depthn[ee], depth[n]));       if (v.size() > 0) {         ans = max(ans, min(depth[n], v[k - 3].first + 1 + depthn[ee]));         ans = max(ans, min(depth[n], depthn[v[0].second] + 1 + depth[een]));       }       cout << ans << endl;     }   }   