Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n, m, s, t = map(int, input().split())


def to_v(i, j):
    return 2*i+j


N = 2*n
edges = [[]for _ in range(N)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    edges[to_v(u, 0)].append((a, to_v(v, 0)))
    edges[to_v(v, 0)].append((a, to_v(u, 0)))
    edges[to_v(u, 1)].append((b, to_v(v, 1)))
    edges[to_v(v, 1)].append((b, to_v(u, 1)))

for u in range(n):
    edges[to_v(u, 0)].append((0, to_v(u, 1)))


def dijkstra(init_v):
    next_v = [(0, init_v)]
    INF = 10**18
    dist = [INF]*N
    dist[init_v] = 0
    while next_v:
        d, v = heapq.heappop(next_v)
        if dist[v] < d:
            continue
        for d, v2 in edges[v]:
            if dist[v2] <= dist[v]+d:
                continue
            dist[v2] = dist[v]+d
            heapq.heappush(next_v, (dist[v2], v2))
    return dist
  

for i in range(n):
    if i != 0:
        i -= 1
        edges[to_v(i, 0)].pop()
    dist = dijkstra(to_v(s-1, 0))
    print(10**15-dist[to_v(t-1, 1)])


Fixed submission:
import heapq
n, m, s, t = map(int, input().split())
edges_yen = [[]for _ in range(n)]
edges_snuuk = [[]for _ in range(n)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    edges_yen[u-1].append((a, v-1))
    edges_yen[v-1].append((a, u-1))
    edges_snuuk[u-1].append((b, v-1))
    edges_snuuk[v-1].append((b, u-1))


def dijkstra(init_v, edges):
    next_v = [(0, init_v)]
    INF = 10**18
    dist = [INF]*n
    dist[init_v] = 0
    while next_v:
        d, v = heapq.heappop(next_v)
        if dist[v] < d:
            continue
        for d, v2 in edges[v]:
            if dist[v2] <= dist[v]+d:
                continue
            dist[v2] = dist[v]+d
            heapq.heappush(next_v, (dist[v2], v2))
    return dist


dist_yen = dijkstra(s-1, edges_yen)
dist_snuuk = dijkstra(t-1, edges_snuuk)
dist = [x+y for x, y in zip(dist_yen, dist_snuuk)]
ans = []
INF = 10**18
MIN = INF
for x in dist[::-1]:
    if x < MIN:
        MIN = x
    ans.append(MIN)
for x in ans[::-1]:
    print(10**15-x)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n, m, s, t = map(int, input().split())


def to_v(i, j):
    return 2*i+j


N = 2*n
edges = [[]for _ in range(N)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    edges[to_v(u, 0)].append((a, to_v(v, 0)))
    edges[to_v(v, 0)].append((a, to_v(u, 0)))
    edges[to_v(u, 1)].append((b, to_v(v, 1)))
    edges[to_v(v, 1)].append((b, to_v(u, 1)))

for u in range(n):
    edges[to_v(u, 0)].append((0, to_v(u, 1)))


def dijkstra(init_v):
    next_v = [(0, init_v)]
    INF = 10**18
    dist = [INF]*N
    dist[init_v] = 0
    while next_v:
        d, v = heapq.heappop(next_v)
        if dist[v] < d:
            continue
        for d, v2 in edges[v]:
            if dist[v2] <= dist[v]+d:
                continue
            dist[v2] = dist[v]+d
            heapq.heappush(next_v, (dist[v2], v2))
    return dist
  

for i in range(n):
    if i != 0:
        i -= 1
        edges[to_v(i, 0)].pop()
    dist = dijkstra(to_v(s-1, 0))
    print(10**15-dist[to_v(t-1, 1)])


Fixed submission:
import heapq
n, m, s, t = map(int, input().split())
edges_yen = [[]for _ in range(n)]
edges_snuuk = [[]for _ in range(n)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    edges_yen[u-1].append((a, v-1))
    edges_yen[v-1].append((a, u-1))
    edges_snuuk[u-1].append((b, v-1))
    edges_snuuk[v-1].append((b, u-1))


def dijkstra(init_v, edges):
    next_v = [(0, init_v)]
    INF = 10**18
    dist = [INF]*n
    dist[init_v] = 0
    while next_v:
        d, v = heapq.heappop(next_v)
        if dist[v] < d:
            continue
        for d, v2 in edges[v]:
            if dist[v2] <= dist[v]+d:
                continue
            dist[v2] = dist[v]+d
            heapq.heappush(next_v, (dist[v2], v2))
    return dist


dist_yen = dijkstra(s-1, edges_yen)
dist_snuuk = dijkstra(t-1, edges_snuuk)
dist = [x+y for x, y in zip(dist_yen, dist_snuuk)]
ans = []
INF = 10**18
MIN = INF
for x in dist[::-1]:
    if x < MIN:
        MIN = x
    ans.append(MIN)
for x in ans[::-1]:
    print(10**15-x)