criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long LL;
const int MAXN=1e5+5;
int tot,head[MAXN];
bool mark[MAXN];
int ans1,ans2;
int n;
int num;
int slit;
int father;

struct Edge
{
    int from,to;
    int next;
}e[MAXN*2];

void add(int u,int v)
{
    e[tot].from=u;
    e[tot].to=v;
    e[tot].next=head[u];
    head[u]=tot++;
}

bool dfs(int rt,int fa)
{
    for(int i=head[rt];i!=-1;i=e[i].next)
    {
        int to=e[i].to;
        if(to==fa) continue;
        if(to==n) return true;
        if(dfs(to,rt))
        {
            mark[to]=true;
            return true;
        }
    }
    return false;
}

int dfs2(int rt,int fa)
{
    for(int i=head[rt];i!=-1;i=e[i].next)
    {
        int to=e[i].to;
        if(to==fa) continue;
        if(!mark[to]) continue;
        else
        {
            num++;
            if(num==slit)
            {
                father=rt;
                return to;
            }
            else
                return dfs2(to,rt);
        }
    }
}

void dfs3(int rt,int fa)
{
    for(int i=head[rt];i!=-1;i=e[i].next)
    {
        int to=e[i].to;
        if(to==fa) continue;
        ans1++;
        dfs3(to,rt);
    }
}

void dfs4(int rt,int fa)
{
    for(int i=head[rt];i!=-1;i=e[i].next)
    {
        int to=e[i].to;
        if(to==fa) continue;
        ans2++;
        dfs4(to,rt);
    }
}

