Language: C++

#include <cstdio>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
using int64 = long long int;
constexpr int64 MOD = 1000000007;

int N;
vector<int> G[210];

int64 dpc[210][210][2], dpn[210][210][2];
vector<int64> merge(vector<int64> A, vector<int64> B) {
  fill(dpc[0][0], dpc[B.size()][0], 0);
  dpc[0][0][0] = 1;

  vector<int64> res(A.size() + B.size() - 1);
  for(size_t i=0; i<=A.size(); i++) {
    for(size_t j=0; j<B.size(); j++) {
      for(size_t k=0; k<=j; k++) {
        fprintf(stderr, "dp[%d][%d][%d] = %lld, %lld\n", i, j, k, dpc[j][k][0], dpc[j][k][1]);
        
        // orig: i, new: j, double: k
        // total: i + j - k
        if(i > 0) {
          fprintf(stderr, "merge 1: (%zu, %zu, %zu), val = %lld * %lld * %lld\n", i-1, j, k, A[i-1], B[j], dpc[j][k][0]);
          (res[i - 1 + j - k] += A[i - 1] * B[j] % MOD * dpc[j][k][0] % MOD) %= MOD;
          if(i < A.size()) {
            fprintf(stderr, "merge 2: (%zu, %zu, %zu), val = %lld * %lld * %lld\n", i, j, k, A[i], B[j], dpc[j][k][1]);
            (res[i + j - k] += A[i] * B[j] % MOD * dpc[j][k][1] % MOD) %= MOD;
          }
        }

        if(i == A.size()) {
          dpc[j][k][true] = dpc[j][k][false] = 0;
          continue;
        }
        
        {
          // f = false
          int64 &val = dpc[j][k][false];
          (dpc[j+1][k][false] += val) %= MOD;
          (dpn[j][k][false] += val) %= MOD;

          if(i+1 < A.size())
            (dpc[j+1][k+1][true] += val) %= MOD;
        }

        if(i+1 < A.size()) {
          // f = true
          int64 &val = dpc[j][k][true];
          (dpc[j+1][k+1][true] += val) %= MOD;
          (dpn[j][k][false] += val) %= MOD;
        }
        dpc[j][k][true] = dpc[j][k][false] = 0;
      }
    }
    swap(dpc, dpn);
  }
  return res;
}

void dump_vec(vector<int64> vec) {
  for(size_t i=0; i<vec.size(); i++) {
    fprintf(stderr, "%lld%c", vec[i], i+1==vec.size()?'\n':' ');
  }
}

vector<int64> solve(int cur) {
  fprintf(stderr, "solve: %d\n", cur);
  vector<int64> res(1, 1);
  for(auto to : G[cur]) {
    auto vec = solve(to);
    res = merge(res, vec);
  }
  res.insert(res.begin(), 0LL);

  fprintf(stderr, "dump: %d\n", cur);
  dump_vec(res);
  return res;
}

int main() {
  cin >> N;
  for(int i=0; i<N-1; i++) {
    int a, b; cin >> a >> b;
    G[a].push_back(b);
  }

  auto res = solve(0);
  int64 ans = 0;
  for(auto e : res) (ans += e) %= MOD;
  cout << ans << endl;
  return 0;
}

solve: 6
dump: 6
0 1
dp[0][0][0] = 1, 0
dp[0][1][0] = 1, 0
dp[0][1][1] = 0, 1
dp[1][0][0] = 1, 0
merge 1: (0, 0, 0), val = 0 * 0 * 1
merge 2: (1, 0, 0), val = 0 * 0 * 0
dp[1][1][0] = 2, 0
merge 1: (0, 1, 0), val = 0 * 1 * 2
merge 2: (1, 1, 0), val = 0 * 1 * 0
dp[1][1][1] = 1, 1
merge 1: (0, 1, 1), val = 0 * 1 * 1
merge 2: (1, 1, 1), val = 0 * 1 * 1
dp[2][0][0] = 1, 0
merge 1: (1, 0, 0), val = 0 * 0 * 1
merge 2: (2, 0, 0), val = 0 * 0 * 0
dp[2][1][0] = 3, 0
merge 1: (1, 1, 0), val = 0 * 1 * 3
merge 2: (2, 1, 0), val = 0 * 1 * 0
dp[2][1][1] = 2, 1
merge 1: (1, 1, 1), val = 0 * 1 * 2
merge 2: (2, 1, 1), val = 0 * 1 * 1
dp[3][0][0] = 1, 0
merge 1: (2, 0, 0), val = 0 * 0 * 1
merge 2: (3, 0, 0), val = 0 * 0 * 0
dp[3][1][0] = 4, 0
merge 1: (2, 1, 0), val = 0 * 1 * 4
merge 2: (3, 1, 0), val = 0 * 1 * 0
dp[3][1][1] = 3, 1
merge 1: (2, 1, 1), val = 0 * 1 * 3
merge 2: (3, 1, 1), val = 0 * 1 * 1
dp[4][0][0] = 1, 0
merge 1: (3, 0, 0), val = 0 * 0 * 1
merge 2: (4, 0, 0), val = 4 * 0 * 0
dp[4][1][0] = 5, 0
merge 1: (3, 1, 0), val = 0 * 1 * 5
merge 2: (4, 1, 0), val = 4 * 1 * 0
dp[4][1][1] = 4, 1
merge 1: (3, 1, 1), val = 0 * 1 * 4
merge 2: (4, 1, 1), val = 4 * 1 * 1
dp[5][0][0] = 1, 0
merge 1: (4, 0, 0), val = 4 * 0 * 1
merge 2: (5, 0, 0), val = 5 * 0 * 0
dp[5][1][0] = 6, 0
merge 1: (4, 1, 0), val = 4 * 1 * 6
merge 2: (5, 1, 0), val = 5 * 1 * 0
dp[5][1][1] = 5, 0
merge 1: (4, 1, 1), val = 4 * 1 * 5
merge 2: (5, 1, 1), val = 5 * 1 * 0
dp[6][0][0] = 1, 0
merge 1: (5, 0, 0), val = 5 * 0 * 1
dp[6][1][0] = 6, 0
merge 1: (5, 1, 0), val = 5 * 1 * 6
dp[6][1][1] = 5, 0
merge 1: (5, 1, 1), val = 5 * 1 * 5
dump: 0
0 0 0 0 0 24 49 30
103



Compiler output:
a.cc:97:1: error: 'solve' does not name a type
   97 | solve: 6
      | ^~~~~