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

Fixed submission:
#!/usr/bin/env python
"""AtCoder Beginner Contest 167: A - 
https://atcoder.jp/contests/abc167/tasks/abc167_a
"""

__author__ = 'bugttle <bugttle@gmail.com>'


def main():
    S = input()
    T = input()

    if S == T[0:-1]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
"""AtCoder Beginner Contest 167: C
https://atcoder.jp/contests/abc167/tasks/abc167_c
"""
import sys
import itertools

__author__ = 'bugttle <bugttle@gmail.com>'


def main():
    [N, M, X] = list(map(int, input().split()))

    l = []
    for n in range(N):
        l.append(list(map(int, input().split())))
    # print(l)

    status = [0]*M
    for n in range(N):
        for m in range(M):
            status[m] += l[n][m + 1]
    for v in status:
        if v < X:
            print(-1)
            return
    
    min_cost = sys.maxsize
    for p in itertools.permutations(range(N)):
        # print(p)
        cost = 0
        status = [0]*M
        for n in p:
            cost += l[n][0]
            if min_cost < cost:
                break
            isCompleted = True
            for m in range(M):
                status[m] += l[n][m + 1]
                if status[m] < X:
                    isCompleted = False
            # print(status)
            if isCompleted:
                # print('fin')
                # print(cost)
                if cost < min_cost:
                    min_cost = cost
                break
    if min_cost == sys.maxsize:
        print(-1)
    else:
        print(min_cost)
            
                    

                # status[m] += l[n][m]
    # for n in range(N):
    #     for m in range(M):
    #         print([n, m])
    # cost = 0
    # status = [[0]*M]*N
    # for n in range(N):
    #     for m in range(M):
    #         print(l[n][m + 1])
    #         # status[n][m] = l[n][m + 1]
    # print(status)

    


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

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
dp=[]
dp.append(0)
dp.append(abs(h[1]-h[0]))
for i in range(2,n):
    dp.append(min(dp[i-2] + abs(h[i]-h[i-2]), dp[i-1] + abs(h[i]-h[i-1])))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
dp=[]
dp.append(0)
dp.append(abs(h[1]-h[0]))
for i in range(3,n):
    dp.append(min(dp[i-2] + abs(h[i]-h[i-2]), dp[i-1] + abs(h[i]-h[i-1])))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
h = []
for i in range(0,n):
    t=int(input())
    h.append(t)
dp=[]
dp.append(h[0])
dp.append(abs(h[1]-h[0]))
for i in range(2,n):
    dp.append(min(dp[i-2] + abs(h[i]-h[i-2]), dp[i-1] + abs(h[i]-h[i-1])))
print(dp[n-1])
Problem p02657 (python)

Fixed submission:
A,B = input().split()
A = int(A)
B = int(B)
print(A*B)

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

print(A*B)

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

print(A*B)

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

print(A*B)

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

print(A*B)

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

C = A*B

print(C)

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

print(int(A*B))

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

print(A*B)
Problem p02606 (python)

Fixed submission:
l,r,k=map(int,input().split())
ans=0
for i in range(l,r+1):
 if i%k==0:
  ans+=1
 else:
  pass
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
 
for i in range (1,n+1):
  ans=0
  for x in range(1,int(i*1/3)):
   for y in range(1,int(i*1/3)):
    for z in range(1,int(i*1/3)):
     if x+y+z==math.sqrt(i+x*y+x*z+y*z):
       ans+=1
       if x==y and y==z:
        break
  print(ans)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
 
