Buggy python submission (verdict: Time Limit Exceeded):
import heapq
# 単一始点最短経路。2地点間ではなく、始点が一つで各点へのコストを計算する
# eは隣接リストでe[v] = [(u1,cost1), (u2,cost2)]みたいな形を想定
# 辺の重みは正である必要がある
# O(ElogV)
def dijkstra(e,n,s):
    inf = 10**18
    d = [inf]*n
    d[s] = 0

    q = [(d[s],s)] # priority queueのソートキーが第一要素
    heapq.heapify([q])
    while len(q)>0:
        _,v = heapq.heappop(q)
        for u,c in e[v]:
            if d[v]+c>=d[u]:
                continue
            d[u] = d[v] + c
            heapq.heappush(q, (d[u],u))
    return d

n,x,y = map(int, input().split())

g = [[] for _ in range(n)]
for i in range(n-1):
    g[i].append((i+1,1))
    g[i+1].append((i,1))
g[x-1].append((y-1,1))
g[y-1].append((x-1,1))
    

res = [0]*n
for i in range(n):
    d = dijkstra(g,n,i)
    for j in range(i+1,n):
        res[d[j]] += 1

for i in range(1,n):
    print(res[i])


Fixed submission:
n, x, y = map(int, input().split())
ans = [0 for i in range(n)]
x -= 1
y -= 1
for i in range(n):
    for j in range(i+1, n):
        cand1 = j - i
        cand2 = abs(x - i) + 1 + abs(y-j)
        ans[min(cand1, cand2)] += 1

for item in ans[1:]:
    print(item)

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

INF = float('inf')

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    h = []
    heappush(h, (0, s))

    while h:
        # 使っていない頂点のうち、現時点で最も距離の近いものを選びvとする
        d, v = heappop(h)
        if dist[v] < d:
            continue
        # vから到達可能な頂点について、距離が短くなれば更新
        for b, cost in G[v]:
            if dist[b] > dist[v] + cost:
                dist[b] = dist[v] + cost
                heappush(h, (dist[b], b))
    return dist

n, x, y = map(int, input().split())

g = [[] for i in range(n)]

for i in range(n-1):
    g[i].append((i+1, 1))
    g[i+1].append((i, 1))

g[x-1].append((y-1, 1))
g[y-1].append((x-1, 1))

ans = [0] * n

for i in range(n):
    for d in dijkstra(n, g, i):
        ans[d] += 1

for item in ans[1:]:
    print(item // 2)



Fixed submission:
n, x, y = map(int, input().split())
ans = [0 for i in range(n)]
x -= 1
y -= 1
for i in range(n):
    for j in range(i+1, n):
        cand1 = j - i
        cand2 = abs(x - i) + 1 + abs(y-j)
        ans[min(cand1, cand2)] += 1

for item in ans[1:]:
    print(item)

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

INF = float('inf')

class Edge():
    def __init__(self, a, b, cost):
        self.a = a
        self.b = b
        self.cost = cost
    def __str__(self):
        return 'Edge: {} -> {}, cost {}'.format(self.a, self.b, self.cost)

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    h = []
    heapq.heappush(h, (0, s))

    while h:
        # 使っていない頂点のうち、現時点で最も距離の近いものを選びvとする
        d, v = heapq.heappop(h)
        if dist[v] < d:
            continue
        # vから到達可能な頂点について、距離が短くなれば更新
        for e in G[v]:
            if dist[e.b] > dist[v] + e.cost:
                dist[e.b] = dist[v] + e.cost
                heapq.heappush(h, (dist[e.b], e.b))
    return dist

n, x, y = map(int, input().split())

g = [[] for i in range(n)]

for i in range(n-1):
    g[i].append(Edge(i, i+1, 1))
    g[i+1].append(Edge(i+1, i, 1))

g[x-1].append(Edge(x-1, y-1, 1))
g[y-1].append(Edge(y-1, x-1, 1))

ans = [0] * n

for i in range(n):
    for d in dijkstra(n, g, i):
        ans[d] += 1

for item in ans[1:]:
    print(item // 2)



Fixed submission:
n, x, y = map(int, input().split())
ans = [0 for i in range(n)]
x -= 1
y -= 1
for i in range(n):
    for j in range(i+1, n):
        cand1 = j - i
        cand2 = abs(x - i) + 1 + abs(y-j)
        ans[min(cand1, cand2)] += 1

for item in ans[1:]:
    print(item)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from scipy.sparse import csr_matrix
# from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse.csgraph import dijkstra

input = sys.stdin.readline

n, x, y = map(int, input().split())
# A,B: 頂点, C: コスト
A, B, C = [], [], []

for i in range(n-1):
    A.append(i)
    B.append(i+1)
    C.append(1)

A.append(x-1)
B.append(y-1)
C.append(1)

# directed: 有効ならTrue, indices: 始点
# WF O(V^3)
# wf = floyd_warshall(csr_matrix((C, (A, B)), shape = (n, n)), directed=False)
# Dijkstra O((V+E)logV)
ans = [0 for i in range(n-1)]

for i in range(n):
    di = dijkstra(csr_matrix((C, (A, B)), shape = (n, n)), directed=False, indices=i)
    for k in di:
        if k:
            ans[int(k-1)] += 1

for k in ans:
    print(k // 2)

Fixed submission:
n, x, y = map(int, input().split())
ans = [0 for i in range(n)]
x -= 1
y -= 1
for i in range(n):
    for j in range(i+1, n):
        cand1 = j - i
        cand2 = abs(x - i) + 1 + abs(y-j)
        ans[min(cand1, cand2)] += 1

for item in ans[1:]:
    print(item)