Language: C++

 
    ddfs(pos,u,start,res); //startは変化なし
  
  }
  
  return ;
}

  
signed main(void){ 
  
  cin >> N;
  to.resize(N);
  edges = vector<vector<int>> (N,vector<int>(N));
  
  for(int i = 1; i < N; i++){
    int a,b; cin >> a >> b; a--; b--;
    to[a].push_back(b); to[b].push_back(a);
  }
  
  dfs(-1LL,0LL);
  //ここまでOK
  
  for(int i = 0LL; i < N; i++){ 
    ddfs(-1LL,i,i,0LL);
  }
  
  //ここまでOK
  
  cin >> M; P.resize(M); //条件を列挙する
  
  for(int i = 0LL; i < M; i++){
    int u,v; cin >> u >> v; u--; v--;
    //uとvの間は少なくとも一つは黒で塗る必要がある
    P[i] = {u,v};
  }
   
  for(int bit = 1LL; bit < (1LL << M); bit++){
    //立ったbit全ての積を取って、包除原理を適用 i = 0,,,M-1はそれぞれの条件を使うか表す
    
    int value = 0LL;
    bool even = true;
    
    for(int i = 0; i < M; i++){
      if( (bit >> i) & 1LL ){  // P[i].firstとP[i].secondを結ぶ辺全てを記録
        even = !even;
        //i番目の条件に含まれている辺全てを追加
        value |= edges[P[i].first][P[i].second];
        
      }
    }
    //valueに含まれているbit全てを白で塗る必要がある
    
    int p = 0LL;
    
    for(int i = 0LL; i < N; i++){ //valueはNケタぐらいまではいく
      if( (value >> i) & 1LL ){ p++;}
    }
    
    int res = 0LL;
    
    if(!even){
      res += pow(2LL,N-1LL-p);
    }
    else{
      res -= pow(2LL,N-1LL-p);
    }
    
    sum += res;
    
  }
  
  cout << pow(2LL,N-1LL)-sum << endl;
  
  return 0;
}
  

Compiler output:
a.cc:2:9: error: expected constructor, destructor, or type conversion before '(' token
    2 |     ddfs(pos,u,start,res); //startは変化なし
      |         ^
a.cc:4:3: error: expected declaration before '}' token
    4 |   }
      |   ^
a.cc:6:3: error: expected unqualified-id before 'return'
    6 |   return ;
      |   ^~~~~~
a.cc:7:1: error: expected declaration before '}' token
    7 | }
      | ^
a.cc: In function 'int main()':
a.cc:12:3: error: 'cin' was not declared in this scope
   12 |   cin >> N;
      |   ^~~
a.cc:12:10: error: 'N' was not declared in this scope
   12 |   cin >> N;
      |          ^
a.cc:13:3: error: 'to' was not declared in this scope
   13 |   to.resize(N);
      |   ^~
a.cc:14:3: error: 'edges' was not declared in this scope
   14 |   edges = vector<vector<int>> (N,vector<int>(N));
      |   ^~~~~
a.cc:14:11: error: 'vector' was not declared in this scope
   14 |   edges = vector<vector<int>> (N,vector<int>(N));
      |           ^~~~~~
a.cc:14:25: error: expected primary-expression before 'int'
   14 |   edges = vector<vector<int>> (N,vector<int>(N));
      |                         ^~~
a.cc:21:3: error: 'dfs' was not declared in this scope
   21 |   dfs(-1LL,0LL);
      |   ^~~
a.cc:25:5: error: 'ddfs' was not declared in this scope
   25 |     ddfs(-1LL,i,i,0LL);
      |     ^~~~
a.cc:30:10: error: 'M' was not declared in this scope
   30 |   cin >> M; P.resize(M); //条件を列挙する
      |          ^
a.cc:30:13: error: 'P' was not declared in this scope
   30 |   cin >> M; P.resize(M); //条件を列挙する
      |             ^
a.cc:63:14: error: 'pow' was not declared in this scope
   63 |       res += pow(2LL,N-1LL-p);
      |              ^~~
a.cc:66:14: error: 'pow' was not declared in this scope
   66 |       res -= pow(2LL,N-1LL-p);
      |              ^~~
a.cc:69:5: error: 'sum' was not declared in this scope
   69 |     sum += res;
      |     ^~~
a.cc:73:3: error: 'cout' was not declared in this scope
   73 |   cout << pow(2LL,N-1LL)-sum << endl;
      |   ^~~~
a.cc:73:11: error: 'pow' was not declared in this scope
   73 |   cout << pow(2LL,N-1LL)-sum << endl;
      |           ^~~
a.cc:73:26: error: 'sum' was not declared in this scope
   73 |   cout << pow(2LL,N-1LL)-sum << endl;
      |                          ^~~
a.cc:73:33: error: 'endl' was not declared in this scope
   73 |   cout << pow(2LL,N-1LL)-sum << endl;
      |                                 ^~~~