for i in range (1,n+1):
  ans=0
  for x in range(1,int(i*2/3)):
   for y in range(1,int(i*2/3)):
    for z in range(1,int(i*2/3)):
     if x+y+z==math.sqrt(i+x*y+x*z+y*z):
       ans+=1
       if x==y and y==z:
        break
  print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(1,n+1):
 ans=0
 for x in range(1,i):
  for y in range(1,i):
   for z in range(1,i):
    if i==(x+y+z)**2-x*y-x*z-y*z:
      ans+=1
 print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(1,n+1):
 ans=0
 for x in range(1,i):
  for y in range(1,i):
   for z in range(1,i):
    if i==(x+y+z)**2-x*y-x*z-y*z:
      ans+=1
 print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(1,n+1):
 ans=0
 for x in range(1,i):
  for y in range(1,i):
   for z in range(1,i):
    if i==x*x+y*y+z*z+x*y+x*z+y*z:
      ans+=1
 print(ans)
Problem p02607 (python)

Fixed submission:
n=int(input())
lst=list(map(int,input().split()))
ans=0
for i in range(0,n):
 if (i+1)%2==0:
    pass
 elif lst[i]%2!=0:
    ans+=1
 else:
  pass
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
lst=list(map(int,input().split()))
ans=0
for i in range(0,n+1):
 if (i+1)%2==0:
    pass
 elif lst[i]%2!=0:
    ans+=1
 else:
  pass
print(ans)
Problem p02628 (python)

Fixed submission:
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=sorted(c)
ans=0
for i in range(0,b):
 ans+=d[i]
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
c=[]
c=input().split()
d=c.sorted()
ans=0
for i in range(b):
  ans+=c[i]
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=list(map(int,input().split()))
d=c.sort()
print(d)
ans=0
for i in range(0,b):
 ans+=d[i]

print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=[]
c=input().split()
d=c.sort()
print(d)
ans=0
for i in range(0,b):
 ans+=d[i]

print(ans)
Problem p02630 (python)

Fixed submission:
n=int(input())
a_list=list(map(int,input().split()))
cnt = [0] * int(1e5 + 10)
sum=0
for i in a_list:
 cnt[i] +=1
 sum+=i
  
q=int(input())
ans=0
 
for j in range(q):
 x,y=map(int,input().split())
 sum+=(y-x)*cnt[x]
 cnt[y]+=cnt[x]
 cnt[x]=0
 print(sum)

Buggy submission (verdict: Runtime Error):
import re
n=int(input())
s=str(input())
q=int(input())
 
for i in range(q):
 x,y=map(str, input().split())
 s=re.sub(x,y,s)
 ans=0 
 s_list=list(s.split())
 for j in range(q+1):
  ans+=int(s_list[j])
 print(ans)

Buggy submission (verdict: Runtime Error):
import re
n=int(input())
s=str(input())
q=int(input())
 
for i in range(q):
 x,y=map(str, input().split())
 s=re.sub(x,y,s)
 print(s)
 ans=0 
 s_list=list(s.split())
 for j in range(q+1):
  ans+=int(s_list[j])
 print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=str(input())
q=int(input())
 
for i in range(q):
 x,y=map(str, input().split())
 s.replace(x,y)
 ans=0 
 s_list=list(s.split())
 for j in range(q+1):
  ans+=int(s_list[j])
  print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=str(input())
q=int(input())
 
for i in range(q):
 x,y=map(str, input().split())
 s.replace(x,y)
ans=0 
s_list=list(s.split())
for j in range(q+1):
 ans+=int(s_list[j])
 
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=str(input())
q=int(input())
 
for i in range(q):
 x,y=map(str, input().split())
 s.replace(x,y)
ans=0 
s_list=list(s.split())
for j in range(q):
 ans+=int(s_list[j])
 
print(ans)

Buggy submission (verdict: Runtime Error):
import re
n=int(input())
s=[]
s=input().split()
q=int(input())

for i in range(q):
 x,y=map(str, input().split())
 s=re.sub(str(x),str(y),str(s))
 
for j in range(q):
 ans+=int(s[j])
 
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[]
s=input().split()
q=int(input())
for i in range(q):
 x,y=map(int,input().split())
 s=re.sub(x,y,s)
 