int main()
{
    //ios::sync_with_stdio(false);
    while(cin>>n)
    {
        memset(head,-1,sizeof(head));
        memset(mark,false,sizeof(mark));
        memset(vis,false,sizeof(vis));
        tot=0;
        int u,v;
        for(int i=1;i<=n-1;i++)
        {
            cin>>u>>v;
            add(u,v);add(v,u);
        }
        dfs(1,0);
        mark[1]=true;mark[n]=true;
        int cnt=0;
        for(int i=1;i<=n;i++)
        {
            if(mark[i])
            {
                cnt++;
                //cout<<i<<" ";
            }

        }
        //cout<<endl;
        if(cnt&1)
            slit=cnt/2+1;
        else slit=cnt/2;
        //cout<<"slit: "<<slit<<endl;
        num=1;
        int id=dfs2(1,0);
        //cout<<id<<endl;
        int child;
        for(int i=head[id];i!=-1;i=e[i].next)
        {
            int to=e[i].to;
            if(mark[to]&&to!=father)
                child=to;
        }
        //cout<<father<<" "<<id<<" "<<child<<endl;
        ans1=0;ans2=0;
        dfs3(id,child);
        dfs4(child,id);
        //cout<<ans1<<" "<<ans2<<endl;
        if(ans1>ans2)
            cout<<"Fennec"<<endl;
        else
            cout<<"Snuke"<<endl;
    }

    return 0;
}
/*
11
1 2
1 6
1 8
3 6
4 6
5 8
5 7
4 9
4 10
10 11
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:97:16: error: 'vis' was not declared in this scope
   97 |         memset(vis,false,sizeof(vis));
      |                ^~~
a.cc: In function 'int dfs2(int, int)':
a.cc:66:1: warning: control reaches end of non-void function [-Wreturn-type]
   66 | }
      | ^
Language: C++

#include<iostream>
#include<queue>
using namespace std;

const int MAX = 100000;
struct board {
	static queue<board *> graph;
	int type; // 0:普通マス 1:黒マス 2:白マス
};

board *nowRead;
int count(board *read, int level) {
	if (read->type == 2) return level / -2;
	int judge, ret = 0;
	while(!read->graph.empty()) {
		nowRead = read->graph.front();
		read->graph.pop();
		judge = count(nowRead, level + 1);
		if (-judge >= 0) {
			if (-judge < level) return judge;
			else continue;
		}
		ret += judge;
	}
	return ret + 1;
}
int main() {
	int N, a, b, cnt;
	static board m[MAX];
	cin >> N;
	m[0].type = 1;
	m[N - 1].type = 2;
	for (int i = 1;i < N - 1;i ++) {
		m[i].type = 0;
	}
	for (int i = 0;i < N - 1;i ++) {
		cin >> a >> b;
		m[a - 1].graph.push(&m[b - 1]);
		m[b - 1].graph.push(&m[a - 1]);
	}
	
	cnt = count(&m[0], 0);
//	cout << cnt << ":";
	if (cnt > N - cnt) cout << "Fennec";
	else cout << "Snuke";
	return 0;
}

Compiler output:
/usr/bin/ld: /tmp/cc3muzbr.o: warning: relocation against `_ZN5board5graphE' in read-only section `.text'
/usr/bin/ld: /tmp/cc3muzbr.o: in function `count(board*, int)':
a.cc:(.text+0x39): undefined reference to `board::graph'
/usr/bin/ld: a.cc:(.text+0x52): undefined reference to `board::graph'
/usr/bin/ld: a.cc:(.text+0x96): undefined reference to `board::graph'
/usr/bin/ld: /tmp/cc3muzbr.o: in function `main':
a.cc:(.text+0x186): undefined reference to `board::graph'
/usr/bin/ld: a.cc:(.text+0x1ba): undefined reference to `board::graph'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
Language: C++

#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <string.h>
using namespace std;
vector<int> v[100010];
int vis[100010];
int ans=0;
int dfs(int n,int w)
{
    if(vis[n]==1||n==w) return 0;
    else
    {
        vis[n]=1;
        for(int i=0;i<v[n].size();i++)
        {
            ans+=dfs(v[n][i],w);
        }
        return 1;
    }
}

int main()
{
    int n,a,b,sa,sb;
    scanf("%d",&n);
    for(int i=0;i<n-1;i++)
    {
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    dfs(1,n);
    sa=ans;
    ans=0;
    memset(vis,0,sizeof(vis));
    dfs(n,1);
    sb=ans;
    if(sa>sb) printf("Fennec");
    else if(sa<sb) printf("Snuke");
    else if(sa%2==0) printf("Snuke");
    else printf("Fennec");
    return 0;
}


Compiler output:
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<int> v[100010];
      | ^~~~~~
a.cc: In function 'int dfs(int, int)':
a.cc:16:23: error: 'v' was not declared in this scope
   16 |         for(int i=0;i<v[n].size();i++)
      |                       ^
a.cc: In function 'int main()':
a.cc:31:9: error: 'v' was not declared in this scope
   31 |         v[a].push_back(b);
      |         ^
Language: Java

import java.util.*;

public class Main {
  static boolean[] memo;
  static int[] choice;
  static ArrayList[] edge;
  static int N;
  static int[] wa;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    N = sc.nextInt();
    edge = new ArrayList[N + 1];
    memo = new boolean[N + 1];
    choice = new int[N + 1];
    wa = new int[N + 1];
    for(int i = 1; i < N + 1; i++) {
      edge[i] = new ArrayList<Integer>();
    }
    for(int i = 0; i < N; i++) {
      int a = sc.nextInt();
      int b = sc.nextInt();
      edge[a].add(b);
      edge[b].add(a);
    }
    dfs(1, -1);
    ArrayList<Integer> road = new ArrayList<Integer>();
    road.add(1);
    int ve = 1;
    int oya = 1;
    while(ve != N) {
      ArrayList<Integer> e = edge[ve];
      for(int i = 0; i < e.size(); i++) {
        int ko = e.get(i);
        if(ko != oya) {
          if(memo[ko]) {
            road.add(ko);
            ve = ko;
            oya = ve;
          }
        }
      }
    }
    int sente = (road.size() + 1) / 2;
    int senten = 0;
    for(int i = sente - 1; i >= 0; i--) {
      int u = road[i];
      senten += sum[u];
    }
    String ans = "Snuke";
    if(senten > N - senten) ans = "Fennec";
    System.out.println(ans);
  }

  public static boolean dfs(int v, int p) {
    choice[v] = 1;
    if(v == N) return true;
    ArrayList<Integer> e = edge[v];
    boolean ret = false;
    for(int i = 0; i < e.size(); i++) {
      int c = e.get(i);
      if(c != p) {
        boolean flg = false;
        if(choice[c] == 0) {
          flg = dfs(c, v);
        } else {
          flg = memo[c];
        }
        ret = ret || flg;
      }
    }
    return memo[v] = ret;
  }

  public static int sum(int v, int p) {
    ArrayList<Integer> e = edge[v];
    int ret = 0;
    for(int i = 0; i < e.size(); i++) {
      int ko = e.get(i);
      if(ko != p && !memo[ko]) {
        int s = 0;
        if(wa[ko] == 0) {
          s = sum(ko, v);
        } else {
          s = wa[ko];
        }
        ret += s;
      }
    }
    return ret;
  }
}

Compiler output:
Main.java:46: error: array required, but ArrayList<Integer> found
      int u = road[i];
                  ^
Main.java:47: error: cannot find symbol
      senten += sum[u];
                ^
  symbol:   variable sum
  location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
Language: C++

#include <stdio.h>
#include <vector>
#include <queue>

using namespace std;

vector<int> edges[100001];
int distA[100001];
int distB[100001];

int main() {
  int N;
  scanf("%d", &N);

  for (int i = 0; i < N - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    edges[a].push_back(b);
    edges[b].push_back(a);
    distA[i] = -1;
    distB[i] = -1;
  }

  queue<int> q;
  distA[1] = 0;
  q.push(1);
  while (!q.empty()) {
    int pos = q.front();
    q.pop();
    //    printf("dist A cur = %d\n", pos);
    for (int i = 0, ilim = edges[pos].size(); i < ilim; i++) {
      int next_pos = edges[pos][i];
      if (distA[next_pos] != -1 || next_pos = N) continue;
      distA[next_pos] = distA[pos] + 1;
      q.push(next_pos);
    }
  }

  distB[N] = 0;
  q.push(N);
  while (!q.empty()) {
    int pos = q.front();
    q.pop();
    for (int i = 0, ilim = edges[pos].size(); i < ilim; i++) {
      int next_pos = edges[pos][i];
      if (distB[next_pos] != -1 || next_pos = 1) continue;
      distB[next_pos] = distB[pos] + 1;
      q.push(next_pos);
    }
  }

  int nearer_to_A = 0;
  for (int i = 1; i <= N - 2; i++) {
    if (distA[i] <= distB[i]) {
      nearer_to_A++;
    }
  }
  
  if (nearer_to_A > N - nearer_to_A) {
    printf("Fennec\n");
  } else {
    printf("Snuke\n");
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:33: error: lvalue required as left operand of assignment
   33 |       if (distA[next_pos] != -1 || next_pos = N) continue;
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
a.cc:46:33: error: lvalue required as left operand of assignment
   46 |       if (distB[next_pos] != -1 || next_pos = 1) continue;
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
Language: C

#include <stdio.h>
#include<queue>
using namespace std;

int main(void){
    int N;
    scanf("%d",&N);
    int a[N-1],b[N-1];
    for(int i=0;i<N-1;i++){
        scanf("%d %d",&a[i],&b[i]);
    }
    queue<int> po;
    int Ftyouten[N+1];
    int Styouten[N+1];
    for(int i=0;i<=N;i++){Ftyouten[i]=-1;Styouten[i]=-1;}
    po.push(1);
    po.push(0);
    while(!po.empty()){
        int pa=po.front();
        po.pop();
        int pi=po.front();
        po.pop();
        for(int i=0;i<N-1;i++){
            if(a[i]==pa&&Ftyouten[b[i]]==-1){
                Ftyouten[b[i]]=pi+1;
                po.push(Ftyouten[b[i]]);
                po.push(pi+1);
            }
            if(b[i]==pa&&Ftyouten[a[i]]==-1){
                Ftyouten[a[i]]=pi+1;
                po.push(Ftyouten[a[i]]);
                po.push(pi+1);
            }
        }
    }
    po.push(N);
    po.push(0);
    while(!po.empty()){
        int pa=po.front();
        po.pop();
        int pi=po.front();
        po.pop();
        for(int i=0;i<N-1;i++){
            if(a[i]==pa&&Styouten[b[i]]==-1){
                Styouten[b[i]]=pi+1;
                po.push(Ftyouten[b[i]]);
                po.push(pi+1);
            }
            if(b[i]==pa&&Styouten[a[i]]==-1){
                Styouten[a[i]]=pi+1;
                po.push(Ftyouten[a[i]]);
                po.push(pi+1);
            }
        }
    }
    int F=0;
    int S=0;
    for(int i=1;i<=N;i++){
        if(Ftyouten[i]>=Styouten[i])F++;
        else S++;
    }
    if(F<=S)printf("Snuke");
    else printf("Fennec");
    return 0;
}


Compiler output:
main.c:2:9: fatal error: queue: No such file or directory
    2 | #include<queue>
      |         ^~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <map>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define vec vector
#define mp make_pair
#define pb push_back
#define piiv pair<int, pair<int, vector<int>>>

int INF = 1000000007;

int n;
vec<vec<int>> edge;

vec<int> bfs(void)
{
	priority_queue<piiv, vec<piiv>, greater<piiv>> que;
	vec<int> dp(n, INF);
	vec<vec<int>> dr(n);
	vec<int> init(1, 0);
	dr[0] = init;
	que.push(mp(0, mp(0, init)));
	dp[0] = 0;
	while(!que.empty()) {
		piiv get = que.top();
		que.pop();
		int v = get.second.first;
		if (dp[v] < get.first) continue;
		rep(i, edge[v].size()) {
			if (dp[edge[v][i]] > dp[v] + 1) {
				dp[edge[v][i]] = dp[v] + 1;
				get.second.second.pb(edge[v][i]);
				dr[edge[v][i]] = get.second.second;
				que.push(mp(dp[v] + 1, mp(edge[v][i], get.second.second)));
			}
		}
	}
	return dr[n - 1];
}

vec<int> dp;
void dfs(int c, int s)
{
	if (dp[s] == 1 - c || dp[s] == 3 - c || dp[s] == c) return;
	dp[s] = c;
	rep(i, edge[s].size()) {
		dfs(c, edge[s][i]);
	}
}

int main(void)
{

Compiler output:
a.cc: In function 'int main()':
a.cc:56:2: error: expected '}' at end of input
   56 | {
      | ~^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

vector<int> tree[100005];

int main(){
  int n;
  cin>>n;
  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    tree[a].pb(b);
    tree[b].pb(a);
  }

  vector<int> df(n, INF), ds(n,INF);

  auto djk = [&](vector<int> d, int from){
    d[from] = 0;
    queue<int> q;
    q.push(from);
    while(!q.empty()){
      int x = q.front(); q.pop();
      for(auto to : tree[x]) if(d[to]==INF){
        d[to] = d[x] +1;
        prev[to] = x;
        q.push(to);
      }
    }
  };

  int fe=0, su=0;
  rep(i,n){
    if(df[i]<=du[i]) fe++;
    else su++;
  }

  assert(fe + su == n);

  if(fe > su) cout << "Fennec" << endl;
  else cout << "Snuke" << endl;

  return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:42:13: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   42 |         prev[to] = x;
      |             ^
a.cc: In function 'int main()':
a.cc:50:15: error: 'du' was not declared in this scope; did you mean 'su'?
   50 |     if(df[i]<=du[i]) fe++;
      |               ^~
      |               su
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
int n;
vector<int> v[100005];
bool vis[100005];
int END;
int cntB,cntW;
void dij(int x){
	priority_queue<pair<int,int> > q;
	q.push(make_pair(0,x));
	vis[x]=true;
	while (!q.empty()){
		pair<int,int> t=q.top();
		q.pop();
		int dist=-t.first;
		int pl=t.second;
		if (pl==END){
			if (dist%2){
				if (cntB<=cntW){
					cout<<"Snuke";
				}
				else{
					cout<<"Fennec";
				}
			}
			else{
				if (cntB<=cntW-1){
					cout<<"Snuke";
				}
				else{
					cout<<"Fennec";
				}
			}
			exit(0);
		}
		for (int i=0;i<v[pl].size();i++){
			if (vis[v[pl][i]]){
				continue;
			}
			vis[v[pl][i]]=true;
			q.push(make_pair(-(dist+1),v[pl][i]));
		}
	}
}
void dfs(int x,int d,bool y){
	if (v[x].size()==1 && y==0){
		cntB+=d;
		return;
	}
	for (int i=0;i<v[x].size();i++){
		if (vis[v[x][i]]){
			continue;
		}
		vis[v[x][i]]=true;
		if (v[x][i]==n){
			dfs(v[x][i],d+1,1);
		}
		else{
			dfs(v[x][i],d+1,y);
		}
	}
}
int main(){
	cin>>n;
	END=n;
	for (int i=1;i<n;i++){
		int a,b;
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	vis[1]=true;
	dfs(1,0,0);
	cntW=n-2-cntB;
	memset(vis,0,sizeof(vis));
	dij(1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:9: error: 'memset' was not declared in this scope
   79 |         memset(vis,0,sizeof(vis));
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <queue>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

def spaceinput():
    return list(map(int,input().split(" ")))

def f(c):
    return abs(sum(aa[:c])-sum(aa[c:]))

N=int(input())
aa=spaceinput()

l=0
r=len(aa)-1
vl=f(l+1)
vr=f(r)
while True:
    c=int((l+r)/2)

    if c==0:
        c+=1

    vc=f(c)
    if vl >vc:
        l=c
        vl=vc
    elif vr >vc:
        r=c
        vr=vc

    else:
        break

print(f(c))


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def spaceinput():
      | ^~~
Language: C++

#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int head[200005],to[200005],next[200005],vis[200005],num,n,ans,u,v;
void add(int u,int v)
{
	next[++num]=head[u];
	head[u]=num;
	to[num]=v;
}
int dfs(int now,int deep)
{
	vis[now]=1;
	int nowans=0;
	if(now==n) return deep;
	for(int i=head[now];i;i=next[i])
	if(!vis[to[i]])
	{
		nowans=max(dfs(to[i],deep+1),nowans);
	}
	return nowans;
}
void color(int now,int c,int nowdeep,int topdeep)
{
	vis[now]=c;
	if(nowdeep==topdeep)
	{
		return;
	}
	for(int i=head[now];i;i=next[i])
	if(!vis[to[i]])
	{
		color(to[i],c,nowdeep+1,topdeep);
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;++i)
	{
		scanf("%d%d",&u,&v);
		add(u,v);
		add(v,u);
	}
	int maxdeep=dfs(1,0);
	memset(vis,0,sizeof vis);
	color(1,1,0,maxdeep/2);
	color(n,2,0,n*2);
	for(int i=1;i<=n;++i)
	if(vis[i]==2) ans++;
	if(ans>=(n-ans))
	{
		printf("Snuke");
	}
		else printf("Fennec");
	
	return 0;
}

Compiler output:
a.cc: In function 'void add(int, int)':
a.cc:10:9: error: reference to 'next' is ambiguous
   10 |         next[++num]=head[u];
      |         ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 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:7:29: note:                 'int next [200005]'
    7 | int head[200005],to[200005],next[200005],vis[200005],num,n,ans,u,v;
      |                             ^~~~
a.cc: In function 'int dfs(int, int)':
a.cc:19:33: error: reference to 'next' is ambiguous
   19 |         for(int i=head[now];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:7:29: note:                 'int next [200005]'
    7 | int head[200005],to[200005],next[200005],vis[200005],num,n,ans,u,v;
      |                             ^~~~
a.cc: In function 'void color(int, int, int, int)':
a.cc:33:33: error: reference to 'next' is ambiguous
   33 |         for(int i=head[now];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:7:29: note:                 'int next [200005]'
    7 | int head[200005],to[200005],next[200005],vis[200005],num,n,ans,u,v;
      |                             ^~~~
Language: C++

//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn=100000+10;
const int maxm=200000+10;

struct Edge{int u,v;Edge(int u=0,int v=0):u(u),v(v){}}e[maxn];

int first[maxn],next[maxm],ecnt;
inline void add_edge(int u,int v){
	next[ecnt]=first[u];first[u]=ecnt;e[ecnt++]=Edge(u,v);	
	next[ecnt]=first[v];first[v]=ecnt;e[ecnt++]=Edge(v,u);	
}

int sz[maxn],fa[maxn],opp,cur;

int n;
int dfs(int u,int pre,int dep)
{
	if(u==n){
		opp=(dep+1)/2;
		
		cur=u;
		for(int j=dep;j>opp+1;--j) cur=fa[cur];
	}
	
	sz[u]=1;
	for(int i=first[u];i!=-1;i=next[i])
	{
		int v=e[i].v;
		if(v!=pre) sz[u]+=dfs(v,u,dep+1);
	}
	return sz[u];
}

int main()
{
	cin>>n;memset(first,-1,sizeof first);
	
	for(int i=1,u,v;i<=n;++i)
	{
		cin>>u>>v;
		add_edge(u,v);
	}
	
	dfs(1,1,1);
	
	puts(sz[cur] >= n - sz[cur] ? "Snuke":"Fennec");
	return 0;
}


Compiler output:
a.cc: In function 'void add_edge(int, int)':
a.cc:15:9: error: reference to 'next' is ambiguous
   15 |         next[ecnt]=first[u];first[u]=ecnt;e[ecnt++]=Edge(u,v);
      |         ^~~~
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:4:
/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:13:17: note:                 'int next [200010]'
   13 | int first[maxn],next[maxm],ecnt;
      |                 ^~~~
a.cc:16:9: error: reference to 'next' is ambiguous
   16 |         next[ecnt]=first[v];first[v]=ecnt;e[ecnt++]=Edge(v,u);
      |         ^~~~
/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:13:17: note:                 'int next [200010]'
   13 | int first[maxn],next[maxm],ecnt;
      |                 ^~~~
a.cc: In function 'int dfs(int, int, int)':
a.cc:32:36: error: reference to 'next' is ambiguous
   32 |         for(int i=first[u];i!=-1;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:13:17: note:                 'int next [200010]'
   13 | int first[maxn],next[maxm],ecnt;
      |                 ^~~~
Language: C++

#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
const int N=200010;
int e[N],next[N],head[N],ed=0;
void adde(int x,int y){e[++ed]=y;next[ed]=head[x];head[x]=ed;}
int p[N],isr[N],cnt=0,sum=0,n;
bool dfs(int x,int fa){
    if(x==n){p[++cnt]=x;return true;}
    for(int i=head[x];i;i=next[i])
        if(e[i]!=fa&&dfs(e[i],x)){
            p[++cnt]=x;
            return true;
        }
    return false;
}
void dfs2(int x,int fa){
    sum++;
    for(int i=head[x];i;i=next[i])
        if(e[i]!=fa&&!isr[e[i]]) dfs2(e[i],x);
}
int main(){
    int i,x,y;
    scanf("%d",&n);
    for(i=1;i<n;i++){
        scanf("%d %d",&x,&y);
        adde(x,y);
        adde(y,x);
    }
    dfs(1,0);
    for(i=1;i<=cnt;i++) isr[p[i]]=1;
    for(i=1;i<=cnt/2;i++) dfs2(p[i],0);
    if(sum*2<n) printf("Fennec\n");
    else printf("Snuke\n");
    return 0;
}


Compiler output:
a.cc: In function 'void adde(int, int)':
a.cc:11:34: error: reference to 'next' is ambiguous
   11 | void adde(int x,int y){e[++ed]=y;next[ed]=head[x];head[x]=ed;}
      |                                  ^~~~
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:2:
/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:10:10: note:                 'int next [200010]'
   10 | int e[N],next[N],head[N],ed=0;
      |          ^~~~
a.cc: In function 'bool dfs(int, int)':
a.cc:15:27: error: reference to 'next' is ambiguous
   15 |     for(int i=head[x];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:10:10: note:                 'int next [200010]'
   10 | int e[N],next[N],head[N],ed=0;
      |          ^~~~
a.cc: In function 'void dfs2(int, int)':
a.cc:24:27: error: reference to 'next' is ambiguous
   24 |     for(int i=head[x];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:10:10: note:                 'int next [200010]'
   10 | int e[N],next[N],head[N],ed=0;
      |          ^~~~
Language: C++


def spaceinput():
    return list(map(int,input().split(" ")))

def f(c):
    return abs(sum(aa[:c])-sum(aa[c:]))

N=int(input())
aa=spaceinput()

l=0
r=len(aa)-1
vl=f(l+1)
vr=f(r)
while True:
    c=int((l+r)/2)

    if c==0:
        c+=1

    vc=f(c)
    if vl >vc:
        l=c
        vl=vc
    elif vr >vc:
        r=c
        vr=vc

    else:
        break

print(f(c))


Compiler output:
a.cc:2:1: error: 'def' does not name a type
    2 | def spaceinput():
      | ^~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int maxi=1e6;
int lev,rez,n,sum,x,y;
vector<int> v[maxi];
int pr[maxi];

void dfs(int x, int pred)
{
    lev++;

    sum++;

    pr[x]=pred;
    if (x==n) rez=lev;
    for (int i:v[x])
        if (i!=pred) dfs(i,x);
    lev--;
}

int main()
{
   cin>>n;

   for (int i=1;i<n;i++)
   {
       scanf("%d%d",&x,&y);
       v[x].push_back(y);
       v[y].push_back(x);
   }

   dfs(1,0);

   rez-=2;
   rez/=2;

   while(rez>0)
   {
       x=pr[x];
       rez--;
   }

    sum=0;
   dfs(x,pr[x]);
#include<bits/stdc++.h>

using namespace std;

const int maxi=1e6;
int lev,rez,n,sum,x,y;
vector<int> v[maxi];
int pr[maxi];

void dfs(int x, int pred)
{
    lev++;

    sum++;

    pr[x]=pred;
    if (x==n) rez=lev;
    for (int i:v[x])
        if (i!=pred) dfs(i,x);
    lev--;
}

int main()
{
   cin>>n;

   for (int i=1;i<n;i++)
   {
       scanf("%d%d",&x,&y);
       v[x].push_back(y);
       v[y].push_back(x);
   }

   dfs(1,0);

   rez-=2;
   rez/=2;

   while(rez>0)
   {
       x=pr[x];
       rez--;
   }

    sum=0;
   dfs(x,pr[x]);

   if (sum>n-sum) printf("Fennec\n"); else printf("Snuke\n");

   return 0;
}
if (sum>n-sum) printf("Fennec\n"); else printf("Snuke\n");

   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:57:1: error: a function-definition is not allowed here before '{' token
   57 | {
      | ^
a.cc:69:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   69 | int main()
      |         ^~
a.cc:69:9: note: remove parentheses to default-initialize a variable
   69 | int main()
      |         ^~
      |         --
a.cc:69:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:70:1: error: a function-definition is not allowed here before '{' token
   70 | {
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define poly vector<ll>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
inline char gc(){
	static char buf[100000],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x=0;char ch=gc();bool positive=1;
	for(;!isdigit(ch);ch=gc()) if(ch=='-') positive=0;
	for(;isdigit(ch);ch=gc()) x=x*10+ch-'0';
	return positive?x:-x;
}
inline void write(ll x){
	if(x<0){
		x=-x;putchar('-');
	}
	if(x>=10) write(x/10);
	putchar('0'+x%10);
}
inline void writeln(ll x){write(x);puts("");}
inline void writep(ll x){write(x);putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=10;
int a[N];
char s[N];
int 
void query(ll x){
	printf("? %lld\n",x);
	fflush(stdout);scanf("%s",s);
}
int main(){
	ll ssw=0;
	For(i,1,10){
		int ksg=-1;
		For(j,(i==1),9){
			query(ssw*10+j);
			if(s[0]=='N'){
				ksg=j-1;break;
			}
		}
		if(ksg==-1){
			ll mjn=ssw,sana=1;ll lny=0;
			if(i==1){
				mjn=1;bool d=0;
				For(j,1,18){
					mjn*=10;query(mjn);lny++;
					if(s[0]=='N'){
						d=1;break;
					}
				}
				if(d==0){
					ssw=1;break;
				}
				if(lny>=2) ssw=ssw*10+9;
				else{
					For(j,1,9){
						query(j*10);
						if(s[0]=='Y'){
							ssw=j;break;
						}
					}
					break;
				}
			}else{
				bool d=0;
				For(j,1,18){
					if(mjn>1e17) break;
					mjn*=10;query(mjn);lny++;
					if(s[0]=='N'){
						d=1;break;
					}
					sana*=10;
				}
				if(d==0){
					ssw*=10;break;
				}
				if(lny==2){
					For(j,1,9){
						query(mjn+j*10);
						if(s[0]=='Y'){
							ssw=ssw*10+j;break;
						}
					}
					break;
				}else ssw=ssw*10+9;
			}
		}else ssw=ssw*10+ksg;
	}
	printf("! %lld",ssw);
}

Compiler output:
a.cc:40:1: error: two or more data types in declaration of 'query'
   40 | int
      | ^~~
a.cc: In function 'int main()':
a.cc:50:25: error: 'query' was not declared in this scope
   50 |                         query(ssw*10+j);
      |                         ^~~~~
a.cc:60:49: error: 'query' was not declared in this scope
   60 |                                         mjn*=10;query(mjn);lny++;
      |                                                 ^~~~~
a.cc:71:49: error: 'query' was not declared in this scope
   71 |                                                 query(j*10);
      |                                                 ^~~~~
a.cc:82:49: error: 'query' was not declared in this scope
   82 |                                         mjn*=10;query(mjn);lny++;
      |                                                 ^~~~~
a.cc:93:49: error: 'query' was not declared in this scope
   93 |                                                 query(mjn+j*10);
      |                                                 ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

mt19937 rng(10);

#define int long long

#ifdef LOCAL
int n;
#endif

int query(int N) {
	#ifdef LOCAL
	assert(N <= 1e18);
	if (n <= N && to_string(n) <= to_string(N)) return 1;
	if (n > N && to_string(n) > to_string(N)) return 1;
	return 0;
	#else 
	cout << "? " << N << endl;
	char c;
	cin >> c;
	return c == 'Y';
	#endif	
}

int chpref(int N) {
	while (N <= 1e17) {
		N = 10 * N + 9;
	}
	return query(N);
}

void run() {
	int pr = 0;
	for (int j = 0; j < 20; j++) {
		if (j > 0 && chpref(10 * pr + 0)) {
			if (query(pr + 1) == chpref(pr + 1)) break;
			// if (chpref(pr + 1)) break;
		}
		int l = 0;
		if (j > 0) l = -1;
		int r = 9;
		while (r - l > 1) {
			int m = (r + l) / 2;
			if (!chpref(10 * pr + m)) l = m;
			else r = m;
		}
		pr = 10 * pr + r;
	}
	#ifdef LOCAL
	if (n != pr) {
		cerr << "WA: " << n << endl;
		cerr << pr << endl;
		exit(0);
	} else {
		cerr << "AC" << endl;
	}
	#else 
	cout << "! " << n << endl;
	#endif
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	#ifdef LOCAL
	while (true) {
		n = rng() % (int)(1e9) + 1;
		run();		
	}
	#else 
	run();
	#endif
}


Compiler output:
a.cc: In function 'void run()':
a.cc:81:25: error: 'n' was not declared in this scope; did you mean 'yn'?
   81 |         cout << "! " << n << endl;
      |                         ^
      |                         yn
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

mt19937 rng(10);

#define int long long

#ifdef LOCAL
int n;
#endif

int query(int N) {
	#ifdef LOCAL
	assert(N <= 1e18);
	if (n <= N && to_string(n) <= to_string(N)) return 1;
	if (n > N && to_string(n) > to_string(N)) return 1;
	return 0;
	#else 
	cout << "? " << N << endl;
	char c;
	cin >> c;
	return c == 'Y';
	#endif	
}

int chpref(int N) {
	while (N <= 1e17) {
		N = 10 * N + 9;
	}
	return query(N);
}

void run() {
	int pr = 0;
	for (int j = 0; j < 20; j++) {
		if (j > 0 && chpref(10 * pr + 0)) {
			if (query(pr + 1) == chpref(pr + 1)) break;
			// if (chpref(pr + 1)) break;
		}
		int l = 0;
		if (j > 0) l = -1;
		int r = 9;
		while (r - l > 1) {
			int m = (r + l) / 2;
			if (!chpref(10 * pr + m)) l = m;
			else r = m;
		}
		pr = 10 * pr + r;
	}
	if (n != pr) {
		cerr << "WA: " << n << endl;
		cerr << pr << endl;
		exit(0);
	} else {
		cerr << "AC" << endl;
	}
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	#ifdef LOCAL
	while (true) {
		n = rng() % (int)(1e9) + 1;
		run();		
	}
	#else 
	run();
	#endif
}


Compiler output:
a.cc: In function 'void run()':
a.cc:72:13: error: 'n' was not declared in this scope; did you mean 'yn'?
   72 |         if (n != pr) {
      |             ^
      |             yn
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<62)-1
#define MAX 1000000000
bool f(int X){
    printf("? %lld\n",X*10);
    char S; cin>>S;
    return S=='Y';
}
signed main(){
    int memo=10;
    int cnt=0;
    while(1){
        printf("? %lld\n",memo);
        string S; cin>>S;
        cnt++;
        if(S=="N") break;
        printf("? %lld\n",memo-1);
        cin>>S;
        cnt++;
        if(S=="Y") break;
        memo*=10;
    }
    int left=memo/10,right=memo-1;
    while(left+1<right){
        int mid=(left+right)/2;
        if(f(mid)) right=mid;
        cnt++;
        else left=mid;
    }
    int ans=right;
    if(f(left)) ans=left;
    cnt++;
    if(cnt>=64){
        while(1){}
    }
    printf("! %lld\n",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:9: error: 'else' without a previous 'if'
   44 |         else left=mid;
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
int qry(ll x){
	printf("? %lld\n",x);
	fflush(stdout);
	char s[3];
	scanf("%s",s);
	if (s[0]=='Y') return 1;
	return 0;
}
int main(){
	int w=0;ll L=1;
	for (;qry(L) && w<=9;w++,L*=10);
	if (w>9){
		w=0,L=10;
		for (;!qry(L-1);w++,L*=10);
		printf("! %lld\n",L/10);
		fflush(stdout);
		return 0;
	}
	ll R=L-1,ans;
	w--,L/=10;
	while (L<=R){
		ll mid=(L+R)>>1;
		if (qry(mid*10)) ans=max(ans,mid),R=mid-1;
		else L=mid+1;
	}
	printf("! %lld\n",ans);
	fflush(stdout);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:38: error: 'max' was not declared in this scope; did you mean 'std::max'?
   25 |                 if (qry(mid*10)) ans=max(ans,mid),R=mid-1;
      |                                      ^~~
      |                                      std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
bool query(int x){
	printf("? %lld\n", x);
	fflush(stdout);
	char s[20]; scanf("%s", s);
	return str[0] == 'Y';
}
int pows(int x, int y) {
	int z = 1;
	while(y) {
		if(y & 1) z *= x;
		x *= x, y >>= 1;
	} return z;
}
signed main() {
	int len = 1;
	query(1);
	//while(query(pows(10, len) - 1)) len++;
	int l = pows(10, len - 1), r = pows(10, len) - 1;
	/*while(l < r) {
		int m = (l + r + 1) >> 1;
		if(query(m)) l = m;
		else r = m + 1;
	}*/
	printf("! %lld\n", l);
	return 0;
}

