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

Fixed submission:
#!/usr/bin/env python3
import bisect
import numpy as np

N, M = list(map(int, input().split()))
a_list = list(map(int, input().split()))
bc_list = []

for i in range(M):
    b, c = list(map(int, input().split()))
    bc_list.append((b, c))

bc_list = sorted(bc_list, key=lambda x: x[1], reverse=True)
a_list = sorted(a_list)

fix_list = []
s = 0
b, c = bc_list[0]
bc_index = 0
count_b = 0

for a in a_list:
    if count_b >= b:
        bc_index += 1
        if bc_index >= len(bc_list):
            s += a
            continue
        count_b = 0
        b, c = bc_list[bc_index]

    if a < c:
        s += c
    else:
        s += a
    count_b += 1

ans = s
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[0]*M
C=[0]*M
D=[]
for i in range(M):
    B[i],C[i]=map(int,input().split())
    D+=[C[i]]*B[i]
D=np.sort(D)[::-1]
A = np.sort(A)

for i in range(sum(B)):
    if A[i] < D[i]:
        A[i]=D[i]
    else:
        break
    if i==N-1:
        break
print(sum(A))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[0]*M
C=[0]*M
D=[]
for i in range(M):
    B[i],C[i]=map(int,input().split())
    D+=[C[i]]*B[i]
D=np.sort(D)[::-1]
A = np.sort(A)

for i in range(N):
    if A[i] < D[i]:
        A[i]=D[i]
    else:
        break
    if i==N-1:
        break
print(sum(A))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[0]*M
C=[0]*M
for i in range(M):
    B[i],C[i]=map(int,input().split())

for i in range(M):
    A = np.sort(A)
    for j in range(B[i]):
        if A[j] < C[i]:
            A[j]=C[i]
        else:
            break
        if j==N-1:
            break
print(sum(A))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[0]*M
C=[0]*M
for i in range(M):
    B[i],C[i]=map(int,input().split())

for i in range(M):
    A = np.sort(A)
    for j in range(B[i]):
        if A[j] < C[i]:
            A[j]=C[i]
            print(i,j)
        else:
            break
        if j==N-1:
            break
print(sum(A))
Problem p02682 (python)

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

if a>k:
  ak=a-k
  ans=ans-ak
if a+b<k:
  ans=ans-(k-(a+b))

print(ans)

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

l = [1]*a
bl = [0]*b
cl = [-1]*c

l.extend(bl)
l.extend(cl)

for i in l:
  ans = ans+i
  m=m+1
  if m==k:
    break

print(ans)
Problem p02689 (python)

Fixed submission:
def main():
    n,m = map(int,input().split())
    h = list(map(int,input().split()))
    A = [0] * n
    for i in range(m):
        a,b = map(int,input().split())
        A[a-1] = max(A[a-1],h[b-1])
        A[b-1] = max(A[b-1],h[a-1])

    cnt = 0

    for i in range(n):
        if A[i] < h[i]:
            cnt += 1

    print(cnt)
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n,m = map(int,input().split())
    h = list(map(list,input().split()))

    for i in range(n):
        h[i].append(int(h[i][0]))

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

    cnt = 0

    for i in range(n):
        if (max(h[i][1:]) == int(h[i][0])):
            if len(h[i][1:]) == len(set(h[i][1:])):
                cnt += 1
    print(cnt)
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def has_duplicates(seq):
    return len(seq) == len(set(seq))

def main():
    n,m = map(int,input().split())
    h = list(map(list,input().split()))

    # h[0].append(int(h[1][0]))
    for i in range(n):
        h[i].append(int(h[i][0]))

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

    cnt = 0

    for i in range(n):
        if max(h[i][1:]) == int(h[i][0]):
            if has_duplicates(h[i][1:]):
                cnt +=1
    print(cnt)
    
if __name__ == "__main__":
    main()
Problem p02594 (python)

Fixed submission:
def ProblemA(X):
    if X>=30:
        print('Yes')
    else:
        print('No')
