func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   vector<vector<int>> adj;   vector<bool> vis;   vector<int> dep;   vector<int> sz;   vector<int> dif;   void dfsd(int v, int c) {     vis[v] = true;     c++;     for (auto it = adj[v].begin(); it != adj[v].end(); ++it) {       if (vis[*it] != true) {         dfsd(*it, c);       }     }     dep[v] = c;   }   void dfss(int v) {     vis[v] = false;     for (auto it = adj[v].begin(); it != adj[v].end(); ++it) {       if (vis[*it] != false) {         dfss(*it);       }     }     for (auto it = adj[v].begin(); it != adj[v].end(); ++it) {       sz[v] += sz[*it];     }     sz[v]++;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n, i, k, p, q, j;     long long cnt = 0;     cin >> n >> k;     adj.resize(n);     vis.resize(n);     dep.resize(n);     sz.resize(n, 0);     dif.resize(n);     for (i = 0; i < n - 1; i++) {       cin >> p >> q;       adj[p - 1].push_back(q - 1);       adj[q - 1].push_back(p - 1);     }     dfsd(0, 0);     dfss(0);     for (i = 0; i < n; i++) {       dif[i] = sz[i] - dep[i];     }     sort(dif.begin(), dif.end(), greater<int>());     for (i = 0; i < n - k; i++) {       cnt += dif[i];     }     cout << cnt;   }   