Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
INF=10**20
N,M,S,T=[int(a) for a in input().split(" ")]
UVAB=[[int(a) for a in input().split(" ")] for i in range(M)]

def dijkstra(S, N, paths):
    from heapq import heappush,heappop
    q=[(0,S)]
    check=[False]*N
    shortest=[INF]*N
    shortest[S]=0
    while len(q)>0:
        d0, src=heappop(q)
        if d0>shortest[src]:
            continue
        check[src]=True
        for dst, d1 in paths[src]:
            if check[dst] is False and d0+d1<shortest[dst]:
                shortest[dst]=d0+d1
                heappush(q, (d0+d1, dst))
        if all(check):
            break
    return np.array(shortest)

paths_yn=[[] for _ in range(N)]
paths_sn=[[] for _ in range(N)]
for u,v,a,b in UVAB:
    paths_yn[u-1].append((v-1,a))
    paths_yn[v-1].append((u-1,a))
    paths_sn[u-1].append((v-1,b))
    paths_sn[v-1].append((u-1,b))
shortest_yn = dijkstra(S-1, N, paths_yn)
shortest_sn = dijkstra(T-1, N, paths_sn)

totals = 10**15-(shortest_yn+shortest_sn)
for a in np.maximum.accumulate(totals[::-1])[::-1]:
    print(int(a))

Fixed submission:
import numpy as np
INF=10**20
N,M,S,T=[int(a) for a in input().split(" ")]
UVAB=[[int(a) for a in input().split(" ")] for i in range(M)]

def dijkstra(S, N, paths):
    from heapq import heappush,heappop
    q=[(0,S)]
    shortest=[INF]*N
    shortest[S]=0
    while len(q)>0:
        d0, src=heappop(q)
        if d0>shortest[src]:
            continue
        for dst, d1 in paths[src]:
            if d0+d1<shortest[dst]:
                shortest[dst]=d0+d1
                heappush(q, (d0+d1, dst))
    return np.array(shortest)

paths_yn=[[] for _ in range(N)]
paths_sn=[[] for _ in range(N)]
for u,v,a,b in UVAB:
    paths_yn[u-1].append((v-1,a))
    paths_yn[v-1].append((u-1,a))
    paths_sn[u-1].append((v-1,b))
    paths_sn[v-1].append((u-1,b))
shortest_yn = dijkstra(S-1, N, paths_yn)
shortest_sn = dijkstra(T-1, N, paths_sn)

totals = 10**15-(shortest_yn+shortest_sn)
for a in np.maximum.accumulate(totals[::-1])[::-1]:
    print(int(a))

Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappush, heappop, heapify
from collections import defaultdict
N,M,S,T=[int(a) for a in input().split(" ")]
S,T=S-1,T-1
UVAB = [[int(a) for a in input().split(" ")] for i in range(M)]
dic = defaultdict(list)
INF = 10**20

for u, v, a, b in UVAB:
    dic[u-1].append((v-1,a))
    dic[v-1].append((u-1,a))
    dic[u+N-1].append((v+N-1,b))
    dic[v+N-1].append((u+N-1,b))

ans = []
for i in list(range(N))[::-1]:
    dic[i].append((i+N,0))
    dic_dist = defaultdict(lambda: INF)
    dic_dist[S] = 0
    q = [(0, S)]
    while(q):
        d0, node = heappop(q)
        if dic_dist[node] < d0:
            continue
        for dst, d1 in dic[node]:
            if dic_dist[dst] > d0+d1:
                dic_dist[dst] = d0+d1
                heappush(q, (d0+d1, dst))
    ans.append(10**15-dic_dist[T+N])

for line in ans[::-1]:
    print(line)


Fixed submission:
import numpy as np
INF=10**20
N,M,S,T=[int(a) for a in input().split(" ")]
UVAB=[[int(a) for a in input().split(" ")] for i in range(M)]

def dijkstra(S, N, paths):
    from heapq import heappush,heappop
    q=[(0,S)]
    shortest=[INF]*N
    shortest[S]=0
    while len(q)>0:
        d0, src=heappop(q)
        if d0>shortest[src]:
            continue
        for dst, d1 in paths[src]:
            if d0+d1<shortest[dst]:
                shortest[dst]=d0+d1
                heappush(q, (d0+d1, dst))
    return np.array(shortest)

paths_yn=[[] for _ in range(N)]
paths_sn=[[] for _ in range(N)]
for u,v,a,b in UVAB:
    paths_yn[u-1].append((v-1,a))
    paths_yn[v-1].append((u-1,a))
    paths_sn[u-1].append((v-1,b))
    paths_sn[v-1].append((u-1,b))
shortest_yn = dijkstra(S-1, N, paths_yn)
shortest_sn = dijkstra(T-1, N, paths_sn)

totals = 10**15-(shortest_yn+shortest_sn)
for a in np.maximum.accumulate(totals[::-1])[::-1]:
    print(int(a))