Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
    """
    英小文字のみからなる文字列 S, T
    文字列 Sに対して、次の操作を何度でも行うことができます。

    操作
        2つの異なる英小文字 c1, c2を選び、
        Sに含まれる全ての 
        c1 を c2に、
        c2 を c1に、置き換える

    0回以上操作を行って、S を Tに一致させられるか判定

    1 <= |S| = |T| <= 2 * 10^5
    """
    S = input()
    T = input()

    ans = f(S, T)
    print(ans)


if True:
    import pytest

    @pytest.mark.randomize(S=str, T=str,
                           min_length=10, max_length=10,
                           str_attrs=("ascii_lowercase",))
    def test_f(S, T):

        assert f(S, T)


def f(S, T):
    """
    26文字存在しないとき
    S: abc
    T: def
        a -> d にしたい
        dbc
        dはSに存在しないので好きに変えられる, でよいか

    S: abc
    T: ddf
        a -> d: dbc
        b -> d: dが存在する
        bを存在しないものに変える: dzc, 状況は変わらない
        a,b入れ替えても意味がない
        a->x, b->x and x->b: bxc, 状況は変わらない

        割当がかぶっていると無理っぽい

    仮に3文字しか種類がない
    S: abc
    T: cab
        c->a, a->c: cba
        b->a, a->b: cab
    """
    import string
    ds = {c: set() for c in string.ascii_lowercase}
    dt = {c: set() for c in string.ascii_lowercase}
    for c1, c2 in zip(S, T):
        ds[c2].add(c1)
        dt[c1].add(c2)

    for c in string.ascii_lowercase:
        if len(ds[c]) >= 2 or len(dt[c]) >= 2:
            return "No"

    return "Yes"


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    """
    英小文字のみからなる文字列 S, T
    文字列 Sに対して、次の操作を何度でも行うことができます。

    操作
        2つの異なる英小文字 c1, c2を選び、
        Sに含まれる全ての 
        c1 を c2に、
        c2 を c1に、置き換える

    0回以上操作を行って、S を Tに一致させられるか判定

    1 <= |S| = |T| <= 2 * 10^5
    """
    S = input()
    T = input()

    ans = f(S, T)
    print(ans)


if False:
    import pytest

    @pytest.mark.randomize(S=str, T=str,
                           min_length=10, max_length=10,
                           str_attrs=("ascii_lowercase",))
    def test_f(S, T):
        assert f(S, T)


def f(S, T):
    """
    26文字存在しないとき
    S: abc
    T: def
        a -> d にしたい
        dbc
        dはSに存在しないので好きに変えられる, でよいか

    S: abc
    T: ddf
        a -> d: dbc
        b -> d: dが存在する
        bを存在しないものに変える: dzc, 状況は変わらない
        a,b入れ替えても意味がない
        a->x, b->x and x->b: bxc, 状況は変わらない

        割当がかぶっていると無理っぽい

    仮に3文字しか種類がない
    S: abc
    T: cab
        c->a, a->c: cba
        b->a, a->b: cab
    """
    import string
    ds = {c: set() for c in string.ascii_lowercase}
    dt = {c: set() for c in string.ascii_lowercase}
    for c1, c2 in zip(S, T):
        ds[c2].add(c1)
        dt[c1].add(c2)

    for c in string.ascii_lowercase:
        if len(ds[c]) >= 2 or len(dt[c]) >= 2:
            return "No"

    return "Yes"


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    x1, y1, x2, y2 = map(int, input().split())

    ans = editorial(x1, y1, x2, y2)
    assert ans == twi(x1, y1, x2, y2)
    print(*ans)


def twi(x1, y1, x2, y2):
    """
    https://twitter.com/akensho/status/1035924165205716992
    https://twitter.com/hogeover30/status/1035903937830764545
    """
    import math
    cos90 = int(math.cos(math.pi / 2))
    sin90 = int(math.cos(math.pi / 2))

    x = x2 - x1
    y = y2 - y1
    x4 = x * cos90 - y * sin90 + x1
    y4 = x * sin90 + y * cos90 + y1

    x = x1 - x4
    y = y1 - y4
    x3 = x * cos90 - y * sin90 + x4
    y3 = x * sin90 + y * cos90 + y4

    return x3, y3, x4, y4


