criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define int long long int
#define f(i,a,b) for (int i= a; i <b; ++i)
using namespace std;

vector<int> v[100005];
int mod=1000000007;
int dp[100005][2];
int solve(int src,int c,int p)
{

    if(dp[src][c]!=-1)
        return dp[src][c];
    int ans=0;
    int w1=1;a
    for(int i=0;i<v[src].size();i++)
    {
        if(v[src][i]!=p)
            w1=(w1*solve(v[src][i],0,src))%mod;
    }
     ans+=w1;
     if(c==0)
     {
         int w2=1;
         for(int i=0;i<v[src].size();i++)
        {
          if(v[src][i]!=p)
            w2=(w2*solve(v[src][i],1,src))%mod;
        }
        ans=(ans+w2)%mod;
     }
     return dp[src][c]=ans;
}
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof dp);
    int n,x,y;
    cin>>n;
    for(int i=0;i<n-1;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    cout<<solve(1,0,-1);
}



Compiler output:
a.cc: In function 'long long int solve(long long int, long long int, long long int)':
a.cc:16:14: error: 'a' was not declared in this scope
   16 |     int w1=1;a
      |              ^
a.cc:17:17: error: 'i' was not declared in this scope
   17 |     for(int i=0;i<v[src].size();i++)
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
# define MOD 1000000007
int dp[2][1000001];
int util(vector<int> adj[], int n, int u, int parent, int flag){
    if(dp[flag][u] != -1) return dp[flag][u]%MOD;
    int white = 1;
    for(int i=0;i<adj[u].size();i++){
        int v = adj[u][i];
        if(v != parent) white = (long long((white%MOD)*(util(adj, n, v, u, 0)%MOD)))%MOD;
    }
    int res = white;
    if(flag == 0){
        int black = 1;
        for(int i=0;i<adj[u].size();i++){
            int v = adj[u][i];
            if(v != parent) black = (long long((black%MOD)*(util(adj, n, v, u, 1)%MOD)))%MOD;
        }
        res = (res%MOD + black%MOD)%MOD;
    }
    res = res%MOD;
    dp[flag][u] = res;
    return res;
}
int main(){
	int n;
	cin>>n;
    vector<int> adj[n];
    for(int i=0;i<n-1;i++){
        int xi, yi;
        cin>>xi>>yi;
        adj[xi-1].push_back(yi-1);
        adj[yi-1].push_back(xi-1);
    }
    memset(dp, -1, sizeof(dp));
    cout<<util(adj, n, 0, -1, 0);
	return 0;
}

Compiler output:
a.cc: In function 'int util(std::vector<int>*, int, int, int, int)':
a.cc:10:34: error: expected primary-expression before 'long'
   10 |         if(v != parent) white = (long long((white%MOD)*(util(adj, n, v, u, 0)%MOD)))%MOD;
      |                                  ^~~~
a.cc:10:34: error: expected ')' before 'long'
   10 |         if(v != parent) white = (long long((white%MOD)*(util(adj, n, v, u, 0)%MOD)))%MOD;
      |                                 ~^~~~
      |                                  )
a.cc:17:38: error: expected primary-expression before 'long'
   17 |             if(v != parent) black = (long long((black%MOD)*(util(adj, n, v, u, 1)%MOD)))%MOD;
      |                                      ^~~~
a.cc:17:38: error: expected ')' before 'long'
   17 |             if(v != parent) black = (long long((black%MOD)*(util(adj, n, v, u, 1)%MOD)))%MOD;
      |                                     ~^~~~
      |                                      )
Language: Java

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	static long MOD = 1000000007;
	static Long dp[][];

	static long getWays(ArrayList<Integer> tree[], int curr, int par, int color)
	{
		if(tree[curr].size()==1 && tree[curr].get(0)==par)
		{
			return 1;
		}

		if(dp[curr][color]!=null)
			return dp[curr];

		long temp=1;

		if(color==1)
		{
			for(int ch: tree[curr])
			{
				if(ch==par)
					continue;
				temp *= getWays(tree, ch, curr, 0);
				temp = temp%MOD;
			}
		}
		else
		{
			for(int ch: tree[curr])
			{
				if(ch==par)
					continue;
				temp *= (getWays(tree, ch, curr, 0)%MOD + getWays(tree, ch, curr, 1)%MOD);
				temp = temp%MOD;
			}
		}
		return dp[curr][color]=temp;
	}

	public static void main(String[] args)
	{
		FastReader scan=new FastReader();
		int n=scan.nextInt();
		ArrayList<Integer> tree[]=new ArrayList[n];
		for(int i=0;i<n;i++)
			tree[i]=new ArrayList<>();

		for(int i=0;i<n-1;i++)
		{
			int u=scan.nextInt()-1;
			int v=scan.nextInt()-1;

			tree[u].add(v);
			tree[v].add(u);
		}

		dp[]=new Long[n][2];
		long ans = getWays(tree, 0, -1, 0)%MOD + getWays(tree, 0, -1, 1)%MOD;
		ans = ans%MOD;

		System.out.println(ans);

	}


static class FastReader
{
    BufferedReader br;
    StringTokenizer st;
 
    public FastReader()
    {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }
 
    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try
            {
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
 
    int nextInt()
    {
        return Integer.parseInt(next());
    }
 
    long nextLong()
    {
        return Long.parseLong(next());
    }
 
    double nextDouble()
    {
        return Double.parseDouble(next());
    }
 
    String nextLine()
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
}



}


Compiler output:
Main.java:62: error: not a statement
		dp[]=new Long[n][2];
		  ^
Main.java:62: error: ';' expected
		dp[]=new Long[n][2];
		    ^
Main.java:62: error: not a statement
		dp[]=new Long[n][2];
		     ^
