Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03087 (python)

Fixed submission:
n, q = map(int, input().split())
s = str(input())
lr = []
for i in range(q):
    lr.append(list(input().split()))

n = len(s)
ary = [0 for i in range(len(s)+1)]

for i in range(1, n):
    if s[i-1] == 'A' and s[i] == 'C':
        ary[i+1] = ary[i] + 1
    else:
        ary[i+1] = ary[i]

for i in range(q):
    ans = ary[int(lr[i][1])] - ary[int(lr[i][0])]
    print(ans)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = str(input())
lr = []
for i in range(q):
    lr.append(list(input().split()))

n = len(s)
ary = [0 for i in range(lne(s)+1)]

for i in range(1, N):
    if s[i-1] == 'A' and s[i] == 'C':
        ary[i+1] = ary[i] + 1
    else:
        ary[i+1] = ary[i]

for i in range(q):
    ans = ary[lr[i][0]] - ary[lr[i][1]]
    print(ans)
Problem p03106 (python)

Fixed submission:
a, b, k = map(int, input().split())
m = 0
ans = []

if a < b:
    m = b
    n = a
else:
    m = a
    n = b

for i in range(1, n+1):
    if m % i == 0 and n % i == 0:
        ans.append(i)

if ans:
    print(ans[-k])
else:
    print("1")

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
m = 0
ans = []

if a < b:
    m = b
    n = a
else:
    m = a
    n = b

for i in range(1, m):
    if n % i == 0 and m % i == 0:
        ans.append(i)

if ans:
    print(ans[-k])
else:
    print("1")

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
m = 0
ans = []

if a < b:
    m = b
    n = a
else:
    m = a
    n = b

for i in range(1, m):
    if n % i == 0:
        ans.append(i)

#print(ans)
if ans:
    print(ans[k-1])
else:
    print("1")
Problem p03243 (python)

Fixed submission:
import math

n = int(input())

if n % 111 == 0:
	print(n)
else:
	amari = math.ceil(n / 111)
	print(111*amari)

Buggy submission (verdict: Runtime Error):
n = int(input())

if n % 111 == 0:
	print(n)
else:
	amari = ceil(n / 111) + 1
	print(111*amari)
Problem p03323 (python)

Fixed submission:
A,B = map(int, input().split())

if A<9 and B<9:
	print("Yay!")
else:
	print(":(")

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())

if if A-B <=1 or B-A <=1:
	print("Yay!")
else:
	print(":(")
Problem p03324 (python)

Fixed submission:
D,N = map(int, input().split())

if N == 100:
	print(101 * (100 ** D))
else:
	print(N * (100 ** D))

Buggy submission (verdict: Runtime Error):
D,N = map(int, input().split())

if N == 100:
	print(101 * (100 ** d))
else:
	print(N * (100 ** d))

Buggy submission (verdict: Runtime Error):
D,N = map(int, input().split())

if N == 100:
	print(101 * (100 ** d))
else:
	print(n * (100 ** d))
Problem p03111 (python)

Fixed submission:
def main():
    N, A, B, C = map(int, input().split())
    ls = [int(input()) for _ in range(N)]

    ans = editorial(N, A, B, C, ls)
    print(ans)


def editorial(N, A, B, C, ls):
    def dfs(cur, a, b, c):
        if cur == N:
            if min([a, b, c]) > 0:
                # 使わなくて足りない/使いすぎて超過している分は差引すればいい
                tmp = abs(a - A) + abs(b - B) + abs(c - C) - 30
            else:
                tmp = float("inf")
            # print(tmp, a, b, c, sep="\t")
            return tmp

        # 使うか使わないか,合成パターンを試す
        d = ls[cur]
        ret0 = dfs(cur + 1, a, b, c)
        ret1 = dfs(cur + 1, a + d, b, c) + 10
        ret2 = dfs(cur + 1, a, b + d, c) + 10
        ret3 = dfs(cur + 1, a, b, c + d) + 10

        return min([ret0, ret1, ret2, ret3])

    ans = dfs(0, 0, 0, 0)
    return ans


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, A, B, C = map(int, input().split())
    ls = [int(input()) for _ in range(N)]

    tmp = []
    from itertools import permutations
    for a, b, c in permutations([A, B, C]):
        x = f(N, a, b, c, ls)
        tmp.append(x)

    ans = min(tmp)
    print(ans)


