Language: C++

#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;

int64_t ss[51][2501];
bool ms[51][2501];

struct R {
	int i;
	int64_t v;
	int64_t p;
};

struct C {
	int64_t t;
	int64_t v;
	int64_t p;
	vector<R> rs;
};

struct S {
	int c;
	int v;
	int64_t p;
};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int n, m; cin >> n >> m;
	int64_t is; cin >> is;

	vector<C> cs(n + 1);
	FOR_LT(i, 0, m) {
		int u, v; cin >> u >> v;
		int64_t a, b; cin >> a >> b;
		cs[u].rs.push_back({ v, a, b });
		cs[v].rs.push_back({ u, a, b });
	}
	FOR_LT(i, 0, n) {
		int64_t a, b; cin >> a >> b;
		cs[i + 1].v = a;
		cs[i + 1].p = b;
	}

	auto comp = [](const S& lhs, const S& rhs) { return lhs.p > rhs.p; };
	priority_queue<S, std::vector<S>, decltype(comp)> search(comp);
	search.push({ 1, (int)min(is, 2050ll), 0 });
	while (!search.empty()) {
		S s = search.top();
		search.pop();
		if (ms[s.c][s.v]) continue;
		ms[s.c][s.v] = true;
		ss[s.c][s.v] = s.p;

		auto& c = cs[s.c];
		for (auto& r : c.rs) {
			if (s.v < r.v) continue;
			if (ms[r.i][s.v - r.v]) continue;
			search.push({ r.i, (int)(s.v - r.v), s.p + r.p });
		}

		search.push({ s.c, s.v + c.v, s.p + c.p });
	}
	

	FOR_LE(i, 2, n) {
		int64_t ans = INT64_MAX;
		FOR_LT(j, 0, 2501) {
			if (ss[i][j] == 0) continue;
			ans = min(ans, ss[i][j]);
		}
		cout << ans << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:82:34: error: no matching function for call to 'min(int64_t&, long long int)'
   82 |         search.push({ 1, (int)min(is, 2050ll), 0 });
      |                               ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:82:34: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   82 |         search.push({ 1, (int)min(is, 2050ll), 0 });
      |                               ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:14:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:82:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   82 |         search.push({ 1, (int)min(is, 2050ll), 0 });
      |                               ~~~^~~~~~~~~~~~
a.cc:82:20: error: no matching function for call to 'std::priority_queue<S, std::vector<S>, main()::<lambda(const S&, const S&)> >::push(<brace-enclosed initializer list>)'
   82 |         search.push({ 1, (int)min(is, 2050ll), 0 });
      |         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = S; _Sequence = std::vector<S>; _Compare = main()::<lambda(const S&, const S&)>; value_type = S]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<S, std::vector<S>, main()::<lambda(const S&, const S&)> >::value_type&' {aka 'const S&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = S; _Sequence = std::vector<S>; _Compare = main()::<lambda(const S&, const S&)>; value_type = S]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<S, std::vector<S>, main()::<lambda(const S&, const S&)> >::value_type&&' {aka 'S&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
a.cc:97:40: warning: narrowing conversion of '(((int64_t)s.S::v) + c.C::v)' from 'int64_t' {aka 'long int'} to 'int' [-Wnarrowing]
   97 |                 search.push({ s.c, s.v + c.v, s.p + c.p });
      |                                    ~~~~^~~~~