for j in range(q):
 ans+=int(s[j])
 
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[]
s=input().split()
q=int(input())
for i in range(q):
 x,y=map(int,input().split())
 s=re.sub(x,y,s)

for j in range(q)
 ans+=int(s[j])

print(ans)
Problem p02639 (python)

Fixed submission:
a=[]
a=input().split()
for i in range(5):
 if a[i]=='0':
   print(str(i+1))
 else:
   pass

Buggy submission (verdict: Runtime Error):
s=[]
x,n=map(int,input().split())
if n==0:
  print(x)
  exit()
  
s=list(map(int,input().split()))
slist=sorted(s)
out=0
for i in range(0,1000):
  out=0
  for j in range(n):
    if slist[j]==x-i:
      out=1
  if out !=1:
   print(x-i)
   exit()
  out=0
  for k in range(n):
    if slist[k]==x+i:
      out=1
  if out !=1:
    print(x+i)
    exit()

Buggy submission (verdict: Runtime Error):
s=[]
x,n=map(int,input().split())
s=list(map(int,input().split()))
slist=sorted(s)

if n==0:
  print(x)
  exit()
for i in range(0,101):
  for j in range(n):
    if slist[j]==x-i:
        flag=1
    if slist[j]==x+i:
        flag=2
            
  if flag==2:
    flag=0
  elif flag==0:
    print(x-i)
    exit()
  elif flag==1:
    print(x+i)
    exit()

