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

#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}

int gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}



int main() {
	double A,B,H,M,hu;
	cin >> A>>B>>H>>M;
	static const double pi = 3.141592653589793;
	hu = H * 60 + M;
	H =hu* pi / 360;
	M *= pi / 30;
	cout << fixed << setprecision(10);
		cout << sqrt(A*A+B*B-2*A*B*cos(H-M)) << endl;
	
	

}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:44: error: 'cos' was not declared in this scope
   51 |                 cout << sqrt(A*A+B*B-2*A*B*cos(H-M)) << endl;
      |                                            ^~~
a.cc:51:25: error: 'sqrt' was not declared in this scope
   51 |                 cout << sqrt(A*A+B*B-2*A*B*cos(H-M)) << endl;
      |                         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    double r = a*a+b*b;
    double angle = fabs((60*h-11*m)/2);
    angle = (M_PI/180.0)*angle;
    double ans = sqrt(r-2*a*b*cos(angle));
    printf("%.10f",ans)
}   


Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: expected ';' before '}' token
   13 |     printf("%.10f",ans)
      |                        ^
      |                        ;
   14 | }
      | ~
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};


int an(double h, double m)  
{  
    int ho = 0.5 * (h * 60 + m);  
    int mi = 6 * m;  
  
    int ang = abs(ho - mi);  
  
    angle = min(360 - ang, ang);  
  
    return angle;  
} 

