func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int read() {     int d = 0;     char c = getchar();     while (c <  0  || c >  9 ) c = getchar();     while (c >=  0  && c <=  9 ) {       d = (d << 3) + (d << 1) + c -  0 ;       c = getchar();     }     return d;   }   const int N = 1e5 + 5;   const long long INF = 1e14;   int n, m, k;   int from[N * 2], ver[N * 2], nxt[N * 2], edge[N * 2], head[N], cnt;   int v[N * 2], h[N], nx[N * 2], cnt1;   long long dis[N][2], ed[N * 2];   int po[N];   bool pl[N];   inline void add(int x, int y, int z) {     from[++cnt] = x, ver[cnt] = y, edge[cnt] = z, nxt[cnt] = head[x],     head[x] = cnt;   }   void spfa() {     for (int i = 1; i <= n; i++) dis[i][0] = dis[i][1] = INF;     queue<int> q;     for (int i = 1; i <= k; i++) {       q.push(po[i]);       pl[po[i]] = true;       dis[po[i]][0] = po[i];       dis[po[i]][1] = 0;     }     while (!q.empty()) {       int x = q.front();       q.pop();       pl[x] = false;       for (int i = head[x]; i; i = nxt[i]) {         int y = ver[i];         if (dis[y][1] > dis[x][1] + edge[i]) {           dis[y][1] = dis[x][1] + edge[i];           dis[y][0] = dis[x][0];           if (!pl[y]) {             q.push(y);             pl[y] = true;           }         }       }     }   }   long long prim() {     long long ans = dis[1][1], nm = dis[1][0];     int tot = 1;     priority_queue<pair<long long, int>, vector<pair<long long, int> >,                    greater<pair<long long, int> > >         q;     pl[nm] = true;     for (int i = h[nm]; i; i = nx[i]) q.push(make_pair(ed[i], v[i]));     while (tot < k) {       while (pl[q.top().second]) q.pop();       int x = q.top().second;       long long len = q.top().first;       pl[x] = true;       ans += len;       tot++;       for (int i = h[x]; i; i = nx[i]) q.push(make_pair(ed[i], v[i]));     }     return ans;   }   int main() {     n = read(), m = read();     for (int i = 1; i <= m; i++) {       int u = read(), v = read(), w = read();       add(u, v, w);       add(v, u, w);     }     k = read();     for (int i = 1; i <= k; i++) po[i] = read();     spfa();     for (int i = 1; i <= cnt; i += 2) {       int x = from[i], y = ver[i];       v[++cnt1] = dis[y][0], nx[cnt1] = h[dis[x][0]], h[dis[x][0]] = cnt1;       ed[cnt1] = dis[x][1] + edge[i] + dis[y][1];       v[++cnt1] = dis[x][0], nx[cnt1] = h[dis[y][0]], h[dis[y][0]] = cnt1;       ed[cnt1] = dis[y][1] + edge[i] + dis[x][1];     }     cout << prim();     return 0;   }   