Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
read = sys.stdin.read

import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

def main():
  n, m, s, t = map(int, input().split())
  U, V, A, B = np.array(read().split(), dtype=np.int64).reshape(m, 4).T
  csr_yen = csr_matrix((A, (U, V)), shape=(n+1, n+1))
  csr_snuuk = csr_matrix((B, (U, V)), shape=(n+1, n+1))
  G_yen = dijkstra(csr_yen, directed=False, indices=s)
  G_snuuk = dijkstra(csr_snuuk, directed=False, indices=t)
  G = G_yen + G_snuuk
  L = []
  L_append = L.append
  U = 10**15
  now = U
  for i in range(n, 0, -1):
    now = min(now, int(G[i]))
    L_append(U-now)
  print(*L[::-1], sep="\n")
  
if __name__ == "__main__":
  main()

Fixed submission:
import sys
input = sys.stdin.buffer.readline
import heapq

def dijkstra(n, start, edge):
    dist = [float("inf")]*n
    dist[start] = 0
    que = [(0, start)]
    while que:
        d, v = heapq.heappop(que)
        if dist[v] < d:
            continue
        for nv, nd in edge[v]:
            if dist[nv] > d + nd:
                dist[nv] = d + nd
                heapq.heappush(que, (dist[nv], nv))
    return dist
    
