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

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
aa = 10 * ((a + 9) // 10)
bb = 10 * ((b + 9) // 10)
cc = 10 * ((c + 9) // 10)
dd = 10 * ((d + 9) // 10)
ee = 10 * ((e + 9) // 10)
if len(set([a%10,b%10,c%10,d%10,e%10]) - {0}) > 0:
    x = min(set([a%10,b%10,c%10,d%10,e%10]) - {0})
else:
    x = 10
# print(x)
print(aa+bb+cc+dd+ee-(10-x))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
aa = 10 * ((a + 9) // 10)
bb = 10 * ((b + 9) // 10)
cc = 10 * ((c + 9) // 10)
dd = 10 * ((d + 9) // 10)
ee = 10 * ((e + 9) // 10)
x = min(set([a%10,b%10,c%10,d%10,e%10]) - {0})
# print(x)
print(aa+bb+cc+dd+ee-(10-x))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
aa = 10 * ((a + 9) // 10)
bb = 10 * ((b + 9) // 10)
cc = 10 * ((c + 9) // 10)
dd = 10 * ((d + 9) // 10)
ee = 10 * ((e + 9) // 10)
x = min(set([a%10,b%10,c%10,d%10,e%10]) - {0})
print(x)
print(aa+bb+cc+dd+ee-(10-x))
Problem p03086 (python)

Fixed submission:
S = list(input())
A = ['A', 'C', 'G', 'T']
T = []
ans = 0
for e in S:
	if e in A:
		ans += 1
	else:
		T.append(ans)
		ans = 0
T.append(ans)
print(max(T))

Buggy submission (verdict: Runtime Error):
S = list(input())
A = ['A', 'C', 'G', 'T']
T = []
ans = 0
for e in S:
	if e in A:
		ans += 1
	else:
		T.append(ans)
		ans = 0
print(max(T))
Problem p03264 (python)

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

Buggy submission (verdict: Runtime Error):
k = int(input())
print(k//2 ** 2) if k % 2 == 0 else pritn(k//2 * (k//2 + 1))
Problem p02918 (python)

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

c=0
for i in range(1,n):
  if r[i-1]==r[i]:
    c+=1
  
print(min(n-1,c+2*k))

Buggy submission (verdict: Runtime Error):
#b is limit
a,b=map(int,input().split())
r=input()

if len(r)==1:
  print(0)
  exit()
  
i=1  
count=0
while i<len(r):
  if r[i-1:i+1]=="RL":
    count+=1
  i+=1
result=(a-1)-2*max(0,count-b)

if r[0]!=r[-1]:
  count-b<=0:
    result-=1

  
print(result)
Problem p02924 (python)

Fixed submission:
n=int(input())
sumNum=n*(n-1)//2

#print(r)
print(sumNum)

Buggy submission (verdict: Runtime Error):
n=int(input())
r=list(range(1,n+1))

#print(r)
print(sum(r)-(n))
Problem p02945 (python)

Fixed submission:
A,B =map(int,input().split())
print(max([A+B,A-B,A*B]))

Buggy submission (verdict: Runtime Error):
#N is numbers of BAITO, M is limit of days
N,M=map(int,input().split())

i=0
inp ={}
while i<N:
  readTime,inCome=map(int,input().split())
  if readTime in inp:
    inp[readTime].append(inCome)
  else:
    inp[readTime]=[inCome]
  
  i=i+1

#print(inp)  

result=0
pool=[]
i=1
while i<=M:
  if i in inp:
	  pool=pool+inp[i]
  #print(i,pool)
  
  if len(pool)>0:
    result=result+max(pool)
    pool.remove(max(pool))
    #print(pool)
  
  i=i+1
 
print(result)
Problem p02958 (python)

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

i=1
count=0
for item in r:
  if item!=i:count+=1
  i+=1

print("YES" if count<3 else "NO")

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

r="".join(r)
a="".join(a)

count=0
i=0
while i<len(r):
  if r[i]!=r[i]:count+=1
    
print("Yes" if count<=2 else "No")
Problem p03101 (python)

Fixed submission:
H,W=map(int,input().split())
h,w=map(int,input().split())

print(H*W-(H*w+W*h-h*w))

Buggy submission (verdict: Runtime Error):
H,W=map(int,input())
h,w=map(int,input())

print(H*w+W*h-h*w)
Problem p03110 (python)

Fixed submission:
n=int(input())

result=0
for item in range(n):
  a,b=map(str,input().split())
  if b=="JPY":
    result+=float(a)
  else:
    result+=float(a)*380000.0
print(result)

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

result=0
for item in range(n):
  a,b=map(str,input().split())
  if b=="JPY":
    result+=int(a)
  else:
    result+=int(a)*380000.0
print(result)
Problem p03145 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(a*b//2)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input.split())
print(a*b//2)
Problem p03160 (python)

Fixed submission:
n=int(input())
cost=list(map(int,input().split()))
 
ashiba=[0]*n
ashiba[1]=abs(cost[1]-cost[0])
#print(ashiba)
i=2
result=0
while i<n:
  ashiba[i]=min(abs(cost[i]-cost[i-1])+ashiba[i-1],abs(cost[i]-cost[i-2])+ashiba[i-2])
  #print(i,ashiba)
  i=i+1
  
print(ashiba[n-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
ashiba=list(map(int,input()))

cost=[0]*n

for item in range(1:n):
  print(item)
Problem p03238 (python)

Fixed submission:
n=int(input())
if n==1:print("Hello World")
else:print(int(input())+int(input()))

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==1:print("Hello World")
print(int(input())+int(input()))

Buggy submission (verdict: Runtime Error):
n=int(input())
print("Hello World" if n==1)
print(int(input())+int(input()))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
print("Hello World" if n==1 else str(a+b))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
print("Hello World" if n==1 else a+b)
Problem p03240 (python)

Fixed submission:
n=int(input())
#(x,y,h)
r=sorted([list(map(int,input().split()))[::-1] for _ in range(n)])[::-1]

for i in range(101):
  for j in range(101):
    h1=r[0][0]+abs(r[0][1]-i)+abs(r[0][2]-j)
    flag=0
    for item in r[1:]:
      if item[0]>0:
        if item[0]+abs(item[1]-i)+abs(item[2]-j)!=h1:
          flag=1
          break
      else:
        if h1-abs(item[1]-i)-abs(item[2]-j)>0:
          flag=1
          break
    if flag==0:
      print(j,i,h1)
      exit()

Buggy submission (verdict: Runtime Error):
n=int(input())
r=[list(map(int,input().split())) for _ in range(N)]
r.sort(key=lambda x:x[2])
x,y,h=r[-1]

for X in range(101):
  for Y in range(101):
    H = h + abs(X-x) + abs(Y-y)
    if all(k==max(H-abs(X-i)-abs(Y-j),0) for i,j,k in r):
      print(i,j,k)
      exit()
Problem p03244 (python)

Fixed submission:
import collections

n=int(input())
r=list(map(int,input().split()))

eNum=collections.Counter(r[1::2]).most_common()
oNum=collections.Counter(r[::2]).most_common()
eNum.append((0,0))
oNum.append((0,0))



if eNum[0][0]==oNum[0][0]:
  print(len(r)-max(eNum[0][1]+oNum[1][1],eNum[1][1]+oNum[0][1]))
else:
  print(len(r)-eNum[0][1]-oNum[0][1])

Buggy submission (verdict: Runtime Error):
import collections

n=int(input())
r=list(map(int,input().split()))

eNum=collections.Counter(r[1::2])
oNum=collections.Counter(r[::2])


if list(eNum)[0]==list(oNum)[0]:
  print(len(r)-max(eNum[list(eNum)[0]]+oNum[list(oNum)[1]],eNum[list(eNum)[1]]+oNum[list(oNum)[0]]))
else:
  print(len(r)-eNum[list(eNum)[0]]-oNum[list(oNum)[0]])

Buggy submission (verdict: Runtime Error):
import collections

n=int(input())
r=list(map(int,input().split()))

eNum=collections.Counter(r[1::2])
oNum=collections.Counter(r[::2])


if eNum.keys()[0]==oNum.keys()[0]:
  print(len(r)-max(eNum[eNum.keys()[0]]+oNum[oNum.keys()[1]],eNum[eNum.keys()[1]]+oNum[oNum.keys()[0]]))
else:
  print(len(r)-eNum[eNum.keys()[0]]-oNum[oNum.keys()[1]])
Problem p03292 (python)

Fixed submission:
r=sorted(map(int,input().split()))[::-1]

print(r[0]-r[2])

Buggy submission (verdict: Runtime Error):
r=sorted(map(int,input().split()))[-1]

print(r[0]-r[2])
Problem p03294 (python)

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

Buggy submission (verdict: Runtime Error):
int(input())
print(-1*int(input())+sum(list(map(int,input().split()))))
Problem p03323 (python)

Fixed submission:
a,b =map(int,input().split())
print(":(" if a>8 or b>8 else "Yay!")

Buggy submission (verdict: Runtime Error):
a,b =map(int,input.split())
print(":(" if a>8 or b>8 else "Yay!")
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if a*b%2==0:
  print("Even")
else:
  print("Odd")

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

flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  unk2=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])

  if unk>=0 and unk%2!=0 and unk2%2!=0:
    flag=1
  beforeTxy=afterTxy
  i=i+1

if flag==0:
  print("Yes")
else:
  print("No")
Problem p03457 (python)

Fixed submission:
N=int(input())
i=0
 
flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  #unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  #unk2=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])
  dt=afterTxy[0]-beforeTxy[0]
  dist=abs(afterTxy[1]-beforeTxy[1])+abs(afterTxy[2]-beforeTxy[2])
  #print(dt,dist)
  if dt < dist or dt%2!=dist%2:
    flag=1
  beforeTxy=afterTxy
  i=i+1
 
if flag==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
i=0

flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  unk2=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])

  if unk>=0 and unk%2!=0 and unk2%2!=0:
    flag=1
  beforeTxy=afterTxy
  i=i+1

if flag==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
i=0

flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  unk2=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])

  if unk>=0 and unk%2!=0 and unk2%2!=0:
    flag=1
  beforeTxy=afterTxy
  i=i+1

if flag==0:
  print("Yes")
else:
  print("No")
Problem p03474 (python)

Fixed submission:
a,b=map(int,input().split())
s=input().split("-")
s.append("-")

if len(s[0])==a and len(s[1])==b and s[1].isalnum() and s[0].isalnum():
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
dic={}
for _ in range(n):
  r=input()
  if r in dic:
    dic[r]+=1
  else:
    dic[r]=1

n=int(input())
for _ in range(n):
  r=input()
  if r in dic:
    dic[r]-=1
  else:
    dic[r]=-1

print(max(dic.values(),0))
Problem p03476 (python)

Fixed submission:
import math
Q = int(input())

def sosuu(x):
  if x == 1:
    return False
  else:
    for i in range(1,int(math.sqrt(x))):
      if x % (i+1) == 0:
        return False
    return True

table=[0]*100001
for i in range(1,100001):
  if i%2==1 and sosuu(int((i+1)/2)) and sosuu(i):
    table[i]=table[i-1] + 1
  else:
    table[i]=table[i-1]
#print(table[0:10])
ans=[0]*Q
for i in range(Q):
  l,r=map(int,input().split())
  ans[i]=table[r] - table[l-1]
  
for i in range(Q):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
import math
Q = int(input())

def sosuu(x):
  if x == 1:
    return False
  else:
    for i in range(1,int(math.sqrt(x))+1):
      if x % (i+1) == 0:
        return False
    return True

table=[0]*50001
for i in range(1,50001):
  if i%2==1 and sosuu((i+1)//2) and sosuu(i):
    table[i]=table[i-1] + 1
  else:
    table[i]=table[i-1]
#print(table[0:10])
ans=[0]*Q
for i in range(Q):
  l,r=map(int,input().split())
  ans[i]=table[r] - table[l-1]
  
for i in range(Q):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
import math
Q = int(input())

def sosuu(x):
  if x == 1:
    return False
  else:
    for i in range(1,int(math.sqrt(x))):
      if x % (i+1) == 0:
        return False
    return True

table=[0]*50001
for i in range(1,50001):
  if i%2==1 and sosuu(int((i+1)/2)) and sosuu(i):
    table[i]=table[i-1] + 1
  else:
    table[i]=table[i-1]
#print(table[0:10])
ans=[0]*Q
for i in range(Q):
  l,r=map(int,input().split())
  ans[i]=table[r] - table[l-1]
  
for i in range(Q):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
import math
Q = int(input())

def sosuu(x):
  if x == 1:
    return False
  else:
    for i in range(1,int(math.sqrt(x))):
      if x % (i+1) == 0:
        return False
    return True

table=[0]*50001
for i in range(1,50001):
  if i%2==1 and sosuu((i+1)//2) and sosuu(i):
    table[i]=table[i-1] + 1
  else:
    table[i]=table[i-1]
#print(table[0:10])
ans=[0]*Q
for i in range(Q):
  l,r=map(int,input().split())
  ans[i]=table[r] - table[l-1]
  
for i in range(Q):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
import math
Q = int(input())

def sosuu(x):
  if x == 1:
    return False
  else:
    for i in range(1,int(math.sqrt(x))):
      if x % (i+1) == 0:
        return False
    return True

table=[0]*50001
for i in range(1,50001):
  if i%2==1 and sosuu((i+1)//2) and sosuu(i):
    table[i]=table[i-1] + 1
  else:
    table[i]=table[i-1]
#print(table[0:10])
ans=[0]*Q
for i in range(Q):
  l,r=map(int,input().split())
  ans[i]=table[r] - table[l-1]
  
for i in range(Q):
  print(ans[i])
Problem p03493 (python)

Fixed submission:
a = int(input())
i=0
sum=0
while i<len(str(a)):
  if str(a)[i]=="1":
    sum=sum+1
  i=i+1
  
print(sum)

Buggy submission (verdict: Runtime Error):
a = int(input())
i=0
sum=0
for i<len(str(a)):
  if str(a)[i]=="1":
    sum=sum+1
  i=i+1
  
print(sum)

Buggy submission (verdict: Runtime Error):
a = int(input())
i=0
sum=0
for i<len(str(a)):
  if str(a)[i]==1:
    sum=sum+1
  i=i+1
  
print(sum)

Buggy submission (verdict: Runtime Error):
a = int(input())
i=0
sum=0
for i<len(a):
  if str(a)[i]==1:
    sum=sum+1
  i=i+1
  
print(sum)
Problem p03578 (python)

Fixed submission:
import collections

a=int(input())
b=collections.Counter(list(map(int,input().split())))
c=int(input())
d=collections.Counter(list(map(int,input().split())))
e=set(d)

for item in e:
  if d[item]>b[item]:
    print("NO")
    exit()
    
print("YES")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
c=int(input())
d=list(map(int,input().split()))
e=set(d)

for item in e:
  if d.count(item)>c.count(item):
    print("NO")
    exit()
    
print("YES")

Buggy submission (verdict: Runtime Error):
n=int(input())
r=list(map(int,input().split()))
m=int(input())
d=list(map(int,input().split()))
e=set(d)

from collections import Counter
n=counter(n)
d=counter(d)

for item in e:
  if r[item]<d[item]:
    print("NO")
    exit()
print("YES")
Problem p03673 (python)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=a[::-2]+a[N%2::2]
print(*b)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[N%2::2])

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[N%2::2])
Problem p03860 (python)

Fixed submission:
print("A%sC"%input()[8])

Buggy submission (verdict: Runtime Error):
print("A%sC",%input().split()[0])

Buggy submission (verdict: Runtime Error):
print("A%sC",%input()[8])
Problem p04030 (python)

Fixed submission:
S=input()

result=[]

for s in S:
  #print(result)
  if s=="B":
    if len(result)>0:
      #print("nBack")
      result.pop()
  else:
    result.append(s)

print(*result,sep="")

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

result=[]

for s in S:
  print(result)
  #if s=="B":
    if len(result)>0:
      #print("nBack")
      result.pop()
  else:
    result.append(s)

print(*result)
Problem p03047 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split())
c = a! / (b! * (a - b)!)
print(c)

Buggy submission (verdict: Runtime Error):
a,b=
Problem p02687 (python)

Fixed submission:
s = input()
if s == 'ABC':
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
s = int(input())
if s == 'ABC':
    print('ARC')
else:
    print('ABC')
Problem p02690 (python)

Fixed submission:
def solve():
   x = int(input())
   for a in range(-500,500):
      for b in range(-500,500):
         n = a**5 - b**5
         if n == x:
            print(a,end=" ")
            print(b)
            return
solve()

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

def f(x,b):
    return int((x+b**5)**(1/5))

b=0
plus=1
while True:
    ans = f(x,b)
    print(ans)
    if ans**5-b**5 == x:
        print(ans, b)
        break
    elif plus == 1:
        b=b*(-1)
        plus = 0
    elif plus == 0:
        b=b*(-1)
        b+=1
        plus = 1

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

def f(x,b):
    return math.floor((x+b**5)**(1/5))

b=0
plus=1
while True:
    ans = f(x,b)
    print(ans)
    if ans**5-b**5 == x:
        print(ans, b)
        break
    elif plus == 1:
        b=b*(-1)
        plus = 0
    elif plus == 0:
        b=b*(-1)
        b+=1
        plus = 1
Problem p02696 (python)

Fixed submission:
import math
 
A, B, N = map(int, input().split())
 
 
ans1 = 0
 
if N > B - 1:
    x = B-1
    print(int((A * x) / B) - A * int(x / B))
elif N <= B - 1:
    x = N
    print(int((A * x) / B) - A * int(x / B))

Buggy submission (verdict: Runtime Error):
import math
a,b,n = map(int,input().split())
#li = []
 
#for x in range(n+1):
ans = (math.floor((a*(n))/b) - (a * math.floor(n/b)))

 
#print(max(li))
if max(li) > n:
    print(0)
else:
    print(max(li))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
a,b,n = map(int,input().split())
li = []
append = li.append
siki = int((a*(x))/b) - a * int(x/b)
for x in range(n+1):
    append(siki)
print(max(li))
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
li = int(input().split())
list = []
list.append(li[2])
list.append(li[0])
list.append(li[1])
print(list)
Problem p02719 (python)

Fixed submission:
N,K = map(int,input().split())
ans1 = N % K
ans2 = abs(ans1 - K)
if ans1 <= ans2:
  print(ans1)
else:
  print(ans2)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
num = N
if N <= abs(N - K)
  print(N)
else:
  while N <= num:
    num = N
    N = abs(N - K)
  print(num)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
num = N
if N <= abs(N -K)
  print(N)
else:
  while N <= num:
    num = N
    N = abs(N - K)
  print(num)
Problem p02743 (python)

Fixed submission:
a, b, c = map(int,input().split())
if (c - a - b > 0) and (4 * a * b < (c - a - b)**2):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
if (c − a − b > 0) and (4 * a * b < (c − a − b)**2):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
if c − a − b > (0 and 4 * a * b) < (c − a − b)**2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
if c − a − b > 0 and 4 * a * b < (c − a − b)**2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
x,y,z = map(int,input().split())
if c − a − b > 0 and 4 * a * b < (c − a − b)**2:
  print('Yes')
else:
  print('No')
Problem p02756 (python)

Fixed submission:
import collections
s = collections.deque(list(input()))
q = int(input())
cnt = 0
for i in range(q):
    fc = input().split()
    if fc[0] == '1':
        cnt += 1
    else:
        if cnt == 1:
            fc[1] = '1' if fc[1] == '2' else '2'
        if fc[1] == '1':
            s.appendleft(fc[2])
        else:
            s.append(fc[2])
    cnt %= 2
s = list(s)
if cnt == 1:
    s.reverse()
print(*s, sep='')

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

if n == 1:
    print('a')
    exit()

ans = []


def dfs(s, c):
    for i in range(ord('a'), ord(c) + 2):
        now = s + chr(i)
        if len(now) == n:
            ans.append(now)
        elif i > ord(c):
            dfs(now, chr(i))
        else:
            dfs(now, c)


dfs('a', 'a')

for c in ans:
    print(c)
Problem p02787 (python)

Fixed submission:
h, n = map(int, input().split())
a = []
b = []
for _ in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

dp = [float("inf")] * (2 * 10000 + 1)
dp[0] = 0
for i in range(h):
    for j in range(n):
        if (i + a[j]) > 2 * 10000:
            dp[2 * 10000] = min(dp[2 * 10000], dp[i] + b[j])
            continue
        dp[i + a[j]] = min(dp[i + a[j]], dp[i] + b[j])

ans = float('inf')
for j in range(h, 2 * 10000 + 1):
    ans = min(ans, dp[j])
print(ans)

Buggy submission (verdict: Runtime Error):
h, n = map(int, input().split())
a = []
b = []
for _ in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

dp = [float("inf")] * (2 * h + 1)
dp[0] = 0
for i in range(h):
    for j in range(n):
        dp[i + a[j]] = min(dp[i + a[j]], dp[i] + b[j])

ans = float('inf')
for j in range(h, 2 * h + 1):
    ans = min(ans, dp[j])
print(ans)

Buggy submission (verdict: Runtime Error):
h, n = map(int, input().split())
a = []
b = []
for _ in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

dp = [float("inf")] * (3 * h)
dp[0] = 0
for i in range(h):
    for j in range(n):
        dp[i + a[j]] = min(dp[i + a[j]], dp[i] + b[j])

ans = float('inf')
for j in range(h, 2 * h + 1):
    ans = min(ans, dp[j])
print(ans)

Buggy submission (verdict: Runtime Error):
h, n = map(int, input().split())
a = []
b = []
for _ in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

dp = [float("inf")] * (3 * h)
dp[0] = 0
for i in range(h):
    for j in range(n):
        dp[i + a[j]] = min(dp[i + a[j]], dp[i] + b[j])

ans = float('inf')
for j in range(h, 2 * h + 1):
    ans = min(ans, dp[n][j])
print(ans)
Problem p02900 (python)

Fixed submission:
import math
import fractions
a, b = map(int, input().split())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort()
    return divisors


def is_prime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True


ans = 1
divs = make_divisors(fractions.gcd(a, b))
for num in divs:
    if is_prime(num):
        ans += 1
print(ans)

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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort()
    return divisors


def is_prime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True


ans = 1
divs = make_divisors(math.gcd(a, b))
for num in divs:
    if is_prime(num):
        ans += 1
print(ans)