func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MAX = 1e5 + 5;   const long long inf = 1e18 + 9;   pair<long long, long long> dp[MAX];   long long p[MAX];   bool portal[MAX];   struct Edge {     long long from, to, cost;   };   long long Find(long long u) {     if (p[u] != u) p[u] = Find(p[u]);     return p[u];   }   void Union(long long u, long long v) { p[Find(u)] = Find(v); }   bool cmp(Edge e1, Edge e2) { return e1.cost < e2.cost; }   vector<Edge> E;   vector<pair<long long, long long> > P[MAX];   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n, m;     cin >> n >> m;     for (long long i = 1; i <= n; i++) p[i] = i;     for (long long i = 1; i <= m; i++) {       long long a, b, c;       cin >> a >> b >> c;       P[a].push_back(make_pair(b, c));       P[b].push_back(make_pair(a, c));       E.push_back({a, b, c});     }     long long k;     cin >> k;     priority_queue<pair<long long, long long> > Q;     for (long long i = 1; i <= n; i++) dp[i] = {inf, -1};     for (long long i = 1; i <= k; i++) {       long long a;       cin >> a;       dp[a] = {0, a};       portal[a] = true;       Q.push(make_pair(-dp[a].first, a));     }     while (!Q.empty()) {       pair<long long, long long> akt = Q.top();       Q.pop();       akt.first *= -1;       if (akt.first != dp[akt.second].first) continue;       for (auto it : P[akt.second]) {         if (it.second + akt.first < dp[it.first].first) {           dp[it.first].first = it.second + akt.first;           dp[it.first].second = dp[akt.second].second;           Q.push(make_pair(-dp[it.first].first, it.first));         }       }     }     for (long long i = 0; i < E.size(); i++) {       E[i].cost += dp[E[i].from].first + dp[E[i].to].first;       E[i].from = dp[E[i].from].second;       E[i].to = dp[E[i].to].second;     }     sort(E.begin(), E.end(), cmp);     long long ans = 0;     for (auto it : E) {       if (Find(it.from) != Find(it.to)) {         Union(it.from, it.to);         ans += it.cost;       }     }     if (!portal[1]) ans += dp[1].first;     cout << ans;     return 0;   }   