func_code_string: #include <bits/stdc++.h>   using namespace std;   const int64_t N = 1e5 + 1;   int64_t crt_node = 0, maxi = 0;   vector<int64_t> previous;   vector<vector<int64_t>> adj;   void dfs(int64_t node, int64_t pere, int64_t len) {     previous[node] = pere;     if (len > maxi) {       crt_node = node;       maxi = len;     }     for (int64_t i : adj[node]) {       if (i != pere) dfs(i, node, len + 1);     }   }   bool ok = true;   vector<int64_t> level, path;   void hedgehog(int64_t node, int64_t pere) {     int64_t k = 0;     for (int64_t i : adj[node]) {       if (i != pere) {         hedgehog(i, node);         if (k == 0)           k = level[i];         else if (k != level[i])           ok = false;       }     }     if (adj[node].size() == 1)       level[node] = 1;     else if (adj[node].size() < 3 or              (adj[node].size() == 3 and path[path.size() / 2] != node))       ok = false;     else       level[node] = k + 1;   }   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int64_t n, k;     cin >> n >> k;     if (n == 1) {       cout <<  No ;       return 0;     }     adj.resize(n + 1);     for (int64_t i = 1; i < n; ++i) {       int64_t u, v;       cin >> u >> v;       adj[u].emplace_back(v);       adj[v].emplace_back(u);     }     previous.resize(n + 1);     dfs(1, 0, 0);     int64_t a = crt_node;     maxi = 0;     fill(previous.begin(), previous.end(), 0ll);     dfs(crt_node, 0, 0);     int64_t b = crt_node;     while (b) {       path.emplace_back(b);       b = previous[b];     }     level.resize(n + 1);     hedgehog(path[path.size() / 2], 0);     if (level[path[path.size() / 2]] != k + 1) ok = false;     cout << (ok ?  Yes  :  No );     return 0;   }   