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

Fixed submission:
# 2019-11-26 17:11:55(JST)
import sys
from string import ascii_lowercase as alph
ind_alph = dict((char, ind) for ind, char in enumerate(alph))

def main():
    s, k = sys.stdin.read().split()
    s = list(s)
    k = int(k)
    n = len(s)

    i = 0
    while k:
        j = ind_alph[s[i]]
        diff = (26 - j) % 26
        if diff <= k:
            s[i] = 'a'
            k -= diff
        if i == n - 1 and k:
                s[i] = alph[(ind_alph[s[i]] + k) % 26]
                k = 0
        i += 1

    print(''.join(s))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# 2019-11-26 17:11:55(JST)
import sys
from string import ascii_lowercase as alph
ind_alph = dict((char, ind) for ind, char in enumerate(alph))

def main():
    s, k = sys.stdin.read().split()
    s = list(s)
    k = int(k)
    n = len(s)

    i = 0
    while k:
        j = ind_alph[s[i]]
        diff = (26 - j) % 26
        if diff <= k:
            s[i] = 'a'
            k -= diff
        if i == n - 1 and k:
                s[i] = alph[(s[i] + k) % 26]
                k = 0
        i += 1

    print(''.join(s))

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

Fixed submission:
import sys

n, a, *x = map(int, sys.stdin.read().split())

def main():
    ma = a * n
    res = [[[0] * (ma + 1) for _ in range(n + 1)] for _ in range(n + 1)]
    res[0][0][0] = 1
    for i in range(n):
        cur = x[i]
        for j in range(i+2):
            for k in range(ma + 1):
                res[i+1][j][k] += res[i][j][k]
                if k >= cur:
                    res[i+1][j][k] += res[i][j-1][k-cur]
    
    ans = 0
    for j in range(1, n+1):
        ans += res[n][j][j*a]

    return ans

if __name__ == '__main__':
    ans = main()
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

n, a, *x = map(int, sys.stdin.read().split())

def main():
    m = max(n, a) * max(x)
    dp = np.zeros((n + 1, m + 1), dtype=np.int64)
    dp[0, 0] = 1
    for i in range(n):
        ndp = np.copy(dp)
        for j in range(1, n + 1):
            ndp[j][x[i]:] += dp[j-1][:m-x[i]+1]
        dp = ndp
    i = np.arange(1, n + 1)
    print(np.sum(dp[i, i * a]))

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

Fixed submission:

def solve(x):
    for b in xrange(-200, 200):
        a5 = (b ** 5) + x
        s = -1 if a5 < 0 else 1
        a = s * int(pow(abs(a5), 0.2) + 0.1)
        if a ** 5 == a5:
            return a, b

def test(x):
    a, b = solve(x)
    assert x == (a ** 5 - b ** 5)

test(33)
test(1)

from random import randint
for i in xrange(100):
    a = randint(-10 ** 3, 10 ** 3)
    b = randint(-10 ** 3, 10 ** 3)
    u = a ** 5 - b ** 5
    if abs(u) > 10 ** 9:
        continue
    test(a ** 5 - b ** 5)


x = int(raw_input())
a, b = solve(x)
print a, b

Buggy submission (verdict: Runtime Error):


def solve(x):
    for b in xrange(-101, 101):
        a5 = (b ** 5) + x
        s = -1 if a5 < 0 else 1
        a = s * int(pow(abs(a5), 0.2) + 0.1)
        if a ** 5 == a5:
            return a, b

def test(x):
    a, b = solve(x)
    assert x == (a ** 5 - b ** 5)

test(33)
test(1)


x = int(raw_input())
a, b = solve(x)
print a, b
Problem p02697 (python)

Fixed submission:
def solve(n, m):
    assert m * 2 + 1 <= n
    res = []

    maxi = (n - 1) / 2
    if maxi % 2 == 0:
        maxi -= 1
    p = 1
    for i in xrange(maxi, 0, -2):
        q = p + i
        res.append([p, q])
        p += 1

    p = maxi + 1 + 1
    maxi += 1
    for i in xrange(maxi, 1, -2):
        q = p + i
        if q > n:
            continue
        res.append([p, q])
        p += 1

    st1 = set()
    st2 = set()
    assert len(res) >= m
    for (a, b) in res:
        assert 1 <= a <= n
        assert 1 <= b <= n
        assert a != b
        assert not (set([a, b]) & st1)
        st1 |= set([a, b])
        diff = abs(a - b)
        assert not (set([diff, n - diff]) & st2)
        st2 |= set([diff, n - diff])
    return res[:m]

