Language: C

// #include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0; i < n; i++)
#define REPR(i, n) for(long long i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(long long i = m; i <= n; i++)
#define FORR(i, m, n) for(long long i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;

struct UnionFind {
    vector<int> par; 

    UnionFind(int N) : par(N) { 
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { 
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x); 
        int ry = root(y); 
        if (rx == ry) return; 
        par[rx] = ry; 
    }

    bool same(int x, int y) { 
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){FIN

    int n,m;cin>>n>>m;
    UnionFind tree(n);
    REP(i,m){
        int x,y,z; cin>>x>>y>>z;
        tree.unite(x,y);
    }
    set<int> st;
    REP(i,n){
        st.insert(tree.root(i+1));
    }   
    cout<<st.size()<<endl;
    return 0;
}

Compiler output:
main.c:11:1: error: unknown type name 'using'
   11 | using namespace std;
      | ^~~~~
main.c:11:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
   11 | using namespace std;
      |                 ^~~
main.c:12:1: error: unknown type name 'using'
   12 | using ll = long long;
      | ^~~~~
main.c:12:12: error: expected expression before 'long'
   12 | using ll = long long;
      |            ^~~~
main.c:13:1: error: unknown type name 'using'
   13 | using vll = vector<ll>;
      | ^~~~~
main.c:13:13: error: 'vector' undeclared here (not in a function)
   13 | using vll = vector<ll>;
      |             ^~~~~~
main.c:13:23: error: expected expression before ';' token
   13 | using vll = vector<ll>;
      |                       ^
main.c:14:1: error: unknown type name 'using'
   14 | using vvll = vector<vector<ll>>;
      | ^~~~~
main.c:15:1: error: unknown type name 'using'
   15 | using P = pair<ll, ll>;
      | ^~~~~
main.c:15:11: error: 'pair' undeclared here (not in a function)
   15 | using P = pair<ll, ll>;
      |           ^~~~
main.c:15:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '>' token
   15 | using P = pair<ll, ll>;
      |                      ^
main.c:16:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'mod'
   16 | const ll mod = 1e9+7;
      |          ^~~
main.c:19:5: error: expected specifier-qualifier-list before 'vector'
   19 |     vector<int> par;
      |     ^~~~~~
main.c: In function 'main':
main.c:10:13: error: 'ios_base' undeclared (first use in this function)
   10 | #define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
      |             ^~~~~~~~
main.c:44:12: note: in expansion of macro 'FIN'
   44 | int main(){FIN
      |            ^~~
main.c:10:13: note: each undeclared identifier is reported only once for each function it appears in
   10 | #define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
      |             ^~~~~~~~
main.c:44:12: note: in expansion of macro 'FIN'
   44 | int main(){FIN
      |            ^~~
main.c:10:21: error: expected ';' before '::' token
   10 | #define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
      |                     ^~
main.c:44:12: note: in expansion of macro 'FIN'
   44 | int main(){FIN
      |            ^~~
main.c:10:47: error: 'cin' undeclared (first use in this function)
   10 | #define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
      |                                               ^~~
main.c:44:12: note: in expansion of macro 'FIN'
   44 | int main(){FIN
      |            ^~~
main.c:10:59: error: 'cout' undeclared (first use in this function)
   10 | #define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
      |                                                           ^~~~
main.c:44:12: note: in expansion of macro 'FIN'
   44 | int main(){FIN
      |            ^~~
main.c:47:5: error: unknown type name 'UnionFind'; use 'struct' keyword to refer to the type
   47 |     UnionFind tree(n);
      |     ^~~~~~~~~
      |     struct 
main.c:47:5: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
main.c:50:13: error: request for member 'unite' in something not a structure or union
   50 |         tree.unite(x,y);
      |             ^
main.c:52:5: error: 'set' undeclared (first use in this function)
   52 |     set<int> st;
      |     ^~~
main.c:52:9: error: expected expression before 'int'
   52 |     set<int> st;
      |         ^~~
main.c:54:9: error: 'st' undeclared (first use in this function)
   54 |         st.insert(tree.root(i+1));
      |         ^~
main.c:54:23: error: request for member 'root' in something not a structure or union
   54 |         st.insert(tree.root(i+1));
      |                       ^
main.c:56:22: error: 'endl' undeclared (first use in this function)
   56 |     cout<<st.size()<<endl;
      |                      ^~~~