/in/foo.cc: In function 'void add(int, int)':
/in/foo.cc:13:22: error: reference to 'next' is ambiguous
tot++; a[tot]=y; next[tot]=p[x]; p[x]=tot;
^~~~
/in/foo.cc:8:15: note: candidates are: int next [100010]
int a[100010],next[100010],p[50010],tot;
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from /in/foo.cc:2:
/usr/include/c++/6/bits/stl_iterator_base_funcs.h:205:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
next(_ForwardIterator __x, typename
^~~~
/in/foo.cc: In function 'void dfs(int, int)':
/in/foo.cc:24:11: error: reference to 'next' is ambiguous
u=next[u];
^~~~
/in/foo.cc:8:15: note: candidates are: int next [100010]
int a[100010],next[100010],p[50010],tot;
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from /in/foo.cc:2:
/usr/include/c++/6/bits/stl_iterator_base_funcs.h:205:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
next(_ForwardIterator __x, typename
^~~~
/in/foo.cc: In function 'int main()':
/in/foo.cc:31:11: warning: unused variable 'j' [-Wunused-variable]
int i,j;
^