Language: C++

#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (ll)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// MODのべき乗
ll powMod(ll n, ll p)
{
	ll res = 1;
	while (p) {
		if (p & 1) (res *= n) %= MOD;
		(n *= n) %= MOD;
		p >>= 1;
	}
	return res;
}

// MODの逆元
ll invMod(ll n)
{
	return powMod(n, MOD - 2);
}

/* コンビネーション */
ll CombinationMod(ll n, ll r)
{
	if (n <= 0) {
		return 1;
	}

	ll sum = 1;
	ll maxR = min(n - r, r);
	for (ll j = 0; j < maxR; j++) {
		sum *= (n - j);
		sum %= MOD;
		sum *= invMod(maxR - j);
		sum %= MOD;
	}

	return sum;
}

// テーブルを作る前処理
const int MAX = 2 * 1000 * 1000;
long long fac[MAX], finv[MAX], inv[MAX];
void CombInit()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++){
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算(nCk)
long long CombExec(int n, int k)
{
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

template <class E>
using Graph = vector<vector<E>>;

// dfs(DP木)
Graph<ll>	G;
vector<ll>	dp;
vector<ll>	num;
ll dfs_treeDp(int from, int to)
{
	ll numOne = 0;
	ll cmbCnt = 1;
	for (auto nextTo : G[to]) {
		if (nextTo != from) {
			ll numNext = dfs_treeDp(to, nextTo);
			numOne += numNext;
			numOne %= MOD;
			cmbCnt *= dp[nextTo] * CombExec(numOne, numNext);
			cmbCnt %= MOD;
		}
	}
	numOne++;
	num[to] = numOne;
	dp[to] = cmbCnt;
	return numOne;
}

/*

//上から下へ
static void CalcDp_Bfs(
const int parent_id,
const int node_id
)
{

for ( auto v : v_1ring[node_id] )
{
if ( v == parent_id) continue;

DP tmp = vtx_dp[node_id];
//辺 node_id - v が無かった状態に戻す
tmp.t  -= vtx_dp[v].t ;
tmp.dp /= comb( tmp.t + vtx_dp[v].t - 1, tmp.t - 1);
tmp.dp /= vtx_dp[v].dp;

//dfsと同様に追加する
vtx_dp[v].dp *= tmp.dp;
vtx_dp[v].dp *= comb( tmp.t + vtx_dp[v].t-1, tmp.t);
vtx_dp[v].t  += tmp.t;

CalcDp_Bfs(node_id, v);
}

}
*/
// dfs(全方位DP)
void dfs_Rerooting(int from, int to)
{
	ll numOne = num[to];
	for (auto nextTo : G[to]) {
		if (nextTo != from) {
			ll n = num[to] - 1;
			ll r = num[to] - num[nextTo];
			ll dpOthre = dp[to];

			dpOthre /= CombExec(n, r - 1);
			dpOthre /= dp[nextTo];
			dp[nextTo] *= dpOthre;
			dp[nextTo] *= CombExec(n, r);
			dp[nextTo] /= MOD;
			num[nextTo] += r;
			dfs_Rerooting(to, nextTo);
		}
	}
}

// メイン
int main()
{
	ll N;
	cin >> N;
	G.resize(N);
	dp.resize(N, 0);
	num.resize(N, 0);
	CombInit();
	REP(i, N - 1) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		G[a].emplace_back(b);
		G[b].emplace_back(a);
	}

	dfs_treeDp(-1, 0);
	dfs_Rerooting(-1, 0);

	for (auto ansOne : dp) {
		cout << ansOne << endl;
	}

	return 0;
}##

Compiler output:
a.cc:196:2: error: stray '##' in program
  196 | }##
      |  ^~