Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappush, heappop
from collections import defaultdict

n, m, s, t = map(int, input().split())
y = 10**15


class Graph(object):
    def __init__(self):
        self.graph = defaultdict(list)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))


class Dijkstra(object):
    def __init__(self, graph, start):
        self.g = graph.graph

        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    heappush(self.Q, (alt, v))


yen_g = Graph()
sno_g = Graph()
for _ in range(m):
    u, v, a, b = map(int, input().split())
    yen_g.add_edge(u, v, a)
    yen_g.add_edge(v, u, a)
    sno_g.add_edge(u, v, b)
    sno_g.add_edge(v, u, b)

cost = [0] * n
yen_d = Dijkstra(yen_g, s)
sno_d = Dijkstra(sno_g, t)
for i in range(1, n + 1):
    cost[i - 1] = yen_d.dist[i] + sno_d.dist[i]

for i in range(n):
    print(y - min(cost[i:]))


Fixed submission:
from heapq import heappush, heappop
from collections import defaultdict

n, m, s, t = map(int, input().split())
y = 10**15


class Graph(object):
    def __init__(self):
        self.graph = defaultdict(list)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))


class Dijkstra(object):
    def __init__(self, graph, start):
        self.g = graph.graph

        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    heappush(self.Q, (alt, v))


yen_g = Graph()
sno_g = Graph()
for _ in range(m):
    u, v, a, b = map(int, input().split())
    yen_g.add_edge(u, v, a)
    yen_g.add_edge(v, u, a)
    sno_g.add_edge(u, v, b)
    sno_g.add_edge(v, u, b)

cost = [0] * n
yen_d = Dijkstra(yen_g, s)
sno_d = Dijkstra(sno_g, t)
for i in range(1, n + 1):
    cost[i - 1] = y - (yen_d.dist[i] + sno_d.dist[i])

ans = [y] * n
ans[n - 1] = cost[n - 1]
for i in range(n - 2, -1, -1):
    ans[i] = max(ans[i + 1], cost[i])

for a in ans:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
from collections import defaultdict

n, m, s, t = map(int, input().split())
X = [tuple(map(int, input().split())) for _ in range(m)]
y = 10**15


class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    """
    ダイクストラ法（二分ヒープ）による最短経路探索
    計算量: O((E+V)logV)
    """

    def __init__(self, graph, start):
        self.g = graph.graph

        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0
        self.prev = defaultdict(lambda: None)

        self.Q = []
        heapq.heappush(self.Q, (self.dist[start], start))

        while self.Q:
            dist_u, u = heapq.heappop(self.Q)
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heapq.heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        return self.dist[goal]

    def shortest_path(self, goal):
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]


cost = [0] * n

g = Graph()
for u, v, a, b in X:
    g.add_edge(u, v, a)
    g.add_edge(v, u, a)
d = Dijkstra(g, s)
for i in range(1, n + 1):
    cost[i - 1] += d.shortest_distance(i)

g = Graph()
for u, v, a, b in X:
    g.add_edge(u, v, b)
    g.add_edge(v, u, b)
d = Dijkstra(g, t)
for i in range(1, n + 1):
    cost[i - 1] += d.shortest_distance(i)

for i in range(n):
    print(y - min(cost[i:]))


Fixed submission:
from heapq import heappush, heappop
from collections import defaultdict

n, m, s, t = map(int, input().split())
y = 10**15


class Graph(object):
    def __init__(self):
        self.graph = defaultdict(list)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))


class Dijkstra(object):
    def __init__(self, graph, start):
        self.g = graph.graph

        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    heappush(self.Q, (alt, v))


yen_g = Graph()
sno_g = Graph()
for _ in range(m):
    u, v, a, b = map(int, input().split())
    yen_g.add_edge(u, v, a)
    yen_g.add_edge(v, u, a)
    sno_g.add_edge(u, v, b)
    sno_g.add_edge(v, u, b)

cost = [0] * n
yen_d = Dijkstra(yen_g, s)
sno_d = Dijkstra(sno_g, t)
for i in range(1, n + 1):
    cost[i - 1] = y - (yen_d.dist[i] + sno_d.dist[i])

ans = [y] * n
ans[n - 1] = cost[n - 1]
for i in range(n - 2, -1, -1):
    ans[i] = max(ans[i + 1], cost[i])

for a in ans:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

n, m, s, t = map(int, input().split())
X = [tuple(map(int, input().split())) for _ in range(m)]
y = 10 ** 15


class DijkstraAlgorithm(object):
    def __init__(self, edges, directed=False, start_node=0):
        self.nodes = self.edge_to_node(edges, directed)
        self.nodes[start_node]['cost'] = 0

    def run(self):
        while True:
            # 確定ノードを探索
            doneNode = None
            for node in self.nodes.values():
                if node['done'] or node['cost'] < 0:
                    continue
                if doneNode is None or node['cost'] < doneNode['cost']:
                    doneNode = node
            if doneNode is None:
                break

            doneNode['done'] = True

            # 接続先ノードの情報更新
            for i in range(len(doneNode['edges_to'])):
                to = doneNode['edges_to'][i]
                cost = doneNode['cost'] + doneNode['edges_cost'][i]
                self.nodes[to]['cost'] = min(self.nodes[to]['cost'], cost)

    def shortest_distance(self, goal_node):
        self.run()
        return self.nodes[goal_node]['cost']

    def edge_to_node(self, edges, directed):
        nodes = defaultdict(
            lambda: {'edges_to': [], 'edges_cost': [], 'done': False, 'cost': float('inf')})
        for i, j, k in edges:
            nodes[i]['edges_to'].append(j)
            nodes[i]['edges_cost'].append(k)

            if not directed:
                nodes[j]['edges_to'].append(i)
                nodes[j]['edges_cost'].append(k)
        return nodes


cost = [0] * n

edges = [(u, v, a) for u, v, a, b in X]
da = DijkstraAlgorithm(edges, start_node=s)
for i in range(1, n + 1):
    cost[i - 1] += da.shortest_distance(i)

edges = [(u, v, b) for u, v, a, b in X]
da = DijkstraAlgorithm(edges, start_node=t)
for i in range(1, n + 1):
    cost[i - 1] += da.shortest_distance(i)

for i in range(n):
    print(y - min(cost[i:]))


Fixed submission:
from heapq import heappush, heappop
from collections import defaultdict

n, m, s, t = map(int, input().split())
y = 10**15


class Graph(object):
    def __init__(self):
        self.graph = defaultdict(list)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))


class Dijkstra(object):
    def __init__(self, graph, start):
        self.g = graph.graph

        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    heappush(self.Q, (alt, v))


yen_g = Graph()
sno_g = Graph()
for _ in range(m):
    u, v, a, b = map(int, input().split())
    yen_g.add_edge(u, v, a)
    yen_g.add_edge(v, u, a)
    sno_g.add_edge(u, v, b)
    sno_g.add_edge(v, u, b)

cost = [0] * n
yen_d = Dijkstra(yen_g, s)
sno_d = Dijkstra(sno_g, t)
for i in range(1, n + 1):
    cost[i - 1] = y - (yen_d.dist[i] + sno_d.dist[i])

ans = [y] * n
ans[n - 1] = cost[n - 1]
for i in range(n - 2, -1, -1):
    ans[i] = max(ans[i + 1], cost[i])

for a in ans:
    print(a)