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

Fixed submission:
S=input()
list1=list(S)
if list1[0]==list1[1]==list1[2]==list1[3]:
  print("No")
else:
  if list1[0]==list1[1] and list1[2]==list1[3]:
    print("Yes")
  elif list1[0]==list1[2] and list1[1]==list1[3]:
    print("Yes")
  elif list1[0]==list1[3] and list1[1]==list1[2]:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
S=input()
list1=list(S)
if list1[0]==list1[2]==list1[3]==list1[4]:
  print("No")
else:
  if list1[0]==list1[1] and list1[2]==list1[3]:
    print("Yes")
  elif list1[0]==list1[2] and list1[1]==list1[3]:
    print("Yes")
  elif list1[0]==list1[3] and list1[1]==list1[2]:
    print("Yes")
  else:
    print("No")
Problem p02990 (python)

Fixed submission:
import math
N,K=map(int,input().split())
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(K):
  if N-K>i:
    ans=combinations_count(N-K+1,i+1)*combinations_count(K-1,i)
    ANS=ans%(10**9+7)
    print(ANS)
  elif N-K==i:
    ans=combinations_count(K-1,i)
    ANS=ans%(10**9+7)
    print(ANS)
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
N,K=map(int,input().split())
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(K):
  ans=combinations_count(N-K+1,i+1)*combinations_count(K-1,i)
  ANS=ans%(10**9+7)
  print(ANS)

Buggy submission (verdict: Runtime Error):
import math
N,K=map(int,input().split())
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(K):
  ans=combinations_count(N-K+1,i+1)*combinations_count(K-1,i)
  print(ans%(10**9+7))
Problem p03038 (python)

Fixed submission:
N,M = map(int, input().split())
listA = list(map(int, input().split()))
listA.sort()
 
listBC = [list(map(int, input().split())) for i in range(M)]
listBC = sorted(listBC, key=lambda x: x[1], reverse=True)
countB = 0
 
for i in range(M):
  B, C = listBC[i][0], listBC[i][1]
  listA += [C]*B
  countB += B
  if countB >= N:
    break

listA.sort(reverse=True)
print(sum(listA[:N]))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
listA = list(map(int, input().split()))
listA.sort()
 
listBC = [list(map(int, input().split())) for i in range(M)]
listBC = sorted(listBC, key=lambda x: x[1], reverse=True)
countB = 0
 
for i in range(M):
  B, C = listBC[i][0], listBC[i][1]
  listA += [C]*B
  countB += B
  if countB >= N:
    break

listA.sort(reverse=True)
print(sum(l[:N]))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
listA = list(map(int, input().split()))
listA.sort()
 
listBC = [list(map(int, input().split())) for i in range(M)]
listBC = sorted(bc, key=lambda x: x[1], reverse=True)
countB = 0
 
for i in range(M):
  B, C = listBC[i][0], listBC[i][1]
  listA += [C]*B
  countB += B
  if countB >= N:
    break

listA.sort(reverse=True)
print(sum(l[:N]))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
list1=list(map(int,input().split()))
listBC=[]
for _ in range(M):
  B,C=map(int,input().split())
  listBC+=[[C,B]]  
listBC.sort(reverse=True)
i=0
while min(list1)<listBC[i][0]:  
  list1+=[listBC[i][0]]*listBC[i][1]
  for k in range(listBC[i][1]):
    list1.remove(min(list1))
  i+=1  
SUM=sum(list1)
print(SUM)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
list1=list(map(int,input().split()))
listBC=[]
for _ in range(M):
  B,C=map(int,input().split())
  listBC+=[[C,B]]  
listBC.sort(reverse=True)
i=0
while min(list1)<listBC[i][0]:  
  list1.append(listBC[i][0]*listBC[i][1])
  for k in range(listBC[i][1]):
    list1.remove(min(list1))
  i+=1  
SUM=sum(list1)
print(SUM)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
list1=list(map(int,input().split()))
list2=[]
for _ in range(M):
  B,C=map(int,input().split())
  if len(list2)<N and C>min(list1):
    list2+=[C]*B  
  if C>min(list2) and len(list2)>N:
    list2+=[C]*B  
list3=list1+list2
list3.sort(reverse=True)
list5=list3[:N]
SUM=sum(list5)
print(SUM)
Problem p02688 (python)

