Buggy python submission (verdict: Runtime Error):
de main():
    import sys
    from collections import deque
    input = sys.stdin.buffer.readline
    
    
    def bfs(v):
        dist = [f_inf for _ in range(n)]
        dist[v] = 0
        q = deque()
        q.append(v)
        while q:
            u = q.popleft()
            for nv in tree[u]:
                if dist[nv] == f_inf:
                    dist[nv] = dist[u] + 1
                    q.append(nv)
        for d in dist:
            res[d] += 1
    
    
    n, x, y = map(int, input().split())
    
    tree = [[] for _ in range(n)]
    for i in range(n - 1):
        tree[i].append(i + 1)
        tree[i + 1].append(i)
    tree[x - 1].append(y - 1)
    tree[y - 1].append(x - 1)
    
    f_inf = float("inf")
    res = [0 for _ in range(n)]
    for i in range(n):
        bfs(i)
    
    for i in range(1, n):
        print(res[i] // 2)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    import sys
    from collections import deque
    input = sys.stdin.buffer.readline


    def bfs(v):
        dist = [f_inf for _ in range(n)]
        dist[v] = 0
        q = deque()
        q.append(v)
        while q:
            u = q.popleft()
            for nv in tree[u]:
                if dist[nv] == f_inf:
                    dist[nv] = dist[u] + 1
                    q.append(nv)
        for d in dist:
            res[d] += 1


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

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

    f_inf = float("inf")
    res = [0 for _ in range(n)]
    for i in range(n):
        bfs(i)

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

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque
input = sys.stdin.buffer.readline


def bfs(v):
    dist = [f_inf for _ in range(n)]
    dist[v] = 0
    q = deque()
    q.append(v)
    while q:
        u = q.popleft()
        for nv in tree[u]:
            if dist[nv] == f_inf:
                dist[nv] = dist[u] + 1
                q.append(nv)
    for d in dist:
        res[d] += 1


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

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

f_inf = float("inf")
res = [0 for _ in range(n)]
for i in range(n):
    bfs(i)

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


Fixed submission:
def main():
    import sys
    from collections import deque
    input = sys.stdin.buffer.readline


    def bfs(v):
        dist = [f_inf for _ in range(n)]
        dist[v] = 0
        q = deque()
        q.append(v)
        while q:
            u = q.popleft()
            for nv in tree[u]:
                if dist[nv] == f_inf:
                    dist[nv] = dist[u] + 1
                    q.append(nv)
        for d in dist:
            res[d] += 1


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

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

    f_inf = float("inf")
    res = [0 for _ in range(n)]
    for i in range(n):
        bfs(i)

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

if __name__ == '__main__':
    main()