Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=5010;
const int mod=1e9+7;
int dp[maxn][maxn][2],f[maxn][2],pair_way[maxn],size[maxn];
vector<int> g[maxn];
void dfs(int u,int fa){
	size[u]=1;
	dp[u][1][0]=1;
	for(int i=0;i<(int)g[u].size();i++){
		int v=g[u][i];
		if(v==fa) continue;
		dfs(v,u);
	}
	for(int i=0;i<(int)g[u].size();i++){
		int v=g[u][i];
		if(v==fa) continue;
		for(int i=1;i<=size[u]+size[v];i++)
			f[i][0]=f[i][1]=0;
		for(int i=1;i<=size[u];i++){
			for(int j=1;j<=size[v];j++){
				for(int s=0;s<2;s++){
					for(int ss=0;ss<2;ss++){
						f[i+j][(s+ss)&1]=(f[i+j][(s+ss)&1]+(ll)dp[u][i][s]*dp[v][j][ss]%mod)%mod;
						f[i][(s+ss+1)&1]=(f[i][(s+ss+1)&1]+(ll)dp[u][i][s]*dp[v][j][ss]%mod*pair_way[j]%mod)%mod;
					}
				}
			}
		}
		size[u]+=size[v];
		for(int i=1;i<=size[u];i++)
			dp[u][i][0]=f[i][0],dp[u][i][1]=f[i][1];
	}
}
int main(){
	int n,u,v;
	scanf("%lld",&n);
	for(int i=1;i<n;i++){
		scanf("%lld%lld",&u,&v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	pair_way[0]=pair_way[2]=1;
	for(int i=4;i<=n;i+=2)
		pair_way[i]=(pair_way[i-2]+(ll)pair_way[i-4]*(i-2)%mod*(i-3)%mod)%mod;
	dfs(1,-1);
	int ans=0;
	for(int i=1;i<=n;i++){
		ans=(ans+dp[1][i][0]*pair_way[i]%mod)%mod;
		ans=(ans+mod-dp[1][i][1]*pair_way[i]%mod)%mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(long long int, long long int)':
a.cc:11:9: error: reference to 'size' is ambiguous
   11 |         size[u]=1;
      |         ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:49: note:                 'long long int size [5010]'
    8 | int dp[maxn][maxn][2],f[maxn][2],pair_way[maxn],size[maxn];
      |                                                 ^~~~
a.cc:21:32: error: reference to 'size' is ambiguous
   21 |                 for(int i=1;i<=size[u]+size[v];i++)
      |                                ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:49: note:                 'long long int size [5010]'
    8 | int dp[maxn][maxn][2],f[maxn][2],pair_way[maxn],size[maxn];
      |                                                 ^~~~
a.cc:21:40: error: reference to 'size' is ambiguous
   21 |                 for(int i=1;i<=size[u]+size[v];i++)
      |                                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:49: note:                 'long long int size [5010]'
    8 | int dp[maxn][maxn][2],f[maxn][2],pair_way[maxn],size[maxn];
      |                                                 ^~~~
a.cc:23:32: error: reference to 'size' is ambiguous
   23 |                 for(int i=1;i<=size[u];i++){
      |                                ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:49: note:                 'long long int size [5010]'
    8 | int dp[maxn][maxn][2],f[maxn][2],pair_way[maxn],size[maxn];
      |                                                 ^~~~
a.cc:24:40: error: reference to 'size' is ambiguous
   24 |                         for(int j=1;j<=size[v];j++){
      |                                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:49: note:                 'long long int size [5010]'
    8 | int dp[maxn][maxn][2],f[maxn][2],pair_way[maxn],size[maxn];
      |                                                 ^~~~
a.cc:33:17: error: reference to 'size' is ambiguous
   33 |                 size[u]+=size[v];
      |                 ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:49: note:                 'long long int size [5010]'
    8 | int dp[maxn][maxn][2],f[maxn][2],pair_way[maxn],size[maxn];
      |                                                 ^~~~
a.cc:33:26: error: reference to 'size' is ambiguous
   33 |                 size[u]+=size[v];
      |                          ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:49: note:                 'long long int size [5010]'
    8 | int dp[maxn][maxn][2],f[maxn][2],pair_way[maxn],size[maxn];
      |                                                 ^~~~
a.cc:34:32: error: reference to 'size' is ambiguous
   34 |                 for(int i=1;i<=size[u];i++)
      |                                ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:49: note:                 'long long int size [5010]'
    8 | int dp[maxn][maxn][2],f[maxn][2],pair_way[maxn],size[maxn];
      |                                                 ^~~~
At global scope:
cc1plus: error: '::main' must return 'int'