solve(9, 4)
solve(6, 2)
solve(7, 3)
solve(15, 6)
solve(12, 5)
solve(10000, 4999)

'''
for i in xrange(1, 100):
    for j in xrange(1, (i - 1) / 2 + 1):
        # print i, j
        solve(i, j)
'''

(n, m) = map(int, raw_input().split())

assert m * 2 + 1 <= n

for a, b in solve(n, m):
    print a, b

Buggy submission (verdict: Runtime Error):
def solve(n, m):
    assert m * 2 + 1 <= n
    res = []

    maxi = (n - 1) / 2
    p = 1
    for i in xrange(maxi, 0, -2):
        q = p + i
        res.append([p, q])
        p += 1

    p = maxi + 1 + 1
    if maxi % 2 == 1:
        maxi -= 1
    for i in xrange(maxi, 1, -2):
        q = p + i
        if q > n:
            break
        res.append([p, q])
        p += 1

    # print res
    st1 = set()
    st2 = set()
    assert len(res) >= m
    for (a, b) in res:
        assert 1 <= a <= n
        assert 1 <= b <= n
        assert a != b
        assert not (set([a, b]) & st1)
        st1 |= set([a, b])
        diff = abs(a - b)
        assert not (set([diff, n - diff]) & st2)
        st2 |= set([diff, n - diff])
    return res[:m]

solve(7, 3)
'''
solve(6, 2)
solve(15, 6)
solve(9, 4)
solve(12, 5)
solve(10000, 4999)

for i in xrange(1, 100):
    for j in xrange(1, (i - 1) / 2 + 1):
        # print i, j
        solve(i, j)
'''

(n, m) = map(int, raw_input().split())

assert m * 2 + 1 <= n

for a, b in solve(n, m):
    print a, b

Buggy submission (verdict: Runtime Error):
(n, m) = map(int, raw_input().split())

assert m * 2 + 1 <= n

p, q = 1, n

st1 = set()
st2 = set()
for i in xrange(m):
    if n % 2 == 0 and i == m - 1:
        q -= 1

    print p, q

    assert p not in st1 and q not in st1
    st1 |= set([p, q])

    cur = set([q - p, (p - q + n) % n])
    # print sorted(cur)
    assert not (st2 & cur)
    st2 |= cur

    p += 1
    q -= 1
Problem p02722 (python)

Fixed submission:

def solve1(n):
    # n = k ^ a
    res = []
    for i in xrange(1, 100):
        u = int(pow(n, 1.0 / i) + 0.1)
        if u ** i == n:
            res.append(u)
    return set(res)

def solve2(n):
    # n = a * k + 1
    m = n - 1

    i = 1
    res = set()
    while i * i <= m:
        if m % i == 0:
            res.add(i)
            res.add(m / i)
        i += 1
    return res ^ set([1])

def solve3(n):
    i = 2
    res = set()
    while i * i <= n:
        if n % i == 0:
            m = n / i
            while m and m % i == 0:
                m /= i
            if m % i == 1:
                res.add(i)
        i += 1
    return res

def brute_force(n):
    res = []
    for i in xrange(2, n + 1):
        m = n
        while m % i == 0:
            m /= i
        m %= i
        if m == 1:
            res.append(i)
    # print res
    return len(res)

def solve(n):
    s1 = solve1(n)
    s2 = solve2(n)
    s3 = solve3(n)
    # print sorted(s1 | s2 | s3)
    return len(s1 | s2 | s3)

assert solve(6) == 3
assert solve(3141) == 13
assert solve(314159265358) == 9

assert solve(10 ** 12)

import random
for i in xrange(2, 100):
    assert brute_force(i) == solve(i)

n = int(raw_input())
print solve(n)

Buggy submission (verdict: Runtime Error):

def solve1(n):
    # n = k ^ a
    res = []
    for i in xrange(1, 100):
        u = int(pow(n, 1.0 / i) + 0.1)
        if u ** i == n:
            res.append(u)
    return set(res)

def solve2(n):
    # n = a * k + 1
    m = n - 1

    i = 1
    res = set()
    while i * i <= m:
        if m % i == 0:
            res.add(i)
            res.add(m / i)
        i += 1
    return res ^ set([1])

