Language: C++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = 56;
const int K = 2501;
const ll inf = (ll)1e14;
ll dis[N][K];

struct Edge{
  int nex;
  int tim;
  int cost;
};

struct Pos{ 
  ll tim;
  int coins;
  int pos;
  bool operator< (const Pos &V) const {
    return tim > V.tim;
  }
};

vector<Edge> T[N];
int c[N];
ll d[N];

int main(){
  fastIO;
  int n, m, s;
  cin >> n >> m >> s;
  int u, v, a, b;
  for(int i = 0 ; i < m ; i ++ ){
    cin >> u >> v >> a >> b;
    T[u].push_back({v, b, a});
    T[v].push_back({u, b, a});
  }
  for(int i = 1; i <= n; i ++ ){
    for(int j = 0 ; j < K; j ++ ){
      dis[i][j] = inf;
    }
  }
  for(int i = 1; i <= n; i ++ ){
    cin >> c[i] >> d[i];
    c[i] = min(c[i], K-1);
  }
  dis[1][min(s,K-1)] = 0;
  priority_queue<Pos> ff;
  ff.push({0,min(s,K-1),1});
  ll curc;
  int node;
  ll tm;
  int take;
  int nxc;
  int cnt = 0;
  while(!ff.empty()){
    node = ff.top().pos;
    curc = ff.top().coins;
    tm = ff.top().tim;
    if(tm != dis[node][curc]){
      ff.pop();
      continue;
    }
    ff.pop();
    take = 1;
    for(auto x : T[node]){
      if(x.cost <= curc){
        if(dis[x.nex][curc - x.cost] > dis[node][curc] + x.tim){
          dis[x.nex][curc - x.cost] = dis[node][curc] + x.tim;
          ff.push({dis[x.nex][curc-x.cost],curc-x.cost,x.nex});
        }
      }
    }
    while(1){ 
      nxc = min(curc + take * c[node], K - 1);
      if(dis[node][nxc] > dis[node][curc] + take * d[node]){
        dis[node][nxc] = dis[node][curc] + take * d[node];
        ff.push({dis[node][nxc],nxc,node});
      }
      if(nxc >= K-1) break;
      take ++;
    }
  }
  ll ans;
  for(int i = 2; i <= n; i ++ ){
    ans = inf;
    for(int j = 0 ; j < K; j ++ ) 
      ans = min(ans, dis[i][j]);
    cout << ans << "\n";
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:80:48: warning: narrowing conversion of '(curc - ((ll)x.Edge::cost))' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
   80 |           ff.push({dis[x.nex][curc-x.cost],curc-x.cost,x.nex});
      |                                            ~~~~^~~~~~~
a.cc:85:16: error: no matching function for call to 'min(ll, int)'
   85 |       nxc = min(curc + take * c[node], K - 1);
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:2:
/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:85:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   85 |       nxc = min(curc + take * c[node], K - 1);
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:85:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   85 |       nxc = min(curc + take * c[node], K - 1);
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~