func_code_string: #include <bits/stdc++.h>   using namespace std;   int read() {     char x = getchar();     int ans = 0, flag = 1;     while (!isdigit(x))       if (x ==  - )         flag = -1, x = getchar();       else         x = getchar();     while (isdigit(x)) ans = ans * 10 + x -  0 , x = getchar();     return ans * flag;   }   int n, m, d, head[100005], nxt[200005], pnt[200005], E, dp[100005][2];   void add_edge(int u, int v) {     pnt[E] = v;     nxt[E] = head[u];     head[u] = E++;   }   void dfs1(int u, int pre) {     for (int i = head[u]; i != -1; i = nxt[i]) {       int v = pnt[i];       if (v == pre) continue;       dfs1(v, u);       if (dp[v][0] == -1) continue;       if (dp[u][0] < dp[v][0] + 1) {         swap(dp[u][0], dp[u][1]);         dp[u][0] = dp[v][0] + 1;       } else if (dp[u][1] < dp[v][0] + 1) {         dp[u][1] = dp[v][0] + 1;       }     }   }   void dfs2(int u, int pre, int val) {     if (dp[u][0] <= val) {       swap(dp[u][0], dp[u][1]);       dp[u][0] = val;     } else if (dp[u][1] <= val) {       dp[u][1] = val;     }     for (int i = head[u]; i != -1; i = nxt[i]) {       int v = pnt[i];       if (v == pre) continue;       int tmp = dp[u][0];       if (tmp == dp[v][0] + 1) tmp = dp[u][1];       dfs2(v, u, tmp + 1);     }   }   signed main() {     memset(head, -1, sizeof(head));     n = read(), m = read(), d = read();     memset(dp, 128, sizeof(dp));     for (int i = 1; i <= m; i++) {       int u = read();       dp[u][0] = dp[u][1] = 0;     }     for (int i = 1; i < n; i++) {       int u = read(), v = read();       add_edge(u, v);       add_edge(v, u);     }     dfs1(1, 0);     dfs2(1, 0, -1e9);     int ans = 0;     for (int i = 1; i <= n; i++) {       if (dp[i][0] <= d) ans++;     }     cout << ans << endl;     return 0;   }   