def solve3(n):
    i = 2
    res = set()
    while i * i <= n:
        if n % i == 0:
            m = n / i
            while m and m % i == 0:
                m /= i
            if m % i == 1:
                res.add(i)
        i += 1
    return res

def brute_force(n):
    res = []
    for i in xrange(2, n + 1):
        m = n
        while m % i == 0:
            m /= i
        m %= i
        if m == 1:
            res.append(i)
    # print res
    return len(res)

def solve(n):
    s1 = solve1(n)
    s2 = solve2(n)
    s3 = solve3(n)
    # print sorted(s1 | s2 | s3)
    return len(s1 | s2 | s3)

assert solve(6) == 3
assert solve(3141) == 13
assert solve(314159265358) == 9

assert solve(10 ** 12)

import random
for i in xrange(100):
    n = random.randint(1, 1000)
    assert brute_force(n) == solve(n)

n = int(raw_input())
print solve(n)
Problem p02727 (python)

Fixed submission:
(x, y, A, B, C) = map(int, raw_input().split())

ps = sorted(map(int, raw_input().split()), reverse=True)[:x]
qs = sorted(map(int, raw_input().split()), reverse=True)[:y]
cs = sorted(map(int, raw_input().split()))

tot = sum(ps) + sum(qs)

while cs and ((ps and cs[-1] > ps[-1]) or (qs and cs[-1] > qs[-1])):
    if ps and qs:
        if ps[-1] < qs[-1]:
            tot -= ps.pop()
            tot += cs.pop()
        else:
            tot -= qs.pop()
            tot += cs.pop()
    elif ps:
        tot -= ps.pop()
        tot += cs.pop()
    elif qs:
        tot -= qs.pop()
        tot += cs.pop()
    else:
        break
# print ps, qs

print tot

Buggy submission (verdict: Runtime Error):
(x, y, A, B, C) = map(int, raw_input().split())

ps = sorted(map(int, raw_input().split()), reverse=True)[:x]
qs = sorted(map(int, raw_input().split()), reverse=True)[:y]
cs = sorted(map(int, raw_input().split()))

tot = sum(ps) + sum(qs)

while cs and (cs[-1] > ps[-1] or cs[-1] > qs[-1]):
    if ps and qs:
        if ps[-1] < qs[-1]:
            tot -= ps.pop()
            tot += cs.pop()
        else:
            tot -= qs.pop()
            tot += cs.pop()
    elif ps:
        tot -= ps.pop()
        tot += cs.pop()
    elif qs:
        tot -= qs.pop()
        tot += cs.pop()
    else:
        break
# print ps, qs

print tot

Buggy submission (verdict: Runtime Error):
(x, y, A, B, C) = map(int, raw_input().split())

ps = sorted(map(int, raw_input().split()), reverse=True)[:x]
qs = sorted(map(int, raw_input().split()), reverse=True)[:y]
cs = sorted(map(int, raw_input().split()))

tot = sum(ps) + sum(qs)

while cs and (cs[-1] > ps[-1] or cs[-1] > qs[-1]):
    if ps and qs:
        if ps[-1] < qs[-1]:
            tot -= ps.pop()
            tot += cs.pop()
        else:
            tot -= qs.pop()
            tot += cs.pop()
    elif ps:
        tot -= ps.pop()
        tot += cs.pop()
    elif qs:
        tot -= qs.pop()
        tot += cs.pop()
    else:
        assert False
# print ps, qs

print tot

Buggy submission (verdict: Runtime Error):
(x, y, A, B, C) = map(int, raw_input().split())

ps = sorted(map(int, raw_input().split()), reverse=True)[:x][::-1]
qs = sorted(map(int, raw_input().split()), reverse=True)[:y][::-1]
cs = sorted(map(int, raw_input().split()), reverse=True)

tot = sum(ps) + sum(qs)

while cs and (cs[0] > ps[0] or cs[0] > qs[0]):
    if ps and qs:
        if ps[0] < qs[0]:
            tot -= ps.pop(0)
            tot += cs.pop(0)
        else:
            tot -= qs.pop(0)
            tot += cs.pop(0)
    elif ps:
        tot -= ps.pop(0)
        tot += cs.pop(0)
    elif qs:
        tot -= qs.pop(0)
        tot += cs.pop(0)
    else:
        assert False
# print ps, qs

print tot
Problem p02936 (python)

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

dictionary = [[] for i in range(N + 1)]

for i in range(N-1):
    a, b = map(int, input().split())
    dictionary[a].append(b)

num = [0] * (N + 1)

