Language: C++

#include<bits/stdc++.h>
//using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll int
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb push_back
#define mp std::make_pair
#define endl "\n"
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
const ll MOD=1e9+7;
//const ll MOD=998244353;
//const ll MOD=100000;
const ll MAX=1e7;
const ll INF=(1ll<<30);
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll N,M,S; cin>>N>>M>>S;
    const ll max=2500;
    vector<vector<std::pair<ll,pii>>> edge(N);
    rep(i,0,M){
        ll A,B,C,D; cin>>A>>B>>C>>D;
        edge[A-1].pb(mp(B-1,mp(C,D)));
        edge[B-1].pb(mp(A-1,mp(C,D)));
    }
    vi C(N),T(N);
    rep(i,0,N) cin>>C[i]>>T[i];
    vector<vii> dp(N,vii(N,vi(max+1,INF)));
    dp[0][0][0]=0;
    vi ans(N,INF);
    prique<std::pair<pii,pii>> que;
    que.push(mp(mp(0,0),mp(0,0)));
    while(!que.empty()){
        ll X=que.top().second.first,Y=que.top().second.second,A=que.top().first.first,B=que.top().first.second;
        que.pop();
        ll x=std::max(0ll,B-S);
        ans[X]=std::min(ans[X],(x+C[Y]-1)/C[Y]*T[Y]+A);
        if(dp[X][Y][B]<A) continue;
        rep(i,0,edge[X].size()){
            ll Z=edge[X][i].first,coin=edge[X][i].second.first+B,time=edge[X][i].second.second+A;
            if(coin>max){
                continue;
            }
            if(dp[Z][Y][coin]>time){
                dp[Z][Y][coin]=time;
                que.push(mp(mp(time,coin),mp(Z,Y)));
            }
        }
        if(B>S){
            A+=(B-S+C[Y]-1)/C[Y]*T[Y];
            B=S;
        }
        Y=X;
        if(dp[X][Y][B]<=A) continue;
        dp[X][Y][B]=A;
        rep(i,0,edge[X].size()){
            ll Z=edge[X][i].first,coin=edge[X][i].second.first+B,time=edge[X][i].second.second+A;
            if(coin>max){
                continue;
            }
            if(dp[Z][Y][coin]>time){
                dp[Z][Y][coin]=time;
                que.push(mp(mp(time,coin),mp(Z,Y)));
            }
        }
    }
    rep(i,1,N) cout<<ans[i]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: 'ios' has not been declared
   33 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:53:22: error: no matching function for call to 'max(long long int, int)'
   53 |         ll x=std::max(0ll,B-S);
      |              ~~~~~~~~^~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:53:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   53 |         ll x=std::max(0ll,B-S);
      |              ~~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:53:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   53 |         ll x=std::max(0ll,B-S);
      |              ~~~~~~~~^~~~~~~~~