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

#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define BUFF_SIZE (int)2e5 + 1

typedef struct {
    intmax_t writeidx;
    intmax_t readidx;
    intmax_t count;
    intmax_t buff[BUFF_SIZE];
} FIFO;

void fifo_init(FIFO *fifo)
{
    fifo->writeidx = 0;
    fifo->readidx = 0;
    fifo->count = 0;
}

void fifo_enqueue(FIFO *fifo, intmax_t *v)
{
    intmax_t i;

    if (v == NULL)
        return;

    if (fifo->count < BUFF_SIZE) {
        i = fifo->writeidx;
        fifo->count++;
        fifo->buff[i] = *v;
        fifo->writeidx = (i + 1) % BUFF_SIZE;
    }
}

bool fifo_dequeue(FIFO *fifo, intmax_t *r)
{
    intmax_t i;

    if (r == NULL)
        return 1;

    if (fifo->count == 0)
        return 1;

    i = fifo->readidx;
    *r = fifo->buff[i];
    fifo->count--;
    fifo->readidx = (i + 1) % BUFF_SIZE;

    return 0;
}

intmax_t N, M, A, B;
bool pass[(int)1e5 + 1][(int)1e5 + 1];
intmax_t ans[(int)2e5 + 1] = {};
FIFO fifo;

int main(void)
{
    intmax_t cave;

    scanf("%jd%jd", &N, &M);
    for (size_t i = 0; i < M; i++) {
        scanf("%jd%jd", &A, &B);
        pass[A][B] = true;
        pass[B][A] = true;
    }

    fifo_init(&fifo);
    cave = 1;
    fifo_enqueue(&fifo, &cave);

    while (fifo_dequeue(&fifo, &cave) == 0) {
        for (intmax_t i = 1; i <= N; i++) {
            if (pass[cave][i] && (ans[i] == 0)) {
                ans[i] = cave;
                fifo_enqueue(&fifo, &i);
            }
        }
    }

    puts("Yes");
    for (size_t i = 2; i <= N; i++) {
        printf("%jd\n", ans[i]);
    }

    return 0;
}


Compiler output:
/tmp/ccClxlvb.o: in function `main':
main.c:(.text+0x249): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/ccClxlvb.o
main.c:(.text+0x267): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/ccClxlvb.o
main.c:(.text+0x2b4): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccClxlvb.o
main.c:(.text+0x2d4): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccClxlvb.o
main.c:(.text+0x2e6): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/ccClxlvb.o
main.c:(.text+0x31c): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/ccClxlvb.o
main.c:(.text+0x35b): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccClxlvb.o
collect2: error: ld returned 1 exit status
Language: C

#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define BUFF_SIZE (int)2e5 + 1

typedef struct {
    intmax_t writeidx;
    intmax_t readidx;
    intmax_t count;
    intmax_t buff[BUFF_SIZE];
} FIFO;

void fifo_init(FIFO *fifo)
{
    fifo->writeidx = 0;
    fifo->readidx = 0;
    fifo->count = 0;
}

void fifo_enqueue(FIFO *fifo, intmax_t *v)
{
    intmax_t i;

    if (v == NULL)
        return;

    if (fifo->count < BUFF_SIZE) {
        i = fifo->writeidx;
        fifo->count++;
        fifo->buff[i] = *v;
        fifo->writeidx = (i + 1) % BUFF_SIZE;
    }
}

bool fifo_dequeue(FIFO *fifo, intmax_t *r)
{
    intmax_t i;

    if (r == NULL)
        return 1;

    if (fifo->count == 0)
        return 1;

    i = fifo->readidx;
    *r = fifo->buff[i];
    fifo->count--;
    fifo->readidx = (i + 1) % BUFF_SIZE;

    return 0;
}

intmax_t N, M, A, B;
bool pass[(int)1e5 + 1][(int)1e5 + 1];
intmax_t ans[(int)2e5 + 1] = {};
FIFO fifo;

int main(void)
{
    intmax_t cave;

    scanf("%jd%jd", &N, &M);
    for (size_t i = 0; i < M; i++) {
        scanf("%jd%jd", &A, &B);
        pass[A][B] = true;
        pass[B][A] = true;
    }

    fifo_init(&fifo);
    cave = 1;
    fifo_enqueue(&fifo, &cave);

    while (fifo_dequeue(&fifo, &cave) == 0) {
        for (intmax_t i = 1; i <= N; i++) {
            if (pass[cave][i] && (ans[i] == 0)) {
                ans[i] = cave;
                fifo_enqueue(&fifo, &i);
            }
        }
    }

    puts("Yes");
    for (size_t i = 2; i <= N; i++) {
        printf("%jd\n", ans[i]);
    }

    return 0;
}


Compiler output:
/tmp/cc6hsQnz.o: in function `main':
main.c:(.text+0x249): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/cc6hsQnz.o
main.c:(.text+0x267): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/cc6hsQnz.o
main.c:(.text+0x2b4): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc6hsQnz.o
main.c:(.text+0x2d4): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc6hsQnz.o
main.c:(.text+0x2e6): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/cc6hsQnz.o
main.c:(.text+0x31c): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/cc6hsQnz.o
main.c:(.text+0x35b): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc6hsQnz.o
collect2: error: ld returned 1 exit status
Language: C++

