func_code_string: #include <bits/stdc++.h>   using namespace std;   struct node {     int to, nxt, v;   } e[1000005];   queue<int> que;   int n, m, head[1000005], cnt, l, r, vis[1000005], pre[1000005], tot;   int sum, ans[1000005], ppp, minn = 1023456789, dfn[1000005], id[1000005];   inline void add(int from, int to, int v) {     e[++cnt].nxt = head[from];     head[from] = cnt;     e[cnt].to = to;     e[cnt].v = v;   }   inline int dfs(int p, int val, int fa) {     pre[p] = tot;     vis[p] = 1;     for (int i = head[p]; i; i = e[i].nxt) {       if (e[i].v > val) {         if (pre[e[i].to] == tot && !vis[e[i].to]) {           continue;         }         if ((pre[e[i].to] == tot && vis[e[i].to]) || dfs(e[i].to, val, fa))           return 1;       }     }     vis[p] = 0;     return 0;   }   inline void work(int val) {     for (int i = 1; i <= m; i++)       if (e[i].v > val) dfn[e[i].to]++;     for (int i = 1; i <= n; i++)       if (!dfn[i]) que.push(i);     while (!que.empty()) {       int u = que.front();       que.pop();       id[u] = ++sum;       for (int i = head[u]; i; i = e[i].nxt) {         if (e[i].v > val) {           dfn[e[i].to]--;           if (!dfn[e[i].to]) que.push(e[i].to);         }       }     }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       add(x, y, z);       r = max(r, z);     }     l = 0;     int fl;     while (l < r) {       fl = 0;       tot++;       sum = 0;       int mid = (l + r) >> 1;       for (int i = 1; i <= n; i++) {         if (pre[i] != tot && dfs(i, mid, i)) {           fl = 1;           break;         }       }       if (!fl) {         r = mid;       } else {         l = mid + 1;       }     }     printf( %d  , r);     sum = 0;     work(r);     for (int i = 1; i <= n; i++) {       for (int j = head[i]; j; j = e[j].nxt) {         if (e[j].v <= r) {           if (id[e[j].to] < id[i]) {             ans[++ppp] = j;           }         }       }     }     printf( %d n , ppp);     sort(ans + 1, ans + ppp + 1);     for (int i = 1; i <= ppp; i++) printf( %d  , ans[i]);     return 0;   }   