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

Fixed submission:
n=int(input())
flag=0
for i in range(1,10):
    for j in range(1,10):
        if i*j==n:
            flag=1
            break
if flag: print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
flag=0
for i in range(9):
    for j in range(9):
        if i*j=n:
            flag=1
            break
if flag: print("Yes")
else: print("No")
Problem p02891 (python)

Fixed submission:
s=input()
k=int(input())
cnt=1
temp=[]
for i in range(len(s)-1):
    if s[i]==s[i+1]: cnt+=1
    else:
        temp.append([s[i],cnt])
        cnt=1
if cnt>=1: temp.append([s[-1],cnt])
if len(temp)==1:
    print(k*len(s)//2)
    exit()
ans=0
if temp[0][0]!=temp[-1][0]:
    for pair in temp:
        if pair[1]!=1: ans+=pair[1]//2
    print(ans*k)
else:
    for pair in temp[1:-1]:
        if pair[1]!=1: ans+=pair[1]//2
    ans*=k
    ans+=(k-1)*((temp[0][1]+temp[-1][1])//2)
    ans+=temp[0][1]//2+temp[-1][1]//2
    print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
cnt=1
temp=[]
for i in range(len(s)-1):
    if s[i]==s[i+1]: cnt+=1
    else:
        temp.append([s[i],cnt])
        cnt=1
if cnt>=1: temp.append([s[-1],cnt])
if len(temp)==1:
    print(k*len(s)//2)
    exit()
ans=0
if temp[0][0]!=temp[-1][0]:
    for pair in temp:
        if pair[1]!=1: ans+=pair[1]//2
    print(ans*k)
else:
    for pair in temp[1:-1]:
        if pair[1]!=1: ans+=pair[1]//2
    ans*=k
    ans+=(k-1)*((temp[0][0]+temp[-1][0])//2)
    ans+=temp[0][0]//2+temp[-1][0]//2
    print(ans)
Problem p02912 (python)

Fixed submission:
import heapq

n,m = map(int,input().split())
a = list(map(lambda x: -int(x),input().split()))
heapq.heapify(a)
for _ in range(m):
    temp = -heapq.heappop(a)
    temp//=2
    heapq.heappush(a,-temp)
ans = 0
for _ in range(n):
    ans -= heapq.heappop(a)
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

n,m = map(int,input().split())
a = list(map(int,input().split()))
a = map(lambda x:-x, a)
heapq.heapify(a)
print(a)
for _ in range(m):
    temp = -heapq.heappop(a)
    temp//=2

    heapq.heappush(a,-temp)
ans = 0
for _ in range(n):
    ans -= heapq.heappop(a)
print(ans)
Problem p02951 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(max(c-(a-b),0))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(max(c-(a-b)),0)
Problem p03137 (python)

Fixed submission:
import heapq
n,m=map(int,input().split())
x=sorted(list(map(int,input().split())))
diff=[]
heapq.heapify(diff)
if n>=m:
    print(0)
else:
    for i in range(m-1):
        heapq.heappush(diff,x[i]-x[i+1]+1)
    temp=0
    for _ in range(n-1):
        temp-=heapq.heappop(diff)
    print(x[m-1]-x[0]+1-temp-n)

Buggy submission (verdict: Runtime Error):
import heapq
n,m=map(int,input().split())
x=sorted(list(map(int,input().split())))
diff=[]
heapq.heapify(diff)
if n>=m:
    print(0)
else:
    for i in range(m-1):
        heapq.heappush(diff,x[i]-x[i+1]-1)
    temp=0
    for _ in range(n-1):
        temp-=heapq.heappop(diff)
        #print(-heapq.heappop(diff))
print(x[m-1]-x[0]+1-temp)
Problem p03805 (python)

Fixed submission:
import itertools as it

n,m=map(int,input().split())
path=[]
for i in range(m): path.append(list(map(int,input().split())))
ls=list(it.permutations(range(1,n+1)))
cnt=0
for l in ls:
    if l[0]!=1: break
    flag=1
    for i in range(n-1):
        if ([l[i],l[i+1]] not in path) and ([l[i+1],l[i]] not in path):
            flag=0
            break
    if flag: cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import itertools as it
n,m=map(int,input().split())
path={[] for _ in range(m)}
for i in range(m): path[i]=list(map(int,input().split()))
ls=list(it.permutations(range(1,n+1)))
cnt=0
for l in ls:
    if l[0]==1: break
    for i in range(n-1):
        if [i,i+1] in path: cnt+=1
print(cnt)
Problem p02725 (python)

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



A = sorted(A)
L = []
ANS = 0

A_max = max(A)

for i in range(N-1):
    L.append(abs(A[i+1]-A[i]))
        
L.append(K + A[0] - A_max)

L = sorted(L)


L.pop(-1)

for i in range(len(L)):
    ANS = ANS + L[i]
    
print(ANS)

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



A = sorted(A)
L = []
ANS = 0

A_max = max(A)

for i in range(N-1):
    L.append(abs(A[i+1]-A[i]))
        
L.append(K + A[0] - A_max)

L = sorted(L)


L.pop(-1)

for i in range(len(L)):
    ANS = ANS + L[i]
    
print(ANS)
Problem p02754 (python)

Fixed submission:
N, A, B = map(int , input().split())
 
L = []
i = 0
k = 0
j = 0
P = N // (A + B)
Q = N % (A + B)

if A > Q:
    print((P * A) + Q)
else:
    print((P * A) + A)

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

L = []
i = 0
k = 0
j = 0
 
for k in range(10**9):
    for i in range(A):
        L.append('b')
        if len(L) >= N:
            L = L[0:N]
            print(L.count('b'))
            exit()
        elif A == 0:
            print(A)
            exit()
        elif A == 1:
            print(N // B)
            exit()
    
    for j in range(B):
        L.append('r')
        if len(L) >= N:
            L = L[0:N]
            print(L.count('b'))
            exit()
        elif B == 0:
            print(N)
            exit()

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

L = []
i = 0
k = 0
j = 0
 
for k in range(10**100):
    for i in range(A):
        L.append('b')
        if len(L) >= N:
            L = L[0:N]
            print(L.count('b'))
            exit()
        elif A == 0:
            print(A)
            exit()
        elif A == 1:
            print(N // B)
            exit()
    
    for j in range(B):
        L.append('r')
        if len(L) >= N:
            L = L[0:N]
            print(L.count('b'))
            exit()
        elif B == 0:
            print(N)
            exit()

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

L = []
i = 0
k = 0
j = 0

for k in range(10**100):
    for i in range(A):
        L.append('b')
        if len(L) >= N:
        L = L[0:N]
        print(L.count('b'))
        break
    
    for j in range(B):
        L.append('r')
    if len(L) >= N:
        L = L[0:N]
        print(L.count('b'))
        break
Problem p02785 (python)

Fixed submission:
N, K = map(int, input().split())
H = list(map(int, input().split()))
H = sorted(H)
SUM = 0

if K >= N:
    print(0)
    exit()


    
for i in range(len(H)-K):
    SUM = SUM + H[i]


print(SUM)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = list(map(int, input().split()))
H = sorted(H, reverse=True)
SUM = 0

if K > N:
    print(0)
    exit()

for i in range(K):
    H.pop(i)
    
for i in range(len(H)):
    SUM = SUM + H[i]

print(SUM)
Problem p02881 (python)

Fixed submission:
import math
N = int(input())
M = []
sqr_N = math.floor(math.sqrt(N))
a = 0
    
for i in range(1, (sqr_N + 1)):
    if N % i == 0:
        a = i

a_pair = N // a
print(a + a_pair - 2)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
M = []
sqr_N = math.floor(math.sqrt(N))
    
for i in range(sqr_N):
    if i == 0:
        continue
    elif N % i == 0:
        M.append(i)

O = []
ANS = []        
for i in range(len(M)):
    O.append(N // M[i])
    


for i in range(len(O)):


    ANS.append(O[i] + M[i]) 
        
     
        
min = min(ANS)

print(min - 2)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
M = []
sqr_N = math.floor(math.sqrt(N))
    
for i in range(sqr_N):
    if i == 0:
        continue
    elif N % i == 0:
        M.append(i)
        
        
ANS = (max(M) - 1) + ((N / max(M)) - 1)

print(int(ANS))
Problem p03745 (python)

Fixed submission:
n = int(input())
if n>1: a = list(map(int, input().split()))
else: a = int(input()); print(1); exit()
ans = 1; togU = 0; togD = 0
if a[1]>a[0]: togU = 1
elif a[1]<a[0]: togD = 1
for i in range(1,n):
  if not (togD or togU):
    if a[i]>a[i-1]: togU = 1; continue
    if a[i]<a[i-1]: togD = 1; continue
  if a[i]>a[i-1]:
    if togD:
      ans += 1
      togD = 0
      togU = 0
  elif a[i]<a[i-1]:
    if togU:
      ans += 1
      togU = 0
      togD = 0
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 1; togU = 0; togD = 0
if a[1]>a[0]: togU = 1
elif a[1]<a[0]: togD = 1
for i in range(1,n):
  if not (togD or togU):
    if a[i]>a[i-1]: togU = 1; continue
    if a[i]<a[i-1]: togD = 1; continue
  if a[i]>a[i-1]:
    if togD:
      ans += 1
      togD = 0
      togU = 0
  elif a[i]<a[i-1]:
    if togU:
      ans += 1
      togU = 0
      togD = 0
print(ans)
Problem p02693 (python)

Fixed submission:
import sys

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

for i in range(a,b+1):
  if i%k==0:
    print("OK")
    sys.exit()

print("NG")

Buggy submission (verdict: Runtime Error):
import sys

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

for i in range(a,b+1):
  if i%k==0:
    print("OK")
    sys.exit()

print("NG")
Problem p02779 (python)

Fixed submission:
import sys

n=int(input())

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

a.sort()

for i in range(len(a)-1):
  if a[i]==a[i+1]:
    print("NO")
    sys.exit()

print("YES")

Buggy submission (verdict: Runtime Error):
import sys

n=int(input())

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

c=[0]*(max(a)+1)

for i in range(len(a)):
  c[a[i]]+=1

  if c[a[i]]>1:
    print("NO")
    sys.exit()

print("YES")

Buggy submission (verdict: Runtime Error):
import sys

n=int(input())

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

c=[0]*max(a)

for i in range(len(a)):
  c[a[i]]+=1

  if c[a[i]]>1:
    print("NO")
    sys.exit()

print("YES")
Problem p02831 (python)

Fixed submission:
import math

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

c=0

while(1):
  c+=a
  if c%b==0:
    print(c)
    break

Buggy submission (verdict: Runtime Error):
import math

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

#c=int((a*b)/math.gcd(a,b))
c=math.gcd(a,b)

print(c)

Buggy submission (verdict: Runtime Error):
import math

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

c=int((a*b)/math.gcd(a,b))

c=0
print(c)

Buggy submission (verdict: Runtime Error):
import math

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

c=int((a*b)/math.gcd(a,b))
print(c)

Buggy submission (verdict: Runtime Error):
import math

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

print((a*b)//math.gcd(a,b))

Buggy submission (verdict: Runtime Error):
import math

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

print((a*b)//math.gcd(a,b))
Problem p02688 (python)

Fixed submission:
n,k = map(int, input().split())
s = []
for i in range(k):
  d = int(input())
  a = list(map(int, input().split()))
  s += a
print(n-len(set(s)))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
s = []
for i in range(k):
  d = int(input())
  a = list(map(int, input()))
  s += a
print(n-len(set(s)))
Problem p02723 (python)

Fixed submission:
s = input()
ans = "No"
if len(s) == 6:
  if s[2]==s[3] and s[4]==s[5]:
    ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
s = int(input())
ans = "No"
if len(s) == 6:
  if s[2]==s[3] and s[4]==s[5]:
    ans = "Yes"
print(ans)
Problem p02766 (python)

Fixed submission:
n,k = map(int, input().split())
s = 1
c = 0
while n//s > 0:
  s *= k
  c += 1
print(c)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
print(len(str(int(n,k))))
Problem p02779 (python)

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

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

Fixed submission:
a = int(input())
b = int(input())
if a == 1:
  if b == 2:
    print(3)
  else:
    print(2)
elif a == 2:
  if b == 1:
    print(3)
  else:
    print(1)
elif a == 3:
  if b == 1:
    print(2)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
x = [1,2,3]
del x[a-1]
del x[b-1]
print(x[0])

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
x = [1,2,3]
del x[a]
del x[b]
print(x[0])
Problem p02831 (python)

Fixed submission:
import fractions
a, b = map(int, input().split())
print((a*b) // fractions.gcd(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().split())
print(lcm(a, b))
Problem p02836 (python)

Fixed submission:
s = input()
h = 0
for i in range(len(s)//2):
  if s[i] != s[len(s)-i-1]:
    h += 1
print(h)

Buggy submission (verdict: Runtime Error):
s = input()
h = 0
for i in range(len(s)//2):
  if s[i] != s[s-i-1]:
    h += 1
print(h)
Problem p02891 (python)

Fixed submission:
s = input()
k = int(input())
n = 0
j = s[0]
l = 1
p = 0
fi,la = 0,0
c = 1
if len(set(list(s))) == 1:
  print(len(s)*k//2)
else:
  for i in range(1,len(s)):
    if s[i] == j:
      l += 1
    else:
      n += l//2
      if s[i-1] == s[0] and c == 1:
        fi = l
        c = 0
      l = 1
      j = s[i]
  n += l//2
  la = l
  if s[0] == s[-1] and fi%2 == 1 and la%2 == 1:
    p = k-1
  print(n*k+p)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
n = 0
j = s[0]
l = 1
p = 0
for i in range(1,len(s)):
  if s[i] == j:
    l += 1
  else:
    n += l//2
    l = 1
    j = s[i]
n += l//2
if s[0] == s[-1] and s[0] != s[1] and s[0] != s[-2]:
  p = k-1
print(n*k+p)
Problem p03041 (python)

Fixed submission:
n,k = map(int, input().split())
w = {"A":"a", "B":"b", "C":"c"}
s = list(input())
print(''.join([w[s[i]] if i == k-1 else s[i] for i in range(n)]))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
w = {"A":"a", "B":"b", "C":"c"}
s = input().split()
print([i if i != k-1 else w[s[i]] for i in len(s)])
Problem p03042 (python)

Fixed submission:
N = input()
n = [int(N[:2]), int(N[2:])]
a = ['YYMM', 'MMYY', 'AMBIGUOUS', 'NA']
if n[0] > 12 or n[0] == 0:
  del a[1]
  del a[1]
  if n[1] > 12 or n[1] == 0:
    del a[0]
elif n[1] > 12 or n[1] == 0:
  del a[0]
  del a[1]
else:
  a = [a[2]]
print(a[0])

Buggy submission (verdict: Runtime Error):
N = input()
n = [int(N[:1]), int(N[1:])]
a = ['YYMM', 'MMYY', 'AMBIGUOUS', 'NA']
if a[0] > 12:
  if a[1] == 0:
    print(a[3])
  else:
    print(a[0])
elif a[1] > 12:
  if a[0 == 0:
    print(a[3])
  else:
    print(a[1])
else:
  print(a[2])
Problem p03135 (python)

Fixed submission:
t,x = map(int ,input().split())
print(t/x)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
x = [int(i) for i in input().split()]
x.sort()
x2 = []
for i in range(len(x)-1):
  x2.append(x[i+1] - x[i])
x2.sort()
if n < m:
  print(sum(x2[:len(x2) - n + 1]))
else:
  print('0')
Problem p03137 (python)

Fixed submission:
n,m = map(int, input().split())
x = [int(i) for i in input().split()]
x.sort()
x2 = []
for i in range(len(x)-1):
  x2.append(x[i+1] - x[i])
x2.sort()
if n < m:
  print(sum(x2[:len(x2) - n + 1]))
else:
  print('0')

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
x = [int(i) for i in input().split()]
x.sort()
x2 = []
for i in range(len(x)-1):
  x2.append(x[i+1] - x[i])
x2.sort()
if n < m:
  print(sum(x2[:len(x2) - n + 1]))
else:
  print('0')
n,m = map(int, input().split())
x = [int(i) for i in input().split()]
x.sort()
x2 = []
for i in range(len(x)-1):
  x2.append(x[i+1] - x[i])
x2.sort()
if n < m:
  print(sum(x2[:len(x2) - n + 1]))
else:
  print('0')
Problem p03208 (python)

Fixed submission:
n,k = map(int,input().split())
h = []
for i in range(n):
  h.append(int(input()))
h.sort()
g = float('inf')
for i in range(n-k+1):
  g = min(g, h[i+k-1] - h[i])
print(g)

Buggy submission (verdict: Runtime Error):
NK = [int(i) for i in input().split()]
N,K = NK[0],NK[1]
h = []
h1 = []
for i in range(N):
    h.append(int(input()))
h.sort()
for i in range(N-1):
    h1.append(h[i+1]-h[i])
hh,hhh = [],[]
for i in range(N-K):
    hh.append([0]*i+h1+[0]*(K-2-i))
for i in range(N-K+1):
    h2 = 0
    for j in range(K-1):
        h2 = h2 + hh[j][i+K-2]
    hhh.append(h2)
print(min(hhh))

Buggy submission (verdict: Runtime Error):
NK = [int(i) for i in input().split()]
N,K = NK[0],NK[1]
h = []
h1 = []
for i in range(N):
    h.append(int(input()))
h.sort()
for i in range(N-1):
    h1.append(h[i+1]-h[i])
hh,hhh = [],[]
for i in range(N-K):
    hh.append([0]*i+h1+[0]*(K-2-i))
for i in range(N-K+1):
    h2 = 0
    for j in range(K-1):
        h2 = h2 + hh[j][i+K-2]
        hhh.append(h2)
print(min(hhh))

Buggy submission (verdict: Runtime Error):
NK = [int(i) for i in input().split()]
N,K = NK[0],NK[1]
h = []
h1 = []
for i in range(N):
  h.append(int(input()))
h.sort()
for i in range(N-1):
  h1.append(h[i+1]-h[i])
hh,hhh = [],[]
for i in range(N-K):
  hh.append([0]*i+h1+[0]*(K-2-i))
for i in range(N-K+1):
  h2 = 0
  for j in range(K-1):
      h2 = h2 + hh[j][i+K-2]
  hhh.append(h2)
print(min(hhh))

Buggy submission (verdict: Runtime Error):
NK = [int(i) for i in input().split()]
N,K = NK[0],NK[1]
h = []
h1 = []
for i in range(N):
    h.append(int(input()))
h.sort()
for i in range(N-1):
    h1.append(h[i+1]-h[i])
hh,hhh = [],[]
for i in range(N-K):
    hh.append([0]*i+h1+[0]*(K-2-i))
for i in range(N-K+1):
    h2 = 0
    for j in range(K-1):
        h2 = h2 + hh[j][i+K-2]
    hhh.append(h2)
print(min(hhh))
Problem p03774 (python)

Fixed submission:
n,m=map(int,input().split())
a,b,c,d=[],[],[],[]
for i in range(n):
    o = list(map(int, input().split()))
    a.append(o[0])
    b.append(o[1])
for i in range(m):
    o = list(map(int, input().split()))
    c.append(o[0])
    d.append(o[1])
s = []
for i in range(n):
    g = float('inf')
    h = 0
    for j in range(m):
        if g > abs(a[i]-c[j])+abs(b[i]-d[j]):
            g = abs(a[i]-c[j])+abs(b[i]-d[j])
            h = j+1
    s.append(h)
for i in s:
    print(i)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input())
a,b,c,d=[],[],[],[]
for i in range(n):
  o = list(map(int, input().split()))
  a.append(o[0])
  b.append(o[1])
for i in range(m):
  o = list(map(int, input().split()))
  c.append(o[0])
  d.append(o[1])
s = []
for i in range(n):
  g = float('inf')
  h = 0
  for j in range(m):
    if g > abs(a[i]-c[j])+abs(b[i]-d[j]):
      g = abs(a[i]-c[j])+abs(b[i]-d[j])
      h = j+1
  s.append(h)
for i in s:
  print(i)
Problem p03775 (python)

Fixed submission:
import math
n = int(input())
def f(n):
  g = float('inf')
  for i in [j for j in range(1,math.ceil(n**0.5)+1) if n%j == 0]:
    if g > len(str(max(i,n//i))):
      g = len(str(max(i,n//i)))
    if g == float('inf'):
        g = 1
  return g
print(f(n))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
def f(n):
  g = float('inf')
  for i in [j for j in range(1,math.ceil(n**0.5))+1 if n%j == 0]:
    if g > len(str(max(i,n//i))):
      g = len(str(max(i,n//i)))
    if g == float('inf'):
        g = 1
  return g
print(f(n))
Problem p02624 (python)

Fixed submission:
import sys
import numba

@numba.njit
def main(N):
    x = 0
    for a in range(1, N+1):
        b=N//a
        x += a*b*(b+1)//2
    return x
 
N = int(input())
print(main(N))

Buggy submission (verdict: Runtime Error):
import numba
@numba.njit
def main(N):
    x = 0
    for a in range(1, N+1):
        b=N//a
        x += a*b*(b+1)//2
    return x
N = int(input())
print(main(N))
Problem p02711 (python)

Fixed submission:
N = list(str(input()))
if int(N[0]) == 7 or int(N[1]) == 7 or int(N[2]) == 7:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
if N[0]==7 or N[1]==7 or N[2]==7:
  print('Yes')
else:
  print('No')
Problem p02779 (python)

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

if len(A) == len(set(A)):
  print("YES")
else:
  print("NO")

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

a=0
i=-1
while True:
  i+=1
  if A.count(A[i])>=2:
    print("NO")
    a=1
    break
  else:
    A.remove(A[i])
    i-=1
    
if a==0:
  print(A)
  print("YES")
Problem p02819 (python)

Fixed submission:
import math

P_lst=[2]
for i in range(1000):
  flag=0
  for j in P_lst:
    if (i+3)%j==0:
      flag=1

  if flag==0:
    P_lst.append(i+3)

X=int(input())

while X<=200000:
  if X==2:
    print(2)
    break
  flag=0
  x=math.sqrt(X)
  for k in P_lst:
    if X%k==0:
      break
    if x<k:
      flag=1
      break
  if flag==1:
    print(X)
    break
  X=X+1

Buggy submission (verdict: Runtime Error):
from sympy import nextprime

X=int(input())
print(nextprime(X))
Problem p02831 (python)

Fixed submission:
import fractions

A,B=map(int,input().split())
f=A*B//fractions.gcd(A,B)
print(f)

Buggy submission (verdict: Runtime Error):
import math

a,b=map(int,input().split())
print(int(a*b/math.gcd(a,b)))
Problem p02833 (python)

Fixed submission:
n=int(input())

if n%2!=0:
  print(0)
else:
  A=0
  m=10
  while n//m>0:
    A+=n//m
    m*=5
  print(A)

Buggy submission (verdict: Runtime Error):
N=input()
M=int(N)
f=1
while 2<=M:
  if M<2:M=1
  f *= M
  M -= 2

A=len(f)-len(f.rstrip('0'))
print(A)
Problem p03250 (python)

Fixed submission:
L=sorted(list(map(str,input().split())))
print(int(L[2]+L[1])+int(L[0]))

Buggy submission (verdict: Runtime Error):
a,b,c=map(str,input().split())
printmax((int(a+b)+int(c),int(a)+int(b+c)))
Problem p02571 (python)

Fixed submission:
s = input()
t = input()

c = [0] * (len(s) - len(t)+1)

for i in range(len(s) - len(t) +1):
  for j in range(len(t)):
    if s[i+j] == t[j]:
      c[i] += 1

print(len(t)-max(c))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

c = [0] * (len(s) - len(t))

for i in range(len(s) - len(t)):
  for j in range(len(t)):
    if s[i+j] == t[j]:
      c[i] += 1

print(len(t)-max(c))
Problem p02546 (python)

Fixed submission:
S = input()

if S[-1] == 's':
  print(S + 'es')
else:
  print(S + 's')

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

for a in range(1, N):
  tmp = (N-1) // a
  if a <= (N) // 2:
    count += tmp
  else:
    count += 1          

print(count)
Problem p02570 (python)

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

if S * T >= D:
  print('Yes') 
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7
ak = 0
ak_2 = 0

for i in range(N):
  ak += A[i]
  ak_2 += A[i] ** 2
s = int(((ak ** 2) - ak_2) // 2)
print(s % mod)
Problem p02629 (python)

Fixed submission:
x = int(input())

alphbet = lambda c: chr(c+64)

def Base_10_to_n(X, n):
    X_dumy = X
    out = []
    while X_dumy > 0:
      if X_dumy % n == 0:
        out.append( 26 )
        X_dumy = int(X_dumy / n - 1)
      else:
        out.append( X_dumy % n )
        X_dumy = int(X_dumy / n)
    return out
if 1 <= x <= 1000000000000001:
    out = Base_10_to_n(x, 26)[::-1]
    print( "".join(alphbet(i) for i in out).lower())

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

alphbet = lambda c: chr(c+64)

def Base_10_to_n(X, n):
    X_dumy = X
    out = []
    while X_dumy>0:
        out.append(X_dumy%n)
        X_dumy = int(X_dumy/n)
    return out
out = Base_10_to_n(x, 26).reverse()
print( "".join(alphbet(i) for i in out) )
Problem p02659 (python)

Fixed submission:
A,B = map(float,input().split( ))
A = int(round(A))
B_0 = B//1
B_1 = B%1
ans_0 = round(A*B_0)
ans_1 = A*round(B_1*100)//100
print(int(round(ans_0 + ans_1)))

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split( ))
B_0 = B//1
B_1 = B%1
ans_0 = round(A*B_0)
ans_1 = A*round(B_1*100)//100
print(int(ans_0 + ans_1))
Problem p02547 (python)

Fixed submission:
n=int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]

zoro=0
aru=0
for i in range(n):
    if x[i]==y[i]:
        zoro+=1
        if zoro==3:
            aru=1
    else:
        zoro=0

if aru==1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]

zoro=0
for i in range(n):
    if x[i]==y[i]:
        zoro+=1
        if zoro==3:
            print("Yes")
            exit()
    else:
        zoro=0

print("No")