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

def main():
    n, x, y = map(int, input().split())
    cnt = [0]*n
    x -= 1
    y -= 1
    q = deque()
    
    for i in range(n):
        q.appendleft(i)
        dist = [None]*n
        dist[i] = 0
        while q:
            j = q.pop()
            d = dist[j]
            cnt[d] += 1
            if j > 0 and dist[j-1] is None:
                dist[j-1] = d+1
                q.appendleft(j-1)
            if j < n-1 and dist[j+1] is None:
                dist[j+1] = d+1
                q.appendleft(j+1)
            if j == x and dist[y] is None:
                dist[y] = d+1
                q.appendleft(y)
            elif j == y and dist[x] is None:
                dist[x] = d+1
                q.appendleft(x)
    for i in range(1, n):
        print(cnt[i]//2)
                

if __name__ == "__main__":
    main()

Fixed submission:
# D問題
from collections import deque
def main():
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1
    inf = 10**5
    ans = [0]*n
    q = deque()
    for i in range(n):
        dist = [inf]*n
        q.appendleft(i)
        dist[i] = 0
        while q:
            v = q.pop()
            d = dist[v]
            if v-1 >= 0 and dist[v-1] == inf:
                q.appendleft(v-1)
                dist[v-1] = d+1
            if v+1 <= n-1 and dist[v+1] == inf:
                q.appendleft(v+1)
                dist[v+1] = d+1
            if v == x and dist[y] == inf:
                q.appendleft(y)
                dist[y] = d + 1
            if v == y and  dist[x] == inf:
                q.appendleft(x)
                dist[x] = d + 1
        for di in dist:
            ans[di] += 1
    for a in ans[1:]:
        print(a//2)

if __name__ == "__main__":
    main()

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

def main():
    n, x, y = map(int, input().split())
    cnt = [0]*n
    q = deque()
    
    for i in range(n):
        q.appendleft([i, 0])
        dist = [None]*n
        dist[i] = 0
        while q:
            j, d = q.pop()
            cnt[d] += 1
            if j > 0 and dist[j-1] is None:
                dist[j-1] = d+1
                q.appendleft([j-1, d+1])
            if j < n-1 and dist[j+1] is None:
                dist[j+1] = d+1
                q.appendleft([j+1, d+1])
            if j == x-1 and dist[y-1] is None:
                dist[y-1] = d+1
                q.appendleft([y-1, d+1])
            elif j == y-1 and dist[x-1] is None:
                dist[x-1] = d+1
                q.appendleft([x-1, d+1])
    for i in range(1, n):
        print(cnt[i]//2)
                

if __name__ == "__main__":
    main()

Fixed submission:
# D問題
from collections import deque
def main():
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1
    inf = 10**5
    ans = [0]*n
    q = deque()
    for i in range(n):
        dist = [inf]*n
        q.appendleft(i)
        dist[i] = 0
        while q:
            v = q.pop()
            d = dist[v]
            if v-1 >= 0 and dist[v-1] == inf:
                q.appendleft(v-1)
                dist[v-1] = d+1
            if v+1 <= n-1 and dist[v+1] == inf:
                q.appendleft(v+1)
                dist[v+1] = d+1
            if v == x and dist[y] == inf:
                q.appendleft(y)
                dist[y] = d + 1
            if v == y and  dist[x] == inf:
                q.appendleft(x)
                dist[x] = d + 1
        for di in dist:
            ans[di] += 1
    for a in ans[1:]:
        print(a//2)

if __name__ == "__main__":
    main()

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

def main():
    n, x, y = map(int, input().split())
    dist = [[None]*n for _ in range(n)]
    cnt = [0]*n
    q = deque()
    
    for i in range(n):
        q.appendleft([i, 0])
        dist[i][i] = 0
        while q:
            j, d = q.pop()
            cnt[d] += 1
            if j > 0 and dist[i][j-1] is None:
                dist[i][j-1] = d+1
                q.appendleft([j-1, d+1])
            if j < n-1 and dist[i][j+1] is None:
                dist[i][j+1] = d+1
                q.appendleft([j+1, d+1])
            if j == x-1 and dist[i][y-1] is None:
                dist[i][y-1] = d+1
                q.appendleft([y-1, d+1])
            elif j == y-1 and dist[i][x-1] is None:
                dist[i][x-1] = d+1
                q.appendleft([x-1, d+1])
    for i in range(1, n):
        print(cnt[i]//2)
                

if __name__ == "__main__":
    main()

Fixed submission:
# D問題
from collections import deque
def main():
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1
    inf = 10**5
    ans = [0]*n
    q = deque()
    for i in range(n):
        dist = [inf]*n
        q.appendleft(i)
        dist[i] = 0
        while q:
            v = q.pop()
            d = dist[v]
            if v-1 >= 0 and dist[v-1] == inf:
                q.appendleft(v-1)
                dist[v-1] = d+1
            if v+1 <= n-1 and dist[v+1] == inf:
                q.appendleft(v+1)
                dist[v+1] = d+1
            if v == x and dist[y] == inf:
                q.appendleft(y)
                dist[y] = d + 1
            if v == y and  dist[x] == inf:
                q.appendleft(x)
                dist[x] = d + 1
        for di in dist:
            ans[di] += 1
    for a in ans[1:]:
        print(a//2)

if __name__ == "__main__":
    main()