Language: C++

#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

vector<int> V[110000];

int mycount=0;
int N,a,b;
ll dis[110000];

void dfs(int x){
  if(nx==N) return;

  mycount++;

  for(int i=0;i<(int)V[x].size();i++){
    int nx=V[x][i];

    if(dis[nx]==-1){
      dis[nx]=dis[x]+1;
      dfs(nx);
    }
  }
}

int main(){
  cin>>N;
  //cout<<"unko"<<endl;
  for(int i=0;i<N-1;i++){
    cin>>a>>b;
    V[a].push_back(b);
    V[b].push_back(a);
  }

  for(int i=0;i<110000;i++) dis[i]=-1;
  dis[1]=0;
  dfs(1);
  cout<<dis[N]<<endl;
  cout<<mycount<<endl;
  if(N%2==0 && mycount+dis[N]/2==N/2) cout<<"Snuke"<<endl;
  else if((mycount+dis[N]/2)*2>N) cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
}
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

vector<int> V[110000];

int mycount=0;
int N,a,b;
ll dis[110000];

void dfs(int x){
  if(nx==N) return;

  mycount++;

  for(int i=0;i<(int)V[x].size();i++){
    int nx=V[x][i];

    if(dis[nx]==-1){
      dis[nx]=dis[x]+1;
      dfs(nx);
    }
  }
}

int main(){
  cin>>N;
  //cout<<"unko"<<endl;
  for(int i=0;i<N-1;i++){
    cin>>a>>b;
    V[a].push_back(b);
    V[b].push_back(a);
  }

  for(int i=0;i<110000;i++) dis[i]=-1;
  dis[1]=0;
  dfs(1);
  cout<<dis[N]<<endl;
  cout<<mycount<<endl;
  if(N%2==0 && mycount+dis[N]/2==N/2) cout<<"Snuke"<<endl;
  else if((mycount+dis[N]/2)*2>N) cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
}
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

vector<int> V[110000];

int mycount=0;
int N,a,b;
ll dis[110000];

void dfs(int x){
  if(nx==N) return;

  mycount++;

  for(int i=0;i<(int)V[x].size();i++){
    int nx=V[x][i];

    if(dis[nx]==-1){
      dis[nx]=dis[x]+1;
      dfs(nx);
    }
  }
}

int main(){
  cin>>N;
  //cout<<"unko"<<endl;
  for(int i=0;i<N-1;i++){
    cin>>a>>b;
    V[a].push_back(b);
    V[b].push_back(a);
  }

  for(int i=0;i<110000;i++) dis[i]=-1;
  dis[1]=0;
  dfs(1);
  cout<<dis[N]<<endl;
  cout<<mycount<<endl;
  if(N%2==0 && mycount+dis[N]/2==N/2) cout<<"Snuke"<<endl;
  else if((mycount+dis[N]/2)*2>N) cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
}
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

vector<int> V[110000];

int mycount=0;
int N,a,b;
ll dis[110000];

void dfs(int x){
  if(nx==N) return;

  mycount++;

  for(int i=0;i<(int)V[x].size();i++){
    int nx=V[x][i];

    if(dis[nx]==-1){
      dis[nx]=dis[x]+1;
      dfs(nx);
    }
  }
}

int main(){
  cin>>N;
  //cout<<"unko"<<endl;
  for(int i=0;i<N-1;i++){
    cin>>a>>b;
    V[a].push_back(b);
    V[b].push_back(a);
  }

  for(int i=0;i<110000;i++) dis[i]=-1;
  dis[1]=0;
  dfs(1);
  cout<<dis[N]<<endl;
  cout<<mycount<<endl;
  if(N%2==0 && mycount+dis[N]/2==N/2) cout<<"Snuke"<<endl;
  else if((mycount+dis[N]/2)*2>N) cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
}
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

vector<int> V[110000];

int mycount=0;
int N,a,b;
ll dis[110000];

