Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort
#include <math.h>

#define DEBUG 0

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll mod = 1000000007;
static const ll INF = 1000000000000000000LL;
                    //999999997000000003
                    //1000000000000000000

using namespace std;

//2-1-4-7-5
//  |
//  3-6

//これが想像できていない
//1-2-3-7
//  |
//  5-6-4

//d[0][N-1]の距離をはかる(閉路がないため、一通り)
//先行の方が先に使える
//あまりの数

int main(){
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;

    vector <vector <int>> G(N);

    REP(i,N-1)
    {
        int a, b;
        cin >> a >> b;
        --a;--b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    //0からの最短経路と最短経路でNを使用するか
    vector <pair<int, int> > d(N);
    vector <int> prev(N);
    vector <int> guard(N);
    REP(i,N)
    {
        d[i].first = N+100;
        d[i].second = 0;
    }

    d[0].first = 0;
    d[N-1].second = 1;

    //0からN-1を経由して到達できる箇所を調べる
    queue <int> que;
    que.push(0);
    int from, to;
    while(!que.empty())
    {
        from = que.front();
        que.pop();

        for(int i = 0; i < G[from].size(); ++i)
        {
            to = G[from][i];
            if(d[from].first + 1 < d[to].first)
            {
                d[to].first = d[from].first + 1;
                //Nは上書きしてはいけない
                if(to != N-1)d[to].second = d[from].second;
                prev[to] = from;
                que.push(to);
            }
        }
    }

    //snukeは Nから1に向かって、(d[N-1] - 1) / 2回移動できる
    int pos = N;
    REP(i, (d[N-1] - 1) / 2)
    {
        pos = prev[pos];
        guard[pos] = 1;
    }

    int fen = 0;
    que.push(0);
    int from, to;
    while(!que.empty())
    {
        from = que.front();
        que.pop();

        for(int i = 0; i < G[from].size(); ++i)
        {
            to = G[from][i];
            if(guard[to] == 1)continue;
            guard[to] = 1;
            ++fen;
            que.push(to);
        }
    }

    string res;
    if( fen > (N - 2) / 2 )
    {   
        res = "Fennec";
    }
    else
    {
        res = "Snuke";
    }

    cout << res << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:90:20: error: no match for 'operator-' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int')
   90 |     REP(i, (d[N-1] - 1) / 2)
a.cc:11:46: note: in definition of macro 'REP'
   11 | #define REP(i, n) for (long long i = 0; i < (n); i++)
      |                                              ^
In file included from /usr/include/c++/14/string:48,
                 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.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:90:22: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::reverse_iterator<_Iterator>'
   90 |     REP(i, (d[N-1] - 1) / 2)
      |                      ^
a.cc:11:46: note: in definition of macro 'REP'
   11 | #define REP(i, n) for (long long i = 0; i < (n); i++)
      |                                              ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:90:22: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::move_iterator<_IteratorL>'
   90 |     REP(i, (d[N-1] - 1) / 2)
      |                      ^
a.cc:11:46: note: in definition of macro 'REP'
   11 | #define REP(i, n) for (long long i = 0; i < (n); i++)
      |                                              ^
a.cc:98:9: error: redeclaration of 'int from'
   98 |     int from, to;
      |         ^~~~
a.cc:68:9: note: 'int from' previously declared here
   68 |     int from, to;
      |         ^~~~
a.cc:98:15: error: redeclaration of 'int to'
   98 |     int from, to;
      |               ^~
a.cc:68:15: note: 'int to' previously declared here
   68 |     int from, to;
      |               ^~