func_code_string: #include <bits/stdc++.h>   using namespace std;   void read(int& x) {     bool fu = 0;     char c;     for (c = getchar(); c <= 32; c = getchar())       ;     if (c ==  - ) fu = 1, c = getchar();     for (x = 0; c > 32; c = getchar()) x = x * 10 + c -  0 ;     if (fu) x = -x;   };   char getc() {     char c;     for (c = getchar(); c <= 32; c = getchar())       ;     return c;   }   const int N = 100010;   const int inf = 1000000000;   int n, m, d, i, j, k, l, p, x, y, ans;   bool have[N];   int edge, e[N * 2], b[N * 2], fir[N], last[N];   void clear() {     edge = 0;     memset(fir, -1, sizeof(fir));     memset(b, -1, sizeof(b));   }   void adde(int x, int y) {     e[edge] = y;     if (fir[x] == -1)       fir[x] = edge;     else       b[last[x]] = edge;     last[x] = edge++;   }   int st[N], ed[N], ti, fa[N], dep[N], home[N];   void dfs(int i) {     st[i] = ++ti;     home[ti] = i;     int k;     for (k = fir[i]; k >= 0; k = b[k])       if (e[k] != fa[i]) {         fa[e[k]] = i;         dep[e[k]] = dep[i] + 1;         dfs(e[k]);       }     ed[i] = ti;   }   int key[N * 4], add[N * 4];   void padd(int i, int s) {     add[i] += s;     key[i] += s;   }   void pdown(int i) {     if (add[i]) padd(i * 2, add[i]), padd(i * 2 + 1, add[i]), add[i] = 0;   }   void upd(int i) { key[i] = max(key[i * 2], key[i * 2 + 1]); }   void build(int i, int x, int y) {     if (x != y) {       build(i * 2, x, (x + y) / 2);       build(i * 2 + 1, (x + y) / 2 + 1, y);       upd(i);     } else       key[i] = (have[home[x]]) ? dep[home[x]] : -inf;   }   void find(int i, int x, int y, int l, int r, int s) {     if (y < l || x > r) return;     if (x >= l && y <= r) {       padd(i, s);       return;     }     pdown(i);     find(i * 2, x, (x + y) / 2, l, r, s);     find(i * 2 + 1, (x + y) / 2 + 1, y, l, r, s);     upd(i);   }   void doit(int l, int r, int s) {     find(1, 1, n, l, r, s);     if (l > 1) find(1, 1, n, 1, l - 1, -s);     if (r < n) find(1, 1, n, r + 1, n, -s);   }   void go(int i) {     if (key[1] <= d) ans++;     int k;     for (k = fir[i]; k >= 0; k = b[k])       if (e[k] != fa[i]) {         doit(st[e[k]], ed[e[k]], -1);         go(e[k]);         doit(st[e[k]], ed[e[k]], 1);       }   }   int main() {     read(n);     read(m);     read(d);     for (i = 1; i <= m; i++) read(x), have[x] = 1;     clear();     for (i = 1; i <= n - 1; i++) read(x), read(y), adde(x, y), adde(y, x);     dfs(1);     build(1, 1, n);     go(1);     printf( %d n , ans);     scanf(  n );     return 0;   }   