Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
const int N=100001,M=200002;
const int INF=0x7f7f7f7f;
struct node {
        int i,value;
        friend bool operator < (node a,node b){
                return a.value > b.value;
        }
};
struct edge{
	int to,value;
	int next;
}mem[M];
priority_queue<node> minq;
int head[N],size=0,dis[N],n,m,start,qian[N];
bool vis[N];
void  dijkstra(int start){
        dis[start]=0;
        node tmp={start,0};
        minq.push(tmp);
        while(!minq.empty()){
                tmp=minq.top();
                minq.pop();
                if(vis[tmp.i])continue;
                vis[tmp.i]=true;
                for(int j=head[tmp.i];j!=0;j=mem[j].next){
                		int to=mem[j].to;
                	    if(!vis[to]&&mem[j].value+dis[tmp.i]<dis[to]){
                            	dis[to]=mem[j].value+dis[tmp.i];
                                node tmp2={to,dis[to]};
                                minq.push(tmp2);
                                qian[to] = tmp.i;
                        }
                }
        }
}
int main(){
        memset(head,0,sizeof(head));
        memset(dis,0x7f,sizeof(dis));
        memset(vis,false,sizeof(vis));
        memset(qian,-1,sizeof(qian));
        scanf("%d %d",&n,&m);
        start=1;
        int u,v,w;
        for(int i=1;i<=m;i++){
                scanf("%d %d",&u,&v);w=1;
                size++;mem[size].to=v;mem[size].value=w;mem[size].next=head[u];head[u]=size;
                size++;mem[size].to=u;mem[size].value=w;mem[size].next=head[v];head[v]=size;
        }
        dijkstra(start);
        for(int i=1;i<=n;i++)
        {
        	if(dis[i]>=2139062143){
        		printf("No");return 0;
			}
		}
		printf("Yes\n");
		for(int i=2;i<=n;i++)
		{
			cout<<qian[i]<<endl;
		}
        return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:17: error: reference to 'size' is ambiguous
   51 |                 size++;mem[size].to=v;mem[size].value=w;mem[size].next=head[u];head[u]=size;
      |                 ^~~~
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:19:13: note:                 'int size'
   19 | int head[N],size=0,dis[N],n,m,start,qian[N];
      |             ^~~~
a.cc:51:28: error: reference to 'size' is ambiguous
   51 |                 size++;mem[size].to=v;mem[size].value=w;mem[size].next=head[u];head[u]=size;
      |                            ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:19:13: note:                 'int size'
   19 | int head[N],size=0,dis[N],n,m,start,qian[N];
      |             ^~~~
a.cc:51:43: error: reference to 'size' is ambiguous
   51 |                 size++;mem[size].to=v;mem[size].value=w;mem[size].next=head[u];head[u]=size;
      |                                           ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:19:13: note:                 'int size'
   19 | int head[N],size=0,dis[N],n,m,start,qian[N];
      |             ^~~~
a.cc:51:61: error: reference to 'size' is ambiguous
   51 |                 size++;mem[size].to=v;mem[size].value=w;mem[size].next=head[u];head[u]=size;
      |                                                             ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:19:13: note:                 'int size'
   19 | int head[N],size=0,dis[N],n,m,start,qian[N];
      |             ^~~~
a.cc:51:88: error: reference to 'size' is ambiguous
   51 |                 size++;mem[size].to=v;mem[size].value=w;mem[size].next=head[u];head[u]=size;
      |                                                                                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:19:13: note:                 'int size'
   19 | int head[N],size=0,dis[N],n,m,start,qian[N];
      |             ^~~~
a.cc:52:17: error: reference to 'size' is ambiguous
   52 |                 size++;mem[size].to=u;mem[size].value=w;mem[size].next=head[v];head[v]=size;
      |                 ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:19:13: note:                 'int size'
   19 | int head[N],size=0,dis[N],n,m,start,qian[N];
      |             ^~~~
a.cc:52:28: error: reference to 'size' is ambiguous
   52 |                 size++;mem[size].to=u;mem[size].value=w;mem[size].next=head[v];head[v]=size;
      |                            ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:19:13: note:                 'int size'
   19 | int head[N],size=0,dis[N],n,m,start,qian[N];
      |             ^~~~
a.cc:52:43: error: reference to 'size' is ambiguous
   52 |                 size++;mem[size].to=u;mem[size].value=w;mem[size].next=head[v];head[v]=size;
      |                                           ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:19:13: note:                 'int size'
   19 | int head[N],size=0,dis[N],n,m,start,qian[N];
      |             ^~~~
a.cc:52:61: error: reference to 'size' is ambiguous
   52 |                 size++;mem[size].to=u;mem[size].value=w;mem[size].next=head[v];head[v]=size;
      |                                                             ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:19:13: note:                 'int size'
   19 | int head[N],size=0,dis[N],n,m,start,qian[N];
      |             ^~~~
a.cc:52:88: error: reference to 'size' is ambiguous
   52 |                 size++;mem[size].to=u;mem[size].value=w;mem[size].next=head[v];head[v]=size;
      |                                                                                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:19:13: note:                 'int size'
   19 | int head[N],size=0,dis[N],n,m,start,qian[N];
      |             ^~~~