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

#include<bits/stdc++.h> 
const int maxn=100005,inf=1000000000;
using namespace std;
int a[maxn][maxn],d[maxn],p[maxn];
int main(){
	int i,j,k,m,n,t=1;
	scanf("%d%d",&n,&m);
	for(i=1;i<=m;i++){
		int x,y,z;
		scanf("%d%d",&x,&y);
		a[x][y]=a[y][x]=1;
	}
	for(i=1;i<=n;i++)d[i]=inf;//初始化d[i]代表i点到t点的距离 
	d[t]=0;
	for(i=1;i<=n;i++){
		int zx=inf;//zx=最小 
		for(j=1;j<=n;j++)//遍历每个点 
			if(!p[j] && d[j]<zx){//找到离原点最近的没有走过的点 用k记录 
				zx=d[j];
				k=j;
			}
		p[k]=1;//k点被走过 
		for(j=1;j<=n;j++)
			if(!p[j] && a[k][j]!=0 && d[j]>d[k]+a[k][j])//更新k点可以走到的所有没走过的点 
				d[j]=d[k]+a[k][j];
	}
	int ok=1;
	for(i=2;i<=n;i++){
		if(d[i]==inf){
			ok=0;
			break;
		}
	}
	if(ok){
		printf("Yes\n");
		for(i=2;i<=n;i++)printf("%d\n",d[i]);
	}
	else printf("No\n");
	return 0;
}

Compiler output:
/tmp/ccPxizRZ.o: in function `main':
a.cc:(.text+0xf7): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccPxizRZ.o
a.cc:(.text+0x11e): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccPxizRZ.o
a.cc:(.text+0x155): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccPxizRZ.o
a.cc:(.text+0x170): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccPxizRZ.o
a.cc:(.text+0x18c): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccPxizRZ.o
a.cc:(.text+0x1b8): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccPxizRZ.o
a.cc:(.text+0x1df): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccPxizRZ.o
a.cc:(.text+0x22d): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccPxizRZ.o
a.cc:(.text+0x244): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccPxizRZ.o
a.cc:(.text+0x288): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccPxizRZ.o
a.cc:(.text+0x2c9): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include <iostream> 
#include <algorithm>
#include <cmath>
#include <vector>
#include <tuple>
#include <queue>  
#define ll long long
  
using namespace std; 

int main(){
    int n,m;
    cin >> n >> m;
    int pointer[20000];

    for (int i = 0; i < n; i++) pointer[i] = -1;
    pointer[0] = 0;

    vector< vector<int>> adj;
    for (int i = 0; i < n; i++) {
        vector<int> tmp;
        adj.push_back(tmp);
    }

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

    queue<int> check_nodes;
    check_nodes.push(0);
    while(!check_nodes.empty()) {
        int cn = check_nodes.front();
        check_nodes.pop();
        for (int ad : adj[cn]) {
            if (pointer[ad] == -1) {
                // cout << "found " <<cn+1 << " " << ad+1 << endl;
                pointer[ad] = cn;
                check_nodes.push(ad);
            }
        }
    }

    bool found = true;
    for (int i = 0; i < n; i++) {
        if (pointer[i] == -1){ 
            found = false;
            break;    
        }
    }

    if (found) {
        cout << "Yes" << endl;
        for (int i = 1; i < n; i++) {
            cout << pointer[i]+1 << endl;
        }
    }
    else {
        cout << "No" << endl;
    }
}

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

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REP2(i,x,n) for(ll i=x; i<(n); i++)
#define REP3(i,x,n) for(ll i=x; i>(n); i--)
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
static const ll INFTY = (1<<21);
static const ll N = 100000;
ll n,Ma[N][N]={0};
ll d[N];
void bfs(ll s){
    queue<ll>q;
    q.push(s);
    ll count=0;
    
    for(ll i = 0;i<n;i++){
        d[i] = INFTY;
    }
    d[s]=0;
    ll u;
    while (!q.empty())
    {
        u=q.front();q.pop();
        for(ll v = 0;v < n;v++){
            if(Ma[u][v]==0)continue;
            if(d[v]!=INFTY)continue;
            d[v]=d[u]+1;count++;
            q.push(v);
        }
    }
    
    if(count==n-1){
        cout << "Yes" << endl;
        for(ll i = 1;i<n;i++){
            cout << d[i] << endl;
        }
    }else{
        cout << "No" << endl;
    }
    

}


int main(){
    ll  M,a,b;
    cin >> n >> M;
    REP(i,M){
        cin >> a >> b;
        a--;
        b--;
        Ma[a][b] = 1;
        Ma[b][a] = 1;
    }

    bfs(0);

    return 0;
}

Compiler output:
/tmp/ccDFetLW.o: in function `bfs(long long)':
a.cc:(.text+0x56): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccDFetLW.o
a.cc:(.text+0x86): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccDFetLW.o
a.cc:(.text+0x105): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccDFetLW.o
a.cc:(.text+0x124): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccDFetLW.o
a.cc:(.text+0x142): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccDFetLW.o
a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccDFetLW.o
collect2: error: ld returned 1 exit status
Language: C++


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