3 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll  long long
#define mod 1000000007
ll int v;
map<ll int,list<ll int> > m;
ll int dp[100002][2];
ll int ans(ll int node,ll int par)
{ll int w=1;
	ll int b=1;
	bool c=false;
for(auto i: m[node])
{
if(i!=par)
{c=true;
ans(i,node);
b=( (b%mod)   * (dp[i][0]%mod) )%mod;
w=((w%mod)   * (dp[i][1]%mod) )%mod;

}	
}
if(c==false)
{
dp[node][0]=1;
dp[node][1]=1;
}
else
{dp[node][1]=(b%mod+w%mod)%mod;
	dp[node][0]=w;

}

return 0;

}
int main()
{
	
cin>>v;
for(ll int i=1;i<v;i++)
{ll int e,f;
	cin>>e>>f;
	m[e].push_back(f);
m[f].push_back(e);
}
ll int d=ans(1,-1);
for(int )



cout<<(dp[1][0]%mod+dp[1][1]%mod)%mod<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:9: error: expected unqualified-id before ')' token
   47 | for(int )
      |         ^
a.cc:47:8: error: expected ';' before ')' token
   47 | for(int )
      |        ^~
      |        ;
a.cc:47:9: error: expected primary-expression before ')' token
   47 | for(int )
      |         ^
a.cc:47:8: error: expected ';' before ')' token
   47 | for(int )
      |        ^~
      |        ;
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mod = 1000000007;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){ //for debug
    ll n = vec.size();
    cout << "------------------------------------\n" ;
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
    cout << "------------------------------------\n" ;
}

void pr2d(vector<vector<ll>> vec){ // for debug
    ll h = vec.size();
    ll w = vec.at(0).size();
    cout << "------------------------------------\n" ;
    rep(i,h){
        rep(j,w){
            cout << vec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
    cout << "------------------------------------\n" ;
}

ll n;
vector<vector<ll>> hen,dp;

ll f(ll num, ll col, ll prev = -1){
    if(dp[num][col]!=-1) return dp[num][col];
    ll ret = 1;
    if(col == 0){ //col==black
        for(auto i:hen[num]){
            if(i==prev) continue;
            ret = (ret*f(i,1,num)%mod);            
        }
    }else{ //col==1==white
        for(auto i:hen[num]){
            if(i==prev) continue;
            ret = (ret*((f(i,0,num)+f(i,1,num))%mod)%mod);            
        }
    }
    dp[num][col] = ret;
    return ret;
}


int main(){
    cin >> n;
    hen.resize(n,vector<ll>(0));
    dp.resize(n,vector<ll>(2,-1));
    dist.resize(n,-1);
    rep(i,n-1){
        ll x,y; cin >> x >> y;
        x--; y--;
        hen.at(x).emplace_back(y);
        hen.at(y).emplace_back(x);
    }
    cout << (f(0,0) + f(0,1))%mod << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:5: error: 'dist' was not declared in this scope
   57 |     dist.resize(n,-1);
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define loop(i,a,b) for(ll i=a; i<b; i++)
#define revloop(i,a,b) for(ll i=a; i>=b; i--)
#define pb push_back
#define vl vector<ll>
#define vvl vector<vl>
#define pl pair<ll,ll>
#define vpl vector<pl>
#define all(c) (c).begin(), (c).end()
#define sz(a) ((a).size())
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i!=(c).end(); i++))
#define mp make_pair
#define ss second
#define ff first
#define ld long double
const ll INF = 1e13;
const ll N = 100002;
ll mod= 1000000007;
/*bool prime(ll x)
{
	if(x<2) return false;
	for(ll i=2; i*i<=x; i++) if(x%i==0) return false;
	return true;
}
vl fac(N);
void fact()
{
	fac[0]=1;
	loop(i,1,N) fac[i]=(fac[i-1]*i)%mod;
}
*/
ll dpw[100005], dpb[100005];
vl adj[100005];
void dfs(ll n, ll p)
{
	dpw[n]=1;
	dpb[n]=1;
	for(auto i:adj[n])
	 if(i!=p)
	 {
	 	dfs(i,n);
	 	dpw[n]=dpw[n]*(dpw[i]+dpb[i])%mod;
	 	dpb[n]=dbp[n]*dpw[i]%mod;
	 }
}
void solve()
{
 ll n;
 cin>>n;
 loop(i,1,n)
 {
 	ll u,v;
 	cin>>u>>v;
 	adj[u].pb(v);
 	adj[v].pb(u);
 }
 dfs(1,0);
 cout<<(dpw[1]+dpb[1])%mod;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--) solve();
 return 0;
}

Compiler output:
a.cc: In function 'void dfs(long long int, long long int)':
a.cc:45:24: error: 'dbp' was not declared in this scope; did you mean 'dup'?
   45 |                 dpb[n]=dbp[n]*dpw[i]%mod;
      |                        ^~~
      |                        dup
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define loop(i,a,b) for(ll i=a; i<b; i++)
#define revloop(i,a,b) for(ll i=a; i>=b; i--)
#define pb push_back
#define vl vector<ll>
#define vvl vector<vl>
#define pl pair<ll,ll>
#define vpl vector<pl>
#define all(c) (c).begin(), (c).end()
#define sz(a) ((a).size())
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i!=(c).end(); i++))
#define mp make_pair
#define ss second
#define ff first
#define ld long double
const ll INF = 1e13;
const ll N = 100002;
ll mod= 1000000007;
/*bool prime(ll x)
{
	if(x<2) return false;
	for(ll i=2; i*i<=x; i++) if(x%i==0) return false;
	return true;
}
vl fac(N);
void fact()
{
	fac[0]=1;
	loop(i,1,N) fac[i]=(fac[i-1]*i)%mod;
}
*/
ll dp[100005][2];
vl adj[100005];
ll dfs(ll n, ll p, ll c)
{
	if(dp[n][c]!=-1) return dp[n][c];
	dp[n][c]=1;
	for(auto child: adj[n])
	{
		if(child!=p)
		{
			ll sub = 1;
			if(c==0) sub = dfs(child,n,1);
			else if(c==1) sub = (dfs(child,n,0)+dfs(child,n,1))%mod;
			dp[n][c] = (dp[n][c]*sub)%mod;
		}
	}
	return dp[n][c];
}
void solve()
{
 ll n;
 cin>>n;
 memset(dp, -1, size0f(adj));
 loop(i,0,n-1)
 {
 	ll u,v;
 	cin>>u>>v;
 	u--; v--;
 	adj[u].pb(v);
 	adj[v].pb(u);
 }
 ll x = dfs(0,-1,0);
 ll y = dfs(0,-1,1);
 cout<<(x+y)%mod;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--) solve();
 return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:56:17: error: 'size0f' was not declared in this scope; did you mean 'size_t'?
   56 |  memset(dp, -1, size0f(adj));
      |                 ^~~~~~
      |                 size_t
