Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

const int MAX_V = 50;
const int MAX_S = MAX_V*50;
const ll INF = 1e18;

struct Edge {
    int to, a, b;
    Edge(int to, int a, int b):to(to),a(a),b(b) {}
};

struct Data {
    int v, s;
    ll x;
    Data(int v, int s, ll x):v(v),s(s),x(x) {}
    bool operator<const Data& a) const {
        return x > a.x;
    }
};

vector<Edge> g[MAX_V];
ll dist[MAX_V][MAX_S+5];

int main(){
    int n,m,s; cin>>n>>m>>s;
    rep(i,m) {
        int u,v,a,b; cin>>u>>v>>a>>b;
        u--; v--;
        g[u].emplace_back(v,a,b);
        g[v].emplace_back(u,a,b);
    }

    rep(i,n)rep(j,MAX_S+5) dist[i][j] = INF;
    s = min(s,MAX_S);
    
    priority_queue<Data> q;
    
    auto push = [&](int v, int s, ll x){
        if(s<0) return;
        if(dist[v][s]<=x) return;
        q.emplace(v,s,x);
    };

    vector<int> c(n),d(n);
    rep(i,n) cin>>c[i]>>d[i];
    push(0,s,0);
    while(!q.empty()){
        Data hoge = q.top(); q.pop();
        int v = hoge.v, s=hoge.s;
        ll x = hoge.x;
        if(dist[v][s]!=x) continue;
        int nows = min(s+c[v],MAX_S);
        push(v,nows,x+d[v]);
        for(Edge e : g[v]){
            push(e.to, s-e.a, x+e.b);
        }
    }
    for(int i=1;i<n;i++){
        ll ans = INF;
        rep(j,MAX_S+5){
            ans = min(ans,dist[i][j]);
        }
        cout << ans << endl;
    }
}


Compiler output:
a.cc:19:10: error: declaration of 'operator<' as non-function
   19 |     bool operator<const Data& a) const {
      |          ^~~~~~~~
a.cc:19:18: error: expected ';' at end of member declaration
   19 |     bool operator<const Data& a) const {
      |                  ^
      |                   ;
a.cc:19:31: error: expected ';' at end of member declaration
   19 |     bool operator<const Data& a) const {
      |                               ^
      |                                ;
a.cc:19:32: error: expected unqualified-id before ')' token
   19 |     bool operator<const Data& a) const {
      |                                ^
a.cc: In constructor 'Data::Data(int, int, ll)':
a.cc:18:5: error: uninitialized reference member in 'const struct Data&' [-fpermissive]
   18 |     Data(int v, int s, ll x):v(v),s(s),x(x) {}
      |     ^~~~
a.cc:19:31: note: 'const Data& Data::a' should be initialized
   19 |     bool operator<const Data& a) const {
      |                               ^
In file included from /usr/include/c++/14/bits/stl_algo.h:61,
                 from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Data*, vector<Data, allocator<Data> > >; _Distance = long int; _Tp = Data; _Compare = __gnu_cxx::__ops::_Iter_comp_val<less<Data> >]':
/usr/include/c++/14/bits/stl_heap.h:216:23:   required from 'void std::push_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<Data*, vector<Data, allocator<Data> > >; _Compare = less<Data>]'
  216 |       std::__push_heap(__first, _DistanceType((__last - __first) - 1),
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  217 |                        _DistanceType(0), _GLIBCXX_MOVE(__value), __cmp);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:755:18:   required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::emplace(_Args&& ...) [with _Args = {int&, int&, long long int&}; _Tp = Data; _Sequence = std::vector<Data, std::allocator<Data> >; _Compare = std::less<Data>]'
  755 |           std::push_heap(c.begin(), c.end(), comp);
      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:44:18:   required from here
   44 |         q.emplace(v,s,x);
      |         ~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_heap.h:142:36: error: use of deleted function 'Data& Data::operator=(Data&&)'
  142 |           *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __parent));
      |                                    ^
a.cc:15:8: note: 'Data& Data::operator=(Data&&)' is implicitly deleted because the default definition would be ill-formed:
   15 | struct Data {
      |        ^~~~
a.cc:15:8: error: non-static reference member 'const Data& Data::a', cannot use default assignment operator
/usr/include/c++/14/bits/stl_heap.h:142:36: note: use '-fdiagnostics-all-candidates' to display considered candidates
  142 |           *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __parent));
      |                                    ^
/usr/include/c++/14/bits/stl_heap.h:146:32: error: use of deleted function 'Data& Data::operator=(Data&&)'
  146 |       *(__first + __holeIndex) = _GLIBCXX_MOVE(__value);
      |                                ^
/usr/include/c++/14/bits/stl_heap.h:146:32: note: use '-fdiagnostics-all-candidates' to display considered candidates
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Data*, vector<Data, allocator<Data> > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<less<Data> >]':
/usr/include/c++/14/bits/stl_heap.h:333:19:   required from 'void std::pop_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<Data*, vector<Data, allocator<Data> > >; _Compare = less<Data>]'
  333 |           std::__pop_heap(__first, __last, __last, __cmp);
      |           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:774:15:   required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::pop() [with _Tp = Data; _Sequence = std::vector<Data, std::allocator<Data> >; _Compare = std::less<Data>]'
  774 |         std::pop_heap(c.begin(), c.end(), comp);
      |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:51:35:   required from here
   51 |         Data hoge = q.top(); q.pop();
      |                              ~~~~~^~
/usr/include/c++/14/bits/stl_heap.h:263:17: error: use of deleted function 'Data& Data::operator=(Data&&)'
  263 |       *__result = _GLIBCXX_MOVE(*__first);
      |                 ^
/usr/include/c++/14/bits/stl_heap.h:263:17: note: use '-fdiagnostics-all-candidates' to display considered candidates
In file included from /usr/include/c++/14/string:49,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/stl_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = Data]':
/usr/include/c++/14/bits/predefined_ops.h:196:23:   required from 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = __gnu_cxx::__normal_iterator<Data*, std::vector<Data, std::allocator<Data> > >; _Value = Data; _Compare = std::less<Data>]'
  196 |         { return bool(_M_comp(*__it, __val)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:140:48:   required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Data*, vector<Data, allocator<Data> > >; _Distance = long int; _Tp = Data; _Compare = __gnu_cxx::__ops::_Iter_comp_val<less<Data> >]'
  140 |       while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
      |                                          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:216:23:   required from 'void std::push_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<Data*, vector<Data, allocator<Data> > >; _Compare = less<Data>]'
  216 |       std::__push_heap(__first, _DistanceType((__last - __first) - 1),
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  217 |                        _DistanceType(0), _GLIBCXX_MOVE(__value), __cmp);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:755:18:   required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::emplace(_Args&& ...) [with _Args = {int&, int&, long long int&}; _Tp = Data; _Sequence = std::vector<Data, std::allocator<Data> >; _Compare = std::less<Data>]'
  755 |           std::push_heap(c.begin(), c.end(), comp);
      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:44:18:   required from here
   44 |         q.emplace(v,s,x);
      |         ~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_function.h:405:20: error: no match for 'operator<' (operand types are 'const Data' and 'const Data')
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
 1045 |     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const Data' is not derived from 'const std::pair<_T1, _T2>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  448 |     operator<(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const Data' is not derived from 'const std::reverse_iterator<_Iterator>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  493 |     operator<(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const Data' is not derived from 'const std::reverse_iterator<_Iterator>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1694 |     operator<(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const Data' is not derived from 'const std::move_iterator<_IteratorL>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_