typedef long double ld;
#define int long long   
#define PB push_back 
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define ii pair <int,int>
#define mii map <int,int>
#define vi vector<int> 
#define vpi vector< pair<int,int> >
#define F first
#define S second 
#define mem1(a) memset(a,-1,sizeof(a))
#define mem0(a) memset(a,0,sizeof(a))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a; i>=b; --i)
#define sz(x) (int)((x).size())

ld pi= 3.14159265358979;
//const int mod=998244353; 
const int mod = 1e9+7;
const int maxn=2e5+5;
vi g[maxn];
bool vis[maxn];
int ans[maxn], cnt;
int lvl[maxn];
int ansl[maxn];
dfs(int x, int p){
	vis[x] = 1;
	lvl[x] = min(lvl[x], lvl[p]+1);
	for(auto it: g[x]){
		lvl[it] = min(lvl[it], lvl[x]+1);
	}
	for(auto it: g[x]){
		if(lvl[x] <= ansl[it]){
			ansl[it] = lvl[x]; ans[it] = x;
		}
		if(!vis[it]){ 
			dfs(it, x);
		}
	}
}

void solve()
{   
    int n, m; cin>>n>>m;
    rep(i, 0, m){
    	int a, b; cin>>a>>b;
    	g[a].PB(b);
    	g[b].PB(a);
	}
	fill(ansl, ansl+n+5, INT_MAX);
	fill(lvl, lvl+n+5, INT_MAX);
	lvl[0] = 0;
	rep(i, 1, n+1){
		if(!vis[i]){
			dfs(i, 0); cnt++;
		}
	}
	rep(i, i, n+1) cout<<lvl[i]<<" "; cout<<endl;
	if(cnt != 1) cout<<"NO";
	else{
		/*for(int i=1; i<=n; i++){
			for(auto it : g[i]){
				if(it)
			}
		}*/
		cout<<"YES"<<endl;
		rep(i, 2, n+1) cout<<ans[i]<<endl;
	}

}

signed main() 
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  //  cout<<setprecision(20);
    int tc=1;// cin>>tc;
    while(tc--){
        solve();//cout<<'\n';
    }
    return 0;
}

Compiler output:
a.cc:31:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive]
   31 | dfs(int x, int p){
      | ^~~
a.cc: In function 'int dfs(long long int, long long int)':
a.cc:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
   45 | }
      | ^
Language: C++

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

vector<bool> seen;
vector<int> x;

