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

Fixed submission:
a, b = [int(w) for w in input().split()]

ans = 0
for i in range(a, b + 1):
    if str(i) == str(i)[::-1]:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
31415 92653
Problem p03695 (python)

Fixed submission:
n = int(input())
la = [int(w) for w in input().split()]

cnt = [0]*9
for a in la:
    if a > 3200:
        a = 3200
    cnt[a // 400] += 1

mi = len([_ for _ in cnt[:8] if _ > 0])
ma = mi+cnt[8]

if mi == 0:
    mi = 1

print(mi, ma)

Buggy submission (verdict: Runtime Error):
n = int(input())
la = [int(w) for w in input().split()]

cnt = [0]*9
for a in la:
    cnt[a // 400] += 1

mi = len([_ for _ in cnt[:8] if _ > 0])
ma = mi+cnt[8]

print(mi, ma)
Problem p02718 (python)

Fixed submission:
N,M = list(map(int,input().split()))
A=list(map(int, input().split())) 
total=sum(A)
cnt=0
for a in A:
  if a*4*M>=total:
  	cnt=cnt+1

print("Yes" if cnt>=M else "No")

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

total=sum(A)
for i in range(N):
  if A[i]*4*M>total:
  	cnt=cnt+1

if cnt>=M:
  print('Yes')
else:
  print('No')
Problem p02791 (python)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
a = P[0]
cnt = 1
for i in P:
    if a > i:
        a = i
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))
a = P[0]
cnt = 1
for i in P:
    if a > P:
        a = P
        count += 1
print(count)
Problem p03352 (python)

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

A=[1]
for b in range(2,32):
  for p in range(2,10):
    if b**p>X:
      break
    elif b**p not in A:
      A.append(b**p)
print(max(A))

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

A=[]
for i in range(X):
  for j in range(X):
    b=i+1
    p=j+1
    if b**p>X:
      break
    elif p>=2 and b**p not in A:
      A.append(b**p)
print(max(A))

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

A=[]
for b in range(1,X):
  for p in range(2,X):
    if b**p>X:
      break
    elif b**p<=X:
      A.append(b**p)

print(max(A))
Problem p03448 (python)

Fixed submission:
#A,B,C,X=map(int,input().split()) #500,100,50, total
#X=500*a+100*b+50*c
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if X==500*a+100*b+50*c:
        count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
A,B,C,X=map(int,input().split()) #500,100,50, total
#X=500*a+100*b+50*c
flag=0
count=0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if X==500*a+100*b+50*c:
        count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
A,B,C,X=map(int,input().split()) #500,100,50, total
#X=500*a+100*b+50*c
flag=0
count=0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if X==500*a+100*b+50*c:
        count=count+1
        flag=1
if flag==1:
  print(count)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
A,B,C,X=map(int,input().split()) #500,100,50, total
#X=500*a+100*b+50*c

count=0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if X==500*a+100*b+50*c:
        count=count+1
        
print(count)
Problem p03455 (python)

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

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


if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a, b = input().split()
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())
 
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a = int(input().split(""))
b = int(input().split(""))

if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):

a=int(input())
b=int(input())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a,b =map(int,input().split)
if (a*b)%2:
  print("Odd")
else:
  print("Even")

Buggy submission (verdict: Runtime Error):
a,b= map(int,input().split)
if a*b%2==0:
  print("Even")
else:
  print("Odd")
Problem p03457 (python)

Fixed submission:
_ = int(input())
bef_time = 0
bef_x = 0
bef_y = 0
ans = True

for i in range(_):
    next = input().split()
    next_time = int(next[0])
    next_x = int(next[1])
    next_y = int(next[2])
    time = next_time - bef_time
    range = abs(next_x - bef_x) + abs(next_y - bef_y)

    if (next_time - bef_time) < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    bef_time = next_time
    bef_y = next_y
    bef_x = next_x



if ans == True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
t0 = 0
x0 = 0
y0 = 0
ans = True

for i in range(N):
    x,y,z = map(int,input().split())
    #t = int(next[0])
    #x = int(next[1])
    #y = int(next[2])
    time = t - t0
    range = abs(x - x0) + abs(y - y0)

    if time < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    t0 = t
    y0 = y
    x0 = x



if ans == True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
t0 = 0
x0 = 0
y0 = 0
ans = True

