func_code_string: #include <bits/stdc++.h>   using namespace std;   int N, M, ans, S, T, C;   pair<int, int> ap;   struct edge {     int u, v, w, i;     bool operator<(const edge &o) const { return w < o.w; }   } tmp[30300];   vector<edge> e;   vector<pair<int, int>> adj[1100];   int id[1100], lo[1100], tp[1100], ep[1100];   bool art[1100];   struct uf {     int p[1100];     void init() {       for (int i = (1); i < (N + 1); i++) p[i] = i;     }     int g(int i) { return p[i] == i ? i : p[i] = g(p[i]); }     bool c(int i, int j) { return g(i) == g(j); }     void m(int i, int j) { p[g(i)] = g(j); }   } a, b, c;   void clr() {     for (int i = (1); i < (N + 1); i++) {       adj[i].clear();       id[i] = 0, lo[i] = 0, art[i] = 0;       tp[i] = 0, ep[i] = 0;     }     C = 0;   }   void go(int i, int p) {     id[i] = ++C;     lo[i] = id[i];     for (auto j : adj[i]) {       if (j.first == p)         p = -1;       else if (!id[j.first]) {         tp[j.first] = i;         ep[j.first] = j.second;         go(j.first, i);         lo[i] = min(lo[i], lo[j.first]);       } else         lo[i] = min(lo[i], id[j.first]);     }     if (lo[i] == id[i]) art[i] = 1;   }   int main() {     scanf( %d %d %d %d , &N, &M, &S, &T);     a.init(), b.init(), c.init(), ans = 2e9 + 7, ap = {-1, -1};     for (int i = (0); i < (M); i++) {       scanf( %d %d %d , &tmp[i].u, &tmp[i].v, &tmp[i].w);       tmp[i].i = i + 1;     }     sort(tmp, tmp + M);     for (int i = (0); i < (M); i++) {       if (!a.c(tmp[i].u, tmp[i].v)) {         a.m(tmp[i].u, tmp[i].v);         e.push_back(tmp[i]), e.back().i = i;       } else if (!b.c(tmp[i].u, tmp[i].v)) {         b.m(tmp[i].u, tmp[i].v);         e.push_back(tmp[i]), e.back().i = i;       } else if (!c.c(tmp[i].u, tmp[i].v)) {         c.m(tmp[i].u, tmp[i].v);         e.push_back(tmp[i]), e.back().i = i;       }     }     if (!a.c(S, T)) return puts( 0 n0 ), 0;     clr();     for (int i = (0); i < ((int)e.size()); i++) {       adj[e[i].u].push_back({e[i].v, e[i].i}),           adj[e[i].v].push_back({e[i].u, e[i].i});     }     go(S, -1);     int x = T;     while (x != S) {       if (art[x]) {         if (tmp[ep[x]].w < ans) {           ans = tmp[ep[x]].w;           ap = {tmp[ep[x]].i, -1};         }       }       x = tp[x];     }     for (int rem = (0); rem < ((int)e.size()); rem++) {       int extra = 0, rid = -1;       clr();       for (int i = (0); i < ((int)e.size()); i++) {         if (i != rem) {           adj[e[i].u].push_back({e[i].v, e[i].i}),               adj[e[i].v].push_back({e[i].u, e[i].i});         } else           extra = e[i].w, rid = tmp[e[i].i].i;       }       go(S, -1);       if (!id[T]) continue;       x = T;       while (x != S) {         if (art[x]) {           if (tmp[ep[x]].w + extra < ans) {             ans = tmp[ep[x]].w + extra;             ap = {tmp[ep[x]].i, rid};           }         }         x = tp[x];       }     }     if (ans == 2e9 + 7)       puts( -1 );     else {       printf( %d n , ans);       if (ap.second == -1) {         printf( 1 n%d n , ap.first);       } else {         printf( 2 n%d %d n , ap.first, ap.second);       }     }     return 0;   }   