func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, d;   bool ck[100005];   vector<int> adj[100005];   int dep[100005], ans;   void dfs(int u, int p) {     dep[u] = (ck[u] ? 0 : -(1 << 20));     for (int i = 0; i < adj[u].size(); ++i) {       int v = adj[u][i];       if (v == p) continue;       dfs(v, u);       if (dep[v] != -(1 << 20)) dep[u] = max(dep[u], dep[v] + 1);     }   }   void get(int u, int p, int bef) {     if (ck[u]) bef = max(0, bef);     ans += (bef <= d && dep[u] <= d);     int m1 = -1, m2 = -1, c1 = 0;     for (int i = 0; i < adj[u].size(); ++i) {       int v = adj[u][i];       if (v == p) continue;       int dd = dep[v] + 1;       if (dd > m1)         m2 = m1, m1 = dd;       else if (dd > m2)         m2 = dd;     }     for (int i = 0; i < adj[u].size(); ++i) {       int v = adj[u][i];       if (v == p) continue;       int dd = dep[v] + 1;       if (dd == m1) c1++;     }     for (int i = 0; i < adj[u].size(); ++i) {       int v = adj[u][i];       if (v == p) continue;       int dd = dep[v] + 1;       if (dd == m1) {         if (c1 > 1)           get(v, u, max(bef + 1, m1 + 1));         else if (m2 != -1)           get(v, u, max(bef + 1, m2 + 1));         else           get(v, u, bef + 1);       } else         get(v, u, max(bef + 1, m1 + 1));     }   }   int main() {     scanf( %d%d%d , &n, &m, &d);     for (int i = 0; i < m; ++i) {       int u;       scanf( %d , &u), u--;       ck[u] = 1;     }     for (int i = 0; i < n - 1; ++i) {       int u, v;       scanf( %d%d , &u, &v), u--, v--;       adj[u].push_back(v);       adj[v].push_back(u);     }     dfs(0, -1), get(0, -1, ck[0] ? 0 : -(1 << 20));     printf( %d , ans);   }   