Language: C++

//Om Sree Sai Ram
#include "bits/stdc++.h"
using namespace std;

const long long mod = 1e9+7;
vector<pair<long long ,long long>> dp;
vector<bool> vis;

void mul_self(long long &a,long long b)
{
  a = a*b;
  a = a%mod;
}

void add_self(long long& a,long long b)
{
  a+=b;
  if(a>=mod)
    {
      a-=mod;
    }
}

pair<long long,long long> dfs(long long id,vector<vector<long long>>& adj)
{
  pair<long long,long long> ans;
   ans.first++;
   ans.second++;
  //bool flag = false;
  for(auto c:adj[id])
  {
    if(vis[c])
    {
      continue;
    }
    //flag = true;
    vis[c] = true;
    auto  tmp = dfs(c,adj);
    long long black = tmp.first;
    long long white = tmp.second;
    add_self(white,black);
    mul_self(ans.first,white);
    mul_self(ans.second,black);
  }
 //  if(!flag)
 //  {
 //  ans.first++;
 //  ans.second++;
 // }
  return ans;
}

int main() 
{

long long n;
cin>>n;
vector<vector<long long>> ar(n);
for(int i=0;i<n-1;i++)
{
  int a,b;
  cin>>a>>b;
  ar[a-1].push_back(b-1);
  ar[b-1].push_back(a-1);
}
dp.assign(n,make_pair(0,0));
//dp[i] represents, number of ways to fill the tree with root
// First element represents number of ways if the current element is filled with white
// Second elemetn represent number of ways if the current element is black
vis.assign(n,false);
vis[0] = true;
auto ans = dfs(0,ar);
//cout<<ans.first<<" "<<ans.second<<endl;
add_self(ans.second,ans.first)
cout<<ans.second<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:31: error: expected ';' before 'cout'
   74 | add_self(ans.second,ans.first)
      |                               ^
      |                               ;
   75 | cout<<ans.second<<endl;
      | ~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)
const int N = 1e5, M = 7 + 1e9;
int n;
ll dp[N][2];
vector<int> g[N];
ll DFS(int u, int p, bool c){  
	ll &ret = dp[i][c];
	if(~ret)
		return ret;
	ret = 1;
	f(i, 0, g[u].size()){
		if(g[u][i] != p){
			ll val = DFS(g[u][i], u, 0);
			if(c == 0)
				val += DFS(g[u][i], u, 1);
			val %= M;
			ret *= val;
			ret %= M;
		}
	}
	return ret;
}
int main()
{
	memset(dp, -1, sizeof dp);
	cin >> n;
	for(int i=0, u, v; i<n-1; ++i){
		cin >> u >> v;
		u--, v--;
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}
	cout << (DFS(0, -1, 0) + DFS(0, -1, 1))%M;
}

Compiler output:
a.cc: In function 'long long int DFS(int, int, bool)':
a.cc:10:22: error: 'i' was not declared in this scope
   10 |         ll &ret = dp[i][c];
      |                      ^
Language: C++

#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <queue>
#include <climits>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const ll INF = 1e17;

struct edge {
	int u, v; ll w;
	edge() {}
	edge(int _u, int _v, ll _w) :
		u(_u), v(_v), w(_w) {}
};

struct node { vector<edge> edges; };

ll dp[(int)1e5 + 2][2];

//Everything is 0-indexed
struct tree {
	vector<node> nodes;
	int root, n;

	tree(int _n, int _r = 0) : n(_n), root(_r) { nodes.resize(n); }

	void add_edge(int u, int v, ll w = 1ll) {
		edge e1(u, v, w); edge e2(v, u, w);
		nodes[u].edges.push_back(e1);
		nodes[v].edges.push_back(e2);
	}
	 
	ll ways(int cur, int p, bool b) {
		if (dp[cur][b] != -1) { return dp[cur][b]; }
		ll ans = 1;

		for (auto &e : nodes[cur].edges) {
			if (e.v == p) { continue; }
			ll w = ways(e.v, cur, 0);
			if (!b) { w += ways(e.v, cur, 1); w %= mod; }
			ans *= w; ans %= mod;
		}

		return dp[cur][b] = ans;
	}
};