void dfs(int x){
  if(nx==N) return;

  mycount++;

  for(int i=0;i<(int)V[x].size();i++){
    int nx=V[x][i];

    if(dis[nx]==-1){
      dis[nx]=dis[x]+1;
      dfs(nx);
    }
  }
}

int main(){
  cin>>N;
  //cout<<"unko"<<endl;
  for(int i=0;i<N-1;i++){
    cin>>a>>b;
    V[a].push_back(b);
    V[b].push_back(a);
  }

  for(int i=0;i<110000;i++) dis[i]=-1;
  dis[1]=0;
  dfs(1);
  cout<<dis[N]<<endl;
  cout<<mycount<<endl;
  if(N%2==0 && mycount+dis[N]/2==N/2) cout<<"Snuke"<<endl;
  else if((mycount+dis[N]/2)*2>N) cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
}
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

vector<int> V[110000];

int mycount=0;
int N,a,b;
ll dis[110000];

void dfs(int x){
  if(nx==N) return;

  mycount++;

  for(int i=0;i<(int)V[x].size();i++){
    int nx=V[x][i];

    if(dis[nx]==-1){
      dis[nx]=dis[x]+1;
      dfs(nx);
    }
  }
}

int main(){
  cin>>N;
  //cout<<"unko"<<endl;
  for(int i=0;i<N-1;i++){
    cin>>a>>b;
    V[a].push_back(b);
    V[b].push_back(a);
  }

  for(int i=0;i<110000;i++) dis[i]=-1;
  dis[1]=0;
  dfs(1);
  cout<<dis[N]<<endl;
  cout<<mycount<<endl;
  if(N%2==0 && mycount+dis[N]/2==N/2) cout<<"Snuke"<<endl;
  else if((mycount+dis[N]/2)*2>N) cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
}
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

vector<int> V[110000];

int mycount=0;
int N,a,b;
ll dis[110000];

void dfs(int x){
  if(nx==N) return;

  mycount++;

  for(int i=0;i<(int)V[x].size();i++){
    int nx=V[x][i];

    if(dis[nx]==-1){
      dis[nx]=dis[x]+1;
      dfs(nx);
    }
  }
}

int main(){
  cin>>N;
  //cout<<"unko"<<endl;
  for(int i=0;i<N-1;i++){
    cin>>a>>b;
    V[a].push_back(b);
    V[b].push_back(a);
  }

  for(int i=0;i<110000;i++) dis[i]=-1;
  dis[1]=0;
  dfs(1);
  cout<<dis[N]<<endl;
  cout<<mycount<<endl;
  if(N%2==0 && mycount+dis[N]/2==N/2) cout<<"Snuke"<<endl;
  else if((mycount+dis[N]/2)*2>N) cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
}
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

vector<int> V[110000];

int mycount=0;
int N,a,b;
ll dis[110000];

void dfs(int x){
  if(nx==N) return;

  mycount++;

  for(int i=0;i<(int)V[x].size();i++){
    int nx=V[x][i];

    if(dis[nx]==-1){
      dis[nx]=dis[x]+1;
      dfs(nx);
    }
  }
}