Fixed submission:
# coding: utf-8
a,b = map(int, input().split())
count=[0]*a
for i in range(b):
    n = int(input())
    num_list = list(map(int, input().split())) 
    for j in num_list:
       count[j-1]+=1
c=0

for i in range(a):
    if count[i]==0:
        c+=1
print(c)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
a,b = map(int, input().split())
count=[0]*a
for i in range(b):
    n = int(input())
    num_list = list(map(int, input().split())) 
    for j in num_list:
       count[j-1]+=1
c=0

for i in range(b):
    if count[i]==0:
        c+=1
print(c)
Problem p02754 (python)

Fixed submission:
n, a, b = map(int, input().split())
period = a+b
times = n//period
k = n%period
n =  a if k >a else k
print(times*a + n)

Buggy submission (verdict: Runtime Error):
from collections import Counter 
n, a, b = map(int, input().split())
red = "r"*b
blue = "b"*a
k=""
while len(k) <= n:
    k += blue+red 
count = Counter(k[:n]) 
print(count['b'])
Problem p02829 (python)

Fixed submission:
n1 = int(input())
n2 = int(input())
choices = [1,2,3]
choices.remove(n1)
choices.remove(n2)
print(choices[0])

Buggy submission (verdict: Runtime Error):
n1 = input()
n2 = input()
choices = [1,2,3]
choices.remove(n1)
choices.remove(n2)
print(choices[0])

Buggy submission (verdict: Runtime Error):
n1 = input()
n2 = input()
choices = [1,2,3]
choices.remove(n1)
choices.remove(n2)
print(choices[0])
Problem p02835 (python)

Fixed submission:
import functools
n = functools.reduce(lambda x,y: int(x)+int(y), input().split())
print("bust" if n>=22 else "win")

Buggy submission (verdict: Runtime Error):
n = int(input())
print("bust" if n>=22 else "win" )
Problem p02693 (python)

Fixed submission:
k=int(input())
a,b=map(int,input().split())
if a%k==0:
    print('OK')
else:
    
    if a//k*k+k<=b:
        print('OK')
    else:
        print('NG')

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
maxs=0
if a>=b:
    if n>=b:
        maxs=a/b*(b-1)-(a%b*(b-1))%b/b
    else:
        maxs=a/b*n-(a%b*n)%b/b
else:
    if n>=b:
        maxs=(a*(b-1))//b
    else:
        maxs=(a*n)//b
print(int(maxs))

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
maxs=0
if a>=b:
    if n>=b:
        maxs=a/b*(b-1)-(a%b*(b-1))%b/b
    else:
        maxs=a/b*n-(a%b*n)%b/b
else:
    if n>=b:
        maxs={a*(b-1)}//b
    else:
        maxs={a*n}//b
print(int(maxs))
Problem p02723 (python)

Fixed submission:
S=list(input())
print('Yes'if S[2]==S[3]and S[4]==S[5] else 'No')

Buggy submission (verdict: Runtime Error):
K,N=map(int,input().split())
A=list(map(int,input().split()))
A=sorted(A)
A.append(A[0]+K)
i=0
b=0
for i in range(N):
    if b<A[i+1]-A[i]:
        b=A[i+1]-A[i]
print(K-b)
Problem p02695 (python)

Fixed submission:
import itertools

N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]

# 重複組み合わせ: nHr = n+r-1Cr を考える
ans = 0
R = [i for i in range(1, M+1)]
# print(R)

for comb in itertools.combinations_with_replacement(R, N):
    temp = 0
    for abcd in ABCD:
        a, b, c, d = abcd
        if comb[b-1] - comb[a-1] == c:
            temp += d
    if temp >= ans:
        ans = temp

    # print("comb: {}, temp: {}, ans: {}".format(comb, temp, ans))

print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]

# 重複組み合わせ: nHr = n+r-1Cr を考える
ans = 0
for comb in itertools.combinations_with_replacement([i for i in range(1, N+2)], M):
    temp = 0
    for abcd in ABCD:
        a, b, c, d = abcd
        if comb[b-1] - comb[a-1] == c:
            temp += d
    if temp >= ans:
        ans = temp

    # print("comb: {}, temp: {}, ans: {}".format(comb, temp, ans))

