Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

struct edge = {int to; ll a, b;};

void solve() {
	int n, m, s, t;
    cin >> n >> m >> s >> t;
    --s; --t;
    vector<edge> g[100100];
    rep(i, n) {
        int u, v; ll a, b; cin >> u >> v >> a >> b;
        --u; --v;
        g[u].pb(edge{v, a, b});
        g[v].pb(edge{u, a, b});
    }
    ll ds[100100], dt[100100];
    rep(i, 100100) {
        ds[i] = dt[i] = INF;
    }
    ds[s] = dt[t] = 0;
    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pque;
    pque.push(make_pair(0, s));
    while(pque.size()) {
        auto p = pque.top(); pque.pop();
        int from = p.sc;
        ll co = p.fr;
        for(auto&e : g[from]) {
            int to = e.to;
            ll a = e.a;
            if(ds[to] > ds[from] + a) {
                ds[to] = ds[from] + a;
                pque.push(make_pair(ds[to], to));
            }
        }
    }

    pque.push(make_pair(0, t));
    while(pque.size()) {
        auto p = pque.top(); pque.pop();
        int from = p.sc;
        ll co = p.fr;
        for(auto&e : g[from]) {
            int to = e.to;
            ll b = e.b;
            if(dt[to] > dt[from] + b) {
                dt[to] = dt[from] + b;
                pque.push(make_pair(dt[to], to));
            }
        }
    }

    vector<ll> res(n, 1e+15);
    rep(i, n) {
        res[i] -= (ds[i] + dt[i]);
    }
    vector<ll> ans(n);
    ans[n - 1] = res[n - 1];
    per(i, n - 1) {
        ans[i] = max(ans[i + 1], ans[i])
    }
    rep(i, n) {
        cout << ans[i] << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Compiler output:
a.cc:52:13: error: expected unqualified-id before '=' token
   52 | struct edge = {int to; ll a, b;};
      |             ^
a.cc: In function 'void solve()':
a.cc:62:29: error: too many initializers for 'edge'
   62 |         g[u].pb(edge{v, a, b});
      |                             ^
a.cc:63:29: error: too many initializers for 'edge'
   63 |         g[v].pb(edge{u, a, b});
      |                             ^
a.cc:77:22: error: invalid use of incomplete type 'struct edge'
   77 |             int to = e.to;
      |                      ^
a.cc:52:8: note: forward declaration of 'struct edge'
   52 | struct edge = {int to; ll a, b;};
      |        ^~~~
a.cc:78:20: error: invalid use of incomplete type 'struct edge'
   78 |             ll a = e.a;
      |                    ^
a.cc:52:8: note: forward declaration of 'struct edge'
   52 | struct edge = {int to; ll a, b;};
      |        ^~~~
a.cc:92:22: error: invalid use of incomplete type 'struct edge'
   92 |             int to = e.to;
      |                      ^
a.cc:52:8: note: forward declaration of 'struct edge'
   52 | struct edge = {int to; ll a, b;};
      |        ^~~~
a.cc:93:20: error: invalid use of incomplete type 'struct edge'
   93 |             ll b = e.b;
      |                    ^
a.cc:52:8: note: forward declaration of 'struct edge'
   52 | struct edge = {int to; ll a, b;};
      |        ^~~~
a.cc:108:41: error: expected ';' before '}' token
  108 |         ans[i] = max(ans[i + 1], ans[i])
      |                                         ^
      |                                         ;
  109 |     }
      |     ~                                    
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = edge; _Alloc = std::allocator<edge>]':
/usr/include/c++/14/bits/stl_vector.h:531:7:   required from here
  531 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:369:49: error: invalid use of incomplete type 'struct edge'
  369 |                       _M_impl._M_end_of_storage - _M_impl._M_start);
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
a.cc:52:8: note: forward declaration of 'struct edge'
   52 | struct edge = {int to; ll a, b;};
      |        ^~~~
In file included from /usr/include/c++/14/string:48,
                 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_iterator.h: In instantiation of '__gnu_cxx::__normal_iterator<_Iterator, _Container>& __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator++() [with _Iterator = edge*; _Container = std::vector<edge>]':
