criyle/codenet-compile-errors huggingface dataset:
Language: Java



import java.util.*;

public class Main {
    public static void main(String[] args) {
        F f = new F();
    }
    Scanner sc = new Scanner(System.in);
    int mod = 1000000007;
    int n;
    int[] size;
    long[] factorial ;
    long[] invFactorial;
    long[] combos;
    ArrayList<Integer> [] adj;
    public F() {
        n = sc.nextInt();
        adj = new ArrayList[n+1];
        size = new int[n+1];
        combos = new long[n+1];

        factorial= new long[n+1];
        invFactorial = new long[n+1];
        factorial[0] = 1;
        for (int i = 1; i<n;i++){
            factorial[i] = (factorial[i-1] * i) % mod;
//            System.out.println(factorial[i]);
        }

        invFactorial[0] = 1;
        for (int i = 1; i < n + 1; i++) {
            invFactorial[i] = (invFactorial[i-1] * power(i, mod - 2))  % mod;
//            System.out.println(invFactorial[i]);
        }

        for (int i = 0; i < n+1; i++) {
            adj[i] = new ArrayList<Integer>();
        }
        for (int i=0;i<n-1;i++) {
            int from = sc.nextInt();
            int to = sc.nextInt();
            adj[to].add(from);
            adj[from].add(to);
        }

        for (int i = 1 ;i<n+1;i++) {
            init(i, -1);
            System.out.println(combos[i]);
            size = new int[n+1];
            combos = new long[n+1];
        }
    }

    void init(int node, int parent) {
        for (int child: adj[node]) {
            if (child == parent) {
                continue;
            }
            init(child, node);
            size[node] += size[child];
        }
        long res = factorial[size[node]];
        for (int child: adj[node]) {
            if (child == parent) {
                continue;
            }
            res = (res * combos[child]) % mod;
            res = (res * invFactorial[size[child]]) % mod;
        }
        combos[node] = res;
        size[node]++;
    }



    long power(long base, long exp) {
        long res = 1;
        while (exp > 0) {
            if (exp % 2 == 1) {
                res = res * base % mod;
            }
            base = base * base % mod;
            exp = exp/2;
        }
        return res;
    }
}


