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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
int visited[200005],high[200005];
typedef struct ANode{
    long long adjvex;                 
    struct ANode *nextarc;                  
} ArcNode;                      
typedef struct Vnode{               
    int count;                  
    ArcNode *firstarc;          
}VNode;                     
typedef struct node{
    VNode adjlist[100005]; 
}AdjGraph;
void add(AdjGraph *G,ll u,ll v){
    ArcNode *p;
    p=(ArcNode *)malloc(sizeof(ArcNode));
    p->adjvex=v;
    p->nextarc=G->adjlist[u].firstarc;  
    G->adjlist[u].firstarc=p;
    p=(ArcNode *)malloc(sizeof(ArcNode));
    p->adjvex=u;
    p->nextarc=G->adjlist[v].firstarc;  
    G->adjlist[v].firstarc=p;
}
void BFS(AdjGraph *G){
    ll w,i,;
    ArcNode *p;
    queue<long long> qu;                                                                        
    for (i=1;i<=n;i++) visited[i]=0;                              
    visited[1]=1;                       
    qu.push(1);
    while(qu.size()){ 
        w=qu.front();
        qu.pop();                    
        p=G->adjlist[w].firstarc;            
        while (p!=NULL){    
            if (visited[p->adjvex]==0){     
                visited[p->adjvex]=1;
                high[p->adjvex]=w;       
                qu.push(p->adjvex);      
            }
            p=p->nextarc;                    
        }
        
    }
}
int main(){
    ll a,b,m;
    AdjGraph *G;
    G=(AdjGraph *)malloc(sizeof(AdjGraph));
    cin>>n>>m;
    for(ll i=1;i<=m;i++){
        cin>>a>>b;
        add(G,a,b);
	}
    for(ll i=1;i<=n;i++)
        high[i]=0;
    BFS(G);
    for(ll i=1;i<=n;i++)
        if(!visited[i]){
            cout<<"No"<<endl;
            return 0;
        }
    cout<<"Yes"<<endl;
    for(ll i=2;i<=n;i++){
        cout<<high[i]<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'void BFS(AdjGraph*)':
a.cc:29:12: error: expected unqualified-id before ';' token
   29 |     ll w,i,;
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
  
int n,m;
vector<vector<int>> G;

void solve(){
    vector<int> dist(n,-1);
    vector<int> prev(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]
                prev[nv] = v;
                que.push(nv);
            }
        }

    }

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



}

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

    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);
    }

    solve();


}

