Language: C++

#include <bits/stdc++.h>
#include <functional>
#define r(i,n) for(int i=0;i<n;i++)
#define se second
#define fi first
using namespace std;
struct ed{int a,b;};
typedef pair<int,ed> P;
struct edge{int to,lim;double dist;};
int n,m,st,go,a1,a3,a2,a4;
double d[31][31];
int dx[]={-1,0,1};
vector<edge> v[31];
int main(){
  while(cin>>n>>m,n){
    r(i,31)v[i].clear();
    r(i,31)r(j,31)if(d[i][j]!=1e12)d[i][j]=1e12;
    cin>>st>>go;
    r(i,m){
      edge e;
      scanf("%d%d%d%d",&a1,&a2,&a3,&a4);
      e.to=a2,e.dist=a3,e.lim=a4;
      v[a1].push_back(e);
      e.to=a1;
      v[a2].push_back(e);
    }
    priority_queue<P,vector<P>, function<bool(P,P)>>q([](P a,P b){return P.fi<P.se});
    d[st][0]=0;
    P xtt;xtt.fi=0,xtt.se.a=st,xtt.se.b=-1;
    q.push(xtt);
    while(!q.empty()){
      P p=q.top();q.pop();
      int cur=p.se.a;
      r(i,v[cur].size()){
        edge e=v[cur][i];
        if(e.to!=p.se.b)r(j,3){
          int x=p.fi+dx[j];
          if(0<x&&x<=e.lim){
            double t=e.dist/x+d[cur][p.fi];
            if(d[e.to][x]>t){
              d[e.to][x]=t;
              P xt;xt.fi=x,xt.se.a=e.to,xt.se.b=cur;
              q.push(xt);
            }
          }
        }
      }
    }
    if(d[go][1]==1e12)cout<<"unreachable"<<endl;
    else printf("%.9f\n",d[go][1]);
  }
}

Compiler output:
a.cc: In lambda function:
a.cc:27:75: error: expected primary-expression before '.' token
   27 |     priority_queue<P,vector<P>, function<bool(P,P)>>q([](P a,P b){return P.fi<P.se});
      |                                                                           ^
a.cc:27:80: error: expected primary-expression before '.' token
   27 |     priority_queue<P,vector<P>, function<bool(P,P)>>q([](P a,P b){return P.fi<P.se});
      |                                                                                ^
a.cc:27:83: error: expected ';' before '}' token
   27 |     priority_queue<P,vector<P>, function<bool(P,P)>>q([](P a,P b){return P.fi<P.se});
      |                                                                                   ^
a.cc: In function 'int main()':
a.cc:27:84: error: no matching function for call to 'std::priority_queue<std::pair<int, ed>, std::vector<std::pair<int, ed> >, std::function<bool(std::pair<int, ed>, std::pair<int, ed>)> >::priority_queue(main()::<lambda(P, P)>)'
   27 |     priority_queue<P,vector<P>, function<bool(P,P)>>q([](P a,P b){return P.fi<P.se});
      |                                                                                    ^
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:691:9: note: candidate: 'template<class _InputIterator, class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&, const _Alloc&) [with _Alloc = _InputIterator; _Requires = _Alloc; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  691 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:691:9: note:   candidate expects 5 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:679:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  679 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:679:9: note:   candidate expects 5 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:671:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  671 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:671:9: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:663:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  663 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:663:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:649:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  649 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:649:9: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:638:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  638 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:638:9: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:629:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  629 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:629:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:594:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(std::priority_queue<_Tp, _Sequence, _Compare>&&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  594 |         priority_queue(priority_queue&& __q, const _Alloc& __a)
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:594:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:590:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const std::priority_queue<_Tp, _Sequence, _Compare>&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  590 |         priority_queue(const priority_queue& __q, const _Alloc& __a)
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:590:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:585:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, _Sequence&&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  585 |         priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a)
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:585:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:579:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  579 |         priority_queue(const _Compare& __x, const _Sequence& __c,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:579:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:573:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  573 |         priority_queue(const _Compare& __x, const _Alloc& __a)
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:573:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_queue.h:569:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]'
  569 |         priority_queue(const _Alloc& __a)
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:569:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_queue.h: In substitution of 'template<class _Tp, class _Sequence, class _Compare> template<class _Alloc> using std::priority_queue<_Tp, _Sequence, _Compare>::_Uses = typename std::enable_if<std::uses_allocator<_Sequence, _Alloc>::value>::type [with _Alloc = main()::<lambda(P, P)>; _Tp = std::pair<int, ed>; _Sequence = std::vector<std::pair<int, ed> >; _Compare = std::function<bool(std::pair<int, ed>, std::pair<int, ed>)>]':
/usr/include/c++/14/bits/stl_queue.h:567:33:   required from here
  567 |       template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
      |                                 ^~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:513:15: error: no type named 'type' in 'struct std::enable_if<false, void>'