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

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

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> to[100100];
    rep(i,m){
        int a,b;
        cin>>a>>b;
        --a;--b;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    queue<int> q;
    vector<int> dist(n, INF);
    vector<int> pre(n, -1);
    q.push(0);
    dist[0]=0;

    while(!q.empty()){
        int v = q.front(); q.pop();
        for(int u: to[v]){
            if(dist[u]!=INF)continue;
            dist[u]=dist[v]+1;
            pre[u]=v;
            q.push(u);
        }
    }
    cout<<"Yes"<<endl;
    rep(i,n){
        if(i==0)continue;
        cout<<pre[i]+1<<endl;
    }
    return 0;

}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;

const INF = 100000001010100;

vector<int> to[100005];

int main(){
  int n,m;
  cin >> n >> m;
  rep(i,m) {
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    
    to[a].push_back(b);
    to[b].push_back(a);
  }

  queue<int> q;
  vector<int> dist(n, INF);
  vector<int> pre(n,-1);
  dist[0] = 0;
  q.push(0);
  while(!q.empty()){
    v = q.front(); q.pop;
    for(int u : to[v]) {
      if(dist[u] != INF) {
        dist[u] = dist[v] + 1;
        pre[u] = v;
        q.push(u);
      }
    }
  }

  rep(i,n) {
    if(i == 0) continue;
    int ans = pre[i];
    ans++;
    
    cout << ans << endl;
  }
}


Compiler output:
a.cc:7:7: error: 'INF' does not name a type
    7 | const INF = 100000001010100;
      |       ^~~
a.cc: In function 'int main()':
a.cc:25:23: error: 'INF' was not declared in this scope
   25 |   vector<int> dist(n, INF);
      |                       ^~~
a.cc:30:5: error: 'v' was not declared in this scope
   30 |     v = q.front(); q.pop;
      |     ^
a.cc:30:22: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
   30 |     v = q.front(); q.pop;
      |                    ~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:316:7: note: declared here
  316 |       pop()
      |       ^~~
Language: C++

#include<iostream>
#include<vector>
#include<queue>
#define INF 1000000000
using namespace std;

//to[u] = v : uからvへの道がある
vector<int> to[100001];

int main(){
    int n,m;
    cin >> n >> m;
    for(int i = 0;i < m;i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    vector<int> dist (n, INF);
    vector<int> pre(n , -1);
    queue<int> q;

    dist[0] = 0;
    q.push(0);
    while(!q.empty()){
        int v = q.front(); q.pop();
        for(int i = 0;i < to[v].size();i++){
       　    int u = to[v][i];  
            if (dist[u] != INF) continue;
       　　  dist[u] = dist[v]+1;
            q.push (u);
       　　  pre[u] = v;
    　　}
    }

    cout << "Yes" << endl;

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


    return 0;
}

Compiler output:
a.cc:31:8: error: extended character 　 is not valid in an identifier
   31 |        　    int u = to[v][i];
      |        ^
a.cc:33:8: error: extended character 　 is not valid in an identifier
   33 |        　　  dist[u] = dist[v]+1;
      |        ^
a.cc:33:8: error: extended character 　 is not valid in an identifier
a.cc:35:8: error: extended character 　 is not valid in an identifier
   35 |        　　  pre[u] = v;
      |        ^
a.cc:35:8: error: extended character 　 is not valid in an identifier
a.cc:36:5: error: extended character 　 is not valid in an identifier
   36 |     　　}
      |     ^
a.cc:36:5: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:31:8: error: '\U00003000' was not declared in this scope
   31 |        　    int u = to[v][i];
      |        ^~
a.cc:32:22: error: 'u' was not declared in this scope
   32 |             if (dist[u] != INF) continue;
      |                      ^
a.cc:33:8: error: '\U00003000\U00003000' was not declared in this scope
   33 |        　　  dist[u] = dist[v]+1;
      |        ^~~~
a.cc:34:21: error: 'u' was not declared in this scope
   34 |             q.push (u);
      |                     ^
a.cc:35:12: error: expected ';' before 'pre'
   35 |        　　  pre[u] = v;
      |            ^ ~~~
      |            ;
a.cc:36:9: error: expected ';' before '}' token
   36 |     　　}
      |         ^
      |         ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector <int> adj[100009];