print(ans)
Problem p02735 (python)

Fixed submission:
H, W = map(int, input().split())
S = [input() for _ in range(H)]

dp = [[float('inf') for _ in range(W)] for _ in range(H)]

if S[0][0] == '#':
    dp[0][0] = 1
else:
    dp[0][0] = 0

for i in range(1, W):
    if S[0][i] == '.':
        dp[0][i] = dp[0][i-1]
    else:
        if S[0][i-1] == '.':
            dp[0][i] = dp[0][i-1] + 1
        else:
            dp[0][i] = dp[0][i-1]

for j in range(1, H):
    if S[j][0] == '.':
        dp[j][0] = dp[j-1][0]
    else:
        if S[j-1][0] == '.':
            dp[j][0] = dp[j-1][0] + 1
        else:
            dp[j][0] = dp[j-1][0]

for j in range(1, H):
    for i in range(1, W):
        if S[j][i-1] == '.' and S[j][i] == '#':
            dp[j][i] = min(dp[j][i], dp[j][i-1] + 1)
        else:
            dp[j][i] = min(dp[j][i], dp[j][i-1])
        if S[j-1][i] == '.' and S[j][i] == '#':
            dp[j][i] = min(dp[j][i], dp[j-1][i] + 1)
        else:
            dp[j][i] = min(dp[j][i], dp[j-1][i])

print(dp[H-1][W-1])

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.extend(input())

T = [-1] * H * W
if S[0] == '#':
    T[0] = 1
else:
    T[0] = 0
S[0] = '-'

k = 0
v = T[k]
R = {k:v}

def get_search_address(add):
    p = []
    x = add % W
    y = add // W
    next_x = x+1
    next_y = y+1
    if next_x <= (H-1):
        p.append(W*y+next_x)
    if next_y <= (W-1):
        p.append(W*next_y+x)
    return p

while R:
    k = min(R, key=R.get)
    # print('k:{}'.format(k))
    p = get_search_address(k)
    # print('p:{}'.format(p))
    for n in p:
        # print('n:{}'.format(n))
        if T[n] == -1:
            if S[n] == '-':
                if T[k]+1 < T[n]:
                    T[n] = T[k]+1
            elif S[n] == '#':
                T[n] = T[k]+1
                S[n] = '-'
                R[n] = T[n]
            else:
                T[n] = T[k]
                S[n] = '-'
                R[n] = T[n]
    del R[k]
    # print('R:{}'.format(R))
    # print('T:{}'.format(T))

print(T[H*W-1])

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.extend(input())

T = [-1] * H * W
if S[0] == '#':
    T[0] = 1
else:
    T[0] = 0
S[0] = '-'

k = 0
v = T[k]
R = {k:v}

def get_search_address(add):
    p = []
    x = add % W
    y = add // W
    next_x = x+1
    next_y = y+1
    if next_x <= (H-1):
        p.append(W*y+next_x)
    if next_y <= (W-1):
        p.append(W*next_y+x)
    return p

while R:
    k = min(R, key=R.get)
    # print('k:{}'.format(k))
    p = get_search_address(k)
    # print('p:{}'.format(p))
    for n in p:
        # print('n:{}'.format(n))
        if T[n] == -1:
            if S[n] == '-':
                if T[k]+1 < T[n]:
                    T[n] = T[k]+1
            elif S[n] == '#':
                T[n] = T[k]+1
                S[n] == '-'
                R[n] = T[n]
            else:
                T[n] = T[k]
                S[n] == '-'
                R[n] = T[n]
    del R[k]
    # print('R:{}'.format(R))
    # print('T:{}'.format(T))

print(T[H*W-1])
Problem p02754 (python)

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

if A==B==0:
    print(0)
