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

Fixed submission:

n,m = map(int,input().split())
lists = [list(map(int,input().split())) for i in range(m)]
for i in range((10**3) + 1):
    num = str(i)
    flag = True
    if len(num) == n:
        for s,c in lists:
            if num[s-1] != str(c):
                flag = False
        if flag:
            print(num)
            exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
if m == 0:
    if n == 1:
        print(0)
        exit()
    else:
        print(-1)
        exit()

lists = [list(map(int,input().split())) for i in range(m)]
keta = ["0"]*n
Max = -999999
Min = 99999999
tmp = lists[0][0]
for i,j in lists:
    keta[i-1] = str(j)
    Max = max(i,Max)
    num = "".join(keta)
    ans = int(num)
    if tmp == i:
        Min = min(ans,Min)
        keta = list(str(Min))
    else:
        Min = ans
if len(str(Min)) == n:
    print(Min)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
lists = [list(map(int,input().split())) for i in range(m)]
keta = ["0"]*n
Max = -999999
Min = 99999999
tmp = lists[0][0]
for i,j in lists:
    keta[i-1] = str(j)
    Max = max(i,Max)
    num = "".join(keta)
    ans = int(num)
    if tmp == i:
        Min = min(ans,Min)
        keta = list(str(Min))
    else:
        Min = ans
if len(str(Min)) == n:
    print(Min)
else:
    print(-1)
Problem p02983 (python)

Fixed submission:
L,R = map(int,input().split())
# R-LはLからRまでの個数を表す
#解の最小は０であり、LからRまでに2019の倍数が存在すればよい
# R-L > 2018ならRからLに2019の倍数が出てくることになる
if R - L >= 2018:
    print(0)
else:
    ans = 2019
    #iとj=i+1でi*jmod2019の最小値を全探索
    for i in range(L,R):
        for j in range(i+1,R+1):
            ans = min(ans,i*j % 2019)
    print(ans)

Buggy submission (verdict: Runtime Error):
def comb(n, k):
    m = 1
    if n < 2 * k:
        k = n - k
    for i in range(1, k + 1):
        m = m * (n - i + 1) / i    
    return m % 2019
L,R = map(int,input().split())
min = 999999999
lists = list(range(L,R+1))
for i in range(len(lists)):
    if min > comb(L,lists[i]) and min !=1 :
        min = comb(L,lists[i])
print(min)
Problem p02993 (python)

Fixed submission:
S = str(input())
cnt = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        print("Bad")
        exit()
print("Good")

Buggy submission (verdict: Runtime Error):
S = str(input())
cnt = 0
for i in range(len(S)):
    if S[i] == S[i+1]:
        print("Bad")
        exit()
print("Good")
Problem p02995 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
def gcd(a, b):
  if a % b is 0:
    return b
  return gcd(b, a % b)
 
def solve(n):
  return n - (n // C) - (n // D) + (n // (C * D // gcd(C, D)))
 
print(solve(B) - solve(A - 1))

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().split())
n = (C * D) // math.gcd(C,D)
C_D = (B - A + 1) / n
c = (B - A + 1) / C
d = (B - A + 1) / D
m = c + d - C_D
ans = int((B - A + 1) - m)
print(str(ans))

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().split())
n = (C * D) // math.gcd(C,D)
C_D = (B - A + 1) / n
c = (B - A + 1) / C
d = (B - A + 1) / D
m = c + d - C_D
ans = int((B - A + 1) - m)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().split())
n = C * D / math.gcd(C,D)
C_D = (B - A + 1) // n
c = (B - A + 1) // C
d = (B - A + 1) // D
m = int((B - A + 1 ) - (c + d - C_D))
print(m)

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().split())
n = C * D / math.gcd(C,D)
C_D = (B - A + 1) / n
c = (B - A + 1) / C
d = (B - A + 1) / D
m = c + d - C_D
ans = int((B - A + 1) - m)
print(ans)
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
ruisekiwa = [0]
lists = []
cnt = 0
S = str(input())
for t in range(1, N):
    if S[t - 1] == "A" and S[t] == "C":
        cnt += 1
    ruisekiwa.append(cnt)
ruisekiwa.append(cnt)
for i in range(Q):
    l, r = map(int, input().split())
    ans = ruisekiwa[r - 1] - ruisekiwa[l - 1]
    lists.append(ans)
for m in range(len(lists)):
    print(lists[m])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = str(input())
count = [0]*(N+1)
lists = []
for i in range(N):
    if S[i] == "A" and S[i + 1] == "C":
        count[i + 1] = count[i] + 1
    else:
        count[i + 1] = count[i]
