Language: C++

#include <bits/stdc++.h>
using namespace std ;
const int N = 1e5 +10 ;
const int inf = 1 << 30 ;
struct st{int p,b,c;};
bool operator < (st a,st b){return a.c>b.c;}
inline int read(){
    char c;int f=1 ;
    while ((c=getchar())<'0' || c>'9') if (c=='-') f=-1 ;
    int res=c-'0' ;
    while ((c=getchar())>='0' && c<='9') res=res*10+c-'0' ;
    return res*f ; 
}
map<int ,vector<int> > E[N] ; 
map<int,int > d[N] ; 
vector <int> G[N];
priority_queue <st> q ;
int n,m;
int main(){
    n=read();m=read() ;
    for (int i=1;i<=m;i++){
        int a,b,c ;
        a=read();b=read();c=read();a--;b-- ;
        E[a][c].push_back(b) ;E[b][c].push_back(a) ;
        G[a].push_back(c) ;G[b].push_back(c) ; 
    }
    d[0][0]=0;q.push({0,0,0}) ;
    while(!q.empty()){
        if (d[p.p][p.b]!=p.c){
            continue ;
        }
        if (d[p.p].find(0)==d[p.p].end() || d[p.p][0]>p.c){
            d[p.p][0]=p.c ;
            q.push({p.p,0,p.c}) ;
        }
        if (p.b==0){
            for (int i=0;i<G[p.p].size();i++){
                int v=G[p.p][i] ;
                if (d[p.p].find(v)==d[p.p].end() || d[p.p][v]>p.c+1){
                    d[p.p][v]=p.c+1 ;
                    q.push({p.p,v,p.c+1}) ;
                 }
             }
            continue ; 
        }
        for (int i=0;i<E[p.p][p.b].size();i++){
            int v=E[p.p][p.b][i] ;
            if (d[v].find(p.b)==d[v].end() || d[v][p.b]>p.c){
                d[v][p.b]=p.c ;
                q.push({v,p.b,p.c}) ;
            }
        }
    }
    int ans=inf ;
    for (map<int,int>::iterator p=d[n-1].begin();p!=d[n-1].end();p++) ans=min(ans,p->second) ;
    if (ans==inf) printf("-1\n") ;
    else printf("%d\n",ans) ;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:15: error: 'p' was not declared in this scope
   29 |         if (d[p.p][p.b]!=p.c){
      |               ^
a.cc:32:15: error: 'p' was not declared in this scope
   32 |         if (d[p.p].find(0)==d[p.p].end() || d[p.p][0]>p.c){
      |               ^
a.cc:34:19: error: no matching function for call to 'std::priority_queue<st>::push(<brace-enclosed initializer list>)'
   34 |             q.push({p.p,0,p.c}) ;
      |             ~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = st; _Sequence = std::vector<st, std::allocator<st> >; _Compare = std::less<st>; value_type = st]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<st>::value_type&' {aka 'const st&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = st; _Sequence = std::vector<st, std::allocator<st> >; _Compare = std::less<st>; value_type = st]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<st>::value_type&&' {aka 'st&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
a.cc:36:13: error: 'p' was not declared in this scope
   36 |         if (p.b==0){
      |             ^
a.cc:41:27: error: no matching function for call to 'std::priority_queue<st>::push(<brace-enclosed initializer list>)'
   41 |                     q.push({p.p,v,p.c+1}) ;
      |                     ~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = st; _Sequence = std::vector<st, std::allocator<st> >; _Compare = std::less<st>; value_type = st]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<st>::value_type&' {aka 'const st&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = st; _Sequence = std::vector<st, std::allocator<st> >; _Compare = std::less<st>; value_type = st]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<st>::value_type&&' {aka 'st&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
a.cc:46:26: error: 'p' was not declared in this scope
   46 |         for (int i=0;i<E[p.p][p.b].size();i++){
      |                          ^
a.cc:50:23: error: no matching function for call to 'std::priority_queue<st>::push(<brace-enclosed initializer list>)'
   50 |                 q.push({v,p.b,p.c}) ;
      |                 ~~~~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = st; _Sequence = std::vector<st, std::allocator<st> >; _Compare = std::less<st>; value_type = st]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<st>::value_type&' {aka 'const st&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = st; _Sequence = std::vector<st, std::allocator<st> >; _Compare = std::less<st>; value_type = st]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<st>::value_type&&' {aka 'st&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~