/in/foo.cc: In function 'int findroot(int)':
/in/foo.cc:12:67: error: no matching function for call to 'find(int&)'
{ if (fa[x]==x) return x; else { fa[x]=find(fa[x]); return fa[x]; }
^
In file included from /usr/include/c++/6/bits/locale_facets.h:48:0,
from /usr/include/c++/6/bits/basic_ios.h:37,
from /usr/include/c++/6/ios:44,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from /in/foo.cc:1:
/usr/include/c++/6/bits/streambuf_iterator.h:369:5: note: candidate: template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&)
find(istreambuf_iterator<_CharT> __first,
^~~~
/usr/include/c++/6/bits/streambuf_iterator.h:369:5: note: template argument deduction/substitution failed:
/in/foo.cc:12:67: note: mismatched types 'std::istreambuf_iterator<_CharT>' and 'int'
{ if (fa[x]==x) return x; else { fa[x]=find(fa[x]); return fa[x]; }
^
In file included from /usr/include/c++/6/algorithm:62:0,
from /in/foo.cc:2:
/usr/include/c++/6/bits/stl_algo.h:3784:5: note: candidate: template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)
find(_InputIterator __first, _InputIterator __last,
^~~~
/usr/include/c++/6/bits/stl_algo.h:3784:5: note: template argument deduction/substitution failed:
/in/foo.cc:12:67: note: candidate expects 3 arguments, 1 provided
{ if (fa[x]==x) return x; else { fa[x]=find(fa[x]); return fa[x]; }
^