Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
#include <iomanip>

using namespace std;

template<typename T> using VT = vector<T>
template<typename T> using VVT = vector<VT<T> >
template<typename T> using VVVT = vector<VVT<T> >
#define rep(i, n) for(int i=0; i<(n); ++i)
const double eps = 1e-8, inf = 1e+8;

template<typename T> inline void chmin(T& t, T f){if(t > f)t = f;}

struct Edge {
    int to; double wt; int cap;
    Edge(int to, double wt, int cap):to(to), wt(wt), cap(cap){}
};

int n, m, s, g;

double solve(vector<vector<Edge> >& G){
    double res = inf;
    VVVT<double> mem(n, VVT<double>(n, VT<double>(35, inf))); mem[s][s][0] = 0.;
    typedef tuple<double, int, int, int> State;
    priority_queue<State> q;
    for(q.emplace(0., 0, s, s); !q.empty();){
        double t; int v, u, p;
        tie(t, v, u, p) = q.top(); q.pop();
        if(mem[u][p][v] + t < -eps || res + t <= -eps)continue;
        if(u == g && v == 1)chmin(res, -t);
        for(auto e: G[u])if(e.to != p){
            for(int dv=-1; dv<=1; ++dv){
                int nv = v + dv <= 0? 1: v + dv;
                double nt = e.wt / nv - t;
                if(30 < nv || e.cap < nv || mem[e.to][u][nv] <= nt + eps)continue;
                mem[e.to][u][nv] = nt;
                q.emplace(-mem[e.to][u][nv], nv, e.to, u);
            }
        }
    }
    if(inf - res < eps)throw "unreachable";
    return res;
}

int main(){
    while(cin >> n >> m, n|m){
        cin >> s >> g;
        s--; g--;
        vector<vector<Edge> > G(n);
        rep(i, m){
            int x, y, d, c;
            cin >> x >> y >> d >> c;
            x--; y--;
            G[x].emplace_back(y, d, c);
            G[y].emplace_back(x, d, c);
        }
        try{
            cout << fixed << setprecision(5) << solve(G) << '\n';
        }
        catch(const char* mes){
            cout << mes << '\n';
        }
    }
    return 0;
}

Compiler output:
a.cc:9:42: error: expected ';' before 'template'
    9 | template<typename T> using VT = vector<T>
      |                                          ^
      |                                          ;
   10 | template<typename T> using VVT = vector<VT<T> >
      | ~~~~~~~~                                  
a.cc: In function 'double solve(std::vector<std::vector<Edge> >&)':
a.cc:25:18: error: 'inf' was not declared in this scope; did you mean 'int'?
   25 |     double res = inf;
      |                  ^~~
      |                  int
a.cc:26:5: error: 'VVVT' was not declared in this scope
   26 |     VVVT<double> mem(n, VVT<double>(n, VT<double>(35, inf))); mem[s][s][0] = 0.;
      |     ^~~~
a.cc:26:10: error: expected primary-expression before 'double'
   26 |     VVVT<double> mem(n, VVT<double>(n, VT<double>(35, inf))); mem[s][s][0] = 0.;
      |          ^~~~~~
a.cc:26:63: error: 'mem' was not declared in this scope
   26 |     VVVT<double> mem(n, VVT<double>(n, VT<double>(35, inf))); mem[s][s][0] = 0.;
      |                                                               ^~~
a.cc:32:32: error: 'eps' was not declared in this scope
   32 |         if(mem[u][p][v] + t < -eps || res + t <= -eps)continue;
      |                                ^~~
a.cc:38:70: error: 'eps' was not declared in this scope
   38 |                 if(30 < nv || e.cap < nv || mem[e.to][u][nv] <= nt + eps)continue;
      |                                                                      ^~~
a.cc:44:20: error: 'eps' was not declared in this scope
   44 |     if(inf - res < eps)throw "unreachable";
      |                    ^~~