Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
struct E{ll to,co,ti;};
struct P{ll ti,id,re;};
bool operator <(const P &a,const P &b){return a.tim>b.tim;}
ll d[50][5001],c[50],d[50],ans[50],n,m,s;
vector<E> edge[50];
priority_queue<P> que;

signed main(){
  cin>>n>>m>>s;
  while(m--){
    ll u,v,a,b;cin>>u>>v>>a>>b;u--;v--;
    edge[u].push_back({v,a,b});
    edge[v].push_back({u,a,b});
  }
  for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
  que.push({1,0,min(5000LL,s)});
  while(que.size()){
    P p=que.top();que.pop();
    if(d[p.id][p.re])continue;
    d[p.id][p.re]=p.ti;
    if(!ans[p.id])ans[p.id]=p.ti;
    for(E q:edge[p.id])
      if(p.re>=q.co&&!d[q.to][p.re-q.co])
        que.push({p.ti+q.ti,q.to,p.re-q.co});
    if(p.re+c[p.id]<=5000)que.push({p.ti+d[p.id],p.id,p.re+c[p.id]});
  }
  for(ll i=1;i<n;i++)cout<<--ans[i]<<endl;
}


Compiler output:
a.cc: In function 'bool operator<(const P&, const P&)':
a.cc:6:49: error: 'const struct P' has no member named 'tim'; did you mean 'ti'?
    6 | bool operator <(const P &a,const P &b){return a.tim>b.tim;}
      |                                                 ^~~
      |                                                 ti
a.cc:6:55: error: 'const struct P' has no member named 'tim'; did you mean 'ti'?
    6 | bool operator <(const P &a,const P &b){return a.tim>b.tim;}
      |                                                       ^~~
      |                                                       ti
a.cc: At global scope:
a.cc:7:22: error: conflicting declaration 'll d [50]'
    7 | ll d[50][5001],c[50],d[50],ans[50],n,m,s;
      |                      ^
a.cc:7:4: note: previous declaration as 'll d [50][5001]'
    7 | ll d[50][5001],c[50],d[50],ans[50],n,m,s;
      |    ^
a.cc: In function 'int main()':
a.cc:18:31: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'll [5001]' {aka 'long long int [5001]'})
   18 |   for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
      |                      ~~~~~~~~~^~~~~~
      |                         |          |
      |                         |          ll [5001] {aka long long int [5001]}
      |                         std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
a.cc:18:36: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'll*' {aka 'long long int*'}
   18 |   for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
      |                                 ~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
a.cc:18:36: error: invalid conversion from 'll*' {aka 'long long int*'} to 'short int' [-fpermissive]
   18 |   for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
      |                                 ~~~^
      |                                    |
      |                                    ll* {aka long long int*}
a.cc:18:36: error: cannot bind rvalue '(short int)((ll*)(& d[i]))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
a.cc:18:36: error: invalid conversion from 'll*' {aka 'long long int*'} to 'short unsigned int' [-fpermissive]
   18 |   for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
      |                                 ~~~^
      |                                    |
      |                                    ll* {aka long long int*}
a.cc:18:36: error: cannot bind rvalue '(short unsigned int)((ll*)(& d[i]))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
a.cc:18:36: error: invalid conversion from 'll*' {aka 'long long int*'} to 'int' [-fpermissive]
   18 |   for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
      |                                 ~~~^
      |                                    |
      |                                    ll* {aka long long int*}
a.cc:18:36: error: cannot bind rvalue '(int)((ll*)(& d[i]))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
a.cc:18:36: error: invalid conversion from 'll*' {aka 'long long int*'} to 'unsigned int' [-fpermissive]
   18 |   for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
      |                                 ~~~^
      |                                    |
      |                                    ll* {aka long long int*}
a.cc:18:36: error: cannot bind rvalue '(unsigned int)((ll*)(& d[i]))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
a.cc:18:36: error: invalid conversion from 'll*' {aka 'long long int*'} to 'long int' [-fpermissive]
   18 |   for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
      |                                 ~~~^
      |                                    |
      |                                    ll* {aka long long int*}
a.cc:18:36: error: cannot bind rvalue '(long int)((ll*)(& d[i]))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
a.cc:18:36: error: invalid conversion from 'll*' {aka 'long long int*'} to 'long unsigned int' [-fpermissive]
   18 |   for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
      |                                 ~~~^
      |                                    |
      |                                    ll* {aka long long int*}
a.cc:18:36: error: cannot bind rvalue '(long unsigned int)((ll*)(& d[i]))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:7: note:   conversion of argument 1 would be ill-formed:
a.cc:18:36: error: invalid conversion from 'll*' {aka 'long long int*'} to 'long long int' [-fpermissive]
   18 |   for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
      |                                 ~~~^
      |                                    |
      |                                    ll* {aka long long int*}
a.cc:18:36: error: cannot bind rvalue '(long long int)((ll*)(& d[i]))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:7: note:   conversion of argument 1 would be ill-formed:
a.cc:18:36: error: invalid conversion from 'll*' {aka 'long long int*'} to 'long long unsigned int' [-fpermissive]
   18 |   for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
      |                                 ~~~^
      |                                    |
      |                                    ll* {aka long long int*}
a.cc:18:36: error: cannot bind rvalue '(long long unsigned int)((ll*)(& d[i]))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  328 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/14/istream:328:7: note:   conversion of argument 1 would be ill-formed:
a.cc:18:36: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
   18 |   for(ll i=0;i<n;i++)cin>>c[i]>>d[i];
      |                                 ~~~^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  219 |       operator>>(float& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:219:25: note:   no known conversion for argument 1 from 'll [5001]' {aka 'long long int [5001]'} to 'float&'
  219 |       operator>>(float& __f)
      |                  ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = st