Language: C++

nclude<bits/stdc++.h>
using namespace std;
#define mod 1000000007

vector<vector<int> >adjlist;
vector<bool>vis;
vector<vector<int> >dp; // dp(node,type) node with which type of root {type =0 (any) type=1 (white)}
 
int ways(int node,int type){
    if(dp[node][type]!=-1){
        return dp[node][type];
    }
    vis[node]=1;
    int ans;
    if(type==0){
        int w0=1;
        int w1=1;
        for(int i=0;i<adjlist[node].size();i++){
            int u = adjlist[node][i];
            if(vis[u]==0){
                w0 *= ways(u,0);
                w0 %=mod;
                w1 *= ways(u,1);
                w1 %=mod;
            }
        }
        ans  = (w0+w1)%mod;
    }else{
        int w1=1;
        for(int i=0;i<adjlist[node].size();i++){
            int u = adjlist[node][i];
            if(vis[u]==0){
                w1 *= ways(u,0);
                w1 %=mod;
            }
        }
 
        ans = w1;
    }
    vis[node]=0;
    return dp[node][type] =ans;
}
void solve(){
    int n;cin>>n;
    adjlist.resize(n);
    vis.resize(n,0);
    dp.resize(n,vector<int>(2,-1));
    for(int i=0;i<n-1;i++){
        int a,b;cin>>a>>b;
        adjlist[a-1].push_back(b-1);
        adjlist[b-1].push_back(a-1);
    }
    cout << ways(0,0)<<"\n";
}
 
int main(){
    cin.tie(0);
    cout.tie(0);
    cin.sync_with_stdio(0);
    cout.sync_with_stdio(0);
 
    cout.precision(10);
    int t=1;//cin>>t;
    while(t--){
 
        solve();
    }
    return 0;
}

Compiler output:
a.cc:1:1: error: 'nclude' does not name a type
    1 | nclude<bits/stdc++.h>
      | ^~~~~~
a.cc:5:1: error: 'vector' does not name a type
    5 | vector<vector<int> >adjlist;
      | ^~~~~~
a.cc:6:1: error: 'vector' does not name a type
    6 | vector<bool>vis;
      | ^~~~~~
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<vector<int> >dp; // dp(node,type) node with which type of root {type =0 (any) type=1 (white)}
      | ^~~~~~
a.cc: In function 'int ways(int, int)':
a.cc:10:8: error: 'dp' was not declared in this scope
   10 |     if(dp[node][type]!=-1){
      |        ^~
a.cc:13:5: error: 'vis' was not declared in this scope
   13 |     vis[node]=1;
      |     ^~~
a.cc:18:23: error: 'adjlist' was not declared in this scope
   18 |         for(int i=0;i<adjlist[node].size();i++){
      |                       ^~~~~~~
a.cc:30:23: error: 'adjlist' was not declared in this scope
   30 |         for(int i=0;i<adjlist[node].size();i++){
      |                       ^~~~~~~
a.cc:41:12: error: 'dp' was not declared in this scope
   41 |     return dp[node][type] =ans;
      |            ^~
a.cc: In function 'void solve()':
a.cc:44:11: error: 'cin' was not declared in this scope
   44 |     int n;cin>>n;
      |           ^~~
a.cc:45:5: error: 'adjlist' was not declared in this scope
   45 |     adjlist.resize(n);
      |     ^~~~~~~
a.cc:46:5: error: 'vis' was not declared in this scope
   46 |     vis.resize(n,0);
      |     ^~~
a.cc:47:5: error: 'dp' was not declared in this scope
   47 |     dp.resize(n,vector<int>(2,-1));
      |     ^~
a.cc:47:17: error: 'vector' was not declared in this scope
   47 |     dp.resize(n,vector<int>(2,-1));
      |                 ^~~~~~
a.cc:47:24: error: expected primary-expression before 'int'
   47 |     dp.resize(n,vector<int>(2,-1));
      |                        ^~~
a.cc:53:5: error: 'cout' was not declared in this scope
   53 |     cout << ways(0,0)<<"\n";
      |     ^~~~
a.cc: In function 'int main()':
a.cc:57:5: error: 'cin' was not declared in this scope
   57 |     cin.tie(0);
      |     ^~~
a.cc:58:5: error: 'cout' was not declared in this scope
   58 |     cout.tie(0);
      |     ^~~~