Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <cstdlib>

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

int main() {
    int n = ri();
	int m = ri();
	int s = ri()-1;
	int t = ri()-1;
	vector<pair<int,int> > hen_0[n];
	vector<pair<int,int> > hen_1[n];
	FOR(i,m) {
		int a = ri()-1;
		int b = ri()-1;
		int c = ri();
		int d = ri();
		hen_0[a].push_back(pi(b,c));
		hen_0[b].push_back(pi(a,c));
		hen_1[a].push_back(pi(b,d));
		hen_1[b].push_back(pi(a,d));
	}
	s64 res0[n]; // from s
	s64 res1[n]; // from t
	FOR(i,n) res0[i] = LINF, res1[i] = LINF;
	res0[s] = 0;
	res1[t] = 0;
	// 0
	priority_queue<pair<s64, int>, vector<pair<s64, int> >, greater<pair<s64,int> > > que;
	que.push(pair<s64,int>(0,s));
	while(que.size()) {
		auto i = que.top(); que.pop();
		for (auto& j : hen_0[i.se]) {
			if (res0[j.fi] > i.fi + j.se) {
				res0[j.fi] = i.fi + j.se;
				que.push(pair<s64,int>(res0[j.fi], j.fi));
			}
		}
	}
	// 1
	que.push(pair<s64,int>(0,t));
	while(que.size()) {
		auto i = que.top(); que.pop();
		for (auto& j : hen_1[i.se]) {
			if (res1[j.fi] > i.fi + j.se) {
				res1[j.fi] = i.fi + j.se;
				que.push(pair<s64,int>(res1[j.fi], j.fi));
			}
		}
	}
	
	s64 mini[n];
	DOWN(i,n) {
		if (i == n-1) mini[i] = res0[i] + res1[i];
		else mini[i] = min(mini[i+1], res0[i] + res1[i]);
	}
	FOR(i,n) {
		cout << 1000000000000000LL-mini[i] << endl;
	}
    return 0;
}


Compiler output:
a.cc:38:9: error: 'uint8_t' does not name a type
   38 | typedef uint8_t u8;
      |         ^~~~~~~
a.cc:6:1: note: 'uint8_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    5 | #include <cstdlib>
  +++ |+#include <cstdint>
    6 | 
a.cc:39:9: error: 'uint16_t' does not name a type
   39 | typedef uint16_t u16;
      |         ^~~~~~~~
a.cc:39:9: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:40:9: error: 'uint32_t' does not name a type
   40 | typedef uint32_t u32;
      |         ^~~~~~~~
a.cc:40:9: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:41:9: error: 'uint64_t' does not name a type
   41 | typedef uint64_t u64;
      |         ^~~~~~~~
a.cc:41:9: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc: In constructor 'Comb::Comb(int)':
a.cc:51:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   51 |         UPTO(i,1,n) {
      |              ^
a.cc:21:49: note: in definition of macro 'UPTO'
   21 | #define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
      |                                                 ^~~
a.cc:52:17: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   52 |             FOR(j,i+1) {
      |                 ^
a.cc:21:49: note: in definition of macro 'UPTO'
   21 | #define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
      |                                                 ^~~
a.cc:52:13: note: in expansion of macro 'FOR'
   52 |             FOR(j,i+1) {
      |             ^~~
a.cc: In function 'int main()':
a.cc:84:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   84 |         FOR(i,m) {
      |             ^
a.cc:21:49: note: in definition of macro 'UPTO'
   21 | #define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
      |                                                 ^~~
a.cc:84:9: note: in expansion of macro 'FOR'
   84 |         FOR(i,m) {
      |         ^~~
a.cc:96:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   96 |         FOR(i,n) res0[i] = LINF, res1[i] = LINF;
      |             ^
a.cc:21:49: note: in definition of macro 'UPTO'
   21 | #define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
      |                                                 ^~~
a.cc:96:9: note: in expansion of macro 'FOR'
   96 |         FOR(i,n) res0[i] = LINF, res1[i] = LINF;
      |         ^~~
a.cc:124:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  124 |         DOWN(i,n) {
      |              ^
a.cc:22:49: note: in definition of macro 'DOWNTO'
   22 | #define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
      |                                                 ^~~
a.cc:124:9: note: in expansion of macro 'DOWN'
  124 |         DOWN(i,n) {
      |         ^~~~
a.cc:128:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  128 |         FOR(i,n) {
      |             ^
a.cc:21:49: note: in definition of macro 'UPTO'
   21 | #define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
      |                                                 ^~~
a.cc:128:9: note: in expansion of macro 'FOR'
  128 |         FOR(i,n) {
      |         ^~~