bool visited[100009]={0};
map <int,int> mp;
void bfs()
{
    queue <int> q;
    q.push(1);
    visited[1]=1;
    while(!q.empty())
    {
        int par=q.front();
        for(int i:adj[par])
        {
            if(!visited[i])
            {
                q.push(i);

                mp[i]=par;
                visited[i]=1;
            }
        }
        q.pop();

    }


}
int main()
{

    ll n,k;
    cin>>n>>k;

    for(i=0;i<k;i++)
    {
        ll a,b;
        cin>>a>>b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    bfs();
    if(mp.size()!=(n-1))
        cout<<"No"<<endl;
    else
    {
        cout<<"Yes"<<endl;
        for(i=2;i<=n;i++)
            cout<<mp[i]<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: 'i' was not declared in this scope
   37 |     for(i=0;i<k;i++)
      |         ^
a.cc:50:13: error: 'i' was not declared in this scope
   50 |         for(i=2;i<=n;i++)
      |             ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#define size 100001

int N,M;
int*dist[size];
int city[size];
int qu[size];
int dist_s[size];

void set(){
  int a,b;
  for(int i=0;i<N;i++){
    city[i]=-1;
    dist_s[i]=0;
  };
  city[0]=0;
  for(int i=0;i<M;i++){
    scanf("%d %d",&a,&b);
    a--;b--;
    dist[a]=realloc(dist[a],sizeof(dist_s[a]+1));
     dist[a][dist_s[a]]=b;
      dist_s[a]++;
    dist[b]=realloc(dist[b],sizeof(dist_s[b]+1));
     dist[b][dist_s[b]]=a;
      dist_s[b]++;
  };
};

void system(){
  int tar=0,nm=0,ji=0;
  while(1){
    for(int i=0;i<dist_s[tar];i++){
      if(city[dist[tar][i]]!=-1)continue;
      city[dist[tar][i]]=tar+1;
      qu[nm]=dist[tar][i];
      nm++;
    };
    if(nm==ji)break;
    tar=qu[ji];
    ji++;
  };
};
    
int main(void){
   scanf("%d%d",&N,&M);
   set();
   system();
   printf("Yes\n");
   for(int i=1;i<N;i++){
     printf("%d\n",city[i]);
   };
  
  return 0;
}

Compiler output:
main.c:30:6: error: conflicting types for 'system'; have 'void()'
   30 | void system(){
      |      ^~~~~~
In file included from main.c:2:
/usr/include/stdlib.h:923:12: note: previous declaration of 'system' with type 'int(const char *)'
  923 | extern int system (const char *__command) __wur;
      |            ^~~~~~
Language: C++

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

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

    vector<int> p(N, -1);
    p[0] = 0;
    queue<int> bfq;
    bfq.push(0);
    while (!bfq.empty())
    {
        auto v = bfq.front();
        bfq.pop();
        for (auto &&u : E[v])
        {
            if (p[u] == -1)
            {
                p[u] = v;
                bfq.push(u);
            }
        } // end u
    }
    cout << "Yes\n";
    for (int i = 1; i < N; ++i)
    {
        cout << p[i] + 1 << '\n';
    } // end i
}

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #inlcude; did you mean #include?
    3 | #inlcude <queue>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:10:5: error: 'is' was not declared in this scope
   10 |     is >> N >> M;
      |     ^~
a.cc:24:5: error: 'queue' was not declared in this scope
   24 |     queue<int> bfq;
      |     ^~~~~
a.cc:3:1: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
    2 | #include <vector>
  +++ |+#include <queue>
    3 | #inlcude <queue>
a.cc:24:11: error: expected primary-expression before 'int'
   24 |     queue<int> bfq;
      |           ^~~
a.cc:25:5: error: 'bfq' was not declared in this scope
   25 |     bfq.push(0);
      |     ^~~
Language: C++

  int N, M;
    vector<vector<int>> E;
    bool input() {
        N = M = 0;
        is >> N >> M;
        E.resize(N);
        for (int i = 0; i < M; ++i) {
            int a, b;
            is >> a >> b;
            a--; b--;
            E[a].push_back(b);
            E[b].push_back(a);
        } // end i

Compiler output:
a.cc:2:5: error: 'vector' does not name a type
    2 |     vector<vector<int>> E;
      |     ^~~~~~
a.cc: In function 'bool input()':
a.cc:5:9: error: 'is' was not declared in this scope
    5 |         is >> N >> M;
      |         ^~
a.cc:6:9: error: 'E' was not declared in this scope
    6 |         E.resize(N);
      |         ^
a.cc:13:10: error: expected '}' at end of input
   13 |         } // end i
      |          ^
a.cc:3:18: note: to match this '{'
    3 |     bool input() {
      |                  ^
a.cc:13:10: warning: no return statement in function returning non-void [-Wreturn-type]
   13 |         } // end i
      |          ^
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(200005);
    //ans(i):部屋iの道しるべ
    vi ans(200005);
    for(int i=2;i<v+1;i++)ans.at(i)=0;
    ans.at(1)=1;
    //1番目の部屋は必ず１の部屋に行ける
    
    for(int i=0;i<e;i++){
        int s,t;
        cin>>s>>t;
        (g.at(s)).push_back(t);
        (g.at(t)).push_back(s);
    }//とりあえず、辺の情報を隣接リストに収納
    
    for(int i=0;i<v+1;i++){
        //cout<<g[1][i]<<endl;
        int u=g.at(1).at(i);
        if(u==0)break;
        else {
            q.push(u);
            ans.at(u)=1;//部屋sと接している部屋の道しるべは1
        }
    }//まず、1の部屋から調べて行って、1の部屋と直接つながっているときに道しるべは必ず１
    
   while (!q.empty()) {
       //全ての部屋に道しるべができるまで調べる。BFS?
       
        int s=q.front();q.pop();//すでに道しるべが決まっている部屋sを１つずつ調べる。
        
        for(int i=0;i<v+1;i++){
            int u=g.at(s).at(i);//uはsと接している部屋;
            if(u==0)break;
            else {
                if(ans.at(u)!=0);//continue;//すでに道しるべあり
                else{
                    q.push(u);
                    ans.at(u)=s;//部屋sと接しているかつ、まだ道しるべがないところは道しるべが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: request for member 'push_back' in 'g.std::vector<int>::at(((std::vector<int>::size_type)s))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   35 |         (g.at(s)).push_back(t);
      |                   ^~~~~~~~~
a.cc:36:19: error: request for member 'push_back' in 'g.std::vector<int>::at(((std::vector<int>::size_type)t))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   36 |         (g.at(t)).push_back(s);
      |                   ^~~~~~~~~
a.cc:41:23: error: request for member 'at' in 'g.std::vector<int>::at(1)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   41 |         int u=g.at(1).at(i);
      |                       ^~
a.cc:55:27: error: request for member 'at' in 'g.std::vector<int>::at(((std::vector<int>::size_type)s))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   55 |             int u=g.at(s).at(i);//uはsと接している部屋;
      |                           ^~
Language: C++

#include <bits/stdc++.h>
#include<iostream>
#include<cmath>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll=long long;
using P=pair<int,int>;
const int INF=1001001001;

vector<int> to[100005];

int main(){
   int n,m; cin>>n>>m;
   rep(i,m){
      int a,b; cin>>a>>b;
      --a;--b;
      to[a].push_back(b);
      to[b].push_back(a);
   }
   queue<int> q;
   vector<int> dist(n,INF);
   vector<int> pre(n,-1);
   dist[0]=0;
   q.push(0);
   while(!q.enmpy()){
      int v=q.front(); q.pop();
      for(int u:to[v]){
         if(dist[u]!=INF) continue;
         dist[u]=dist[v]+1;
         pre[u]=v;
         q.push(u);
      }
   }

   cout<<"Yes"<<endl;
   rep(i,n){
      if(i==0) continue;
      int ans=pre[i];
      ++ans;
      cout<<ans<<endl;
   }
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: 'class std::queue<int>' has no member named 'enmpy'
   25 |    while(!q.enmpy()){
      |             ^~~~~
Language: C++

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

int main(){
  int n,m;cin>>n>>m;
  vector<int> edge[n],ans(n,-1);
  while(m--){
    int u,v;cin>>u>>v;u--;v--;
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  queue<int>que;
  que.push(0);
  while(que.size()){
    int p=que.front();que.pop();
    for(int q:edge[p])
      if(!~ans[q]){
        ans[q]=p;
        queue.push(q);
      }
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<n;i++)cout<<ans[i]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:14: error: expected unqualified-id before '.' token
   19 |         queue.push(q);
      |              ^
Language: C++

// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;
ll n,m;




//注意

vector<set<ll>> s(300000);
vector<pair<ll ,bool>> f(3000000);
deque<ll> q;


void search(){

   // cout<<endl;
    search();
}

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);

    ll c,d,maxi=0,mini=INF,sum=0;
    string str;
    cin>>n>>m;
    vector<ll> a(m);
    vector<ll> b(m);
    s.resize(n);
    f.resize(n);
    rep(i,n) f[i].second=false;
    rep(i,m){
        cin>>c>>d;
        c--;
        d--;
        s[c].insert(d);
        s[d].insert(c);
    }
    q.push_back(0);
    while(!q.empty()){
    if(q.size()==0) return;
    ll num=q.front();
    q.pop_front();
    //if(f[num].second==true) return;
    //cout<<"num= "<<num<<" ";
    for(auto itr=s[num].begin();itr!=s[num].end();++itr){
        //cout<<*itr<<" ";
        if(f[*itr].second==false){
            f[*itr].second=true;
            f[*itr].first=num;
            q.push_back(*itr);
        }
    }
    }    ll flag=1;
    rep(i,n){
        if(f[i].second==false) flag=0;
    }
    if(flag==0) No;
    else{
        Yes;
        for(ll i=1;i<n;i++){
            cout<<f[i].first+1<<endl;
        }
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:21: error: return-statement with no value, in function returning 'int' [-fpermissive]
   54 |     if(q.size()==0) return;
      |                     ^~~~~~
Language: C++

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

int n;

void solve(vector<int> room[n+1], int n) {
    
    set<int> used;
    
    map<int,int> mapp;
    vector<int> roomNums={1};
    int index=0;
    int before = 0;
    
    while(roomNums.size()<n) {
        
        index=(int)roomNums.size()-index;
        
        if(index==before) {
            cout<<"no"<<"\n";
            return;
        }
        
        before=index;
        
        for(int i=index; i<roomNums.size(); i++) {
            int roomNum = roomNums[i]-1;
            for(int j=0; j<room[roomNum].size(); j++) {
                int num = room[roomNum].at(j);
                if(used.count(num)==0){
                    mapp[num]=roomNum+1;
                    used.insert(num);
                    roomNums.push_back(num);
                    index++;
                }
            }
        }
    }
    
    for(auto x : mapp) {
        if(x.first!=1)
            cout<<x.second<<"\n";
    }
    
    
}


int main() {
    
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int m;
    
    cin>>n>>m;            //n=#ofRooms m=#ofPassages
    vector<int> room[n+1];   //room 1 is room[0], room 2 is room[1], room m is room[,-1];
                          //stores the possibilites
    
    while(m--) {
        int a,b;
        cin>>a>>b;
        room[b-1].push_back(a);
        room[a-1].push_back(b);
    }
    
    solve(room, n);
}


Compiler output:
a.cc:9:30: error: size of array 'room' is not an integral constant-expression
    9 | void solve(vector<int> room[n+1], int n) {
      |                             ~^~
Language: C++

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

int n,m;

void solve(vector<int> room[n+1]) {
    
    set<int> used;
    
    map<int,int> mapp;
    vector<int> roomNums={1};
    int index=0;
    int before = 0;
    
    while(roomNums.size()<n) {
        
        index=(int)roomNums.size()-index;
        
        if(index==before) {
            cout<<"no"<<"\n";
            return;
        }
        
        before=index;
        
        for(int i=index; i<roomNums.size(); i++) {
            int roomNum = roomNums[i]-1;
            for(int j=0; j<room[roomNum].size(); j++) {
                int num = room[roomNum].at(j);
                if(used.count(num)==0){
                    mapp[num]=roomNum+1;
                    used.insert(num);
                    roomNums.push_back(num);
                    index++;
                }
            }
        }
    }
    
    for(auto x : mapp) {
        if(x.first!=1)
            cout<<x.second<<"\n";
    }
    
    
}


int main() {
    
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    cin>>n>>m;            //n=#ofRooms m=#ofPassages
    vector<int> room[n+1];   //room 1 is room[0], room 2 is room[1], room m is room[,-1];
                          //stores the possibilites
    
    while(m--) {
        int a,b;
        cin>>a>>b;
        room[b-1].push_back(a);
        room[a-1].push_back(b);
    }
    
    solve(room);
}
     /*
 use map<int,int> m
 vector of sets
 boom
 */


Compiler output:
a.cc:9:30: error: size of array 'room' is not an integral constant-expression
    9 | void solve(vector<int> room[n+1]) {
      |                             ~^~
Language: C++

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

int main()
{
    int N,M;
    cin >> N >> M;
    int A,B;
    vector<vector<int>> room(N);
    for(int i = 0; i < M; i++)
    {
        cin >> A >> B;
        room[A].push_back(B);
        room[B].push_back(A);
    }
    vector<int> dest(N);
    queue<int> que;
    vector<int> dist(N, -1);
    que.push_back(0);
    dist[0].push_back(0);

    while(!que.empty)
    {
        int s = que.front();
        que.pop();
        for(int i : room[s])
        {
            if(dist[i] != -1)
            {
                dist[i] = dist[s] + 1;
                dest[i] = s;
                que.push_back(i);
            }
        }
    }

    bool flag = true;
    for(int i : dist)
    {
        if(i == -1) flag = false;
    }
    if(flag)
    {
        cout << "Yes" << endl;
        for(int i : dest) cout << i << endl;
    }
    else cout << "No" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'class std::queue<int>' has no member named 'push_back'
   19 |     que.push_back(0);
      |         ^~~~~~~~~
a.cc:20:13: error: request for member 'push_back' in 'dist.std::vector<int>::operator[](0)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   20 |     dist[0].push_back(0);
      |             ^~~~~~~~~
a.cc:22:16: error: cannot convert 'std::queue<int>::empty' from type 'bool (std::queue<int>::)() const' to type 'bool'
   22 |     while(!que.empty)
      |                ^~~~~
a.cc:22:16: error: in argument to unary !
   22 |     while(!que.empty)
      |            ~~~~^~~~~
a.cc:32:21: error: 'class std::queue<int>' has no member named 'push_back'
   32 |                 que.push_back(i);
      |                     ^~~~~~~~~
Language: C

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;

int main() {
    // 頂点数と辺数
    int N, M; cin >> N >> M;

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

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

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    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);
         
          vector<int> dist(N-1,0);
          
        }
    }

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

from collections import deque
n,m = list(map(int,input().split()))
e = [[] for _ in range(m+1)]
for i in range(m):
    a,b = list(map(int,input().split()))
    e[a].append(b)
    e[b].append(a)
q = deque()
q.append(1)
s = [float('inf') for _ in range(n+1)]
t = [-1 for _ in range(n+1)]
s[1] = 0
while len(q):
    node = q.pop()
    step = s[node]+1
    for i in range(len(e[node])):
        nex = e[node][i]
        if s[nex] > step:
            q.append(nex)
            s[nex] = step
            t[nex] = node
# print(s,t,e)
print("Yes")
for i in range(2,n+1):
    print(t[i])

Compiler output:
main.c:1:1: error: unknown type name 'from'
    1 | from collections import deque
      | ^~~~
main.c:1:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'import'
    1 | from collections import deque
      |                  ^~~~~~
main.c:1:18: error: unknown type name 'import'
main.c:10:12: warning: multi-character character constant [-Wmultichar]
   10 | s = [float('inf') for _ in range(n+1)]
      |            ^~~~~
main.c:22:3: error: invalid preprocessing directive #print
   22 | # print(s,t,e)
      |   ^~~~~
Language: C

//#pragma GCC optimize(2)
//#include <bits/stdc++.h>
#include <set>
#include <vector>
#include <iostream>
using namespace std;
typedef long long ll;
#define rep(i, beg, end) for (int i = (beg); i < (end); i++)

struct cmp
{
    bool operator()(pair<int, int> a, pair<int, int> b)
    {
        if (a.first != b.first)
        {
            if (a.second == b.second)
            {
                return a.first < b.first;
            }
            else
            {
                return a.second < b.second;
            }
        }
        else
        {
            return a.second < b.second;
        }
    }
};

int edgeTo[100000 + 5];
int distTo[100000 + 5];
set<pair<int, int>, cmp> pq;
void relax(int from, int to, int weight)
{
    if (distTo[to] > distTo[from] + weight)
    {
        pair<int, int> backup = {to, distTo[to]};
        distTo[to] = distTo[from] + weight;
        edgeTo[to] = from;
        if (pq.find(backup) != pq.end())
        {
            pq.erase(backup);
            pq.insert({to, distTo[to]});
        }
        else
        {
            pq.insert({to, distTo[to]});
        }
    }
}

void dijsktra(vector<vector<pair<int, int>>> g, int s)
{
    int n = g.size();
    for (int i = 0; i < n + 1; i++)
    {
        distTo[i] = 2147483647;
    }

    distTo[s] = 0;
    pq.insert({s, 0});
    while (!pq.empty())
    {
        auto it = pq.begin();
        pair<int, int> top = *it;
        pq.erase(*it);
        for (pair<int, int> e : g[top.first])
        {
            relax(top.first, e.first, e.second);
        }
    }
}

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<pair<int, int>>> graph(n + 1);
    rep(i, 1, m + 1)
    {
        int a, b;
        cin >> a >> b;
        graph[a].push_back({b, 1});
        graph[b].push_back({a, 1});
    }
    dijsktra(graph, 1);

    cout << "Yes" << endl;
    rep(i, 2, n + 1)
    {
        cout << edgeTo[i] << endl;
    }
    return 0;
}

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

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

int main (void){
  long long int n = 0,m = 0;
  cin >> n >> m;
  vector<vector<long int>> g(n,vector<long int>());
  vector<int> yet(n,0);
  vector<int> ans(n,0);
  for(int i = 0;i < m;i++){
    long int a = 0,b = 0;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  queue<pair<long int,int>> q;
  pair<long int,int> a,b;
  long int cur;

  for(int i = 1;i < n;i++){
    q.push({i,0});
    while(!q.empty()){
      a = q.front();
      q.pop();
      cur = a.first;
      if(cur == 0){
        ans[i] = a.second;
        break;
      }else{
        yet[cur]++;
        a.second++;
        for(int k = 0;k < g[cur].size();k++){
          if(yet[g[cur][k]] == 0){
            q.push({g[cur][k],a.second});
          }
        }
      }
    }
    while(!q.empty()){
      q.pop();
    }
    for(int d = 0;d < n;d++){
      yet[d] = 0;
    }
  }
  for(int f = 1;f < n;f++){
    if(ans[f] == 0){
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  for(int i = 1;i < n;i++){
    for(int k = 0;k < g[i].size();k++){
      if(ans[i] - 1 == ans[g[i][k]]){
        g[i][k]++;
        cout << g[i][k] << endl;
        break;
      }
    }
  }
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:64:12: error: expected '}' at end of input
   64 |   return 0;
      |            ^
a.cc:4:16: note: to match this '{'
    4 | int main (void){
      |                ^
Language: Java

import java.util.*;

public class DoubleDots {


    private static int[] solve(Graph graph) {
        int n = graph.getSize();
        int[] dist = new int[n + 1];
        int[] parent = new int[n + 1];
        boolean[] visited = new boolean[n + 1];
        Arrays.fill(dist, Integer.MAX_VALUE);
        dist[1] = 0;
        parent[1] = 0;
        Queue<Integer> pq = new LinkedList<>();
        pq.offer(1);
        while (!pq.isEmpty()) {
            Integer node = pq.poll();
            visited[node] = true;
            List<Node> childNodes = graph.getAdjacentList(node);
            for (Node child : childNodes) {
                if (visited[child.end])
                    continue;
                int newDist = dist[node] + child.weight;
                if (dist[child.end] > newDist) {
                    dist[child.end] = newDist;
                    pq.offer(child.end);
                    parent[child.end] = child.start;
                }
            }
        }
        return parent;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int M = Integer.parseInt(sc.next());
        Graph graph = new Graph(N);
        for (int i = 0; i < M; i++) {
            int start = Integer.parseInt(sc.next());
            int end = Integer.parseInt(sc.next());
            graph.addEdge(start, end);
        }
        int[] res = solve(graph);
        for (int i = 2; i <= N; i++) {
            if(res[i] == Integer.MAX_VALUE){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
        for (int i = 2; i <= N; i++) {
            System.out.println(res[i]);
        }
    }

    static class Graph {

        private final Map<Integer, List<Node>> adjacentList = new HashMap<>();

        Graph(int capacity) {
            for (int i = 1; i <= capacity; i++) {
                adjacentList.put(i, new LinkedList<>());
            }
        }


        public void addEdge(int start, int end) {
            adjacentList.get(start).add(new Node(start, end));
            adjacentList.get(end).add(new Node(end, start));
        }

        public List<Node> getAdjacentList(int node) {
            return adjacentList.get(node);
        }

        public int getSize() {
            return adjacentList.size();
        }
    }

    static class Node {
        int start;
        int end;
        int weight = 1;

        Node(int s, int e) {
            this.start = s;
            this.end = e;
        }
    }
}


Compiler output:
Main.java:3: error: class DoubleDots is public, should be declared in a file named DoubleDots.java
public class DoubleDots {
       ^
1 error
Language: Java

import java.util.*;

public class Main{

    static class Room{
        int num;
        Map<Integer, Room> joint = new HashMap<>();
        int mark = -1;
        Room(int num){
            this.num = num;
        }
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        Map<Integer, Room> map = new HashMap<>();
        for(int i = 0; i < n; i++){
            map.put(i + 1, new Room(i + 1));
        }

        for(int i = 0; i < m; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            map.get(a).joint.put(b, map.get(b));
            map.get(b).joint.put(a, map.get(a));
        }

        ArrayDeque<Room> q = new ArrayDeque<>();

        q.add(map.get(1));

        while(!q.isEmpty()){
            Room room = q.poll();

            for(Room i : room.joint.values()){
                if(i.mark == -1){
                    i.mark = room.num;
                    q.add(i);
                }
            }
        }

        map.remove(1);

        StringBuilder sb = new StringBuilder();
        sb.append("Yes\n");

        for(int i = 1; i < n; i++){
            sb.append(map.get(i + 1).i.mark).append("\n");
        }
        System.out.println(sb);

    }
}


Compiler output:
Main.java:54: error: cannot find symbol
            sb.append(map.get(i + 1).i.mark).append("\n");
                                    ^
  symbol:   variable i
  location: class Room
1 error
Language: Java

import java.util.*;

public class Main{

    static class Room{
        int num;
        Map<Integer, Room> joint = new HashMap<>();
        int mark = -1;
        Room(int num){
            this.num = num;
        }
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        Map<Integer, Room> map = new HashMap<>();
        for(int i = 0; i < n; i++){
            map.put(i + 1, new Room(i + 1));
        }

        for(int i = 0; i < m; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            map.get(a).joint.put(b, map.get(b));
            map.get(b).joint.put(a, map.get(a));
        }

        ArrayDeque<Room> q = new ArrayDeque<>();

        q.add(map.get(1));

        while(!q.isEmpty()){
            Room room = q.poll();

            for(Room i : room.joint.values()){
                if(i.mark == -1){
                    i.mark = room.num;
                    q.add(i);
                }
            }
        }

        map.remove(1);

        StringBuilder sb = new StringBuilder();
        sb.append("Yes\n");

        for(int i = 0; i < n; i++){
            sb.append(map.get(i + 1).i.mark).append("\n");
        }
        System.out.println(sb);

    }
}


Compiler output:
Main.java:54: error: cannot find symbol
            sb.append(map.get(i + 1).i.mark).append("\n");
                                    ^
  symbol:   variable i
  location: class Room
1 error
Language: C++

#include<iostream>
#include<vector>
#include<queue>
using namespace std;
const int inf = 1000000000;

int main() {
  int n, m;
  cin>>n>>m;
  vector<int>g[n+1];
  int a, b;
  for(int i = 0; i < m; i++) {
    cin>>a>>b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  
  vector<int>dist(n+1, inf), pre(n+1, -1);
  queue<int>q;
  dist[1] = 0;
  q.push(1);
  while(!q.empty()) {
    v = q.front();
    q.pop();
    for(int u : g[v]) {
      if(dist[u] != inf)
        continue;
      dist[u] = dist[v] + 1;
      pre[u] = pre[v];
      q.push(u);
    }
  }
  
  cout<<"\nYes";
  for(int i=0;i<n;i++){
    if(i == 0) continue;
    int ans = pre[i];
    ans++;
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'v' was not declared in this scope
   23 |     v = q.front();
      |     ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000007
using namespace std;


int main(){
  int n,m;
  cin >> n >> m;
  int flag[n],ans[n];
  rep(i,n) flag[i]=0;
  int a[m],b[m];
  rep(i,m){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  int d[n][10000];
  int dd[n];
  rep(i,n)dd[i]=0;
  rep(i,m){
    d[a[i]][dd[a[i]]]=b[i];
    d[b[i]][dd[b[i]]]=a[i];
    dd[a[i]]++;
    dd[b[i]]++;
  }

  queue<int> que;
  que.push(0);
  flag[0]=1;
  while(que.empty()==0){
    int now=que.front();
    que.pop();
    rep(j,dd[now]){
      if(flag[d[now][j]]==0){
        que.push(d[now][j]);
        ans[d[now][j]]=now+1;
        flag[d[now][j]]=1;
      }
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:41:4: error: expected '}' at end of input
   41 |   }
      |    ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
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;
intmax_t 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);
        for (size_t j = 0;; j++) {
            if (pass[A][j] == 0) {
                pass[A][j] = B;
                break;
            }
        }
        for (size_t j = 0;; j++) {
            if (pass[B][j] == 0) {
                pass[B][j] = A;
                break;
            }
        }
    }

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

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

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

    return 0;
}


Compiler output:
/tmp/cc3Zr0A6.o: in function `main':
main.c:(.text+0x2dd): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/cc3Zr0A6.o
main.c:(.text+0x2fb): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/cc3Zr0A6.o
main.c:(.text+0x349): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc3Zr0A6.o
main.c:(.text+0x38a): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc3Zr0A6.o
main.c:(.text+0x3bc): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/cc3Zr0A6.o
main.c:(.text+0x405): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/cc3Zr0A6.o
main.c:(.text+0x444): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc3Zr0A6.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>//cout << fixed << setprecision() <<
#include <set>
#include <map>
using ll = long long;
using namespace std;
vector<vector<int>> v;
vector<int> v2,v3;

void monmo(int n,int keta){
    for(int i=0;i<v[n].size();i++
        if(v2[v[n][i]]==0){
            v2[v[n][i]]=n;
            v3[v[n][i]]=keta;
            monmo(v[n][i],keta+1);
        }else{
            if(v3[v[n][i]]>keta){
                v2[v[n][i]]=n;
                v3[v[n][i]]=keta;
            }
        }
    }
}

int main(void){
    int n,m;
    int a,b;
    cin>>n>>m;
    v.emplace_back(); //v[0]は無視
    v2.push_back(0);//v2[0]は無視
    v3.push_back(1000000);//v3[0]は無視
    for(int i=0;i<n;i++){
        v.emplace_back();
        v2.push_back(0);
        v3.push_back(1000000);
    }
    for(int i=0;i<m;i++){
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    
    monmo(1,0);
    cout<<"yes"<<endl;
    for(int i=2;i<=n;i++){
        cout<<v2[i]<<endl;
    }
    
}


Compiler output:
a.cc: In function 'void monmo(int, int)':
a.cc:13:34: error: expected ')' before 'if'
   13 |     for(int i=0;i<v[n].size();i++
      |        ~                         ^
      |                                  )
   14 |         if(v2[v[n][i]]==0){
      |         ~~                        
a.cc: At global scope:
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

struct Vertex {
  int32_t distance{INT32_MAX};
  bool explored{false};
  int32_t parent{-1};
  vector<int32_t> neighbours;
};

// Vertex vertices[100000 + 2];

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  using DistanceIndexPair = pair<int32_t, int32_t>;
  priority_queue<int32_t, vector<DistanceIndexPair>, greater<DistanceIndexPair>> pqueue;

  constexpr int32_t kStart = 1;
  int32_t number_of_vertices, number_of_edges;
  cin >> number_of_vertices >> number_of_edges;
  vector<Vertex> vertices(number_of_vertices + 1);

  for (int32_t i = 0; i < number_of_edges; ++i) {
    int32_t a, b;
    cin >> a >> b;
    vertices[b].neighbours.push_back(a);
    vertices[a].neighbours.push_back(b);
  }

  pqueue.push(DistanceIndexPair(0, kStart));
  while (pqueue.size() > 0) {
    const DistanceIndexPair p = pqueue.top();
    pqueue.pop();
    const int32_t target_distance = p.first;
    const int32_t target_index = p.second;

    Vertex &cvertex = vertices[target_index];

    cvertex.explored = true;
    for (const int32_t next_index : cvertex.neighbours) {
      if (!vertices[next_index].explored) {
        const int32_t temp_distance = (target_distance != INT32_MAX) ? target_distance + 1 : INT32_MAX;
        if (temp_distance < vertices[next_index].distance) {
          vertices[next_index].distance = temp_distance;
          vertices[next_index].parent = target_index;
          pqueue.push(DistanceIndexPair(temp_distance, next_index));
        }
      }
    }
  }
  bool found = true;
  for (int32_t i = 2; i <= number_of_vertices; ++i) {
    if (vertices[i].parent < 0) {
      found = false;
    }
  }

  if (!found) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
    for (int32_t i = 2; i <= number_of_vertices; ++i) {
      cout << vertices[i].parent << endl;
    }
  }

  return 0;
}


Compiler output:
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_queue.h: In instantiation of 'class std::priority_queue<int, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >':
a.cc:24:82:   required from here
   24 |   priority_queue<int32_t, vector<DistanceIndexPair>, greater<DistanceIndexPair>> pqueue;
      |                                                                                  ^~~~~~
/usr/include/c++/14/bits/stl_queue.h:520:67: error: static assertion failed: value_type must be the same as the underlying container
  520 |       static_assert(is_same<_Tp, typename _Sequence::value_type>::value,
      |                                                                   ^~~~~
/usr/include/c++/14/bits/stl_queue.h:520:67: note: 'std::integral_constant<bool, false>::value' evaluates to false
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;
int n,m;
std::vector<int> v[200001];
int minrt[200001];
int al[200001];
void dfs(const int index, const int parent, const int start, int cnt)
{
    cout << "[" << start << "]" << index << ":" << cnt << ", ";
    
    if(index == 1){
        if(minrt[start] > cnt){
            minrt[start] = cnt;
        }
        cout << endl;
        return;
    }
    if(parent != -1 && al[index] == 1){
        cout << endl;
        return;
    }
    al[index] = 1;
    
    int size = v[index].size();
    for(int i=0; i<size; i++){
        if(v[index][i] == parent) continue;
        dfs(v[index][i], index, start, cnt+1);
        if(parent == -1) for(int i=0; i<=n; i++) al[i] = 0;
    }
    
}
int main()
{
    
    cin >> n >> m;
    
    int a[m], b[m];
    for(int i=0; i<m; i++){
        int a,b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    for(int i=0; i<=n; i++) minrt[i] = 2147483647;
    
    int ans[n+1];
    for(int i=2; i<=n; i++){
        for(int i=0; i<=n; i++) al[i] = 0;
        dfs(i, -1, i, 0);
        cout << endl;
        if(minrt[i] == 2147483647){
            cout << "No" << endl;
            return 0;
        }
        ans[i] = minrt[i];
    }
    
    cout << "Yes" << endl;
    for(int i=2; i<=n; i++){
        cout << ans[i] << endl;
    }
    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:67:6: error: expected '}' at end of input
   67 |     }
      |      ^
a.cc:39:1: note: to match this '{'
   39 | {
      | ^
Language: Java

import java.util.*;

public class Main {
  static int m;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    m = sc.nextInt();
    ArrayList<Road> roads = new ArrayList<>();
    int res[] = new int[n];
    Arrays.fill(res, -1);
    LinkedList<Integer> nexts = new LinkedList<>();
    nexts.add(1);
    for (int i = 0; i < m; i++) {
      roads.add(new Road(sc.nextInt(), sc.nextInt()));
    }
    while (nexts.size() != 0) {
      point(nexts.poll(), roads, res, nexts);
    }
    for (int i = 1; i < n; i ++) {
      if (res[i] == -1) {
        System.out.println("No");
        return;
      }
    }
    System.out.println("Yes");
    for (int i = 1; i < n; i++)  {
      System.out.println(res[i]);
    }
    sc.close();
  }

  static void point(int to, ArrayList<Road> roads, int array[], LinkedList<Integer> nexts) {
    int size = roads.size();
    ArrayList<Integer> remInd = new ArrayList<>();
    for (int i = 0; i < size; i ++) {
      if (roads.get(i).a == to && array[roads.get(i).b-1] == -1 && roads.get(i).b != 1) {
        array[roads.get(i).b-1] = to;
        nexts.add(roads.get(i).b);
        remInd.add(i);
      } else if (roads.get(i).b == to && array[roads.get(i).a-1] == -1 && roads.get(i).a != 1) {
        array[roads.get(i).a-1] = to;
        nexts.add(roads.get(i).a);
        remInd.add(i);
      }
    }
    int size2 = remInd.size()
    for (int i = 0; i < size2; i++) {
      roads.remove(remInd.get(i) - i);
    }
  }

  static class Road {
    int a, b;
    Road (int a, int b) {
      this.a = a;
      this.b = b;
    }
  }
}

Compiler output:
Main.java:47: error: ';' expected
    int size2 = remInd.size()
                             ^
1 error
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/ccdzhCw2.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/ccdzhCw2.o
main.c:(.text+0x267): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/ccdzhCw2.o
main.c:(.text+0x2b4): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccdzhCw2.o
main.c:(.text+0x2d4): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccdzhCw2.o
main.c:(.text+0x2e6): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/ccdzhCw2.o
main.c:(.text+0x31c): relocation truncated to fit: R_X86_64_PC32 against symbol `fifo' defined in .bss section in /tmp/ccdzhCw2.o
main.c:(.text+0x35b): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccdzhCw2.o
collect2: error: ld returned 1 exit status