func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 100002;   int n, m, ok[N], a, b, c, l[N], nr[N];   vector<pair<int, int>> G[N];   int p[20][N];   void parentDFS(int x, int par) {     p[0][x] = par;     l[x] = l[par] + 1;     for (auto it : G[x])       if (it.first != par) parentDFS(it.first, x);   }   int lca(int x, int y) {     if (l[x] < l[y]) swap(x, y);     for (int i = 0; i < 18; i++)       if (((l[x] - l[y]) & (1 << i))) x = p[i][x];     if (x == y) return x;     for (int i = 17; i >= 0; i--)       if (p[i][x] != p[i][y]) {         x = p[i][x];         y = p[i][y];       }     return p[0][x];   }   pair<int, int> dist[N], ans[N];   pair<int, int> maxx(pair<int, int> a, pair<int, int> b, int nod) {     if (a.first < 0) return b;     if (b.first < 0) return a;     if (a.first == b.first)       return {a.first, nod};     else       return max(a, b);   }   void dfs1(int x, int p) {     if (ok[x]) {       dist[x] = {0, x};     } else       dist[x] = {-1e9, -1};     for (auto it : G[x]) {       int u = it.first, c = it.second;       if (u == p) continue;       dfs1(u, x);       dist[x] = maxx(dist[x], {dist[u].first + c, dist[u].second}, x);     }   }   void dfs2(int x, int par, pair<int, int> sus) {     ans[x] = maxx(sus, dist[x], x);     if (ok[x]) {       int t = ans[x].second;       int L = lca(x, t);       nr[x]++;       nr[t]++;       nr[L]--;       if (p[0][L] != 0) nr[p[0][L]]--;     }     pair<int, int> aux;     if (ok[x])       aux = {0, x};     else       aux = {-1e9, -1};     vector<pair<int, int>> child;     vector<pair<int, int>> pr;     int j = 0;     for (auto it : G[x])       if (it.first != par) child.push_back(it);     for (auto it : child) {       int u = it.first, c = it.second;       pr.push_back(aux);       aux = maxx(aux, {dist[u].first + c, dist[u].second}, x);     }     for (int i = child.size() - 1; i >= 0; i--) {       int u = child[i].first;       int c = child[i].second;       pair<int, int> aux1 = maxx(sus, pr[i], x);       aux1.first += c;       dfs2(u, x, aux1);       sus = maxx(sus, {dist[u].first + c, dist[u].second}, x);     }   }   void mars(int x, int p) {     for (auto it : G[x]) {       int u = it.first;       if (u == p) continue;       mars(u, x);     }     nr[p] += nr[x];   }   int main() {     cin >> n >> m;     for (int i = 1; i <= m; i++) {       cin >> a;       ok[a] = 1;     }     for (int i = 1; i < n; i++) {       cin >> a >> b >> c;       G[a].push_back({b, c});       G[b].push_back({a, c});     }     parentDFS(1, 0);     for (int i = 1; i < 18; i++)       for (int j = 1; j <= n; j++) p[i][j] = p[i - 1][p[i - 1][j]];     dfs1(1, 0);     dfs2(1, 0, {-1e9, -1});     mars(1, 0);     int r = 0, sol = 0;     for (int i = 1; i <= n; i++) {       if (!ok[i]) {         if (sol < nr[i]) {           sol = nr[i];           r = 1;         } else if (sol == nr[i])           r++;       }     }     cout << sol <<     << r;     return 0;   }   