for i in range(Q):
    l, r = map(int, input().split())
    ans = count[r-1] - count[l-1]
    lists.append(ans)
for i in range(len(lists)):
    print(lists[i])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = str(input())
cnt = 0
count = [0]*(N+1)
lists_l = []
lists_r = []
for i in range(N):
    if S[i] == "A" and S[i + 1] == "C":
        count[i + 1] = count[i] + 1
    else:
        count[i + 1] = count[i]
for i in range(Q):
    l, r = map(int, input().split())
    lists_l.append(l)
    lists_r.append(r)
for i in range(Q):
    L = lists_l[i]
    R = lists_r[i]
    print(count[R-1] - count[L-1])
Problem p03211 (python)

Fixed submission:
S = str(input())
min = 99999999999
ans = 0
for i in range(len(S)-2):
    m = int(S[i:i+3])
    ans = abs(753 - m)
    if min > ans:
        min = ans
print(min)

Buggy submission (verdict: Runtime Error):
ans = 0
for i in range(len(S)-2):
    m = int(S[i:i+3])
    ans = abs(753 - m)
    if min > ans:
        min = ans
print(min)
Problem p03352 (python)

Fixed submission:
X = int(input())
lists = []
max = 1
for i in range(1,X+1):
    for j in range(2,X+1):
        if i**j <= X:
            if max < i**j:
                max = i**j
        elif i**j > X:
            break
print(max)

Buggy submission (verdict: Runtime Error):
X = int(input())
lists = []
max = 1
for i in range(1,X+1):
    for j in range(2,X+1):
        if i**j <= X:
           lists.append(i**j)
lists.sort()
print(lists[-1])
Problem p03386 (python)

Fixed submission:
A,B,K = map(int,input().split())
if abs(B-A) < K:
    for i in range(A,B+1):
        print(i)
    exit()
min_list = list(range(A,A+K))
max_list = list(range(B-K+1,B+1))
lists = list(set(min_list) | set(max_list))
lists.sort()
for i in range(len(lists)):
    print(lists[i])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
lists = list(range(A,B+1))
ans = []
for i in range(K):
    if i < len(lists):
        ans.append(lists[i])
        ans.append(lists[(len(lists)-1)-i])
    else:
        break
m = set(ans)
lm = sorted(m)
for j in range(len(lm)):
    print(lm[j])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
lists = list(range(A,B+1))
min_list = []
max_list = []
if K > len(lists):
        for m in range(len(lists)):
                print(lists[m])
else:
        for i in range(K):
                min_list.append(lists[i])
        for j in range(K,len(lists)):
                min_list.append(lists[j])
        for k in range(len(min_list)):
                print(min_list[k])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
lists = list(range(A,B+1))
result = list(set(lists[:K] + lists[-K:]))
result.sort()
if K > len(lists):
        for j in range(len(lists)):
                print(lists[j])
else:
        for i in range(len(result)):
                print(result[i])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
lists = list(range(A,B+1))
result = list(set(lists[:K] + lists[-K:]))
result.sort()
if K >= len(lists):
        for j in range(len(lists)):
                print(lists[j])
else:
        for i in range(len(result)):
                print(result[i])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
lists = list(range(A,B+1))
result = list(set(lists[:K] + lists[-K:]))
for i in range(len(result)):
        print(result[i])
Problem p03387 (python)

Fixed submission:
import collections
a,b,c = map(int,input().split())
lists = [str(a%2),str(b%2),str(c%2)]
abc = [a,b,c]
an = []
if len(set(lists)) != 1:

    d = collections.Counter(lists)
    jud = int(d.most_common()[0][0])
    for i in range(3):
        if jud == int(lists[i]):
            an.append(i)
    for i in an:
            abc[i] += 1
    cnt = 1
else:
    cnt = 0

while 1:
    Max = max(abc)
    count = 0
    for i in range(3):
        if Max == abc[i]:
            count += 1
    if count == 1:
        cnt += 1
        for i in range(3):
            if Max != abc[i]:
                abc[i] += 1

    elif count == 2:
        cnt += abs(max(abc) - min(abc)) // 2
        abc.sort()
        abc[0] += abs(max(abc) - min(abc))
    elif count == 3:
        break

print(cnt)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
if abs(B-A) < K:
    for i in range(A,B+1):
        print(i)
    exit()