else:
    print(N//(A+B)*A + min(N%(A+B), A))

Buggy submission (verdict: Runtime Error):
N, A, B = int(input())

print(N//(A+B)*B + max(N%(A+B)-A, 0))
Problem p02833 (python)

Fixed submission:
N = int(input())

if N % 2 == 1:
    ans = 0
else:
    count = 1
    ans = 0
    while N//2 >= 5**count:
        ans += N//(2*5**count)
        count+=1

print(ans)

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

if N % 2 == 1:
    ans = 0
else:
    count = 1
    num5 = 0
    while N//2 >= 5**count:
        num5 += N//(2*5**count)
        count+=1

print(num5)
Problem p02989 (python)

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

D = sorted(D)
left = D[N//2-1]
right = D[N//2]
# print("left: {}, right: {}".format(left, right))
print(right-left)

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

D = sorted(D)
left = D[N//2]
right = D[N//2+1]

print(right-left)
Problem p03038 (python)

Fixed submission:
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
BC = []
for _ in range(M):
    B, C = map(int, input().split())
    BC.append([B, C])
BC = sorted(BC, key=lambda x: x[1], reverse=True)
# print("A: {}".format(A))
# print("BC: {}".format(BC))

A_dash = []
for ij in BC:
    i, j = ij
    A_dash.extend([j]*i)
    if len(A_dash) >= N:
        break
A_dash = A_dash[:N]

A_dash.extend(A)
A_dash = sorted(A_dash, reverse=True)[:N]

print(sum(A_dash))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
min_val = sorted(A)[0]
for _ in range(M):
  B, C = map(int, input().split())
  if min_val <= C:
  	A.extend([C]*B)
    A = sorted(A)[:N]
    min_val = A[0]
  
A = sorted(A, reverse=True)
print(sum(A[:N]))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
min_val = sorted(A)[0]
for _ in range(M):
  B, C = map(int, input().split())
  if min_val <= C:
  	A.extend([C]*B)
    A = sorted(A, reverse=True)
    min_val = A[0]
  
A = sorted(A, reverse=True)
print(sum(A[:N]))
Problem p03053 (python)

Fixed submission:
from collections import deque

H, W = map(int, input().split())

m = [[0 for _ in range(W)] for _ in range(H)]
root = []
for i in range(H):
    # m.append(list(map(lambda x: 0 if x=="#" else 1, input()))）
    for j, c in enumerate(input()):
        if c == "#":
            m[i][j] = 1
            root.append((i, j))

# print(m)
# print(root)

queue = deque(root)
visited = deque(root)
visited_extend = visited.extend
ans = 0
while len(visited) < H*W:
    # print(visited)
    ans += 1
    new_queue = deque([])
    while queue:
        p = queue.popleft()
        for i, j in ([-1, 0], [1, 0], [0, 1], [0, -1]):
            next_p = (p[0] + i, p[1] + j)
            if (0 <= next_p[0] < H) and (0 <= next_p[1] < W):
                if not m[next_p[0]][next_p[1]]:
                    m[next_p[0]][next_p[1]] = 1
                    new_queue.append(next_p)
    visited_extend(new_queue)
    queue = new_queue
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
input = sys.stdin.readline

m = [list(map(lambda x: 1 if x=="#" else 0, input())) for _ in range(H)]
black = [(i, j, 0) for i in range(H) for j in range(W) if m[i][j] == 1]

# print(m)
# print(black)

queue = deque(black)
queue_append = queue.append
ans = 0
while queue:
    p = queue.popleft()
    if ans < p[2]:
        ans += 1
    for i, j in ((-1, 0), (1, 0), (0, 1), (0, -1)):
        next_p = (p[0] + i, p[1] + j)
        if (0 <= next_p[0] < H) and (0 <= next_p[1] < W):
            if not m[next_p[0]][next_p[1]]:
                m[next_p[0]][next_p[1]] = 1
                queue_append((next_p[0], next_p[1], ans+1))
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import numpy
from collections import deque
input = sys.stdin.readline

H, W = map(int, input().split())

m = np.zeros(H, W)
root = []
for i in range(H):
    # m.append(list(map(lambda x: 0 if x=="#" else 1, input()))）
    for j, c in enumerate(input()):
        if c == "#":
            m[i][j] = 1
            root.append((i, j))

# print(m)
# print(root)

queue = deque(root)
visited = deque(root)
visited_extend = visited.extend
ans = 0
while len(visited) < H*W:
    # print(visited)
    ans += 1
    new_queue = deque([])
    while queue:
        p = queue.popleft()
        for i, j in ((-1, 0), (1, 0), (0, 1), (0, -1)):
            next_p = (p[0] + i, p[1] + j)
            if (0 <= next_p[0] < H) and (0 <= next_p[1] < W):
                if not m[next_p[0]][next_p[1]]:
                    m[next_p[0]][next_p[1]] = 1
                    new_queue.append(next_p)
    visited_extend(new_queue)
    queue = new_queue
print(ans)
Problem p03252 (python)

Fixed submission:
S = input()
T = input()
N = len(S)

dict_S = {}
dict_T = {}

for i in range(N):
    # print("dict_S: {}".format(dict_S))
    # print("dict_T: {}".format(dict_T))
    if S[i] in dict_S:
        if dict_S[S[i]] != T[i]:
            print("No")
            exit()
    if T[i] in dict_T:
        if dict_T[T[i]] != S[i]:
            print("No")
            exit()
    dict_S[S[i]] = T[i]
    dict_T[T[i]] = S[i]
print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
N = len(S)

dict_S = {}
dict_T = {}

for i in range(N):
    if S[i] in dict_S:
        if dict_S[S[i]] != T[i]:
            print("No")
            eixt()
    if T[i] in dict_T:
        if dict_T[T[i]] != S[i]:
            print("No")
            exit()
    dict_S[S[i]] = T[i]
    dict_T[T[i]] = S[i]
print("Yes")
Problem p03723 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A == B == C and A % 2 == 0:
  print(-1)
else:
  count = 0
  while 0 == A % 2 == B % 2 == C % 2:
    _A = (B + C) // 2
    _B = (C + A) // 2
    _C = (A + B) // 2
    A = _A
    B = _B
    C = _C
    count += 1
    # print("A: {}, B: {}, C: {}".format(A, B, C))
  print(count)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A == B == C:
  print(-1)
else:
  count = 0
  while 0 == A % 2 == B % 2 == C % 2:
	A = (B + C) // 2
    B = (C + A) // 2
    C = (A + B) // 2
    count += 1
  print(count)
Problem p03775 (python)

Fixed submission:
N = int(input())

for i in range(int(N**0.5)+1, 0, -1):
    div, mod = divmod(N, i)
    if not mod:
        print(len(str(max(div, N//div))))
        exit()

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

for i in range(N**0.5, 0, -1):
    div, mod = divmod(N)
    if not mod:
        print(len(str(min(div, N//div))))
Problem p03805 (python)

Fixed submission:
import itertools

def main():
    N, M = map(int, input().split())
    VE = tuple(tuple(map(lambda x: int(x)-1, input().split())) for _ in range(M))
    # print(VE)

    adj_mat = [[0 for _ in range(N)] for _ in range(N)]
    for ve in VE:
        adj_mat[ve[0]][ve[1]] = 1
        adj_mat[ve[1]][ve[0]] = 1
    # for row in adj_mat:
    #     print(row)

    ans = 0
    for perm in itertools.permutations([i for i in range(1, N)]):
        # print(perm)
        flag = True
        now_V = 0
        for next_V in perm:
            # print('{} to {}'.format(now_V, next_V))
            # print('{}'.format(adj_mat[now_V][next_V]))
            if not adj_mat[now_V][next_V]:
                flag = False
                break
            now_V = next_V
        if flag:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import itertools

def main():
    N, M = map(int, input().split())
    VE = tuple(tuple(map(lambda x: int(x)-1, input().split())) for _ in range(M))
    # print(VE)

    adj_mat = [[0 for _ in range(N)] for _ in range(M)]
    for ve in VE:
        adj_mat[ve[0]][ve[1]] = 1
        adj_mat[ve[1]][ve[0]] = 1
    # for row in adj_mat:
    #     print(row)

    ans = 0
    for perm in itertools.permutations([i for i in range(1, N)]):
        # print(perm)
        flag = True
        now_V = 0
        for next_V in perm:
            # print('{} to {}'.format(now_V, next_V))
            # print('{}'.format(adj_mat[now_V][next_V]))
            if not adj_mat[now_V][next_V]:
                flag = False
                break
            now_V = next_V
        if flag:
            ans += 1

    print(ans)

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

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

ans = 0
for x in range(K+1):
    n = 0
    if S < x:
        break
    for y in range(K+1):
        n = S - (x + y)
        if 0 <= n <= K:
            ans += 1

print(ans)

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

ans = 0
for x in range(K+1):
    xyz = x
    if S > xyz:
        continue
    for y in range(K+1):
        xyz += y
        if S > xyz:
            continue:
        for z in range(K+1):
            xyz += z
            if xyz == S:
                ans += 1

print(ans)
Problem p02627 (python)

Fixed submission:
alpha = input()

large = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
            'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

small = [i.lower() for i in large]

if alpha in large:
    print("A")
else:
    print("a")

Buggy submission (verdict: Runtime Error):
alpha = input()

large = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
            'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

small = [i.lower() for i in large]

if alpha in large:
    print("A")
else:
    pritn("a")
Problem p02793 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7
def gcd(a, b):
    if b ==0:
        return a
    else:
        return gcd(b,a%b)

mk = 1
for i in a:
    mk = mk * i//gcd(mk, i)

k = 0
for j in a:
    k +=  mk // j
print(k %MOD)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7
def gcd(a, b):
    if b ==0:
        return a
    else:
        return gcd(b,a%b)

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

mk = 1
for i in a:
    mk = lcm(mk, i)


k = 0
for j in a:
    k = (k +  mk / j) %MOD
print(int(k %MOD))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7
def gcd(a, b):
    if b ==0:
        return a
    else:
        return gcd(b,a%b)

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


mk = 1
for i in a:
    mk = lcm(mk, i)


k = 0
for i in a:
    k = (k +  mk / i) %MOD
print(int(k %MOD))
Problem p03013 (python)

Fixed submission:

n,m=map(int,input().split())
a=[1]*(n+1)
for i in range(m):
    a[int(input())]=0
p0=a[0]
p1=a[1]
for i in range(2,n+1):
    if a[i]==1:
        p2=p0+p1
    else:
        p2=0
    p0,p1=p1,p2
print(p1%1000000007)

Buggy submission (verdict: Runtime Error):

n,m=map(int,input().split())
a=[1]*(n+1)
for i in range(m):
    a[int(input())]=0
memo={}

def count(p):
    if p in memo:
        return memo[p]
    if p==0:
        return 1
    if p==1:
        return a[p]
    if a[p]==1:
        x=count(p-1)+count(p-2)
        memo[p]=x
        return x
    else:
        memo[p]=0
        return 0
print(count(n)%1000000007)
Problem p02711 (python)

Fixed submission:
s=(input())
a = [int(c) for c in s]
if a[0]==7 or a[1]==7 or a[2]==7:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
a = [str(c) for c in s]
ans=0
r=0
g=0
b=0
er=0
for i in range(n):
    if a[i]=='R':
        r+=1
        ans=ans+g*b
    elif a[i]=='G':
        g+=1
        ans=ans+r*b
    else:
        b+=1
        ans=ans+g*r
for i in range(1,n+1//3):
    for j in range(i,n):
        k=j+i
        l=k+i
        if l<n:
            if a[l]!=a[j] and a[j]!=a[k] and a[k]!=a[l]:
                er+=1
print(ans-er)

Buggy submission (verdict: Runtime Error):
s=int(input())
a = [int(c) for c in s]
if a[0]==7 or a[1]==7 or a[2]==7:
    print('Yes')
else:
    print('No')
Problem p02753 (python)

Fixed submission:
a = input()
b = list(a)
if b[0]=='A' and b[1]=='A' and b[2]=='A':
    print('No')
elif b[0]=='B' and b[1]=='B' and b[2]=='B':
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
import numpy as np
a = list(map(int,input().split()))
b = a[0]/0.08
c = (a[0]+1)/0.08
d = a[1]/0.1
e = (a[1]+1)/0.1
f=20000
if b<d:
    min=b
else :
    min =d
g=int(np.ceil(min))
for i in range(g,10001):
    if i>=b and i<=c:
        if i>=d and i<=e:
            f = i
            break
if f==20000:
    print(-1)
else:
    print(f)
Problem p02771 (python)

Fixed submission:
a = list(map(int,input().split()))
b = 0
if a[0]==a[1] and a[1]==a[2]:
    print("No")
elif a[0]!=a[1] and a[1]!=a[2] and a[0]!=a[2]:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = 0
f a[0]==a[1]:
    if a[1] == a[2]:
        print("No")
        b=1
if b==0:
    print("Yes")