Language: C++

#include<bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define pb push_back
#define ins insert
#define er erase

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, ii> iiii;

const int oo = 1e18 + 7, mod = 1e9 + 7;

int n, m, s, c[55], d[55], dp[55][5005];
vector<iii> vc[55];
priority_queue<iii, vector<iii>, greater<iii>> pq;

void dijk(){
    while(!pq.empty()){
        //if(pq.size() <= 5000) cout << pq.size() << "\n";
        iii tmp = pq.top();
        pq.pop();
        if(tmp.fi > dp[tmp.se.fi][tmp.se.se]) continue;
        int u = tmp.se.fi;
        //cout << u << " " << tmp.se.se << " " << dp[tmp.se.fi][tmp.se.se] << " " << c[u] << " " << d[u] << "\n";
        if(tmp.se.se + c[u] <= 5000 && dp[u][tmp.se.se + c[u]] > (dp[u][tmp.se.se] + d[u])){
            dp[u][tmp.se.se + c[u]] = (dp[u][tmp.se.se] + d[u]);
            pq.push({dp[u][tmp.se.se + c[u]], {u, tmp.se.se + c[u]}});
        }
        for(int i = 0; i < vc[u].size(); i++){
            int v = vc[u][i].fi;
            if(tmp.se.se < vc[u][i].se.fi) continue;
            //cout << u << " " << tmp.se.se << " " << dp[u][tmp.se.se] << "\n";
            if(dp[v][tmp.se.se - vc[u][i].se.fi] > (dp[u][tmp.se.se] + vc[u][i].se.se)){
                //if(v == 3) cout << u << " " << v << " " << tmp.se.se << "\n";
                dp[v][tmp.se.se - vc[u][i].se.fi] = dp[u][tmp.se.se] + vc[u][i].se.se;
                //if(pq.size() < 10000) cout << v << " " << tmp.se.se - vc[u][i].se.fi << "\n";
                pq.push({dp[v][tmp.se.se - vc[u][i].se.fi], {v, tmp.se.se - vc[u][i].se.fi}});
            }
        }
    }
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin >> n >> m >> s;
	s = min(s, 5000);
	for(int i = 1; i <= m; i++){
	    int u, v, a, b;
	    cin >> u >> v >> a >> b;
	    vc[u].pb({v, {a, b}});
	    vc[v].pb({u, {a, b}});
	}
	for(int i = 1; i <= n; i++) cin >> c[i] >> d[i];
    for(int i = 1; i <= n; i++){
	    for(int j = 0; j <= 5000; j++) dp[i][j] = oo;
	}
	dp[1][s] = 0;
	for(int i = 1; i <= n; i++){
	    for(int j = 0; j <= 5000; j++) pq.push({dp[i][j], {i, j}});
	}
	dijk();
	for(int i = 2; i <= n; i++){
	    int answ = oo;
	    for(int j = 0; j <= 5000; j++) answ = min(answ, dp[i][j]);
	    cout << answ << "\n";
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:16: error: no matching function for call to 'min(long long int&, int)'
   50 |         s = min(s, 5000);
      |             ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:50:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   50 |         s = min(s, 5000);
      |             ~~~^~~~~~~~~
/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:
/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:50:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   50 |         s = min(s, 5000);
      |             ~~~^~~~~~~~~