def editorial(x1, y1, x2, y2):
    x = x2 - x1
    y = y2 - y1

    x3 = x2 - y
    y3 = y2 + x
    x4 = x1 - y
    y4 = y1 + x

    return x3, y3, x4, y4


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    x1, y1, x2, y2 = map(int, input().split())

    ans = editorial(x1, y1, x2, y2)
    # assert ans == twi(x1, y1, x2, y2)
    print(*ans)


def twi(x1, y1, x2, y2):
    """
    https://twitter.com/akensho/status/1035924165205716992
    https://twitter.com/hogeover30/status/1035903937830764545
    """
    import math
    cos90 = int(math.cos(math.pi / 2))
    sin90 = int(math.cos(math.pi / 2))

    x = x2 - x1
    y = y2 - y1
    x4 = x * cos90 - y * sin90 + x1
    y4 = x * sin90 + y * cos90 + y1

    x = x1 - x4
    y = y1 - y4
    x3 = x * cos90 - y * sin90 + x4
    y3 = x * sin90 + y * cos90 + y4

    return x3, y3, x4, y4


def editorial(x1, y1, x2, y2):
    x = x2 - x1
    y = y2 - y1

    x3 = x2 - y
    y3 = y2 + x
    x4 = x1 - y
    y4 = y1 + x

    return x3, y3, x4, y4


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    """
    """
    N, M, Q = map(int, input().split())
    L, R = zip(*(
        map(int, input().split())
        for _ in range(M)
    ))
    p, q = zip(*(
        map(int, input().split())
        for _ in range(Q)
    ))

    # answers = f(N, M, Q, L, R, p, q)
    # experiment(N, M, Q, L, R, p, q)
    # answers = TLE(N, M, Q, L, R, p, q)
    answers = editorial(N, M, Q, L, R, p, q)
    for ans in answers:
        print(ans)


def editorial(N, M, Q, L, R, p, q):
    """
    ２次元累積和のライブラリを持っておくとよいらしい
        確かに実装ミスりそう

    """
    # LRの組合せ, N<=500より間に合う
    t1 = [[0] * (N+1) for _ in range(N+1)]
    t2 = [[0] * (N+1) for _ in range(N+1)]
    for l, r in zip(L, R):
        t1[l][r] += 1

    # Lごとの累積和
    for l in range(1, N+1):
        for r in range(1, N+1):
            t2[l][r] = t2[l][r-1] + t1[l][r]

    answers = []
    for _p, _q in zip(p, q):
        ans = 0
        for l in range(_p, _q+1):
            ans += t2[l][_q] - t2[l][_p-1]

        answers.append(ans)

    return answers


def TLE(N, M, Q, L, R, p, q):
    """
    10^5 * 10^5
    """
    answers = []
    for _p, _q in zip(p, q):
        ans = 0
        for left, right in zip(L, R):
            if _p <= left and right <= _q:
                ans += 1

        answers.append(ans)

    return answers


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    """
    """
    N, M, Q = map(int, input().split())
    L, R = zip(*(
        map(int, input().split())
        for _ in range(M)
    ))
    p, q = zip(*(
        map(int, input().split())
        for _ in range(Q)
    ))

    # answers = f(N, M, Q, L, R, p, q)
    # experiment(N, M, Q, L, R, p, q)
    # answers = TLE(N, M, Q, L, R, p, q)
    answers = editorial(N, M, Q, L, R, p, q)
    for ans in answers:
        print(ans)


def editorial(N, M, Q, L, R, p, q):
    """
    ２次元累積和のライブラリを持っておくとよいらしい
        確かに実装ミスりそう

    """
    # LRの組合せ, N<=500より間に合う
    t1 = [[0] * (N+1) for _ in range(N+1)]
    t2 = [[0] * (N+1) for _ in range(N+1)]
    for l, r in zip(L, R):
        t1[l][r] += 1

    # Lごとの累積和
    for l in range(1, N+1):
        for r in range(1, N+1):
            t2[l][r] = t2[l][r-1] + t1[l][r]

    answers = []
    for _p, _q in zip(p, q):
        ans = 0
        for l in range(_p, _q+1):
            ans += t2[l][_q] - t2[l][_p-1]

        answers.append(ans)

    return answers


