Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for (long i=0;i<(n);i++)
#define FOR(i,a,b) for (long i=(a);i<(b);i++)
#define RREP(i,n) for(long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl;
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl;
#define dump(x)  cerr << #x << " => " << (x) << endl;
#define CLR(vec) { REP(i,vec.size()) vec[i] = 0; } 
#define llINF (long long) 9223372036854775807
#define loINF (long) 2147483647
#define shINF (short) 32767
#define SORT(c) sort((c).begin(),(c).end())
#define MIN(vec) *min_element(vec.begin(), vec.end());
#define MAX(vec) *max_element(vec.begin(), vec.end());
#define IN(n,m)  (!(m.find(n) == m.end()))
#define TO_INT(vec,s) REP(i,s.length()){vec.push_back(s[i] - ‘0’);}

using namespace std;
typedef vector<long> VI;
typedef vector<VI> VVI;
typedef map<long,long> mp;

class Union_Find {
private:
    vector<unsigned> par;    // par[x] : x の親ノード
    vector<unsigned> rank;   // rank[x] : 木の高さ
    size_t sz;             // 集合の個数
public:   
    // コンストラクタ : 空
    Union_Find() : sz(0) { }

    // コンストラクタ : 1 要素の集合 n 個
    Union_Find(size_t n) :
        par(n, -1), rank(n, 0), sz(n) {
        for (size_t i = 0; i < n; i++) par[i] = i;
    }

    size_t size() { return sz; }

    // 集合の追加 : 1 個
    void add_node() {
        par.push_back(par.size());
        rank.push_back(0);
        sz++;
    }
    // 集合の追加 : n 個
    void add_node(size_t n) {
        for (size_t i = 0; i < n; i++) add_node();
    }

    // x が属する集合の代表元を返す
    size_t find(size_t x) {
        if (par[x] == x)
            return x;
        else
            return par[x] = find(par[x]);
    }

    // x が属する集合と y が属する集合をマージする
    void unite(size_t x, size_t y) {
        x = find(x);
        y = find(y);
        if (x == y) return;

        if (rank[x] < rank[y])
            par[x] = y;
        else {
            par[y] = x;
            if (rank[x] == rank[y]) rank[x]++;
        }
        sz--;
    }
    // x と y が同じ集合に属しているか？
    bool same(size_t x, size_t y) {
        return find(x) == find(y);
    }
    
    void dump_par(void){
        dump1d_arr(par);
    }

    void dump_rank(void){
        dump1d_arr(rank);
    }
};
int main(void){
    long N,K,L;
    long p,q;
    mp group;
    cin >> N >> K >> L;
    Union_Find uf(N);
    Union_Find uf2(N);
    VI par(N);
    REP(i,K){
        cin >> p >> q;
        uf.unite(p-1,q-1);
    }
    REP(i,L){
        cin >> p >> q;
        if (uf.same(p-1,q-1)) uf2.unite(p-1,q-1);
    }
    REP(i,N){
        par[i] = uf2.find(i);
        if (IN(par[i],group)) group[par[i]]++;
        else group[par[i]] = 1;
    }
    
    REP(i,N) cout << group[par[i]] << " "
    cout << "\n";

    return 0;
}

Compiler output:
a.cc:17:62: error: extended character ‘ is not valid in an identifier
   17 | #define TO_INT(vec,s) REP(i,s.length()){vec.push_back(s[i] - ‘0’);}
      |                                                              ^
a.cc:17:62: error: extended character ’ is not valid in an identifier
a.cc: In function 'int main()':
a.cc:109:42: error: expected ';' before 'cout'
  109 |     REP(i,N) cout << group[par[i]] << " "
      |                                          ^
      |                                          ;
  110 |     cout << "\n";
      |     ~~~~