Buggy submission (verdict: Runtime Error):
s=list(map(int,input().split())
for i in range(5):
  if s[i]==0:
     print(i+1)
     exit()
  else:
     pass

Buggy submission (verdict: Runtime Error):
s=list(map(int,input().stlip())
for i in s:
  if i==0:
     print(i+1)
     exit()
  else:
     pass

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
for i in range(a):
  for j in range(b):
   if i+j==a and i*2+4*j==b:
    print("Yes")
    break
   else:
     print("No")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
for i in range(a):
  for j in range(b):
   if i+j=a and i*2+4*j=b:
    print("Yes")
     break
   else:
     print("No")

Buggy submission (verdict: Runtime Error):
a=[]
a=int(input().split())
for i in range(4):
 if a[i]==0:
  print(i)
 else:
  pass

Buggy submission (verdict: Runtime Error):
a=int(input().split())
for i in range(4):
 if a[i]==0:
  print(i)
 else:
  pass

Buggy submission (verdict: Runtime Error):
a=int(input().split())
for i in range(4):
 if a[i]==0:
  print(i)
 else
  pass

Buggy submission (verdict: Runtime Error):
a=[]
a=int(input().split())
for i in a:
 if a[i]==0:
   print(i+1)
 else:
  pass

Buggy submission (verdict: Runtime Error):
a=[]
a=map(int, input().split())
for i in a:
 if a[i]==0:
   print(i)
 else:
  pass

Buggy submission (verdict: Runtime Error):
a=[]
a=map(int, input().stlip())
for i in a:
 if a[i]==0:
   print(i)
 else:
  pass
Problem p02640 (python)

Fixed submission:
a,b=map(int,input().split())
ans=1
for i in range(0,b):
  for j in range(0,b):
   if i+j==a and i*2+4*j==b:
    ans+=1
    break
   else:
     pass

if ans>1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x,y=map(int, input().split())
flag=0
for i in range(100):
 for j in range(100):
  if i+j==x and i*2+j*4=y:
    flag=1
    exit()
  else:
    pass
if flag==1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
 for i in range(a):
  for j in range(b):
   if i+j=a and i*2+4*j=b:
    print("Yes")
     break
   else:
     print("No")
Problem p02657 (python)

Fixed submission:
x,y=map(int, input().split())
print(x*y)

Buggy submission (verdict: Runtime Error):
n=input()
s=list(map(int,input().split())
sum=1
for i in s:
   sum=sum*i
if sum>10**18:
       print(-1)
else:
       print(sum)
Problem p02658 (python)

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
ans=1
for i in x:
  if i==0:
    print(0)
    exit()

for i in x:
    ans=ans*i
    if ans>10**18:
      ans=-1
      break
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=list(map(int,input().split()))
ans=1
for i in x:
    ans=ans*i
    if ans>10**18:
     ans=-1
     break
    elif ans=0:
     break
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=list(map(int,input().split()))
ans=1
for i in x:
    ans=ans*i
    if ans>10**18:
     ans=-1
     break
    elif ans=0
     break
print(ans)

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

digits=0
ans=1

for i in list:
  digits+=len(i)
  if digits >=18:
   print(-1)
  else:
    ans=ans*i

print(ans)

Buggy submission (verdict: Runtime Error):
n=input()
s=list(map(int,input().split())
sum=1
for i in s
   sum=sum*i
if sum>10**18:
       print(-1)
else:
       print(sum)
Problem p02675 (python)

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

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

a=n//10
if a==3:
 print("bon")
elif a==0 or a==6 or a==8 or a==1
 print("pon")
else
 print("hon")
Problem p02681 (python)

Fixed submission:
import re
s=str(input())
t=str(input())
for i in range(len(s)):
 if s[i]!=t[i]:
  print("No")
  exit()
 else:
  pass
if re.sub(r"[a-z]","",t)=="":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=str(input())
t=str(input())
for i in range s:
 if s[i]!=t[i]:
  print("No")
 else:
  pass
if len(t2)==1 and re.sub(r"[a-z]","",t2)=="":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import re
s=str(input())
t=str(input())
t2=replace(s,t[:-1])
if len(t2)==1 and re.sub(r"[a-z]","",t2)=="":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import re
s=str(input())
t=str(input())
t2=re.match(s,t)
if len(t2)==1 and re.sub(r"[a-z]","",t2)=="":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import re
s=str(input())
t=str(input())
t2=re.sub(r^s,"",t)
if len(t2)==1 and re.sub(r"[a-z]","",t2)=="":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import re
s=str(input())
t=str(input())
t2=t.replace(s,"",1)
if re.match([a-z]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import re
s=str(input())
t=str(input())
t2=re.sub(s,"",t)
if len(t2)=1:
  print("Yes")
else:
  print("No")
Problem p02687 (python)

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

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
list_a=[]
for d in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  list_a.extend(a)
ans=0
for i in range(1,n): 
 if list_a.count(i)==0:
      ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
list_a=[]
for d in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  list_a.extend(a)
ans=0
for i in range(1,n): 
 if list_a.count(i)==0:
      ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
list_a=[]
for d in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  list_a.extend(a)
print(list_a)
ans=0
for i in range(1,n): 
 if list_a.count(i)==0:
      ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=str(input())
if n="ABC":
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
n=str(input())
if str="ABC":
  print("ARC")
else:
  print("ABC")
Problem p02700 (python)

Fixed submission:
tt,ta,at,aa=map(int,input().split())
 
for i in range(100):
 at-=ta 
 if at>0:
    pass
 elif at<=0:
    print("Yes")
    exit()
 tt-=aa
 if tt>0:
    pass
 elif tt<=0:
    print("No")
    exit()

Buggy submission (verdict: Runtime Error):
tt,ta,at,aa=map(int,input().split())
 
for i in range(100):
 at-=ta 
 if at-ta>0:
    pass
 elif at-ta<=0:
    print("Yes")
    exit()
 tt-=aa
 elif tt-aa>0:
    pass
 elif tt-aa<=0:
    print("No")
    exit()

Buggy submission (verdict: Runtime Error):
tt,ta,at,aa=map(int,input().split())
 
for i in range(100):
 at-=ta 
 if at-ta>0:
    pass
 elif at-ta<=0:
    print("Yes")
    exit
 tt-=aa
 elif tt-aa>0:
    pass
 elif tt-aa<=0:
    print("No")

Buggy submission (verdict: Runtime Error):
ta,tt,aa,at=map(int,input().split())
 
for i in range(100):
 if at-tt>0:
    at-=tt
 elif at-tt=<0:
    print("Yes")
 elif tt-aa>0:
     tt=-aa
 elif tt-aa=<0:
    print("No")
Problem p02717 (python)

Fixed submission:
x,y,z=map(int,input().split())
print(str(z)+" "+str(x)+" "+str(y))

Buggy submission (verdict: Runtime Error):
x,y,z=map(int,input().split()):
print(z+" "+x+" "+y)

Buggy submission (verdict: Runtime Error):
x,y,z=map(int,input().split()):
print(z,x,y)

Buggy submission (verdict: Runtime Error):
x,y,z=map(int,input().split()):
temp=x
y=x
x=temp

temp2=z
z=x
x=temp2
print(x,y,z)
Problem p02718 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a_sort=[]
a_sort=sorted(a,reverse=True)
sum=0
for i in a:
  sum+=i
b_sort=a_sort[0:m]
for j in b_sort:
 if j<sum/(4*m):
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a_sort=a.sorted()
sum=0
for i in a:
  sum+=i

for j in (1,m+1):
 if j<=1/(4*m):
    print("No")
    exit()
print("Yes")
Problem p02730 (python)

Fixed submission:
s=str(input())
n=len(s)

for i in range(0,n):
 if s[i]!=s[-i-1]:
    print("No")
    exit()

new_n1=int((n-1)/2)
new_s1=s[:new_n1]

new_n2=int((n+3)/2)
new_s2=s[new_n2-1:]
for i in range(0,len(new_s1)):
 if new_s1[i]!=new_s1[-i-1]:
    print("No")
    exit()
else:
  pass
for i in range(0,len(new_s2)):
 if new_s2[i]!=new_s2[-i-1]:
    print("No")
    exit()
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
s=str(input())
n=len(s)
new_n1=(n-1)/2
new_s1=s[:new_n]

new_n2=(n+3)/2
new_s2=s[new_nw:]

for i in range(new_n1):
 if new_s1[i]!=new_s1[n-i+1]:
    print("No")
    exit()
 else:
  pass

for j in range(new_n2):
 if new_s2[j]!=new_s2[n-j+1]:
    prin("No")
 else
  print("Yes")
Problem p02755 (python)

Fixed submission:
a,b =map(int,input().split())
 
for x in range(1009):
 if (x*0.08)//1==a and (x*0.10)//1==b and x//1==int(x):
  print(int(x))
  exit()
  
print(-1)

Buggy submission (verdict: Runtime Error):
a,b =map(int,input().split())
 
for x in range(101):
 if (x*1.08)//1==a+x and (x*1.10)//1==b+x and x//1=int(x):
  print(int(x))
  exit()
  
print(-1)
Problem p03494 (python)

Fixed submission:
b=[]
a=input()
b=map(int,input().split())
ans=[]
f_ans=0
for i in b:
 d=0
 while i % 2 == 0:
   i=i/2
   d+=1
 ans.append(d)
 f_ans=min(ans)
print(f_ans)

Buggy submission (verdict: Runtime Error):
a=input()
b=map(int,input().split())
ans=[]
max_b=max(b)
d=0
for i in b
 while i%2=0
   i=i/2
   d+=1
 ans.append(d)
print(ans)

Buggy submission (verdict: Runtime Error):
a=input()
b=map(int,input().stlip())
ans=0

while True:
for s in b
 if b[s]%2!=0
  break
 else:
   b[s]=b[s]/2
   ans+=1
print(ans)
Problem p03339 (python)

Fixed submission:
from collections import Counter
n = int(input())
s = input()
r = dict(Counter(s))
if 'W' not in r:
    r['W'] = 0
if 'E' not in r:
    r['E'] = 0
l = {'W': 0, 'E': 0}
a = []
for c in s:
    l[c] += 1
    r[c] -= 1
    l[c] -= 1
    a.append(l['W'] + r['E'])
    l[c] += 1
print(min(a))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
s = input()
r = dict(Counter(s))
l = {'W': 0, 'E': 0}
if s[0] == 'W':
    a = r['E']
else:
    a = r['E'] - 1
for c in s:
    if c == 'W' and r['W'] > 0:
        l['W'] += 1
        r['W'] -= 1
    if c == 'E' and r['E'] > 0:
        l['E'] += 1
        r['E'] -= 1
    if c == 'W':
        a = max(1, min(a, l['W'] + r['E'] - 1))
    else:
        a = max(1, min(a, l['W'] + r['E']))
print(a)
Problem p03474 (python)

Fixed submission:
a, b = map(int, input().split())
s = input()
import sys
if len(s) != a + b + 1:
  print('No')
else:
  for i in range(a):
    if s[i].isdigit() == False:
      print('No')
      sys.exit(0)
  for i in range(b):
    if s[a+i+1].isdigit() == False:
      print('No')
      sys.exit(0)
  if s[a] != '-':
    print('No')
  else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = input()
import sys
if len(s) != a + b + 1:
  print('No')
else:
  for i in range(a):
    if !(s[i].isdigit()):
      print('No')
      sys.exit(0)
  for i in range(b):
    if !(s[len(a)+i+1].isdigit()):
      print('No')
      sys.exit(0)
  if s[len(a)] != '-':
    print('No')
  else:
    print('Yes')
Problem p03478 (python)

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

def digitSum(n):
    return sum(list(map(int, list(str(n)))))
  
s = 0
for i in range(n+1):
  c = digitSum(i)
  if a <= c and c <= b: s += i
    
print(s)

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

def digitSum(n):
    s = str(n)
    array = list(map(int, list(s)))
    return sum(array)
  
sum = 0
for i in range(n+1):
  c = digitSum(i)
  if a <= c and c <= b: sum += i
    
print(sum)

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

def digitSum(n):
    s = str(n)
    array = list(map(int, list(s)))
    return sum(array)
  
sum = 0
for i in range(n+1):
  c = digitSum(i)
  if a <= c && c <= b: sum += i
    
print(sum)
Problem p03495 (python)

Fixed submission:
n, k = map(int, input().split())
a_l = list(map(int, input().split()))
           
import sys
import numpy as np

def g():
    m_l = np.array([0]*(n+1))

    r = 0
    for a in a_l:
        if m_l[a] == 0: r += 1
        m_l[a] += 1

    if r <= k:
        print(0)
        sys.exit(0)

    mn = 0
    while True:
        ma = np.ma.masked_equal(m_l, 0, copy=False)
        a = np.where(m_l == ma.min())[0]

        for i in a:
            mn += m_l[i]
            r -= 1
            m_l[i] = 0

            if r <= k: return mn
        
print(g())

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a_l = list(map(int, input().split()))
           
import sys
def g():
    m_l = [0] * (n+1)

    r = 0
    for a in a_l:
        if m_l[a] == 0: r += 1
        m_l[a] += 1

    if r <= k:
        print(0)
        sys.exit(0)

    mn = 0
    
    while True:
        mm = min(i for i in m_l if i > 0)

        for i in range(n+1):
            if mm == m_l[i]:
                mn += mm
                r -= 1
                m_l[i] = 0

                if r <= k: return mn
        
print(g())
Problem p03547 (python)

Fixed submission:
x, y = input().split()
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')
Problem p03555 (python)

Fixed submission:
c1 = input()
c2 = input()
c2 = c2[::-1]

import sys
for (a, b) in zip(c1, c2):
    if a != b:
        print('NO')
        sys.exit(0)

print('YES')

Buggy submission (verdict: Runtime Error):
c1 = input()
c2 = input()
c2 = c2[::-1]

import sys
for (a, b) in zip(c1, c2):
    if a != b:
        print('NO')
        sys.exit(1)

print('YES')