Compiler output:
a.cc: In function 'bool query(long long int)':
a.cc:8:16: error: 'str' was not declared in this scope; did you mean 'std'?
    8 |         return str[0] == 'Y';
      |                ^~~
      |                std
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
bool query(int x){
	printf("? %lld\n", x);
	fflush(stdout);
	char s[20]; scanf("%s", s);
	return str[0] == 'Y';
}
int pows(int x, int y) {
	int z = 1;
	while(y) {
		if(y & 1) z *= x;
		x *= x, y >>= 1;
	} return z;
}
signed main() {
	int len = 1;
	while(query(pows(10, len) - 1)) len++;
	int l = pows(10, len - 1), r = pows(10, len) - 1;
	/*while(l < r) {
		int m = (l + r + 1) >> 1;
		if(query(m)) l = m;
		else r = m + 1;
	}*/
	printf("! %lld\n", l);
	return 0;
}

Compiler output:
a.cc: In function 'bool query(long long int)':
a.cc:8:16: error: 'str' was not declared in this scope; did you mean 'std'?
    8 |         return str[0] == 'Y';
      |                ^~~
      |                std
Language: C++

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	for (auto &u : v) os << u << el;
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}
int N;

char judge(string &T) {
#ifdef DEBUG
	if (stoi(T) <= N && T <= to_string(N) ||
			stoi(T) > N && T > to_string(N) ) {
		c = 'Y';
	} else {
		c = 'N';
	}
#else
	cin >> c;
#endif
	return (c);
}