for i in range(Q):
    p, x = map(int, input().split())
    num[p] += x

for i in range(1, N + 1):
    print(num[i])
    for j in range(0, len(dictionary[i])):
        num[dictionary[i][j]] += num[i]

Buggy submission (verdict: Runtime Error):
def func(now, ans_base, num, tree):
    ans_base.append(num[now])
    addNum = num[now]
    while len(tree[now]) > 0:
        next = tree[now].pop(0)
        num[next] += num[now]
        ans_base = func(next, ans_base, num, tree)
    return ans_base


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

tree = {}
for i in range(1, N + 1):
    tree[i] = list()

for i in range(N - 1):
    a, b = map(int, input().split())
    tree[a].append(b)

num = [0] * (N + 1)
for i in range(Q):
    p, x = map(int, input(). split())
    num[p] += x

ans_base = list()

result = func(1, ans_base, num, tree)

print(' '.join(list(map(str, result))))
Problem p02937 (python)

Fixed submission:
import bisect

s = list(input())
t = list(input())

# 辞書を作る
dictionary = {}

tt = t[:]
ss = dict(zip(list(range(len(s * 2))), s * 2))

for i in range(len(ss)):
    c = ss[i]
    if c not in dictionary:
        dictionary[c] = []
    dictionary[c].append(i)

result = 0
current_idx = 0
sLen = len(s)

for c in t:
    if c not in dictionary:
        print(-1)
        exit(0)
    indexes = dictionary[c]
    next = dictionary[c][bisect.bisect_left(indexes, current_idx)] + 1
    result += next - current_idx
    current_idx = next
    if next >= sLen:
        current_idx -= sLen

print(result)

Buggy submission (verdict: Runtime Error):
import bisect

s = list(input())
t = list(input())

# 辞書を作る
dictionary = {}

tt = t[:]
ss = s * 2

i = 0
while len(ss):
    _s = ss.pop(0)
    if _s not in dictionary:
        dictionary[_s] = [i]
    else:
        dictionary[_s].append(i)
    i += 1

result = 0
before = 0
sLen = len(s)
while len(t) > 0:
    _t = t.pop(0)
    next = dictionary[_t][bisect.bisect_left(dictionary[_t], before)] + 1
    result += next - before
    before = next
    if next >= sLen:
        before -= sLen

print(result)
Problem p02953 (python)

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

prev = -999
for i in range(N):
  if prev <= hh[i]-1:
    prev = hh[i]-1
  elif prev <= hh[i]:
    prev = hh[i]
  else:
    print('No')
    exit(0)

print('Yes')
exit(0)

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

prev = -999
for i in range(N):
  if pre <= hh[i]-1:
    pre = hh[i]-1
  elif pre <= hh[i]:
    pre = hh[i]
  else:
    print('No')
    exit(0)
print('Yes')
exit(0)
Problem p02972 (python)

Fixed submission:
import math

N = int(input())

aa = list(map(int, input().split()))

bb = aa[:]

i = N

while i > 0:

    total = 0
    j = i * 2

    while j <= N:
        total ^= bb[j - 1]
        j += i

    bb[i - 1] = total ^ aa[i - 1]
    i -= 1

bbKisu = list(filter(lambda n: n % 2 == 1, bb))
count = len(bbKisu)

print(count)
for i in range(N):
    if bb[i] == 1:
        print(i + 1)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

aa = list(map(int, input().split()))

bb = aa[:]

i = math.floor(N / 2)

while i >= 0:
    bai = (i + 1) * 2 - 1
    if aa[i] == 1:  # 自分が奇数
        if aa[bai] == 0:  # 2倍が偶数
            bb[i] = 1
        else:  # 2倍が奇数
            bb[i] = 0
    else:  # 自分が偶数
        if aa[bai] == 0:  # 2倍が偶数
            bb[i] = 0
        else:  # 2倍が奇数
            bb[i] = 1
    i -= 1

bbKisu = filter(lambda n: n % 2 == 1, bb)
count = len(list(bbKisu))

print(count)
for i in range(N):
    if bb[i] == 1:
        print(i + 1)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

aa = list(map(int, input().split()))

bb = aa[:]

i = math.floor(N / 2)

while i >= 0:
    if aa[i] == 1:  # 自分が奇数
        if aa[i * 2] == 0:  # 2倍が偶数
            bb[i] = 1
        else:  # 2倍が奇数
            bb[i] = 0
    else:  # 自分が偶数
        if aa[i * 2] == 0:  # 2倍が偶数
            bb[i] = 0
        else:  # 2倍が奇数
            bb[i] = 1
    i -= 1

