Language: C++

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
using namespace std;

class data
{
public:
    int p, q, c;
    data(int p0, int q0, int c0){
        p = p0;
        q = q0;
        c = c0;
    }
};

void solve(int n, int start, int goal, vector<vector<int> > distance, vector<vector<int> > limit)
{
    vector<bool> easyCheck(n, false);
    queue<int> q;
    q.push(start);
    while(!q.empty()){
        int a = q.front();
        if(!easyCheck[a]){
            easyCheck[a] = true;
            for(int i=0; i<n; ++i){
                if(distance[a][i] > -1)
                    q.push(i);
            }
        }
        q.pop();
    }
    if(!easyCheck[goal]){
        cout << "unreachable" << endl;
        return;
    }

    vector<vector<vector<bool> > > check(n, vector<vector<bool> >(n, vector<bool>(31, false)));
	vector<vector<vector<double> > > time(n, vector<vector<double> >(n, vector<double>(31, DBL_MAX)));
    for(int i=0; i<n; ++i){
        if(distance[start][i] > -1)
			time[i][start][1] = distance[start][i];
    }

    for(;;){
		int p, q, c;
		double minTime = DBL_MAX;
		for(int i=0; i<n; ++i){
			for(int j=0; j<n; ++j){
				for(int k=1; k<=30; ++k){
					if(!check[i][j][k] && time[i][j][k] < minTime){
						p = i;
						q = j;
						c = k;
						minTime = time[i][j][k];
					}
				}
			}
		}
		if(p == goal && c == 1){
			printf("%.10f\n", minTime);
			return;
		}

        check[p][q][c] = true;
        for(int i=0; i<n; ++i){
            if(i == p || i == q || distance[i][p] == -1)
                continue;
            for(int j=-1; j<=1; ++j){
                if(1 <= c+j && c+j <= limit[p][i] && !check[i][p][c+j])
					time[i][p][c+j] = min(time[i][p][c+j], minTime + distance[p][i]/static_cast<double>(c+j));
            }
        }
    }
}

int main()
{
    for(;;){
        int n, m, s, g;
        cin >> n >> m;
        if(n == 0 && m == 0)
            break;
        cin >> s >> g;
        -- s;
        -- g;

        vector<vector<int> > distance(n, vector<int>(n, -1));
        vector<vector<int> > limit(n, vector<int>(n, -1));
        for(int i=0; i<m; ++i){
            int x, y;
            cin >> x >> y;
            -- x;
            -- y;
            cin >> distance[x][y] >> limit[x][y];
            distance[y][x] = distance[x][y];
            limit[y][x] = limit[x][y];
        }

        solve(n, s, g, distance, limit);
    }

    return 0;
}

Compiler output:
a.cc: In function 'void solve(int, int, int, std::vector<std::vector<int> >, std::vector<std::vector<int> >)':
a.cc:49:96: error: 'DBL_MAX' was not declared in this scope
   49 |         vector<vector<vector<double> > > time(n, vector<vector<double> >(n, vector<double>(31, DBL_MAX)));
      |                                                                                                ^~~~~~~
a.cc:14:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
   13 | #include <algorithm>
  +++ |+#include <cfloat>
   14 | using namespace std;