int main(){
  cin>>N;
  //cout<<"unko"<<endl;
  for(int i=0;i<N-1;i++){
    cin>>a>>b;
    V[a].push_back(b);
    V[b].push_back(a);
  }

  for(int i=0;i<110000;i++) dis[i]=-1;
  dis[1]=0;
  dfs(1);
  cout<<dis[N]<<endl;
  cout<<mycount<<endl;
  if(N%2==0 && mycount+dis[N]/2==N/2) cout<<"Snuke"<<endl;
  else if((mycount+dis[N]/2)*2>N) cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:22:6: error: 'nx' was not declared in this scope; did you mean 'x'?
   22 |   if(nx==N) return;
      |      ^~
      |      x
a.cc: At global scope:
a.cc:68:13: error: redefinition of 'std::vector<int> V [110000]'
   68 | vector<int> V[110000];
      |             ^
a.cc:15:13: note: 'std::vector<int> V [110000]' previously declared here
   15 | vector<int> V[110000];
      |             ^
a.cc:70:5: error: redefinition of 'int mycount'
   70 | int mycount=0;
      |     ^~~~~~~
a.cc:17:5: note: 'int mycount' previously defined here
   17 | int mycount=0;
      |     ^~~~~~~
a.cc:71:5: error: redefinition of 'int N'
   71 | int N,a,b;
      |     ^
a.cc:18:5: note: 'int N' previously declared here
   18 | int N,a,b;
      |     ^
a.cc:71:7: error: redefinition of 'int a'
   71 | int N,a,b;
      |       ^
a.cc:18:7: note: 'int a' previously declared here
   18 | int N,a,b;
      |       ^
a.cc:71:9: error: redefinition of 'int b'
   71 | int N,a,b;
      |         ^
a.cc:18:9: note: 'int b' previously declared here
   18 | int N,a,b;
      |         ^
a.cc:72:4: error: redefinition of 'll dis [110000]'
   72 | ll dis[110000];
      |    ^~~
a.cc:19:4: note: 'll dis [110000]' previously declared here
   19 | ll dis[110000];
      |    ^~~
a.cc:74:6: error: redefinition of 'void dfs(int)'
   74 | void dfs(int x){
      |      ^~~
a.cc:21:6: note: 'void dfs(int)' previously defined here
   21 | void dfs(int x){
      |      ^~~
a.cc: In function 'void dfs(int)':
a.cc:75:6: error: 'nx' was not declared in this scope; did you mean 'x'?
   75 |   if(nx==N) return;
      |      ^~
      |      x
a.cc: At global scope:
a.cc:89:5: error: redefinition of 'int main()'
   89 | int main(){
      |     ^~~~
a.cc:36:5: note: 'int main()' previously defined here
   36 | int main(){
      |     ^~~~
a.cc:121:13: error: redefinition of 'std::vector<int> V [110000]'
  121 | vector<int> V[110000];
      |             ^
a.cc:15:13: note: 'std::vector<int> V [110000]' previously declared here
   15 | vector<int> V[110000];
      |             ^
a.cc:123:5: error: redefinition of 'int mycount'
  123 | int mycount=0;
      |     ^~~~~~~
a.cc:17:5: note: 'int mycount' previously defined here
   17 | int mycount=0;
      |     ^~~~~~~
a.cc:124:5: error: redefinition of 'int N'
  124 | int N,a,b;
      |     ^
a.cc:18:5: note: 'int N' previously declared here
   18 | int N,a,b;
      |     ^
a.cc:124:7: error: redefinition of 'int a'
  124 | int N,a,b;
      |       ^
a.cc:18:7: note: 'int a' previously declared here
   18 | int N,a,b;
      |       ^
a.cc:124:9: error: redefinition of 'int b'
  124 | int N,a,b;
      |         ^
a.cc:18:9: note: 'int b' previously declared here
   18 | int N,a,b;
      |         ^
a.cc:125:4: error: redefinition of 'll dis [110000]'
  125 | ll dis[110000];
      |    ^~~
a.cc:19:4: note: 'll dis [110000]' previously declared here
   19 | ll dis[110000];
      |    ^~~
a.cc:127:6: error: redefinition of 'void dfs(int)'
  127 | void dfs(int x){
      |      ^~~
a.cc:21:6: note: 'void dfs(int)' previously defined here
   21 | void dfs(int x){
      |      ^~~
a.cc: In function 'void dfs(int)':
a.cc:128:6: error: 'nx' was not declared in this scope; did you mean 'x'?
  128 |   if(nx==N) return;
      |      ^~
      |      x
a.cc: At global scope:
a.cc:142:5: error: redefinition of 'int main()'
  142 | int main(){
      |     ^~~~
a.cc:36:5: note: 'int main()' previously defined here
   36 | int main(){
      |     ^~~~
a.cc:174:13: error: redefinition of 'std::vector<int> V [110000]'
  174 | vector<int> V[110000];
      |             ^
a.cc:15:13: note: 'std::vector<int> V [110000]' previously declared here
   15 | vector<int> V[110000];
      |             ^
a.cc:176:5: error: redefinition of 'int mycount'
  176 | int mycount=0;
      |     ^~~~~~~
a.cc:17:5: note: 'int mycount' previously defined here
   17 | int mycount=0;
      |     ^~~~~~~
a.cc:177:5: error: redefinition of 'int N'
  177 | int N,a,b;
      |     ^
a.cc:18:5: note: 'int N' previously declared here
   18 | int N,a,b;
      |     ^
a.cc:177:7: error: redefinition of 'int a'
  177 | int N,a,b;
      |       ^
a.cc:18:7: note: 'int a' previously declared here
   18 | int N,a,b;
      |       ^
a.cc:177:9: error: redefinition of 'int b'
  177 | int N,a,b;
      |         ^
a.cc:18:9: note: 'int b' previously declared here
   18 | int N,a,b;
      |         ^
a.cc:178:4: error: redefinition of 'll dis [110000]'
  178 | ll dis[110000];
      |    ^~~
a.cc:19:4: note: 'll dis [110000]' previously declared here
   19 | ll dis[110000];
      |    ^~~
a.cc:180:6: error: redefinition of 'void dfs(int)'
  180 | void dfs(int x){
      |      ^~~
a.cc:21:6: note: 'void dfs(int)' previously defined here
   21 | void dfs(int x){
      |      ^~~
a.cc: In function 'void dfs(int)':
a.cc:181:6: error: 'nx' was not declared in this scope; did you mean 'x'?
  181 |   if(nx==N) return;
      |      ^~
      |      x
a.cc: At global scope:
a.cc:195:5: error: redefinition of 'int main()'
  195 | int main(){
      |     ^~~~
a.cc:36:5: note: 'int main()' previously defined here
   36 | int main(){
      |     ^~~~
a.cc:227:13: error: redefinition of 'std::vector<int> V [110000]'
  227 | vector<int> V[110000];
      |             ^
a.cc:15:13: note: 'std::vector<int> V [110000]' previously declared here
   15 | vector<int> V[110000];
      |             ^
a.cc:229:5: error: redefinition of 'int mycount'
  229 | int mycount=0;
      |     ^~~~~~~
a.cc:17:5: note: 'int mycount' previously defined here
   17 | int mycount=0;
      |     ^~~~~~~
a.cc:230:5: error: redefinition of 'int N'
  230 | int N,a,b;
      |     ^
a.cc:18:5: note: 'int N' previously declared here
   18 | int N,a,b;
      |     ^
a.cc:230:7: error: redefinition of 'int a'
  230 | int N,a,b;
      |       ^
a.cc:18:7: note: 'int a' previously declared here
   18 | int N,a,b;
      |       ^
a.cc:230:9: error: redefinition of 'int b'
  230 | int N,a,b;
      |         ^
a.cc:18:9: note: 'int b' previously declared here
   18 | int N,a,b;
      |         ^
a.cc:231:4: error: redefinition of 'll dis [110000]'
  231 | ll dis[110000];
      |    ^~~
a.cc:19:4: note: 'll dis [110000]' previously declared here
   19 | ll dis[110000];
      |    ^~~
a.cc:233:6: error: redefinition of 'void dfs(int)'
  233 | void dfs(int x){
      |      ^~~
a.cc:21:6: note: 'void dfs(int)' previously defined here
   21 | void dfs(int x){
      |      ^~~
a.cc: In function 'void dfs(int)':
a.cc:234:6: error: 'nx' was not declared in this scope; did you mean 'x'?
  234 |   if(nx==N) return;
      |      ^~
      |      x
a.cc: At global scope:
a.cc:248:5: error: redefinition of 'int main()'
  248 | int main(){
      |     ^~~~
a.cc:36:5: note: 'int main()' previously defined here
   36 | int main(){
      |     ^~~~
a.cc:280:13: error: redefinition of 'std::vector<int> V [110000]'
  280 | vector<int> V[110000];
      |             ^
a.cc:15:13: note: 'std::vector<int> V [110000]' previously declared here
   15 | vector<int> V[110000];
      |             ^
a.cc:282:5: error: redefinition of 'int mycount'
  282 | int mycount=0;
      |     ^~~~~~~
a.cc:17:5: note: 'int mycount' previously defined here
   17 | int mycount=0;
      |     ^~~~~~~
a.cc:283:5: error: redefinition of 'int N'
  283 | int N,a,b;
      |     ^
a.cc:18:5: note: 'int N' previously declared here
   18 | int N,a,b;
      |     ^
a.cc:283:7: error: redefinition of 'int a'
  283 | int N,a,b;
      |       ^
a.cc:18:7: note: 'int a' previously declared here
   18 | int N,a,b;
      |       ^
a.cc:283:9: error: redefinition of 'int b'
  283 | int N,a,b;
      |         ^
a.cc:18:9: note: 'int b' previously declared here
   18 | int N,a,b;
      |         ^
a.cc:284:4: error: redefinition of 'll dis [110000]'
  284 | ll dis[110000];
      |    ^~~
a.cc:19:4: note: 'll dis [110000]' previously declared here
   19 | ll dis[110000];
      |    ^~~
a.cc:286:6: error: redefinition of 'void dfs(int)'
  286 | void dfs(int x){
      |      ^~~
a.cc:21:6: note: 'void dfs(int)' previously defined here
   21 | void dfs(int x){
      |      ^~~
a.cc: In function 'void dfs(int)':
a.cc:287:6: error: 'nx' was not declared in this scope; did you mean 'x'?
  287 |   if(nx==N) return;
      |      ^~
      |      x
a.cc: At global scope:
a.cc:301:5: error: redefinition of 'int main()'
  301 | int main(){
      |     ^~~~
a.cc:36:5: note: 'int main()' previously defined here
   36 | int main(){
      |     ^~~~
a.cc:333:13: error: redefinition of 'std::vector<int> V [110000]'
  333 | vector<int> V[110000];
      |             ^
a.cc:15:13: note: 'std::vector<int> V [110000]' previously declared here
   15 | vector<int> V[110000];
      |             ^
a.cc:335:5: error: redefinition of 'int mycount'
  335 | int mycount=0;
      |     ^~~~~~~
a.cc:17:5: note: 'int mycount' previously defined here
   17 | int mycount=0;
      |     ^~~~~~~
a.cc:336:5: error: redefinition of 'int N'
  336 | int N,a,b;
      |     ^
a.cc:18:5: note: 'int N' previously declared here
   18 | int N,a,b;
      |     ^
a.cc:336:7: error: redefinition of 'int a'
  336 | int N,a,b;
      |       ^
a.cc:18:7: note: 'int a' previously declared here
   18 | int N,a,b;
      |       ^
a.cc:336:9: error: redefinition of 'int b'
  336 | int N,a,b;
      |         ^
a.cc:18:9: note: 'int b' previously declared here
   18 | int N,a,b;
      |         ^
a.cc:337:4: error: redefinition of 'll dis [110000]'
  337 | ll dis[110000];
      |    ^~~
a.cc:19:4: note: 'll dis [110000]' previously declared here
   19 | ll dis[110000];
      |    ^~~
a.cc:339:6: error: redefinition of 'void dfs(int)'
  339 | void dfs(int x){
      |      ^~~
a.cc:21:6: note: 'void dfs(int)' previously defined here
   21 | void dfs(int x){
      |      ^~~
a.cc: In function 'void dfs(int)':
a.cc:340:6: error: 'nx' was not declared in this scope; did you mean 'x'?
  340 |   if(nx==N) return;
      |      ^~
      |      x
a.cc: At global scope:
a.cc:354:5: error: redefinition of 'int main()'
  354 | int main(){
      |     ^~~~
a.cc:36:5: note: 'int main()' previously defined here
   36 | int main(){
      |     ^~~~
a.cc:386:13: err