void dfs(const vv &g, int v) {
  if(seen.size()==n) return 0;
  for (auto next_v : g[v]) { 
    if (seen[next_v]) continue;
    x[next_v]=v;
    seen[next_v]=true;
    dfs(g, next_v); 
  }
}
int main() {
  int n,m;
  cin>>n>>m;
  vv g(n);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    g[a-1].push_back(b-1);
  }
  seen[0]=true;
  dfs(g,0);
  for(int i=0;i<x.size();i++){
    if(x[i]==0){
      cout<<"No";
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  for(int i=0;i<n;i++){
    cout<<x[i]<<endl;
  }
}


Compiler output:
a.cc: In function 'void dfs(const vv&, int)':
a.cc:9:19: error: 'n' was not declared in this scope
    9 |   if(seen.size()==n) return 0;
      |                   ^
a.cc:9:29: error: return-statement with a value, in function returning 'void' [-fpermissive]
    9 |   if(seen.size()==n) return 0;
      |                             ^
Language: C++

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

int n, m, x, y;
bool visited[200009];

int ans[200009];

vector<int> g[200009];

// map<int, vector<int> > g;
int cntr = 0;

void BFS() {
	int start = 1;
	queue<int> q;
	q.push(start);

	int dist = 1;
	visited[1] = true;

	while(!q.empty()) {
		int sz = q.size();
		// cout<<"at level"<<dist<<endl;
		while(sz--) {
			int node = q.front();
			q.pop();
			// cout<<node<<endl;
			cntr++;

			for(auto u: g[node]) {
				// int u = g[node][i];
				if(!visited[u]) {
					visited[u] = true;
					ans[u] = node;
					q.push(u);
				}
			}
		}
		dist++;
	}

}


int main() {

	cin>>n>>m;
	
	for(int i = 0; i < n; i++)
		ans[i] = INT_MAX;

	for(int i = 0; i < m; i++) {
		cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	
	BFS();
	if(cntr < n)
		cout<<"No\n";
	else {
		cout<<"Yes\n";
		for(int i = 2; i <= n; i++) {
			cout<<ans[i]<<endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:26: error: 'INT_MAX' was not declared in this scope
   54 |                 ans[i] = INT_MAX;
      |                          ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<queue>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define debug(x) cout << #x << " = " << x << endl
#define print(x) cout << x << endl;
const ll MOD = 1000000007;

vector<ll> ans;

struct node
{
    ll id;
    ll cost;   // The cost to arrive at this node
    ll parent; // Not used for now
    node(ll _id, ll _cost)
    {
        id = _id;
        cost = _cost;
    }
};

bool operator<(const node &left, const node &right)
{
    return left.cost < right.cost;
}

bool operator>(const node &left, const node &right)
{
    return left.cost > right.cost;
}

struct edge
{
    ll to;
    ll cost;
    edge(ll _to, ll _cost)
    {
        to = _to;
        cost = _cost;
    }
};

struct Graph
{
    ll V;
    vector<vector<edge>> edges;

    // V is the number of vertices
    Graph(ll _V)
    {
        // init
        V = _V;
        rep(i, V)
        {
            edges.push_back({});
        }
    }

    void addEdge(ll u, ll v, ll w)
    {
        edges[u].push_back(edge(v, w));
    }

    // O((E+N)logN)
    vector<ll> dijkstra(ll s) // s: starting vertex
    {

        // init min distance vector
        // d[i] is the minimum distance from s to i
        vector<ll> d(V);
        rep(i, V)
        {
            d[i] = LLONG_MAX;
        }

        // the top element is the vertex with the smallest cost
        priority_queue<node, vector<node>, greater<node>> q;

        // init start vertex
        d[s] = 0;
        q.push(node(s, 0));

        // update
        while (!q.empty())
        {
            node n = q.top();
            q.pop();

            // cout << "Now at node " << n.id << endl;

            // Check all the node which connects with n
            for (edge e : edges[n.id])
            {
                // cout << "Searching edge from " << n.id << " to " << e.to << endl;
                ll cand = d[n.id] + e.cost; // Cost via n
                // cout << "Candidate cost to " << e.to << " is " << cand << endl;

                if (cand < d[e.to])
                {
                    // cout << "Update cost for " << e.to << " to " << cand << endl;
                    d[e.to] = cand;
                    // cout << "Mejirushi for " << e.to << "is" << n.id << endl;
                    ans[e.to] = n.id;
                    q.push(node(e.to, cand)); // If via n is better, this may improve the shortest cost so need check
                }
            }
        }

        return d;
    }
};

int main()
{
    ll N, M;
    cin >> N >> M;

    Graph graph(N);
    rep(i, M)
    {
        ll temp, temp2;
        cin >> temp >> temp2;
        temp--;
        temp2--;
        graph.addEdge(temp, temp2, 1);
        graph.addEdge(temp2, temp, 1);
        ans.push_back(-1);
    }

    graph.dijkstra(0);

    cout << "Yes" << endl;
    rep(i, N - 1)
    {
        cout << ans[i + 1] + 1 << endl;
    }
}
j

Compiler output:
a.cc:140:1: error: 'j' does not name a type
  140 | j
      | ^
Language: C++

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

int n, m, x, y;
bool visited[200009];

int ans[200009];

vector<int> g[200009];

// map<int, vector<int> > g;
int cntr = 0;

void BFS() {
	int start = 1;
	queue<int> q;
	q.push(start);

	int dist = 1;
	visited[1] = true;

	while(!q.empty()) {
		int sz = q.size();
		// cout<<"at level"<<dist<<endl;
		while(sz--) {
			int node = q.front();
			q.pop();
			// cout<<node<<endl;
			cntr++;

			for(int i = 0; i < g[node].size(); i++) {
				int u = g[node][i];
				if(!visited[u]) {
					visited[u] = true;
					ans[u] = node;
					q.push(u);
				}
			}
		}
		dist++;
	}

}


int main() {

	cin>>n>>m;
	
	for(int i = 0; i < n; i++)
		ans[i] = INT_MAX;

	for(int i = 0; i < m; i++) {
		cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	
	BFS();
	if(cntr < n)
		cout<<"No\n";
	else {
		cout<<"Yes\n";
		for(int i = 2; i <= n; i++) {
			cout<<ans[i]<<endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:26: error: 'INT_MAX' was not declared in this scope
   54 |                 ans[i] = INT_MAX;
      |                          ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<queue>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<int >me[100005];
int visit[100005];
int parent[100005];
queue<int >qu;
int main(){
	int n,e;
	scanf("%d%d",&n,&e);
	for(int i=1;i<=n;i++)
		parent[i]=-1;
	for(int i=0;i<e;i++){
		int a,b,c;
		scanf("%d%d",&a,&b);
		me[a].push_back(b);
		me[b].push_back(a);
	}
	qu.push(1);
	while(!qu.empty()){
		int a=qu.front();
		visit[a]=1;
		qu.pop();
		for(auto A=me[a].begin();A!=me[a].end();A++){
			if(visit[*A]==0){
				qu.push(*A);
				visit[*A]=1;
				parent[*A]=a;
			}
		}
	}
	for(int i=2;i<=n;i++){
		if(parent[i]==-1)
		{
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	for(int i=2;i<=n;i++){
		printf("%d\n",parent[i]);
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: reference to 'visit' is ambiguous
   21 |                 visit[a]=1;
      |                 ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:4:5: note:                 'int visit [100005]'
    4 | int visit[100005];
      |     ^~~~~
a.cc:24:28: error: reference to 'visit' is ambiguous
   24 |                         if(visit[*A]==0){
      |                            ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:4:5: note:                 'int visit [100005]'
    4 | int visit[100005];
      |     ^~~~~
a.cc:26:33: error: reference to 'visit' is ambiguous
   26 |                                 visit[*A]=1;
      |                                 ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:4:5: note:                 'int visit [100005]'
    4 | int visit[100005];
      |     ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REP2(i,x,n) for(ll i=x; i<(n); i++)
#define REP3(i,x,n) for(ll i=x; i>(n); i--)
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
static const ll INFTY = (1<<21);
static const ll N = 100000;
ll n,Ma[N][N]={0};
ll d[N];
void bfs(ll s){
    queue<ll>q;
    q.push(s);
    ll count=0;
    bool ok = true;
    for(ll i = 0;i<n;i++){
        d[i] = INFTY;
    }
    d[s]=0;
    int u;
    while (!q.empty())
    {
        u=q.front();q.pop();
        for(ll v = 0;v < n;v++){
            if(Ma[u][v]==0)continue;
            if(d[v]!=INFTY)continue;
            d[v]=d[u]+1;count++;
            q.push(v);
        }
    }
    
    if(count==n-1){
        cout << "Yes" << endl;
        for(ll i = 1;i<n;i++){
            cout << d[i] << endl;
        }
    }else{
        cout << "No" << endl;
    }
    

}


int main(){
    ll  M,a,b,ans=0;
    cin >> n >> M;
    REP(i,M){
        cin >> a >> b;
        a--;
        b--;
        Ma[a][b] = 1;
        Ma[b][a] = 1;
    }

    bfs(0);

    return 0;
}

Compiler output:
/tmp/ccwrXx2y.o: in function `bfs(long long)':
a.cc:(.text+0x5a): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccwrXx2y.o
a.cc:(.text+0x8a): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccwrXx2y.o
a.cc:(.text+0x10a): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccwrXx2y.o
a.cc:(.text+0x12a): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccwrXx2y.o
a.cc:(.text+0x148): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccwrXx2y.o
a.cc:(.text+0x20a): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccwrXx2y.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>

using namespace std;


int main() {
  int n, m; cin >> n >> m;
  vector<vector<int>> v(n);
  for(int i = 0; i < m; ++i) {
    int x, y; cin >> x >> y;
    --x; --y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  queue<pair<int, int>> q;
  q.emplace(0, -1);
  vector<bool> vis(n), par(n);
  while(!q.empty()) {
    int c = q.front().first;
    vis[c] = true; par[c] = q.front().second;
    q.pop();
    for (auto x: v[c]) {
      if (!vis[x]) q.emplace(x, c);
    }
  }
  cout << "Yes" << endl;
  for (int i = 1; i < n; ++i) {
    cout << p[i] << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:13: error: 'p' was not declared in this scope
   28 |     cout << p[i] << endl;
      |             ^
Language: C++

#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,m;
	scanf("%d %d",&n,&m);
	vector<int>v[n+5];
	for(int i=0;i<m;i++)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		v[x].push_back(y);
		v[y].push_back(x);
	}
	priority_queue<pair<int,pair<int,int>>,vector<pair<int,pair<int,int>>>,greater<pair<int,pair<int,int>>>>pq;
	pq.push({0,{1,1}});
	int dis[n+5],par[n+5];
	for(int i=0;i<=n;i++)
	{
		dis[i]=100000000;
		par[i]=-1;
	}
	dis[1]=0;
	while(pq.size()>0)
	{
		pair<int,pair<int,int>>p=pq.top();
		int wei=p.first;
		int node=p.second.first;
		int parent=p.second.second;
		if(par[i]==-1)
		{
			par[i]=parent;
			dis[node]=wei;
		}
		pq.pop();
		for(int i=0;i<v[node].size();i++)
		{
			if(par[i]==-1)
			{
				pq.push({wei+1,{v[node][i],node}});
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(dis[i]==100000000)
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	for(int i=2;i<=n;i++)printf("%d\n",par[i]);
	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:35:24: error: 'i' was not declared in this scope
   35 |                 if(par[i]==-1)
      |                        ^
Language: C++

#include<bits/stdc++.h>

using namespace std;


int main() {
  int n, m; cin >> n >> m;
  vector<vector<int>> v(n);
  for(int i = 0; i < m; ++i) {
    int x, y; cin >> x >> y;
    --x; --y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  queue<pair<int, int>> q;
  q.emplace(0, -1);
  vector<bool> vis(n), par(n);
  while(!q.empty()) {
    int c = q.front().first();
    vis[c] = true; par[c] = q.front().second();
    q.pop();
    for (auto x: v[c]) {
      if (!vis[x]) q.emplace(x, c);
    }
  }
  cout << "Yes" << endl;
  for (int i = 1; i < n; ++i) {
    cout << p[i] << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: expression cannot be used as a function
   19 |     int c = q.front().first();
      |             ~~~~~~~~~~~~~~~^~
a.cc:20:45: error: expression cannot be used as a function
   20 |     vis[c] = true; par[c] = q.front().second();
      |                             ~~~~~~~~~~~~~~~~^~
a.cc:28:13: error: 'p' was not declared in this scope
   28 |     cout << p[i] << endl;
      |             ^
Language: C++

//c++ テンプレ
#include<bits/stdc++.h>
using namespace std;

typedef long long llint;
typedef long double ld;

#define inf 1e9
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m;
int d[100005];
bool used[100005];
int a[200005],b[200005];
int g[100005][100005];
int x[100005];


void di(int s){
    fill(d,d+n+1,inf);
    fill(used,used+n+1,false);
    fill(x,x+n+1,inf);
    d[s]=0;
    while(1){
        int v=-1;
        for(int u=1;u<=n;u++){
            if(!used[u]&& (v==-1 || d[u]<d[v]))v=u;
        }
        if(v==-1)break;
        used[v]=true;
        for(int u=1;u<=n;u++){
            if(d[u]>d[v]+g[v][u]){
                d[u]=d[v]+g[v][u];
                x[u]=v;
            }
        }
    }

}

void solve(){
    cin >> n >> m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++)g[i][j]=inf;
    }
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        g[a][b]=1;
        g[b][a]=1;
    }
    di(1);
    bool f=true;
    for(int i=2;i<=n;i++){
        if(d[i]==inf){
            f=false;
            break;
        }
    }
    if(!f)cout << "No" << endl;
    else{
        cout << "Yes" << endl;
        for(int i=2;i<=n;i++){
            cout << x[i] << endl;
        }
    }
}

int main(){
  solve();
  return 0;
}


Compiler output:
/tmp/ccUNEHsJ.o: in function `di(int)':
a.cc:(.text+0xa8): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccUNEHsJ.o
a.cc:(.text+0xbd): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccUNEHsJ.o
a.cc:(.text+0x241): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccUNEHsJ.o
/tmp/ccUNEHsJ.o: in function `solve()':
a.cc:(.text+0x45b): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccUNEHsJ.o
collect2: error: ld returned 1 exit status
Language: C++

//c++ テンプレ
#include<bits/stdc++.h>
using namespace std;

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

llint n,m;
llint d[100005];
bool used[100005];
llint a[200005],b[200005];
llint g[100005][100005];
llint x[100005];


void di(llint s){
    fill(d,d+n+1,inf);
    fill(used,used+n+1,false);
    fill(x,x+n+1,inf);
    d[s]=0;
    while(1){
        int v=-1;
        for(int u=1;u<=n;u++){
            if(!used[u]&& (v==-1 || d[u]<d[v]))v=u;
        }
        if(v==-1)break;
        used[v]=true;
        for(int u=1;u<=n;u++){
            if(d[u]>d[v]+g[v][u]){
                d[u]=d[v]+g[v][u];
                x[u]=v;
            }
        }
    }

}

void solve(){
    cin >> n >> m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++)g[i][j]=inf;
    }
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        g[a][b]=1;
        g[b][a]=1;
    }
    di(1);
    bool f=true;
    for(int i=2;i<=n;i++){
        if(d[i]==inf){
            f=false;
            break;
        }
    }
    if(!f)cout << "No" << endl;
    else{
        cout << "Yes" << endl;
        for(int i=2;i<=n;i++){
            cout << x[i] << endl;
        }
    }
}

int main(){
  solve();
  return 0;
}


Compiler output:
/tmp/ccuXJtxH.o: in function `di(long long)':
a.cc:(.text+0xa6): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccuXJtxH.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccuXJtxH.o
a.cc:(.text+0x258): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccuXJtxH.o
/tmp/ccuXJtxH.o: in function `solve()':
a.cc:(.text+0x4b6): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccuXJtxH.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
ll n,m,i,j,k,l,t,arr[sz],brr[sz],vis[sz];
vector<ll>v[sz];
char c[sz];
void bfs(ll node)
{
    for(ll ii=0;ii<v[node].size();ii++)
    {
        ll xx=v[node][ii];
        if(vis[xx]==0 || arr[xx]>arr[node]+1)
        {
            vis[xx]=1;
            arr[xx]=arr[node]+1;
            brr[xx]=node;
            bfs(xx);
        }
    }
    return;
}
int main()
{
   scanf("%lld %lld",&n,&m);
   for(i=1;i<=m;i++)
   {
       scanf("%lld %lld",&x,&y);
       v[x].push_back(y);
       v[y].push_back(x);
   }
   vis[1]=1;
   bfs(1);
   for(i=2;i<=n;i++)
   {
       if(vis[i]==0)
       {
           printf("No\n");
           return 0;
       }
   }
   printf("Yes\n");
   for(i=2;i<=n;i++)
    printf("%lld\n",brr[i]);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:27: error: 'x' was not declared in this scope
   28 |        scanf("%lld %lld",&x,&y);
      |                           ^
a.cc:28:30: error: 'y' was not declared in this scope; did you mean 'yn'?
   28 |        scanf("%lld %lld",&x,&y);
      |                              ^
      |                              yn
Language: C

#include <stdio.h>
#include <vector>
using namespace std;
vector<vector<int>> G;
int n, m;
int dist[100000];
int q[100000], head, tail;
void bfs(int st) {
	for (int i = 0; i < n; i++) {
		dist[i] = -1;
	}
	dist[st] = 0;
	head = tail = 0;
	q[tail] = st;
	tail++;
	while (head != tail) {
		// q[head] -> no ?
		for (int i = 0; G[q[head]][i] != -1; i++) {
			int no = G[q[head]][i];
			if (0 <= no && no < n && dist[no] == -1) {
				dist[no] = dist[q[head]] + 1;
				q[tail] = no;
				tail++;
			}
		}
		head++;
	}
}
int min(int x, int y) {
	return x < y ? x : y;
}
int main() {
	scanf("%d%d", &n, &m);
	G.resize(n);
	for (int i = 0; i < m; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	for (int i = 0; i < n; i++) {
		G[i].push_back(-1);
	}
	bfs(0);
	bool canReach = true;
	for (int i = 0; i < n; i++) {
		if (dist[i] == -1) {
			canReach = false;
			break;
		}
	}
	if (canReach) {
		printf("Yes\n");
		for (int i = 1; i < n; i++) {
			for (int j = 0; G[i][j] != -1; j++) {
				if (dist[G[i][j]] - dist[i] == -1) {
					printf("%d\n", G[i][j] + 1);
					break;
				}
			}
		}
	} else {
		printf("No\n");
	}
	return 0;
}


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

#include "utils.cpp"

#include <bits/stdc++.h>


using namespace std;
using ll = int64_t;
#define int int64_t

 
/* ==== declarations ====== */
// functions
void solve();
void getInput();
 
// global variables
int N, M;
vector<vector<int>> AL;
vector<int> D;
vector<int> ans;
const int INF = 1e9;

/* ======================== */
void getInput() {
    cin>>N>>M;
    AL = vector<vector<int>>(N, vector<int>());    
    D = vector<int>(N, INF);
    ans = vector<int>(N, -1);
    for(int i=0; i<M; ++i) {
        int u, v;
        cin>>u>>v;
        u--; v--;
        AL[u].push_back(v);
        AL[v].push_back(u);
    }
    // print(AL);
}
 
 
void solve() {
    // auto nb = AL[0];
    // print(nb);
    // queue<int> que;
    queue<vector<int>> que;
    que.push({0, 0});
    // print(que);

    while(!que.empty()) {
        auto op = que.front();
        que.pop();
        auto n = op[0];
        auto d = op[1];
        D[n] = d;
        // print("write ", n ,"to", d);
        // print(op, "!");
        auto nb = AL[n];
        
        for(auto nn: nb) {
            if (D[nn] <= d) continue;
            D[nn] = d+1;
            que.push({nn, d+1});
            ans[nn] = n;
        }
    }
    // print(D);
    // print(ans);
    for (int i=1; i<N; ++i) {
        if (ans[i] == -1) {
            cout<<"No"<<endl;
            exit(0);
        }
    }
    cout<<"Yes"<<endl;
    for (int i=1; i<N; ++i)
        cout<<ans[i]+1<<endl;

}
 
 
 
signed main(){
    getInput();
    solve();
    return 0;
}

Compiler output:
a.cc:1:10: fatal error: utils.cpp: No such file or directory
    1 | #include "utils.cpp"
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<vector>
#include<queue>
#define pb push_back
using namespace std;
vector<int> adj[100005];
bool v[100005];
int prev[100005];
int main(){
  int N,M;
  cin>>N>>M;
  for(int i=0; i<M; i++){
    int a,b;
    cin>>a>>b;
    adj[a].pb(b);
    adj[b].pb(a);
  }
  queue<int> myq;
  myq.push(1);
  v[1]=true;
  prev[1]=-1;
  while(!myq.empty()){
    int cur_room=myq.front();
    myq.pop();
    for(int i=0; i<adj[cur_room].size(); i++){
      int next=adj[cur_room][i];
      if(!v[next]){
        myq.push(next);
        v[next]=true;
        prev[next]=cur_room;
      }
    }
  }
  for(int i=1; i<=N; i++){
    if(!v[i]){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  for(int i=2; i<=N; i++){
    cout<<prev[i]<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: reference to 'prev' is ambiguous
   21 |   prev[1]=-1;
      |   ^~~~
In file included from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:8:5: note:                 'int prev [100005]'
    8 | int prev[100005];
      |     ^~~~
a.cc:30:9: error: reference to 'prev' is ambiguous
   30 |         prev[next]=cur_room;
      |         ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:8:5: note:                 'int prev [100005]'
    8 | int prev[100005];
      |     ^~~~
a.cc:42:11: error: reference to 'prev' is ambiguous
   42 |     cout<<prev[i]<<endl;
      |           ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:8:5: note:                 'int prev [100005]'
    8 | int prev[100005];
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};
const int month[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};
vi v[100010];
int ans[100010];
bool use[100010];
void bfs(int now)
{
	queue<int> q;
	q.push(now);
	while(!q.empty())
	{
		now=q.front();
		q.pop();
		rep(i,v[now].size())
		{
			if(!use[v[now][i]])
			{
				use[v[now][i]]=1;
				ans[v[now][i]]=now;
				q.push(v[now][i]);
			}
		}
	}
}
/*======================================================================*/
int main()
{
  /*
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
  */
  /*====================================================================*/
  int n,m;
  cin>>n>>m;
  rep(i,m)
  {
  	int a,b;
  	cin>>a>>b;
  	a--,b--;
  	v[a].pb(b);
  	v[b].pb(a);
  }
  bfs(0);
  /*rep(i,n)
  {
  	cout<<i<<" "<<use[i]<<endl;
  }*/
  rep(i,n)
  {
  	if(!use[i])
  	{
  		//cout<<i<<endl;
  		cout<<"No"<<endl;
  		return 0;
	}
  }
  cout<<"Yes"<<endl;
  forn(i,1,n-1)
  {
  	cout<<ans[i]+1<<endl;
  }
  return 0;
}


Compiler output:
a.cc:6:1: error: 'vi' does not name a type; did you mean 'void'?
    6 | vi v[100010];
      | ^~
      | void
a.cc: In function 'void bfs(int)':
a.cc:17:21: error: 'i' was not declared in this scope
   17 |                 rep(i,v[now].size())
      |                     ^
a.cc:17:23: error: 'v' was not declared in this scope
   17 |                 rep(i,v[now].size())
      |                       ^
a.cc:17:17: error: 'rep' was not declared in this scope
   17 |                 rep(i,v[now].size())
      |                 ^~~
a.cc: In function 'int main()':
a.cc:38:7: error: 'i' was not declared in this scope
   38 |   rep(i,m)
      |       ^
a.cc:38:3: error: 'rep' was not declared in this scope
   38 |   rep(i,m)
      |   ^~~
a.cc:61:3: error: 'forn' was not declared in this scope; did you mean 'fork'?
   61 |   forn(i,1,n-1)
      |   ^~~~
      |   fork
Language: C++

#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

vector<int> g[100010];
pair<int, int> gc[100010];
queue<pair<int, int>> q;

int main()
{
    int n, m;
    cin >> n >> m;
    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i, n)
    {
        gc[i] = make_pair(INF, -1);
    }
    gc[0] = make_pair(0, 0);
    bfs(0);
    for(int i : g[0]){
        
        q.push(make_pair(i,0));
    }
    while(!q.empty()){
        pair<int, int> p = q.front();
        q.pop();
        int now = p.first;

        for (int i : g[now])
        {
            if(i==p.second)
                continue;
            if (gc[i].first > gc[now].first + 1)
            {
                gc[i] = make_pair(gc[now].first + 1, now);
                q.push(make_pair(i, now));
            }
        }
    }
    cout << "Yes" << endl;
    rep(i, n - 1)
    {
        cout << gc[i + 1].second + 1 << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:5: error: 'bfs' was not declared in this scope; did you mean 'ffs'?
   38 |     bfs(0);
      |     ^~~
      |     ffs
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<deque>
using namespace std;

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

int N, M;
map<<int, int>, int> mp;
int mark[100000] = {0};
const int INF = 100000000;
int dist[100000];


int main() {
  cin >> N >> M;
  rep(i, N) {
    dist[i] = INF;
  }

  rep(i, M) {
    int x, y;
    cin >> x >> y;
    mp[make_pair(x-1, y-1)] = 1;
    mp[make_pair(y-1, x-1)] = 1;
  }

  dist[0] = 0;
  deque<int> que;
  que.push_back(0);

  mark[0] = 0;

  while(que.size()) {
    int p = que.front();
    que.pop_front();
    for(int i = 0; i < N; i++) {
      if(mp[make_pair(p, i)] == 1 || mp[make_pair(i, p)] == 1) {
        if(dist[i] > dist[p] + 1) {
          // cout << dist[1] << endl;
          dist[i] = dist[p] + 1;
          mark[i] = p + 1;
          que.push_back(i);
        }
       }
      }
    }

  // cout << dist[1] << endl;
  cout << "Yes" << endl;

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



  return 0;
}

Compiler output:
a.cc:16:4: error: expected unqualified-id before '<<' token
   16 | map<<int, int>, int> mp;
      |    ^~
a.cc: In function 'int main()':
a.cc:31:5: error: 'mp' was not declared in this scope
   31 |     mp[make_pair(x-1, y-1)] = 1;
      |     ^~
a.cc:45:10: error: 'mp' was not declared in this scope; did you mean 'p'?
   45 |       if(mp[make_pair(p, i)] == 1 || mp[make_pair(i, p)] == 1) {
      |          ^~
      |          p
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ctime>
#include <set>
#include <sstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <cmath>
#define ll long long
using namespace std;


int n;

int bfs(vector<int> g[n], int i) {
    queue<int> q;
    q.push(0);
    vector<int> vis(n);
    vis[0] = 1;
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int v: g[u]) {
            if (v == i) {
                return u;
            }
            if (!vis[v]) {
                q.push(v);
                vis[v] = 1;
            }
        }
    }
    return -1;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> g[n];
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--;y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    for (int i = 1; i < n; i++) {
        int ans = 1;
        queue<int> q;
        q.push(0);
        vector<int> vis(n);
        vis[0] = 1;
        bool ok = false;
        while (!q.empty()) {
            int u = q.front();
            q.pop();
            for (int v: g[u]) {
                if (v == i) {
                    ans = u;
                    ok = true;
                }
                if (!vis[v]) {
                    q.push(v);
                    vis[v] = 1;
                }
            }
            if (ok) break;
        }
        cout << ans + 1 << "\n";
    }
}


Compiler output:
a.cc:19:23: error: size of array 'g' is not an integral constant-expression
   19 | int bfs(vector<int> g[n], int i) {
      |                       ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<deque>
using namespace std;

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

int N, M;
int a[100000][100000] = {0};
int mark[100000] = {0};
const int INF = 100000000;
int dist[100000];


int main() {
  cin >> N >> M;
  rep(i, N) {
    dist[i] = INF;
  }

  rep(i, M) {
    int x, y;
    cin >> x >> y;
    a[x-1][y-1] = 1;
    a[y-1][x-1] = 1;
  }

  dist[0] = 0;
  deque<int> que;
  que.push_back(0);

  mark[0] = 0;

  while(que.size()) {
    int p = que.front();
    que.pop_front();
    for(int i = 0; i < N; i++) {
      if(a[p][i] == 1) {
        if(dist[i] > dist[p] + 1) {
          // cout << dist[1] << endl;
          dist[i] = dist[p] + 1;
          mark[i] = p + 1;
          que.push_back(i);
        }
       }
      }
    }

  // cout << dist[1] << endl;
  cout << "Yes" << endl;

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



  return 0;
}

Compiler output:
/tmp/ccXRdlfg.o: in function `main':
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccXRdlfg.o
a.cc:(.text+0x12a): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccXRdlfg.o
a.cc:(.text+0x15a): relocation truncated to fit: R_X86_64_PC32 against symbol `mark' defined in .bss section in /tmp/ccXRdlfg.o
a.cc:(.text+0x1d9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccXRdlfg.o
a.cc:(.text+0x1f0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccXRdlfg.o
a.cc:(.text+0x20e): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccXRdlfg.o
a.cc:(.text+0x22b): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccXRdlfg.o
a.cc:(.text+0x24b): relocation truncated to fit: R_X86_64_PC32 against symbol `mark' defined in .bss section in /tmp/ccXRdlfg.o
a.cc:(.text+0x2e9): relocation truncated to fit: R_X86_64_PC32 against symbol `mark' defined in .bss section in /tmp/ccXRdlfg.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <set>
#include <vector>
#include <deque>

using namespace std;

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> defined(N,0);
  vector<set<int> > route(N);

  for(int i=0;i<M;i++){
    int A,B;
    cin >> A >> B;
    route[A-1].insert(B-1);
    route[B-1].insert(A-1);
  }

  deque<int> q;
  q.push_back(0);
  while(q.size()!=0){
    int top = q.front();
    q.pop_front();
    for(int s : route[top]){
      if(defined[s]==0){
        defined[s]=top+1;
        q.push_back(s);
      }
    }
  }
  if(find(defined.begin()+1, defined.end(), 0)==defined.end()){
    cout << "Yes" << endl;
    for(int i=1;i<N;i++) {
      cout << defined[i] << endl;
    }
  }else{
    cout << "No" << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:10: error: no matching function for call to 'find(__gnu_cxx::__normal_iterator<int*, std::vector<int> >, std::vector<int>::iterator, int)'
   33 |   if(find(defined.begin()+1, defined.end(), 0)==defined.end()){
      |      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:33:10: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   33 |   if(find(defined.begin()+1, defined.end(), 0)==defined.end()){
      |      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: Java

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;

public class Main {

    private static final Scanner SCANNER = new Scanner(System.in);

    static int readOneInt() {
        String line = SCANNER.nextLine();
        return Integer.parseInt(line);
    }

    public static void main(String[] args) {

//        int tc = Integer.parseInt(SCANNER.nextLine());
        int tc = 1;
        for (int i = 0; i < tc; ++i) {
            int[] ints = readInts();
            int n = ints[0];
            int m = ints[1];

            Map<Integer, Set<Integer>> g = new HashMap<>();
            for (int j = 0; j < m; ++j) {
                int[] p = readInts();
                g.computeIfAbsent(p[0], k->new HashSet<>()).add(p[1]);
                g.computeIfAbsent(p[1], k->new HashSet<>()).add(p[0]);
            }

            test(n, m, g);
        }
    }

    private static void test(int n, int m, Map<Integer, Set<Integer>> g) {
        if (g.size() < n) {
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
        int[] d = new int[n];
        int[] s = new int[s];
        boolean[] visited = new boolean[n];
        Arrays.fill(d, Integer.MAX_VALUE);
        d[0] = 0;
        PriorityQueue<Integer> q = new PriorityQueue<>();
        q.add(1);
        while (!q.isEmpty()) {
            int roomId = q.poll();
            if (visited[roomId]) continue;
            visited[roomId] = true;

            Set<Integer> adj = g.get(roomId);

            for (int a : adj) {
                if (d[a - 1] > d[roomId - 1]) {
                    d[a - 1] = d[roomId - 1];
                    s[a - 1] = roomId;
                }

                q.add(a);
            }
        }

        for (int i = 1; i < s.length; ++i) {
            System.out.println(s[i]);
        }

    }

    private static int[] readInts() {
        String s = SCANNER.nextLine();
        String[] str = s.split(" ");
        int[] ints = new int[str.length];
        for (int j  = 0; j < str.length; ++j) {
            ints[j] = Integer.parseInt(str[j]);
        }
        return ints;
    }

    private static void test(int a, int b, int h, int m) {
        double full = 2 * Math.PI;

        double ba = full * (m / 60.0);
        double aa = full * (h * 60 + m) / 12.0 / 60.0;

        double ax = a * Math.sin(aa);
        double ay = a * Math.cos(aa);

        double bx = b * Math.sin(ba);
        double by = b * Math.cos(ba);

        double dx = bx - ax;
        double dy = by - ay;

        double d = Math.sqrt(dx*dx + dy*dy);
        System.out.println(d);
    }

}



Compiler output:
Main.java:45: error: incompatible types: int[] cannot be converted to int
        int[] s = new int[s];
                          ^
1 error
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m,u,v;
	cin>>n>>m;
	vector<vector<int>> adj(n+1,vector<int>());
	for(int i=0; i<m; i++)
	{
		cin>>u>>v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	vector<int> par(n+1,-1);
	par[0] = 0;
	par[1] = 0;
	queue<int> q;
	q.push(1);
	while(!q.empty())
	{
		u = q.front();
		q.pop();
		for(auto& v: adj[u])
		{
			if(par[v]==-1)
			{
				par[v] = u;
				q.push(v);
			}
		}
	}
	if(*min_element(par.begin(), par.end())==-1)
		cout<<"No\n";
	else{
		cout<<"Yes\n";
		for(int i=2; i<=n; i++)
			cout<<par[i]<<"\n";
	}
}

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