Language: C++

#include <iostream>
#include <utility>
#include <queue>
#include <tuple>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){
    int n, m, s; 
    cin >> n >> m >> s;
    pair<int, long long> map[60][60];
    long long dist[60] = {};
    long long maxCost = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            map[i][j].second = 10000000000000000UL;
        }
        dist[i] = 10000000000000000UL;
    }
    for(int i = 0; i < m; i++){
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        map[u][v].first = -a;
        map[v][u].first = -a;
        map[u][v].second = b;
        map[v][u].second = b;
        maxCost = max(a, maxCost);
    }
    for(int i = 1; i <= n; i++){
        int c, d; cin >> c >> d;
        map[i][i].first = c;
        map[i][i].second = d;
    }
    // 時間, 費用, 場所の順
    priority_queue<tuple<long long, long long, int>,
     vector<tuple<long long, long long, int>>,
     greater<tuple<long long, long long, int>>> q;
    q.push(make_tuple(0,s,1));
    while(!q.empty()){
        auto p = q.top(); q.pop();
        long long time = get<0>(p);
        long long cost = get<1>(p);
        int place = get<2>(p);
        for(int i = 1; i <= n; i++){
            if(map[place][i].first + cost >= 0 &&
             (map[place][i].first + cost <= maxCost * (n - 1) || i != place) ){
                if(time + map[place][i].second < dist[i])
                    dist[i] = time + map[place][i].second;
                q.push(make_tuple(time + map[place][i].second, map[place][i].first + cost, i));
            }
        }
        int counter = n-1;
        for(int i = 2; i <= n; i++){
            if(dist[i] <= time)counter--;
        }
        if(!counter)break;
    }
    for(int i = 2; i <= n; i++){
        cout << dist[i] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:22: error: no matching function for call to 'max(int&, long long int&)'
   29 |         maxCost = max(a, maxCost);
      |                   ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:29:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   29 |         maxCost = max(a, maxCost);
      |                   ~~~^~~~~~~~~~~~
/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,
                 from a.cc:5:
/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:29:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   29 |         maxCost = max(a, maxCost);
      |                   ~~~^~~~~~~~~~~~