def TLE(N, M, Q, L, R, p, q):
    """
    10^5 * 10^5
    """
    answers = []
    for _p, _q in zip(p, q):
        ans = 0
        for left, right in zip(L, R):
            if _p <= left and right <= _q:
                ans += 1

        answers.append(ans)

    return answers


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    """
    1 <= N <= 10^5
    """
    N = int(input())

    ans = f(N)
    print(ans)


def test_ans():
    N_ans = [
        (127, 4),
        (3, 3),
        (44852, 16),
    ]
    for N, ans in N_ans:
        assert rec(N) == ans


def rec(N):
    import sys
    sys.setrecursionlimit(10 ** 7)
    memo = [-1] * (N+1)

    def _rec(i):
        if i == 0:
            return 0
        if memo[i] != -1:
            return memo[i]

        ans = N
        p = 1
        while p <= i:
            #print(6, i, i-p)
            ans = min(ans, _rec(i-p) + 1)
            p *= 6
        p = 1
        while p <= i:
            #print(9, i, i-p)
            ans = min(ans, _rec(i-p) + 1)
            p *= 9

        memo[i] = ans

        return ans

    ans = _rec(N)
    return ans


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    """
    1 <= N <= 10^5
    """
    N = int(input())

    ans = rec(N)
    print(ans)


def test_ans():
    N_ans = [
        (127, 4),
        (3, 3),
        (44852, 16),
    ]
    for N, ans in N_ans:
        assert rec(N) == ans


def rec(N):
    import sys
    sys.setrecursionlimit(10 ** 7)
    memo = [-1] * (N+1)

    def _rec(i):
        if i == 0:
            return 0
        if memo[i] != -1:
            return memo[i]

        ans = N
        p = 1
        while p <= i:
            #print(6, i, i-p)
            ans = min(ans, _rec(i-p) + 1)
            p *= 6
        p = 1
        while p <= i:
            #print(9, i, i-p)
            ans = min(ans, _rec(i-p) + 1)
            p *= 9

        memo[i] = ans

        return ans

    ans = _rec(N)
    return ans


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    """
    1<=|s|<=5,000
    1<=K<=5
    """
    s = input()
    K = int(input())

    part(s,K)

def part(s,K):
    n = len(s)
    ss = set()
    for i in range(n+1):
        for j in range(i, n):
            subs = s[i:j+1]
            ss.add(subs)

    ans = sorted(ss)[K-1]
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    """
    1<=|s|<=5,000
    1<=K<=5
    """
    s = input()
    K = int(input())

    part(s, K)


def f(s, K):
    """
    K=1, sorted(s)[0]
    K=2, s[min_idx:min_idx+2]
        aabbaac

        min:a, next: aa
        aab<aac
    1-5文字: すべて異なる文字列なら1文字でよい

    minから5種類存在するなら不要
        K個以上存在する
    a: min
    aaaaa: 5th(aa,aaa,aaaaがあれば)

    abced: 完了
    babcd: 途中にaがあるから未完
     abcde: 完了,ただしaaaaaとかあったらNG
    """
    pass


def part(s, K):
    #s = "abcde" * 1000
    n = len(s)
    ss = set()
    for i in range(n):
        # 最初なぜかn文字まで繰り返していたが、辞書順を考えれば不要
        for j in range(i, i+K):
            subs = s[i:j+1]
            # print(subs, i, j, sep="\t")
            ss.add(subs)

    ans = sorted(ss)[K-1]
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    """
    0? <= h, w <= 100
        grid
    1 <= A, B <= 500

    2つの白く塗られたマス c1,c2が連結であるとは、
        マスc1からマスc2へ、
        上下左右に隣り合うマスへの移動を繰り返して、
        白く塗られたマスだけを通って移動できること

    白く塗られたマスの集合 S が連結成分であるとは、
        S のどの2 つのマスも連結である
        S に含まれないどの白く塗られたマスと、Sに含まれるどのマスも連結ではない
    """
    A, B = map(int, input().split())

    f(A, B)


def editorial(A, B):
    """
    市松模様が浮かんでた
    白い海、黒い海をつくり
    白に黒の島を浮かべ、黒に白の島を浮かべるイメージらしい
    これに至る発想の流れの解説がない…発想力
        100*100だったので,最小領域で考えず最大領域を作ることはしたかった
        1マスは連結だった…
    """
    wh = "."
    bl = "#"
    
    grid = [
        list(wh * 50 + bl * 50)
        for _ in range(100)
    ]
    update(A, grid, wh, shift=50)
    update(B, grid, bl, shift=0)

    print(100, 100)
    for line in grid:
        print(*line, sep="")


