Language: C++

#include <iostream>
#Include <bits/stdc++.h>

using namespace std;

int par[100010];
int rank[100010];
   
void init( int n ){
  for(int i=0;i<n;i++){
    par[i] = i ;
    rank[i] = 0;
  }
}

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

void unite(int x , int 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]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}


int main(){
  
  init(100010);
  
  int n , m;
  
  int a[100010],b[100010],c[100010];
  
  cin >> n >> m;
  
  for(int i=0;i<m;i++){
    cin >> a[i] >> b[i] >> c[i];
    
    a[i]--;
    b[i]--:
    c[i]--;
  }
  
  for(int i=0;i<m;i++){
    unite(a[i] , b[i]);
  }
  
    set<int> se;
    
    for (int i = 0; i < n; ++i) se.insert(uf.root(i));
    
  }
  
cout << (int)se.size() << endl;
}

  
  

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #Include; did you mean #include?
    2 | #Include <bits/stdc++.h>
      |  ^~~~~~~
      |  include
a.cc: In function 'void init(int)':
a.cc:12:5: error: reference to 'rank' is ambiguous
   12 |     rank[i] = 0;
      |     ^~~~
In file included from /usr/include/c++/14/bits/move.h:37,
                 from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:5: note:                 'int rank [100010]'
    7 | int rank[100010];
      |     ^~~~
a.cc: In function 'void unite(int, int)':
a.cc:30:6: error: reference to 'rank' is ambiguous
   30 |   if(rank[x] < rank[y]){
      |      ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:5: note:                 'int rank [100010]'
    7 | int rank[100010];
      |     ^~~~
a.cc:30:16: error: reference to 'rank' is ambiguous
   30 |   if(rank[x] < rank[y]){
      |                ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:5: note:                 'int rank [100010]'
    7 | int rank[100010];
      |     ^~~~
a.cc:35:8: error: reference to 'rank' is ambiguous
   35 |     if(rank[x] == rank[y]) rank[x]++;
      |        ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:5: note:                 'int rank [100010]'
    7 | int rank[100010];
      |     ^~~~
a.cc:35:19: error: reference to 'rank' is ambiguous
   35 |     if(rank[x] == rank[y]) rank[x]++;
      |                   ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:5: note:                 'int rank [100010]'
    7 | int rank[100010];
      |     ^~~~
a.cc:35:28: error: reference to 'rank' is ambiguous
   35 |     if(rank[x] == rank[y]) rank[x]++;
      |                            ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:7:5: note:                 'int rank [100010]'
    7 | int rank[100010];
      |     ^~~~
a.cc: In function 'int main()':
a.cc:58:11: error: expected ';' before ':' token
   58 |     b[i]--:
      |           ^
      |           ;
a.cc:66:5: error: 'set' was not declared in this scope
   66 |     set<int> se;
      |     ^~~
a.cc:2:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    1 | #include <iostream>
  +++ |+#include <set>
    2 | #Include <bits/stdc++.h>
a.cc:66:9: error: expected primary-expression before 'int'
   66 |     set<int> se;
      |         ^~~
a.cc:68:33: error: 'se' was not declared in this scope
   68 |     for (int i = 0; i < n; ++i) se.insert(uf.root(i));
      |                                 ^~
a.cc:68:43: error: 'uf' was not declared in this scope
   68 |     for (int i = 0; i < n; ++i) se.insert(uf.root(i));
      |                                           ^~
a.cc: At global scope:
a.cc:72:1: error: 'cout' does not name a type
   72 | cout << (int)se.size() << endl;
      | ^~~~
a.cc:73:1: error: expected declaration before '}' token
   73 | }
      | ^