/in/foo.cc: In function 'void add(int, int)':
/in/foo.cc:11:15: error: reference to 'next' is ambiguous
to[cnt]=b,next[cnt]=head[a],head[a]=cnt++;
^~~~
/in/foo.cc:7:17: note: candidates are: int next [20020]
int to[maxn<<1],next[maxn<<1],head[maxn],d[maxn];
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/algorithm:61,
from /in/foo.cc:3:
/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:27:27: error: reference to 'next' is ambiguous
for(i=head[x];i!=-1;i=next[i]) if(to[i]!=fa) dfs(to[i],x);
^~~~
/in/foo.cc:7:17: note: candidates are: int next [20020]
int to[maxn<<1],next[maxn<<1],head[maxn],d[maxn];
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/algorithm:61,
from /in/foo.cc:3:
/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:28:31: error: reference to 'next' is ambiguous
for(m=0,i=head[x];i!=-1;i=next[i]) if(to[i]!=fa) g[++m]=f[to[i]]+1;
^~~~
/in/foo.cc:7:17: note: candidates are: int next [20020]
int to[maxn<<1],next[maxn<<1],head[maxn],d[maxn];
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/algorithm:61,
from /in/foo.cc:3:
/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
^~~~