min_list = list(range(A,A+K))
max_list = list(range(B-K+1,B+1))
lists = list(set(min_list) | set(max_list))
lists.sort()
for i in range(lists):
    print(lists[i])
Problem p03543 (python)

Fixed submission:
N = input()
count = 0
if N[0]==N[1]==N[2] or N[1]==N[2]==N[3]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = input()
i = 0
while i<4:
    if N[0] == N[i]:
        count = count + 1
        i = i + 1
    else:
        i = i + 1
if count >= 3:
    print("Yes")
elif count <= 3:
    print("No")
Problem p03556 (python)

Fixed submission:
import math 
N = int(input())
print(math.floor(math.sqrt(N))**2)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
list_N = list(range(1,N+1))
max = -9999
for i in range(N):
    if max < int(math.sqrt(list_N[i])):
        max = int(math.sqrt(list_N[i]))

print(max*max)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
list_N = list(range(1,N+1))
max = -999999999
sqrt_N = []
for i in range(N):
    if max < int(math.sqrt(list_N[i])):
        max = int(math.sqrt(list_N[i]))

print(max*max)
Problem p03563 (python)

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)

Buggy submission (verdict: Runtime Error):
R,G = map(int,input().split())
print(2*G-R)
Problem p03597 (python)

Fixed submission:
N = int(input())
A = int(input())
print(N*N - A)

Buggy submission (verdict: Runtime Error):
N = input()
A = input()
print((N*N)-A)

Buggy submission (verdict: Runtime Error):
N,A = map(int,input().split())
print((N*N)-A)
Problem p03671 (python)

Fixed submission:
a,b,c = map(int,input().split())
print(min(a+b,b+c,c+a))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
min = a+b
if min >= a+c:
    min = a+c
elif min >= b+c:
    min = b+c
print(str(min)
Problem p03693 (python)

Fixed submission:
r, g, b = map(str, input().split())
ans = r + g + b
# print(ans)
ans_i = int(ans)
 
if ans_i % 4 == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
r=int(input())
g=int(input())
b=int(input())
d=r*100+g*10+b
if d%4==0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
r=int(input(""))
g=int(input(""))
b=int(input(""))
d=r*100+g*10+b
if d%4==0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
r = int(input(""))
g = int(input(""))
b = int(input(""))
d = r*100 + g*10 + b
D = int(d)
if D % 4 == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
r = int(input(""))
g = int(input(""))
b = int(input(""))
d = r*100 + g*10 + b
if d % 4 == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
r = int(input(""))
g = int(input(""))
b = int(input(""))
d = r*100 + g*10 + b
if d % 4 == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
r = int(input(""))
g = int(input(""))
b = int(input(""))
r = r * 100
g = g * 10
d = r + g + b
if d % 4 == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
r = int(input(""))
g = int(input(""))
b = int(input(""))

r = r * 100
g = g * 10
b = b * 1

d = r + g + b
if d % 4 == 0:
    print("YES")
else:
    print("NO")
Problem p03694 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
print(max(a)-min(b))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
print(max(a) - min(b))
Problem p03697 (python)

Fixed submission:
a,b= map(int,input().split())
if a+b >= 10:
            print("error")
else:
            print(str(a+b))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split()))
if a+b >= 10:
            print("error")
else:
            print(str(a+b))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split()))
if a+b >= 10:
            print("error")
else:
            print(a+b)
Problem p02719 (python)

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

# print(N % K)
# print(N % abs(N-K))

# SN = N
# PN = float('inf')
# while PN > N:
#     PN = N
#     N = abs(N-K)
#     print(PN, N)

if N == K:
    print(0)

elif N > K:
    val = N % K
    print(min(abs(val), abs(val-K)))
else:
    SN = N
    PN = float('inf')
    while PN > N:
        PN = N
        N = abs(N-K)
    print(min(SN, PN))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
gap = abs(N - K)

if K == 1:
    print(0)
else:
    ans = N % gap
    print(ans)
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
A = [float('inf') for _ in range(N)]

for i in range(M):
    s, c = map(int, input().split())
    s -= 1
    
    if A[s] != float('inf') and A[s] != c:
        print(-1)
        exit()

    A[s] = min(A[s], c)
    #A[s] = c

for i in range(1, N):
    if A[i] == float('inf'):
        A[i] = '0'
    A[i] = str(A[i]) 

#print(A)

if A[0] == float('inf'):
    if len(A) == 1: A[0] = '0'
    else: A[0] = '1'
else:
    A[0] = str(A[0])

ans = int(''.join(A))

