Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp;
inline int read(){
	char c=getchar();
	int x=0;
	for(;c>'9'||c<'0';) c=getchar();
	for(;c>='0'&&c<='9';){
		x=(x<<3)+(x<<1)+c-'0';
		c=getchar();
		return x;
	}
}
void add(int x,int y){
	cnt++;
	e[cnt]=y;
	next[cnt]=last[x];
	last[x]=cnt;
}
void dfs(int u,int f){
	int i,v;
	fa[u]=f;
	size[u]=1;
	for(i=last[u];i;i=next[i]){
		v=e[i];
		if(v!=f){
			dfs(v,u);
			size[u]+=size[v];
		}
	}
}
int main(){
	n=read();
	for(int i=1;i<n;i++){
		a=read(),b=read();
		add(a,b);add(b,a);
	}
	dfs(1,0);
	tmp=n;
	while(tmp!=1) tmp=fa[tmp],tot++;
	tot--,tmp=0,a=n;
	while(tmp<tot/2) a=fa[a],tmp++;
	b=fa[a];
	dfs(a,0);
	sum1=size[b];sum2=n-sum1;
	if(sum1>sum2) puts("Fennec");
	else puts("Snuke");
	return 0;
}

Compiler output:
a.cc: In function 'void add(int, int)':
a.cc:18:9: error: reference to 'next' is ambiguous
   18 |         next[cnt]=last[x];
      |         ^~~~
In file included from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:4:81: note:                 'int next [400005]'
    4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp;
      |                                                                                 ^~~~
a.cc: In function 'void dfs(int, int)':
a.cc:24:9: error: reference to 'size' is ambiguous
   24 |         size[u]=1;
      |         ^~~~
In file included from /usr/include/c++/14/string:53:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:4:14: note:                 'int size [400005]'
    4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp;
      |              ^~~~
a.cc:25:27: error: reference to 'next' is ambiguous
   25 |         for(i=last[u];i;i=next[i]){
      |                           ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:4:81: note:                 'int next [400005]'
    4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp;
      |                                                                                 ^~~~
a.cc:29:25: error: reference to 'size' is ambiguous
   29 |                         size[u]+=size[v];
      |                         ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:4:14: note:                 'int size [400005]'
    4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp;
      |              ^~~~
a.cc:29:34: error: reference to 'size' is ambiguous
   29 |                         size[u]+=size[v];
      |                                  ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:4:14: note:                 'int size [400005]'
    4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp;
      |              ^~~~
a.cc: In function 'int main()':
a.cc:46:14: error: reference to 'size' is ambiguous
   46 |         sum1=size[b];sum2=n-sum1;
      |              ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:4:14: note:                 'int size [400005]'
    4 | int n,a,b,rt,size[400005],fa[400005],tot=0,sum1,sum2,cnt,e[400005],last[400005],next[400005],tmp;
      |              ^~~~
a.cc: In function 'int read()':
a.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type]
   14 | }
      | ^