func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<int, int>> edges;   vector<int> g[300001];   int police[300001];   int nearest[300001];   int stat[300001];   void dfs1(int beta, int baap) {     int mini = (police[beta] ? 0 : (int)1e9), minpos = (police[beta] ? beta : -1);     for (int i = 0; i < g[beta].size(); i++) {       int pota = g[beta][i];       if (pota == baap) continue;       dfs1(pota, beta);       if (mini > 1 + nearest[pota]) {         mini = 1 + nearest[pota];         minpos = stat[pota];       }     }     nearest[beta] = mini;     stat[beta] = minpos;   }   void dfs2(int beta, int baap) {     int up = (baap == -1 ? (int)1e9 : 1 + nearest[baap]);     if (up < nearest[beta]) {       nearest[beta] = up;       stat[beta] = stat[baap];     }     for (int i = 0; i < g[beta].size(); i++) {       int pota = g[beta][i];       if (pota == baap) continue;       dfs2(pota, beta);     }   }   int main() {     int n, k, d;     scanf( %d %d %d , &n, &k, &d);     for (int i = 0; i < k; i++) {       int x;       scanf( %d , &x);       police[x] = 1;     }     for (int i = 0; i < n - 1; i++) {       int x, y;       scanf( %d %d , &x, &y);       g[x].push_back(y);       g[y].push_back(x);       edges.push_back(make_pair(x, y));     }     dfs1(1, -1);     dfs2(1, -1);     vector<int> ans;     for (int i = 0; i < n - 1; i++) {       int u = edges[i].first, v = edges[i].second;       if (stat[u] != stat[v]) ans.push_back(i + 1);     }     printf( %d n , (int)ans.size());     for (int i = 0; i < ans.size(); i++) {       printf( %d  , ans[i]);     }     return 0;   }   