func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, dad[200000 + 1], u[200000 + 1], v[200000 + 1];   long long w[200000], pop[200000], initsum, S;   std::vector<int> adjl[200000 + 1];   int cnode(int node, int ed) { return node ^ u[ed] ^ v[ed]; }   void dfs(int u) {     int isleaf = 1;     if (u != 1) pop[dad[u]] = 0;     for (int ed : adjl[u])       if (ed != dad[u]) {         isleaf = 0;         int v = cnode(u, ed);         dad[v] = ed;         dfs(v);         initsum += w[ed] * pop[ed];         if (u != 1) pop[dad[u]] += pop[ed];       }     if (isleaf) pop[dad[u]] = 1;   }   struct good_cmp {     bool operator()(int l, int r) {       return pop[l] * ((w[l] + 1) / 2) < pop[r] * ((w[r] + 1) / 2);     }   };   void run() {     cin >> n >> S;     for (int i = 1; i <= n; ++i) adjl[i].clear();     for (int i = 1; i < n; ++i) {       cin >> u[i] >> v[i] >> w[i];       adjl[u[i]].emplace_back(i);       adjl[v[i]].emplace_back(i);     }     initsum = 0;     memset(dad + 1, 0, n * sizeof(int));     dad[1] = -1;     dfs(1);     std::priority_queue<int, std::vector<int>, good_cmp> pq;     for (int i = 1; i < n; ++i) pq.push(i);     long long ans = 0;     while (initsum > S) {       ++ans;       int top = pq.top();       pq.pop();       initsum -= pop[top] * ((w[top] + 1) / 2);       w[top] /= 2;       pq.push(top);     }     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(nullptr);     int t;     cin >> t;     while (t--) run();     return 0;   }   