Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
from itertools import accumulate
import heapq
n,m,s,t=map(int, input().split())
s-=1
t-=1
yen=[[0 for _ in range(n)] for _ in range(n)]
snk=[[0 for _ in range(n)] for _ in range(n)]
adj=defaultdict(list)
for _ in range(m):
    u,v,a,b=map(int, input().split())
    u-=1    
    v-=1    
    adj[u].append(v)
    adj[v].append(u)
    yen[u][v]=a
    yen[v][u]=a
    snk[u][v]=b
    snk[v][u]=b

def dijkstra(s, t, cost):
    q=[]
    d=[float('inf')]*n
    d[s]=0
    heapq.heappush(q, (d[s], s))
    while q!=[]:
        du, u=heapq.heappop(q)
        if du>d[u]:
            continue
        for v in adj[u]:
            tmp=du+cost[u][v]
            if d[v]>tmp:
                d[v]=tmp
                heapq.heappush(q, (d[v], v))
    return d

d1=dijkstra(s, t, yen)
d2=dijkstra(t, s, snk)
snuke=[]
for d1i, d2i in zip(d1,d2):
    snuke.append(d1i+d2i)
ans=list(accumulate(reversed([y+s for y,s in zip(d1, d2)]), min))
for ai in reversed(ans):
    print(10**15-ai)


Fixed submission:
from collections import defaultdict
import heapq
n,m,s,t=map(int, input().split())
s-=1
t-=1
yen={}
snk={}
adj=defaultdict(list)
for _ in range(m):
    u,v,a,b=map(int, input().split())
    u-=1    
    v-=1    
    adj[u].append(v)
    adj[v].append(u)
    yen[(u,v)]=a
    yen[(v,u)]=a
    snk[(u,v)]=b
    snk[(v,u)]=b

def dijkstra(s, t, cost):
    q=[]
    d=[float('inf')]*n
    d[s]=0
    heapq.heappush(q, (d[s], s))
    prev={}
    while q!=[]:
        du, u=heapq.heappop(q)
        for v in adj[u]:
            if d[v]>du+cost[(u,v)]:
                d[v]=du+cost[(u,v)]
                prev[v]=u
                
                heapq.heappush(q, (d[v], v))
    return d

d1=dijkstra(s, t, yen)
d2=dijkstra(t, s, snk)
snuke=[]
for d1i, d2i in zip(d1,d2):
    snuke.append(d1i+d2i)
ans=[]
mins=float('inf')
for si in reversed(snuke):
    if si<mins:
        ans.append(si)
        mins=si
    else:
        ans.append(mins)
ans.reverse()
for ai in ans:
    print(10**15-ai)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
n,m,s,t=map(int, input().split())
s-=1
t-=1
yen={}
snk={}
adj=defaultdict(list)
for _ in range(m):
    u,v,a,b=map(int, input().split())
    u-=1    
    v-=1    
    adj[u].append(v)
    adj[v].append(u)
    yen[(u,v)]=a
    yen[(v,u)]=a
    snk[(u,v)]=b
    snk[(v,u)]=b

d=[float('inf')]*n
d[s]=0
prev={}
q=list(range(n))
while q!=[]:
    md=float('inf')    
    for qi in q:
        md=min(md,d[qi])
    u=q.pop(q.index(d.index(md)))
    for v in adj[u]:
        if d[v]>d[u]+yen[(u,v)]:
            d[v]=d[u]+yen[(u,v)]
            prev[v]=u
# tr=t
# while tr!=s:
#     print(tr,'->')
#     tr=prev[tr]
# print(s)
dr=[float('inf')]*n
dr[t]=0
prevr={}
qr=list(range(n))
while qr!=[]:
    md=float('inf')    
    for qi in qr:
        md=min(md,dr[qi])
    u=qr.pop(qr.index(dr.index(md)))
    for v in adj[u]:
        if dr[v]>dr[u]+snk[(u,v)]:
            dr[v]=dr[u]+snk[(u,v)]
            prevr[v]=u
while d!=[]:
    ans=float('inf')
    for y,s in zip(d,dr):
        ans=min(ans, y+s)
        if ans==y+s:
            ai=d.index(y)
    print(10**15-ans)
    del d[0]
    del dr[0]


Fixed submission:
from collections import defaultdict
import heapq
n,m,s,t=map(int, input().split())
s-=1
t-=1
yen={}
snk={}
adj=defaultdict(list)
for _ in range(m):
    u,v,a,b=map(int, input().split())
    u-=1    
    v-=1    
    adj[u].append(v)
    adj[v].append(u)
    yen[(u,v)]=a
    yen[(v,u)]=a
    snk[(u,v)]=b
    snk[(v,u)]=b

def dijkstra(s, t, cost):
    q=[]
    d=[float('inf')]*n
    d[s]=0
    heapq.heappush(q, (d[s], s))
    prev={}
    while q!=[]:
        du, u=heapq.heappop(q)
        for v in adj[u]:
            if d[v]>du+cost[(u,v)]:
                d[v]=du+cost[(u,v)]
                prev[v]=u
                
                heapq.heappush(q, (d[v], v))
    return d

d1=dijkstra(s, t, yen)
d2=dijkstra(t, s, snk)
snuke=[]
for d1i, d2i in zip(d1,d2):
    snuke.append(d1i+d2i)
ans=[]
mins=float('inf')
for si in reversed(snuke):
    if si<mins:
        ans.append(si)
        mins=si
    else:
        ans.append(mins)
ans.reverse()
for ai in ans:
    print(10**15-ai)