X=int(input())
ProblemA(X)

Buggy submission (verdict: Runtime Error):
def ProblemA(X):
    if X>=30:
        print('Yes')
    else;
        print('No')
X=int(input())
ProblemA(X)
Problem p02598 (python)

Fixed submission:
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=1
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=0
    for i in range(N):
        if A[i]%x==0:
            m+=A[i]//x-1
        else:
            m+=A[i]//x
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)

Buggy submission (verdict: Runtime Error):
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=0
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=0
    for i in range(N):
        if A[i]%x==0:
            m+=A[i]//x-1
        else:
            m+=A[i]//x
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)

Buggy submission (verdict: Runtime Error):
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=0
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=sum([A[i]//x for i in range(N)]) # x以下にするための回数
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)

Buggy submission (verdict: Runtime Error):
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=0
y=copy.copy(a)
while l<=a:
    x=(l+a)//2
    m=sum([A[i]//x for i in range(N)]) # x以下にするための回数
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)
Problem p02623 (python)

Fixed submission:
N, M, K=map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
LA = [0]
LB = [0]
for i in range(N):
    C=LA[i]+A[i]
    if C>K:
        N=i
        break
    else:
        LA.append(C)
for j in range(M):
    C=LB[j]+B[j]
    if C>K:
        M=j
        break
    else:
        LB.append(C)
r=N
for i in range(N+1):
    u=0
    for j in range(r-N+i,M+1):
        if LA[N-i]+LB[j]>K:
            r=max(r,N-i+j-1) # 最大のrを求めたいので結果をrefineする場合だけで回す
            u=1
            break
    if u==0:
        r=max(r,N-i+M)
        break
print(r)

Buggy submission (verdict: Runtime Error):
import copy
L = list(map(int, input().split())) # N, M, K=map(int,input().split())
N=L[0]
M=L[1]
K=L[2]
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = 0
b = 0
p=N
q=M
for i in range(N):
    a=a+A[i]
    if a>K:
        a=a-A[i]
        p=i
        break
if a<K:
    X=K-a
    for j in range(M):
        b=b+B[j]
        if b>X:
            b=b-B[j]
            q=j
            break
c=a+b
count=p+q
F=[p+q]
u=0
for i in range(p):
    u=0
    c=c-A[p-i-1]
    count=count-1
    for j in range(M-q):
        c=c+B[q+j]
        if K<c:
            c=c-B[q]
            F.append(copy.copy(count))
            u=1
            break
        else:
            count=count+1
            q=q+1
    if u==0:
        F.append(copy.copy(count))
        break
print(max(F))
Problem p02629 (python)

Fixed submission:
N=int(input())
Al=['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']
s=''
M=[26**i for i in range(12)]
k=0
for i in range(12):
    k=k+M[i]
    if N<k:
        m=k-M[i]
        N=N-m
        L=[0]
        n=0
        for j in range(1, i+1):
            L.append(N%M[j])
            s=Al[(L[j]-L[j-1])//M[j-1]]+s
        break
print(s)

Buggy submission (verdict: Runtime Error):
=int(input())
Al=['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']
s=''
M=[26**i for i in range(12)]
S=[]
k=0
for i in range(11):
    k=k+M[i]
    if N<k:
        m=k-M[i]
        N=N-m
        L=[0]
        n=0
        for j in range(1, i+1):
            L.append(N%M[j])
            s=Al[(L[j]-L[j-1])//M[j-1]]+s
        break
print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
Al=['z','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']
s=''
L=[]
M=[26**i for i in range(12)]
for i in range(1,12):
    if M[i-1]<=N:
        L.append(N%M[i])
    else:
        l=i
        break
for i in range(l-1):
    if i==0:
        s=s+Al[L[i]]
    else:
        s=Al[(L[i]-L[i-1])//M[i]]+s
print(s)
Problem p02689 (python)

Fixed submission:
N, M = input().split()
height = input().split()
able = []
for n in range(int(N)):
  able.append([])
for m in range(int(M)):
  con = input().split()
  con[0] = int(con[0]) - 1
  con[1] = int(con[1]) - 1
  able[con[0]].append(int(height[con[1]]))
  able[con[1]].append(int(height[con[0]]))
good = []
for n in range(int(N)):
  if len(able[n]) == 0:
    good.append(n)
  else:
    if int(height[n]) > max(able[n]):
      good.append(n)
print(len(good))

Buggy submission (verdict: Runtime Error):
N, M = input().split()
height = input().split()
able = []
for n in range(int(N)):
  able.append([])
for m in range(int(M)):
  con = input().split()
  con[0] = int(con[0]) - 1
  con[1] = int(con[1]) - 1
  able[con[0]].append(height(con[1]))
  able[con[1]].append(height(con[0]))
good = []
for n in range(int(N)):
  if len(able[n]) == 0:
    good.append(n)
  else:
    if int(height[n]) > max(able[n])
      good.append(n)
print(len(good))
Problem p02659 (python)

Fixed submission:
from decimal import *
a,b = input().split()
ans = Decimal(a) * Decimal(b)
print(ans.quantize(Decimal("1"),rounding=ROUND_DOWN))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
ans=a*b
print(math.floor(ans))
Problem p02897 (python)

Fixed submission:
n=int(input())
if n%2==0:
  print(0.5)
else:
  print((n//2+1)/n)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n%2==0:
  print(0.5)
else:
  print((n//2+1)/(n//2))
Problem p02915 (python)

Fixed submission:
print(int(input())**3)

Buggy submission (verdict: Runtime Error):
print(int(input())**3
Problem p03207 (python)

Fixed submission:
p=sorted([int(input()) for _ in range(int(input()))])
print(sum(p[0:-1])+p[-1]//2)

Buggy submission (verdict: Runtime Error):
p=sorted([int(input()) for _ in range(int(input()))])
print(sum(p[0:-1]+p[-1]/2)
Problem p03834 (python)

Fixed submission:
s=input().split(",")
print(*s)

Buggy submission (verdict: Runtime Error):
s=input.split(",")
print(*s)

Buggy submission (verdict: Runtime Error):
s=list(input.split(","))
print(*s)
Problem p02688 (python)

Fixed submission:
n, k = map(int, input().split())
li = []
for x in range(k*2):
    li.append(input().split())
li2 = []
i = 1
while i < k*2:
    for j in li[i]:
        li2.append(j)
    i += 2
li2 = set(li2)
print(n - len(li2))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
list1, list2, k = [], [], k*2
for x in range(k):
    list1.append(input().split())
while i < k:
    for j in list1[i]:
        list2.append(j)
    i += 2
print(n - len(set(list2)))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
list1, list2, k = [], [], k*2
for x in range(k):
    list1.append(input().split())
while i < k:
    for j in list1[i]:
        list2.append(j)
    i += 2
print(n - len(set(list2)))
Problem p02693 (python)

Fixed submission:
count, K = 0, int(input())
A, B = map(int, input().split())
for i in range(A, B+1):
    if i % K == 0:
        count += 1
print('OK' if count > 0 else 'NG')

Buggy submission (verdict: Runtime Error):
K, A, B = map(int, input().split())
count = 0
for i in range(A, B+1):
    if i % K == 0:
        count += 1
print('OK' if count > 0 else 'NG')
Problem p02723 (python)

Fixed submission:
string = input("").lower()
print("Yes" if (string[2] == string[3]) and (string[4] == string[5]) else "No")

Buggy submission (verdict: Runtime Error):
K, N = input().split()
i, lists = 0, []
while i < N:
    lists.append(eval(input()))
    i += 1
if 0 in lists:
   lists.remove(0) 
print(max(lists) - min(lists))

Buggy submission (verdict: Runtime Error):
string = input("").lower()
print("Yes" if string[3] == string[4] and string[5] == string[6] else "No")
Problem p02779 (python)

Fixed submission:
n = int(input())
a = input().split(" ")
b = set(a)
if len(b)<len(a):
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input().split(" ")
b = set(a)
print "YES" if len(b) > len(a) else "NO"
Problem p02835 (python)

Fixed submission:
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")

Buggy submission (verdict: Runtime Error):
s = int(input()).split(" ")
print("bust") if sum(s) >= 22 else print("win")
Problem p02873 (python)

Fixed submission:
s=input()+"1"
a=0
b=[]
i=0
l=len(s)
e=0
while True:
    if s[i]==s[i+1]:
        a+=1
    else:
        b.append(a+1)
        a=0
    i+=1
    if i+1>=l:
        break
if s[-2]=='<':
    b.append(0)
if s[0]=='>':
    b.insert(0,0)
for i in range(len(b)//2):
    c,d=max(b[i*2],b[i*2+1]),min(b[i*2],b[i*2+1])
    e+=(c*(c+1)//2)+(d*(d-1)//2)
print(e)

Buggy submission (verdict: Runtime Error):
print(s)
n=len(s)#長さ

c=0#非負整数列
N=0
j=0
k=0
for i in range(1,n):
  if (s[i-1]=="<" and s[i]==">"):
    #print(i)
    j=i
    N+=math.factorial(i-k)
    #print("<>",i-k)
  if (s[i-1]==">" and s[i]=="<"):
    k=i
    N+=math.factorial(i-j)
    #print("><",i-j)
print(N)
Problem p02897 (python)

Fixed submission:
N = int(input())
print(((N + 1)//2)/N)
  		
#int(input()) で入力された数値をint型で受け取る
#(N+1)//:N+1を2で割ったものが
#切り捨て除算
#(8+1)//2=4,(9+1)//2=5:これが正整数Nに含まれる奇数の数になる

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = list(map(int, input().split()))
 
cnt = 0
for i in range(len(h)):
    if h[i] >= K:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
int N = input()
float a
if N === 1:
	a = N/1
elif:
	if N%2 == 0:
    	a = N/2
    elif:
      	a = (N-2)/N
        
print(a)
Problem p02915 (python)

Fixed submission:
s = int(input())
print(pow(s,3))

Buggy submission (verdict: Runtime Error):
s = int(input())
print s
Problem p02689 (python)

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
AB=[]
for i in range(M):
    AB.append(list(map(int,input().split())))

J=[0]*N
for i in range(M):
    if H[AB[i][0]-1]<H[AB[i][1]-1]:
        J[AB[i][0]-1]+=1
    elif H[AB[i][0]-1]==H[AB[i][1]-1]:
        J[AB[i][0]-1]+=1
        J[AB[i][1]-1]+=1    
    else:
        J[AB[i][1]-1]+=1
c=0
for i in J:
    if i == 0:
        c+=1

print(c)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
H=list(map(int,input().split()))
AB=[]
for i in range(M):
    AB.append(list(map(int,input().split())))

J=[0]*N
for i in range(M):
    if H[AB[i][0]-1]<H[AB[i][1]-1]:
        J[AB[i][0]]+=1
    else:
        J[AB[i][1]]+=1
c=0
for i in J:
    if i == 0:
        c+=1

print(c)
Problem p02595 (python)

Fixed submission:
import numpy as np
temp = input().split()
s = [input().split() for i in range(int(temp[0]))]
cnt = 0
for i in range(int(temp[0])):
  if np.sqrt(int(s[i][0])*int(s[i][0]) + int(s[i][1])*int(s[i][1])) <= int(temp[1]):
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
    import numpy as np
     
    temp = input().split()
     
    s = [input().split() for i in range(int(temp[0]))]
     
    cnt = 0
     
    for i in range(int(temp[0])):
      if np.sqrt(int(s[i][0])*int(s[i][0]) + int(s[i][1])*int(s[i][1])) <= int(temp[1]):
        cnt += 1
     
    print(cnt)
Problem p02701 (python)

Fixed submission:
n = int(input())
s = [input() for i in range(n)]
ans_set = set(s)
print(len(ans_set))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(3)]
ans_set = set(s)
print(len(ans_set))
Problem p02835 (python)

Fixed submission:
A = list(map(int, input().split()))
if sum(A) >= 22:
    print("bust")
else:
    print("win ")

Buggy submission (verdict: Runtime Error):
A,B,C = list(map(int, input().split()))
if sum(A,B,C) >= 22:
    print("bust")
else:
    print("win ")
Problem p02860 (python)

Fixed submission:
N = int(input())
S = list(input())
before = ""
after = ""
if N % 2 != 0:
  print("No")
else:
  for i in range(N//2):
  	before += S[i]
  for j in range(N//2, N):
    after += S[j]
  if before == after:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
before = ""
after = ""
if N % 2 != 0:
  print("No")
else:
  for i in range N//2:
  	before += S[i]
  for j in range(N//2, N):
    after += S[j]
  if before == after:
    print("Yes")
  else:
    print("No")
Problem p02879 (python)

Fixed submission:
A,B = map(int, input().split(" "))
if A <= 9 and B <= 9:
  print(A*B)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
A,B = map(input().split(" "))
if A <= 9 and B <= 9:
  print(A*B)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
A,B = input().split(" ")
if A <= 9 and B <= 9:
  print(A*B)
else:
  print(-1)
Problem p03012 (python)

Fixed submission:
N = int(input())
string = list(map(int,input().split()))
remain  = []
S1 = 0
S2 = 0

for T in range(1,N+1):
    for i in range(T):
        S1 += string[i]
    for j in range(T, len(string)):
        S2 += string[j]
    remain.append(abs(S1-S2))
    S1 = 0
    S2 = 0
print(min(remain))

Buggy submission (verdict: Runtime Error):
N = int(input())
remain  = []
S1 = 0
S2 = 0
string = list(map(int,input().split())
for T in range(1,N+1):
    for i in range(T):
        S1 += string[i]
    for j in range(T, len(string)):
        S2 += string[j]
    remain.append(abs(S1-S2))
    S1 = 0
    S2 = 0
print(min(remain))

Buggy submission (verdict: Runtime Error):
N = input().split()
remain  = []
S1 = 0
S2 = 0
string = list(map(int,input().split())
for T in range(1,N+1):
    for i in range(T):
        S1 += string[i]
    for j in range(T, len(string)):
        S2 += string[j]
    remain.append(abs(S1-S2))
    S1 = 0
    S2 = 0
print(min(remain))

Buggy submission (verdict: Runtime Error):
N = input().split()
remain  = []
S1 = 0
S2 = 0
string = list(map(int,input().split())
for T in range(1,N+1):
    for i in range(T):
        S1 += string[i]
    for j in range(T, len(string)):
        S2 += string[j]
    remain.append(abs(S1-S2))
print(min(remain))
Problem p03041 (python)

Fixed submission:
N, change = map(int, input().split())
string = list(input())
string[change-1] = string[change-1].lower()
print(''.join(string))

Buggy submission (verdict: Runtime Error):
length, index = map(int, input().split())
string = list(input())
string = replace(string[index],string[index].lower())
print(string.join())
Problem p03072 (python)

Fixed submission:
N = int(input())
hotel = list(map(int, input().split()))
count = 0
c = 0
for i in range(1, N):
    c=0
    for j in range(0, i):
        
        if hotel[i] >= hotel[j]:
            c += 1
        if c == i:
            count += 1
print(count+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
hotel = list(map(int, input().split()))
count = 0
for i in range(1, N):
  for j in range(0, i):
    if all(hotel[i] >= hotel[j]):
      count += 1
print(count+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
hotel = list(map(int, input().split()))
count = 0
for i in range(1, N):
  for j in range(i):
    if all(hotel[i] >= hotel[j]):
      count += 1
print(count+1)
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e - a <= k:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a = map(int, input())
b = map(int, input())
c = map(int, input())
d = map(int, input())
e = map(int, input())
k = map(int, input())
if e - a =< k:
  print("Yay!")
else:
  print(":(")
Problem p03207 (python)

Fixed submission:
N = int(input())
price = []
p = 0
for i in range(N):
  price.append(int(input()))
m = price.index(max(price))
for j in range(len(price)):
  if j != m:
     p += price[j]
  else:
     p += price[j]//2
print(p)

Buggy submission (verdict: Runtime Error):
N = int(input())
price = []
p = 0
for i in range(N):
  price.append(int(input())
m = price.index(max(price))
for j in range(len(price)):
  if j != m:
     p += price[j]
  else:
     p += price[j]//2
print(p)
Problem p03803 (python)

Fixed submission:
A, B = map(int, input().split())
if A != 1 and B != 1 and A > B:
  	print("Alice")
elif  A != 1 and B != 1 and B > A:
    print("Bob")
elif A == B:
    print("Draw")
elif A == 1:
    print("Alice")
else:
    print("Bob")

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
if A != 1 and B != 1:
	if A > B:
  	  print("Alice")
	elif B > A:
  	  print("Bob")
	elif A == B:
      print("Draw")
else:
  if A == 1:
    print("Alice")
  else:
   	print("Bob")
Problem p02831 (python)

Fixed submission:
import fractions
 
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
 
a,b=map(int,input().strip().split())
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a,b=map(int,input().strip().split())
print(lcm(a, b))
Problem p02699 (python)

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

if(S > W):
    print("safe")
else:
    print("unsafe")

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

if(S > W):
    print(safe)
else:
    print(unsafe)
Problem p02711 (python)

Fixed submission:
import sys
n = int(input())

for _ in range(3):
    if n % 10 == 7:
        print('Yes')
        sys.exit(0)
    n = n // 10
print('No')

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

for _ in range(3):
    if n % 10 == 7:
        print('Yes')
        sys.exit(1)
    n = n // 10
print('No')
Problem p02831 (python)

Fixed submission:
def gcd(a, b):
    if a < b:
        a, b = b, a
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b


if __name__ == "__main__":
    a, b = map(int,input().split())
    print(a * b // gcd(a,b))

Buggy submission (verdict: Runtime Error):
import math

if __name__ == "__main__":
    a, b = map(int,input().split())
    print(a * b // math.gcd(a,b))
Problem p03075 (python)

Fixed submission:
import sys

spots = [int(input()) for _ in range(5)]
k = int(input())

for i in range(5):
    for j in range(i + 1, 5):
        distance = spots[j] - spots[i]
        if (distance > k):
            print(":(")
            sys.exit()

print("Yay!")

Buggy submission (verdict: Runtime Error):
import sys

spots = [int(input()) for _ in range(5)]
k = int(input())

for i in range(5):
    for j in range(i + 1, 5):
        distance = spots[j] - spots[i]
        if (distance > k):
            print(":(")
            sys.exit(1)

print("Yay!")
Problem p02693 (python)

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

while True:
    if A <= K*i <=B:
        print('OK')
        break
    elif B < K*i:
        print('NG')
        break
    else:
        i += 1

Buggy submission (verdict: Runtime Error):
from itertools import combinations_with_replacement

def main():
    N, M, Q = map(int, input().split())
    qs = [list(map(int,input().split())) for _ in range(Q)]
    seq = [i for i in range(1,M+1)]
    C = combinations_with_replacement(seq, N)
    max_score = 0

    for A in C:
        A = sorted(A)
        score = 0
        for q in qs:
            if A[q[1]-1] - A[q[0]-1] == q[2]:
                score += q[3]
        max_score = max(score, max_score)
    print(max_score)

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

Fixed submission:
import collections
N = int(input())
l = []
for i in range(N):
    l.append(input())

c = collections.Counter(l)
print(len(c))

Buggy submission (verdict: Runtime Error):
f = open('C/C.txt','r')
sys.stdin = f

N = int(input())
l = []
for i in range(N):
    l.append(input())

c = collections.Counter(l)
print(len(c))