int main() {
#ifdef DEBUG
	cin >> N;
#endif
	string S;
	while (true) {
		int ok, ng;
		char c;

		//sakini 9 situmon suru
		{
			string T = S + '9';
			cout << "? " << T << el;
			fflush(stdout);
			c = judge(T);
		}

		if (c == 'N') {
			ok = 0, ng = 9;
			while (abs(ok-ng) > 1) {
				int m = (ok+ng)/2;
				string T = S + (char)(m + '0');
				cout << "? " << T << el;
				fflush(stdout);
				c = judge(T);
				if (c == 'Y') ok = m;
				else ng = m;
			}
			S += (ok + '0');	
			continue;
		}

		ok = 10, ng = -1;
		while (abs(ok-ng) > 1) {
			int m = (ok+ng)/2;
			string T = S + (char)(m + '0');
			if (count(begin(T), end(T), '0') == T.size()) {
				ng = m;
				continue;
			}
			while (T.size() < 15) T += '0';
			cout << "? " << T << el;
			fflush(stdout);
			c = judge(T);
			if (c == 'Y') ok = m;
			else ng = m;
		}
		if (ok == 10) {
			S += '9';
			continue;
		} else {
			S += (ok + '0');
			cout << "! " << S << el;
			fflush(stdout);
			break;
		}
	}
	return (0);
}