def update(n, grid, mark, shift):
    rest = n - 1
    for i in range(1, 50, 2):
        for j in range(1+shift, shift+50, 2):
            if rest <= 0:
                return
            grid[i][j] = mark
            rest -= 1


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    """
    0? <= h, w <= 100
        grid
    1 <= A, B <= 500

    2つの白く塗られたマス c1,c2が連結であるとは、
        マスc1からマスc2へ、
        上下左右に隣り合うマスへの移動を繰り返して、
        白く塗られたマスだけを通って移動できること

    白く塗られたマスの集合 S が連結成分であるとは、
        S のどの2 つのマスも連結である
        S に含まれないどの白く塗られたマスと、Sに含まれるどのマスも連結ではない
    """
    A, B = map(int, input().split())

    f(A, B)


def f(A, B):
    """
    解説pdfがないので、Twitter/動画を参考
    市松模様が浮かんでた
    白い海、黒い海をつくり
    白に黒の島を浮かべ、黒に白の島を浮かべるイメージらしい
    これに至る発想の流れの解説がない…発想力
        100*100だったので,最小領域で考えず最大領域を作ることはしたかった
        1マスは連結だった…
    """
    wh = "."
    bl = "#"

    grid = [
        list(wh * 50 + bl * 50)
        for _ in range(100)
    ]
    update(A, grid, wh, shift=50)
    update(B, grid, bl, shift=0)

    print(100, 100)
    for line in grid:
        print(*line, sep="")


def update(n, grid, mark, shift):
    rest = n - 1
    for i in range(0, 100, 2):
        for j in range(1+shift, shift+49, 2):
            if rest <= 0:
                return
            grid[i][j] = mark
            rest -= 1


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    H, W, D = map(int, input().split())
    A = [
        list(map(int, input().split()))
        for _ in range(H)
    ]
    Q = int(input())
    LR = [
        list(map(int, input().split()))
        for _ in range(Q)
    ]

    f(H, W, D, A, Q, LR)


def f(H, W, D, A, Q, LR):
    pos = [None for _ in range(H * W + 1)]
    for y in range(H):
        for x in range(W):
            a = A[y][x]
            pos[a] = (x, y)

    for l, r in LR:
        ans = 0
        current = l
        target = r
        while current != target:
            _next = current + D
            i, j = pos[current]
            x, y = pos[_next]

            dist = abs(x - i) + abs(y - j)
            ans += dist

            # print((j, i), "to", (y, x), "cur", current, "next", _next, dist)
            current = _next

        print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    H, W, D = map(int, input().split())
    A = [
        list(map(int, input().split()))
        for _ in range(H)
    ]
    Q = int(input())
    LR = [
        list(map(int, input().split()))
        for _ in range(Q)
    ]

    f(H, W, D, A, Q, LR)


def f(H, W, D, A, Q, LR):
    """
    距離を計算しておく
    """
    pos = [None for _ in range(H * W + 1)]
    for y in range(H):
        for x in range(W):
            a = A[y][x]
            pos[a] = (x, y)

    d = [0 for _ in range(H * W + 1)]
    for i in range(1, D + 1):
        current = i
        dist = 0
        while current + D <= H * W:
            _next = current + D
            i, j = pos[current]
            x, y = pos[_next]

            dist += abs(x - i) + abs(y - j)

            # print((j, i), "to", (y, x), "cur", current, "next", _next, dist)
            d[_next] = dist
            current = _next

    # print(d)

    for l, r in LR:
        ans = d[r] - d[l]
        print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def TLE(N, Y):
    # 2000**3 => 2 * 10 * 9:TLE
    for m in range(N, -1, -1):
        for g in range(N - m, -1, -1):
            for s in range(N - m - g, -1, -1):
                if m + g + s == N and \
                        m * 10000 + g * 5000 + s * 1000 == Y:
                    print(m, g, s)
                    return

    print(-1, -1, -1)

N, Y = map(int, input().split())

TLE(N, Y)


Fixed submission:
def main():
    N, Y = map(int, input().split())

    exhaustive_search(N, Y)