a.cc:76:28:   required from here
   76 |         for(auto&e : g[from]) {
      |                            ^
/usr/include/c++/14/bits/stl_iterator.h:1102:11: error: cannot increment a pointer to incomplete type 'edge'
 1102 |         ++_M_current;
      |           ^~~~~~~~~~
In file included from /usr/include/c++/14/bits/move.h:37,
                 from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/type_traits: In instantiation of 'struct std::is_destructible<edge>':
/usr/include/c++/14/bits/stl_construct.h:188:51:   required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = edge*]'
  188 |       static_assert(is_destructible<_Value_type>::value,
      |                                                   ^~~~~
/usr/include/c++/14/bits/alloc_traits.h:993:20:   required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator, allocator<_T2>&) [with _ForwardIterator = edge*; _Tp = edge]'
  993 |       std::_Destroy(__first, __last);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:735:15:   required from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = edge; _Alloc = std::allocator<edge>]'
  735 |         std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
      |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  736 |                       _M_get_Tp_allocator());
      |                       ~~~~~~~~~~~~~~~~~~~~~~
a.cc:58:26:   required from here
   58 |     vector<edge> g[100100];
      |                          ^
/usr/include/c++/14/type_traits:1049:52: error: static assertion failed: template argument must be a complete class or an unbounded array
 1049 |       static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/type_traits:1049:52: note: 'std::__is_complete_or_unbounded<__type_identity<edge> >((std::__type_identity<edge>(), std::__type_identity<edge>()))' evaluates to false
In file included from /usr/include/c++/14/bits/alloc_traits.h:33,
                 from /usr/include/c++/14/ext/alloc_traits.h:34,
                 from /usr/include/c++/14/bits/basic_string.h:39,
                 from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/stl_construct.h: In instantiation of 'void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = edge*]':
/usr/include/c++/14/bits/alloc_traits.h:993:20:   required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator, allocator<_T2>&) [with _ForwardIterator = edge*; _Tp = edge]'
  993 |       std::_Destroy(__first, __last);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:735:15:   required from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = edge; _Alloc = std::allocator<edge>]'
  735 |         std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
      |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  736 |                       _M_get_Tp_allocator());
      |                       ~~~~~~~~~~~~~~~~~~~~~~
a.cc:58:26:   required from here
   58 |     vector<edge> g[100100];
      |                          ^
/usr/include/c++/14/bits/stl_construct.h:188:51: error: static assertion failed: value type is destructible
  188 |       static_assert(is_destructible<_Value_type>::value,
      |                                                   ^~~~~
/usr/include/c++/14/bits/stl_construct.h:188:51: note: 'std::integral_constant<bool, false>::value' evaluates to false
/usr/include/c++/14/bits/stl_construct.h:195:25: error: invalid use of incomplete type 'std::iterator_traits<edge*>::value_type' {aka 'struct edge'}
  195 |       std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:52:8: note: forward declaration of 'std::iterator_traits<edge*>::value_type' {aka 'struct edge'}
   52 | struct edge = {int to; ll a, b;};
      |        ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33,
                 from /usr/include/c++/14/bits/allocator.h:46,
                 from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::deallocate(_Tp*, size_type) [with _Tp = edge; size_type = long unsigned int]':
/usr/include/c++/14/bits/alloc_traits.h:550:23:   required from 'static void std::allocator_traits<std::allocator<_CharT> >::deallocate(allocator_type&, pointer, size_type) [with _Tp = edge; allocator_type = std::allocator<edge>; pointer = edge*; size_type = long unsigned int]'
  550 |       { __a.deallocate(__p, __n); }
      |         ~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:389:19:   required from 'void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(pointer, std::size_t) [with _Tp = edge; _Alloc = std::allocator<edge>; pointer = edge*; std::size_t = long unsigned int]'
  389 |           _Tr::deallocate(_M_impl, __p, __n);
      |           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:368:2:   required from 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = edge; _Alloc = std::allocator<edge>]'
  368 |         _M_deallocate(_M_impl._M_start,
      |         ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7:   required from here
  531 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/14/bits/new_allocator.h:165:13: error: invalid application of '__alignof__' to incomplete type 'edge'
  165 |         if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
      |             ^~~~~~~~~~~~
/usr/include/c++/14/bits/new_allocator.h:167:38: error: invalid application of 'sizeof' to incomplete type 'edge'
  167 |             _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n),
      |                                      ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/new_allocator.h:168:55: error: invalid application of '__alignof__' to incomplete type 'edge'
  168 |                                      std::align_val_t(alignof(_Tp)));
      |                                                       ^~~~~~~~~~~~
/usr/include/c++/14/bits/new_allocator.h:172:34: error: invalid application of 'sizeof' to incomplete type 'edge'
  172 |         _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
      |                                  ^~~~~~~~~~~~~~~~~~~~~~