Language: C++

#pragma GCC optimize ("Ofast")
using llong = long long;
using ullong = unsigned long long;
using ulong = unsigned long;
#include <bits/stdc++.h>
#define PROBLEMNAME ""
#define DEBUG1(key, x) cerr << #key": " << x << endl;
#define DEBUG(x) cerr << #x": " << x << endl;
#define DEBUG_CONTAINER(x) {cerr << #x":" << endl; for (const auto & xx : x) cerr << xx << " "; cerr << endl;}
#define REPORT cerr << "Ok here" << endl;
#ifndef AduMaster
#define endl '\n'
#undef DEBUG
#undef DEBUG1
#undef DEBUG_CONTAINER
#undef REPORT
#define DEBUG(x)
#define DEBUG1(key, x)
#define REPORT
#define DEBUG_CONTAINER(x)
#endif
using namespace std;
//ifstream fin(PROBLEMNAME".INP");
//ofstream fout(PROBLEMNAME".OUT");
#ifdef AduMaster
//#define cin fin
//#define fout cout
#endif

struct Edge
{
	int V, A, B;
};

struct Counter
{
	int C, D;
};

const int MaxSilver = 5000 + 1;

vector<vector<llong>> Dijkstra(int S, const vector<vector<Edge>> & Adj, const vector<Counter> & Counters)
{
	S = min(S, MaxSilver);
	
	const int N = Adj.size() - 1;
	
	vector<vector<llong>> DP(N + 1, vector<llong>(MaxSilver, LLONG_MAX));
	
	struct Record
	{
		llong Time;
		int Position;
		llong Money;
		
		operator>(const Record & r) const
		{
			return (Time != r.Time) ? Time > r.Time : 
				  ((Position != r.Position) ? Position > r.Position : Money > r.Money);
		}
	};
	
	priority_queue<Record, vector<Record>, greater<Record>> Q;
	
	DP[1][S] = 0;
	Q.push({0, 1, S});
	
	while (Q.size())
	{
		auto [time, position, money] = Q.top();
		Q.pop();
		
		if (time > DP[position][money]) continue;
		
		DEBUG(time);
		DEBUG(position);
		DEBUG(money);
		
		REPORT;
		
		if (money + Counters[position].C < MaxSilver)
		{
			llong newMoney = money + Counters[position].C;
			llong newTime = time + Counters[position].D;
			
			if (DP[position][newMoney] > newTime)
			{
				DP[position][newMoney] = newTime;
				Q.push({newTime, position, newMoney});
			}
		}
		
		REPORT;
		
		for (const auto & x : Adj[position])
		{
			if (money < x.A) continue;
			int newPos = x.V;
			int newMoney = money - x.A;
			int newTime = time + x.B;
			
			if (DP[newPos][newMoney] > newTime)
			{
				DP[newPos][newMoney] = newTime;
				Q.push({newTime, newPos, newMoney});
			}
		}
		
		REPORT;
	}
	
	return DP;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
		
	int N, M, S;
	cin >> N >> M >> S;
	
	vector<vector<Edge>> Adj(N + 1);
	while (M--)
	{
		static int U, V, A, B;
		cin >> U >> V >> A >> B;
		Adj[U].push_back({V, A, B});
		Adj[V].push_back({U, A, B});
	}
	
	vector<Counter> Counters(N + 1);
	for (int i = 1; i <= N; ++i)
	{
		cin >> Counters[i].C >> Counters[i].D;
	}
	
	REPORT;
	
	vector<vector<llong>> Result = Dijkstra(S, Adj, Counters);
	
	REPORT;
	
	for (int v = 2; v <= N; ++v)
	{
		llong result = *min_element(Result[v].begin(), Result[v].end());
		cout << result << endl;
	}
	
	return 0;
}


Compiler output:
a.cc: In function 'std::vector<std::vector<long long int> > Dijkstra(int, const std::vector<std::vector<Edge> >&, const std::vector<Counter>&)':
a.cc:56:17: error: ISO C++ forbids declaration of 'operator>' with no type [-fpermissive]
   56 |                 operator>(const Record & r) const
      |                 ^~~~~~~~