Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict
def main():
    n, x, y= map(int, input().split())
    x -= 1
    y -= 1
    dis = defaultdict(int)
    for i1 in range(n):
        for i2 in range(n):
            d = min(abs(i2-i1), abs(x-i1)+abs(y-i2)+1, abs(x-i2)+abs(y-i1)+1)
            dis[d] += 1

    for k1 in range(1, n):
        print(dis[k1]//2)

if __name__ == '__main__':
    main()


Fixed submission:

import sys
input = sys.stdin.readline
from collections import deque
from collections import Counter
def main():
    # 入力
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1

    # 処理
    dis = deque()
    for i1 in range(n):
        if x < i1:
            right = i1 + 1
            while right < n:
                dis_now = min(right - i1, (i1 - x + abs(right - y) + 1))
                dis.append(dis_now)
                right += 1
        else:
            right = i1 + 1
            while right < n:
                if right < y:
                    dis_now = min(right - i1,(x - i1 + abs(y - right) + 1))
                    dis.append(dis_now)
                else:
                    dis.append(right - i1 - (y - x) + 1)
                right += 1
    dis_c = Counter(dis)
    dis_list = [0] * (n - 1)
    for i2 in range(1, n):
        dis_list[i2 - 1] = dis_c[i2]

    # 出力

    for edis in dis_list:
        print(edis)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.read
from itertools import chain
from collections import Counter
def main():
    def warshall_floyd(d):
        for k in range(n):
            for i in range(n):
                for j in range(n):
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j])
        # 更新したdを返す。d[i][j]はノードiからノードjまでの最短距離
        # 行きつけないノードはinfになる。
        # 負閉路があるなら「ノードｖからノードｖへのコスト」、つまりd[x][x]がマイナス値になる。
        return d

    # 入力
    n, x, y = map(int, input().split())
    # ワーシャルフロイドで更新する変数dをつくる
    d = [[float("inf")] * n for _ in range(n)]
    d[x - 1][y - 1] = 1
    d[y - 1][x - 1] = 1
    for i1 in range(n-1):
        d[i1][i1+1] = 1
        d[i1+1][i1] = 1
    for j1 in range(n):
        d[j1][j1] = 0

    # ワーシャルフロイド実行。
    res = warshall_floyd(d)
    res1d = chain.from_iterable(res)
    res1dc = Counter(res1d)
    for i1 in range(1, n):
        r = res1dc[i1] // 2
        print(r)

if __name__ == '__main__':
    main()

Fixed submission:

import sys
input = sys.stdin.readline
from collections import deque
from collections import Counter
def main():
    # 入力
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1

    # 処理
    dis = deque()
    for i1 in range(n):
        if x < i1:
            right = i1 + 1
            while right < n:
                dis_now = min(right - i1, (i1 - x + abs(right - y) + 1))
                dis.append(dis_now)
                right += 1
        else:
            right = i1 + 1
            while right < n:
                if right < y:
                    dis_now = min(right - i1,(x - i1 + abs(y - right) + 1))
                    dis.append(dis_now)
                else:
                    dis.append(right - i1 - (y - x) + 1)
                right += 1
    dis_c = Counter(dis)
    dis_list = [0] * (n - 1)
    for i2 in range(1, n):
        dis_list[i2 - 1] = dis_c[i2]

    # 出力

    for edis in dis_list:
        print(edis)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.read
from itertools import chain
from collections import Counter
def main():
    def warshall_floyd(d):
        for k in range(n):
            for i in range(n):
                for j in range(n):
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j])
        # 更新したdを返す。d[i][j]はノードiからノードjまでの最短距離
        # 行きつけないノードはinfになる。
        # 負閉路があるなら「ノードｖからノードｖへのコスト」、つまりd[x][x]がマイナス値になる。
        return d

    # 入力
    n, x, y = map(int, input().split())
    # ワーシャルフロイドで更新する変数dをつくる
    d = [[float("inf")] * n for _ in range(n)]
    d[x - 1][y - 1] = 1
    d[y - 1][x - 1] = 1
    for i1 in range(n-1):
        d[i1][i1+1] = 1
        d[i1+1][i1] = 1
    for j1 in range(n):
        d[j1][j1] = 0

    # ワーシャルフロイド実行。
    res = warshall_floyd(d)
    res1d = chain.from_iterable(res)
    res1dc = Counter(res1d)
    for i1 in range(1, n):
        r = res1dc[i1] // 2
        print(r)

if __name__ == '__main__':
    main()

Fixed submission:

import sys
input = sys.stdin.readline
from collections import deque
from collections import Counter
def main():
    # 入力
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1

    # 処理
    dis = deque()
    for i1 in range(n):
        if x < i1:
            right = i1 + 1
            while right < n:
                dis_now = min(right - i1, (i1 - x + abs(right - y) + 1))
                dis.append(dis_now)
                right += 1
        else:
            right = i1 + 1
            while right < n:
                if right < y:
                    dis_now = min(right - i1,(x - i1 + abs(y - right) + 1))
                    dis.append(dis_now)
                else:
                    dis.append(right - i1 - (y - x) + 1)
                right += 1
    dis_c = Counter(dis)
    dis_list = [0] * (n - 1)
    for i2 in range(1, n):
        dis_list[i2 - 1] = dis_c[i2]

    # 出力

    for edis in dis_list:
        print(edis)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.read
def main():
    def warshall_floyd(d):
        for k in range(n):
            for i in range(n):
                for j in range(n):
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j])
        # 更新したdを返す。d[i][j]はノードiからノードjまでの最短距離
        # 行きつけないノードはinfになる。
        # 負閉路があるなら「ノードｖからノードｖへのコスト」、つまりd[x][x]がマイナス値になる。
        return d

    # 入力
    n, x, y = map(int, input().split())
    # ワーシャルフロイドで更新する変数dをつくる
    d = [[float("inf")] * n for _ in range(n)]
    d[x - 1][y - 1] = 1
    d[y - 1][x - 1] = 1
    for i1 in range(n-1):
        d[i1][i1+1] = 1
        d[i1+1][i1] = 1
    for j1 in range(n):
        d[j1][j1] = 0

    # ワーシャルフロイド実行。
    res = warshall_floyd(d)
    r = [0] * (n - 1)
    for i1 in range(n-1):
        for i2 in range(i1 + 1, n):
            r[res[i1][i2] - 1] += 1
    print(*r, sep= '\n')

if __name__ == '__main__':
    main()

Fixed submission:

import sys
input = sys.stdin.readline
from collections import deque
from collections import Counter
def main():
    # 入力
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1

    # 処理
    dis = deque()
    for i1 in range(n):
        if x < i1:
            right = i1 + 1
            while right < n:
                dis_now = min(right - i1, (i1 - x + abs(right - y) + 1))
                dis.append(dis_now)
                right += 1
        else:
            right = i1 + 1
            while right < n:
                if right < y:
                    dis_now = min(right - i1,(x - i1 + abs(y - right) + 1))
                    dis.append(dis_now)
                else:
                    dis.append(right - i1 - (y - x) + 1)
                right += 1
    dis_c = Counter(dis)
    dis_list = [0] * (n - 1)
    for i2 in range(1, n):
        dis_list[i2 - 1] = dis_c[i2]

    # 出力

    for edis in dis_list:
        print(edis)

if __name__ == '__main__':
    main()