func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<vector<int> > g;   bool flag[100003];   int down[100003];   int max1[100003];   int max2[100003];   int up[100003];   void dfs(int x) {     flag[x] = true;     int i;     for (i = 0; i < g[x].size(); i++) {       if (!flag[g[x][i]]) {         dfs(g[x][i]);         if (down[g[x][i]] + 1 > max1[x]) {           max2[x] = max1[x];           max1[x] = down[g[x][i]] + 1;         } else if (down[g[x][i]] + 1 > max2[x])           max2[x] = down[g[x][i]] + 1;       }     }     down[x] = max1[x];   }   void dfs2(int x) {     flag[x] = true;     int i;     int res;     for (i = 0; i < g[x].size(); i++) {       if (!flag[g[x][i]]) {         if (down[g[x][i]] + 1 > max1[x] - 1)           res = max2[x];         else           res = max1[x];         up[g[x][i]] = max(up[x] + 1, res + 1);         dfs2(g[x][i]);       }     }   }   int n, m, d;   int main() {     scanf( %d %d %d , &n, &m, &d);     g.resize(n);     int x, y;     int i;     for (i = 0; i < n; i++) max1[i] = max2[i] = up[i] = down[i] = -2000000000;     for (i = 0; i < m; i++) {       scanf( %d , &x);       x--;       down[x] = 0;       up[x] = 0;       max1[x] = 0;     }     for (i = 0; i < n - 1; i++) {       scanf( %d %d , &x, &y);       x--;       y--;       g[x].push_back(y);       g[y].push_back(x);     }     dfs(0);     for (i = 0; i < n; i++) flag[i] = false;     dfs2(0);     int ans = 0;     for (i = 0; i < n; i++)       if (down[i] < d + 1 && up[i] < d + 1) ans++;     printf( %d n , ans);     return 0;   }   