Buggy python submission (verdict: Time Limit Exceeded):
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
from heapq import heappush, heappop
import sys
input = sys.stdin.readline

money = 10**15
N, M, s, t = map(int, input().split())
s -= 1; t -= 1
data1 = []; row1 = []; col1 = []
data2 = []; row2 = []; col2 = []
for i in range(M):
  u, v, a, b = map(int, input().split())
  u -= 1; v -= 1
  data1 += [a]; data2 += [b]
  row1 += [u]; row2 += [u]
  col1 += [v]; col2 += [v]

graph1 = csr_matrix((data1, (row1, col1)), shape=(N, N))
graph2 = csr_matrix((data2, (row2, col2)), shape=(N, N))
dist1 = dijkstra(graph1, indices=s, directed=False).astype(int)
dist2 = dijkstra(graph2, indices=t, directed=False).astype(int)

value = [dist1[i]+dist2[i] for i in range(N)]
ans = []
cost = []
for i in range(N-1, -1, -1):
  heappush(cost, value[i])
  ans.append(money - cost[0])

print(*(ans[::-1]), sep='\n')

Fixed submission:
from heapq import heappush, heappop

money = 10**15
N, M, s, t = map(int, input().split())
s -= 1; t -= 1
graph = [[[] for i in range(N)] for _ in range(2)]
for i in range(M):
  u, v, a, b = map(int, input().split())
  u -= 1; v -= 1
  graph[0][u].append((v, a)); graph[0][v].append((u, a))
  graph[1][u].append((v, b)); graph[1][v].append((u, b))


def dijkstra(s, mode):
  dist = [-1] * N
  dist[s] = 0
  e = []
  for child, cost in graph[mode][s]:
    heappush(e, (cost, child))
  while e:
    cost, node = heappop(e)
    if dist[node] >= 0:
      continue
    dist[node] = cost
    for child, c in graph[mode][node]:
      if dist[child] >= 0:
        continue
      heappush(e, (cost+c, child))
  return dist
  
dist = [dijkstra(s, 0), dijkstra(t, 1)]  
value = [dist[0][i]+dist[1][i] for i in range(N)]

ans = []
cost = []
for i in range(N-1, -1, -1):
  heappush(cost, value[i])
  ans.append(money - cost[0])

print(*(ans[::-1]), sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
from heapq import heappush, heappop

money = 10**15
N, M, s, t = map(int, input().split())
s -= 1; t -= 1
data1 = []; row1 = []; col1 = []
data2 = []; row2 = []; col2 = []
for i in range(M):
  u, v, a, b = map(int, input().split())
  u -= 1; v -= 1
  data1 += [a]; data2 += [b]
  row1 += [u]; row2 += [u]
  col1 += [v]; col2 += [v]

graph1 = csr_matrix((data1, (row1, col1)), shape=(N, N))
graph2 = csr_matrix((data2, (row2, col2)), shape=(N, N))
dist1 = dijkstra(graph1, indices=s, directed=False).astype(int)
dist2 = dijkstra(graph2, indices=t, directed=False).astype(int)

value = [dist1[i]+dist2[i] for i in range(N)]
ans = []
cost = []
for i in range(N-1, -1, -1):
  heappush(cost, value[i])
  ans.append(money - cost[0])

print(*(ans[::-1]), sep='\n')

Fixed submission:
from heapq import heappush, heappop

money = 10**15
N, M, s, t = map(int, input().split())
s -= 1; t -= 1
graph = [[[] for i in range(N)] for _ in range(2)]
for i in range(M):
  u, v, a, b = map(int, input().split())
  u -= 1; v -= 1
  graph[0][u].append((v, a)); graph[0][v].append((u, a))
  graph[1][u].append((v, b)); graph[1][v].append((u, b))


def dijkstra(s, mode):
  dist = [-1] * N
  dist[s] = 0
  e = []
  for child, cost in graph[mode][s]:
    heappush(e, (cost, child))
  while e:
    cost, node = heappop(e)
    if dist[node] >= 0:
      continue
    dist[node] = cost
    for child, c in graph[mode][node]:
      if dist[child] >= 0:
        continue
      heappush(e, (cost+c, child))
  return dist
  
dist = [dijkstra(s, 0), dijkstra(t, 1)]  
value = [dist[0][i]+dist[1][i] for i in range(N)]

ans = []
cost = []
for i in range(N-1, -1, -1):
  heappush(cost, value[i])
  ans.append(money - cost[0])

print(*(ans[::-1]), sep='\n')