def f(N, A, B, C, ls):
    """
    A,B,Cそれぞれが存在していたら終了
    存在しない場合
    diff をとる
        diffと合成するしないでの最善
    ABCの順に依存するが、3つしかないので 3P3=6通り
    N_max=8 よりゴリ押し
    """
    ls = ls[:]
    abc = [A, B, C]

    ans = 0
    for x in abc[:]:
        if x in ls:
            abc.remove(x)
            ls.remove(x)

    while abc:
        x = abc[0]
        diffs = [l - x for l in ls]
        # print(abc, ans, ls, diffs)
        # 完全一致
        if x in ls:
            ls.remove(x)
            abc.remove(x)
            continue

        # 合成コスト以下, sortedで試してたけどmin のkey指定でよかった
        i, diff = min(enumerate(diffs), key=lambda a: abs(a[0]))
        min_cost = abs(diff)
        if min_cost <= 10:
            ans += min_cost
            del ls[i]
            del abc[0]
            continue

        # 合成できない
        if len(ls) < 2:
            ans += abs(ls[0] - x)
            abc.remove(x)
            del ls[0]
            continue

        # 合成
        comb = []
        n_ls = len(ls)
        for i in range(n_ls):
            for j in range(i+1, n_ls):
                comb.append((i, j, ls[i] + ls[j]))

        # 合成前後のコスト比較
        i, j, new_l = min(comb, key=lambda b: abs(b[2] - x))
        # print("\t", [c[2] for c in comb])
        # print("\t", i, j, new_l, min_cost)
        cost = abs(x - new_l)
        if cost >= min_cost:
            del_idx = min(i, j, key=lambda idx: abs(ls[idx]) - x)
            ans += min_cost
            del ls[del_idx]
            del abc[0]
        else:
            ls[i] = new_l
            del ls[j]
            ans += 10

    return ans


if __name__ == '__main__':
    main()
Problem p03243 (python)

Fixed submission:
def main():
    N = int(input())

    for i in range(N, 999+1):
        if len(set(list(str(i)))) == 1:
            print(i)
            return


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())

    ans1 = AC1(N)
    ans2 = AC2(N)
    assert ans1 == ans2

    print(ans1)


def AC1(N):
    for i in range(N, 999+1):
        if len(set(list(str(i)))) == 1:
            return i


def AC2(N):
    for i in range(1, 9+1):
        if N >= 111 * i:
            return 111 * i


if __name__ == '__main__':
    main()
