Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<climits> //INT_MIN/MAX

typedef int long long;
using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(e);(i)++)
#define FORR(i,s,e) for(int (i)=(s);(i)>(e);(i)--)
#define MOD 1000000007
#define llong long long
#define debug(x) cout<<#x<<": "<<x<<endl
#define non -1
llong n;

int color1[200001];
int color2[200001];
vector<int> G1[200001];
vector<int> G2[200001];
llong City[200001];

void dfs1(int r, int c, int color[200001], vector<int> G[200001]) {//r
    stack<int>S;
    S.push(r);
    color[r] = c;
    while (!S.empty()) {
        int u = S.top();
        S.pop();

        FOR(i, 0, G[u].size()) {
            int v = G[u][i];
            if (color[v] == non) {
                color[v] = c;
                S.push(v);
            }
        }
    }
}




void assigncolor1(int color[200001], vector<int>G[200001]) {
    int id = 1;
    FOR(i, 1, n + 1)
        color[i] = non;
    FOR(u, 1, n + 1) {
        if (color[u] == non)
            dfs1(u, id++, color, G);
    }
}





signed main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int k, l;
    cin >> n >> k >> l;


    bool visit1[200001];
    bool visit2[200001];
    bool CityP[200001];


    FOR(i, 1, n+1) {
        visit1[i] = false;
        visit2[i] = false;
        City[i] = 1;
        CityP[i] = false;
        color1[i] = non;
        color2[i] = non;
    }
     

    FOR(i, 0, k) {
        int s, t;
        cin >> s >> t;
        G1[s].push_back(t);
        G1[t].push_back(s);

    }


    FOR(i, 0, l) {
        int s, t;
        cin >> s >> t;
        G2[s].push_back(t);
        G2[t].push_back(s);

    }

    assigncolor1(color1, G1);
  /*  
    FOR(i, 1, n + 1) {
        cout << "color1 : v" << i << ": " << color1[i] << endl;
    }*/

    assigncolor1(color2, G2);
    
    /*FOR(i, 1, n + 1) {
        cout << "color2 : v" << i << ": " << color2[i] << endl;
    }
*/
  FOR(v, 1, n + 1) {
        if (visit1[v] == true)continue;
        int count = 1;
        queue<int >Q;
        queue<int >Q2;

        Q.push(v);
        Q2.push(v);

        while (!Q.empty()) {
            int u = Q.front();
            Q.pop();
            visit1[u] = true;
            FOR(i, 0, G2[u].size()) {
                int p = G2[u][i];
                if(visit1[p]==false)
                if (color1[u]==color1[p]&&color2[u]==color2[p]) {
                    count++;

                /*  debug(count);
                    debug(u);
                    debug(p);
*/
                    Q.push(p);
                    Q2.push(p);
                    visit1[p] = true;
                }
            }
        }

        while (!Q2.empty()) {
            int u = Q2.front();
            Q2.pop();
            City[u] = count;
        }

    }



    FOR(i, 1, n) {

        cout << City[i] << " ";

    }
    cout << City[n] << endl;


    return 0;
}


Compiler output:
a.cc:14:18: error: declaration does not declare anything [-fpermissive]
   14 | typedef int long long;
      |                  ^~~~