def exhaustive_search(N, Y):
    # 2000**2 => 4 * 10 * 6:Not TLE
    for m in range(N + 1):
        for g in range(N + 1):
            s = N - m - g
            #print(m, g, s)
            if 0 <= s <= N and \
                    m + g + s == N and \
                    m * 10000 + g * 5000 + s * 1000 == Y:
                print(m, g, s)
                return

    print(-1, -1, -1)

main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))

    # a<b<c となる並べ方の数
    # b<c となる並べ方の数、１つずつに対してN個調べるO(N^2) => すでにOver => pypy
    # b M個となったとき (b_c_i - b_c_m) を保持する
    # a<b となる並べ方の数、１つずつに対してN個調べるO(M*N)
    # b L個となったとき (b_a_i - b_a_m) を保持する (b_cと対応付ける)

    ans = 0
    for b in B:
        less_b_count = sum(1 for a in A if a < b)
        if less_b_count > 0:
            over_b_count = sum(1 for c in C if b < c)
            ans += less_b_count * over_b_count

    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
import bisect


def main():
    N = int(input())
    A = sorted(map(int, input().split()))
    B = list(map(int, input().split()))
    C = sorted(map(int, input().split()))

    ans = 0
    for b in B:
        na = bisect.bisect_left(A, b)
        nc = N - bisect.bisect_right(C, b)
        ans += na * nc

    print(ans)


def TLE(N, A, B, C):
    # a<b<c となる並べ方の数
    # b<c となる並べ方の数、１つずつに対してN個調べるO(N^2) => すでにOver => pypy
    # b M個となったとき (b_c_i - b_c_m) を保持する
    # a<b となる並べ方の数、１つずつに対してN個調べるO(M*N)
    # b L個となったとき (b_a_i - b_a_m) を保持する (b_cと対応付ける)

    ans = 0
    for b in B:
        less_b_count = sum(1 for a in A if a < b)
        if less_b_count > 0:
            over_b_count = sum(1 for c in C if b < c)
            ans += less_b_count * over_b_count

    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
```
def main():
    s = input()
    t = input()

    f(s, t)

def f(s, t):
    l_t =len(t)
    for i in reversed(range(len(s)-l_t+1)):
        b = s[i:i+l_t]
        c = sum(c1 == c2 or c2 == "?" for c1, c2 in zip(t, b))

        if c == len(t):
            print(s[:i], t, s[i+l_t:])
            ans = s[:i].replace("?", "a") + t + s[i+l_t:].replace("?", "a")
            print(ans)
            return

    print("UNRESTORABLE")


if __name__ == "__main__":
    main()
```

Fixed submission:
def main():
    S_ = input()
    T = input()

    f(S_, T)


def f(s, t):
    l_t = len(t)
    for i in reversed(range(len(s)-l_t+1)):
        b = s[i:i+l_t]
        c = sum(c1 == c2 or c2 == "?" for c1, c2 in zip(t, b))

        if c == len(t):
            ans = s[:i].replace("?", "a") + t + s[i+l_t:].replace("?", "a")
            print(ans)
            return

    print("UNRESTORABLE")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    """
    1 <= i <= N
    p_1 ... p_n
    p_i != p_j
    2 <= N <= 10^5

    p_i != i にする
    最悪、sort(reverse) + αすれば終わりそう
    -> N^2
    """
    N = int(input())
    p = list(map(int, input().split()))
    n_swap = 0

    for i in range(N - 1):
        for j in range(i, N - 1):
            if p[j] == j + 1 or p[j + 1] == j + 2:
                p[j + 1], p[j] = p[j], p[j + 1]
                n_swap += 1

    print(n_swap)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    """
    1 <= i <= N
    p_1 ... p_n
    p_i != p_j
    2 <= N <= 10^5

    p_i != i にする
    最悪、sort(reverse) + αすれば終わりそう
    -> N^2(10^5^2 -> 10^10 NG)

    xx: 12(xx) -> 21(oo)
    xo: 132(xoo) -> 312(ooo)
    ox:
      oは飛ばしてxから始める
    """
    N = int(input())
    p = map(int, input().split())
    n_swap = 0

    p_same = [i == _p for i, _p in enumerate(p, 1)]
    # enumerateでは複製になるのでrangeで回しながら更新
    for i in range(N - 1):
        same = p_same[i]
        if same:
            n_swap += 1
            p_same[i] = p_same[i + 1] = False

    if p_same[-1]:
        n_swap += 1
    print(n_swap)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    """
    1 <= i <= N
    p_1 ... p_n
    p_i != p_j
    2 <= N <= 10^5

    p_i != i にする
    最悪、sort(reverse) + αすれば終わりそう
    -> N^2
    """
    N = int(input())
    p = list(map(int, input().split()))
    n_swap = 0

    for i in range(N - 1):
        for j in range(i, N - 1):
            if p[j] == j + 1 or p[j + 1] == j + 2:
                p[j + 1], p[j] = p[j], p[j + 1]
                n_swap += 1

    print(n_swap)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    """
    1 <= i <= N
    p_1 ... p_n
    p_i != p_j
    2 <= N <= 10^5

    p_i != i にする
    最悪、sort(reverse) + αすれば終わりそう
    -> N^2(10^5^2 -> 10^10 NG)

    xx: 12(xx) -> 21(oo)
    xo: 132(xoo) -> 312(ooo)
    ox:
      oは飛ばしてxから始める
    """
    N = int(input())
    p = map(int, input().split())
    n_swap = 0

    p_same = [i == _p for i, _p in enumerate(p, 1)]
    # enumerateでは複製になるのでrangeで回しながら更新
    for i in range(N - 1):
        same = p_same[i]
        if same:
            n_swap += 1
            p_same[i] = p_same[i + 1] = False

    if p_same[-1]:
        n_swap += 1
    print(n_swap)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from collections import Counter