from collections import deque
from sys import stdin
nii=lambda:map(int,stdin.readline().split())

n,m=nii()

tree=[[] for i in range(n)]
for i in range(m):
  a,b=nii()
  a-=1
  b-=1
  tree[a].append(b)
  tree[b].append(a)

ans=[-1 for i in range(n)]
ans[0]=0

dq=deque()
dq.append(0)
while dq:
  x=dq.popleft()
  for i in tree[x]:
    if ans[i]==-1:
      ans[i]=x
      dq.append(i)

print('Yes')
for i in ans[1:]:
  print(i+1)

Compiler output:
a.cc:27:7: warning: multi-character character constant [-Wmultichar]
   27 | print('Yes')
      |       ^~~~~
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import deque
      | ^~~~
Language: C++

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

int main(){
  int n,m;
  cin >> n >> m;
  
  vector<vector<int>> graph(n,vector<int>(0));
  vector<int> depth(n,-1);
  vector<int> path(n);
  queue<int> que;
  que.push(0);
  depth[0] = 0;
  
  int a,b;
  for(int i=0; i<m; i++){
    cin >> a >> b;
    a--; b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  
  while(!que.empty()){
    int v = que.front();
    que.pop();
    
    for(int k : graph[v]){
      if(depth[k] != -1) continue;
      depth[k] = depth[v] + 1;
      path[k] = v; 
      que.push(k);
    }
  }

    cout << "Yes" << endl;
    for(int i=1; i<n; i++){
      cout << path[i] + 1 << endl;
    }
  }
}


Compiler output:
a.cc:41:1: error: expected declaration before '}' token
   41 | }
      | ^
