func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MM = 120000;   vector<int> G[MM], T[MM];   int P[MM], L[MM];   void dfs(int u, int par) {     P[u] = par;     if (par != -1) L[u] = L[par] + 1;     for (auto v : G[u]) {       if (v != par) {         dfs(v, u);       }     }   }   int N, K;   bool rip = 0;   void dfs2(int u, int par, int lev) {     int kek = 0;     for (auto v : G[u]) {       if (v != par) {         kek++;         dfs2(v, u, lev + 1);       }     }     if (kek < 3 && kek != 0) {       rip = 1;     }     if (kek == 0 && lev != K) {       rip = 1;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> N >> K;     for (int i = 0; i < N - 1; i++) {       int u, v;       cin >> u >> v;       G[u - 1].push_back(v - 1);       G[v - 1].push_back(u - 1);     }     dfs(0, -1);     int mx = 0;     int el = -1;     for (int i = 0; i < N; i++) {       mx = max(mx, L[i]);       if (mx == L[i]) {         el = i;       }     }     if (mx >= K) {       mx = K;       while (mx--) el = P[el];       int rt = el;       dfs2(rt, -1, 0);       if (rip) {         cout <<  No ;       } else {         cout <<  Yes ;       }     } else {       cout <<  No ;       return 0;     }     return 0;   }   