bbKisu = filter(lambda n: n % 2 == 1, bb)
count = len(list(bbKisu))

print(count)
for i in range(N):
    if bb[i] == 1:
        print(i + 1)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

aa = list(map(int, input().split()))

bb = aa[:]

i = math.floor(N / 2)

while i > 0:
    if aa[i] == 1:  # 自分が奇数
        if aa[i * 2] == 0:  # 2倍が偶数
            bb[i] = 1
        else:  # 2倍が奇数
            bb[i] = 0
    else:  # 自分が偶数
        if aa[i * 2] == 0:  # 2倍が偶数
            bb[i] = 0
        else:  # 2倍が奇数
            bb[i] = 1
    i -= 1

bbKisu = filter(lambda n: n % 2 == 1, bb)
count = len(list(bbKisu))

print(count)
for i in range(N):
    if bb[i] == 1:
        print(i + 1)
Problem p02601 (python)

Fixed submission:
A,B,C = map(int,input().split())
K = int(input())
count = 0
while B <= A:
    B *= 2
    count += 1
while C <= B :
    C *= 2
    count += 1
if count > K :
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
K = int(input())
count = 0
while B <= A:
    B *= 2
    count += 1
while C <= B :
    C *= 2
    count += 1
if count > K :
    print("No")
else:
    pirnt("Yes")
Problem p02609 (python)