Compiler output:
Main.java:17: error: invalid method declaration; return type required
    public F() {
           ^
1 error
Language: C++

#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f3f3f3f3f
#define pi 3.1415926535898

#define N 200010
using namespace std;
vector <int >g[N];
const ll mod=1e9+7
int n,x,y;
ll power(ll a,ll b)
{
    return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;
}
ll p[N],f[N],c[N];
void dfs(int u)
{
    c[u]=1;
    f[u]=1;
    for(auto: g[u])
    {
        if(s[v])
        {
            dfs(v);
            s[u]+=s[v];
            p[v]=u;
            f[u]=f[u]*f[v]%mod;
        }
    }
    f[u]=f[u]*s[u]%mod;
}
void calculate(int u)
{
    for(auto v:g[u])
    {
        if(v!=p[u])
        {
            f[v]=f[u]*(n-s[v])%mod*power(s[v],mod-2)%mod;
            calculate(v);
        }
    }
}
int main()
{
    cin>>n;
    for(int i=0; i<n-1; i++)
    {
        cin>x>>y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    ll S=1;
    for(int i=1; i<=n; i++)
        S=S*i%mod;
    dfs(1);
    calculate(1);
    for(int i=1; i<=n; i++)
        cout<<S*power(f[i],mod-2)%mod<<endl;
    return 0;
}


Compiler output:
a.cc:23:1: error: expected ',' or ';' before 'int'
   23 | int n,x,y;
      | ^~~
a.cc: In function 'void dfs(int)':
a.cc:33:13: error: expected unqualified-id before ':' token
   33 |     for(auto: g[u])
      |             ^
a.cc:35:12: error: 's' was not declared in this scope
   35 |         if(s[v])
      |            ^
a.cc:35:14: error: 'v' was not declared in this scope
   35 |         if(s[v])
      |              ^
a.cc:43:15: error: 's' was not declared in this scope
   43 |     f[u]=f[u]*s[u]%mod;
      |               ^
a.cc: In function 'void calculate(int)':
a.cc:51:24: error: 'n' was not declared in this scope
   51 |             f[v]=f[u]*(n-s[v])%mod*power(s[v],mod-2)%mod;
      |                        ^
a.cc:51:26: error: 's' was not declared in this scope
   51 |             f[v]=f[u]*(n-s[v])%mod*power(s[v],mod-2)%mod;
      |                          ^
a.cc: In function 'int main()':
a.cc:58:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   58 |     cin>>n;
      |          ^
      |          yn
a.cc:61:13: error: 'x' was not declared in this scope
   61 |         cin>x>>y;
      |             ^
a.cc:61:16: error: 'y' was not declared in this scope
   61 |         cin>x>>y;
      |                ^
Language: C++

jkjkjknmnmnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn

Compiler output:
a.cc:1:1: error: 'jkjkjknmnmnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn' does not name a type
    1 | jkjkjknmnmnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include <algorithm>
#include<queue>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<map>
#include<set>
using LL = long long;
using namespace std;
 
const int M = 2e5 + 100;
const int mod = 1e9 + 7;
 
vector<int> e[M];
int n, sz[M], ans[M];
int fac[M], inv[M], inv2[M];
 
LL mul(LL a, LL b) {
	return a * b % mod;
}
 
void init() 
{
	fac[0] = 1;
	for (int i = 1; i <= n; i++) 
		fac[i] = mul(fac[i - 1], i);
	inv[1] = 1;
	for (int i = 2; i <= n; i++) 
		//常规公式为inv[i] = mul((- mod / i), inv[mod % i])，为使得逆元为正数，分子加上mod仍有i*inv[i] = 1(mod p)
		inv[i] = mul((mod - mod / i), inv[mod % i]);
 
}
 
void dfs(int u, int fa) 
{
	sz[u] = 1;
	for (int v : e[u]) 
	{
		if (v != fa) 
		{
			dfs(v, u);
			sz[u] += sz[v];
		}
	}
}
 
void reroot(int cur, int p)
{
	ans[cur] = 1LL * ans[p] * sz[cur] * inv[(n - sz[cur])] % mod;
	for (int i : g[cur])
	{
		if (i == p)
			continue;
		reroot(i,cur);
	}
}
int main() {
	cin >> n;
 	init();
	for (int i = 0; i < n - 1; i++) 
	{
		int u, v; 
		cin >> u >> v;
		e[u].push_back(v);
		e[v].push_back(u);
	}
	dfs(1, 0);
	ans[1] = fac[n];
	for (int i = 1; i <= n; i++) 
		ans[1] = mul(ans[1], inv[sz[i]]);
	for (int v : e[1]) 
		reroot(v, 1);
	for (int i = 1; i <= n; i++) 
		cout << ans[i] << "\n";
}

Compiler output:
a.cc: In function 'void reroot(int, int)':
a.cc:52:22: error: 'g' was not declared in this scope
   52 |         for (int i : g[cur])
      |                      ^
Language: C++


#include<iostream>
#include <algorithm>
#include<queue>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<map>
#include<set>
using LL = long long;
using namespace std;

const int M = 2e5 + 100;
const int mod = 1e9 + 7;

vector<int> e[M];
int n, sz[M], ans[M];
int fac[M], inv[M], inv2[M];

LL mul(LL a, LL b) {
	return a * b % mod;
}

void init() 
{
	fac[0] = 1;
	for (int i = 1; i <= n; i++) 
		fac[i] = mul(fac[i - 1], i);
	inv[1] = 1;
	for (int i = 2; i <= n; i++) 
		//常规公式为inv[i] = mul((- mod / i), inv[mod % i])，为使得逆元为正数，分子加上mod仍有i*inv[i] = 1(mod p)
		inv[i] = mul((mod - mod / i), inv[mod % i]);

}

void dfs(int u, int fa) 
{
	sz[u] = 1;
	for (int v : e[u]) 
	{
		if (v != fa) 
		{
			dfs(v, u);
			sz[u] += sz[v];
		}
	}
}

void reroot(int cur, int p)
{
	ans[cur] = 1LL * ans[p] * sz[cur] * inv[(n - sz[cur])] % mod;
	for (int i : g[cur])
	{
		if (i == p)
			continue;
		dfs2(i,cur);
	}
}
int main() {
	cin >> n;
 	init();
	for (int i = 0; i < n - 1; i++) 
	{
		int u, v; 
		cin >> u >> v;
		e[u].push_back(v);
		e[v].push_back(u);
	}
	dfs(1, 0);
	ans[1] = fac[n];
	for (int i = 1; i <= n; i++) 
		ans[1] = mul(ans[1], inv[sz[i]]);
	for (int v : e[1]) 
		reroot(v, 1);
	for (int i = 1; i <= n; i++) 
		cout << ans[i] << "\n";
}

Compiler output:
a.cc: In function 'void reroot(int, int)':
a.cc:53:22: error: 'g' was not declared in this scope
   53 |         for (int i : g[cur])
      |                      ^
a.cc:57:17: error: 'dfs2' was not declared in this scope; did you mean 'dfs'?
   57 |                 dfs2(i,cur);
      |                 ^~~~
      |                 dfs
Language: C++


#include<iostream>
#include <algorithm>
#include<queue>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<map>
#include<set>
using LL = long long;
using namespace std;

const int M = 2e5 + 100;
const int mod = 1e9 + 7;

vector<int> e[M];
long long n, sz[M], ans[M];
long long fac[M], inv[M];

LL mul(LL a, LL b) {
	return a * b % mod;
}

void init() {
	fac[0] = 1;
	for (int i = 1; i <= n; i++)
		fac[i] = mul(fac[i - 1], i);
	inv[1] = 1;
	for (int i = 2; i <= n; i++)
		inv[i] = mul((mod - mod / i), inv[mod % i]);
}

void dfs(int u, int fa) {
	sz[u] = 1;
	for (int v : e[u]) {
		if (v != fa) {
			dfs(v, u);
			sz[u] += sz[v];
		}
	}
}

void reroot(int u, int fa) {
	ans[u] = mul(mul(ans[fa], sz[u]), inv[n - sz[u]]);
	for (int v : e[u]) {
		if (v != fa) {
			reroot(v, u);
		}
	}
}

int main() {
	cin >> n;
	init();
	for (int i = 0; i < n - 1; i++) {
		int u, v; cin >> u >> v;
		e[u].push_back(v);
		e[v].push_back(u);
	}
	dfs(1, 0);
	ans[1] = fac[n];
	for (int i = 1; i <= n; i++)
		ans[1] =  ans[1] *inv( sz[i]) % mod;
	for (int v : e[1]) reroot(v, 1);
	for (int i = 1; i <= n; i++) cout << ans[i] << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:38: error: 'inv' cannot be used as a function
   64 |                 ans[1] =  ans[1] *inv( sz[i]) % mod;
      |                                   ~~~^~~~~~~~
Language: C++

#include<iostream>
#include <algorithm>
#include<queue>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include <Eigen/Dense>
#include <Eigen/Geometry>
using namespace Eigen;

using namespace std;


#define xx first
#define yy second
using namespace std;

using LL = long long;
using namespace std;

const int M = 2e5 + 100;
const int mod = 1e9 + 7;

vector<int> e[M];
int n, sz[M], ans[M];
int fac[M], inv[M];

void init() {
	fac[0] = 1;
	for (int i = 1; i <= n; i++)
		fac[i] = fac[i - 1] * i;
	//inv[1] = 1;
	//for (int i = 2; i <= n; i++) 
	//	inv[i] = mul((mod - mod / i), inv[mod % i]);
}

void dfs(int u, int fa)
{
	sz[u] = 1;
	for (int v : e[u])
	{
		if (v != fa) 
		{
			dfs(v, u);
			sz[u] += sz[v];
		}
	}
}

void reroot(int u, int fa) 
{
	ans[u] = ans[fa] * sz[u] / (n - sz[u]) % mod;//ans[fa]*sz[u]/(n - sz[u])
	for (int v : e[u]) 
	{
		if (v != fa) 
		{
			reroot(v, u);
		}
	}
}

int main() {
	cin >> n;
	init();
	for (int i = 0; i < n - 1; i++) 
	{
		int u, v; cin >> u >> v;
		e[u].push_back(v);
		e[v].push_back(u);
	}
	dfs(1, 0);

	ans[1] = fac[n];
	for (int i = 1; i <= n; i++) 
		ans[1] = ans[1]/sz[i] % mod;//(a / b) % mod = (a * inv(b)) % mod

	for (int v : e[1]) 
		reroot(v, 1);

	for (int i = 1; i <= n; i++) 
		cout << ans[i] << "\n";
}


Compiler output:
a.cc:10:10: fatal error: Eigen/Dense: No such file or directory
   10 | #include <Eigen/Dense>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
#define mkp make_pair
#define pii pair<int,int>
typedef long long ll;
const int inf=0x3f3f3f3f;
const int maxn=2e5+5;
const int mod=1e9+7;
int fac[maxn],inv[maxn],dp[maxn],sz[maxn];
int n;
vector<int>v[maxn];
ll mul(ll a,ll b){
	return (a*b)%mod;
}
void init(int n){
	fac[1]=1;
	fac[0]=1;
	for(int i=2;i<=n;i++){
		fac[i]=mul(fac[i-1],i);
	}
	inv[1] = 1;
	for(int i = 2; i <=n; ++ i)
    inv[i] = mul((mod - mod / i) , inv[mod % i] );
}
void dfs(int x,int fa){
	sz[x]=1;
	for(auto y:v[x]){
		if(y==fa)continue;
		dfs(y,x);
		sz[x]+=sz[y];
	}
}
void reroot(int x,int fa){
	dp[x]=mul(mul(dp[fa],sz[x]),inv[(n-sz[x])]);
	for(auto p:v[x]){
		if(p==fa)continue;
		reroot(p,x);
	}
}
int main(){
	
	scanf("%d",&n);
	init(n);
	for(int i=1;i<n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].pb(y);
		v[y].pb(x);
	}
	dfs(1,-1);
	dp[1]=fac[n];
	for(int i=1;i<=n;i++){
		dp[1]=mul(dp[1],inv[sz[i]]);
	}
	reroot(p,1);
	for(int i=1;i<=n;i++)printf("%d\n",dp[i]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:16: error: 'p' was not declared in this scope
   58 |         reroot(p,1);
      |                ^
Language: C++

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;

const int MAXN = 2e5 + 5;
const int MOD = 1000000007;

vi adj[MAXN];
int n, fac[MAXN], sz[MAXN], f[MAXN], ans[MAXN];

int mod_pow(int a, int b) {
  int res = 1;
  for (; b; b >>= 1, a = 1LL * a * a % MOD)
    if (b & 1) res = 1LL * res * a % MOD;
  return res;
}

void dfs1(int u, int from) {
  f[u] = 1;
  sz[u] = 0;
  for (int v : adj[u]) {
    if (v == from) continue;
    dfs1(v, u);
    f[u] = 1LL * f[u] * f[v] % MOD * mod_pow(fac[sz[v]], MOD - 2) % MOD;
    sz[u] += sz[v];
  }
  f[u] = 1LL * f[u] * fac[sz[u]++] % MOD;
  // cerr << "DEBUG: " << u << " " << f[u] << "\n";
}

void dfs2(int u, int from) {
  ans[u] = 1LL * f[u] * mod_pow(fac[sz[u] - 1], MOD - 2) % MOD;
  if (from != -1) {
    ll cur = 1;
    cur = cur * ans[from] * mod_pow(fac[n - 1], MOD - 2) % MOD;
    cur = cur * fac[sz[u]] % MOD * mod_pow(f[u], MOD - 2) % MOD;
    cur = cur * mod_pow(n - sz[u], MOD - 2) % MOD;
    ans[u] = ans[u] * cur % MOD;
  }
  ans[u] = 1LL *. ans[u] * fac[n - 1] % MOD;
  for (int v : adj[u]) {
    if (v == from) continue;
    dfs2(v, u);
  }
}

void solve() {
  cin >> n;
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = 1LL * fac[i - 1] * i % MOD;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs1(0, -1);
  dfs2(0, -1);

  for (int i = 0; i < n; ++i) cout << ans[i] << "\n";
}

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int o_o = 1;
  if (!o_o) cin >> o_o;
  for (; o_o; --o_o) solve();
  return 0;
}


Compiler output:
a.cc: In function 'void dfs2(int, int)':
a.cc:63:17: error: expected primary-expression before '.' token
   63 |   ans[u] = 1LL *. ans[u] * fac[n - 1] % MOD;
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int MOD = 1e9 + 7;

struct Combination{

  vector<int> fact; //　fact[i] = iの階乗
  void init(int n){
    fact.resize(n+1);
    fact[0] = fact[1] = 1;
    for(int i = 2; i <= n; i++){
      fact[i] = i * fact[i-1] % MOD;
    }
  }

  int nCr(int n, int r){ // nCr = n!/r!(n-r)!
    if(n < r) return 0;
    return fact[n] * mod_pow(fact[r]*fact[n-r]%MOD, MOD-2) % MOD;
  }

  int inv(int n){ // a/n ≡ a*n^(p-2) nとpは互いに素
    int r = 1, p = MOD-2;
    for(; p > 0; p >>= 1){
      if(p & 1LL) r = (r * n) % MOD;
      n = (n * n) % MOD;
    }
    return r; // r = n^p % MOD
  }

}c;

signed main(){

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

  c.init(2e6);
  vector<int> num(n, 0), dp(n, 1);
  auto dfs1 = [&](auto&& dfs1, int u, int p)->void{
    for(int v : G[u]){
      if(v == p) continue;
      dfs1(dfs1, v, u);
      num[u] += num[v];
      dp[u] = dp[u] * dp[v]%MOD * c.nCr(num[u], num[v]) % MOD;
    }
    num[u]++;
  };
  dfs1(dfs1, 0, -1);

  vector<int> ans(n);
  auto dfs2 = [&](auto&& dfs2, int u, int p, int res)->void{
    ans[u] = dp[u] * res%MOD * c.nCr(n-1, n-num[u]) % MOD;
    for(int v : G[u]){
      if(v == p) continue;
      res = ans[u] * c.inv(dp[v])%MOD * c.inv(c.nCr(n-1, num[v])) % MOD;
      dfs2(dfs2, v, u, res);
    }
  };
  dfs2(dfs2, 0, -1, 1);

  for(int p : ans){
    cout << p << endl;
  }

  return 0;
}


Compiler output:
a.cc: In member function 'long long int Combination::nCr(long long int, long long int)':
a.cc:22:22: error: 'mod_pow' was not declared in this scope
   22 |     return fact[n] * mod_pow(fact[r]*fact[n-r]%MOD, MOD-2) % MOD;
      |                      ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int MOD = 1e9 + 7;

struct Combination{
  const int MOD = 1e9+7;

  vector<int> fact; //　fact[i] = iの階乗
  void init(int n){
    fact.resize(n+1);
    fact[0] = fact[1] = 1;
    for(int i = 2; i <= n; i++){
      fact[i] = i * fact[i-1] % MOD;
    }
  }

  int nCr(int n, int r){ // nCr = n!/r!(n-r)!
    if(n < r) return 0;
    return fact[n] * mod_pow(fact[r]*fact[n-r]%MOD, MOD-2) % MOD;
  }

  int mod_pow(int n, int p){ // a/n ≡ a*n^(p-2) nとpは互いに素
    int r = 1;
    for(; p > 0; p >>= 1){
      if(p & 1LL) r = (r * n) % MOD;
      n = (n * n) % MOD;
    }
    return r; // r = n^p % MOD
  }

}c;

signed main(){

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

  c.init(2e6);
  vector<int> num(n, 0), dp(n, 1);
  auto dfs1 = [&](auto&& dfs1, int u, int p)->void{
    for(int v : G[u]){
      if(v == p) continue;
      dfs1(dfs1, v, u);
      num[u] += num[v];
      dp[u] = dp[u] * dp[v]%MOD * c.nCr(num[u], num[v]) % MOD;
    }
    num[u]++;
  };
  dfs1(dfs1, 0, -1);

  vector<int> ans(n);
  auto dfs2 = [&](auto&& dfs2, int u, int p, int res)->void{
    ans[u] = dp[u] * res%MOD * c.nCr(n-1, n-num[u]) % MOD;
    for(int v : G[u]){
      if(v == p) continue;
      res = ans[u] * c.inv(dp[v])%MOD * c.inv(c.nCr(n-1, num[v])) % MOD;
      dfs2(dfs2, v, u, res);
    }
  };
  dfs2(dfs2, 0, -1, 1);

  for(int p : ans){
    cout << p << endl;
  }

  return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:66:24: error: 'struct Combination' has no member named 'inv'
   66 |       res = ans[u] * c.inv(dp[v])%MOD * c.inv(c.nCr(n-1, num[v])) % MOD;
      |                        ^~~
a.cc:66:43: error: 'struct Combination' has no member named 'inv'
   66 |       res = ans[u] * c.inv(dp[v])%MOD * c.inv(c.nCr(n-1, num[v])) % MOD;
      |                                           ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxm=2e5+5;
const int mod=1e9+7;
vector<int>g[maxm];
int mul[maxm];
int sz[maxm];
int n;
int ppow(int a,int b,int mod){
	int ans=1%mod;a%=mod;
	whlie(b){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
void dfs1(int x,int fa){
    sz[x]=1;
    for(int v:g[x]){
        if(v==fa)continue;
        dfs1(v,x);
        sz[x]+=sz[v];
        mul[x]=mul[x]*mul[v]%mod;
    }
    mul[x]=mul[x]*sz[x]%mod;
}
void dfs2(int x,int fa){
    for(int v:g[x]){
        if(v==fa)continue;
        //mul[x]是正确的
        int pre=mul[x]*ppow(n,mod-2,mod)%mod*ppow(mul[v],mod-2,mod)%mod*(n-sz[v])%mod;
        mul[v]=mul[v]*ppow(sz[v],mod-2,mod)%mod*pre%mod*n%mod;
        dfs2(v,x);
    }
}
signed main(){
    cin>>n;
    for(int i=1;i<n;i++){
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for(int i=1;i<=n;i++)mul[i]=1;
    dfs1(1,-1);
    dfs2(1,-1);
    int nn=1;
    for(int i=1;i<=n;i++){//计算阶乘
        nn=nn*i%mod;
    }
    for(int i=1;i<=n;i++){
        cout<<nn*ppow(mul[i],mod-2,mod)%mod<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'long long int ppow(long long int, long long int, long long int)':
a.cc:12:9: error: 'whlie' was not declared in this scope
   12 |         whlie(b){
      |         ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxm=2e5+5;
const int mod=1e9+7;
vector<int>g[maxm];
int mul[maxm];
int sz[maxm];
int n;
void dfs1(int x,int fa){
    sz[x]=1;
    for(int v:g[x]){
        if(v==fa)continue;
        dfs1(v,x);
        sz[x]+=sz[v];
        mul[x]=mul[x]*mul[v]%mod;
    }
    mul[x]=mul[x]*sz[x]%mod;
}
void dfs2(int x,int fa){
    for(int v:g[x]){
        if(v==fa)continue;
        //mul[x]是正确的
        int pre=mul[x]*ppow(n,mod-2,mod)%mod*ppow(mul[v],mod-2,mod)%mod*(n-sz[v])%mod;
        mul[v]=mul[v]*ppow(sz[v],mod-2,mod)%mod*pre%mod*n%mod;
        dfs2(v,x);
    }
}
signed main(){
    cin>>n;
    for(int i=1;i<n;i++){
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for(int i=1;i<=n;i++)mul[i]=1;
    dfs1(1,-1);
    dfs2(1,-1);
    int nn=1;
    for(int i=1;i<=n;i++){//计算阶乘
        nn=nn*i%mod;
    }
    for(int i=1;i<=n;i++){
        cout<<nn*ppow(mul[i],mod-2,mod)%mod<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'void dfs2(long long int, long long int)':
a.cc:24:24: error: 'ppow' was not declared in this scope; did you mean 'pow'?
   24 |         int pre=mul[x]*ppow(n,mod-2,mod)%mod*ppow(mul[v],mod-2,mod)%mod*(n-sz[v])%mod;
      |                        ^~~~
      |                        pow
a.cc: In function 'int main()':
a.cc:45:18: error: 'ppow' was not declared in this scope; did you mean 'pow'?
   45 |         cout<<nn*ppow(mul[i],mod-2,mod)%mod<<endl;
      |                  ^~~~
      |                  pow
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, x, y;
  const int mod(1000000007);
  cin >> n;
  vector<vector<int>> trees(n);
  int sub[n];
  long fac[n], invfac[n], f[n], g[n], ans[n];
  
  for (int i = 0; i < n - 1; ++i) {
    cin >> x >> y;
    trees[x - 1].push_back(y - 1);
    trees[y - 1].push_back(x - 1);
  }
  
  auto mod_pow = [&](long a, long b=mod-2){
    long r(1);
    while (b) {
      if (b % 2) r = r * a % mod;
      a = a * a % mod;
      b /= 2;
    }
    return r;
  };
  
  for (int i = 0; i < n; ++i) {
    fac[i] = i ? fac[i - 1] * i % mod : 1;
    invfac[i] = mod_pow(fac[i]);
  }
  
  auto mod_add = [&](long a, long b){ return (a + b) % mod; };
  auto mod_mul = [&](long a, long b){ return a * b % mod; };
  auto mod_div = [&](long a, long b){ return a * mod_pow(b) % mod; };
  
  
  
  
  
  
  function<void(int, int)> root = [&](int i, int p) {
    f[i] = sub[i] = 1;
    for (const int& j: trees[i]) {
      if (j == p) continue;
      root(j, i);
      f[i] = mod_div(mod_mul(f[i], f[j]), fac[sub[j]]);
      sub[i] += sub[j];
    }
    f[i] = mod_mul(f[i], fac[sub[i] - 1]);
  };
  
  root(0, -1);
  
  function<void(int, int)> reroot = [&](int i, int p) {
    g[i] = 1;
    if (p != -1) {
      g[i] = mod_mul(mod_mul(fac[sub[i]], fac[n - sub[i] - 1]),
                     mod_mul(f[p], g[p]));
      g[i] = mod_div(g[i], mod_mul(f[i],
                           mod_mul(fac[sub[p] - 1], fac[n - sub[p]])));
    }
    for (const int& j: trees[i]) {
        if (j == p) continue;
        reroot(j, i);
    }
    ans[i] = mod_mul(f[i], mod_mul(g[i], fac[n - 1]));
    ans[i] = mod_div(ans[i], mod_mul(fac[sub[i] - 1], fac[n - sub[i]])); 
  };
  
  reroot(0, -1);
  
  for (int i = 0; i < n; ++i)
    cout << ans[i] << '\n';
  
  return 0;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:37: error: local variable 'mod' may not appear in this context
   18 |   auto mod_pow = [&](long a, long b=mod-2){
      |                                     ^~~
Language: C++

kuyhfujr5tutrsytrsdhrfsxhtrsxzhtrfdzhrftydzhfgxzhjgtfdzhgtfxjgfxjfx\

;jgfygkc
]jgfjtrf;
fxhtfkyuv



khtgdxjvhjk

khvyhjgḥ,vk
\

Compiler output:
a.cc:12:1: error: stray '\' in program
   12 | \
      | ^
a.cc:1:1: error: 'kuyhfujr5tutrsytrsdhrfsxhtrsxzhtrfdzhrftydzhfgxzhjgtfdzhgtfxjgfxjfx' does not name a type
    1 | kuyhfujr5tutrsytrsdhrfsxhtrsxzhtrfdzhrftydzhfgxzhjgtfdzhgtfxjgfxjfx\
    2 | 
a.cc:3:2: error: 'jgfygkc' does not name a type
    3 | ;jgfygkc
      |  ^~~~~~~
a.cc:5:1: error: 'fxhtfkyuv' does not name a type
    5 | fxhtfkyuv
      | ^~~~~~~~~
Language: C++

const M=10^9+7
function main()
	N=parse(Int,readline())
	fac=ones(Int,N)
	for i=2:N
		fac[i]=fac[i-1]*(i-1)%M
	end
	invfac=zeros(Int,N)
	invfac[N]=invmod(fac[N],M)
	for i=N-1:-1:1
		invfac[i]=invfac[i+1]*i%M
	end
	G=[Int[] for _=1:N]
	for s=readlines()
		a,b=map(x->parse(Int,x),split(s))
		push!(G[a],b)
		push!(G[b],a)
	end
	c=zeros(Int,N)
	dp1=zeros(Int,N)
	function dfs1(u,p)
		ret=1
		c[u]=1
		for v=G[u]
			if v!=p
				ret=ret*dfs1(v,u)%M
				ret=ret*invfac[c[v]+1]%M
				c[u]+=c[v]
			end
		end
		dp1[u]=ret
		ret*fac[c[u]]%M
	end
	ans=zeros(Int,N)
	function dfs2(u,p,pr)
		ans[u]=dp1[u]*pr%M*invfac[N-c[u]+1]%M
		for v=G[u]
			if v!=p
				dfs2(v,u,ans[u]*c[v]%M*invmod(dp1[v],M)%M*fac[N-c[v]]%M)
			end
		end
		ans[u]=ans[u]*fac[N]%M
	end
	dfs1(1,0)
	dfs2(1,0,1)
	println.(ans)
end
main()

Compiler output:
a.cc:1:7: error: 'M' does not name a type
    1 | const M=10^9+7
      |       ^
Language: C

#include<stdio.h>
int ta[200010],nt[400010],to[400010],cc[400010];
long long u[200010],ANS[200020],ans[200020];
int mbk(long long a,int n,int m){return n?(mbk((a*a)%m,n/2,m)*(n%2?a:1))%m:1;}
int inv(int a,int m){return mbk((long long)a,m-2,m);}
long long pp[200010],ip[200010],M=1e9+7;
int f(int s){//printf("!%d\n",s);
  long long i;
  u[s]=1;
  for(i=ta[s];i+1;i=nt[i]){
    if(u[to[i]])continue;
    ans[s]=ans[s]*f(to[i])%M;
    cc[s]+=cc[to[i]]+1;
  }
  ans[s]=ans[s]*inv(cc[s]+1,M)%M;
  return ans[s];
}
void h(int s,int t){
  ans[s]=ans[s]*(cc[s]+1)*inv(ans[t],M)%M;
  ans[t]=ans[t]*(cc[t]+1)%M;
  cc[s]-=cc[t]+1;
  cc[t]+=cc[s]+1;
  ans[s]=ans[s]*inv(cc[s]+1)%M;
  ans[t]=ans[t]*inv(cc[t]+1)*ans[s]%M;
}
void g(int s){//printf("!!%d %d\n",s,cc[s]);
  int i;
  u[s]=2;
  ANS[s]=ans[s];
  for(i=ta[s];i+1;i=nt[i]){
    if(u[to[i]]==2)continue;
    //printf("%d %d %d %d %lld %lld\n",s,to[i],cc[s],cc[to[i]],ans[s],ans[to[i]]);
    h(s,to[i]);
    //printf("%d %d %d %d %lld %lld\n",s,to[i],cc[s],cc[to[i]],ans[s],ans[to[i]]);
    g(to[i]);
    h(to[i],s);
  }
}
int main(){
  int n,a,b,i;
  scanf("%d",&n);
  for(i=0;i<=n;i++)ta[i]=-1;
  pp[0]=1;
  for(i=1;i<=n;i++)pp[i]=(pp[i-1]*i)%M;
  for(i=0;i<=n;i++)ip[i]=inv(pp[i],M);
  for(i=1;i<=n;i++)ans[i]=1;
  for(i=0;i<n-1;i++){
    scanf("%d %d",&a,&b);
    nt[i    ]=ta[to[i+n-1]=a];
    nt[i+n-1]=ta[to[i    ]=b];
    ta[b]=i+n-1;
    ta[a]=i;
  }
  f(1);
  //for(i=0;i<=10;i++)printf("%lld\n",pp[i]);printf("\n");
  //for(i=0;i<=n;i++)printf("%d\n",cc[i]);
  //printf("%d\n",f(1));
  //for(i=0;i<=n;i++)printf("%d\n",cc[i]);
  //for(i=1;i<=n;i++)printf("%3d ",i);printf("\n");
  //for(i=1;i<=n;i++)printf("%3lld ",ans[i]);printf("\n");
  //for(i=1;i<=n;i++)printf("%3d ",cc[i]);printf("\n");
  g(1);
  for(i=1;i<=n;i++)printf("%lld\n",ANS[i]);
  return 0;
}


Compiler output:
main.c: In function 'h':
main.c:23:17: error: too few arguments to function 'inv'
   23 |   ans[s]=ans[s]*inv(cc[s]+1)%M;
      |                 ^~~
main.c:5:5: note: declared here
    5 | int inv(int a,int m){return mbk((long long)a,m-2,m);}
      |     ^~~
main.c:24:17: error: too few arguments to function 'inv'
   24 |   ans[t]=ans[t]*inv(cc[t]+1)*ans[s]%M;
      |                 ^~~
main.c:5:5: note: declared here
    5 | int inv(int a,int m){return mbk((long long)a,m-2,m);}
      |     ^~~
Language: C++

#pragma GCC target ("avx")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")

#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)

template<typename T>
T power(T x, long long n, const T &m){
	if(n == 0) return 1;
	if(n == 1) return x;
	T tmp = power(x, n/2, m);
	if(n%2 == 0) return tmp * tmp % m;
	else return tmp * tmp % m * x % m;
}

template<typename T>
T inverse(T x, T m){
	return power(x, m-2, m);
}

int N;
int A[200000], B[200000];
vector<pair<int,pair<int,int>>> e[200000];

int memo[200000] ={};
int sz(int n, int d){ //0:A->B 1:B->A
	if(d == 1) return N-solve(n, 0);
	if(memo[n] != 0) return memo[n];
	int x=B[n], y=A[n];

	int ret = 1;
	rep(i, e[x].size()){
		if(e[x][i].first == y) continue;
		ret += sz(e[x][i].second.first, e[x][i].second.second);
	}
	return memo[n] = ret;
}

int fact[200001], inve[200001];

int dp[200000][2] ={};
int solve(int n, int d){
	if(dp[n][d] != 0) return dp[n][d];
	int x=B[n], y=A[n];
	if(d == 1) swap(x, y);

	ll ret = fact[sz(n, d)-1];
	rep(i, e[x].size()){
		if(e[x][i].first == y) continue;
		ret *= inve[sz(e[x][i].second.first, e[x][i].second.second)];
		ret %= MOD;
		ret *= solve(e[x][i].second.first, e[x][i].second.second);
		ret %= MOD;
	}
	return dp[n][d] = ret;
}

signed main(){
	scanf("%d", &N);
	rep(i, N-1){
		scanf("%d %d", A+i, B+i);
		A[i]--;
		B[i]--;
		e[A[i]].pb({ B[i], {i, 0} });
		e[B[i]].pb({ A[i], {i, 1} });
	}
	fact[0] = 1;
	inve[1] = 1;
	rep(i, N){
		fact[i+1] = (fact[i] * (ll)(i+1))%MOD;
		inve[i+1] = inverse((ll)fact[i+1], MOD);
	}
	rep(i, N){
		ll ans = fact[N-1];
		rep(j, e[i].size()){
			ans *= inve[sz(e[i][j].second.first, e[i][j].second.second)];
			ans %= MOD;
			ans *= solve(e[i][j].second.first, e[i][j].second.second);
			ans %= MOD;
		}
		printf("%d\n", ans);
	}
}


Compiler output:
a.cc: In function 'int sz(int, int)':
a.cc:34:29: error: 'solve' was not declared in this scope
   34 |         if(d == 1) return N-solve(n, 0);
      |                             ^~~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long LL;

const LL MOD = 1000000007LL;

LL modpow(LL x, LL n) {
  LL ret = 1;
  while(n != 0) {
    if(n & 1) {
      ret = ret * x % MOD;
    }
    x = x * x % MOD;
    n >>= 1;
  }
  return ret;
}

vector<LL> fac(200001), ifac(200001);

LL comb(int a, int b) {
  return fac[a] * (ifac[b] * ifac[a-b] % MOD) % MOD;
}

void prepare() {
  fac[0] = 1; ifac[0] = 1;
  for(int i=1; i<=200000; ++i) {
    fac[i] = fac[i-1] * i % MOD;
    ifac[i] = ifac[i-1] * modpow(i, MOD-2) % MOD;
  }
}

map<pair<int,int>, LL> leafSize, leafPatn;
vector<vector<int>> adj;

void calc(int x, int parent) {s
  if(leafSize.find(make_pair(parent, x)) != leafSize.end())
    return;
  if(adj[x].size() == 1 && parent >= 0) {
    leafSize[make_pair(parent, x)] = 1;
    leafPatn[make_pair(parent, x)] = 1;
    return;
  }
  int totalLeaf = 0;
  LL totalPatn = 1;
  for(const auto& i : adj[x]) {
    if(i == parent) continue;
    calc(i, x);
    totalLeaf += leafSize[make_pair(x, i)];
  }
  for(const auto& i : adj[x]) {
    if(i == parent) continue;
    int cSize = leafSize[make_pair(x, i)];
    totalPatn = totalPatn * leafPatn[make_pair(x, i)] % MOD;
    totalPatn = totalPatn * comb(totalLeaf, cSize) % MOD;
    totalLeaf -= cSize;
  }
  leafPatn[make_pair(parent, x)] = totalPatn;
}

int main() {
  prepare();
  int N;
  cin >> N;
  adj = vector<vector<int>>(N, vector<int>());
  REP(i, N-1) {
    int A, B;
    cin >> A >> B;
    --A; --B;
    adj[A].push_back(B);
    adj[B].push_back(A);
  }
  REP(i, N) {
    calc(i, -1);
  }
  REP(i, N) {
    cout << leafPatn[make_pair(-1, i)] << endl;
  }
}

Compiler output:
a.cc: In function 'void calc(int, int)':
a.cc:42:31: error: 's' was not declared in this scope
   42 | void calc(int x, int parent) {s
      |                               ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long	ll;
typedef pair< int, int >	pll;

const int N = int(2e5 + 10);
	
const ll mod = ll(1e9) + 7LL;
int n;
ll fat[N];
int father[N];
int st[N], en[N];
int pnt = 1;
vector< int > adj[N];
vector< ll > dp[N];

ll fast_expo(ll x, ll e, ll mod){
	ll b = x;
	ll r = 1LL;

	while(e){
		if(e & 1LL){
			r = (r * b) % mod;
		}

		e >>= 1LL;
		b = (b * b) % mod;
	}

	return r;
}

ll comb(int n, int k){
	assert(n >= k);

	ll inv = fast_expo((fat[n - k] * fat[k]) % mod, mod - 2, mod);

	// printf("%d, %d = %lld\n", n, k, (fat[n] * inv) % mod);

	return (fat[n] * inv) % mod;
}

void dfs(int u, int ft){
	father[u] = ft;

	st[u] = pnt;

	for(int v: adj[u]){
		if(v == ft){
			continue;
		}

		pnt++;
		dfs(v, u);
	}

	en[u] = pnt;
}

int get(int u, int ft){
	if(u == ft){
		return n;
	}

	assert(1 <= u && u <= n);
	assert(1 <= ft && ft <= n);

	if(father[u] == ft){
		return en[u] - st[u] + 1;
	}else{
		return n - (en[ft] - st[ft] + 1);
	}
}

ll solve(int u, int kk){
	int ft;

	assert(u >= 1 && u <= n);
	assert(kk <= adj[u].size());

	if(kk == adj[u].size()){
		ft = u;
	}else{
		assert(kk < adj[u].size());
		ft = adj[u][kk];
	}

	assert(ft >= 1 && ft <= n);
	// printf("%d %d %lu %d\n", u, ft, adj[u].size(), kk);

	assert(kk < dp[u].size());

	if(dp[u][kk] != -1){
		return dp[u][kk];
	}

	int sz = get(u, ft);

	ll ans = 1LL;

	int k = 0;

	for(int v: adj[u]){
		if(v == ft){
			k++;
			continue;
		}

		int d = get(v, u);
		// printf("(%d, %d)\n", sz - 1, d);
		ans = ans * ((comb(sz - 1, d) * solve(v, lower_bound(adj[v].begin(), adj[v].end(), u))) % mod);
		ans %= mod;
		sz -= d;

		k++;
	}

	assert(u >= 1 && u <= n);

	assert(kk < dp[u].size());

	dp[u][kk] = ans;

	return ans;
}

int main(){
	fat[0] = 1LL;

	for(int i = 1 ; i < N ; i++){
		fat[i] = ll(i) * fat[i - 1];
		fat[i] %= mod;
	}

	scanf("%d", &n);

	for(int i = 0 ; i < n - 1 ; i++){
		int ai, bi;

		scanf("%d %d", &ai, &bi);

		adj[ai].push_back(bi);
		adj[bi].push_back(ai);
	}

	for(int i = 1 ; i <= n ; i++){
		dp[i].resize(adj[i].size() + 11, -1);
		sort(adj[i].begin(), adj[i].end());
	}

	dfs(1, 1);

	for(int i = 1 ; i <= n ; i++){
		// printf("%lld\n", solve(i, adj[i].size()));
		break;
	}

	return 0;
}

Compiler output:
a.cc: In function 'll solve(int, int)':
a.cc:113:69: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int'
  113 |                 ans = ans * ((comb(sz - 1, d) * solve(v, lower_bound(adj[v].begin(), adj[v].end(), u))) % mod);
      |                                                          ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                     |
      |                                                                     __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:77:21: note:   initializing argument 2 of 'll solve(int, int)'
   77 | ll solve(int u, int kk){
      |                 ~~~~^~
Language: C++

#include<bits/stdc++.h>
#define mod ((int)1e9+7)
using namespace std;
typedef pair<int,int> pi;
typedef long long int ll;

const int N = (int)2e5+5;
vector<int> v[N];
ll power(ll a,ll b) {
    if (b==0) return 1;
    ll c = power(a,b>>1);
    c = (c*c)%mod;
    if (b&1) return (c*a)%mod;
    return c;
}
ll f[N], dp[N], ans[N];
ll comb(int n,int r) {
    ll num = f[n];
    ll den = (f[r]*f[n-r])%mod;
    return (num*power(den,mod-2))%mod;
}
int cnt[N];
void dfs(int i,int p) {
    cnt[i] = 1;
    for(auto it:v[i]) {
        if(it!=p) {
            dfs(it,i);
            cnt[i] += cnt[it];
        }
    }
    int n = cnt[i]-1;
    dp[i] = 1;
    for(auto it:v[i]) {
        if(it!=p) {
            dp[i] *= (comb(n,cnt[it])*dp[it])%mod;
            dp[i] %= mod;
            n -= cnt[it];
        }
    }
}
void run(int i,int p) {
    ans[i] = dp[i];
    for(auto it:v[i]) {
        if(it!=p) {
            int t = (comb(n,cnt[it])*dp[it])%mod;
            dp[i] = (dp[i]*power(t,mod-2))%mod;
            int s = (comb(cnt[i]-1,cnt[i]-cnt[it])*dp[i])%mod;
            int p = cnt[i];
            cnt[i] = cnt[i]-cnt[it];
            cnt[it] = p;
            dp[it] = (dp[it]*s)%mod;
            run(it,i);
            cnt[i] = p;
            dp[it] = (dp[it]*power(s,mod-2))%mod;
            dp[i] = (dp[i]*t)%mod;
        }
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    f[0] = 1;
    for(int i=1;i<N;i++) {
        f[i] = (f[i-1]*i)%mod;
    }
    int n;
    cin>>n;
    for(int i=1,x,y;i<n;i++) {
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    dfs(1,1);
    cout<<dp[1]; return 0;
    run(1,1);
    for(int i=1;i<=n;i++) {
        cout<<ans[i]<<"\n";
    }
}


Compiler output:
a.cc: In function 'void run(int, int)':
a.cc:45:27: error: 'n' was not declared in this scope
   45 |             int t = (comb(n,cnt[it])*dp[it])%mod;
      |                           ^
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
long long extGCD(long long a,long long mod,long long &x,long long &y){
    if(mod==0){
        x=1;
        y=0;
        return a;
    }
    long long d=extGCD(mod,a%mod,y,x);
    y-=(a/mod)*x;
    return d;
}
long long invmod(long long a,long long mod){
    long long x,y;
    extGCD(a,mod,x,y);
    x%=mod;
    if(x<0)x+=mod;
    return x;
}
ll fac[2000010],finv[2000010],inv[2000010];
void combinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    REP(i,2,2000010){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=invmod(i,mod);
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
ll comb(ll n,ll k){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
vector<vector<ll> >g(200010);
map<pll,ll>dp;
map<pll,ll>sz;
ll dfs(ll p,ll i){
    if(sz.find(mp(p,i))!=sz.end())return sz[mp(p,i)];
    ll res=1;
    for(auto e:g[i]){
        if(p==e)continue;
        res+=dfs(e,i);
    }
    sz[mp(p,i)]=res;
    return res;
}
ll dfs(ll i,ll p){
    if(dp.find(mp(p,i))!=dp.end())return dp[mp(p,i)];
    ll res1=1;
    ll res2=1;
    for(auto e:g[i]){
        if(p==e)continue;
        res1=comb(res1+sz[mp(i,e)],res1);
        res1%=inf;
        res2*=dfs(i,e);
        res2%=inf;
    }
    res1=res1%inf*res2%inf;
    dp[mp(p,i)]=res1;
    return res1;
}
int main(){
    combinit();
    dp.clear();
    ll n;cin>>n;
    rep(i,n-1){
        ll a,b;cin>>a>>b;
        a--;b--;
        g[a].pb(b);
        g[b].pb(a);
    }
    rep(i,n){
        ll ans=dfs(-1,i);
        ans%=inf;
        if(ans<0)ans+=inf;
        cout<<ans<<endl;
    }
}

Compiler output:
a.cc:63:4: error: redefinition of 'll dfs(ll, ll)'
   63 | ll dfs(ll i,ll p){
      |    ^~~
a.cc:53:4: note: 'll dfs(ll, ll)' previously defined here
   53 | ll dfs(ll p,ll i){
      |    ^~~
Language: C++

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

ll fac[200007],finv[200007],inv[200007];
void cominit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<200007;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;
    }
}
ll com(ll n,ll k){
    if(n<k)return 0;
    if(n<0 || k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
vector<vector<ll> > g(200000);
ll father[200000];
ll dpinline[200000],dpinnum[200000];
void dfs1(int x,int fa){
	father[x]=fa;
	ll ret=1;
	
	for(int i=0;i<g[x].size();i++){
		int to=g[x][i];
		if(to==fa) continue;
		dfs1(to,x);
		ret++;
	}
	dpin[x]=(ret+);
}

void dfs2(int x,int fa){
	vector <ll> v1,v2;
	for(int i=0;i<g[x].size();i++){
		int to=g[x][i];
		if(to==fa) v1.pb(1ll),v2.pb(1ll);
		else v1.pb(dpin[to]),v2.pb(dpin[to]);
	}
	for(int i=1;i<v1.size();i++) v1[i]=(v1[i-1]*v1[i]);
	for(int i=v2.size()-2;i>=0;i--) v2[i]=(v2[i+1]*v2[i]);
	for(int i=0;i<g[x].size();i++){
		int to=g[x][i];
		if(to==fa) continue;
		ll ret=1;
		if(i>0) ret=(ret*v1[i-1]);
		if(i<v2.size()-1) ret=(ret*v2[i+1]);
		ret=(ret*dpout[x]);
		ret=(ret+1);
		dpout[to]=ret;
		dfs2(to,x);
	}
}

int main(){
	cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cominit();
	ll n;
	cin>>n;
	ll a,b;
	for(int i=1;i<n;i++){
		cin>>a>>b;
		a--,b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	dfs1(0,-1);
	dpout[0]=1ll; dfs2(0,-1);
	for(int i=0;i<n;i++){
		ll ans=dpout[i];
		for(int j=0;j<g[i].size();j++){
			int to=g[i][j];
			if(to==father[i]) continue;
			ans=(ans*dpin[to]);
		}
		printf("%d\n",ans);
	}
	return 0;
}


Compiler output:
a.cc: In function 'void dfs1(int, int)':
a.cc:47:9: error: 'dpin' was not declared in this scope
   47 |         dpin[x]=(ret+);
      |         ^~~~
a.cc:47:22: error: expected primary-expression before ')' token
   47 |         dpin[x]=(ret+);
      |                      ^
a.cc: In function 'void dfs2(int, int)':
a.cc:55:28: error: 'dpin' was not declared in this scope
   55 |                 else v1.pb(dpin[to]),v2.pb(dpin[to]);
      |                            ^~~~
a.cc:3:25: note: in definition of macro 'pb'
    3 | #define pb(q) push_back(q)
      |                         ^
a.cc:65:26: error: 'dpout' was not declared in this scope
   65 |                 ret=(ret*dpout[x]);
      |                          ^~~~~
a.cc: In function 'int main()':
a.cc:87:9: error: 'dpout' was not declared in this scope
   87 |         dpout[0]=1ll; dfs2(0,-1);
      |         ^~~~~
a.cc:93:34: error: 'dpin' was not declared in this scope
   93 |                         ans=(ans*dpin[to]);
      |                                  ^~~~
Language: C++

#include <bits/stdc++.h>
#define int long long
#define pii pair<int, int>

using namespace std;
const int inf = 1e9 + 7;
const int max_n = 2e5 + 7;
vector<int> gr[max_n];
map<int, int> dp[max_n], sz[max_n];
int fact[max_n];

inline int mul(int a, int b) {
	return a * b % inf;
}

inline int power(int a, int b) {
	int res = 1;
	while(b) {
		if (b & 1) res = mul(res, a);

		a = mul(a, a);

		b >>= 1;
	}

	return res;
}

inline int inv(int a) {
	return power(a, inf - 2);
}

inline int C(int n, int k) {
	return mul(fact[n], inv(mul(fact[k], fact[n - k])));
}


int iter = 0;

set<pii> temp;
int iter = 0;

void dfs(int v, int pr) {
	iter++;
	if (iter > 2 * max_n) {
		int aa = 0;
		fact[0] /= aa;
	}
	//temp.emplace(v, pr);


	sz[v][pr] = 0;
	dp[v][pr] = 1;

	for(int i : gr[v]) {
		if (i == pr) continue;
		if (dp[i].find(v) == dp[i].end()) dfs(i, v);
		sz[v][pr] += sz[i][v];
		dp[v][pr] = mul(dp[v][pr], mul(dp[i][v], C(sz[v][pr], sz[i][v])));
	}
	sz[v][pr]++;
}

inline void solve() {
	fact[0] = 1;
	for(int i = 1;i < max_n;i++) fact[i] = mul(fact[i - 1], i);

	int n;
	cin >> n;
	for(int i = 0;i < n - 1;i++) {
		int v1, v2;
		cin >> v1 >> v2;
		v1--; v2--;
		gr[v1].emplace_back(v2);
		gr[v2].emplace_back(v1);
	}


	//cout << "scan" << endl;


	for(int i = 0;i < n;i++) {
		for(int pr : gr[i]) {
			if (dp[i].find(pr) == dp[i].end()) dfs(i, pr);
		}
	}

	//cout << "dfs" << endl;

	for(int i = 0;i < n;i++) {
		int c_sz = 0;
		int res = 1;
		for(int j : gr[i]) {
			c_sz += sz[j][i]; 
			res = mul(res, mul(dp[j][i], C(c_sz, sz[j][i])));
		}

		cout << res << '\n';
	}

}







signed main() {
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
*/
 	cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);


    solve();
}

Compiler output:
a.cc:41:5: error: redefinition of 'long long int iter'
   41 | int iter = 0;
      |     ^~~~
a.cc:38:5: note: 'long long int iter' previously defined here
   38 | int iter = 0;
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#include "../lib/math/comb.hpp"

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const ld eps = 1e-9;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

int n;
Combination<MOD> comb;

vector<ll> sz, ans1, ans2;

int dfs1(int now, int prev, const vvi &tr) {
  int res = 1;
  ll su = 0;
  for(int i=0;i<SZ(tr[now]);++i) {
    int nxt = tr[now][i];
    if(nxt == prev) continue;
    int nowsz = dfs1(nxt, now, tr);
    su += nowsz;
    res += nowsz;
    ans1[now] *= ans1[nxt];
    ans1[now] %= MOD;
  }

  for(int i=0;i<SZ(tr[now]);++i) {
    int nxt = tr[now][i];
    if(nxt == prev) continue;
    ans1[now] *= comb.C(su, sz[nxt]);
    ans1[now] %= MOD;
    su -= sz[nxt];
  }

  sz[now] = res;
  return res;
}

void dfs2(int now, int prev, ll par, const vvi &tr) {
  ll tmpsu = n-1;
  for(int i=0;i<SZ(tr[now]);++i) {
    int nxt = tr[now][i];
    if(nxt == prev) continue;
    ans2[now] *= ans1[nxt];
    ans2[now] %= MOD;
    ans2[now] *= comb.C(tmpsu, sz[nxt]);
    ans2[now] %= MOD;
    tmpsu -= sz[nxt];
  }
  ans2[now] *= par;
  ans2[now] %= MOD;

  for(int i=0;i<SZ(tr[now]);++i) {
    int nxt = tr[now][i];
    if(nxt == prev) continue;
    ll nxtpar = ans2[now];
    nxtpar *= comb.getinv(ans1[nxt]);
    nxtpar %= MOD;
    nxtpar *= comb.getinv(comb.C(n-1, sz[nxt]));
    nxtpar %= MOD;
    dfs2(nxt, now, nxtpar, tr);
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  comb = Combination<MOD>(1000000);

  cin >> n;
  vvi tr(n);
  for(int i=0;i<n-1;++i) {
    int a, b; cin >> a >> b;
    a--; b--;
    tr[a].push_back(b);
    tr[b].push_back(a);
  }

  ans1.resize(n, 1);
  ans2.resize(n, 1);
  sz.resize(n, 0);

  dfs1(0, -1, tr);
  dfs2(0, -1, 1, tr);
  for(int i=0;i<n;++i) {
    cout << ans2[i] << endl;
  }

}


Compiler output:
a.cc:2:10: fatal error: ../lib/math/comb.hpp: No such file or directory
    2 | #include "../lib/math/comb.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define int long long
#define pii pair<int, int>

using namespace std;
const int inf = 1e9 + 7;
const int max_n = 2e5 + 7;
vector<int> gr[max_n];
map<int, int> dp[max_n], sz[max_n];
int fact[max_n];

inline int mul(int a, int b) {
	return a * b % inf;
}

inline int power(int a, int b) {
	int res = 1;
	while(b) {
		if (b & 1) res = mul(res, a);

		a = mul(a, a);

		b >>= 1;
	}

	return res;
}

inline int inv(int a) {
	return power(a, inf - 2);
}

inline int C(int n, int k) {
	return mul(fact[n], inv(mul(fact[k], fact[n - k])));
}


int iter = 0;

void dfs(int v, int pr) {
	iter++;
	if (iter > max_n) {
		int a = 0;
		n /= a;
	}


	sz[v][pr] = 0;
	dp[v][pr] = 1;

	for(int i : gr[v]) {
		if (i == pr) continue;
		if (dp[i].find(v) == dp[i].end()) dfs(i, v);
		sz[v][pr] += sz[i][v];
		dp[v][pr] = mul(dp[v][pr], mul(dp[i][v], C(sz[v][pr], sz[i][v])));
	}
	sz[v][pr]++;
}

inline void solve() {
	fact[0] = 1;
	for(int i = 1;i < max_n;i++) fact[i] = mul(fact[i - 1], i);

	int n;
	cin >> n;
	for(int i = 0;i < n - 1;i++) {
		int v1, v2;
		cin >> v1 >> v2;
		v1--; v2--;
		gr[v1].emplace_back(v2);
		gr[v2].emplace_back(v1);
	}


	//cout << "scan" << endl;


	for(int i = 0;i < n;i++) {
		for(int pr : gr[i]) {
			if (dp[i].find(pr) == dp[i].end()) dfs(i, pr);
		}
	}

	//cout << "dfs" << endl;

	for(int i = 0;i < n;i++) {
		int c_sz = 0;
		int res = 1;
		for(int j : gr[i]) {
			c_sz += sz[j][i]; 
			res = mul(res, mul(dp[j][i], C(c_sz, sz[j][i])));
		}

		cout << res << '\n';
	}

}







signed main() {
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/

 	cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);


    solve();
}

Compiler output:
a.cc: In function 'void dfs(long long int, long long int)':
a.cc:44:17: error: 'n' was not declared in this scope
   44 |                 n /= a;
      |                 ^