int main() {
	int n; cin >> n;
	tree t(n);
	for (int i = 0; i < n - 1; i++) {
		int u, v; cin >> u >> v; u--; v--;
		t.add_edge(u, v);
	}
	memset(dp, -1, sizeof(dp));

	ll res = t.ways(0, -1, 0) + t.ways(0, -1, 1); res %= mod;
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:9: error: 'memset' was not declared in this scope
   59 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    7 | #include <climits>
  +++ |+#include <cstring>
    8 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <queue>
#include <climits>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const ll INF = 1e17;

struct edge {
	int u, v; ll w;
	edge() {}
	edge(int _u, int _v, ll _w) :
		u(_u), v(_v), w(_w) {}
};

struct node { vector<edge> edges; };

ll dp[(int)1e5 + 2][2];

//Everything is 0-indexed
struct tree {
	vector<node> nodes;
	int root, n;

	tree(int _n, int _r = 0) : n(_n), root(_r) { nodes.resize(n); }

	void add_edge(int u, int v, ll w = 1ll) {
		edge e1(u, v, w); edge e2(v, u, w);
		nodes[u].edges.push_back(e1);
		nodes[v].edges.push_back(e2);
	}
	 
	ll ways(int cur, int p, bool b) {
		if (dp[cur][b] != -1) { return dp[cur][b]; }
		ll ans = 1;

		for (auto &e : nodes[cur].edges) {
			if (e.v == p) { continue; }
			ll w = ways(e.v, cur, 0);
			if (!b) { w += ways(e.v, cur, 1); w %= mod; }
			ans *= w; ans %= mod;
		}

		return dp[cur][b] = ans;
	}
};

int main() {
	int n; cin >> n;
	tree t(n);
	for (int i = 0; i < n - 1; i++) {
		int u, v; cin >> u >> v; u--; v--;
		t.add_edge(u, v);
	}
	memset(dp, -1, sizeof(dp));

	ll res = t.ways(0, -1, 0) + t.ways(0, -1, 1); res %= mod;
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:9: error: 'memset' was not declared in this scope
   58 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <climits>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

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

const int N = 100005, mod = 1e9 + 7;
vector<int> g[N];
int ans = 0;

ll dp[N][2];

bool used[N][2];

// 1 --> black
// 0 --> white

int dfs(int v, int p, int cl) {
	if(used[v][cl])
		return dp[v][cl];
	int tmp = 1;
	for(auto to : g[v]) {
		if(to != p) {
			int x = dfs(to, v, 0) % mod;
			if(!cl) {
				x += dfs(to, v, 1);
			}
			x %= mod;
			tmp *= x;
			tmp %= mod;
		}
	}	
	dp[v][cl] = tmp;
	used[v][cl] = 1;
	return tmp;
}

signed main() {
	int n;
	cin >> n;
	for(int i = 1; i < n; i++) {
		int x, y;
		cin >> x >> y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	ans = dfs(1, -1, 0) + dfs(1, -1, 1);
	cout << ans % mod;
	return 0;
}

Compiler output:
a.cc:9:1: error: 'll' does not name a type
    9 | ll dp[N][2];
      | ^~
a.cc: In function 'long long int dfs(long long int, long long int, long long int)':
a.cc:18:24: error: 'dp' was not declared in this scope; did you mean 'p'?
   18 |                 return dp[v][cl];
      |                        ^~
      |                        p
a.cc:31:9: error: 'dp' was not declared in this scope; did you mean 'p'?
   31 |         dp[v][cl] = tmp;
      |         ^~
      |         p
Language: C++

#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int n;
vector<int> arr[100001];
const int mod = 1e9 + 7;
int mul(int a, int b) {
    return (long long) a * b % mod;
}
pair<int, int> DFS_tree(vector<pair<int, int>> &dp, int vertex, int parent)
{
    for (auto adj : arr[vertex])
    {
        if (adj != parent)
        {
            pair<int, int> temp = DFS_tree(dp, adj, vertex);
            if (dp[vertex].first == -1 && dp[vertex].second == -1)
            {   
                dp[vertex].first = (long long)(temp.first + temp.second)%mod;
                dp[vertex].second = temp.first;
            }
            else
            {
                dp[vertex].first = (mul(dp[vertex].first * temp.first) + mul(dp[vertex].first * temp.second))%mod;
                dp[vertex].second = mul(dp[vertex].second * temp.first);
            }
        }
    }
    if (dp[vertex].first == -1 && dp[vertex].second == -1){
      return make_pair(1,1);
    } 
    return dp[vertex];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    vector<pair<int, int>> dp(n + 1);

    for (int i = 0; i < n - 1; ++i)
    {
        int x;
        int y;
        cin >> x >> y;
        arr[x].push_back(y);
        arr[y].push_back(x);
    }
    for (auto &x : dp)
    {
        x.first = -1;
        x.second = -1;
    }
    dp[1] = DFS_tree(dp, 1, -1);
    cout << (dp[1].first + dp[1].second)%mod << endl;
    return 0;
}

Compiler output:
a.cc: In function 'std::pair<int, int> DFS_tree(std::vector<std::pair<int, int> >&, int, int)':
a.cc:25:40: error: too few arguments to function 'int mul(int, int)'
   25 |                 dp[vertex].first = (mul(dp[vertex].first * temp.first) + mul(dp[vertex].first * temp.second))%mod;
      |                                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:8:5: note: declared here
    8 | int mul(int a, int b) {
      |     ^~~
a.cc:25:77: error: too few arguments to function 'int mul(int, int)'
   25 |                 dp[vertex].first = (mul(dp[vertex].first * temp.first) + mul(dp[vertex].first * temp.second))%mod;
      |                                                                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:8:5: note: declared here
    8 | int mul(int a, int b) {
      |     ^~~
a.cc:26:40: error: too few arguments to function 'int mul(int, int)'
   26 |                 dp[vertex].second = mul(dp[vertex].second * temp.first);
      |                                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:8:5: note: declared here
    8 | int mul(int a, int b) {
      |     ^~~
Language: C++

#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int n;
vector<int> arr[100001];
const int mod = 1e9 + 7;
int mul(int a, int b) {
    return (ll) a * b % mod;
}
pair<int, int> DFS_tree(vector<pair<int, int>> &dp, int vertex, int parent)
{
    for (auto adj : arr[vertex])
    {
        if (adj != parent)
        {
            pair<int, int> temp = DFS_tree(dp, adj, vertex);
            if (dp[vertex].first == -1 && dp[vertex].second == -1)
            {   
                dp[vertex].first = (long long)(temp.first + temp.second)%mod;
                dp[vertex].second = temp.first;
            }
            else
            {
                dp[vertex].first = (mul(dp[vertex].first * temp.first) + mul(dp[vertex].first * temp.second))%mod;
                dp[vertex].second = mul(dp[vertex].second * temp.first);
            }
        }
    }
    if (dp[vertex].first == -1 && dp[vertex].second == -1){
      return make_pair(1,1);
    } 
    return dp[vertex];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    vector<pair<int, int>> dp(n + 1);

    for (int i = 0; i < n - 1; ++i)
    {
        int x;
        int y;
        cin >> x >> y;
        arr[x].push_back(y);
        arr[y].push_back(x);
    }
    for (auto &x : dp)
    {
        x.first = -1;
        x.second = -1;
    }
    dp[1] = DFS_tree(dp, 1, -1);
    cout << (dp[1].first + dp[1].second)%mod << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int mul(int, int)':
a.cc:9:13: error: 'll' was not declared in this scope
    9 |     return (ll) a * b % mod;
      |             ^~
a.cc:9:16: error: expected ';' before 'a'
    9 |     return (ll) a * b % mod;
      |                ^~
      |                ;
a.cc: In function 'std::pair<int, int> DFS_tree(std::vector<std::pair<int, int> >&, int, int)':
a.cc:25:40: error: too few arguments to function 'int mul(int, int)'
   25 |                 dp[vertex].first = (mul(dp[vertex].first * temp.first) + mul(dp[vertex].first * temp.second))%mod;
      |                                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:8:5: note: declared here
    8 | int mul(int a, int b) {
      |     ^~~
a.cc:25:77: error: too few arguments to function 'int mul(int, int)'
   25 |                 dp[vertex].first = (mul(dp[vertex].first * temp.first) + mul(dp[vertex].first * temp.second))%mod;
      |                                                                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:8:5: note: declared here
    8 | int mul(int a, int b) {
      |     ^~~
a.cc:26:40: error: too few arguments to function 'int mul(int, int)'
   26 |                 dp[vertex].second = mul(dp[vertex].second * temp.first);
      |                                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:8:5: note: declared here
    8 | int mul(int a, int b) {
      |     ^~~
Language: C++

#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int n;
vector<int> arr[100001];
const int MOD = 1e9+7
pair<int, int> DFS_tree(vector<pair<int, int>> &dp, int vertex, int parent)
{
    for (auto adj : arr[vertex])
    {
        if (adj != parent)
        {
            pair<int, int> temp = DFS_tree(dp, adj, vertex);
            if (dp[vertex].first == -1 && dp[vertex].second == -1)
            {
                dp[vertex].first = (temp.first + temp.second)%MOD;
                dp[vertex].second = temp.first%MOD;
            }
            else
            {
                dp[vertex].first = (dp[vertex].first%MOD * (temp.first + temp.second)%MOD)%MOD;
                dp[vertex].second = (dp[vertex].second%MOD * temp.first%MOD)%MOD;
            }
        }
    }
    if (dp[vertex].first == -1 && dp[vertex].second == -1){
      return make_pair(1,1);
    } 
    return dp[vertex];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    vector<pair<int, int>> dp(n + 1);

    for (int i = 0; i < n - 1; ++i)
    {
        int x;
        int y;
        cin >> x >> y;
        arr[x].push_back(y);
        arr[y].push_back(x);
    }
    for (auto &x : dp)
    {
        x.first = -1;
        x.second = -1;
    }
    dp[1] = DFS_tree(dp, 1, -1);
    cout << (dp[1].first + dp[1].second)%MOD << endl;
    return 0;
}

Compiler output:
a.cc:8:1: error: expected ',' or ';' before 'pair'
    8 | pair<int, int> DFS_tree(vector<pair<int, int>> &dp, int vertex, int parent)
      | ^~~~
a.cc: In function 'int main()':
a.cc:53:13: error: 'DFS_tree' was not declared in this scope
   53 |     dp[1] = DFS_tree(dp, 1, -1);
      |             ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
// #include <ext/pb_ds/tree_policy.hpp> 
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;
// using u128 = __uint128_t;
typedef long long ll;
typedef vector<int> vi;
// typedef vector<vi> vvi;
typedef vector<ll> vll;
// typedef vector<vi> vvll;
// typedef pair<ll,ll> ii;
// typedef vector<ii> vii;
// typedef vector<vector<pair<ll,ll>>> vvii;
// typedef long double ld;
// typedef vector<long double> vld;
// typedef vector<vector<long double>> vvld;
typedef vector<bool> vbl;
// typedef vector<vector<bool>> vvbl;
#define pb push_back
#define rep(x, n) for(int x = 0 ; x < n ; x++)
// #define rep1(x, n) for(int x = 1 ; x < n ; x++)
// #define rrep(x, n) for(int x = n ; x >= 0 ; x--)
// #define all(c) (c).begin() , (c).end()
// typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll MOD = 1e9 + 7;
vvi g;
ll n;
vbl visited;
vll f1, f2;

inline void dfs(int node, int parent=-1)
{
    for (auto child : g[node])
    {
        if (child == parent)
            continue;
        if (!visited[child])
            dfs(child, node);
        visited[child] = true;
        f1[node] = (f1[node] * (f1[child] + f2[child]) % MOD) % MOD;
        f2[node] = (f2[node] * f1[child]) % MOD;
    }
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    cin >> n;
    g.resize(n);
    visited.resize(n, false);
    f1.resize(n, 1);
    f2.resize(n, 1);
    ll a, b;
    rep(i,n - 1)        cin >> a >> b, a--, b--, g[a].pb(b), g[b].pb(a);
    dfs(0);
    cout << (f1[0] + f2[0]) % MOD << '\n';
    return 0;
}

Compiler output:
a.cc:27:1: error: 'vvi' does not name a type; did you mean 'vi'?
   27 | vvi g;
      | ^~~
      | vi
a.cc: In function 'void dfs(int, int)':
a.cc:34:23: error: 'g' was not declared in this scope
   34 |     for (auto child : g[node])
      |                       ^
a.cc: In function 'int main()':
a.cc:53:5: error: 'g' was not declared in this scope
   53 |     g.resize(n);
      |     ^
Language: C++

#include"stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define md 1000000007
#define pb push_back
#define pi pair<ll,ll>
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
ll min(ll a,ll b)
{
    if(a<b)
        return a;
    return b;
}
#define cases ll t;cin>>t;while(t--)
ll n;
vector<vector<ll> > adj(100005);
ll dp[100005][2];
bool visited[100005];
void dfs(ll u)
{
    visited[u]=true;
    ll white=1,pro=1,count=0;
    for(auto &i:adj[u])
    {
        if(!visited[i])
        {
            count=1;
            dfs(i);
            white=(white*dp[i][0])%md;
            pro=(pro*(dp[i][0]+dp[i][1]))%md;
        }
    }
    if(count==1)
    {
        dp[u][0]=pro;
        dp[u][1]=white;
    }
  	else
       dp[u][0]=dp[u][1]=1;
}
int main()
{
    memset(visited,false,sizeof(visited));
    cin>>n;
    for(int i=0;i<n-1;i++)
    {
        ll a,b;
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    dfs(1);
    cout<<dp[1][0]+dp[1][1]<<endl;
    return 0;
}


Compiler output:
a.cc:1:9: fatal error: stdc++.h: No such file or directory
    1 | #include"stdc++.h"
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int SIZE = 1e5 + 333;
const int MOD = 1e9 + 7;

vector <int> graf[SIZE];
bool vis[SIZE];
int dp[SIZE][2];

int n, a, b;

    void input(){
        cin >> n;
        for(int i = 1; i < n; i++){
            cin >> a >> b;
            graf[a].push_back(b);
            graf[b].push_back(a);
        }
    }

    void dfs(int start){
        vis[start] = true;
        for(auto it : graf[start])
            if(!vis[it]){
                dfs(it);
                dp[start][0] *= dp[it][0] + dp[it][1];
                dp[start][1] *= dp[it][0];
                dp[start][0] %= MOD;
                dp[start][1] %= MOD;
            }
    }
int main(){
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    input();

    for(int i = 0; i <= n; i++){
            dp[i][0] = 1;
            dp[i][1] = 1;
        }

    dfs(1);

    cout << (dp[1][0] + dp[1][1]) % MOD;
    return 0;

}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>

using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree < int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update >
#define smallk order_of_key
#define kth find_by_order
*/

#define nl '\n'
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define pb push_back

typedef long long ll;

const int N = (int)1e5 + 123;
const int M = 1e9 + 7;
const int K = 500;

int n;
vector<int> g[N];
long long dp[N][3];

int solve(int v, int t, int p){
    if(dp[v][t] != -1){
        return dp[v][t];
    }
    dp[v][t] = 1;
    for(int to : g[v]){
        if(to == p) continue;
        int cnt = 1;
        if(t == 1) cnt = solve(to, 2, v) % M;
        else cnt = (solve(to, 2, v)  + solve(to, 1, v)) % M;
        dp[v][t] *= cnt;
        d[v][t] %= M;
    }
    return dp[v][t] % M;
}
int main(){

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

    #ifdef LOCAL
        freopen("B.txt", "r", stdin);
    #endif // LOCAL

    cin >> n;
    for(int i = 1; i <= n; ++i){
        dp[i][1] = dp[i][2] = -1;
    }
    for(int i = 1, x, y; i < n; ++i){
        cin >> x >> y;
        g[x].pb(y);
        g[y].pb(x);
    }

    cout << (solve(1, 1, -1) + solve(1, 2, -1)) % M;
    return 0;
}



Compiler output:
a.cc: In function 'int solve(int, int, int)':
a.cc:42:9: error: 'd' was not declared in this scope
   42 |         d[v][t] %= M;
      |         ^
Language: Java

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class IndependentSetCorrectedCorrectedOne {

  static int MOD = 1000000007;
  static Map<Integer, List<Integer>> adjList;

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    adjList = new HashMap<>();
    int P;
    int Q;
    for (int i = 1; i < N; i++) {
      P = scanner.nextInt();
      Q = scanner.nextInt();
      List<Integer> orDefault = adjList.getOrDefault(P, new ArrayList<>());
      orDefault.add(Q);
      adjList.put(P, orDefault);
      orDefault = adjList.getOrDefault(Q, new ArrayList<>());
      orDefault.add(P);
      adjList.put(Q, orDefault);
    }
    int[] solve = solve(1, -1);
    System.out.println((solve[0] + solve[1]) % MOD);
  }

  private static int mul(int a, int b) {
    return ((a % MOD) * (b % MOD)) % MOD;
  }

  private static int[] solve(int node, int parent) {
    int allWhite = 1;
    int sthIsBlack = 0;
    if (adjList.containsKey(node)) {
      for (int child : adjList.get(node)) {
        if (child != parent) {
          int[] ways = solve(child, node);
          int memoWhite = allWhite;
          allWhite = mul(allWhite, ways[1]);
          sthIsBlack = (mul(memoWhite, ways[0]) + mul(sthIsBlack, ways[0] + ways[1])) % MOD;
        }
      }
    }
    return new int[] {allWhite, (allWhite + sthIsBlack) % MOD};
  }
}


Compiler output:
Main.java:7: error: class IndependentSetCorrectedCorrectedOne is public, should be declared in a file named IndependentSetCorrectedCorrectedOne.java
public class IndependentSetCorrectedCorrectedOne {
       ^
1 error
Language: Java

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

  static int MOD = 1000000007;
  static Map<Integer, List<Integer>> adjList;

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    adjList = new HashMap<>();
    int P;
    int Q;
    visited = new boolean[N + 1];
    for (int i = 1; i < N; i++) {
      P = scanner.nextInt();
      Q = scanner.nextInt();
      List<Integer> orDefault = adjList.getOrDefault(P, new ArrayList<>());
      orDefault.add(Q);
      adjList.put(P, orDefault);
      orDefault = adjList.getOrDefault(Q, new ArrayList<>());
      orDefault.add(P);
      adjList.put(Q, orDefault);
    }
    int[] solve = solve(1, -1);
    System.out.println((solve[0] + solve[1]) % MOD);
  }

  private static int[] solve(int node, int parent) {
    int allWhite = 1;
    int sthIsBlack = 0;
    if (adjList.containsKey(node)) {
      for (int child : adjList.get(node)) {
        if (child != parent) {
          int[] ways = solve(child, node);
          int memoWhite = allWhite;
          allWhite = ((allWhite % MOD) * (ways[1] % MOD)) % MOD;
          sthIsBlack =
              ((((memoWhite % MOD) * (ways[0] % MOD)) % MOD)
                  + ((sthIsBlack % MOD) * (ways[0] + ways[1]) % MOD) % MOD)%MOD;
        }
      }
    }
    return new int[] {allWhite, (allWhite + sthIsBlack) % MOD};
  }
}


Compiler output:
Main.java:18: error: cannot find symbol
    visited = new boolean[N + 1];
    ^
  symbol:   variable visited
  location: class Main
1 error
Language: Java

import java.io.*;
import java.util.*;
public class main {
	static List<Integer> adj[];
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
	
		int[][] dp = new int[n+1][2];
		//int n = Integer.parseInt(str.nextToken());
		// 0 is black 1 is white
		adj = new ArrayList[n+1];
		for(int i =1; i <= n; i++) adj[i] = new ArrayList();
		for(int i =0 ; i <n-1; i++)
		{
			StringTokenizer str = new StringTokenizer(br.readLine());
			int a = Integer.parseInt(str.nextToken());
			int b = Integer.parseInt(str.nextToken());
			adj[a].add(b);
			adj[b].add(a);
			
			
		}
		pair ans = dfs(1,-1);
		System.out.println((ans.getFirst()+ans.getSecond())%1000000007);
		
		
		
	}
	
	static pair dfs(int a, int parent)
	{
		long all_white = 1;
		long smthg_black = 0;
		for(int b: adj[a])
		{
			if(b != parent)
			{
				pair p = dfs(b, a);
				long memo = all_white;
				all_white = mul(all_white, p.getSecond());
				smthg_black =( mul(memo, p.getFirst()) + mul(smthg_black,p.getFirst() + p.getSecond()))%1000000007;
			}
		}
		return new pair(all_white, (all_white + smthg_black)%1000000007);
	}
	static long mul(long a, long l)
	{
		return (a*l)%1000000007;
	}

}
class pair
{
	long a, b;
	public pair(long a, long b)
	{
		this.a = a;
		this.b = b;
	}
	public long getFirst()
	{
		return this.a;
	}
	public long getSecond()
	{
		return this.b;
	}
}


Compiler output:
Main.java:3: error: class main is public, should be declared in a file named main.java
public class main {
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

include <bits/stdc++.h>
 
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define int long long
struct IoSetup {
IoSetup() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
cerr << fixed << setprecision(10);
}
}IoSetup;
static const signed int SMOD = 1000000007;
 
template<class T>bool chmax(T &a, const T&b){if(a<b)return(a=b,1);return 0;}
template<class T>bool chmin(T &a, const T&b){if(b<a)return(a=b,1);return 0;}
 
int n;
 
vector<int> edge[100100];
 
int dp[100100][5];
 
void dfs(int u, int pr) {
dp[u][0] = dp[u][1] = 1;
for(int i = 0; i < edge[u].size(); i++) {
int v = edge[u][i];
if(v == pr) continue;
dfs(v, u);
dp[u][0] = dp[u][0] * (dp[v][0]+dp[v][1]) % SMOD;
dp[u][1] = dp[u][1] * dp[v][0] % SMOD;
}
}
 
signed main() {
 
cin >> n;
 
for(int i = 0; i < n-1; i++) {
int a, b;
cin >> a >> b;
edge[a].bash(b);
edge[b].bash(a);
}
 
dfs(1, 0);
 
cout << (dp[1][0] + dp[1][1]) % SMOD << endl;
 
 
 
return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In constructor 'IoSetup::IoSetup()':
a.cc:11:1: error: 'cin' was not declared in this scope
   11 | cin.tie(0);
      | ^~~
a.cc:12:1: error: 'ios' has not been declared
   12 | ios::sync_with_stdio(false);
      | ^~~
a.cc:13:1: error: 'cout' was not declared in this scope
   13 | cout << fixed << setprecision(10);
      | ^~~~
a.cc:13:9: error: 'fixed' was not declared in this scope
   13 | cout << fixed << setprecision(10);
      |         ^~~~~
a.cc:13:18: error: 'setprecision' was not declared in this scope
   13 | cout << fixed << setprecision(10);
      |                  ^~~~~~~~~~~~
a.cc:14:1: error: 'cerr' was not declared in this scope
   14 | cerr << fixed << setprecision(10);
      | ^~~~
a.cc: At global scope:
a.cc:24:1: error: 'vector' does not name a type
   24 | vector<int> edge[100100];
      | ^~~~~~
a.cc: In function 'void dfs(long long int, long long int)':
a.cc:30:20: error: 'edge' was not declared in this scope
   30 | for(int i = 0; i < edge[u].size(); i++) {
      |                    ^~~~
a.cc: In function 'int main()':
a.cc:41:1: error: 'cin' was not declared in this scope
   41 | cin >> n;
      | ^~~
a.cc:46:1: error: 'edge' was not declared in this scope
   46 | edge[a].bash(b);
      | ^~~~
a.cc:52:1: error: 'cout' was not declared in this scope
   52 | cout << (dp[1][0] + dp[1][1]) % SMOD << endl;
      | ^~~~
a.cc:52:41: error: 'endl' was not declared in this scope
   52 | cout << (dp[1][0] + dp[1][1]) % SMOD << endl;
      |                                         ^~~~
Language: C++

//
//  ROIGold.cpp
//  Main calisma
//
//  Created by Rakhman on 05/02/2019.
//  Copyright © 2019 Rakhman. All rights reserved.
//
 
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>
 
#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define no_answer return cout << 0, 0;
#define FOR(i, start, finish, k) for(int i = start; i <= finish; i += k)
 
const int MXN = 1e7 + 200;
const long long MNN = 2e3 + 520;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const int OO = 1e9 + 500;
 
typedef long long llong;
typedef unsigned long long ullong;
 
using namespace std;

llong n;
vector<int> g[MXN];

void add(llong& a, llong b){
    a += b;
    //if(a < 0) a += MOD;
    while(a >= MOD) a -= MOD;
}

pair<llong, llong> dfs(int x, int p){
    llong all_white = 1, some_black = 1;
    for(int i = 0; i < g[x].size(); i++){
        int to = g[x][i];
        if(to == p) continue;
        pair<llong, llong> sinok = dfs(to, x);
        all_white = (all_white * sinok.F) % MOD;
        some_black = (some_black * (sinok.F + sinok.S) % MOD)) % MOD;
    }
    return {some_black, all_white};
}

int main () {
    ios;
    cin >> n;
    for(int i = 1; i < n; i++){
        int a, b;
        cin >> a >> b;
        g[a].pb(b);
        g[b].pb(a);
    }
    pair<llong, llong> ans = dfs(1, 0);
    cout << (ans.F + ans.S) % MOD;
}


Compiler output:
a.cc: In function 'std::pair<long long int, long long int> dfs(int, int)':
a.cc:70:62: error: expected ';' before ')' token
   70 |         some_black = (some_black * (sinok.F + sinok.S) % MOD)) % MOD;
      |                                                              ^
      |                                                              ;
Language: C++


from functools import lru_cache
import sys
sys.setrecursionlimit(10**9)


def len_max(mat):
    for i in range(len(mat)):
        if len(mat[i])>1:
            return i

n = int(input())
adj_mat =[[] for i in range(n)]



for i in range(n-1):
    a, b = [int(x) for x in input().strip().split()]
    adj_mat[a-1].append(b-1)
    adj_mat[b-1].append(a-1)

root = len_max(adj_mat) or 0


@lru_cache(None)
def cal(parent, node, col):

    nei = adj_mat[node]
    if len(nei)==1:
        if col=='w':
            return 2
        else:
            return 1 
    
    else:
        
        if col=='w':
            sb=1
            sw=1
            for k in nei:
                if k==parent:
                    continue
                sw*=cal(node, k, 'w')
                sb*=cal(node, k, 'b')
            return sb+sw

        else:
            sw=1
            for k in nei:
                if k==parent:
                    continue
                sw*=cal(node, k, 'w')
            return sw


ans = cal(None,root,'w')
if n==0:
    print(0)
elif n==1:
    print(2)
elif n==2:
    print(3)
else:
    print(ans)


Compiler output:
a.cc:25:1: error: stray '@' in program
   25 | @lru_cache(None)
      | ^
a.cc:2:1: error: 'from' does not name a type
    2 | from functools import lru_cache
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define mods 1000000007
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef long long int lint;
typedef unsigned long long int ulint;
list <lint> graph[100020];
lint hesap(lint a,lint b,lint ata);
lint n,k,dp[100020];
bool visit[100020];
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lint a,b,i,j,l,il;
    cin>>n;
    for(i=0;i<n-1;i++){
        cin>>a>>b;
        graph[a].pb(b);
        graph[b].pb(a);
        }
    cout<<hesap(1,0,0)+hesap(1,1,0);
    return 0;
}
lint hesap(lint a,lint b,lint ata){
    if(visit[i]==true) return dp[i];
    visit[i]==true;
    list <lint> :: iterator it;
    if(b==0){
        
        
        
    }else{
        
        
    }
    
    
    
    }

Compiler output:
a.cc: In function 'lint hesap(lint, lint, lint)':
a.cc:29:8: error: reference to 'visit' is ambiguous
   29 |     if(visit[i]==true) return dp[i];
      |        ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:13:6: note:                 'bool visit [100020]'
   13 | bool visit[100020];
      |      ^~~~~
a.cc:29:14: error: 'i' was not declared in this scope
   29 |     if(visit[i]==true) return dp[i];
      |              ^
a.cc:30:5: error: reference to 'visit' is ambiguous
   30 |     visit[i]==true;
      |     ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:13:6: note:                 'bool visit [100020]'
   13 | bool visit[100020];
      |      ^~~~~
a.cc:30:11: error: 'i' was not declared in this scope
   30 |     visit[i]==true;
      |           ^
Language: C

#include <stdio.h>

#define MAXN 100000
#define QQQ 1000000007

typedef unsigned long long ull;

typedef struct AAA {
  int cnt;
  int c[10000];
} NODE;

typedef struct BBB {
   ull b,w;
} DP;

NODE A[MAXN+1];
DP S[MAXN+1];

DP indset ( int no, int p )
{
  if ( S[no].w != -1 ) return S[no];

  ull i,b,w;
  DP tmp,ans;

  ans.w = ans.b = 1;
  for ( i = 0; i < A[no].cnt; i++ ) {
    if ( A[no].c[i] == p ) continue;
    tmp = indset(A[no].c[i], no);
    ans.b *= tmp.w;
    ans.b %= QQQ;
    ans.w *= (tmp.b+tmp.w);
    ans.w %= QQQ;
  }

  //printf("S[%d] = ans\n",no);

  return S[no] = ans;
}

int main(void)
{
  int n,i,x,y,j,maxno = 1;
  DP ans;

  scanf("%d", &n);

  for ( i = 0; i <= n; i++ ) {
    A[i].cnt = 0;
    S[i].w = -1;
  }
  for ( i = 0; i < n-1; i++  ){
    scanf("%d%d", &x,&y);
    A[x].c[A[x].cnt++] = y;
    A[y].c[A[y].cnt++] = x;
  }

  ans = indset(1,0);

  printf("%d\n",(ans.b+ans.w)%QQQ);
  return 0;
}


Compiler output:
/tmp/cc8blQsP.o: in function `indset':
main.c:(.text+0x1d): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/cc8blQsP.o
main.c:(.text+0x3a): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/cc8blQsP.o
main.c:(.text+0x18a): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/cc8blQsP.o
main.c:(.text+0x1ae): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/cc8blQsP.o
/tmp/cc8blQsP.o: in function `main':
main.c:(.text+0x21b): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/cc8blQsP.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

const int maxn = 11;
ModInt dp[maxn][2];

int n;
vector<vector<int>> graph;
vector<bool> visited;

/* 
木DP。
*/
void dfs(int i) {
    visited[i] = true;
    dp[i][0] = 1; dp[i][1] = 1;
    for(int j : graph[i]) {
        if (visited[j]) continue;
        dfs(j);
        dp[i][0] *= dp[j][0] + dp[j][1];
        dp[i][1] *= dp[j][0];
    }
    return;
}

int main() {
    cin >> n;
    graph.resize(n);
    visited.resize(n);
    rep(i, n-1) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    dfs(0);
    cout << dp[0][0] + dp[0][1] << endl;
    return 0;
}

Compiler output:
a.cc:7:1: error: 'ModInt' does not name a type
    7 | ModInt dp[maxn][2];
      | ^~~~~~
a.cc: In function 'void dfs(int)':
a.cc:18:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   18 |     dp[i][0] = 1; dp[i][1] = 1;
      |     ^~
      |     dup
a.cc: In function 'int main()':
a.cc:40:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   40 |     cout << dp[0][0] + dp[0][1] << endl;
      |             ^~
      |             dup