Fixed submission:
N = int(input())
ans_list = [0] * (N+1)
def popcnt(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c
for i in range(N):
    if i == 0:
        continue
    else:
        if i %popcnt(i) == 0 :
            ans_list[i] = 1
        else:
            ans_list[i] = ans_list[i%popcnt(i)] + 1
S = input()
count = 0
for i in range(N):
    if S[i] == "1":
        count += 1
if count == 1:
    high_total = 0
    low_total = 0
    for i in range(N):
        if S[i] == "1":
            high_total += pow(2,N-1-i,count+1)
            high_total %= (count+1)
    for i in range(N):
        if S[i] == "1":
            print(0)
        if S[i] == "0":
            total = (high_total + pow(2,N-1-i,count+1)) % (count+1)
            print(ans_list[total]+1)
else:
    high_total = 0
    low_total = 0
    for i in range(N):
        if S[i] == "1":
            high_total += pow(2,N-1-i,count+1)
            high_total %= (count+1)
            low_total +=  pow(2,N-1-i,count-1)
            low_total %= (count-1)
    for i in range(N):
        if S[i] == "1":
            total = (low_total - pow(2,N-1-i,count-1)) % (count-1)
            print(ans_list[total]+1)
        if S[i] == "0":
            total = (high_total + pow(2,N-1-i,count+1)) % (count+1)
            print(ans_list[total]+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans_list = [0] * (N+1)
def popcnt(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c
for i in range(N):
    if i == 0:
        continue
    else:
        if i %popcnt(i) == 0 :
            ans_list[i] = 1
        else:
            ans_list[i] = ans_list[i%popcnt(i)] + 1
S = input()
count = 0
for i in range(N):
    if S[i] == "1":
        count += 1
high_total = 0
low_total = 0
for i in range(N):
    if S[i] == "1":
        high_total += pow(2,N-1-i,count+1)
        high_total %= (count+1)
        low_total +=  pow(2,N-1-i,count-1)
        low_total %= (count-1)
for i in range(N):
    if S[i] == "1":
        total = (low_total - pow(2,N-1-i,count-1)) % (count-1)
        print(ans_list[total]+1)
    if S[i] == "0":
        total = (high_total + pow(2,N-1-i,count+1)) % (count+1)
        print(ans_list[total]+1)
Problem p02645 (python)

Fixed submission:
S  = input()
print(S[:3])

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = [int(i) for i in input().split()]
three_hold_list = [0] *(3*N)
ans = ans = [N] * N
if K >= N :
    print(*ans)
else:
    for i in range(K):
        Accum = [0] *(3*N)
        for j in range(N):
            Accum[N+j-A[j]] += 1
            Accum[N+j+A[j]+1] -= 1
        num = 0
        for l in range(3*N):
            num += Accum[l]
            three_hold_list[l] = num
        if three_hold_list[N:2*N] == ans:
            break
        else:
            A = three_hold_list[N:2*N]
    print(*three_hold_list[N:2*N])
Problem p02647 (python)

Fixed submission:
N,K = map(int,input().split())
A = [int(i) for i in input().split()]
three_hold_list = [0] *(3*N)
ans = ans = [N] * N
if K >= N :
    print(*ans)
else:
    for i in range(K):
        Accum = [0] *(3*N)
        for j in range(N):
            Accum[N+j-A[j]] += 1
            Accum[N+j+A[j]+1] -= 1
        num = 0
        for l in range(3*N):
            num += Accum[l]
            three_hold_list[l] = num
        if three_hold_list[N:2*N] == ans:
            break
        else:
            A = three_hold_list[N:2*N]
    print(*three_hold_list[N:2*N])

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = [int(i) for i in input().split()]
three_hold_list = [0] *(3*N)
ans = ans = [N] * N
if (1.8)**(K//2) >= N :
    print(*ans)
else:
    for i in range(K):
        Accum = [0] *(3*N)
        for j in range(N):
            Accum[N+j-A[j]] += 1
            Accum[N+j+A[j]+1] -= 1
        num = 0
        for l in range(3*N):
            num += Accum[l]
            three_hold_list[l] = num
        if three_hold_list[N:2*N] == ans:
            break
        else:
            A = three_hold_list[N:2*N]
    print(*three_hold_list[N:2*N])
Problem p02675 (python)

Fixed submission:
N= int(input())
n = N%10
if n == 3:
    print("bon")
elif n == 1 or n == 6 or n == 8 or n == 0 :
    print("pon")
else:
    print("hon")

Buggy submission (verdict: Runtime Error):
N= int(input())
n = N%10
if n == 3:
    print("bon")
elif n == 1 or n == 6 or n == 8 or n == 0 :
    print("pon")
else:
    print(hon)
Problem p02678 (python)

Fixed submission:
N,M = map(int,input().split())
path_list = []
for i in range(N):
    z = []
    path_list.append(z)
for i in range(M):
    A,B = map(int,input().split())
    path_list[A-1].append(B)
    path_list[B-1].append(A)
chk = [0] * N

def bfs(a,chk,path):
    queue = [a]
    while queue:
        b = queue.pop(0)
        for i in range(len(path[b-1])):
            if chk[path[b-1][i]-1] == 0:
                queue.append(path[b-1][i])
                chk[path[b-1][i]-1] =b
    return chk
bfs(1,chk,path_list)
print("Yes")
for i in range(N):
    if i == 0:
        continue
    else:
        print(chk[i])

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
path_list = []
for i in range(M):
    z = []
    path_list.append(z)
for i in range(M):
    A,B = map(int,input().split())
    path_list[A-1].append(B)
    path_list[B-1].append(A)
chk = [0] * N

def bfs(a,chk,path):
    queue = [a]
    while queue:
        b = queue.pop(0)
        for i in range(len(path[b-1])):
            if chk[path[b-1][i]-1] == 0:
                queue.append(path[b-1][i])
                chk[path[b-1][i]-1] =b
    return chk
bfs(1,chk,path_list)
print("Yes")
for i in range(N):
    if i == 0:
        continue
    else:
        print(chk[i])
Problem p02687 (python)

Fixed submission:
N = input()
if N == "ABC":
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
N = input()
if N = "ABC":
  print("ARC")
else:
  print("ABC")
Problem p02741 (python)

Fixed submission:
N = int(input())
n_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(n_list[N-1])

Buggy submission (verdict: Runtime Error):
alp = ["a","b","c","d","e","f","g","h","i","j"]
N = int(input())
ans_list = []
for i in range(N):
    ans_list.append([])
for i in range(N):
    if i == 0:
        ans_list[i].append(["a",1])
    else:
        for j in range(len(ans_list[i-1])):
            for l in range(ans_list[i-1][j][1]+1):
                temp = ans_list[i-1][j][0] + alp[l]
                if l == ans_list[i-1][j][1]:
                    chk = ans_list[i-1][j][1]+1
                else:
                    chk = ans_list[i-1][j][1]
                ans_list[i].append([temp,chk])
for i in range(len(ans_list[N-1])):
    print(ans_list[N-1][i][0])
Problem p02795 (python)

Fixed submission:
H = int(input())
W = int(input())
N = int(input())
A = max(H,W)
print((N-1)//A+1)

Buggy submission (verdict: Runtime Error):
H = input()
W = input()
N = input()
A = max(H,W)
print((N-1)%A+1)