Compiler output:
a.cc: In function 'char judge(std::string&)':
a.cc:49:16: error: 'c' was not declared in this scope
   49 |         cin >> c;
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

#define int long long

int N;

string hoge(int n){
  string res;

  //cout<<"N = "<<N<<" n = "<<n<<endl;

  if(n <= N && to_string(n) <= to_string(N)) res = "Y";
  else if(n > N && to_string(n) > to_string(N)) res = "Y";
  else res = "N";
  // cout<<"res = "<<res<<endl;

  cout<<res<<endl;

  //string hogehoge;
  //cin>>hogehoge;

  return res;
}

bool checkt(int m){
  string ans;

  m *= 10;

  cout<<"? "<<m<<endl;
  //cout<<flush;

  ans = hoge(m);
  //cin>>ans;

  return ans == "Y";
}

void solvet(){
   int con = 0;

  for(int i = 1; ;i *= 10){
    int n = i;
    string ans;

    cout<<"? "<<n<<endl;
    //cout<<flush;

    // cin>>ans;
    ans = hoge(n);

    if(ans == "Y") {
      con++;
    } else{
      break;
    }
  }

  // cout<<con<<endl;

  int l = 1, h = 10, m = 0;

  for(int i = 1; i < con; i++){
    l *= 10;
    h *= 10;
  }

  while(l + 1< h){
    m = (l + h)/2;

    if(!checkt(m)){
      l = m;
    } else {
      h = m;
    }
  }

  cout<<"! "<<h<<endl;
  cout<<flush;
}