if len(str(ans)) == N: print(ans)
else: print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
SC = [[] for _ in range(N)]

error = False
for _ in range(M):
    s, c = map(int, input().split())
    s -= 1
    if SC[s] and SC[s] != c:
        error = True
        break
    else:
        SC[s] = c

if error:
    print(-1)
elif SC[0] == 0 and len(SC) > 1:
    print(-1)
else:
    if not SC[0]:
        SC[0] = 1
    if not SC[1]:
        SC[1] = 0
    if not SC[2]:
        SC[2] = 0
    print(''.join(map(str,SC)))
Problem p02823 (python)

Fixed submission:
def upper_cnt(a, b):
    upper_cnt = n-b + 1
    a += upper_cnt
    upper_cnt += ((n-a) // 2)    
    return upper_cnt

def lower_cnt(a, b):
    lower_cnt = a-1 + 1
    b -= lower_cnt
    lower_cnt += ((b-1) // 2)
    return lower_cnt

n, a, b = map(int, input().split())

if 0 == (b-a) % 2:
    print((b-a) // 2)

else:
    up = upper_cnt(a, b)
    low = lower_cnt(a, b)
    print(min(up, low))

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

if 0 == (b-a) % 2:
    print((b-a) // 2)

else:
    upper = max(a-1, b-1)
    lower = max(n-a, n-b)

	print(min(upper, lower))

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

if 0 == (b-a) % 2:
    print((b-a) // 2)

else:
    upper = max(a-1, b-1)
    lower = max(n-a, n-b)

print(min(upper, lower))
Problem p02918 (python)

Fixed submission:
n, k = map(int, input().split())
s = list(input())

cnt = 0

i = 1
while i < len(s):
    if cnt == k:
        break

    if s[i] != s[i-1]:
        cnt += 1
        start = i
        target = s[i]

        while  i < len(s) and target == s[i]:
            if s[i] == 'R': s[i] = 'L'
            else: s[i] = 'R'

            i += 1   

        continue    

    i += 1

ans = 0
for i in range(1, len(s)):
    if s[i] == s[i-1]:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = list(input())

cnt = 0

i = 1
while i < len(s):
    print(i, s, cnt)
    if cnt == k:
        break

    if s[i] != s[i-1]:
        cnt += 1
        start = i
        target = s[i]

        while  i < len(s) and target == s[i]:
            if s[i] == 'R': s[i] = 'L'
            else: s[i] = 'R'

            i += 1   

        continue    

    i += 1

ans = 0
for i in range(1, len(s)):
    if s[i] == s[i-1]:
        ans += 1

print(ans)
Problem p02936 (python)

Fixed submission:
n, q = map(int, input().split())
tree = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

cost = [0 for _ in range(n)]
for _ in range(q):
    pos, point = map(int, input().split())
    cost[pos-1] += point

memo = set([0])
stack = [0]

while len(stack) > 0:
    cur_node = stack.pop()
    cur_cost = cost[cur_node]

    for node in tree[cur_node]:
        if node not in memo:
            memo.add(node)
            cost[node] += cur_cost
            stack.append(node)

print(*cost)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
tree = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

cost = [0 for _ in range(n)]
for _ in range(q):
    pos, point = map(int, input().split())
    cost[pos-1] += point

ans = [0 for i in range(n)]
memo = [0]

def dfs(i, cnt, ans, memo):
    cnt += cost[i]
    ans[i] = cnt
    if not tree[i]:
        return

    for x in tree[i]:
        if x in memo:
            continue
        memo.append(x)
        dfs(x, cnt, ans, memo)

dfs(0, 0, ans, memo)

print(*ans)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
tree = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)

cost = [0 for _ in range(n)]
for _ in range(q):
    pos, point = map(int, input().split())
    cost[pos-1] += point

ans = [0 for i in range(n)]

def dfs(i, cnt, ans):
    cnt += cost[i]
    ans[i] = cnt
    if not tree[i]:
        return

    for x in tree[i]:
        dfs(x, cnt, ans)

dfs(0, 0, ans)

print(*ans)
Problem p03095 (python)

Fixed submission:
num = int(input())
words = input()
mod = 10**9+7

words_count = {}
for key in words:
    if key in words_count:
        words_count[key] += 1
    else:
        words_count[key] = 1

ans = 1
for key, val in words_count.items():
    ans *= (val + 1)

print((ans - 1) % mod)

Buggy submission (verdict: Runtime Error):
num = int(input())
words = input()

words_count = {}
for key in words:
    if words_count[key] in words_count:
        words_count[key] += 1
    else:
        words_count[key] = 1

ans = 1
for key, val in words_count:
    ans *= (val + 1)

print(ans - 1)
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

n, m = map(int, input().split())
graph = [[] for _ in range(n)]
dp = [-1 for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    graph[x-1].append(y-1)


def dfs(s):
    #print(s, dp)
    if dp[s] != -1:
        return dp[s]
    
    rep = 0
    for g in graph[s]:
        rep = max(rep, dfs(g)+1)
    dp[s] = rep
    return rep

#print(graph)
ans = 0
for i in range(n):
    #print('i:', i)
    ans = max(ans, dfs(i))

print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
graph = [[] for _ in range(n)]
dp = [-1 for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    graph[x-1].append(y-1)


def dfs(s):
    #print(s, dp)
    if dp[s] != -1:
        return dp[s]
    
    rep = 0
    for g in graph[s]:
        rep = max(rep, dfs(g)+1)
    dp[s] = rep
    return rep

#print(graph)
ans = 0
for i in range(n):
    #print('i:', i)
    ans = max(ans, dfs(i))

print(ans)
Problem p03316 (python)

Fixed submission:
n = input()
sn = sum(map(int, n))

print('Yes' if int(n) % sn == 0 else 'No')

Buggy submission (verdict: Runtime Error):
n = input()
sn = sum(map(int, n))

print('Yes' if n % sn == 0 else 'No')
Problem p03352 (python)

Fixed submission:
x = int(input())
ans = 1
for b in range(1, x):
    for p in range(2, x):
        if b ** p <= x:
            ans = max(ans, b**p)
        else: break

print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
ans = 0
for b in range(1, x):
    for p in range(2, x):
        if b ** p <= x:
            ans = max(ansm, b**p)

print(ans)
Problem p03386 (python)

Fixed submission:
A, B, K = map(int, input().split())
SA = list(range(A, min(B, A + K)))
SB = list(range(max(A, B - K + 1), B + 1))

ans = sorted(set(SA + SB))
for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
S = list(range(A, B + 1))

ans = sorted(set(S[:K] + S[-K:]))
for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
S = list(range(A, B + 1))

ans = set(S[:K] + S[-K:])
for a in ans:
    print(a)
Problem p03408 (python)

Fixed submission:
import collections

def insert_card(card_number, card_list):
    i = 0
    while i < card_number:
        card_list.append(input())
        i += 1


blue_card_number = int(input())
blue_card_list = []
insert_card(blue_card_number, blue_card_list)

red_card_number = int(input())
red_card_list = []
insert_card(red_card_number, red_card_list)

blue_card_collection = collections.Counter(blue_card_list)
red_card_collection = collections.Counter(red_card_list)

result_card_collection = blue_card_collection - red_card_collection

answer_collection = sorted(result_card_collection.items(), key=lambda x:x[1], reverse=True)
if answer_collection == []:
    print(0)
else:
    print(answer_collection[0][1])

Buggy submission (verdict: Runtime Error):
import collections

def insert_card(card_number, card_list):
    i = 0
    while i < card_number:
        card_list.append(input())
        i += 1


blue_card_number = int(input())
blue_card_list = []
insert_card(blue_card_number, blue_card_list)

red_card_number = int(input())
red_card_list = []
insert_card(red_card_number, red_card_list)

blue_card_collection = collections.Counter(blue_card_list)
red_card_collection = collections.Counter(red_card_list)

result_card_collection = blue_card_collection - red_card_collection

answer_collection = sorted(result_card_collection.items(), key=lambda x:x[1], reverse=True)
print(answer_collection[0][1])

Buggy submission (verdict: Runtime Error):
import collections

def insert_card(card_number, card_list):
    i = 0
    while i < card_number:
        card_list.append(input())
        i += 1


blue_card_number = int(input())
blue_card_list = []
insert_card(blue_card_number, blue_card_list)

red_card_number = int(input())
red_card_list = []
insert_card(red_card_number, red_card_list)

blue_card_collection = collections.Counter(blue_card_list)
red_card_collection = collections.Counter(red_card_list)

result_card_collection = blue_card_collection - red_card_collection

answer_collection = sorted(result_card_collection.items(), key=lambda x:x[1], reverse=True)
print(answer_collection[0][0])
Problem p03447 (python)

Fixed submission:
x, a, b = [int(input()) for i in range(3)]
print((x-a) % b)

Buggy submission (verdict: Runtime Error):
x, a, b = [int(input() for i in range(3))]
print((x-a) % b)