Language: C++

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<queue>
#include<string.h>
using namespace std;
int main(){
 long long n,m;
 long long i,j,k;
 scanf("%lld%lld",&n,&m);
 long long a[m+1],b[m+1];
 printf("%lld %lld\n",n,m
 for(i=0;i<m;i++){
  scanf(" %lld%lld",&a[i],&b[i]);
  printf("%lld %lld\n",a[i],b[i]);
 }
 long long num[n+1]={100000},ans[n+1]={0};
 queue<long long>que;
 que.push(1);
 for(i=0;i<1+n;i++){
  ans[i]=0;
  num[i]=100000;
 }
 num[1]=0;
 long long u;while(!que.empty()){
  u=que.front();
  que.pop();
  for(i=0;i<m;i++){
   if(a[i]==u){
    if(num[b[i]]>num[u]+1){
     num[b[i]]=num[u]+1;
     que.push(b[i]);
    }
   }
   if(b[i]==u){
    if(num[a[i]]>num[u]+1){
     num[a[i]]=num[u]+1;
     que.push(a[i]);
     }
    }
   }
 
 }
 for(i=0;i<m;i++){
  if(num[a[i]]<num[b[i]])
   ans[b[i]]=a[i];
  if(num[b[i]]<num[a[i]])
   ans[a[i]]=b[i];
}
 puts("Yes"); 
 for(i=2;i<n+1;i++){
  printf("%lld\n",num[i]);
  }

return 0;}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:26: error: expected ')' before 'for'
   14 |  printf("%lld %lld\n",n,m
      |        ~                 ^
      |                          )
   15 |  for(i=0;i<m;i++){
      |  ~~~                      
a.cc:15:17: error: expected ';' before ')' token
   15 |  for(i=0;i<m;i++){
      |                 ^
      |                 ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const int INF = 1e9+7;

int N,M;

int main(){
    cin>>N>>M;
    vector<vector<int>> G(N);
    
    for(int i=0; i<M; i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    queue<int> q;
    q.push_back(0);
    vector<int> dis(N,INF);
    map<int,int> ans;
    dis[0] = 0;

    while(!q.empty()){
        int u = q.front();
        q.pop();
        for(auto a : G[u]){
            if(dis[u] + 1 < dis[a]){
                dis[a] = dis[u]+1;
                ans[a] = u+1;
            }
        } 
    }

    bool flag = true;
    for(int i=0; i<N; i++) if(dis[i] == INF) flag = false;

    if(flag){
        cout<<"Yes"<<endl;
        for(int i=1; i<N; i++){
            cout<<ans[i]<<endl;
        }
    }

    else cout<<"No"<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:7: error: 'class std::queue<int>' has no member named 'push_back'
   21 |     q.push_back(0);
      |       ^~~~~~~~~
Language: C

#include <stdio.h>
#include <string.h>
#include <math.h>

int path[200200][200200];
int exist = 0;
int kai;
int min = 200200;
int ans[200200],no[200200];
int N,M;
int cycle(int node){
	//printf("node:%ld\n",node);
	int ret;
	if(node ==1){
		if(min>kai)min=kai;
		//printf("<<%ld>>\n",min);
		exist = 1;
		kai = 0;
		return 0;
	}
	int i;
	kai++;
	if(no[node]==1){
		//kai=0;
		return 1;
	}
	no[node]=1;
	
	//printf("kai:%ld\n",kai);
	for(i=1;i<=M;i++){
		if(path[node][i]){
			//printf("-->%ld\n",i);
			ret=cycle(i);
			if(ret==0){
				//printf("don\n");
				return 0;
			}
		}
	}

	return 1;
	
}
int main(){
	

	int i;
	scanf("%d%d",&N,&M);
	
	for(i=0;i<M;i++){
		int t,s;
		scanf("%d%d",&t,&s);
		path[t][s]=1;
		path[s][t]=1;
	}
	
	for(i=2;i<=N;i++){
		cycle(i);
		//printf("(%ld)%ld %ld\n",i,kai,min);
		ans[i-1]=min;
		min = 200200;
		int j;
		for(j=0;j<=N;j++)no[j]=0;
	}
	if(exist){
		printf("Yes\n");
		for(i=1;i<N;i++)printf("%d\n",ans[i]);
		
	}else {
		printf("No\n");
	}
	
	
	
		
	return 0;
}


Compiler output:
/tmp/ccja1YTr.o: in function `cycle':
main.c:(.text+0x19): relocation truncated to fit: R_X86_64_PC32 against symbol `kai' defined in .bss section in /tmp/ccja1YTr.o
main.c:(.text+0x23): relocation truncated to fit: R_X86_64_PC32 against symbol `kai' defined in .bss section in /tmp/ccja1YTr.o
main.c:(.text+0x2f): relocation truncated to fit: R_X86_64_PC32 against symbol `exist' defined in .bss section in /tmp/ccja1YTr.o
main.c:(.text+0x39): relocation truncated to fit: R_X86_64_PC32 against symbol `kai' defined in .bss section in /tmp/ccja1YTr.o
main.c:(.text+0x4d): relocation truncated to fit: R_X86_64_PC32 against symbol `kai' defined in .bss section in /tmp/ccja1YTr.o
main.c:(.text+0x56): relocation truncated to fit: R_X86_64_PC32 against symbol `kai' defined in .bss section in /tmp/ccja1YTr.o
main.c:(.text+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `no' defined in .bss section in /tmp/ccja1YTr.o
main.c:(.text+0x8d): relocation truncated to fit: R_X86_64_PC32 against symbol `no' defined in .bss section in /tmp/ccja1YTr.o
main.c:(.text+0xec): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccja1YTr.o
/tmp/ccja1YTr.o: in function `main':
main.c:(.text+0x107): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccja1YTr.o
main.c:(.text+0x111): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
#include <sstream>
#include <bitset>
#define PI 3.141592653589793
 
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;
ll ma[250000][250000];
ll sign[250000];
int main(){
    ll n, m, tmp1, tmp2;
    cin >> n >> m;
    
    fill(sign, sign+n, -1);
    sign[0]=0;
    for(ll i=0;i<n;i++) {
        fill(ma[i], ma[i]+n, 0);
    }
    for(ll i=0;i<m;i++) {
        cin >> tmp1 >> tmp2;
        ma[tmp1-1][tmp2-1]=1;
        ma[tmp2-1][tmp1-1]=1;
    }
    queue<int> room;
    room.push(0);
    ll last_visited;
    while(1) {
        if(room.empty()) break;
        last_visited = room.front();
        room.pop();
        for(ll i=0;i<n;i++) {
            if(ma[last_visited][i]==1 && sign[i]==-1) {
                sign[i] = last_visited;
                room.push(i);
            }
        }
    }
 
    cout << "Yes" << endl;
    for(ll i=1;i<n;i++) {
        cout << sign[i]+1 << endl;
    }
    return 0;
}

Compiler output:
/tmp/ccxAhaE1.o: in function `main':
a.cc:(.text+0x4a): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccxAhaE1.o
a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccxAhaE1.o
a.cc:(.text+0x6e): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccxAhaE1.o
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccxAhaE1.o
a.cc:(.text+0x253): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccxAhaE1.o
a.cc:(.text+0x2d9): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccxAhaE1.o
collect2: error: ld returned 1 exit status
Language: C++

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

int main() {
  int a,b,h,m;
  double pi = 3.141592653589793;
  double aa, ab,angle ;
  double d;
  cin >> b >> a >> h >> m;
  aa = a * 30 + b * 30 / 60 ; 
  bb = b * 6 ;
  if(aa >= bb) angle = aa - bb ;
  else angle = bb - aa ;
  if(angle == 0) cout << b - a;
  else if(angle == 180) cout << b + a ;
  else{
    angle = pi * angle / 180;
    d = a * a + b * b - 2 * a * b * cos(angle);
    d = sqrt(d);
    cout << d ;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'bb' was not declared in this scope; did you mean 'ab'?
   11 |   bb = b * 6 ;
      |   ^~
      |   ab
Language: C++

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
#include <sstream>
#include <bitset>
#define PI 3.141592653589793

const int MOD = 1e9+7;
typedef long long ll;
using namespace std;
ll ma[250000][250000];
ll sign[250000];
int main(){
    ll n, m, tmp1, tmp2;
    cin >> n >> m;
 //   ll ma[n][n];
 //   ll sign[n];
    fill(sign, sign+n, -1);
    sign[0]=0;
    for(ll i=0;i<n;i++) {
        fill(ma[i], ma[i]+n, 0);
    }
    for(ll i=0;i<m;i++) {
        cin >> tmp1 >> tmp2;
        ma[tmp1-1][tmp2-1]=1;
        ma[tmp2-1][tmp1-1]=1;
    }
    queue<int> room;
    room.push(0);
    ll last_visited;
    while(1) {
        if(room.empty()) break;
        last_visited = room.front();
        room.pop();
        for(ll i=0;i<n;i++) {
            if(ma[last_visited][i]==1 && sign[i]==-1) {
                sign[i] = last_visited;
                room.push(i);
            }
        }
    }

    cout << "Yes" << endl;
    for(ll i=1;i<n;i++) {
        cout << sign[i]+1 << endl;
    }
    return 0;
}

Compiler output:
/tmp/ccSlILum.o: in function `main':
a.cc:(.text+0x4a): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccSlILum.o
a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccSlILum.o
a.cc:(.text+0x6e): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccSlILum.o
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccSlILum.o
a.cc:(.text+0x253): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccSlILum.o
a.cc:(.text+0x2d9): relocation truncated to fit: R_X86_64_PC32 against symbol `sign' defined in .bss section in /tmp/ccSlILum.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <sstream>
#include <bitset>
#define PI 3.141592653589793

const int MOD = 1e9+7;
typedef long long ll;
using namespace std;
ll ma[250000][250000];
ll sign[250000];
int main(){
    ll n, m, tmp1, tmp2;
    cin >> n >> m;
 //   ll ma[n][n];
 //   ll sign[n];
    fill(sign, sign+n, -1);
    sign[0]=0;
    for(ll i=0;i<n;i++) {
        fill(ma[i], ma[i]+n, 0)
    }
    for(ll i=0;i<m;i++) {
        cin >> tmp1 >> tmp2;
        ma[tmp1-1][tmp2-1]=1;
        ma[tmp2-1][tmp1-1]=1;
    }
    queue<int> room;
    queue.push(0);
    ll last_visited;
    while(1) {
        if(room.empty()) break;
        last_visited = room.front();
        room.pop();
        for(ll i=0;i<n;i++) {
            if(ma[last_visited][i]==1 && sign[i]==-1) {
                sign[i] = last_visited;
                room.push(i);
            }
        }
    }

    cout << "Yes" << endl;
    for(ll i=1;i<n;i++) {
        cout << sign[i]+1 << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:32: error: expected ';' before '}' token
   26 |         fill(ma[i], ma[i]+n, 0)
      |                                ^
      |                                ;
   27 |     }
      |     ~                           
a.cc:34:10: error: expected unqualified-id before '.' token
   34 |     queue.push(0);
      |          ^
Language: C++

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <ma>
#include <sstream>
#include <bitset>
#define PI 3.141592653589793

const int MOD = 1e9+7;
typedef long long ll;
using namespace std;
ll ma[250000][250000];
ll sign[250000];
int main(){
    ll n, m, tmp1, tmp2;
    cin >> n >> m;
 //   ll ma[n][n];
 //   ll sign[n];
    fill(sign, sign+n, -1);
    sign[0]=0;
    for(ll i=0;i<n;i++) {
        fill(ma[i], ma[i]+n, 0)
    }
    for(ll i=0;i<m;i++) {
        cin >> tmp1 >> tmp2;
        ma[tmp1-1][tmp2-1]=1;
        ma[tmp2-1][tmp1-1]=1;
    }
    queue<int> room;
    queue.push(0);
    ll last_visited;
    while(1) {
        if(room.empty()) break;
        last_visited = room.front();
        room.pop();
        for(ll i=0;i<n;i++) {
            if(ma[last_visited][i]==1 && sign[i]==-1) {
                sign[i] = last_visited;
                room.push(i);
            }
        }
    }

    cout << "Yes" << endl;
    for(ll i=1;i<n;i++) {
        cout << sign[i]+1 << endl;
    }
    return 0;
}

Compiler output:
a.cc:9:10: fatal error: ma: No such file or directory
    9 | #include <ma>
      |          ^~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> t(m, inf);
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        t.at(a) = b;
    }
    
    vector<int> mark(n, inf), dammy(n,inf);
    
    queue<int> q;
    rep(i,n){
        while(!q.empty()){
            q.push_back(i);
            
        }
        
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:15: error: 'class std::queue<int>' has no member named 'push_back'
   23 |             q.push_back(i);
      |               ^~~~~~~~~
Language: Java



import java.util.ArrayList;
import java.util.Collection;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		int m=scanner.nextInt();
		int start,end;
		ArrayList<Node> nodes=new ArrayList<Node>();
		nodes.add(new Node(0));
		nodes.add(new Node(1));
		nodes.get(1).length=0;
		for(int i=2;i<=n;i++) {
			nodes.add(new Node(i));
		}
		for(int i=0;i<m;i++) {
			start=scanner.nextInt();
			end=scanner.nextInt();
			nodes.get(start).next.add(end);
			nodes.get(end).next.add(start);
		}
		
		for(int i=1;i<=n;i++) {
			for(int j=0;j<nodes.get(i).next.size();j++) {
				if(nodes.get(nodes.get(i).next.get(j)).length>nodes.get(i).length) {
					nodes.get(nodes.get(i).next.get(j)).length=nodes.get(i).length+1;
					nodes.get(nodes.get(i).next.get(j)).pre=i;
					for(Integer n1:nodes.get(nodes.get(i).next.get(j)).next) {
						if(nodes.get(n1).pre==nodes.get(nodes.get(i).next.get(j)).) {
							
						}
					}
				}
				else if(nodes.get(nodes.get(i).next.get(j)).length<nodes.get(i).length) {
					nodes.get(i).length=nodes.get(nodes.get(i).next.get(j)).length+1;
					nodes.get(i).pre=nodes.get(nodes.get(i).next.get(j)).num;
				}
			}
		}
		for(int i=1;i<=n;i++) {
			for(int j=0;j<nodes.get(i).next.size();j++) {
				if(nodes.get(nodes.get(i).next.get(j)).length>nodes.get(i).length) {
					nodes.get(nodes.get(i).next.get(j)).length=nodes.get(i).length+1;
					nodes.get(nodes.get(i).next.get(j)).pre=i;
					
				}
				else if(nodes.get(nodes.get(i).next.get(j)).length<nodes.get(i).length) {
					nodes.get(i).length=nodes.get(nodes.get(i).next.get(j)).length+1;
					nodes.get(i).pre=nodes.get(nodes.get(i).next.get(j)).num;
				}
			}
		}
		for(int i=1;i<=n;i++) {
			if(nodes.get(i).length==10000000) {
				System.out.println("No");
				return;
			}
			
		}
		System.out.println("Yes");
		for(int i=2;i<=n;i++) {
			System.out.println(nodes.get(i).pre);
		}
	}
	
}
class Node implements Comparable<Node>{
	int num;
	int pre=-1;
	int length=10000000;
	ArrayList<Integer> next=new ArrayList<Integer>();
	public Node(int num) {
		this.num=num;
	}
	@Override
	public int compareTo(Node o) {
		
		return this.length-o.length;
	}
	
}

Compiler output:
Main.java:34: error: <identifier> expected
						if(nodes.get(n1).pre==nodes.get(nodes.get(i).next.get(j)).) {
						                                                          ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
int n, m;
vector<vector<int> > G;
vector<int> field;
vector<bool> visit(100010, false);

void bfs(){
	queue<int> que;
	que.push(0);
	visit[0] = true;
	while(!que.empty()){
		int now = que.front(); que.pop();
		for(auto next : G[now]){
			if(!visit[next]){
				que.push(next);
				field[next] = now;
				visit[next] = true;
			} 
		}
	}
}

signed main(){
	cin >> n >> m;
	vector<lint> a(m), b(m);
	G.resize(n); field.resize(n);
	for(int i = 0; i < m; i++){
		int a, b; cin >>a >> b;
		G[a - 1].push_back(b - 1); G[b - 1].push_back(a - 1);
	}
	bfs();
	cout << "Yes" << endl;
	for(int i = 1; i < n; i++) cout << field[i] + 1 << endl;
}

Compiler output:
a.cc: In function 'void bfs()':
a.cc:12:9: error: reference to 'visit' is ambiguous
   12 |         visit[0] = true;
      |         ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:7:14: note:                 'std::vector<bool> visit'
    7 | vector<bool> visit(100010, false);
      |              ^~~~~
a.cc:16:29: error: reference to 'visit' is ambiguous
   16 |                         if(!visit[next]){
      |                             ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:7:14: note:                 'std::vector<bool> visit'
    7 | vector<bool> visit(100010, false);
      |              ^~~~~
a.cc:19:33: error: reference to 'visit' is ambiguous
   19 |                                 visit[next] = true;
      |                                 ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:7:14: note:                 'std::vector<bool> visit'
    7 | vector<bool> visit(100010, false);
      |              ^~~~~
Language: Java



import java.util.ArrayList;
import java.util.Collection;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		int m=scanner.nextInt();
		int start,end;
		ArrayList<Node> nodes=new ArrayList<Node>();
		nodes.add(new Node(0));
		nodes.add(new Node(1));
		nodes.get(1).length=0;
		for(int i=2;i<=n;i++) {
			nodes.add(new Node(i));
		}
		for(int i=0;i<m;i++) {
			start=scanner.nextInt();
			end=scanner.nextInt();
			nodes.get(start).next.add(end);
			nodes.get(end).next.add(start);
		}
		
		for(int i=1;i<=n;i++) {
			for(int j=0;j<nodes.get(i).next.size();j++) {
				if(nodes.get(nodes.get(i).next.get(j)).length>nodes.get(i).length) {
					nodes.get(nodes.get(i).next.get(j)).length=nodes.get(i).length+1;
					nodes.get(nodes.get(i).next.get(j)).pre=i;
					for(Integer n1:nodes.get(nodes.get(i).next.get(j)).next) {
						if(nodes.get(n1).pre==nodes.get(nodes.get(i).next.get(j)).) {
							
						}
					}
				}
				else if(nodes.get(nodes.get(i).next.get(j)).length<nodes.get(i).length) {
					nodes.get(i).length=nodes.get(nodes.get(i).next.get(j)).length+1;
					nodes.get(i).pre=nodes.get(nodes.get(i).next.get(j)).num;
				}
			}
		}
		for(int i=1;i<=n;i++) {
			for(int j=0;j<nodes.get(i).next.size();j++) {
				if(nodes.get(nodes.get(i).next.get(j)).length>nodes.get(i).length) {
					nodes.get(nodes.get(i).next.get(j)).length=nodes.get(i).length+1;
					nodes.get(nodes.get(i).next.get(j)).pre=i;
					for(Integer n1:nodes.get(nodes.get(i).next.get(j)).next) {
						if(nodes.get(n1).pre==nodes.get(nodes.get(i).next.get(j)).) {
							
						}
					}
				}
				else if(nodes.get(nodes.get(i).next.get(j)).length<nodes.get(i).length) {
					nodes.get(i).length=nodes.get(nodes.get(i).next.get(j)).length+1;
					nodes.get(i).pre=nodes.get(nodes.get(i).next.get(j)).num;
				}
			}
		}
		for(int i=1;i<=n;i++) {
			if(nodes.get(i).length==10000000) {
				System.out.println("No");
				return;
			}
			
		}
		System.out.println("Yes");
		for(int i=2;i<=n;i++) {
			System.out.println(nodes.get(i).pre);
		}
	}
	
}
class Node implements Comparable<Node>{
	int num;
	int pre=-1;
	int length=10000000;
	ArrayList<Integer> next=new ArrayList<Integer>();
	public Node(int num) {
		this.num=num;
	}
	@Override
	public int compareTo(Node o) {
		
		return this.length-o.length;
	}
	
}

Compiler output:
Main.java:34: error: <identifier> expected
						if(nodes.get(n1).pre==nodes.get(nodes.get(i).next.get(j)).) {
						                                                          ^
Main.java:51: error: <identifier> expected
						if(nodes.get(n1).pre==nodes.get(nodes.get(i).next.get(j)).) {
						                                                          ^
2 errors
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n,m;
  cin >> n >> m;
  int load[n+1][n+1] = {0};
  int a,b;
  bool can = true;
  for(int i=0;i<m;++i){
    cin >> a >> b;
    load[a][b] = 1;load[b][a] = 1;
  }
  for(int i=1;i<=n;++i){
    bool can_2 = false;
  	for(int j=1;j<=n;++j){
    	if(load[i][j] == 1){can_2 = true;}
    }
    if(can_2 == false){can = false;}
  }
  int mark[n+1] = {0};
  int stack[500000];
  int s = 0;
  int e = 1;
  int p;
  stack[0] = 1;
  if(can == false){cout << "No" << endl;}
  else{
  	while(1){
    	p = stack[s];
    	for(int i=1;i<=n;++i){
      	if(load[p][i] == 1){ stack[e] = i; e++; mark[i] = p;}
    	}
    	for(int i=2;i<=n;++i){
      		bool end = true;
      		if(mark[i] == 0){end = false;}
    	}
    	if(end == true){
        	for(int i=2;i<=n;++i){ cout << mark[i] + "\n";}
          	cout << endl;
        }
    s++;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:16: error: invalid operands of types '<unresolved overloaded function type>' and 'bool' to binary 'operator=='
   38 |         if(end == true){
      |            ~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main(){
   
    queue<int> q;
    int v,e;
    cin>>v>>e;
    vi g[200001];
    vi ans(v+1);
    for(int i=2;i<v+1;i++)ans.at(i)=0;
    ans.at(1)=1;
    
    for(int i=0;i<e;i++){
        int s,t;
        cin>>s>>t;
        g[s].push_back(t);
        g[t].push_back(s);
    }
    
    for(int i=0;i<v2000001;i++){
        //cout<<g[1][i]<<endl;
        if(g[1][i]==0)break;
        else {
            q.push(g[1][i]);
            ans.at(g[1][i])=1;
        }
    }
    
   while (!q.empty()) {
    int s=q.front();
  
    q.pop();
         for(int i=0;i<200001;i++){
        if(g[s][i]==0)break;
        else {
            if(ans.at(g[s][i])!=0)continue;
            else{
                q.push(g[s][i]);
                ans.at(g[s][i])=s;
            }
        }
        
    
    }
  }
 
      cout<<"Yes"<<endl;
      
      for(int i=2;i<v+1;i++){
          cout<<ans.at(i)<<endl;
      }
 
    return 0;
}

   
    

   



Compiler output:
a.cc: In function 'int main()':
a.cc:35:19: error: 'v2000001' was not declared in this scope
   35 |     for(int i=0;i<v2000001;i++){
      |                   ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
//#include <functional>
//#include <iostream>

using namespace std;
typedef long long ll;

inline int at(ll x, int k){ return (x >> k) & 1; }
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)


using Graph = vector<vector<ll>>;

int main{
  ll n,m;
  cin >> n >> m;
  Graph G;
  ll a[m],b[m];
  rep(i,0,m){
    cin >> a[i] >> b[i];
    a[i] -= 1;
    b[i] -= 1;
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }

  rep(i,1,n){
  // BFS のためのデータ構造
    vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = i;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] == -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }
    if(dist[0]== n-1){
      sort(dist);
      return 0;
    }

  }


}


Compiler output:
a.cc:15:5: error: cannot declare '::main' to be a global variable
   15 | int main{
      |     ^~~~
a.cc:16:6: error: expected primary-expression before 'n'
   16 |   ll n,m;
      |      ^
a.cc:16:6: error: expected '}' before 'n'
a.cc:15:9: note: to match this '{'
   15 | int main{
      |         ^
a.cc:17:3: error: 'cin' does not name a type
   17 |   cin >> n >> m;
      |   ^~~
a.cc:19:8: error: 'm' was not declared in this scope; did you mean 'tm'?
   19 |   ll a[m],b[m];
      |        ^
      |        tm
a.cc:19:13: error: 'm' was not declared in this scope; did you mean 'tm'?
   19 |   ll a[m],b[m];
      |             ^
      |             tm
a.cc:9:20: error: expected unqualified-id before 'for'
    9 | #define rep(i,a,b) for(ll i=a;i<b;i++)
      |                    ^~~
a.cc:20:3: note: in expansion of macro 'rep'
   20 |   rep(i,0,m){
      |   ^~~
a.cc:20:7: error: 'i' does not name a type
   20 |   rep(i,0,m){
      |       ^
a.cc:9:31: note: in definition of macro 'rep'
    9 | #define rep(i,a,b) for(ll i=a;i<b;i++)
      |                               ^
a.cc:20:7: error: 'i' does not name a type
   20 |   rep(i,0,m){
      |       ^
a.cc:9:35: note: in definition of macro 'rep'
    9 | #define rep(i,a,b) for(ll i=a;i<b;i++)
      |                                   ^
a.cc:9:20: error: expected unqualified-id before 'for'
    9 | #define rep(i,a,b) for(ll i=a;i<b;i++)
      |                    ^~~
a.cc:28:3: note: in expansion of macro 'rep'
   28 |   rep(i,1,n){
      |   ^~~
a.cc:28:7: error: 'i' does not name a type
   28 |   rep(i,1,n){
      |       ^
a.cc:9:31: note: in definition of macro 'rep'
    9 | #define rep(i,a,b) for(ll i=a;i<b;i++)
      |                               ^
a.cc:28:7: error: 'i' does not name a type
   28 |   rep(i,1,n){
      |       ^
a.cc:9:35: note: in definition of macro 'rep'
    9 | #define rep(i,a,b) for(ll i=a;i<b;i++)
      |                                   ^
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define M0D 998244353;
vector<int> G[100009];
pair<int,int> ans[100009];
int count=0;

void answww(int num, int sup){
  if(count>100009) return;
  for(int j=0; j<G[num].size(); j++){
    if(ans[G[num][j]].first>sup){
      ans[G[num][j]].second = num;
      ans[G[num][j]].first = sup;
      cout << ans[G[num][j]].first << " " << ans[G[num][j]].second << endl;
    }
  }
  count++;
  sup++;
  for(int j=0; j<G[num].size(); j++){
    answww(G[num][j],sup);
  }
}

int main(){
  int N,M,num=1,sup=1;
  cin >> N >> M;
  int A[M+1],B[M+1];
  for(int i=0; i<N+1; i++) ans[i].second = 0;
  for(int i=0; i<N+1; i++) ans[i].first = 1000009;
  for(int i=1; i<=M; i++) cin >> A[i] >> B[i];
  for(int i=1; i<=M; i++){
    G[A[i]].push_back(B[i]);
    G[B[i]].push_back(A[i]);
  }
  answww(num,sup);
  cout << "Yes" << endl;
  for(int i=2; i<N+1; i++) cout << ans[i].second << endl;
  return 0;
}


Compiler output:
a.cc: In function 'void answww(int, int)':
a.cc:9:6: error: reference to 'count' is ambiguous
    9 |   if(count>100009) return;
      |      ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:6:5: note:                 'int count'
    6 | int count=0;
      |     ^~~~~
a.cc:17:3: error: reference to 'count' is ambiguous
   17 |   count++;
      |   ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:6:5: note:                 'int count'
    6 | int count=0;
      |     ^~~~~
Language: C++

#include<bits/stdc++.h> 
using namespace std; 
  
// A utility function to add an edge in an 
// undirected graph. 
void addEdge(vector<int> adj[], int u, int v) 
{ 
    adj[u].push_back(v); 
    adj[v].push_back(u); 
} 
  
// A utility function to print the adjacency list 
// representation of graph 
void printGraph(vector<int> adj[], int v,int e) 
{ 
    int visited[e]={0};
    vector<int>v1;
    visited[1]=1;
    for(int i=0;i<adj[1].size();i++)
    {
        v1.push_back(adj[i][i]);
        visited[adj[i][i]]=1;
    }
    while(!v1.empty())
    {
        int x=v[0];
        v.erase(v1.begin());
        for(int i=0;i<adj[x].size();i++)
        {
            if(visited[adj[x][i]]==0)
            {
                visited[adj[x][i]]==x;
            }
        }
    }
    int flag=0;
    for(int i=1;i<visited.size();i++)
    {
        if(visited[i]==0)
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
    {
        cout<<"No";
    }
    else
    
    {
        cout<<"Yes";
        for(int i=2;i<visited.size();i++)
        {
            cout<<visited[i]<<endl;
        }
    }
} 
  
// Driver code 
int main() 
{ 
    int v,e;
    cin>>v>>e;
    v=v+1;
    vector<int> adj[v];
    for(int i=0;i<e;i++){
        int x,y;
        cin>>x>>y;
    addEdge(adj, x, y);
    addEdge(adj ,y,x);
    }
    printGraph(adj, v,e); 
    return 0; 
} 

Compiler output:
a.cc: In function 'void printGraph(std::vector<int>*, int, int)':
a.cc:26:16: error: invalid types 'int[int]' for array subscript
   26 |         int x=v[0];
      |                ^
a.cc:27:11: error: request for member 'erase' in 'v', which is of non-class type 'int'
   27 |         v.erase(v1.begin());
      |           ^~~~~
a.cc:37:27: error: request for member 'size' in 'visited', which is of non-class type 'int [e]'
   37 |     for(int i=1;i<visited.size();i++)
      |                           ^~~~
a.cc:53:31: error: request for member 'size' in 'visited', which is of non-class type 'int [e]'
   53 |         for(int i=2;i<visited.size();i++)
      |                               ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
int n, m;
vector<vector<int> > G;
vector<int> field;
vector<bool> visit;

void bfs(){
	queue<int> que;
	que.push(0);
	visit[0] = true;
	while(!que.empty()){
		int now = que.front(); que.pop();
		for(auto next : G[now]){
			if(!visit[next]){
				que.push(next);
				field[next] = now;
				visit[next] = true;
			} 
		}
	}
}

signed main(){
	cin >> n >> m;
	vector<lint> a(m), b(m);
	G.resize(n); 
  field.resize(n);
  visit.resize(n, false);
	for(int i = 0; i < m; i++){
		int a, b; cin >>a >> b;
		G[a - 1].push_back(b - 1); G[b - 1].push_back(a - 1);
	}
	bfs();
	cout << "Yes" << endl;
	for(int i = 1; i < n; i++) cout << field[i] + 1 << endl;
}


Compiler output:
a.cc: In function 'void bfs()':
a.cc:12:9: error: reference to 'visit' is ambiguous
   12 |         visit[0] = true;
      |         ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:7:14: note:                 'std::vector<bool> visit'
    7 | vector<bool> visit;
      |              ^~~~~
a.cc:16:29: error: reference to 'visit' is ambiguous
   16 |                         if(!visit[next]){
      |                             ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:7:14: note:                 'std::vector<bool> visit'
    7 | vector<bool> visit;
      |              ^~~~~
a.cc:19:33: error: reference to 'visit' is ambiguous
   19 |                                 visit[next] = true;
      |                                 ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:7:14: note:                 'std::vector<bool> visit'
    7 | vector<bool> visit;
      |              ^~~~~
a.cc: In function 'int main()':
a.cc:30:3: error: reference to 'visit' is ambiguous
   30 |   visit.resize(n, false);
      |   ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:7:14: note:                 'std::vector<bool> visit'
    7 | vector<bool> visit;
      |              ^~~~~
Language: C++

#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
#include<math.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;

void fill_cost(vector<vector<int>>& path, vector<int>& cost, int index){
    for (auto&& x : path[index]){
        if(cost[x] > cost[index]+1){
            fill_cost(path, cost, x);
        }
    }
}

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> cost(n, INT_MAX);
    cost[0] = 0;
    vector<vector<int>> path(n);
    rep(i, m){
        int tmpA, tmpB;
        cin >> tmpA >> tmpB;
        path[tmpA-1].push_back(tmpB-1);
        path[tmpB-1].push_back(tmpA-1);
    }
    for (int i=0; i<n; ++i){
        for(auto&& x : path[i]){
            cost[x] = cost[i]+1;
        }
    }
    fill_cost(path, cost, 0);
    cout <<"Yes"<<endl;
    for (int i=1; i<n; ++i){
        int result = INT_MAX;
        for(auto&& x : path[i]){
            if(x < result){
                result = x;
            }
        }
        cout << result << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: 'INT_MAX' was not declared in this scope
   24 |     vector<int> cost(n, INT_MAX);
      |                         ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<math.h>
  +++ |+#include <climits>
    7 | #define rep(i, n) for (int i=0; i<n; ++i)
Language: C++

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

#define rep(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second　   //pairの二つ目の要素

map<int,int> M;
int m,n;
int to[200005][20005]={};
int y[20005]={};

void dsp(int p,int d){
    d++;
    rep(i,n+1){
        if(to[p][i]==1){
            to[p][i]=0;
            to[i][p]=0;
            if(M.count(i)){
                if(M[i]>d){
                    y[i]=p;
                    M[i]=d;
                }
                else d=M[i];
            }
            else{
                y[i]=p;
                cout<<i<<p<<endl;
            }
            dsp(i,d);
        }
    }
    return;
}

int main(){
    cin >>n>>m;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        to[a][b]=1;
        to[b][a]=1;
    }
    dsp(1,0);
    for(int i=2;i<=n;i++) if(y[i]==0){
        cout<<"No"<<endl;
//        return 0;
    } 
    cout<<"Yes"<<endl;
    for(int i=2;i<=n;i++) cout<<y[i]<<endl;
    return 0;
}

Compiler output:
a.cc:18:11: error: extended character 　 is not valid in an identifier
   18 | #define S second　   //pairの二つ目の要素
      |           ^
Language: C++

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

#define INF 1e+9
#define MAX_V 10

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin >> V;
    int E;
    cin >> E;
    for (int i=0; i<E; ++i) {
        int a, b;
        cin >> a >> b;
        edge e = {a, b};
        
        G[a].push_back(e);
      edge e = {b, a};
        
        G[b].push_back(e);
    }
    dijkstra(0);
    for (int i=0; i<V; ++i) {
        if(d[i] != INF)
            cout << "0から" << i << "までのコスト: " << d[i] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:12: error: redeclaration of 'edge e'
   53 |       edge e = {b, a};
      |            ^
a.cc:50:14: note: 'edge e' previously declared here
   50 |         edge e = {a, b};
      |              ^