Language: C++

#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
struct node
{
    ll u,a,b;    
};
struct node1
{
    ll tim,i,t;
};
struct CompareHeight { 
    bool operator()(node1 const& p1, node1 const& p2) 
    { 
        // return "true" if "p1" is ordered  
        // before "p2", for example: 
        return p1.tim > p2.tim; 
    } 
}; 
int main() {

    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        ll n,m,s;cin>>n>>m>>s;
        vector<node> g[n];
        rep(i,m){
            int u,v,a,b;cin>>u>>v>>a>>b;u--;v--;
            g[u].pb({v,a,b});g[v].pb({u,a,b});
        }
        ll c[n],d[n];
        rep(i,n){
            cin>>c[i]>>d[i];
        }
        ll ans[n];ll N=2500;
        ll dp[n][N];memset(dp,-1,sizeof(dp));
        dp[0][s%N]=0;
        ll visit[n][N];
        memset(visit,0,sizeof(visit));
        priority_queue<node1,vector<node1 >,CompareHeight > pq;
        node1 x={0,0,s%N};
        pq.push(x);
        while(!pq.empty()){
            node1 p=pq.top();pq.pop();
            ll i=p.i;ll t=p.t;
            ll tim=p.tim;
            if(visit[i][t]==1)continue;
            visit[i][t]=1;
            dp[i][t]=tim;
            for(auto j:g[i]){
                ll buy=0;
                buy=(j.a-t)/c[i];
                buy=max(0,buy);
                while(1){
                    ll u=t-j.a;
                    ll q=j.b;
                    u=(u+buy*c[i])%N;
                    q=q+buy*d[i];
                    buy++;if(u<0)continue;
                    if(visit[j.u][u]==0){
                        pq.push({tim+q,j.u,u});
                    }
                    u=u+c[i];
                    if(u>=N){
                        break;
                    }
                }
            }
        }
        repA(i,1,n-1){
            ans[i]=1e17;
            for(int j=0;j<N;j++){
                if(dp[i][j]!=-1){
                    ans[i]=min(ans[i],dp[i][j]);
                }
            }
        }
        repA(i,1,n-1){
            cout<<ans[i]<<endl;
        }
    }   
    timecalculater();
    return 0;   
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:106:24: error: no matching function for call to 'max(int, ll&)'
  106 |                 buy=max(0,buy);
      |                     ~~~^~~~~~~
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:106:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  106 |                 buy=max(0,buy);
      |                     ~~~^~~~~~~
/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:106:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  106 |                 buy=max(0,buy);
      |                     ~~~^~~~~~~