func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 5e5 + 10;   long long n, m, k, ki[maxn], d[maxn], par[maxn];   long long ans;   vector<pair<int, int>> veci[maxn];   bool mark[maxn], fu;   set<pair<long long, pair<int, int>>> st;   vector<pair<long long, pair<int, int>>> yal;   int get(int u) { return par[u] = par[u] == u ? u : get(par[u]); }   int main() {     ios_base ::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (int i = 0; i < m; i++) {       int u, v, w;       cin >> u >> v >> w;       veci[v].push_back({u, w});       veci[u].push_back({v, w});       yal.push_back({w, {u, v}});     }     cin >> k;     for (int i = 0; i < k; i++) {       int a;       cin >> a;       mark[a] = 1;       ki[a] = a;       for (auto x : veci[a])         if (mark[x.first] == 0) st.insert({x.second, {a, x.first}});       par[a] = a;       if (a == 1) fu = 1;     }     while (st.size()) {       auto y = *st.begin();       int u = y.second.second;       st.erase(y);       if (mark[u] == 1) continue;       mark[u] = 1;       ki[u] = y.second.first;       d[u] = y.first;       for (auto x : veci[u])         if (mark[x.first] == 0) st.insert({d[u] + x.second, {ki[u], x.first}});     }     st.clear();     for (auto x : yal)       st.insert({d[x.second.first] + d[x.second.second] + x.first,                  {ki[x.second.first], ki[x.second.second]}});     while (st.size()) {       auto x = *st.begin();       long long u = x.second.first, v = x.second.second, w = x.first;       st.erase(x);       u = get(u);       v = get(v);       if (u != v) {         par[u] = v;         ans += w;       }     }     if (fu == 1)       cout << ans;     else       cout << (long long)ans + d[1];   }   