int main()
{
	ll a, b, h, m;
	cin >> a >> b >> h >> m;
	ll q= an(h, m);
	ld fuck = cos((pi*q/180.));
	ld c = sqrt(a*a+b*b-2*a*b*fuck);
	cout << setprecision(10) << fixed << c;




	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Compiler output:
a.cc: In function 'int an(double, double)':
a.cc:41:5: error: 'angle' was not declared in this scope; did you mean 'ang'?
   41 |     angle = min(360 - ang, ang);
      |     ^~~~~
      |     ang
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <algorithm>

typedef long long ll;
#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

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



#define MOD 998244353
#define PI 3.14159265359


int main()
{
	int a, b, h, m;
	cin >> a >> b >> h >> m;

	cout.precision(15);
	double time = h  + m / 60.0;
	double rad =  2 * PI * m / 60.0 - 2 * PI *  1 / 12.0 * time;
	cout << sqrt(a * a + b*b - 2 * a * b * cos(rad) )<< endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:48: error: 'cos' was not declared in this scope
   29 |         cout << sqrt(a * a + b*b - 2 * a * b * cos(rad) )<< endl;
      |                                                ^~~
a.cc:29:17: error: 'sqrt' was not declared in this scope
   29 |         cout << sqrt(a * a + b*b - 2 * a * b * cos(rad) )<< endl;
      |                 ^~~~
Language: C++

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

const inf INF = 1001001001;
vector<int> to[100005]

int main() {
    //スタートからの距離-1のノードへの指示ができればok
    //幅優先探索をすれば良い
    //各ノードにスタートからの距離とどこから来たか(たどるため)を記録する

    int n, m;
    cin >> n >> m;
    rep(i, m){
        int a, b;
        cin >> a >> b;
        --a; --b;
        //push_backは末尾に追加
        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()){
        //queueの先頭を取り出し
        int v = q.front(); q.pop();
        //vとつながっているノードをなめていく
        for (int u: to[v]){
            if(dist[u] != INF) continue;
            dist[u] = dist[v] + 1;
            //親を記録
            pre[u] = v;
            //訪問済みにする
            q.push(u);
        }
    }

    //今回はどの部屋もつながっている条件があるので必ずYes
    cout << "Yes" << endl;
    rep(i, n){
        if(i == 0) continue;
        int ans = pre[i];
        ++ans;
        cout << ans << endl;
    }

    return 0;
}

Compiler output:
a.cc:7:7: error: 'inf' does not name a type; did you mean 'int'?
    7 | const inf INF = 1001001001;
      |       ^~~
      |       int
a.cc:10:1: error: expected initializer before 'int'
   10 | int main() {
      | ^~~
Language: C++

#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000
#include <dijkstra>

//using namespace atcoder;
//
using namespace std;

#ifndef MYLIBRARY_DIJKSTRA_HPP
#define MYLIBRARY_DIJKSTRA_HPP 1

#include <utility>
#include <queue>
#include <vector>

struct dijk_graph {
  using Cap = long long int;
  public:
    dijk_graph() : _n(0) {}
    dijk_graph(int n) : _n(n), g(n), dist(n), prev(n) {}

    void add_edge(int from, int to, Cap cap){
      assert(0 <= from && from < _n);
      assert(0 <= to && to < _n);
      assert(0 <= cap);
      g[from].push_back(_edge{to, cap});
    }

    void make_table(int start){
      assert(0 <= start && start < _n);

      std::fill(dist.begin(), dist.end(), _inf);

      prev[0] = -1;
      Q.push(q_data(0, start));
      while (Q.size() != 0){
        auto p = Q.top();
        Q.pop();
        Cap ud = p.first;
        Cap u = p.second;
        if (dist[u] < ud){
          continue;
        }
        dist[u] = ud;

        for (auto t : g[u]){
          Cap v = t.to;
          Cap vd = ud + t.cap;
          if (dist[v] > vd){
            dist[v] = vd;
            Q.push(q_data(vd, v));
            prev[v] = u;
          }
        }
      }
    }

    Cap get_dist(int u){
      return dist[u];
    }

    int get_prev(int u){
      return prev[u];
    }

  private:
    int _n;
    struct _edge {
        int to;
        Cap cap;
    };
    std::vector<std::vector<_edge>> g;
    std::vector<long long int> dist;
    std::vector<int> prev;
    using q_data = std::pair<Cap, int>;
    Cap _inf = 1000000000000000000;
    std::priority_queue<q_data, std::vector<q_data>, std::greater<q_data>> Q;
};

#endif  // MYLIBRARY_DIJKSTRA_HPP

int main(void){
  
  ll n, m;
  cin >> n >> m;
  
  dijk_graph g(n);
  for (ll i = 0; i < m; i++){
    ll a, b;
    cin >> a >> b;
    a--; b--;
    
    g.add_edge(a, b, 1);
    g.add_edge(b, a, 1);
  }
  g.make_table(0);

  cout << "Yes" << endl;
  for (ll i = 1; i < n; i++){
    cout << g.get_prev(i) + 1 << endl;
  }

  return 0;
}


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

#ifndef MYLIBRARY_DIJKSTRA_HPP
#define MYLIBRARY_DIJKSTRA_HPP 1

#include <utility>
#include <queue>
#include <vector>
#include <cassert>

struct dijk_graph {
  using Cap = long long int;
  public:
    dijk_graph() : _n(0) {}
    dijk_graph(int n) : _n(n), g(n), dist(n), prev(n) {}

    void add_edge(int from, int to, Cap cap){
      assert(0 <= from && from < _n);
      assert(0 <= to && to < _n);
      assert(0 <= cap);
      g[from].push_back(_edge{to, cap});
    }

    void make_table(int start){
      assert(0 <= start && start < _n);

      std::fill(dist.begin(), dist.end(), _inf);

      prev[0] = -1;
      Q.push(q_data(0, start));
      while (Q.size() != 0){
        auto p = Q.top();
        Q.pop();
        Cap ud = p.first;
        Cap u = p.second;
        if (dist[u] < ud){
          continue;
        }
        dist[u] = ud;

        for (auto t : g[u]){
          Cap v = t.to;
          Cap vd = ud + t.cap;
          if (dist[v] > vd){
            dist[v] = vd;
            Q.push(q_data(vd, v));
            prev[v] = u;
          }
        }
      }
    }

    Cap get_dist(int u){
      return dist[u];
    }

    int get_prev(int u){
      return prev[u];
    }

  private:
    int _n;
    struct _edge {
        int to;
        Cap cap;
    };
    std::vector<std::vector<_edge>> g;
    std::vector<long long int> dist;
    std::vector<int> prev;
    using q_data = std::pair<Cap, int>;
    Cap _inf = 1000000000000000000;
    std::priority_queue<q_data, std::vector<q_data>, std::greater<q_data>> Q;
};

#endif  // MYLIBRARY_DIJKSTRA_HPP


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#ifndef MYLIBRARY_DIJKSTRA_HPP
#define MYLIBRARY_DIJKSTRA_HPP 1

#include <utility>
#include <queue>
#include <vector>
#include <cassert>

struct dijk_graph {
  using Cap = long long int;
  public:
    dijk_graph() : _n(0) {}
    dijk_graph(int n) : _n(n), g(n), dist(n), prev(n) {}

    void add_edge(int from, int to, Cap cap){
      assert(0 <= from && from < _n);
      assert(0 <= to && to < _n);
      assert(0 <= cap);
      g[from].push_back(_edge{to, cap});
    }

    void make_table(int start){
      assert(0 <= start && start < _n);

      std::fill(dist.begin(), dist.end(), _inf);

      prev[0] = -1;
      Q.push(q_data(0, start));
      while (Q.size() != 0){
        auto p = Q.top();
        Q.pop();
        ll ud = p.first;
        ll u = p.second;
        if (dist[u] < ud){
          continue;
        }
        dist[u] = ud;

        for (auto t : g[u]){
          ll v = t.to;
          ll vd = ud + t.cap;
          if (dist[v] > vd){
            dist[v] = vd;
            Q.push(q_data(vd, v));
            prev[v] = u;
          }
        }
      }
    }

    Cap get_dist(int u){
      return dist[u];
    }

    int get_prev(int u){
      return prev[u];
    }

  private:
    int _n;
    struct _edge {
        int to;
        Cap cap;
    };
    std::vector<std::vector<_edge>> g;
    std::vector<long long int> dist;
    std::vector<int> prev;
    using q_data = std::pair<Cap, int>;
    Cap _inf = 1000000000000000000;
    std::priority_queue<q_data, std::vector<q_data>, std::greater<q_data>> Q;
};

#endif  // MYLIBRARY_DIJKSTRA_HPP


Compiler output:
a.cc: In member function 'void dijk_graph::make_table(int)':
a.cc:32:9: error: 'll' was not declared in this scope
   32 |         ll ud = p.first;
      |         ^~
a.cc:33:12: error: expected ';' before 'u'
   33 |         ll u = p.second;
      |            ^
a.cc:34:18: error: 'u' was not declared in this scope
   34 |         if (dist[u] < ud){
      |                  ^
a.cc:34:23: error: 'ud' was not declared in this scope
   34 |         if (dist[u] < ud){
      |                       ^~
a.cc:37:14: error: 'u' was not declared in this scope
   37 |         dist[u] = ud;
      |              ^
a.cc:37:19: error: 'ud' was not declared in this scope
   37 |         dist[u] = ud;
      |                   ^~
a.cc:40:14: error: expected ';' before 'v'
   40 |           ll v = t.to;
      |              ^
a.cc:41:14: error: expected ';' before 'vd'
   41 |           ll vd = ud + t.cap;
      |              ^~
a.cc:42:20: error: 'v' was not declared in this scope
   42 |           if (dist[v] > vd){
      |                    ^
a.cc:42:25: error: 'vd' was not declared in this scope; did you mean 'void'?
   42 |           if (dist[v] > vd){
      |                         ^~
      |                         void
Language: C++

#ifndef MYLIBRARY_DIJKSTRA_HPP
#define MYLIBRARY_DIJKSTRA_HPP 1

#include <utility>
#include <queue>
#include <vector>
#include <assert>

struct dijk_graph {
  using Cap = long long int;
  public:
    dijk_graph() : _n(0) {}
    dijk_graph(int n) : _n(n), g(n), dist(n), prev(n) {}

    void add_edge(int from, int to, Cap cap){
      assert(0 <= from && from < _n);
      assert(0 <= to && to < _n);
      assert(0 <= cap);
      g[from].push_back(_edge{to, cap});
    }

    void make_table(int start){
      assert(0 <= start && start < _n);

      std::fill(dist.begin(), dist.end(), _inf);

      prev[0] = -1;
      Q.push(q_data(0, start));
      while (Q.size() != 0){
        auto p = Q.top();
        Q.pop();
        ll ud = p.first;
        ll u = p.second;
        if (dist[u] < ud){
          continue;
        }
        dist[u] = ud;

        for (auto t : g[u]){
          ll v = t.to;
          ll vd = ud + t.cap;
          if (dist[v] > vd){
            dist[v] = vd;
            Q.push(q_data(vd, v));
            prev[v] = u;
          }
        }
      }
    }

    Cap get_dist(int u){
      return dist[u];
    }

    int get_prev(int u){
      return prev[u];
    }

  private:
    int _n;
    struct _edge {
        int to;
        Cap cap;
    };
    std::vector<std::vector<_edge>> g;
    std::vector<long long int> dist;
    std::vector<int> prev;
    using q_data = std::pair<Cap, int>;
    Cap _inf = 1000000000000000000;
    std::priority_queue<q_data, std::vector<q_data>, std::greater<q_data>> Q;
};

#endif  // MYLIBRARY_DIJKSTRA_HPP


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

#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000
#include <dijkstra>

//using namespace atcoder;
using namespace std;

int main(void){
  
  ll n, m;
  cin >> n >> m;
  
  dijk_graph g(n);
  for (ll i = 0; i < m; i++){
    ll a, b;
    cin >> a >> b;
    a--; b--;
    
    g.add_edge(a, b, 1);
    g.add_edge(b, a, 1);
  }
  g.make_table(1);

  cout << "Yes" << endl;
  for (ll i = 1; i < n; i++){
    cout << g.get_prev(i) + 1 << endl;
  }

  return 0;
}


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

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define MOD 1000000007
#define oo 1000000000000000000
#define forr(i,n) for(ll i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0) ; cout.tie(0);
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define pb push_back
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
using namespace __gnu_pbds; 
using namespace std;

ll valueOfIndex(ordered_set&s , ll i){ return *(s.find_by_order(i)); }
ll indexOfValue(ordered_set&s , ll x){ return s.order_of_key(x); }
ll add(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a+b + p)%p;}
ll mul(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a*b + p)%p;} // __int128
ll power(ll x,ll n,ll p=MOD){ if(x==0) return 0; if(n==0 || x==1) return 1LL;
    ll r = (power(x,n/2,p))%p; if(n&1) return mul(mul(r,r,p) , x,p); else return mul(r,r,p);
}
ll inv(ll x){return power(x,MOD-2);}



void __sol(){
    int n,m; cin >> n >> m;
    int ans[n+10];
    bool visit[n+10];
    vector<vector<int>> v(n+10);
    forr(i,m){
        int u,v; cin >> u >> v;
        g[v].eb(u); g[u].eb(v);
    }
    visit[1]=0,ans[1]=-1;
    for(int i=2;i<=n;i++) ans[i]=-1,visit[i]=0;
    queue<int> q; q.push(1);
    visit[1]=1;
    while(!q.empty()){
        int node = q.front(); q.pop();
            for(auto &i: g[node]){
                if(!visit[i]){
                    ans[i] = node;
                    visit[i]=true;
                    q.push(i);
                }
            }
    }
    for(int i=2;i<=n;i++){
        if(!visit[i]){
            cout << "No";
            return;
        }
    }
    cout << "Yes\n";
    for(int i=2;i<=n;i++) cout << ans[i] << "\n";


}


int main(){
    fastio
    ll tc=1; //cin >> tc;
    while(tc--) __sol();
    return 0;
}

Compiler output:
a.cc: In function 'void __sol()':
a.cc:35:9: error: 'g' was not declared in this scope
   35 |         g[v].eb(u); g[u].eb(v);
      |         ^
a.cc:43:26: error: 'g' was not declared in this scope
   43 |             for(auto &i: g[node]){
      |                          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define pb push_back 
signed main()
{
  	int n,m ; cin>>n>>m;
  	vector<int>adj[n+1];
  	for(int i = 0 ; i < m ;i++)
    {
    	int u , v;cin>>u>>v;
      	adj[u].pb(v);
      	adj[v].pb(u);
    }
  	
  	vector<int>dist(n+1,INT_MAX);
  	vector<int>par(n+1);
  	vector<int>vis(n+1);
  	priority_queue<pair<int,int>, vector<pair<int,int>> , greater<pair<int,int>>>pq;
  	pq.push({0,1});
  	dis[1] = 0; 
  	while(!pq.empty())
    {
    	int cost = pq.top().first;
      	int tp = pq.top().second;
      	pq.pop();
      	vis[tp] = 1;
      	for(auto it : adj[tp])
        {	
          if(dist[it] > dist[tp] + cost) 
          {
          	dis[it] = dist[tp] + cost;
            par[it] = tp;
            pq.push(it);
          }
        }
    }
  
  	for(int i = 2 ; i <=n ;i++)
      cout<<par[i]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'dis' was not declared in this scope; did you mean 'vis'?
   20 |         dis[1] = 0;
      |         ^~~
      |         vis
a.cc:33:20: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(int&)'
   33 |             pq.push(it);
      |             ~~~~~~~^~~~
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:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; value_type = std::pair<int, int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from 'int' to 'const std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::value_type&' {aka 'const std::pair<int, int>&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; value_type = std::pair<int, int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from 'int' to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::value_type&&' {aka 'std::pair<int, int>&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define pb push_back 
signed main()
{
  	int n,m ; cin>>n>>m;
  	vector<int>adj[n+1];
  	for(int i = 0 ; i < m ;i++)
    {
    	int u , v;cin>>u>>v;
      	adj[u].pb(v);
      	adj[v].pb(u);
    }
  	
  	vector<int>dist(n+1,INT_MAX);
  	vector<int>par(n+1);
  	vector<int>vis(n+1);
  	queue<pair<int,int>, vector<pair<int,int>> , greater<pair<int,int>>>pq;
  	pq.push({0,1});
  	dis[1] = 0; 
  	while(!pq.empty())
    {
    	int cost = pq.top().first;
      	int tp = pq.top().second;
      	pq.pop();
      	vis[tp] = 1;
      	for(auto it : adj[tp])
        {	
          if(dist[it] > dist[tp] + cost) 
          {
          	dis[it] = dist[tp] + cost;
            par[it] = tp;
            pq.push(it);
          }
        }
    }
  
  	for(int i = 2 ; i <=n ;i++)
      cout<<par[i]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:76: error: wrong number of template arguments (3, should be at least 1)
   18 |         queue<pair<int,int>, vector<pair<int,int>> , greater<pair<int,int>>>pq;
      |                                                                            ^
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:96:11: note: provided for 'template<class _Tp, class _Sequence> class std::queue'
   96 |     class queue
      |           ^~~~~
a.cc:19:12: error: request for member 'push' in 'pq', which is of non-class type 'int'
   19 |         pq.push({0,1});
      |            ^~~~
a.cc:20:9: error: 'dis' was not declared in this scope; did you mean 'vis'?
   20 |         dis[1] = 0;
      |         ^~~
      |         vis
a.cc:21:19: error: request for member 'empty' in 'pq', which is of non-class type 'int'
   21 |         while(!pq.empty())
      |                   ^~~~~
a.cc:23:23: error: request for member 'top' in 'pq', which is of non-class type 'int'
   23 |         int cost = pq.top().first;
      |                       ^~~
a.cc:24:21: error: request for member 'top' in 'pq', which is of non-class type 'int'
   24 |         int tp = pq.top().second;
      |                     ^~~
a.cc:25:12: error: request for member 'pop' in 'pq', which is of non-class type 'int'
   25 |         pq.pop();
      |            ^~~
a.cc:33:16: error: request for member 'push' in 'pq', which is of non-class type 'int'
   33 |             pq.push(it);
      |                ^~~~
Language: C++

//幅優先探索 BFS bfs

#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};

vector <int> to(100100);  //グラフを格納

int main(void){
  int N, M;
  cin >> N >> M;
  rep(i,M){
    int a, b;
    cin >> a >> b;
    a --; b --;
    //to[i]にはiにつながっている頂点のリストが入る
    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()){
    int v = q.front();  //queueから先頭頂点を取り出す
    q.pop();

    // vから辿れる頂点をすべて調べる
    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:21:11: error: request for member 'push_back' in 'to.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   21 |     to[a].push_back(b);
      |           ^~~~~~~~~
a.cc:22:11: error: request for member 'push_back' in 'to.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   22 |     to[b].push_back(a);
      |           ^~~~~~~~~
a.cc:38:22: error: 'begin' was not declared in this scope
   38 |     for (int u : to[v]){
      |                      ^
a.cc:38:22: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:3:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:38:22: error: 'end' was not declared in this scope
   38 |     for (int u : to[v]){
      |                      ^
a.cc:38:22: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
Language: C++

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

int main(){
  int n, m; cin >> n >> m;
  
  vector<vector<int>> graph(n+1);
  
  for(int i = 0; i < m; i++){
  	int a, b; cin >> a >> b;
  
  	graph[a].push_back(b);
  	graph[b].push_back(a);
  }
  
  queue<int> que;
  que.push(1);
  
  vector<int> seen(n+1, -1);
  seen[1] = 1;
  
  vector<int> parent(n+1);
  
  while(!que.empty()){
  	int nv = que.front();
    que.pop();
  
  	for(int v : graph[nv]){
    	if(seen[v] != -1) continue;
      	que.push(v);
      
      	seen[v] = 1;
      
      	parent[v] = nv;
  	}
  
  }
  
  cout << "Yes" << endl;
  for(int i = 2; i <= n; i++) cout << parent[i] << endl;
  
  for(int i = 0; i < n; i++){
  for(int j = 0; j < m; j++){
  
  	a=1;
  }}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:9: error: 'a' was not declared in this scope
   45 |         a=1;
      |         ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;

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

    vector<int> parent(n, -1);
    queue<int> q;
    q.push(0);

    while (not q.empty()) {
        int x = q.front();
        q.pop();

        for (auto next : v[x]) {
            if (parent[next] >= 0)
                continue;
            parent[next] = x;
            q.push(next);
        }
        // for (int i = 1; i < n; i++) {
        //     cout << parent[i] << " ";
        // }
        // cout << endl;
    }

    bool flag = false;
    for (int i = 1; i < n; i++) {
        if (parent[i] < 0) flag = true;
    }
    if (flag)
        cout << "No" << endl;
    else {
        cout << "Yes" << endl;
        for (int i = 1; i < n; i++) {
            cout << parent[i] + 1 << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:32: error: call of overloaded 'vector(int&, <brace-enclosed initializer list>)' is ambiguous
   13 |     vector<vector<int>> v(n, {});
      |                                ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]'
  569 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]'
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; //intじゃ扱えないことに注意！
using P = pair<int,int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意！

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); //b->a
      to[b].push_back(a); //a->b
    }

    queue<int> q;
    vector<int> dist(n,INF); //距離を記録
    vector<int> pre(n,-1); //どこから来たか記録
    dist[0] = 0;
    q.push(0); //0を入れる
    while(!q.empty()){
      int v = q.front(); q.pop(); //頂点を先頭から取り出す
      for(int u : to[v]){ //vにつながっている頂点を全探索
        if(dist[u] != INF) continue;
        dist[u] = dist[v]+1;
        pre[u] = v;　//ここがいつものBFSと違う
        q.push(u); //uをqueueに追加
      }
    }

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

Compiler output:
a.cc:30:20: error: extended character 　 is not valid in an identifier
   30 |         pre[u] = v;　//ここがいつものBFSと違う
      |                    ^
a.cc: In function 'int main()':
a.cc:21:24: warning: overflow in conversion from 'long long int' to 'std::vector<int>::value_type' {aka 'int'} changes value from '1152921504606846976' to '0' [-Woverflow]
   21 |     vector<int> dist(n,INF); //距離を記録
      |                        ^~~
a.cc:30:20: error: '\U00003000' was not declared in this scope
   30 |         pre[u] = v;　//ここがいつものBFSと違う
      |                    ^~
a.cc:42:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   42 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C

#include<stdio.h>
#define NMAX 100100
int main(void){ 	int n,m,a,b; 	int list[5*NMAX]={0}; 	int last=NMAX; 	int node[5*NMAX]={0}; 	int queue[5*NMAX]={0},qfirst=0,qlen=0;; 	int room[NMAX]={0}; 	int i; 	int now,tmp; 	scanf("%d%d",n,m) 	for(i=0;i<m;i++){ 		scanf("%d%d",a,b) ;list[last]=list[a]; 		list[a]=last; 		node[last]=b; 		last++; 		list[last]=list[b]; 		list[b]=last; 		node[last]=a; 		last++; 	} 	queue[0]=1;qlen=1; 	room[1]=room[0]=-1; 	while(qlen){ 		now=queue[qfirst]; 		qlen--; 		qfirst++; 		tmp=now; 		 		while(tmp){ 			tmp=list[tmp]; 			if(room[node[tmp]]==0){ 				room[node[tmp]]=now; 				queue[(qfirst+qlen)%(5*NMAX)]=node[tmp]; 				qlen++; 			} 		} 	} 	puts("Yes"); 	for(i=2;i<=n;i++){ 		printf("%d\n",room[i]); 	} 	return 0; } 


Compiler output:
main.c: In function 'main':
main.c:3:218: error: expected ';' before 'for'
    3 | int main(void){         int n,m,a,b;    int list[5*NMAX]={0};   int last=NMAX;  int node[5*NMAX]={0};   int queue[5*NMAX]={0},qfirst=0,qlen=0;;         int room[NMAX]={0};     int i;  int now,tmp;    scanf("%d%d",n,m)       for(i=0;i<m;i++){               scanf("%d%d",a,b) ;list[last]=list[a];          list[a]=last;           node[last]=b;           last++;                 list[last]=list[b];             list[b]=last;           node[last]=a;           last++;         }       queue[0]=1;qlen=1;      room[1]=room[0]=-1;     while(qlen){            now=queue[qfirst];              qlen--;                 qfirst++;               tmp=now;                                while(tmp){                     tmp=list[tmp];                  if(room[node[tmp]]==0){                                 room[node[tmp]]=now;                            queue[(qfirst+qlen)%(5*NMAX)]=node[tmp];                                qlen++;                         }               }       }       puts("Yes");    for(i=2;i<=n;i++){              printf("%d\n",room[i]);         }       return 0; }
      |                                                                                                                                                                                                                          ^      ~~~
      |                                                                                                                                                                                                                          ;
Language: C

#include<stdio.h> #define NMAX 100100  int main(void){ 	int n,m,a,b; 	int list[5*NMAX]={0}; 	int last=NMAX; 	int node[5*NMAX]={0}; 	int queue[5*NMAX]={0},qfirst=0,qlen=0;; 	int room[NMAX]={0}; 	int i; 	int now,tmp; 	scanf("%d%d",n,m) 	for(i=0;i<m;i++){ 		scanf("%d%d",a,b) ;list[last]=list[a]; 		list[a]=last; 		node[last]=b; 		last++; 		list[last]=list[b]; 		list[b]=last; 		node[last]=a; 		last++; 	} 	queue[0]=1;qlen=1; 	room[1]=room[0]=-1; 	while(qlen){ 		now=queue[qfirst]; 		qlen--; 		qfirst++; 		tmp=now; 		 		while(tmp){ 			tmp=list[tmp]; 			if(room[node[tmp]]==0){ 				room[node[tmp]]=now; 				queue[(qfirst+qlen)%(5*NMAX)]=node[tmp]; 				qlen++; 			} 		} 	} 	puts("Yes"); 	for(i=2;i<=n;i++){ 		printf("%d\n",room[i]); 	} 	return 0; } 


Compiler output:
main.c:1:19: warning: extra tokens at end of #include directive
    1 | #include<stdio.h> #define NMAX 100100  int main(void){  int n,m,a,b;    int list[5*NMAX]={0};   int last=NMAX;  int node[5*NMAX]={0};   int queue[5*NMAX]={0},qfirst=0,qlen=0;;         int room[NMAX]={0};     int i;  int now,tmp;    scanf("%d%d",n,m)       for(i=0;i<m;i++){               scanf("%d%d",a,b) ;list[last]=list[a];          list[a]=last;           node[last]=b;           last++;                 list[last]=list[b];             list[b]=last;           node[last]=a;           last++;         }       queue[0]=1;qlen=1;      room[1]=room[0]=-1;     while(qlen){            now=queue[qfirst];              qlen--;                 qfirst++;               tmp=now;                                while(tmp){                     tmp=list[tmp];                  if(room[node[tmp]]==0){                                 room[node[tmp]]=now;                            queue[(qfirst+qlen)%(5*NMAX)]=node[tmp];                                qlen++;                         }               }       }       puts("Yes");    for(i=2;i<=n;i++){              printf("%d\n",room[i]);         }       return 0; }
      |                   ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#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.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;
    int ans = pre[i];
    ++ans;
    cout << ans << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:11: error: request for member 'push_back' in 'to.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   17 |     to[a].push_back(b);
      |           ^~~~~~~~~
a.cc:18:11: error: request for member 'push_back' in 'to.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   18 |     to[b].push_back(a);
      |           ^~~~~~~~~
a.cc:28:22: error: 'begin' was not declared in this scope
   28 |     for (int u : to[v]) {
      |                      ^
a.cc:28:22: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:28:22: error: 'end' was not declared in this scope
   28 |     for (int u : to[v]) {
      |                      ^
a.cc:28:22: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)

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

  vector<int> ans(n);
  queue<int> q;
  q.push(0);
  while (q.size()) {
    int v = q.front();
    q.pop();
    for (int nv : g[v]) {
      if (ans[nv] == 0) {
        ans[nv] = v + 1;
        q.push(nv);
      }
    }
  }
  cout << "Yes" << '\n';
  rep(i, 1, n) cout << ans[i] << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'queue' was not declared in this scope
   18 |   queue<int> q;
      |   ^~~~~
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 | using namespace std;
a.cc:18:9: error: expected primary-expression before 'int'
   18 |   queue<int> q;
      |         ^~~
a.cc:19:3: error: 'q' was not declared in this scope
   19 |   q.push(0);
      |   ^
Language: C

#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
Graph G;
vector<int> to_exit;

void bfs(int start) {
    queue<int> que;
    que.push(start);
    while (!que.empty())
    {
        int cur = que.front();
        que.pop();
        for (auto nex: G[cur]) {
            if (to_exit[nex] != -1) continue;
            to_exit[nex] = cur;
            que.push(nex);
        }
    }
    
}


int main() {
    int N, M;
    cin >> N >> M;
    G.assign(N, vector<int>());
    to_exit.assign(N, -1);
    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);
    }
    to_exit[0] = -2;
    bfs(0);
    cout << "Yes" << endl;
    for (auto i: to_exit) {
        if (i == -2) continue;
        cout << 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>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  
  vector<int> c[100005]; //どことつながっているかを記録する二次元配列
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    c[a].push_back(b);
    c[b].push_back(a); //じつはこれで二次元配列を作れる
  }
  
  queue<int> q; //これから調べるぞリスト,調べ終わったものは削除する
  vector<int> p(n,-1);　//道しるべとなる部屋番号,決まっていない場合は-1
  
  q.push(0); //queueに0を入れる
  while (!q.empty()) { //queueが空になるまでループする
    int v = q.front();　//queueの一番前を取り出しそれをvとする
    q.pop(); //queueの一番前を削除
    for (int u : c[v]) { //vとつながっている部屋uを全探索
      if (p[u] != -1) continue; //道しるべが決まっていたらskip
      p[u] = v; //uの目印をvにする
      q.push(u); //queueにuを入れる(つまりこれから調べるということ)
    }
  }
  
  cout << "Yes" << endl;
  rep(i,n) {
    if (i==0) continue;
    cout << p[i] + 1 << endl;
  }
}

Compiler output:
a.cc:19:23: error: extended character 　 is not valid in an identifier
   19 |   vector<int> p(n,-1);　//道しるべとなる部屋番号,決まっていない場合は-1
      |                       ^
a.cc:23:23: error: extended character 　 is not valid in an identifier
   23 |     int v = q.front();　//queueの一番前を取り出しそれをvとする
      |                       ^
a.cc: In function 'int main()':
a.cc:19:23: error: '\U00003000' was not declared in this scope
   19 |   vector<int> p(n,-1);　//道しるべとなる部屋番号,決まっていない場合は-1
      |                       ^~
a.cc:23:25: error: expected ';' before 'q'
   23 |     int v = q.front();　//queueの一番前を取り出しそれをvとする
      |                         ^
      |                         ;
   24 |     q.pop(); //queueの一番前を削除
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,M;
    cin >> N >> M;
    vector<vector<int>>road(N);
    for(int i = 0; i < M; i++) {
        int A,B;
        cin >> A >> B;
        A--;B--;
        road[A].push_back(B);
        road[B].push_back(A);
    }
    queue<int> que;
    vector<int>cnt(N,-1);
    cnt[0] = 0;
    que.push(0);
    while(!que.empty) {
        int x = que.front();
        que.pop();
        for(int i = 0; i < road[x].size(); i++) {
            if(cnt[road[x][i]] == -1) {
                cnt[road[x][i]] = x;
                que.push(road[x][i]);
            }
        }
    }
    bool ok = true;
    for(int i = 0; i < N; i++) {
        if(cnt[i] == -1) {
            ok = false;
        }
    } 
    if(ok) {
        cout << "Yes" << endl;
        for(int i = 1; i < N; i++) {
            cout << cnt[i]+1 << endl;
        }
    }
    else {
        cout << "No" << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: cannot convert 'std::queue<int>::empty' from type 'bool (std::queue<int>::)() const' to type 'bool'
   18 |     while(!que.empty) {
      |                ^~~~~
a.cc:18:16: error: in argument to unary !
   18 |     while(!que.empty) {
      |            ~~~~^~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int n, m;
vector<vector<int>> G;

void bfs() {
    vector<int> dist(n, -1);
    vector<int> pre(n, -1);
    queue<int> que;
    que.push(0);
    dist[0] = 0;
    
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for(auto nv : G[v]) {
            if (dist[nv] == -1) {
                dist[nv] = dist[v] + 1;
                pre[nv] = v;
                que.push(nv);
            }
        }
    }
    
    for(int i = 1; i < n; i++) {
        cout << pre[i] + 1 << endl;
        
    }
}




int main() {

    cin >> n >> m;
    G.assign(n, vector<int>());

    REP(i, m) {
        cin >> a >> b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }

    cout << "Yes" << endl;
    
    bfs();

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:16: error: 'a' was not declared in this scope
   53 |         cin >> a >> b;
      |                ^
a.cc:53:21: error: 'b' was not declared in this scope
   53 |         cin >> a >> b;
      |                     ^
Language: Java

import java.util.*;
import java.io.*;
import java.util.Scanner;
import java.util.HashMap;

public class Solution{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ways = sc.nextInt();
		int[][] arr = new int[n][n];
		for(int a=0;a<ways;a++)
		{
			int l = sc.nextInt();
			int r = sc.nextInt();
			arr[l-1][r-1] = 1;
			arr[r-1][l-1] = 1;	
		}
		int[][] ans = new int[2][n];
		for(int i=0;i<n;i++)
		{
			ans[1][i] = Integer.MAX_VALUE;
		}
		giveout(arr,ans,n);
		int count = 0;
		for(int i=0;i<n;i++)
		{
			if(ans[1][i]<Integer.MAX_VALUE)
				count++;
		}
		if(count == n)
		{
			System.out.println("Yes");
			for(int i=1;i<n;i++)
			{
				System.out.println(ans[0][i]+1);
			}
		}
		else{
			System.out.println("No");
		}
	}
	static void giveout(int[][] arr, int[][] ans,int n)
	{
		ans[1][0] = 0;
		Boolean[] st = new Boolean[n];
		for(int i=0;i<n;i++)
		{
			st[i] = false;
		}
		for(int j=0;j<n;j++)
		{
			int ver = 0;
			int min = Integer.MAX_VALUE;
			int index = -1;
			int i = 0;
			for(i=0;i<n;i++)
			{
				if(st[i] == false && ans[1][i] <= min)
				{
					min = ans[1][i];
					index = i;
				}
			}
			st[index] = true;
			for(i=0;i<n;i++)
			{
				if(st[i] == false && ans[1][i]>=min+1 && arr[index][i] != 0)
				{
					ans[1][i] = min+1;
					ans[0][i] = index;
				}
			}
		}
	}
}

Compiler output:
Main.java:6: error: class Solution is public, should be declared in a file named Solution.java
public class Solution{
       ^
1 error
Language: C++


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


int main() {
    int N, M; cin >> N >> M;
    vector<int> a(M), b(M);
    queue<int> q;
    rep(i, M) cin >> a[i] >> b[i];
    vector<bool> searchedNode(N+3, false);
    vector<bool> searchedPath(M, false);
    vector<int> ans(N+5, -1);

    //初期化条件
    q.push(1);
    searchedNode[1] = true;

    while(!q.empty()) {
        int x = q.front();
        q.pop();
        rep(i,M) {
            if(searchedPath[i] == true) continue;
            if(a[i] == x) {
                if(searchedNode[b[i]] == true) continue;
                else {
                    q.push(b[i]);
                    ans[b[i]] = x;
                    searchedPath[i] = true;
                };

                searchedNode[b[i]] = true;
            } else if(b[i] == x) {
                if(searchedNode[a[i]] == true) continue;
                else {
                    q.push(a[i]);
                    ans[a[i]] = x;
                    searchedPath[i] = true;
                }

                searchedNode[a[i]] = true;
            };
        };
    };

    bool canExit = true;
    rep(i,N) {
        if(searchedNode[i+1] == false) {
            canExit = false;
            break;
        }
    }
    if(canExit) {
        cout << "Yes" << endl;
        rep(i,N-1) cout << ans[i+2
        ] << endl;
    } else cout << "No" << endl;
};

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: expected ')' before 'cin'
   11 |     rep(i, M) cin >> a[i] >> b[i];
      |               ^~~
a.cc:4:22: note: to match this '('
    4 | #define rep(i, N) for(int i = 0; i< N; i
      |                      ^
a.cc:11:5: note: in expansion of macro 'rep'
   11 |     rep(i, M) cin >> a[i] >> b[i];
      |     ^~~
a.cc:23:18: error: expected ')' before '{' token
   23 |         rep(i,M) {
      |                  ^
a.cc:4:22: note: to match this '('
    4 | #define rep(i, N) for(int i = 0; i< N; i
      |                      ^
a.cc:23:9: note: in expansion of macro 'rep'
   23 |         rep(i,M) {
      |         ^~~
a.cc:48:14: error: expected ')' before '{' token
   48 |     rep(i,N) {
      |              ^
a.cc:4:22: note: to match this '('
    4 | #define rep(i, N) for(int i = 0; i< N; i
      |                      ^
a.cc:48:5: note: in expansion of macro 'rep'
   48 |     rep(i,N) {
      |     ^~~
a.cc:56:20: error: expected ')' before 'cout'
   56 |         rep(i,N-1) cout << ans[i+2
      |                    ^~~~
a.cc:4:22: note: to match this '('
    4 | #define rep(i, N) for(int i = 0; i< N; i
      |                      ^
a.cc:56:9: note: in expansion of macro 'rep'
   56 |         rep(i,N-1) cout << ans[i+2
      |         ^~~