Language: C++

#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 1000000000
#define INF 9223372036854775807
#define MOD 998244353
#define mod 998244353
#define INT_MAX_ 2147483647
#define EPS (1e-10)
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define rep(i,n)for (ll i = 0; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
#define me memset
#define bit(n,k) ((n>>k)&1)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp1(pair<ll,ll> a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi>b.fi;
}
//----------------------------------------------------------------------
ll dp[55][2505];
//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_t=clock();
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //-------------------------------
    ll n,m,s;cin>>n>>m>>s;
    chmin(s,(ll)2500);
    V<pair<ll,Pll>>G[55];
    V<ll>c(n),d(n);
    for(ll i=0;i<m;i++){
        ll u,v,a,b;cin>>u>>v>>a>>b;
        u--;v--;
        G[u].pb(mp(v,mp(a,b)));
        G[v].pb(mp(u,mp(a,b)));
    }
    for(ll i=0;i<n;i++){
        cin>>c[i]>>d[i];
    }
    for(ll i=0;i<n;i++){
        for(ll j=0;j<=2500;j++){
            dp[i][j]=INF;
        }
    }
    dp[0][s]=0;
    priority_queue<pair<ll, Pll>, vector<pair<ll, Pll> >, greater<pair<ll, Pll>>>Q;
    Q.push(mp(0,mp(0,s)));
    while(!Q.empty()){
        auto p = Q.top();Q.pop();
        ll distance = p.fi;
        ll city = p.se.fi;
        ll money = p.se.se;
        if(distance>dp[city][money])continue;

        if(money<2500){
            ll nmoney = money+c[city];
            chmin(nnmoney,2500);
            ll ndis = distance+d[city];
            if(chmin(dp[city][nmoney],ndis)){
                Q.push(mp(ndis,mp(city,nmoney)));
            }
        }

        for(ll i=0;i<G[city].size();i++){
            if(money<G[city][i].se.fi)continue;
            ll ncity = G[city][i].fi;
            ll nmoney = money -G[city][i].se.fi;
            ll ndis = distance+G[city][i].se.se;
            if(chmin(dp[ncity][nmoney],ndis)){
                Q.push(mp(ndis,mp(ncity,nmoney)));
            }
        }

    }
    for(ll i=1;i<n;i++){
        ll ans=INF;
        for(ll j=0;j<=2500;j++){
            chmin(ans,dp[i][j]);
        }
        cout<<ans<<endl;
    }
    //-------------------------------  
    //fclose(stdin);
    //fclose(stdout);
    //ll end_t=clock();cout<<"time="<<end_t-begin_t<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------



















































Compiler output:
a.cc: In function 'int main()':
a.cc:112:19: error: 'nnmoney' was not declared in this scope; did you mean 'nmoney'?
  112 |             chmin(nnmoney,2500);
      |                   ^~~~~~~
      |                   nmoney