func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxN = (int)5e3 + 3;   vector<int> g[maxN], p[maxN];   int u, v, cur_h[maxN], cnt, n;   bool used[maxN], dp[maxN], ans[maxN];   void dfs(int v, int* cur_h) {     used[v] = true;     cur_h[v] = 1;     for (int i = 0; i < (int)g[v].size(); ++i) {       int to = g[v][i];       if (!used[to]) {         p[v].push_back(to);         dfs(to, cur_h);         cur_h[v] += cur_h[to];       }     }   }   void init_arrays() {     memset(dp, 0, sizeof(bool) * maxN);     memset(used, 0, sizeof(bool) * maxN);     memset(cur_h, 0, sizeof(int) * maxN);   }   int main() {     ios_base::sync_with_stdio(0);     cin >> n;     for (int i = 0; i < n - 1; ++i) {       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);     }     init_arrays();     dfs(1, cur_h);     dp[0] = 1;     for (int i = 1; i <= n; ++i) {       for (int k = 1; k <= n; ++k) dp[k] = 0;       for (int j = 0; j < (int)p[i].size(); ++j)         for (int k = n; k >= 0; --k) dp[k + cur_h[p[i][j]]] |= dp[k];       for (int k = n; k >= 0; --k) dp[k + n - cur_h[i]] |= dp[k];       for (int k = n; k >= 0; --k) ans[k] |= dp[k];     }     --n;     for (int i = 1; i < n; ++i)       if (ans[i] == true) ++cnt;     cout << cnt << endl;     for (int i = 1; i < n; ++i)       if (ans[i] == true) cout << i <<     << n - i << endl;     return 0;   }   