func_code_string: #include <bits/stdc++.h>   using namespace std;   long long Answer = 0, idx[300100], edges[300100], dis[300100];   int n, m, x, y, w, u;   vector<pair<pair<int, int>, int> > v[300100];   priority_queue<pair<int, int>, vector<pair<int, int> >,                  greater<pair<int, int> > >       Q;   void dik() {     for (int i = 1; i <= n; i++) dis[i] = 1e18;     Q.push({0, u});     dis[u] = 0;     while (!Q.empty()) {       pair<int, int> x = Q.top();       Q.pop();       for (int i = 0; i < v[x.second].size(); i++) {         int V = v[x.second][i].first.first;         int cost = v[x.second][i].first.second;         int id = v[x.second][i].second;         if (dis[V] > dis[x.second] + cost ||             (dis[V] == dis[x.second] + cost && edges[idx[V]] > edges[id])) {           dis[V] = dis[x.second] + cost;           idx[V] = id;           Q.push({dis[V], V});         }       }     }   }   int main() {     memset(idx, -1, sizeof(idx));     cin >> n >> m;     for (int i = 0; i < m; i++) {       cin >> x >> y >> w;       v[x].push_back({{y, w}, i + 1});       v[y].push_back({{x, w}, i + 1});       edges[i + 1] = w;     }     cin >> u;     dik();     for (int i = 1; i <= n; i++) {       if (idx[i] != -1) {         Answer += edges[idx[i]];       }     }     cout << Answer << endl;     for (int i = 1; i <= n; i++) {       if (idx[i] != -1) cout << idx[i] <<    ;     }     return 0;   }   