n, m, s, t = map(int, input().split())
G_yen = [[] for _ in range(n+1)]
G_snuuk = [[] for _ in range(n+1)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    G_yen[u].append((v, a))
    G_yen[v].append((u, a))
    G_snuuk[u].append((v, b))
    G_snuuk[v].append((u, b))
dijk_yen = dijkstra(n+1, s, G_yen)
dijk_snuuk = dijkstra(n+1, t, G_snuuk)
L = []
U = 10**15
now = U
for i in range(n, 0, -1):
    now = min(now, dijk_yen[i]+dijk_snuuk[i])
    L.append(U-now)
print(*L[::-1], sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
read = sys.stdin.read

import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

def main():
  n, m, s, t = map(int, input().split())
  U, V, A, B = np.array(read().split(), dtype=np.int64).reshape(m, 4).T
  csr_yen = csr_matrix((A, (U, V)), shape=(n+1, n+1))
  csr_snuuk = csr_matrix((B, (U, V)), shape=(n+1, n+1))
  G_yen = dijkstra(csr_yen, directed=False, indices=s)
  G_snuuk = dijkstra(csr_snuuk, directed=False, indices=t)
  L = []
  L_append = L.append
  U = 10**15
  now = U
  for i in range(n, 0, -1):
    now = min(now, int(G_yen[i]+G_snuuk[i]))
    L_append(U-now)
  print(*L[::-1], sep="\n")
  
if __name__ == "__main__":
  main()

Fixed submission:
import sys
input = sys.stdin.buffer.readline
import heapq

def dijkstra(n, start, edge):
    dist = [float("inf")]*n
    dist[start] = 0
    que = [(0, start)]
    while que:
        d, v = heapq.heappop(que)
        if dist[v] < d:
            continue
        for nv, nd in edge[v]:
            if dist[nv] > d + nd:
                dist[nv] = d + nd
                heapq.heappush(que, (dist[nv], nv))
    return dist
    
n, m, s, t = map(int, input().split())
G_yen = [[] for _ in range(n+1)]
G_snuuk = [[] for _ in range(n+1)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    G_yen[u].append((v, a))
    G_yen[v].append((u, a))
    G_snuuk[u].append((v, b))
    G_snuuk[v].append((u, b))
dijk_yen = dijkstra(n+1, s, G_yen)
dijk_snuuk = dijkstra(n+1, t, G_snuuk)
L = []
U = 10**15
now = U
for i in range(n, 0, -1):
    now = min(now, dijk_yen[i]+dijk_snuuk[i])
    L.append(U-now)
print(*L[::-1], sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
read = sys.stdin.read

import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

def main():
  n, m, s, t = map(int, input().split())
  U, V, A, B = np.array(read().split(), dtype=np.int64).reshape(m, 4).T
  csr_yen = csr_matrix((A, (U, V)), shape=(n+1, n+1))
  csr_snuuk = csr_matrix((B, (U, V)), shape=(n+1, n+1))
  G_yen = dijkstra(csr_yen, directed=False, indices=s)
  G_snuuk = dijkstra(csr_snuuk, directed=False, indices=t)
  L = []
  U = 10**15
  now = U
  for i in range(n, 0, -1):
    now = min(now, int(G_yen[i]+G_snuuk[i]))
    L.append(U-now)
  print(*L[::-1], sep="\n")
  
if __name__ == "__main__":
  main()

Fixed submission:
import sys
input = sys.stdin.buffer.readline
import heapq

def dijkstra(n, start, edge):
    dist = [float("inf")]*n
    dist[start] = 0
    que = [(0, start)]
    while que:
        d, v = heapq.heappop(que)
        if dist[v] < d:
            continue
        for nv, nd in edge[v]:
            if dist[nv] > d + nd:
                dist[nv] = d + nd
                heapq.heappush(que, (dist[nv], nv))
    return dist
    
n, m, s, t = map(int, input().split())
G_yen = [[] for _ in range(n+1)]
G_snuuk = [[] for _ in range(n+1)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    G_yen[u].append((v, a))
    G_yen[v].append((u, a))
    G_snuuk[u].append((v, b))
    G_snuuk[v].append((u, b))
dijk_yen = dijkstra(n+1, s, G_yen)
dijk_snuuk = dijkstra(n+1, t, G_snuuk)
L = []
U = 10**15
now = U
for i in range(n, 0, -1):
    now = min(now, dijk_yen[i]+dijk_snuuk[i])
    L.append(U-now)
print(*L[::-1], sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
read = sys.stdin.read

import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

n, m, s, t = map(int, input().split())
U, V, A, B = np.array(read().split(), dtype=np.int64).reshape(m, 4).T
csr_yen = csr_matrix((A, (U, V)), shape=(n+1, n+1))
csr_snuuk = csr_matrix((B, (U, V)), shape=(n+1, n+1))
G_yen = dijkstra(csr_yen, directed=False, indices=s)
G_snuuk = dijkstra(csr_snuuk, directed=False, indices=t)
L = []
U = 10**15
now = U
for i in range(n, 0, -1):
  now = min(now, int(G_yen[i]+G_snuuk[i]))
  L.append(U-now)
print(*L[::-1], sep="\n")

Fixed submission:
import sys
input = sys.stdin.buffer.readline
import heapq

def dijkstra(n, start, edge):
    dist = [float("inf")]*n
    dist[start] = 0
    que = [(0, start)]
    while que:
        d, v = heapq.heappop(que)
        if dist[v] < d:
            continue
        for nv, nd in edge[v]:
            if dist[nv] > d + nd:
                dist[nv] = d + nd
                heapq.heappush(que, (dist[nv], nv))
    return dist
    
n, m, s, t = map(int, input().split())
G_yen = [[] for _ in range(n+1)]
G_snuuk = [[] for _ in range(n+1)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    G_yen[u].append((v, a))
    G_yen[v].append((u, a))
    G_snuuk[u].append((v, b))
    G_snuuk[v].append((u, b))
dijk_yen = dijkstra(n+1, s, G_yen)
dijk_snuuk = dijkstra(n+1, t, G_snuuk)
L = []
U = 10**15
now = U
for i in range(n, 0, -1):
    now = min(now, dijk_yen[i]+dijk_snuuk[i])
    L.append(U-now)
print(*L[::-1], sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
read = sys.stdin.read

import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

n, m, s, t = map(int, input().split())
U, V, A, B = np.array(read().split(), dtype=np.int64).reshape(m, 4).T
csr_yen = csr_matrix((A, (U, V)), shape=(n+1, n+1))
csr_snuuk = csr_matrix((B, (U, V)), shape=(n+1, n+1))
G_yen = dijkstra(csr_yen, directed=False, indices=s)
G_snuuk = dijkstra(csr_snuuk, directed=False, indices=t)
L = np.zeros(n, dtype=np.int64)
U = 10**15
now = U
for i in range(n, 0, -1):
  now = min(now, int(G_yen[i]+G_snuuk[i]))
  L[i-1] = U-now
print(*L, sep="\n")

Fixed submission:
import sys
input = sys.stdin.buffer.readline
import heapq

def dijkstra(n, start, edge):
    dist = [float("inf")]*n
    dist[start] = 0
    que = [(0, start)]
    while que:
        d, v = heapq.heappop(que)
        if dist[v] < d:
            continue
        for nv, nd in edge[v]:
            if dist[nv] > d + nd:
                dist[nv] = d + nd
                heapq.heappush(que, (dist[nv], nv))
    return dist
    
n, m, s, t = map(int, input().split())
G_yen = [[] for _ in range(n+1)]
G_snuuk = [[] for _ in range(n+1)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    G_yen[u].append((v, a))
    G_yen[v].append((u, a))
    G_snuuk[u].append((v, b))
    G_snuuk[v].append((u, b))
dijk_yen = dijkstra(n+1, s, G_yen)
dijk_snuuk = dijkstra(n+1, t, G_snuuk)
L = []
U = 10**15
now = U
for i in range(n, 0, -1):
    now = min(now, dijk_yen[i]+dijk_snuuk[i])
    L.append(U-now)
print(*L[::-1], sep="\n")