def main():
    N = int(input())
    counter = Counter(map(int, input().split()))

    a = 0
    b = 0

    def sort_func(t):
        return t[0]
    for length, n in sorted(counter.items(),
                            key=sort_func,
                            reverse=True):
        if n < 2:
            continue
        if a == 0:
            a = length
            if n >= 4:
                b = length
                break
        else:
            b = length
            break
    print(a * b)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    x, a, b = map(int, input().split())
    if abs(x - a) < abs(x - b):
        print("A")
    else:
        print("B")

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input().strip())
    res = int(input().strip())
    if N == 1:
        print(res)
        return
    for _ in range(1, N):
        t = int(input().strip())
        res = lcm(res, t)
    print(res)


def lcm(a, b):
    return (a * b) / gcd(a, b)


def gcd(a, b):
    if b == 0:
        return a
    if b == 1:
        return 1
    if b > a:
        return gcd(b, a)
    else:
        return gcd(b, a % b)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N_str = input().strip()
    if N_str == N_str[::-1]:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input().strip())
    res = int(input().strip())
    if N == 1:
        print(res)
        return
    for _ in range(1, N):
        t = int(input().strip())
        res = lcm(res, t)
    print(res)


def lcm(a, b):
    return (a * b) / gcd(a, b)


def gcd(a, b):
    if b == 0:
        return a
    if b == 1:
        return 1
    if b > a:
        return gcd(b, a)
    else:
        return gcd(b, a % b)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input().strip())
    res = int(input().strip())
    if N == 1:
        print(res)
        return
    for _ in range(1, N):
        t = int(input().strip())
        res = lcm(res, t)
    print(res)


def lcm(a, b):
    return (a * b) // gcd(a, b)


def gcd(a, b):
    if b == 0:
        return a
    if b == 1:
        return 1
    if b > a:
        return gcd(b, a)
    else:
        return gcd(b, a % b)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input().strip())
    res = int(input().strip())
    if N == 1:
        return res
    for _ in range(1, N):
        t = int(input().strip())
        res = f(res, t)
    print(res)


def f(a, b):
    _gcd = gcd(a, b)
    return int(a / _gcd * b)


def gcd(a, b):
    if b == 0:
        return a
    if b == 1:
        return 1
    if b > a:
        return gcd(b, a)
    else:
        return gcd(b, a % b)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input().strip())
    res = int(input().strip())
    if N == 1:
        print(res)
        return
    for _ in range(1, N):
        t = int(input().strip())
        res = lcm(res, t)
    print(res)


def lcm(a, b):
    return (a * b) // gcd(a, b)


def gcd(a, b):
    if b == 0:
        return a
    if b == 1:
        return 1
    if b > a:
        return gcd(b, a)
    else:
        return gcd(b, a % b)

if __name__ == '__main__':
    main()