Problem p03402 (python)

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 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()
Problem p03565 (python)

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 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()
```
Problem p03623 (python)

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 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()
Problem p03633 (python)

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 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()

Buggy 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()
Problem p03665 (python)

Fixed submission:
def main():
    N, P = map(int, input().split())
    *A, = map(int, input().split())

    odd = sum(a % 2 for a in A)
    even = N - odd
    o, e = 0, 0
    # 奇数枚の袋の選び方
    # P=0: 奇数個含まれる袋から足して２の倍数になる袋の組合せ(袋0でもよい)
    # P=1: 奇数なので奇数枚の袋を奇数個
    for i in range(P, odd+1, 2):
        o += ncr(odd, i)

    for i in range(even+1):
        e += ncr(even, i)
    ans = o * e

    print(ans)


def _factorial(n):
    if n < 0:
        raise ValueError("factorial() not defined for negative values")
    a = 1
    for i in range(1, n + 1):
        a *= i
    return a


def npr(n, r):
    if n < r:
        return 0
    a = 1
    for i in range(r):
        a *= n - i
    return a


def ncr(n, r):
    _npr = npr(n, r)
    if _npr == 0:
        return 0
    return _npr // _factorial(r)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, P = map(int, input().split())
    *A, = map(int, input().split())

    editorial(N, P, A)

def editorial(N, P, A):
    odds = [a for a in A if a % 2 == 1]
    odd = len(odds)
    even = N - odd

    if odd == 0:
        if P = 1:
            print(0)
        else:
            print(2 ** N)
        return
    
    # ある奇数袋を取り除いて、残りでの組み合わせ(選ぶ選ばないの2通りがN-1)
    ans = 2 ** (N - 1)
    # s = 組み合わせのビスケット枚数
    # P=0,s:奇数であるとき、加えるのは1通り
    # P=0,s:奇数でないとき、加えないのは1通り
    # P=1,s:奇数であるとき、加えないのは１通り
    # P=1,s:奇数でないとき、加えるのは1通り
    print(ans)


if __name__ == '__main__':
    main()
Problem p03693 (python)

Fixed submission:
def main():
    r, g, b = list(map(int, input().strip().split()))
    v = r * 100 + g * 10 + b
    if v % 4 == 0:
        print("YES")
    else:
        print("NO")

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    # not use N
    _ = int(input().strip())

    n_399 = 0
    n_799 = 0
    n_1199 = 0
    n_1599 = 0
    n_1999 = 0
    n_2399 = 0
    n_2799 = 0
    n_3199 = 0
    n_free = 0
    rates = list(map(int, input().strip().split()))
    for r in rates:
        if r <= 399:
            n_399 = 1
        elif r <= 799:
            n_799 = 1
        elif r <= 1199:
            n_1199 = 1
        elif r <= 1599:
            n_1599 = 1
        elif r <= 1999:
            n_1999 = 1
        elif r <= 2399:
            n_2399 = 1
        elif r <= 2799:
            n_2799 = 1
        elif r <= 3199:
            n_3199 = 1
        else:
            n_free += 1

    n_min = n_399 + n_799 + n_1199 + n_1599 + n_1999 + n_2399 + n_2799 + n_3199
    if n_min == 0 and n_free > 0:
        n_min = 1

    if n_min + n_free >= 8:
        n_max = 8
    else:
        n_max = n_min + n_free

    print(n_min, n_max)

if __name__ == '__main__':
    main()
Problem p03854 (python)

Fixed submission:
def main():
    S = input()

    editorial(S)


def editorial(S):
    """
    それぞれがそれ以外のprefixにならなければ良い
    """
    l = len(S)
    idx = 0
    ok = True
    rs = S[::-1]
    r7 = "dreamer"[::-1]
    r6 = "eraser"[::-1]
    r5_1 = "dream"[::-1]
    r5_2 = "erase"[::-1]

    while idx < l:
        if rs[idx:idx + 7] == r7:
            idx += 7
        elif rs[idx:idx + 6] == r6:
            idx += 6
        elif rs[idx:idx + 5] == r5_1 or \
                rs[idx:idx + 5] == r5_2:
            idx += 5
        else:
            ok = False
            break

    if ok:
        print("YES")
    else:
        print("NO")


def RE(S):
    l = len(S)
    if _dfs(S, l, 0):
        print("YES")
    else:
        print("NO")


def _dfs(S, l, idx, pattern=0):
    # print(l, idx, pattern)
    if idx == l:
        return True

    if S[idx:idx + 7] == "dreamer":
        ok = _dfs(S, l, idx + 7, 1)
        if ok:
            return True
    if S[idx:idx + 6] == "eraser":
        ok = _dfs(S, l, idx + 6, 2)
        if ok:
            return True
    if S[idx:idx + 5] == "dream" or \
            S[idx:idx + 5] == "erase":
        ok = _dfs(S, l, idx + 5, 3)
        if ok:
            return True

    return False


def WA(S):
    l = len(S)
    idx = 0
    ok = True
    while idx < l:
        if S[idx:idx + 7] == "dreamer":
            idx += 7
        elif S[idx:idx + 6] == "eraser":
            idx += 6
        elif S[idx:idx + 5] == "dream" or \
                S[idx:idx + 5] == "erase":
            # 評価順番注意
            idx += 5
        else:
            ok = False
            break

    if ok:
        print("YES")
    else:
        print("NO")

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S = input()

    dfs(S)


def dfs(S):
    l = len(S)
    if _dfs(S, l, 0):
        print("YES")
    else:
        print("NO")


def _dfs(S, l, idx, pattern=0):
    # print(l, idx, pattern)
    if idx == l:
        return True

    if S[idx:idx + 7] == "dreamer":
        ok = _dfs(S, l, idx + 7, 1)
        if ok:
            return True
    if S[idx:idx + 6] == "eraser":
        ok = _dfs(S, l, idx + 6, 2)
        if ok:
            return True
    if S[idx:idx + 5] == "dream" or \
            S[idx:idx + 5] == "erase":
        ok = _dfs(S, l, idx + 5, 3)
        if ok:
            return True

    return False


def WA(S):
    l = len(S)
    idx = 0
    ok = True
    while idx < l:
        if S[idx:idx + 7] == "dreamer":
            idx += 7
        elif S[idx:idx + 6] == "eraser":
            idx += 6
        elif S[idx:idx + 5] == "dream" or \
                S[idx:idx + 5] == "erase":
            # 評価順番注意
            idx += 5
        else:
            ok = False
            break

    if ok:
        print("YES")
    else:
        print("NO")

if __name__ == '__main__':
    main()
Problem p03231 (python)

Fixed submission:
#!/usr/bin/env python
#-*- coding: utf-8 -*-

from collections import defaultdict
from math import factorial as f
from fractions import gcd as g

n, m = [int (i) for i in raw_input ().split ()]
s = raw_input ()
t = raw_input ()
L = n * m / g (n, m)
d = defaultdict (str)
cnt = 0
ok = True
for i in range (n):
    d [i * L / n] = s [i]
for i in range (m):
    ok &= (d [i * L / m] == '' or d [i * L / m] == t [i])
    d [i * L / m] = t [i]
if not ok: L = -1
print L

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
#-*- coding: utf-8 -*-

from collections import defaultdict
from math import factorial as f
from fractions import gcd as g

n, m = [int (i) for i in raw_input ().split ()]
s = raw_input ()
t = raw_input ()
L = n * m / g (n, m)
l = [''] * (L + 5)
cnt = 0
ok = True
for i in range (n):
    l [i * L / n] = s [i]
for i in range (m):
    ok &= (l [i * L / m] == '' or l [i * L / m] == t [i])
    l [i * L / m] = t [i]
if not ok: L = -1
print L

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
#-*- coding: utf-8 -*-

from collections import defaultdict
from math import factorial as f
from fractions import gcd as g

n, m = [int (i) for i in raw_input ().split ()]
s = raw_input ()
t = raw_input ()
L = n * m / g (n, m)
l = [''] * (n * m + 5)
cnt = 0
ok = True
for i in range (n):
    l [i * L / n] = s [i]
for i in range (m):
    ok &= (l [i * L / m] == '' or l [i * L / m] == t [i])
    l [i * L / m] = t [i]
if not ok: L = -1
print L

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
#-*- coding: utf-8 -*-

from collections import defaultdict
from math import factorial as f
from fractions import gcd as g

n, m = [int (i) for i in raw_input ().split ()]
s = raw_input ()
t = raw_input ()
L = n * m / g (n, m)
l = [''] * L
cnt = 0
ok = True
for i in range (n):
    l [i * L / n] = s [i]
for i in range (m):
    ok &= (l [i * L / m] == '' or l [i * L / m] == t [i])
    l [i * L / m] = t [i]
if not ok: L = -1
print L
Problem p03085 (python)

Fixed submission:
n = input()

if(n == 'A'):
    print('T')
elif(n == 'T'):
    print('A')
elif(n == 'C'):
    print("G")
elif(n == 'G'):
    print('C')

Buggy submission (verdict: Runtime Error):
import functools
import math

values = [290021904, 927964716, 826824516, 817140688]
gcd = functools.reduce(math.gcd, values)
print(gcd)
Problem p03262 (python)

Fixed submission:
a, b = map(int, input().split())


def gcd(x, y):
    if(y == 0):
        return x
    else:
        return gcd(y, x%y)

A = list(input().split())
B = []
ans = abs(int(A[0])-b)
for i in A:
    aa = abs(int(i) - b)
    ans = gcd(ans, aa)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())

A = list(input().split())
B = []
ans = abs(int(A[0])-b)
for i in A:
    aa = abs(int(i) - b)
    ans = math.gcd(ans, aa)

print(ans)
Problem p03296 (python)

Fixed submission:
n = int(input())

X = list(map(int, input().split()))
X.append(1000000)
ans = 0

for i in range(1, n):
    if(X[i-1] == X[i]):
        ans+=1
        X[i] = X[i-1] + X[i+1]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())

X = list(input().split())
X.append(1000000)
ans = 0

for i in range(1, n):
    if(X[i-1] == X[i]):
        ans+=1
        X[i] = X[i-1] + X[i+1]
print(ans)
Problem p03110 (python)

Fixed submission:
n=int(input())
ans=0
rate=380000.0
for i in range(n):
    x,u=input().split()
    x=float(x)
    ans+=x*rate if u=="BTC" else x
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
xu=dict(map(str,input().split()) for i in range(n) )
s=[]
b=[]
for key,val in xu.items():
    if val=="JPY":
        s.append(float(key))
    else:
        b.append(float(key))
print(sum(s)+(sum(b)*380000.0))n=int(input())

Buggy submission (verdict: Runtime Error):
n=int(input())
xu=dict(map(str,input().split()) for i in range(n) )
s=[]
b=[]
for key,val in xu.items():
    if val=="JPY":
        s.append(float(key))
    else:
        b.append(float(key))
print(sum(s)+(sum(b)*380000))n=int(input())
xu=dict(map(str,input().split()) for i in range(n) )
s=[]
b=[]
for key,val in xu.items():
    if val=="JPY":
        s.append(int(key))
    else:
        b.append(float(key))
print(sum(s)+(sum(b)*380000.0))
Problem p03220 (python)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
h=list(map(lambda x:t-x*0.006,h))
tmp=[abs(i-a) for i in h]
print(tmp.index(min(tmp))+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
if a>=0:
    h=list(map(lambda x:abs(t-x*0.006-a),h))
else:
    h=list(map(lambda x:t-x*0.006-a),h)

print(h.index(min(h))+1)
Problem p03262 (python)

Fixed submission:
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n,x=map(int,input().split())
x_lst=list(map(int,input().split()))
x_lst=list(map(lambda a:abs(a-x),x_lst))
print(gcd_list(x_lst))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n,x=map(int,input().split())
x_lst=list(map(int,input().split()))
x_lst=list(map(lambda a:abs(a-x),x_lst))
print(gcd_list(x_lst))
Problem p03352 (python)

Fixed submission:
import sys
x=int(input())
a=[]
if x==0:
    print(0)
    sys.exit()
for i in range(1,33):
    for j in range(2,11):
        if i**j<=x:
            a.append(i**j)
print(max(a))

Buggy submission (verdict: Runtime Error):
x=int(input())
if x==1:
    print(1)
    a=True
for i in range(33):
    if a:
        break
    if i**2<x:
        pass
    else:
        print((i-1)**2)
        break
Problem p03474 (python)

Fixed submission:
a,b=map(int,input().split())
s=input()
if s[a]=="-" and (not "-"in s[:a]+s[a+1:]):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=input()
if s[a]=="-" and (not "-"in s[:a]+s[a+1:])
    print("Yes")
else:
    print("No")