Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define print(x) std::cout<<x<<"\n"
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
  for (auto i = first;i != last;i++){
    cin >> (*i);
  }
}
template<class itr> void array_output(itr start,itr goal){
  string ans = "",k = " ";
  for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
  if (!ans.empty()) ans.pop_back();
  //PRINT(ans);
}
ll gcd(ll a, ll b) {
  return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 2510;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};

struct Node{
	ll to=0;
	ll cost=0;
};
class Dijkstra{
 private:

  vector<vector<Node>> G;
  VI d;
  ll siz;
 public:
  Dijkstra(ll n){
    G.resize(n);
    siz = n;
  }
  void add_edge(ll from,ll to,ll cost){
    G[from].push_back(Node{to,cost});
  }
  vector<ll> dijkstra(ll s){
    priority_queue<P,vector<P>,greater<P>> q;
    d.assign(siz,INF);
    d[s] = 0;
    q.push(P(0,s));
    while(!q.empty()){
      P p = q.top();q.pop();
      ll v = p.second;
      if (d[v] < p.first) continue;
      for(Node &e:G[v]){
        if (chmin(d[e.to],d[v]+e.cost)){
          q.push(P(d[e.to],e.to));
        }
      }
    }
    return d;
  }
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,s;
  cin >> n >> m >> s;
  Dijkstra g(2501*n); // u:2500*u+money
  ll u,v,a,b,c,d;
  rep(i,m){
    cin >> u >> v >> a >> b;
    --u;
    --v;
    rep(i,a,2501){
      g.add_edge(2501*u+i,2501*v+i-a,b);
      g.add_edge(2501*v+i,2501*u+i-a,b);
    }
  }
  rep(i,n){
    cin >> c >> d;
    rep(j,2500){
      g.add_edge(2501*i+j,2501*i+min(j+c,(ll)2500),d);
    }
  }
  vector<ll> dist = g.dijkstra(min(s,(ll)2500));
  rep(i,1,n){
    ll ans = INF;
    rep(j,2501){
      chmin(ans,dist[2501*i+j]);
    }
    print(ans);
  }
}


Compiler output:
a.cc: In function 'void Yes(bool)':
a.cc:27:48: error: 'PRINT' was not declared in this scope
   27 | inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
      |                                                ^~~~~
a.cc:27:67: error: 'PRINT' was not declared in this scope
   27 | inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
      |                                                                   ^~~~~