void test(){

  while(true){
    cin>>N;

    solvet();

    while(true){
      int x;
      cin>>x;
      cout<<hoge(x)<<endl;
    }
  }
}


bool check(int m){
  string ans;

  m *= 10;

  cout<<"? "<<m<<endl;
  cout<<flush;

  cin>>ans;

  return ans == "Y";
}





void solve(){
   int con = 0;

  for(int i = 1; ;i *= 10){
    int n = i;
    string ans;

    cout<<"? "<<n<<endl;
    cout<<flush;

    cin>>ans;

    if(ans == "Y") {
      con++;
    } else if(ans == "N"){
      break;
    }
  }

  // cout<<con<<endl;

  int l = 1, h = 10, m = 0;

  for(int i = 1; i < con; i++){
    l *= 10;
    h *= 10;
  }

  while(l + 1< h){
    m = (l + h)/2;

    if(!check(m)){
      l = m;
    } else {
      h = m;
    }
  }

  cout<<"! "<<h<<endl;
  cout<<flush;
}



signed main(){

  // test();

  sovle();

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:165:3: error: 'sovle' was not declared in this scope; did you mean 'solve'?
  165 |   sovle();
      |   ^~~~~
      |   solve
Language: C++

#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long i,l,r,mid,max1,y;
char s[15];
void query(long long x){
	printf("? %lld\n",x);
	fflush(stdout);
	scanf("%s",s);
}
int main(){
	//freopen("camp.in","r",stdin);
	//freopen("camp.out","w",stdout);
	for(i=1;;i=i*10){
		query(i);
		if(s[0]=='N'){
			i/=10;
			l=i;
			r=i*10-1;
			mid=(l+r)/2;
			break;
		}
	}
	while(l<=r){
		query(mid*10);
		if(s[0]=='Y'){
			min1=min(min1,mid);
			r=mid-1;
		}
		else
			l=mid+1;
		mid=(l+r)/2;
	}
	cout<<"! "<<max1<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:25: error: 'min1' was not declared in this scope
   58 |                         min1=min(min1,mid);
      |                         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    const int I = 64;
    const int D = 10;
    const char Y = 'Y';
    const char N = 'N';

    auto qout = [](ll x){cout << "? " << to_string(x) << endl; cout.flush();return;};
    auto aout = [](ll x){cout << "! " << to_string(x) << endl; cout.flush();return;};
    auto qin = []{char c; cin >> c; return c == Y;};

    int n = 9;
    int i = 0;
    vector<bool> visit(D);
    vector<bool> yn(D);

    ll ans = 1e9;
    while(true) {
        qout(ans+1);
        i++;
        if (qin()) {
            qout(ans);
            i++;
            if (qin()) {
                aout(ans):
                return 0;
            }
            break;
        } else {
            ans /= 10;
            n--;
            if (n == 0) break;
        }
    }

    bool nl = false;
    int x = 1;
    int d = 8;
    ans = 0;
    while(i < I) {
        if(nl) {
            visit = vector<bool>(D);
            yn = vector<bool>(D);
            x = 0;
            d = 9;
            nl = false;
        }
        visit[x] = true;
        if (n == 0) {
            qout(ans*100 + x*10);
        } else {
            qout(ans*10 + x);
        }
        bool b = qin();
        yn[x] = b;
        if (b) {
            if (n == 0) {
                aout(ans*10+x);
                return 0;
            } else if (x == 9) {
                ans = ans * 10 + x;
                n--;
                nl = true;
            } else if (visit[x+1] && !yn[x+1]) {
                ans = ans * 10 + x;
                n--;
                nl = true;
            } else {
                x += d;
            }
        } else {
            if (n == 0) {
                x++;
            } else if (visit[x-1] && yn[x-1]) {
                ans = ans * 10 + x-1;
                n--;
                nl = true;
            } else {
                x -= d;
            }
        }

        d /= 2; if (d == 0) d = 1;
        i++;
    }
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:26: error: expected ';' before ':' token
   40 |                 aout(ans):
      |                          ^
      |                          ;
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n=1e9;char s[10];
void query(int x){printf("? %d\n",x);fflush(stdout);scanf("%s",s);}
int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
    while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}
    return x*f;
}
int main(){
	while(1){
		query(n);
		if(s[0]=='Y') break;
		else n/=10;
	}
	int base=n;int now=n+base;
	while(1){
		query(now);
		if(s[0]=='N') now-=base,base/=10;
		if(!base) break; now+=base;
	}prinf("! %d\n",now);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:10: error: 'prinf' was not declared in this scope; did you mean 'printf'?
   23 |         }prinf("! %d\n",now);
      |          ^~~~~
      |          printf