Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long inf=2147483647;
const long long maxn=100005;
int n,m,c,f[maxn];
int find(x){if(x==f[x])return x;else return f[x]=find(f[x]);} 
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		f[i]=i;
	while(m--){
		int x,y,z;
		cin>>x>>y>>z;
		int fatherx=find(x);
		int fathery=find(y);
		if(fahterx!=fathery){
			f[fatherx]=fathery;
			c++;
		}
	}
	cout<<n-c<<endl;
	return 0; 
}

Compiler output:
a.cc:7:10: error: 'x' was not declared in this scope
    7 | int find(x){if(x==f[x])return x;else return f[x]=find(f[x]);}
      |          ^
a.cc: In function 'int main()':
a.cc:15:29: error: reference to 'find' is ambiguous
   15 |                 int fatherx=find(x);
      |                             ^~~~
In file included from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidates are: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:3842:5: note:                 'template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)'
 3842 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
a.cc:7:5: note:                 'int find'
    7 | int find(x){if(x==f[x])return x;else return f[x]=find(f[x]);}
      |     ^~~~
a.cc:16:29: error: reference to 'find' is ambiguous
   16 |                 int fathery=find(y);
      |                             ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidates are: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/14/bits/stl_algo.h:3842:5: note:                 'template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)'
 3842 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
a.cc:7:5: note:                 'int find'
    7 | int find(x){if(x==f[x])return x;else return f[x]=find(f[x]);}
      |     ^~~~
a.cc:17:20: error: 'fahterx' was not declared in this scope; did you mean 'fatherx'?
   17 |                 if(fahterx!=fathery){
      |                    ^~~~~~~
      |                    fatherx