Language: C++

int main()
{
	int N, K, L;
	cin >> N >> K >> L;
/*	vector<int> pre_road(N + 1);
	vector<int> pre_railway(N + 1);
	for (int i = 1; i <= N; i++)
	{
		pre_road[i] = i;
		pre_railway[i] = i;
	}*/
	unordered_map<int, unordered_set<int>>	roads;
	unordered_map<int, unordered_set<int>>	railways;
	for (int i = 0; i < K; i++)
	{
		int a, b;
		cin >> a >> b;
		for (auto t : roads[a])
		{
			roads[b].insert(t);
			roads[t].insert(b);
		}
		for (auto t : roads[b])
		{ 
			roads[a].insert(t);
			roads[t].insert(a);
		}
		roads[a].insert(b);
		roads[b].insert(a);
	}
	//BuildCon(roads, N);
	for (int i = 0; i < L; i++)
	{
		int a, b;
		cin >> a >> b;
		for (auto t : railways[a])
		{
			railways[b].insert(t);
			railways[t].insert(b);
		}
		for (auto t : railways[b])
		{ 
			railways[a].insert(t);
			railways[t].insert(a);
		}
		railways[a].insert(b);
		railways[b].insert(a);
	}
	//BuildCon(railways, N);
	for (int i = 1; i <= N; i++)
	{
		roads[i].insert(i);
		railways[i].insert(i);
		int count = 0;
		for (auto t : roads[i])
		{
			if (railways[i].find(t) != railways[i].end())
				count++;
		}
		cout << count;
		if (i != N)
			cout << " ";
		else
			cout << endl;
	}
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin >> N >> K >> L;
      |         ^~~
a.cc:12:9: error: 'unordered_map' was not declared in this scope
   12 |         unordered_map<int, unordered_set<int>>  roads;
      |         ^~~~~~~~~~~~~
a.cc:12:23: error: expected primary-expression before 'int'
   12 |         unordered_map<int, unordered_set<int>>  roads;
      |                       ^~~
a.cc:13:23: error: expected primary-expression before 'int'
   13 |         unordered_map<int, unordered_set<int>>  railways;
      |                       ^~~
a.cc:18:31: error: 'roads' was not declared in this scope
   18 |                 for (auto t : roads[a])
      |                               ^~~~~
a.cc:23:31: error: 'roads' was not declared in this scope
   23 |                 for (auto t : roads[b])
      |                               ^~~~~
a.cc:28:17: error: 'roads' was not declared in this scope
   28 |                 roads[a].insert(b);
      |                 ^~~~~
a.cc:36:31: error: 'railways' was not declared in this scope
   36 |                 for (auto t : railways[a])
      |                               ^~~~~~~~
a.cc:41:31: error: 'railways' was not declared in this scope
   41 |                 for (auto t : railways[b])
      |                               ^~~~~~~~
a.cc:46:17: error: 'railways' was not declared in this scope
   46 |                 railways[a].insert(b);
      |                 ^~~~~~~~
a.cc:52:17: error: 'roads' was not declared in this scope
   52 |                 roads[i].insert(i);
      |                 ^~~~~
a.cc:53:17: error: 'railways' was not declared in this scope
   53 |                 railways[i].insert(i);
      |                 ^~~~~~~~
a.cc:60:17: error: 'cout' was not declared in this scope; did you mean 'count'?
   60 |                 cout << count;
      |                 ^~~~
      |                 count
a.cc:64:33: error: 'endl' was not declared in this scope
   64 |                         cout << endl;
      |                                 ^~~~