func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   int logb(int base, int x) { return (log(x) / log(base)); }   int occurs(vector<long long> v, int n) {     auto it = lower_bound(((v)).begin(), ((v)).end(), (n));     auto it1 = upper_bound(((v)).begin(), ((v)).end(), (n));     int x = it1 - it;     return x;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long powm(int a, int b) {     long long res = 1;     while (b) {       if (b & 1) res = (res * 1LL * a) % mod;       b >>= 1;       a = (a * 1LL * a) % mod;     }     return res;   }   long long nCr(long long n, long long k) {     int fact[n];     long long res = (fact[n] * powm(fact[k], mod - 2)) % mod;     return (res * powm(fact[n - k], mod - 2)) % mod;   }   const int N = 1e5 + 5, inf = 1e9;   vector<int> g[N];   int n, m, d;   int mxin[N], mxout[N], marked[N];   void dfs_down(int v, int p) {     mxin[v] = -inf;     if (marked[v]) mxin[v] = 0;     for (auto u : g[v]) {       if (u == p) continue;       dfs_down(u, v);       mxin[v] = max(mxin[v], mxin[u] + 1);     }   }   void dfs_up(int v, int p) {     int max1 = -1 * inf, max2 = -1 * inf;     for (auto u : g[v]) {       if (u == p) continue;       if (mxin[u] >= max1)         max2 = max1, max1 = mxin[u];       else if (mxin[u] > max2)         max2 = mxin[u];     }     for (auto u : g[v]) {       if (u == p) continue;       int used = (mxin[u] == max1) ? max2 : max1;       mxout[u] = max(1 + mxout[v], 2 + used);       if (mxout[u] < 0 && marked[u]) mxout[u] = 0;       dfs_up(u, v);     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m >> d;     int x, y;     for (int(i) = 0; (i) < (m); ++(i)) {       cin >> x;       marked[x] = 1;     }     for (int(i) = 0; (i) < (n - 1); ++(i)) {       cin >> x >> y;       g[x].push_back(y);       g[y].push_back(x);     }     dfs_down(1, 0);     mxout[1] = (marked[1] ? 0 : -inf);     dfs_up(1, 0);     int ans = 0;     for (int i = 1; i <= n; i++) ans += (mxin[i] <= d && mxout[i] <= d);     cout << ans <<   n ;     return 0;   }   