Language: C++

#include <bits/stdc++.h>
using namespace std;

#define rep(i, j, n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};

struct edge {
  int to, idx;
};

vvt<edge> e[101000];

vt<i64> dijkstra(int s, vt<i64> &cost) {
  vt<i64> dist(101000, 1e18);
  dist[s] = 0;

  priority_queue<pair<int, i64>, vt<pair<int, i64>>, greater<pair<int, i64>>> que;
  que.push({s, 0});

  while(!que.empty()) {
    auto p = que.top();
    que.pop();

    int v = p.first;
    i64 d = p.second;

    if(dist[v] < d) continue;

    for(auto &nxt : e[v]) {
      if(dist[nxt.to] < dist[v] + cost[nxt.idx]) continue;

      dist[nxt.to] = dist[v] + cost[nxt.idx];
      que.push({nxt.to, dist[nxt.to]});
    }
  }
  
  return dist;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, m, s, t;
  cin >> n >> m >> s >> t;
  s--; t--;

  vt<i64> a(m), b(m);
  rep(i, 0, m) {
    int u, v;
    cin >> u >> v >> a[i] >> b[i];
    u--; v--;
    e[u].push_back({v, i});
    e[v].push_back({u, i});
  }

  auto dist1 = dijkstra(s, a);
  auto dist2 = dijkstra(t, b);

  vt<i64> ans;
  i64 res = 0;
  for(int i = n - 1; i >= 0; --i) {
    res = max(res, (i64)1e15 - dist1[i] - dist2[i]);
    ans.push_back(res);
  }

  for(int i = n - 1; i >= 0; --i) cout << ans[i] << endl;
}


Compiler output:
a.cc: In function 'vt<long long int> dijkstra(int, vt<long long int>&)':
a.cc:44:19: error: 'class std::vector<edge, std::allocator<edge> >' has no member named 'to'
   44 |       if(dist[nxt.to] < dist[v] + cost[nxt.idx]) continue;
      |                   ^~
a.cc:44:44: error: 'class std::vector<edge, std::allocator<edge> >' has no member named 'idx'
   44 |       if(dist[nxt.to] < dist[v] + cost[nxt.idx]) continue;
      |                                            ^~~
a.cc:46:16: error: 'class std::vector<edge, std::allocator<edge> >' has no member named 'to'
   46 |       dist[nxt.to] = dist[v] + cost[nxt.idx];
      |                ^~
a.cc:46:41: error: 'class std::vector<edge, std::allocator<edge> >' has no member named 'idx'
   46 |       dist[nxt.to] = dist[v] + cost[nxt.idx];
      |                                         ^~~
a.cc:47:21: error: 'class std::vector<edge, std::allocator<edge> >' has no member named 'to'
   47 |       que.push({nxt.to, dist[nxt.to]});
      |                     ^~
a.cc:47:34: error: 'class std::vector<edge, std::allocator<edge> >' has no member named 'to'
   47 |       que.push({nxt.to, dist[nxt.to]});
      |                                  ^~
a.cc:47:15: error: no matching function for call to 'std::priority_queue<std::pair<int, long long int>, std::vector<std::pair<int, long long int>, std::allocator<std::pair<int, long long int> > >, std::greater<std::pair<int, long long int> > >::push(<brace-enclosed initializer list>)'
   47 |       que.push({nxt.to, dist[nxt.to]});
      |       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, long long int>; _Sequence = std::vector<std::pair<int, long long int>, std::allocator<std::pair<int, long long int> > >; _Compare = std::greater<std::pair<int, long long int> >; value_type = std::pair<int, long long int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::pair<int, long long int>, std::vector<std::pair<int, long long int>, std::allocator<std::pair<int, long long int> > >, std::greater<std::pair<int, long long int> > >::value_type&' {aka 'const std::pair<int, long long int>&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<int, long long int>; _Sequence = std::vector<std::pair<int, long long int>, std::allocator<std::pair<int, long long int> > >; _Compare = std::greater<std::pair<int, long long int> >; value_type = std::pair<int, long long int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<int, long long int>, std::vector<std::pair<int, long long int>, std::allocator<std::pair<int, long long int> > >, std::greater<std::pair<int, long long int> > >::value_type&&' {aka 'std::pair<int, long long int>&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:67:19: error: no matching function for call to 'std::vector<std::vector<edge, std::allocator<edge> >, std::allocator<std::vector<edge, std::allocator<edge> > > >::push_back(<brace-enclosed initializer list>)'
   67 |     e[u].push_back({v, i});
      |     ~~~~~~~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<edge, std::allocator<edge> >; _Alloc = std::allocator<std::vector<edge, std::allocator<edge> > >; value_type = std::vector<edge, std::allocator<edge> >]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::vector<edge, std::allocator<edge> >, std::allocator<std::vector<edge, std::allocator<edge> > > >::value_type&' {aka 'const std::vector<edge, std::allocator<edge> >&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<edge, std::allocator<edge> >; _Alloc = std::allocator<std::vector<edge, std::allocator<edge> > >; value_type = std::vector<edge, std::allocator<edge> >]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::vector<edge, std::allocator<edge> >, std::allocator<std::vector<edge, std::allocator<edge> > > >::value_type&&' {aka 'std::vector<edge, std::allocator<edge> >&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:68:19: error: no matching function for call to 'std::vector<std::vector<edge, std::allocator<edge> >, std::allocator<std::vector<edge, std::allocator<edge> > > >::push_back(<brace-enclosed initializer list>)'
   68 |     e[v].push_back({u, i});
      |     ~~~~~~~~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<edge, std::allocator<edge> >; _Alloc = std::allocator<std::vector<edge, std::allocator<edge> > >; value_type = std::vector<edge, std::allocator<edge> >]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::vector<edge, std::allocator<edge> >, std::allocator<std::vector<edge, std::allocator<edge> > > >::value_type&' {aka 'const std::vector<edge, std::allocator<edge> >&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<edge, std::allocator<edge> >; _Alloc = std::allocator<std::vector<edge, std::allocator<edge> > >; value_type = std::vector<edge, std::allocator<edge> >]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::vector<edge, std::allocator<edge> >, std::allocator<std::vector<edge, std::allocator<edge> > > >::value_type&&' {aka 'std::vector<edge, std::allocator<edge> >&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~