Compiler output:
a.cc: In function 'void solve()':
a.cc:35:35: error: expected ';' before 'prev'
   35 |                 dist[nv] = dist[v]
      |                                   ^
      |                                   ;
   36 |                 prev[nv] = v;
      |                 ~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n,m;
  cin >> n >> m;
  vector<vector<int>> graph(n,vector<int>(0));
  int a,b;
  REP(i,m){
    cin >> a>> b;
    a--;
    b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  vector<int> prev(n,-1);
  
  queue<int> queue;
  prev[0] = 0;
  queue.push(0);
  int now;
  while(!queue.empty()){
    now = queue.front();
    queue.pop();
    for(auto p : graph[now]){
      if(prev[p]==-1){
        prev[p] = now;
        queue.push(p);
      }
    }
  }
  REP(i,n){
    if(prev[i]==-1){
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;
  FOR(i,1,n){
    cout << prev[i]+1 << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:7: error: return-statement with no value, in function returning 'int' [-fpermissive]
   53 |       return;
      |       ^~~~~~
Language: C++

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

int main() {
  int n,m; cin>>n>>m;
  graph v(n+1);
  int a,b;
  rep(i,m){
    cin>>a>>b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  vector<int> vec(n+1,0);
  set<int> s{1};
  rep(i,n){
    if(i==0){continue;}
    set<int>s_=s;
    s.clear();
    for(int j:s_){ 
      for(int k:v[j]){
        if(vec[k]==0){
          vec[k]=j;
          s.insert(k);
        }
      }
    }
  } 
  if(count(vec.begin()+2,vec.end(),0)!=0){
    cout<<"No";
  }
  else{
    cout<<"Yes"<<endl;
    rep(i,n+1){
      if(i<=1){continue;}
      cout<<vec[i]<<endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:22: error: 'll' was not declared in this scope
    3 | #define rep(i,n) for(ll i=0; i<(ll)(n); i++)
      |                      ^~
a.cc:10:3: note: in expansion of macro 'rep'
   10 |   rep(i,m){
      |   ^~~
a.cc:10:7: error: 'i' was not declared in this scope
   10 |   rep(i,m){
      |       ^
a.cc:3:30: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(ll i=0; i<(ll)(n); i++)
      |                              ^
a.cc:3:22: error: 'll' was not declared in this scope
    3 | #define rep(i,n) for(ll i=0; i<(ll)(n); i++)
      |                      ^~
a.cc:17:3: note: in expansion of macro 'rep'
   17 |   rep(i,n){
      |   ^~~
a.cc:17:7: error: 'i' was not declared in this scope
   17 |   rep(i,n){
      |       ^
a.cc:3:30: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(ll i=0; i<(ll)(n); i++)
      |                              ^
a.cc:3:22: error: 'll' was not declared in this scope
    3 | #define rep(i,n) for(ll i=0; i<(ll)(n); i++)
      |                      ^~
a.cc:35:5: note: in expansion of macro 'rep'
   35 |     rep(i,n+1){
      |     ^~~
a.cc:35:9: error: 'i' was not declared in this scope
   35 |     rep(i,n+1){
      |         ^
a.cc:3:30: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(ll i=0; i<(ll)(n); i++)
      |                              ^
Language: C++

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dsync std::ios::sync_with_stdio(false); std::cin.tie(NULL);
#define pb push_back
#define mp make_pair
typedef long long ll;

//#define foi(a, b) for (LL i = a; a < b ? i < b : b > i; a < b ? i++ : i--)
//#define foj(a, b) for (LL j = a; a < b ? j < b : b > j; a < b ? j++ : j--)

using namespace std;

int main()
{
   dysnc;
   int node, edge;
   cin >> node >> edge;
   vector<vector<int>> adj(node + 1);
   for (int i = 1; i <= edge; i++)
   {
      int a, b;
      cin >> a >> b;
      adj[a].pb(b);
      adj[b].pb(a);
   }

   queue<int> q;
   vector<bool> visited(node + 1, false);
   vector<int> distance(node + 1, 0);

   visited[1] = true;
   distance[1] = 0;
   q.push(1);

   while (!q.empty())
   {
      int s = q.front();
      q.pop();

      for (auto u : adj[s])
      {
         if (visited[u])
            continue;

         visited[u] = true;
         distance[u] = s;
         q.push(u);
      }
   }
   for (int x = 2; x <= node; x++)
   {
      if (distance[x] == 0)
      {
         cout << "No" << endl;
         return 0;
      }
   }
   cout << "Yes" << endl;
   for (int x = 2; x <= node; x++)
   {
      cout << distance[x] << endl;
   }
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:4: error: 'dysnc' was not declared in this scope; did you mean 'dsync'?
   15 |    dysnc;
      |    ^~~~~
      |    dsync
Language: C++

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
// #define int long long
// #define pow mypow

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9+5;
const int MOD = 1e9+7;

int n, m;
vector<int> g[N];
int p[N];
int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n >> m;
	while(m--) {
		int u, v; cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	queue<int> q;
	q.push(1);
	while(!q.empty()){
		int v = q.front(); q.pop();
		for(auto u:g[v]){
			if (p[u]) continue;
			p[u] = v;
			q.push(u);
		}
	}
	for(int i=2; i<=n; i++) 
		if (p[i] == 0) {
			cout << "No" << endl;
			return 0;
		}

	cout < "Yes" << endl;
	for(int i=2; i<=n; i++) cout << p[i] << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:52:22: error: invalid operands of types 'const char [4]' and 'char' to binary 'operator<<'
   52 |         cout < "Yes" << endl;
      |                ~~~~~ ^~
      |                |
      |                const char [4]
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
const int INF_INT = 2147483647;
const long long INF_LONG = 9223372036854775807;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


void bfs(vector<vector<int>> &v, vector<int> &w) {
  queue<int> que;

  for (int x : v[0]) {
    que.push(x);
    w[x] = 0;
  }
  while (!que.empty()) {
    int x = que.front();  que.pop();
    for (int y : v[x]) {
      if (w[y] == -1) {
        que.push(y);
        w[y] = x;
      }
    }
  }
}

     
int main() {
  int n, m;  cin >> n >> m;
  vector<vector<int>> v(n ,vector<int>(0));
  vector<int> w(n, -1);
  rep (i, m) {
    int x, y;  cin >> x >> y;
    v[x-1].push_back(y-1);
    v[y-1].push_back(x-1);
  }

  bfs(v, w);

  int flag=0;
  rep (i, n) {
    if (w[i] == -1) {
      flag = 1;
      break;
    }
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:53:4: error: expected '}' at end of input
   53 |   }
      |    ^
a.cc:29:12: note: to match this '{'
   29 | int main() {
      |            ^
Language: C++

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
typedef long long LL;

//#define foi(a, b) for (LL i = a; a < b ? i < b : b > i; a < b ? i++ : i--)
//#define foj(a, b) for (LL j = a; a < b ? j < b : b > j; a < b ? j++ : j--)

using namespace std;

LL main()
{
   LL node, edge;
   cin >> node >> edge;
   vector<vector<LL>> adj(node+1);
   for (LL i = 1; i <= edge; i++)
   {
      LL a, b;
      cin >> a >> b;
      adj[a].pb(b);
      adj[b].pb(a);
   }

   queue<LL> q;
   vector<bool> visited(node+1,false);
   vector<LL> distance(node+1,0);

   visited[1] = true;
   distance[1] = 0;
   q.push(1);

   while (!q.empty())
   {
      LL s = q.front();
      q.pop();

      // process node s
      for (auto u : adj[s])
      {
         if (visited[u]) continue;
         
         visited[u] = true;
         distance[u] = s;
         q.push(u);
      }
   }
   for (LL x = 2; x <= node; x++)
   {
      if (distance[x] == 0)
      {
         cout << "No" << endl;
         exit(0);
      }
      
   }
   cout << "Yes" << endl;
   for (LL x = 2; x <= node; x++)
   {
      cout << distance[x] << endl;
   }
   return 0;
}


Compiler output:
a.cc:12:1: error: '::main' must return 'int'
   12 | LL main()
      | ^~
Language: C++

#include <bits/stdc++.h>
#include<iterator>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;
const int N = 2e5 + 5;
int n, m;
int vis[N], dist[N], ways[N], ans[N];
vector<int> g[N];
void bfs(int k){
	queue<int> q;
	queue.push(k);
	while(!q.empty()){
		int curr=q.front();
		q.pop();
		for(auto it:g[curr]){
			if(!vis[it]){
				dist[it]=dist[curr]+1;
				ans[it]=curr;
				vis[it]=1;
				q.push(it);
			}
		}
	}
	for(int i=0;i<n;i++)
	if(!vis[i])
{
		cout<<"No";
	exit(0);}
}
int main(){
	IOS;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int u,v;
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
		
	}
	bfs(1);
	cout << "Yes" << endl;
	for(int i = 2; i <= n; i++)
		cout << ans[i] << endl;
	
}

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

#include <bits/stdc++.h>
#include<iterator>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;
const int N = 2e5 + 5;
int n, m;
int vis[N], dist[N], ways[N], ans[N];
vector<int> g[N];
void bfs(int k){
	queue<int> q;
	queue.push(q);
	while(!q.empty()){
		int curr=q.front();
		q.pop();
		for(auto it:g[curr]){
			if(!vis[it]){
				dist[it]=dist[curr]+1;
				ans[it]=curr;
				vis[it]=1;
				q.push(it);
			}
		}
	}
	for(int i=0;i<n;i++)
	if(!vis[i])
{
		cout<<"No";
	exit(0);}
}
int main(){
	IOS;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int u,v;
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
		
	}
	bfs(1);
	cout << "Yes" << endl;
	for(int i = 2; i <= n; i++)
		cout << ans[i] << endl;
	
}

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

#include<iostream>
using namespace std;

struct roomroad{
	int leftroom;
	int rightroom;
};

struct roomans{
	int roomno;
	int ans;
}


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

	struct roomroad rm[200000] = {};
	struct roomans  ra[100000] = {};
	int roomcount


	for(int i = 0; i < M; ++i){
		cin >> rm[i].leftroom >> rm[i].rightroom;
	}

	for(int j = 2; j <= N; ++j){
		ra[j-2].roomno = j;
	}

	for(int k = 0; k < M; ++k){
		if(rm[k].leftroom == 1 ||
		   rm[k].rightroom == 1){
			   cout << "YES" << endl;
			   break;
		}else{
			cout << "NO" << endl;
			break;
		}
	}

	for(int l = 0; l < M; ++l){
		if(rm[l].leftroom == 1){
			ra[rm[l].leftroom-1].roomno = rm[l].leftroom-1;

		}

	}

}

Compiler output:
a.cc:12:2: error: expected ';' after struct definition
   12 | }
      |  ^
      |  ;
a.cc: In function 'int main()':
a.cc:24:9: error: expected initializer before 'for'
   24 |         for(int i = 0; i < M; ++i){
      |         ^~~
a.cc:24:24: error: 'i' was not declared in this scope
   24 |         for(int i = 0; i < M; ++i){
      |                        ^
Language: C++

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

int main()
{
    int n, m;
    std::cin >> n >> m;
    std::vector<std::vector<int>> edges(n);

    int f, t;
    while (std::cin >> f >> t)
    {
        edges[f-1].emplace_back(t-1);
        edges[t-1].emplace_back(f-1);
    }

    std::vector<int> result(n, -1);
    std::queue<int> q = {};
    q.push(0);
    result[0] = 1;

    while (!q.empty())
    {
        int index = q.front();
        q.pop();
        
        const auto& ts = edges[index];
        for (const int t : ts)
        {
            if (result[t] != -1)
                continue;

            result[t] = index;
            q.push(t);
        }
    }

    if (std::all_of(std::cbegin(result), std::cend(result), [](const int r) { return r != -1; }))
    {
        std::cout << "Yes" << std::endl;
        for (std::size_t index = 1; index < result.size(); ++index)
        {
            std::cout << result[index] + 1 << std::endl;
        }
    }
    else
    {
        std::cout << "No" << std::endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:14: error: 'all_of' is not a member of 'std'
   39 |     if (std::all_of(std::cbegin(result), std::cend(result), [](const int r) { return r != -1; }))
      |              ^~~~~~
Language: C

#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2")
typedef long long ll;

const int N = 100005;
const int inf = 0x7ffffff;
ll n, d[N], sign[N];
bool vis[N];
vector<int> e[N << 1];

void spfa()
{
	queue<int> q;
	for (int i = 1; i <= n; i++) d[i] = inf;
	q.push(1);
	vis[1] = 1;
	d[1] = 0;
	while (!q.empty())
	{
		int t = q.front();
		q.pop();
		vis[t] = 0;
		for (auto i:e[t])
		{
			if (d[i] > d[t] + 1)
			{
				d[i] = d[u] + 1;
				sign[i] = t;
				if (!vis[i]) q.push(i), vis[i] = 1;
			}
		}
	}
	bool check = 1;
	for (int i = 2; i <= n; i++)
		if (d[i] == inf)
		{
			check = 0;
			break;
		}
	if (!check) cout << "No\n";
	else
	{
		cout << "Yes\n";
		for (int i = 2; i <= n; i++)
			cout << sign[i] << endl;
	}
}

int main()
{
	ios::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 1, u, v; i <= m; i++)
    {
    	cin >> u >> v;
    	e[u].push_back(v);
    	e[v].push_back(u);
	}
	spfa();
	return 0;
}

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

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

int main(){
   long long N,M;
   cin>>N>>M;
   bool x[N][N];
   for(long i=0; i<N; i++)
       for(long j=0; j<N; j++){
           x[i][j] = false;
       }
   }
   for(int i=0; i<M; i++){
       long long A,B;
       cin>>A>>B;
   }
}


Compiler output:
a.cc:14:4: error: expected unqualified-id before 'for'
   14 |    for(int i=0; i<M; i++){
      |    ^~~
a.cc:14:17: error: 'i' does not name a type
   14 |    for(int i=0; i<M; i++){
      |                 ^
a.cc:14:22: error: 'i' does not name a type
   14 |    for(int i=0; i<M; i++){
      |                      ^
a.cc:18:1: error: expected declaration before '}' token
   18 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  vector<vector<int>> G(N,vector<int>());
  for(int i=0;i<M;i++){
    cin>>a>>b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push/back(a);
  }
  
  queue<int> seen;
  int dist[N];
  bool judge[N];
  for(int i=0;i<N;i++){
    dist[i]=0;
    judge[i]=false;
  }
  
  judge[0]=true;
  seen.push(0);
  int ct=0;
  
  while(!(seen.empty()||ct==N)){
    int S=seen.front();
    for(int i=0;i<G.at(S).size();i++){
      int nv=G.at(S).at(i);
      if(judge[nv]){
        continue;
      }
      dist[nv]=S;
      seen.push(nv);
      judge[nv]=true;
    }
    seen.pop();
    ct++;
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<N;i++){
    cout<<dist[i]<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'a' was not declared in this scope
    8 |     cin>>a>>b;
      |          ^
a.cc:8:13: error: 'b' was not declared in this scope
    8 |     cin>>a>>b;
      |             ^
a.cc:12:15: error: 'back' was not declared in this scope
   12 |     G[b].push/back(a);
      |               ^~~~
Language: C++

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

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

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

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

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

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

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

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

    // 結果出力 (各頂点の頂点 0 からの距離を見る)
  cout<<"Yes"<<endl;
  for(int v=1;v<N;i++){
    cout<<dist[v]<<endl;
  }
}

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

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> root(n);
    int a,b;
    REP(i,m){
        cin >> a >> b;
        --a;--b;
        root[a].push_back(b);
        root[b].push_back(a);
    }
    //橋が存在＝（道が一個しかないところ（小島））から1回転移して、
    //その時の転移した島が,転移する前の島とそのほかの島1つに転移できる場合
    //その島は橋を形成している。
    
    queue<int> que;
    set<int> counted;
    int count = 0;
    REP(i,n){
        if(root[i].size()==1){
            count++;
            que.push(root[i][0]);
            counted.push_back(i);
        }
    }
    while(!que.empty()){
        int num = que.front();
        que.pop();
        for(int x:room[num]){
            for(auto y:counted){
                if(x==y)
            }
        }
    }
    COUT(count);
    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<iostream>


using namespace std;

#define maxn 1e5 + 2

int cave[maxn][maxn];
int sign[maxn];
int times = 0;

void get_connect(const int& th, const int& n)
{
	for(int i = 1; i < n; ++i)
	{
		if(cave[th][i] == 1 && sign[i] == 0)
		{
			sign[i] = th;
			times++;
		}
	}
	for(int i = 1; i < n; ++i)
	{
		if(sign[i] == th)
		{
			get_connect(i,n);
		}
	}
}

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	if(m < n - 1)
		printf("No\n");
	else
	{
		int x, y;
		for(int i = 0; i < m; ++i)
		{
			scanf("%d %d", &x, &y);
			cave[x][y] = 1;
			cave[y][x] = 1;
		}
		get_connect(1, n);
		if(times == n - 1)
		{
			printf("Yes\n");
			for(int i = 1; i < n; ++i)
			{
				printf("%d\n", sign[i]);
			}
		}
		else
		{
			printf("No\n");
		}
	}
	return 0;
}

Compiler output:
a.cc:6:18: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | #define maxn 1e5 + 2
      |              ~~~~^~~
a.cc:8:16: note: in expansion of macro 'maxn'
    8 | int cave[maxn][maxn];
      |                ^~~~
a.cc:6:18: error: could not convert '(1.0e+5 + (double)2)' from 'double' to 'long unsigned int'
    6 | #define maxn 1e5 + 2
      |              ~~~~^~~
      |                  |
      |                  double
a.cc:8:16: note: in expansion of macro 'maxn'
    8 | int cave[maxn][maxn];
      |                ^~~~
a.cc:6:18: error: size of array 'cave' has non-integral type 'double'
    6 | #define maxn 1e5 + 2
      |              ~~~~^~~
a.cc:8:16: note: in expansion of macro 'maxn'
    8 | int cave[maxn][maxn];
      |                ^~~~
a.cc:6:18: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | #define maxn 1e5 + 2
      |              ~~~~^~~
a.cc:8:10: note: in expansion of macro 'maxn'
    8 | int cave[maxn][maxn];
      |          ^~~~
a.cc:6:18: error: could not convert '(1.0e+5 + (double)2)' from 'double' to 'long unsigned int'
    6 | #define maxn 1e5 + 2
      |              ~~~~^~~
      |                  |
      |                  double
a.cc:8:10: note: in expansion of macro 'maxn'
    8 | int cave[maxn][maxn];
      |          ^~~~
a.cc:6:18: error: size of array 'cave' has non-integral type 'double'
    6 | #define maxn 1e5 + 2
      |              ~~~~^~~
a.cc:8:10: note: in expansion of macro 'maxn'
    8 | int cave[maxn][maxn];
      |          ^~~~
a.cc:6:18: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | #define maxn 1e5 + 2
      |              ~~~~^~~
a.cc:9:10: note: in expansion of macro 'maxn'
    9 | int sign[maxn];
      |          ^~~~
a.cc:6:18: error: could not convert '(1.0e+5 + (double)2)' from 'double' to 'long unsigned int'
    6 | #define maxn 1e5 + 2
      |              ~~~~^~~
      |                  |
      |                  double
a.cc:9:10: note: in expansion of macro 'maxn'
    9 | int sign[maxn];
      |          ^~~~
a.cc:6:18: error: size of array 'sign' has non-integral type 'double'
    6 | #define maxn 1e5 + 2
      |              ~~~~^~~
a.cc:9:10: note: in expansion of macro 'maxn'
    9 | int sign[maxn];
      |          ^~~~
Language: C++

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

constexpr int inf = 2147483647;
constexpr int64_t inf64 = 9223372036854775807;
constexpr int mod = 1e9+7;

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

  int n, m;
  cin >> n >> m;

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

  queue<int> que;
  vector<int> dist(n, -1);
  vector<int> res(n-1);
  dist[0] = 0;
  que.push(0);

  while(!que.empty()) {
    int v = que.front();
    que.pop();
    for(int nv : Graph[v]) {
      if(dist[nv] != -1) continue;
      dist[nv] = dist[v]+1;
      res[nv-1] = v+1r;
      que.push(nv);
    }
  }

  cout << "Yes" << endl;
  rep(i,n-1) cout << res[i] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:96:21: error: fixed-point types not supported in C++
   96 |       res[nv-1] = v+1r;
      |                     ^~
Language: C++

#include <bits/stdc++.h>
#define int long long
#define L_T_S_K ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std; 

const int N = 1e6 + 7;
 
vector <int> v[N];
int par[N];
int n , m;
bool visit[N]; 
int32_t main(){
    L_T_S_K;
    cin >> n >> m;

    for(int i = 0 ; i < m ; i++){
        int x , y;
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }

    set <int> s;

    queue <int> Q;
    Q.push(1);
    par[1] = 1;
    visit[1] = 1;
    while(Q.size() > 0){
        auto it = Q.front();
        Q.pop();
        s.insert(it);
        for(auto x : v[it]){
            if(visit[x] == 0){
                Q.push(x);
                visit[x] = 1;
                par[x] = it;
            }
        }
    }

    if(s.size() != n) {cout << "No\n" ; return 0;}
    cout << "Yes\n";
    for(int i = 2 ; i <= n ; i++){
        cout << par[i] << "\n";
    }

    return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:28:5: error: reference to 'visit' is ambiguous
   28 |     visit[1] = 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:11:6: note:                 'bool visit [1000007]'
   11 | bool visit[N];
      |      ^~~~~
a.cc:34:16: error: reference to 'visit' is ambiguous
   34 |             if(visit[x] == 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:11:6: note:                 'bool visit [1000007]'
   11 | bool visit[N];
      |      ^~~~~
a.cc:36:17: error: reference to 'visit' is ambiguous
   36 |                 visit[x] = 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:11:6: note:                 'bool visit [1000007]'
   11 | bool visit[N];
      |      ^~~~~
Language: C++

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

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

using namespace std;
using Graph = vector<vector<int>>;

bool dbg = false;

int main(void){
    int N, M; cin >> N >> M;
    Graph G(N);
    vector<int> next(N);
    bool avail= true;

    rep(i, M){
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<int> dist(N, -1);
    queue<int> que;
    dist[0] = 0;
    que.push(0);

    while(!que.empty()){
        int v = que.front();
        que.pop();

        for(int nv:G[v]){
            if(dist[nv] != -1) continue;
            dist[nv] = dist[v] + 1;
            que.push(nv);
            next[nv] = v;
        }
    }

    rep(i,N){
        if(dist[i] == -1) avail = false;
    }

    if(avail){
        cout << "Yes" << endl;
        rep(i, N){
            if(i==0) continue
            cout << next[i]+1 << endl;
        }
    }else{
        cout << "No" << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:30: error: expected ';' before 'cout'
   51 |             if(i==0) continue
      |                              ^
      |                              ;
   52 |             cout << next[i]+1 << endl;
      |             ~~~~
Language: C

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

int main() {
    int N, M;
    cin >> N >> M;
    Graph G(N);
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        G[a-1].push_back(b);
        G[b-1].push_back(a);
    }
    vector<int> sign(N, -1);
    queue<int> que;

    sign[0] = 0;
    que.push(1);

    while(!que.empty()) {
        int v = que.front();
        que.pop();

        for (auto nv : G[v-1]) {
            if (sign[nv-1] != -1) continue;

            sign[nv-1] = v;
            que.push(nv);
        }
    }
    rep(i, N) {
        if (sign[i] == -1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i = 1; i < N; i++) cout << sign[i] << 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++

// by Balloons
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1e9;
const int maxn=2e5+5; 

int n,m;
struct edges{
	int to,nxt;
}ed[maxn << 1];
int head[maxn],ecnt=0;
int dis[maxn],pre[maxn];
struct ee{
	int to,dis;
	bool operator<(ee b) const {
		return dis<b.dis;
	}
};
priority_queue<ee>pq;

void add(int x,int y){
	ed[++ ecnt].to=y;ed[ecnt].nxt=head[x];head[x]=ecnt;
}

void dij(){
	memset(dis,127,sizeof dis);
	pq.push((ee){1,0});
	dis[1] = 0;vis[1]=1;
	while(!pq.empty()){
		ee u = pq.top();pq.pop();
		for(int i=head[u.to];~i;i=ed[i].nxt){
			int v=ed[i].to;
			if(dis[v] > dis[u.to] + 1){
				dis[v] = dis[u.to] + 1;
				pq.push((ee){v,dis[v]});
				pre[v] = u.to;
			}
		}
	}
//	for(int i=1;i<=n;i++)printf("%d ",dis[i]);puts("");
}

signed main(){
	memset(head,-1,sizeof head);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int x,y;scanf("%d%d",&x,&y);
		add(x,y);add(y,x);
	}
	dij();
	int imp = dis[0];
	for(int i=1;i<=n;i++)if(dis[i] == imp)return puts("No"), 0;
	puts("Yes");for(int i=2;i<=n;i++)printf("%d\n",pre[i]);
/*
有n个点，给m个两点之间得关系，问是否每个点都能到1，是输出“Yes”，并且输出每个点到1得最短路上得前一个点，否则输出“No”。
6 5
1 2
2 3
2 4
4 5
2 6
*/
	return 0;
}



Compiler output:
a.cc: In function 'void dij()':
a.cc:40:20: error: 'vis' was not declared in this scope; did you mean 'dis'?
   40 |         dis[1] = 0;vis[1]=1;
      |                    ^~~
      |                    dis
Language: C

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<vector>
using namespace std;

int num[10005];

void debugout ( long long value ){
    cout << value  << endl;
}


int main(){

    long double hourLength, minuteLength, hour, minute;
    cin >> hourLength >> minuteLength >> hour >> minute;

    long double PI = 3.141592653589793238462;

    long double theta = 2*PI*( hour/12.0 + minute/720.0 - minute/60.0);

    double length = ( hourLength*hourLength + minuteLength*minuteLength )
            - (long double)2.0 * hourLength * minuteLength * cos(theta);

    printf("%10.10lf", sqrt(length));
    return 0;
}





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

#include <iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<vector>
using namespace std;

int num[10005];

void debugout ( long long value ){
    cout << value  << endl;
}


int main(){

    long double hourLength, minuteLength, hour, minute;
    cin >> hourLength >> minuteLength >> hour >> minute;

    long double PI = 3.141592653589793238462;

    long double theta = 2*PI*( hour/12.0 + minute/720.0 - minute/60.0);

    double length = ( hourLength*hourLength + minuteLength*minuteLength )
            - (long double)2.0 * hourLength * minuteLength * cos(theta);

    printf("%10.10lf", sqrt(length));
    return 0;
}





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;
#define ll long long
#define Pi 3.14159265358979323846264338327950L

vector<int> edges[200005];
vector<int> dis(n+1,1e10);

bool bfs(int n, int m)
{
    queue<int> q;
    q.push(1);
    dis[1]=0;
    vector<int> vis(n+1,0);
    vis[1]=1;
    int visit=1;
    while(!q.empty())
    {
        int i=q.front();
        q.pop();
        for(auto j:edges[i])
        {
            if(vis[j]==0)
            {
                visit++;
                vis[j]=1;
                dis[j]=i;
                q.push(j);
            }
        }
    }
    if(visit==n) return true;
    return false;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin >> t;
    while(t--){
        int n,m;
        cin>>n>>m;
        for(int i=0;i<m;i++)
        {
            int a,b;
            cin>>a>>b;
            edges[a].push_back(b);
            edges[b].push_back(a);
        }
        bool flag=bfs(n,m);
        if(!flag) cout<<"NO\n";
        else
        {
            cout<<"Yes\n";
            for(int i=2;i<=n;i++)
                cout<<dis[i]<<endl;
        }

}
return 0;

}


Compiler output:
a.cc:7:17: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 | vector<int> dis(n+1,1e10);
      |                 ^
      |                 yn
Language: C++

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

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

int main()
{
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        t[a].push_back(b);
        t[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 p: to[v]) {
            if (dist[p] != INF)continue;
            dist[p] = dist[v] + 1;
            pre[p] = v;
            q.push(p);
        }
    }
    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:31:21: error: 'to' was not declared in this scope; did you mean 'tm'?
   31 |         for (int p: to[v]) {
      |                     ^~
      |                     tm
Language: C

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
ll h,w;
ll ans=0;
int field[105][105]={0};
bool used[105][105];
int ex[6] = {-1,0,-1,1,-1,0};
int ey[6] = {-1,-1,0,0,1,1};
int ox[6] = {0,1,-1,1,1,0};
int oy[6] = {-1,-1,0,0,1,1};

int main() {
  int n,m;
  cin >> n >> m;
  vvi root(n);
  REP(i,m) {
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    root[a].push_back(b);
    root[b].push_back(a);
  }
  vi mejirushi(n,-1);
  qi que;
  que.push(0);
  mejirushi[0]=0;
  int cnt=0;
  while(!que.empty()) {
    int now= que.front();
    que.pop();
    for(auto i:root[now]) {
      if(mejirushi[i]!=-1) continue;
      mejirushi[i]=now+1;
      que.push(i);
      cnt++;
    }
  }
  if(cnt==n-1) {
    cout << "Yes" << endl;
    REP1(i,n-1) {
      cout << mejirushi[i] << endl;
    } 
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000007
using Graph = vector<vector<int>>;
vector<bool>seen;
vector<int>dist;

void dfs(Graph &G,int i){
  seen[i]=true;
  rep(j,G[i].size){
    if(seen[G[i][j]]==false){
      seen[G[i][j]]=true;
      dist[G[i][j]]=dist[i]+1;
      dfs(G,G[i][j]);
    }
  }
}
int main (){
  int N,M;
  cin>>N>>M;
  Graph G(N);
  rep(i,M){
    int a,b;
    cin>>a>>b;
    G[a-1].push_back(b-1);
    G[b-1].push_back(a-1);
  }
  seen.assign(N,false);
  dist.resize(N);
  dfs(G,0);
  cout<<"Yes"<<endl;
  rep(i,N){
    cout<<dist[i]<<endl;
  }
}


Compiler output:
a.cc: In function 'void dfs(Graph&, int)':
a.cc:11:14: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   11 |   rep(j,G[i].size){
      |              ^
a.cc:3:45: note: in definition of macro 'rep'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
Language: C++

/*
https://qiita.com/drken/items/996d80bcae64649a6580
DST : 幅優先探索
*/

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

using namespace std;
using Graph = vector<vector<int>>;

int main(void){
    int N,M;
    cin>>N>>M;
    int A[M],B[M];
  
    Graph G(N);

    for(int i=0;i<M;i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    vector<int> dist(N,-1); //スタート頂点から頂点vまでのステップ数
    queue<int> que;         //その時点での発見済みかつ未到達の点

    dist[0]=0;
    que.push(0);

    while(!que.empty()){
        int v = que.front(); //一番はじめにqueingされた要素
        que.pop();
        for(int nv:G[v]){
            if(dist[nv] != -1) continue;
            dist[nv] = dist[v]+1;
            que.push(nv);
        }
    }
    for (int v = 1; v < N; ++v) cout << v << ": " << dist[v] << endl;


    }
    return 0;
}

Compiler output:
a.cc:48:5: error: expected unqualified-id before 'return'
   48 |     return 0;
      |     ^~~~~~
a.cc:49:1: error: expected declaration before '}' token
   49 | }
      | ^
Language: C++

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

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	
	vector<vector<int>> roots(n);
	for (int i = 0; i < m; ++i) {
		int a, b;
		cin >> a >> b;
		roots[a - 1].push_back(b - 1);
		roots[b - 1].push_back(a - 1);
	}
	
	vector<int> sign(n, -1);
	queue<int> que;
	
	sign[0] = 0;
	que.push(0);
	
	while (!que.empty()) {
		auto cur = que.front();
		que.pop();
		
		for (auto && root : roots[cur]) {
			if (sign[root] != -1)
				continue;
			
			que.push(root);
			sign[root] = cur;
		}
	}
	
	if (count(sign.begin(), sign.end(), -1))
		cout << "No" << endl;
	else {
		cout << "Yes" << endl;
		
		for (int i = 1; i < n; ++i)
			cout << sign[i] + 1 << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:13: error: 'count' was not declared in this scope
   38 |         if (count(sign.begin(), sign.end(), -1))
      |             ^~~~~
Language: C++

#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int main(){
  int n,m,a,b;
  cin>>n>>m;
  int to[100005];
  for(int i=0;i<m;i++){
    cin>>a>>b;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  queue<int> q;
  vecotr<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=0;u<n;v++){
      if(dist[u]!=100005) continue;
      dist[u]=dist[v]+1;
      pre[u]=v;
      q.push(u);
    }
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<n;i++){
    int ans=pre[i];
    ans++;
    cout<<ans<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: request for member 'push_back' in 'to[a]', which is of non-class type 'int'
   13 |     to[a].push_back(b);
      |           ^~~~~~~~~
a.cc:14:11: error: request for member 'push_back' in 'to[b]', which is of non-class type 'int'
   14 |     to[b].push_back(a);
      |           ^~~~~~~~~
a.cc:17:3: error: 'vecotr' was not declared in this scope
   17 |   vecotr<int> dist(n,inf);
      |   ^~~~~~
a.cc:17:10: error: expected primary-expression before 'int'
   17 |   vecotr<int> dist(n,inf);
      |          ^~~
a.cc:19:3: error: 'dist' was not declared in this scope
   19 |   dist[0]=0;
      |   ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int main(){
  int n,m,a,b;
  cin>>n>>m;
  vector<int> to(100005);
  for(int i=0;i<m;i++){
    cin>>a>>b;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  queue<int> q;
  vecotr<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=0;u<n;v++){
      if(dist[u]!=100005) continue;
      dist[u]=dist[v]+1;
      pre[u]=v;
      q.push(u);
    }
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<n;i++){
    int ans=pre[i];
    ans++;
    cout<<ans<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13: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'}
   13 |     to[a].push_back(b);
      |           ^~~~~~~~~
a.cc:14: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'}
   14 |     to[b].push_back(a);
      |           ^~~~~~~~~
a.cc:17:3: error: 'vecotr' was not declared in this scope
   17 |   vecotr<int> dist(n,inf);
      |   ^~~~~~
a.cc:17:10: error: expected primary-expression before 'int'
   17 |   vecotr<int> dist(n,inf);
      |          ^~~
a.cc:19:3: error: 'dist' was not declared in this scope
   19 |   dist[0]=0;
      |   ^~~~
Language: C++

/*
AtCoderBeginnerContest168
Problem D - .. (Double Dots) / Double Dots
Time Limit: 2 sec / Memory Limit: 1024 MB
Score: 400 points
*/

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

std::vector< std::vector<int> > conns;
std::vector<int> signs;
std::queue<int> q;

int main()
{
    int N, M;
    std::cin >> N >> M;
    for (int i=0; i<=N; i++) { conns.push_back(std::vector<int>()); }
//std::cerr << "size of conns: " << conns.size() << "\n";

    int A, B;
    for (int i=0; i<M; i++)
    {
        std::cin >> A >> B;
        conns[A].push_back(B);
        conns[B].push_back(A);
    }

    for (int i=0; i<=N; i++) { signs.push_back(-1); }

    q.push(1);
    while(!q.empty())
    {
        int curr = q.front();
        q.pop();
//not needed, but gives exact match to sample output and shouldn't kill the timing
std::sort(conns[curr].begin(), conns[curr].end());
        for (int i=0; i<conns[curr].size(); i++)
        {
            int next = conns[curr][i];
            if (signs[next]==-1)
            {
                q.push(next);
                signs[next] = curr;
            }
        }
    }
    std::cout << "Yes\n";
    for (int i=2; i<=N; i++)
    {
        std::cout << signs[i] << "\n";
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:6: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   39 | std::sort(conns[curr].begin(), conns[curr].end());
      |      ^~~~
      |      qsort