Language: C++

#include<bits/stdc++.h>
#include<set>
#include<queue>
#define INF 0x3f3f3f3f
using namespace std;
inline int read(){
    int w=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        w=(w<<3)+(w<<1)+ch-48;
        ch=getchar();
    }
    return w*f;
}
int n,m,dis[500010],cnt,head[500010];
set<int> c[500010];
struct Edge{
    int from,to,next,col;
}edge[5000010];
inline void addedge(int u,int v,int w){
    cnt++;
    edge[cnt].from=u;
    edge[cnt].to=v;
    edge[cnt].col=w;
    edge[cnt].next=head[u];
    head[u]=cnt;
}
struct Node{
    int u,dis;
};
inline bool operation < (Node x,Node y){
    return x.dis<y.dis;
}
priority_queue<Node> pq;
bool vis[500010];
/*inline void dij(int from){
    dis[1]=0;pq.push((Node){1,0});
    while(!pq.empty()){
        Node cur=pq.top();pq.pop();int u=cur.u;if(vis[u])continue;vis[u]=true;
        for(int i=head[u];i;i=edge[i].next){
            int v=edge[i].to;int color=edge[i].col;
            int w=c[u].count(edge[i].col)?0:1;
            if(dis[v]>dis[u]+w){
                dis[v]=dis[u]+w;c[v].clear();c[v].insert(edge[i].col);pq.push((Node){v,dis[v]});
            }
            else if(dis[v]==dis[u]+w){
                c[v].insert(edge[i].col);
            }
        }
    }
}*/
inline void dij(){
    for(int i=2;i<=n;++i)dis[i]=0x3f3f3f3f,vis[i]=false;
    dis[1]=0;pq.push((Node){1,dis[1]});
    while(!pq.empty()){
        Node x=pq.top();
        pq.pop();
        if(vis[x.u])continue;
        vis[x.u]=1;int u=x.u;
        for(int i=head[x.u];i;i=edge[i].next){
            int v=edge[i].to,w=c[x.u].count(edge[i].col)?0:1;
            if(dis[v]>dis[x.u]+w){dis[v]=dis[x.u]+w,pq.push((Node){v,dis[v]}),c[v].clear(),c[v].insert(edge[i].col);}
            else if(dis[v]==dis[x.u]+w){c[v].insert(edge[i].col);}
        }
    }
}
signed main(){
    n=read();m=read();
    for(int i=1;i<=m;i++){
        int x=read();int y=read();int z=read();
        addedge(x,y,z);addedge(y,x,z);
    }
    memset(dis,0x3f,sizeof(dis));
    dij();
    if(dis[n]==INF)cout<<-1<<endl;
    else cout<<dis[n]<<endl;
    return 0;
}


Compiler output:
a.cc:35:23: error: expected initializer before '<' token
   35 | inline bool operation < (Node x,Node y){
      |                       ^
In file included from /usr/include/c++/14/string:49,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = Node]':
/usr/include/c++/14/bits/predefined_ops.h:196:23:   required from 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = __gnu_cxx::__normal_iterator<Node*, std::vector<Node, std::allocator<Node> > >; _Value = Node; _Compare = std::less<Node>]'
  196 |         { return bool(_M_comp(*__it, __val)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:140:48:   required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Node*, vector<Node, allocator<Node> > >; _Distance = long int; _Tp = Node; _Compare = __gnu_cxx::__ops::_Iter_comp_val<less<Node> >]'
  140 |       while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
      |                                          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:216:23:   required from 'void std::push_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<Node*, vector<Node, allocator<Node> > >; _Compare = less<Node>]'
  216 |       std::__push_heap(__first, _DistanceType((__last - __first) - 1),
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  217 |                        _DistanceType(0), _GLIBCXX_MOVE(__value), __cmp);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:747:16:   required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = Node; _Sequence = std::vector<Node, std::allocator<Node> >; _Compare = std::less<Node>; value_type = Node]'
  747 |         std::push_heap(c.begin(), c.end(), comp);
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:58:21:   required from here
   58 |     dis[1]=0;pq.push((Node){1,dis[1]});
      |              ~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_function.h:405:20: error: no match for 'operator<' (operand types are 'const Node' and 'const Node')
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
 1045 |     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const Node' is not derived from 'const std::pair<_T1, _T2>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  448 |     operator<(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const Node' is not derived from 'const std::reverse_iterator<_Iterator>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  493 |     operator<(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const Node' is not derived from 'const std::reverse_iterator<_Iterator>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1694 |     operator<(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const Node' is not derived from 'const std::move_iterator<_IteratorL>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
 1760 |     operator<(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const Node' is not derived from 'const std::move_iterator<_IteratorL>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~