for i in range(N):
    x,y,z = map(input().split())
    #t = int(next[0])
    #x = int(next[1])
    #y = int(next[2])
    time = t - t0
    range = abs(x - x0) + abs(y - y0)

    if time < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    t0 = t
    y0 = y
    x0 = x



if ans == True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
2
3 1 2
5 100 7
Problem p03470 (python)

Fixed submission:
N=int(input())
d=set()
for i in range(N):
  d.add(int(input()))
print(len(d))

Buggy submission (verdict: Runtime Error):
N,Y=map(int,input().split())
#N=a+b+c
#Y=10000*a+5000*b+1000*c
ans=[]
maxA=Y//10000
maxB=Y//5000
maxC=Y//1000
for a in range(maxA+1):
  for b in range(maxB+1):
    for c in range(maxC+1):
      if N==a+b+c:
        if Y==10000*a+5000*b+1000*c:
          ans.append(str(a)+" "+str(b)+" "+str(c))
if len(ans)!=0:
  print(ans[0])
else:
  print(str(-1)+" "+str(-1)+" "+str(-1))
Problem p03478 (python)

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

ans=0
count=0
for n in range(N+1):
  d_sum=0
  count=n
  while n>=1:
    d_sum=d_sum+n%10
    n=n//10
  if A <= d_sum <= B:
    ans=ans+count
    
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=int(input())
B=int(input())
#N=a*1000+b*100+c*10+d*1
#N=a*(10**3)+b*(10**2)+c*(10**1)+d*(10**0)

ans=0
while N>0:
  i=0
  while N>(10**i):
    i=i+1
  
  d_sum=0
  N_buff=N
  while i>=0:
    d=N//(10**i)
    N=N-d*(10**i)
    d_sum=d_sum+d
    i=i-1
  N=N_buff
  if d_sum>=A and d_sum<=B:
    ans=ans+d_sum
    
  N=N-1

print(ans)
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

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

flag=0
count=0
ans=[]
for a in A:
  if a%2==0:
    count=a/2
    ans.append(count)
  else:
    flag=1
if flag==0:
  print(int(min(ans)))
else:
  print(0)

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

p=0
for i in A:
  if p==0:
    while i%2==1:
      p=p+1    
  else:
    ans=p
    while i%2==1:
      p=p+1
    if p>ans:
      ans=p
print(ans)
Problem p03854 (python)

Fixed submission:
S=input()
Word = ['eraser','erase','dreamer','dream']
for i in Word:
  S=S.replace(i,'')
if len(S) == 0 :
  print('YES')
else :
  print('NO')

Buggy submission (verdict: Runtime Error):
s=str(input())
words=["dream", "dreamer", "erase", "eraser"]
N=max(len(words[0]),len(words[1]),len(words[2]),len(words[3]))
flag=0
while len(s)>=0:
  pos0=s[-N:].rfind(words[0])
  pos1=s[-N:].rfind(words[1])
  pos2=s[-N:].rfind(words[2])
  pos3=s[-N:].rfind(words[3])
  m=max(pos0,pos1,pos2,pos3)
  if m==-1:
    flag=1
    break
  else:
    pos=N-m
    s=s[:-pos]

if flag=1:
  print("NO")
else:
  print("YES")
Problem p02582 (python)

Fixed submission:
S = input()
s = [i for i in S]
if s.count('R') == 3:
    print(3)
elif s.count('R') == 1:
    print(1)
elif s.count('R') == 0:
    print(0)
else:
    if S == 'RSR':
        print(1)
    else:
        print(2)

Buggy submission (verdict: Runtime Error):
S = input()
s = [i for i in input()]
if s.count('R') == 3:
    print(3)
elif s.count('R') == 1:
    print(1)
elif s.count('R') == 0:
    print(0)
else:
    if S == 'RSR':
        print(1)
    else:
        print(2)
Problem p02995 (python)

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

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

CD = C * D // gcd(C,D) 

