func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int ans = 0;   vector<int> vx[200005];   bool vu[200005];   int n, k;   int dfs(int v, int p) {     int aa = 0, aa2 = 0;     for (int i = 0; i < vx[v].size(); i++) {       if (vx[v][i] == p) continue;       int pr = dfs(vx[v][i], v);       aa += pr;       aa2 += min(pr, 2 * k - pr);     }     ans += aa2;     if (vu[v]) aa++;     return aa;   }   int main() {     for (int i = 0; i < 200005; i++) vu[i] = 0;     cin >> n >> k;     int u, v;     for (int i = 0; i < k; i++) {       cin >> u >> v;       vu[u] = vu[v] = 1;     }     for (int i = 1; i < n; i++) {       cin >> u >> v;       vx[u].push_back(v);       vx[v].push_back(u);     }     dfs(1, -1);     cout << ans;     return 0;   }   