Language: C++

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

struct Edge {
	int to, id;
	Edge(int id, to) :to(to), id(id) {}
};

vector<Edge> esets[55];

vector<int> es;
int dfs(int st, int to, int prev = -1) {
	if (st == to) return true;
	for(Edge e : esets[st]) {
		if (prev == e.to) continue;
		if ( dfs(e.to, to, st) == true) {
			es.push_back(e.id);
			return true;
		}
	}
	return false;
}


int main(void) {
	int n,m;
	cin >> n;
	rep(i, n-1) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		esets[a].emplacement_back(b, i);
		esets[b].emplacement_back(a, i);
	}
	
	cin >> m;
	vector<ll> combination;	// 各条件を白線が有効な場合にbitを立てている	rep(i, m) {
		int a, b;
		cin >> a >> b;
		es.clear();	// es = vector<int>()
		--a;
		--b;
		dfs(a, b);
		for(int id : es) {
			combination[i] = combination[i] | 1ll<<id;
		}
	}
	
	ll answer = 0;
	int counter;
	rep(i, 1<<m) {
		ll mask = 0;
		rep(i,m) {
			if (((m>>i)&1)==1) mask |= combination[i];
		}
		int counter = __builtin_popcountll(mask);
		ll now = 1ll << (n-1-counter);
		if (i%2==1) answer -= now;
		else answer += now;
		
	}
	
	cout >> answer >> endl;
	
	return 0;
	
}


Compiler output:
a.cc:9:22: error: 'to' is not a type
    9 |         Edge(int id, to) :to(to), id(id) {}
      |                      ^~
a.cc: In function 'int main()':
a.cc:36:26: error: 'class std::vector<Edge>' has no member named 'emplacement_back'; did you mean 'emplace_back'?
   36 |                 esets[a].emplacement_back(b, i);
      |                          ^~~~~~~~~~~~~~~~
      |                          emplace_back
a.cc:37:26: error: 'class std::vector<Edge>' has no member named 'emplacement_back'; did you mean 'emplace_back'?
   37 |                 esets[b].emplacement_back(a, i);
      |                          ^~~~~~~~~~~~~~~~
      |                          emplace_back
a.cc:49:37: error: 'i' was not declared in this scope; did you mean 'id'?
   49 |                         combination[i] = combination[i] | 1ll<<id;
      |                                     ^
      |                                     id
a.cc: At global scope:
a.cc:3:18: error: expected unqualified-id before 'for'
    3 | #define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
      |                  ^~~
a.cc:55:9: note: in expansion of macro 'rep'
   55 |         rep(i, 1<<m) {
      |         ^~~
a.cc:3:39: error: expected constructor, destructor, or type conversion before '<' token
    3 | #define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
      |                                       ^
a.cc:55:9: note: in expansion of macro 'rep'
   55 |         rep(i, 1<<m) {
      |         ^~~
a.cc:3:46: error: expected unqualified-id before '++' token
    3 | #define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
      |                                              ^~
a.cc:55:9: note: in expansion of macro 'rep'
   55 |         rep(i, 1<<m) {
      |         ^~~
a.cc:67:9: error: 'cout' does not name a type
   67 |         cout >> answer >> endl;
      |         ^~~~
a.cc:69:9: error: expected unqualified-id before 'return'
   69 |         return 0;
      |         ^~~~~~
a.cc:71:1: error: expected declaration before '}' token
   71 | }
      | ^