tgC = max(B//C - (A-1)//C, 0)
tgD = max(B//D - (A-1)//D, 0)
tgCD = max(B//CD - (A-1)//CD, 0)

print((B-A+1)-(tgC+tgD-tgCD))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import math
A,B,C,D = map(int,input().split())

CD = C * D // math.gcd(C,D) 

tgC = int(B/C) - int((A-1)/C)
tgD = int(B/D) - int((A-1)/D)
tgCD = int(B/CD) - int((A-1)/CD)


print((B-A+1)-(tgC+tgD-tgCD))
Problem p02612 (python)

Fixed submission:
N = int(input())

answer = 1000 - (N%1000)
answer = answer%1000

print(answer)

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

answer = 1000 - (N%1000)

print(answer)
Problem p02613 (python)

Fixed submission:
N = int(input())

ac = 0
wa = 0
tle = 0
re = 0

for i in range(N):
  s = input()
  
  if s=="AC":
    ac+=1
  elif s=="WA":
    wa+=1
  elif s=="TLE":
    tle+=1
  else:
    re+=1
      
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))

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

ac = 0
wa = 0
tle = 0
re = 0

for i in range(N):
  s = input()
  
  if s=="AC":
	ac+=1
  else if s=="wa":
    wa+=1
  else if s=="TLE":
    tle+=1
  else:
    re+=1
      
print("AC x "+ac)
print("WA x "+wa)
print("TLE x "+tle)
print("RE x "+re)

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

ac = 0
wa = 0
tle = 0
re = 0

for i in range(N):
  s = input()
  
  switch(s):
    case "AC":
      ac+=1
      break
    case "WA":
      wa+=1
      break
    case "TLE":
      tle+=1
      break
    case "RE":
      re+=1
      break
      
print("AC x "+ac)
print("WA x "+wa)
print("TLE x "+tle)
print("RE x "+re)
Problem p02898 (python)

Fixed submission:
n, k = input().split(" ")
h = input().split(" ")

count = 0
for i in range(int(n)):
  if int(h[i])>=int(k):
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n, k = input().split(" ")
h = input().split(" ")

count = 0
for i in range(n):
  if h[i]>=k:
    count+=1
print(count)
Problem p02899 (python)

Fixed submission:
n = int(input())
lst = input().split(" ")

dic = {}
for i, l in enumerate(lst):
  dic[int(l)] = i+1

ll = []
for i in range(1, n+1):
  ll.append(str(dic[i]))
  
answer = " ".join(ll)
print(answer)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = input().split(" ")

dic = {}
for i, l in enumerate(lst):
  dic[int(l)] = i

ll = []
for i in range(1, n+1):
  ll.append(dic[i])
  
answer = " ".join(ll)
print(answer)
Problem p02630 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = [0] * Q
C = [0] * Q  
li=[0]*100001
for a in A:
  li[a]+=1
su=sum(A)
for q in range(Q):
  B,C=list(map(int, input().split())) 
  su += li[B] * (C-B)
  li[C]+=li[B]
  li[B]=0
  print(su)

Buggy submission (verdict: Runtime Error):
N,=list(map(int, input().split()))
A = list(map(int, input().split()))
Q, = list(map(int, input().split()))
B = [0 for i in range(Q)]
C = [0 for i in range(Q)]
for q in range(Q):
  B[q],C[q]=list(map(int, input().split())) 
li=[0 for i in range(1,100001)]
for a in A:
  li[a]+=1
su=sum(A)
for q in range(Q):
  su += li[B[q]] * (C[q]-B[q])
  li[C[q]]+=li[B[q]]
  li[B[q]]=0
  print(su)

Buggy submission (verdict: Runtime Error):
N,=list(map(int, input().split()))
A = list(map(int, input().split()))
Q, = list(map(int, input().split()))
B = [0 for i in range(Q)]
C = [0 for i in range(Q)]
for q in range(Q):
  B[q],C[q]=list(map(int, input().split())) 
li=[0 for i in range(100000)]
for a in A:
  li[a]+=1
su=sum(A)
for q in range(Q):
  su += li[B[q]] * (C[q]-B[q])
  li[C[q]]+=li[B[q]]
  li[B[q]]=0
  print(su)

Buggy submission (verdict: Runtime Error):
N,=list(map(int, input().split()))
A = list(map(int, input().split()))
Q, = list(map(int, input().split()))
B = [0 for i in range(Q)]
C = [0 for i in range(Q)]
for q in range(Q):
  B[q],C[q]=list(map(int, input().split())) 
li=[0 for i in range(100000)]
for a in A:
  li[a]+=1
su=sum(A)
for q in range(Q):
  su = su + li[B[q]] * (C[q]-B[q])
  li[C[q]]+=li[B[q]]
  li[B[q]]=0
  print(su)
Problem p02687 (python)

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

Buggy submission (verdict: Runtime Error):
S=list(map(int, input().split()))
if S=='ARC':
  print("ABC")
else:
  print("ARC")
Problem p02696 (python)

Fixed submission:
A,B,N= list(map(int, input().split()))
print(int(A*min(B-1,N)/B)-A*int(min(B-1,N)/B))

Buggy submission (verdict: Runtime Error):
A,B,N= list(map(int, input().split()))
ma=0
for i in range(min(N,B)+1,1):
    a=int(A*i/B)-A*int(i/B)
    if(a<=A):
    	if(ma<a):
        	ma=a
            break
print(ma)
Problem p02741 (python)

Fixed submission:
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(a[k-1])

Buggy submission (verdict: Runtime Error):
import math as np
a,b,c=map(int, input().split())
r=(1-((a**2/c**2)+(b**2/c**2)))**2
if r>4*a*b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import math
a,b,c=map(int, input().split())
if (a/c) ** 2+(b/c)**2+2* math.sqrt(a*b/(c ** 2))<1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b,c=map(int, input().split())
if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
  print("Yes")
else:
  print("No")
Problem p02743 (python)

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

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

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b,c=map(int, input().split())
r=c**2-(a**2+b**2)
if r>2*np.sqrt(ab):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b,c=map(int, input().split())
if a**2+c**2<b**2-2*np.sqrt(ac):
  print("Yes")
else:
  print("No")
Problem p03103 (python)

Fixed submission:
import numpy as np
from operator import itemgetter
N,M=(int(x) for x in input().split())
A=[]
 
for i in range(N):
  D=[int(x) for x in input().split()]
  A+=[D]    
result=A.sort(key=itemgetter(0))
count=M
sum=0
for i in range(N):
  if count-A[i][1]>0:
    count=count-A[i][1]
    sum+=A[i][0]*A[i][1]
  else:
    sum+=count*A[i][0]
    break
print(sum)

Buggy submission (verdict: Runtime Error):
import numpy as np
from operator import itemgetter
N,M=(int(x) for x in input().split())
A=[]

for i in range(N):
  D=[int(x) for x in input().split()]
  A=A.append([D])    
result=A.sort(key=itemgetter(0))
count=M
sum=0
for i in range(N):
  if count-A[i][1]>0:
    count=count-A[i][1]
    sum+=A[i][0]*A[i][1]
  else:
    sum+=count*A[i][0]
    break
print(sum)
Problem p02582 (python)

Fixed submission:
A = input()

cnt = A.count('R')
if cnt == 2:
  ccc = A.find('S')
  if ccc == 1:
    cnt =1

print(cnt)

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

cnt = A.conunt('R')
if cnt = 2:
  if A(2) == 'S':
    cnt =1
Problem p02718 (python)

Fixed submission:
l = list(map(int, input().split()))
a = list(map(int, input().split()))
fla=True
n=sum(a)
a.sort(reverse=True)
if a[l[1]-1]>=n/(4*l[1]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
l = list(map(int, input().split()))
a = list(map(int, input().split()))
n=sum(a)
if a[l[1]]>=n/(4*l[0]):
    print('Yes')
else:
    print('No')
Problem p02742 (python)

Fixed submission:
l = list(map(int, input().split()))
x=l[0]*l[1]
if l[0]==1 or l[1]==1:
    print('1')
elif x%2==0:
    print(int(x/2))
else:
    print(int(x//2)+1)

Buggy submission (verdict: Runtime Error):
l = list(map(int, input().split()))
x=l[0]*l[1]
if l[0]==1 or l[2]==1:
    print('1')
elif x%2==0:
    print(int(x/2))
else:
    print(int(x//2)+1)

Buggy submission (verdict: Runtime Error):
l = list(map(int, input().split()))
x=l[0]*l[1]
if l[0]==1 or l[1]=1:
    print('1')
elif x%2==0:
    print(int(x/2))
else:
    print(int(x//2))
Problem p02760 (python)

Fixed submission:
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
n=int(input())
b = [int(input()) for i in range(n)]
f=False
for i in range(3):
    for j in range(n):
        if l1[i]==b[j]:
            l1[i]=0
        elif l2[i]==b[j]:
            l2[i]=0
        elif l3[i]==b[j]:
            l3[i]=0
for i in range(3):
    if l1[i]==l2[i] and l2[i]==l3[i] and l1[i]==l3[i]:
        f=True
if l1[0]==l1[1] and l1[1]==l1[2] and l1[0]==l1[2]:
    f=True
elif l2[0]==l2[1] and l2[1]==l2[2] and l2[0]==l2[2]:
    f=True
elif l3[0]==l3[1] and l3[1]==l3[2] and l3[0]==l3[2]:
    f=True
elif l1[0]==0 and l2[1]==0 and l3[2]==0:
    f=True
elif l3[0]==0 and l1[2]==0 and l2[1]==0:
    f=True
    
if f==True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
n=int(input())
b = [int(input()) for i in range(n)]
f=False
for i in range(3):
    for j in range(n):
        if l1[i]==b[j]:
            l1[i]=0
        elif l2[i]==b[j]:
            l2[i]=0
        elif l3[i]==b[j]:
            l3[i]=0
for i in range(3):
    if l1[i]==l2[i] and l2[i]==l3[i] and l1[i]==l3[i]:
        f=True
if l1[0]==l1[1] and l1[1]==l[2] and l1[0]==l1[2]:
    f=True
elif l2[0]==l2[1] and l2[1]==l2[2] and l2[0]==l2[2]:
    f=True
elif l3[0]==l3[1] and l3[1]==l3[2] and l3[0]==l3[2]:
    f=True
elif l1[0]==0 and l2[1]==0 and l3[2]==0:
    f=True
elif l3[0]==0 and l1[2]==0 and l2[1]==0:
    f=True
    
if f==True:
    print('Yes')
else:
    print('No')
Problem p02778 (python)

Fixed submission:
x=input()
xx=''
for i in range(len(x)):
    xx+='x'
print(xx)

Buggy submission (verdict: Runtime Error):
    x=input()
    xx=[]
    if i in range(len(x)):
      xx.append("x")
    print(x)

Buggy submission (verdict: Runtime Error):
x=input()
xx=[]
if i in range(len(x)):
  xx.append(x)
print(x)
Problem p02657 (python)

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

print(A * B)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input().split()
 
 
#リストAの要素をすべて掛け算
product = 1
for i in A:
    product *= int(i)
 
if product > 10 ** 18:
    product = -1
 
print(product)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
MX = 10**18
a = list(map(int, input.split()))
if 0 in a:
    print(0)
    exit(0)
ans = 1
for x in a:
    ans *= x
    if ans > MX:
        print(0)
        exit(0)
print(ans)
Problem p02582 (python)

Fixed submission:
s=input()
if 'RRR' in s:
    print ('3')
elif 'RR' in s:
    print ('2')
elif 'R' in s:
    print('1')
else:
    print('0')

Buggy submission (verdict: Runtime Error):
s=input()
if 'RRR' in s:
    print ('3')
if 'RR' in s:
    print ('2")
if 'R' in s:
    print('1')
else:
    print('0')
Problem p03043 (python)

Fixed submission:
N, K = map(int, input().split())
pro = 0
for score in range(1, N+1):
    a = 0
    while score < K:
        score *= 2
        a += 1
    pro += 1/N * (0.5**a)
print(pro)

Buggy submission (verdict: Runtime Error):
import math

N, K = map(int, input().split())
pro = 0
for score in range(N+1):
    a = math.floor(math.log(K,score))
    pro += 1/N * 0.5**a
print(pro)
Problem p03050 (python)

Fixed submission:
import math
N = int(input())
num = 0
i = 1
while i <= math.sqrt(N):
    if N % i == 0:
        a = i - 1
        b = (N // i) - 1
        if a == b:
            if a > 0 and N // a == N % a:
                num += a
        else:
            if a > 0 and N // a == N % a:
                num += a
            if b > 0 and N // b == N % b:
                num += b
    i += 1

print(num)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
num = 0
i = 1
while i <= math.sqrt(N):
    if N % i == 0:
        a = i - 1
        b = (N // i) - 1
        if a == b:
            if N // a == N % a:
                num += a
        else:
            if a > 0 and N // a == N % a:
                num += a
            if b > 0 and N // b == N % b:
                num += b
    i += 1

print(num)
Problem p03161 (python)

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

dp = [10**10] * n
dp[0] = 0

for i in range(n-1):
    for j in range(1, k+1):
        if i+j < n:
            dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
print(dp[-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
n, k = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = np.full_like(h, 10**9)
dp[0] = 0

for i in range(n-1):
    for j in range(1, k+1):
        if i+j < n:
            dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
print(dp[-1])