func_code_string: #include <bits/stdc++.h>   using namespace std;   void fun() {}   long long int md = 998244353;   long long int __gcd(long long int a, long long int b) {     if (b == 0) return a;     return __gcd(b, a % b);   }   long long int poww(long long int a, long long int b, long long int md) {     if (b < 0) return 0;     if (a == 0) return 0;     long long int res = 1;     while (b) {       if (b & 1) {         res = (1ll * res * a) % md;       }       a = (1ll * a * a) % md;       b >>= 1;     }     return res;   }   long long int poww(long long int a, long long int b) {     if (b < 0) return 0;     if (a == 0) return 0;     long long int res = 1;     while (b) {       if (b & 1) {         res = (1ll * res * a);       }       a = (1ll * a * a);       b >>= 1;     }     return res;   }   void ainp(long long int arr[], long long int n) {     for (long long int i = 1; i <= n; i++) cin >> arr[i];   }   void disp(long long int arr[], long long int n) {     for (long long int i = 1; i <= n; i++) cout << arr[i] <<    ;     cout <<   n ;   }   void dispv(vector<long long int> &v) {     for (long long int i = 0; i < v.size(); i++) cout << v[i] <<    ;     cout <<   n ;   }   long long int divide(long long int a, long long int b, long long int md) {     long long int rr = a * (poww(b, md - 2, md));     rr %= md;     return rr;   }   const long long int size = 2e5 + 5;   long long int n, m, k, u, v;   vector<long long int> g[size];   pair<long long int, long long int> dis[size], prr[size];   queue<long long int> q;   long long int arr[size], suffmax[size];   bool fnn(pair<long long int, long long int> &p1,            pair<long long int, long long int> &p2) {     return (p1.first - p1.second < p2.first - p2.second);   }   void bfs() {     dis[1].first = 0;     q.push(1);     while (!q.empty()) {       long long int node = q.front();       q.pop();       for (long long int child : g[node]) {         if (dis[child].first > dis[node].first + 1 ||             (child != 1 && dis[child].first == 0)) {           dis[child].first = dis[node].first + 1;           q.push(child);         }       }     }     q.push(n);     dis[n].second = 0;     while (!q.empty()) {       long long int node = q.front();       q.pop();       for (long long int child : g[node]) {         if (dis[child].second > dis[node].second + 1 ||             (child != n && dis[child].second == 0)) {           dis[child].second = dis[node].second + 1;           q.push(child);         }       }     }   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     fun();     cin >> n >> m >> k;     ainp(arr, k);     for (long long int i = 1; i <= m; i++) {       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);     }     bfs();     for (long long int i = 1; i <= k; i++) prr[i] = dis[arr[i]];     sort(prr + 1, prr + 1 + k, fnn);     for (long long int i = k; i > 0; i--)       suffmax[i] = max(suffmax[i + 1], prr[i].second);     long long int cost = dis[n].first;     long long int cst = 0;     for (long long int i = 1; i < k; i++) {       cst = max(suffmax[i + 1] + 1 + prr[i].first, cst);     }     cout << min(cst, cost) <<   n ;     return 0;   }   