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

Fixed submission:
N = int(input())
li = list(map(int, input().split()))
li.sort()
P = 0
for i in range(N):
  P += li[i*2]
print(P)

Buggy submission (verdict: Runtime Error):
N = int(input())
li = list(map(int, input().split))
li.sort()
P = 0
for i in range(N):
  P += li[i*2]
print(P)
Problem p02687 (python)

Fixed submission:
def nextweek(S):
  if( S == "ABC"):
    return "ARC"
  else:
    return "ABC"



S = input()
print (nextweek(S))

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

ans = [0,0]
for i in range(-500,500):
  for j in range(-500,500):
    if i**5 - j**5 == X:
      ans[0] = i
      ans[1] = j
      break

ans = " ".join(map(str,ans))
print(ans)

Buggy submission (verdict: Runtime Error):
NK = list(map(int, input().split()))
ans = [0]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,NK[0]):
    if table.count(j) == 1:
      ans[j] = 0
print(NK[1]-sum(ans))

Buggy submission (verdict: Runtime Error):
NK = list(map(int, input().split()))
ans = [1]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,NK[0]):
    if table.count(j) == 0:
      ans[j] = 0
print(sum(ans))
Problem p02690 (python)

Fixed submission:
X = int(input())

ans = [0,0]
for i in range(-500,500):
  for j in range(-500,500):
    if i**5 - j**5 == X:
      ans[0] = i
      ans[1] = j
      break

ans = " ".join(map(str,ans))
print(ans)

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

def smaller(n,m):
  if n >= m:
    return m
  else:
    return n

a = 0

for i in range(0,N):
  for j in range(i+1,smaller(N,100)):
    if j-i == hight[i] + hight[j]:
      a = a+1

print(a)

distance = [0]
Problem p02981 (python)

Fixed submission:
n,a,b=map(int,input().split())
if n*a<b:
    print("{}".format(n*a))
else:
    print("{}".format(b))

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
L=l%2019
R=r%2019
min=2020
if L>R:
    R=R+2019
for j in range(L+1,R+1):
    for i in range(L,j):
        if min > i*j%2019:
            min = i*j%2019
print("{}".format(min))
Problem p03284 (python)

Fixed submission:
num = [int(e) for e in input().split()]
N=num[0]
K=num[1]
if N%K==0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
num = [int(e) for e in input().split()]
N=num[0]
K=num[1]
if B%A==0:
    print(0)
else:
    print(1)
Problem p02687 (python)

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

Buggy submission (verdict: Runtime Error):
## import

## function definition 

## main process
if __name__ == '__main__':
    
    ## input
    N, M = map(int,input().split())
    HEIGHT_LIST = list(map(int,input().split())) 
    ROAD_LIST = []
    for j in range(M): 
        ROAD_LIST.append(
            set(map(int,input().split()))
        )
    
    ## business logic
    COUNT = 0
    
    for i in list(range(1, N+1)):
        unioned_i = set([])
        for k in ROAD_LIST:
            if i in k:
                unioned_i = unioned_i | k
        if len(unioned_i) == 0:
            COUNT = COUNT + 1
            continue
        HIGHT_i = HEIGHT_LIST[i-1]
        if HIGHT_i >= max(
            [ HEIGHT_LIST[l-1] for l in list(unioned_i) ]
        ):
            COUNT = COUNT + 1
    
    ## output
    print(COUNT)

Buggy submission (verdict: Runtime Error):
S = input()
if S == 'ABC':
    print 'ARC'
else:
    print 'ABC'
Problem p02958 (python)

Fixed submission:
n=input()
p=list(map(int,input().split()))
cnt=0
for i in range(len(p)):
  if(p[i]!=i+1):
    cnt+=1

if(cnt<=2):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n=input()
p=list(map(int,input().split()))
cnt=0
for i in p:
  if(p[i]!=i):
    cnt+=1

if(cnt<=2):
  print("YES")
else:
  print("NO")

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

if(cnt<=2):
  print("YES")
else:
  print("NO")
Problem p02687 (python)

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

Buggy submission (verdict: Runtime Error):
if S == "ABC" : 
  print("ARC")
if S == "ARC" :
  print("ABC")

Buggy submission (verdict: Runtime Error):
S = <math xmlns="http://www.w3.org/1998/Math/MathML">
  <mi>S</mi>
</math>
if S == "ABC" :
  print("ARC")
if S == "ARC" :
  print("ABC")

Buggy submission (verdict: Runtime Error):
if S == "ABC" :
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
if S == ABC:
  print("ARC")
else:
  print("ABC")
Problem p02853 (python)

Fixed submission:
a = {1:300000,2:200000,3:100000}

x,y = map(int,input().split())

if x == 1 and y == 1:
	print(a[x] + a[y] + 400000)
else:
	if x > 3 and y <= 3:
		print(a[y])
	elif x <= 3 and y > 3:
		print(a[x])
	elif x>3 and y >3:
		print(0)
	else:
		print(a[x] + a[y])

Buggy submission (verdict: Runtime Error):
a = {1:300000,2:200000,3:100000}

x,y = map(int,input().split())

if x == 1 and y == 1:
	print(a[x] + a[y] + 400000)
else:
	if x > 3 and y <=  3:
		print(a[y])
	elif x <= 3 and y >  3:
		print(a[x])
	else:
		print(a[x] + a[y])
Problem p02687 (python)

Fixed submission:
list=["ABC","ARC"]
a=input()
if a==list[0]:
      print(list[1])
else:
      print(list[0])

Buggy submission (verdict: Runtime Error):
list=["ABC","ARC]
a=input()
if a==list[0]:
      print(list[1])
else:
      print(list[0])
Problem p02817 (python)

Fixed submission:
s, t = map(str, input().split())
print(t+s)

Buggy submission (verdict: Runtime Error):
s, t = map(str, input()split())
print(t+s)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
print(t+s)
Problem p02687 (python)

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

Buggy submission (verdict: Runtime Error):
x=int(input())
a=0
b=0
for i in range(-500,500):
  for j in range(-500,500):
    if i**5-j**5==x:
      a=i
      b=j
      break
  else:
    continue
  break
print(a,b)
Problem p02690 (python)

Fixed submission:
x=int(input())
a=0
b=0
for i in range(-500,500):
  for j in range(-500,500):
    if i**5-j**5==x:
      a=i
      b=j
      break
  else:
    continue
  break
print(a,b)

Buggy submission (verdict: Runtime Error):
x=int(input())
a=0
b=0
for i in range(-x,x):
  for j in range(-x,x):
    if i**5-j**5==x:
      a=i
      b=j
      berak
print(a),print(b)
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
def swap(a,b):
    temp=a
    a=b
    b=temp


lis=[]
for i in range(3):
    a=int(input())
    lis.append(a)
for j in lis:
    print(j,end=" ")
    
swap(a[1],a[2])
swap(a[1],a[3])
for j in lis:
    print(j)
Problem p02687 (python)

Fixed submission:
print('ABC' if input()[1] == 'R' else 'ARC')

Buggy submission (verdict: Runtime Error):
print('ABC' if s[1] == 'R' else 'ARC')

Buggy submission (verdict: Runtime Error):
print('ABC' if s[1] == 'R' else 'ARC')

Buggy submission (verdict: Runtime Error):
print("ABC" if s[1] == "R" else "ARC")
Problem p02813 (python)

Fixed submission:
from itertools import permutations 

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N+1), N))
print(abs(perm.index(P) - perm.index(Q)))

Buggy submission (verdict: Runtime Error):
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

perm = list(permutations(range(1, N+1), N))
print(abs(perm.index(P) - perm.index(Q)))
Problem p02687 (python)

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

Buggy submission (verdict: Runtime Error):
S = input().split()
if(S=ABC):
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
ABC, ARC = input().split()

if (s=ABC):
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
ABC, ARC = map(input().split())

if (s=ABC):
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
ABC, ARCw = map(input().split())

if (s=ABC):
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
ABC, ARCw = map(int, input().split())

if (s=ABC):
    print('ARC')
else:
    print('ABC')
Problem p02687 (python)

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

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

H = input().split()
    
t_1 = [int(h) for h in H]

t_2 = []
    
for m in range(M):
      
    g = 0
    
    A, B = map(int, input().split())
    
    if t_1[A-1] > t_1[B-1]:
        
        g = t_1[A-1]
        f = t_1[B-1]
        
    
    else:
        
        g = t_1[B-1]
        f = t_1[A-1]
        
    if f in t_2:    
        t_2.remove(f)
            
    t_2.append(g)
    
print(len(set(t_2)))
Problem p02694 (python)

Fixed submission:
import math

X = int(input())

cur = 100
i = 0

while cur < X:
  cur = math.floor(cur * 1.01)
  i += 1
  
print(i)

Buggy submission (verdict: Runtime Error):
import math

X = int(input())

cur = 100
i = 0

while cur < X:
  cur = math.fllor(cur * 1.01)
  i += 1
  
print(i)
Problem p02687 (python)

Fixed submission:
# coding: utf-8

S = input()
arc = "ARC"
abc = "ABC"
if S == arc:
    print(abc)
elif S == abc:
    print(arc)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

X = int(input())
flg = 0
for A in range(-100, 100):
    for B in range(-80, 80):
        if A ** 5 - B ** 5 == X:
            print(f"{A} {B}")
            flg = 1
            break
    if flg:
        break
Problem p03416 (python)

Fixed submission:
l = input().split()
A = int(l[0])
B = int(l[1])

cnt = 0
for i in range(A, B + 1):
	S = str(i)
	ok = True
	for j in range(0, 3):
		if S[j] != S[4 - j]:
			ok = False
			break

	if ok:
		cnt = cnt + 1

print(cnt)

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

cnt = 0
for i in range(A, B + 1):
	S = str(i)
	ok = True
	for j in range(0, 3):
		if S[j] != S[4 - j]:
			ok = False
			break

	if ok:
		cnt = cnt + 1

print(cnt)
Problem p03079 (python)

Fixed submission:
a,b,c = map(int,input().split())
if(a== b == c):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = input().sprit()
if(a== b == c):
  print('Yes')
else:
  print('No')
Problem p02687 (python)

Fixed submission:
N = input()

if N == 'ARC':
    print('ABC')
else:
    print('ARC')

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

AA = 0
BB = 0

for A in range(200):
    for B in range(200):
        if X == (A ** 5) - (B ** 5):
            AA = A
            BB = B

if AA == 0 and BB == 0:
    for A in range(200):
        if X == (A ** 5) + 1:
            AA = A
            BB = -1

print(AA,BB)
Problem p03206 (python)

Fixed submission:
n = int(input())

if n == 25:
    print("Christmas")

if n == 24:
    print("Christmas Eve")

if n == 23:
    print("Christmas Eve Eve")

if n == 22:
    print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
a, b = (int(i) for i in input().split()) 

list=[]
 
for i in range(a):
    list.append(int(input()))

new_list = sorted(list)

sabun = None

for i in range(len(new_list)-1):

    if i+b == len(new_list):
        break

    bbb = new_list[i+b-1] - new_list[i]

    if sabun == None:
        sabun = bbb
        continue

    if sabun > bbb:
        sabun = bbb
    
print(sabun)
Problem p03238 (python)

Fixed submission:
n = int(input())

if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())

    print(a + b)

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

XYHA = []

for i in range(N):
    x,y,h = map(int,input().split())
    if h == 0:
        N -= 1
        continue
    XYHA.append([x,y,h])

for i in range(101):
    for j in range(101):
        HC = XYHA[0][2] + abs(XYHA[0][0] - i) + abs(XYHA[0][1] - j)

        for k in range(1, N):
            H = XYHA[k][2] + (XYHA[k][0] - i) + abs(XYHA[k][1] - j)

            if HC != H:
                break

            if k == N - 1:
                print(i,j,HC)
                exit()
print(0,0,0)
Problem p03240 (python)

Fixed submission:
N = int(input())
 
info = []
 
for i in range(N):
    x,y,h = map(int,input().split())
    if h == 0:
        N -= 1
        continue
    info.append([x,y,h])
 
for i in range(101):
    for j in range(101):
        H_0 = info[0][2] + abs(info[0][0] - i) + abs(info[0][1] - j)
        
        for k in range(1, N):
            H = info[k][2] + abs(info[k][0] - i) + abs(info[k][1] - j)
            
            if H_0 != H:
                break
            elif k == N - 1:
                print(i,j,H_0)
                exit()
 
print(info[0][0],info[0][1],info[0][2])

Buggy submission (verdict: Runtime Error):
N = int(input())
 
XYHA = []
 
for i in range(N):
    x,y,h = map(int,input().split())
    if h == 0:
        continue
    XYHA.append([x,y,h])
    
for i in range(101):
    for j in range(101):
        HC = XYHA[0][2] + abs(XYHA[0][0] - i) + abs(XYHA[0][1] - j)
        for k in range(1, len(XYHA)):

            H = XYHA[k][2] + abs(XYHA[k][0] - i) + abs(XYHA[k][1] - j)

            if HC != H:
                break
            elif k == len(XYHA) - 1:
                print(i,j,HC)
                exit()
print(info[0][0],info[0][1],info[0][2])

Buggy submission (verdict: Runtime Error):
N = int(input())
 
XYHA = []
 
for i in range(N):

    BBBB = input().split(" ")

    if BBBB[2] == '0':
        continue

    XYHA.append(BBBB)

HC = 0

for i in range(101):
    for j in range(101):
        OKFLG = True
        HC = 0
        for k in range(len(XYHA)):

            H = int(XYHA[k][2]) + abs(int(XYHA[k][0]) - i) + abs(int(XYHA[k][1]) - j), 0)

            if HC == 0:
                HC = H
                continue

            if HC != H:
                OKFLG = False
                break
        if OKFLG:
            print(i,j,HC)
            exit()

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

XYHA = []

for i in range(N):
    XYHA.append(input().split(" "))

HC = 0
CX = 0
CY = 0
OKFLG = True

for i in range(101):
    for j in range(101):
        HC = 0
        OKFLG = True
        for k in range(N+1):
            XYH = XYHA[k]
            H = int(XYH[2]) + abs(int(XYH[0]) - i) + abs(int(XYH[1]) - j)
            if HC == 0:
                HC = H
                CX = i
                CY = j
                continue
            
            if HC == H:
                continue
            else:
                OKFLG = False
                break

        if OKFLG:
            break
    if OKFLG:
        break


print(CX,CY,HC)
Problem p03555 (python)

Fixed submission:
from sys import stdin

a = list(input())
b = list(input())

def rot(a,b):
  if a[0] == b[2]:
    if a[1]==b[1]:
      if a[2]==b[0]:
        return 'YES'
  return 'NO'

print(rot(a,b))

Buggy submission (verdict: Runtime Error):
from sys import stdin

a = list(map(char, input().split()))
b = list(map(char, input().split()))

def rot(a,b):
  if a[0] == b[2]:
    if a[1]==b[1]:
      if a[2]==b[0]:
        return 'YES'
  return 'NO'

print(rot(a,b))

Buggy submission (verdict: Runtime Error):
from sys import stdin

a = list(map(char, input().split()))
b = list(map(char, input().split()))

def rot(a,b):
  if a[0] == b[2]:
    if a[1]==b[1]:
      if a[2]==b[0]:
        return 'YES'
  return 'NO'

rot(a,b)

Buggy submission (verdict: Runtime Error):
a = {int(s) for s in input().split()}
b = {int(s) for s in input().split()}

c = 0
for i in range(3):
  if a[i] == b[2-i]:
    c += 1
  else:
    print('NO')
    break
    
if c == 2:
	print('YES')
Problem p03243 (python)

Fixed submission:
n = int(input())
if n % 111 == 0:
    x = n
while n % 111 != 0:
    x = n+1
    n += 1

print(x)

Buggy submission (verdict: Runtime Error):
n = int(input())
while n % 111 != 0:
    x = n+1
    n += 1
print(x)
Problem p04011 (python)

Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())
z = 0
for i in range(n):
    if i >= k:
        z += y
    else:
        z += x

print(z)

Buggy submission (verdict: Runtime Error):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
z = 0
for i in range(n):
  if i >= k:
    z += y
  else:
    z += x
    
 print(z)
Problem p02687 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
As = [int(n) for n in input().split()]
# len(As) = N
# Ai = 身長
c = 0
for i, ai in enumerate(As):
    # i + ai = 最低これだけ先が無いとダメ
    j0 = i + ai
    if j0 >= N-1:
        continue
    j = 1
    l = N - j0 - 1
    while l > 0:
        if j == As[j0+j]:
            c += 1
        j+=1
        l-=1
print(c)
Problem p02687 (python)

Fixed submission:
s = input()

if s == "ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
import numpy 
x = int(input())
max = 10**9+1
flag = False
for i in range(1,max):
    if x%i == 0:
        for j in range(-i,i+1): 
            if (numpy.power(i-j,5) - numpy.power(j,5)) == x:
                print(str(i-j)+" "+str(j))
                flag = True
                break
    if flag:
        break

Buggy submission (verdict: Runtime Error):
x = int(input())
max = 10**9+1
flag = False
for i in range(1,max):
    if x%i == 0:
        for j in range(-i-1,i+1):
            tmp = (i-j)**5 - j**5
            if tmp == x:
                print(str(i-j)+" "+str(j))
                flag = True
                break
    if flag:
        break
Problem p02983 (python)

Fixed submission:
import itertools
l,r = map(int,input().split(" "))

if r-l > 2019:
    print(0)
else:
    ret = 2020
    for i in itertools.combinations(range(l,r+1,1),2):
        ret = min(ret,(i[0]*i[1])%2019)
    print(ret)

Buggy submission (verdict: Runtime Error):
import itertools
l,r = map(int,input().split(" "))

if r-l > 2019:
    print(0)
else:
    ret = 2020
print(ret)

Buggy submission (verdict: Runtime Error):
import itertools
l,r = map(int,input().split(" "))

if r-l > 2019:
    print(0)
else:

    ret = 2020
    for i in itertools.combinations(range(l,r+1,1),2):
        ret = min(ret,(i[0]*i[1])%2019)
        print(i,ret)
print(ret)

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split(" "))

if r-l > 2019:
    print(0)
else:
    import itertools
    ret = 2020
    for i in itertools.combinations(list(range(l,r+1,1)),2):
        ret = min(ret,(i[0]*i[1])%2019)
       #print(i,ret)

print(ret)

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split(" "))

if r-l > 2019:
    print(0)
else:
    ret = 2020
    for i in range(l,r+1,1):
        for j in range(l,r+1,1):
            if i == j:
                continue
            ret = min(ret,(i*j)%2019)
print(ret)

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split(" "))

if r-l > 2019:
    print(0)
else:
    ret = 2020
    for i in range(l,r+1,1):
        for j in range(l,r+1,1):
            ret = min(ret,(i*j)%2019)

print(ret)

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split(" "))

if r-l > 2019:
    print(0)
else:
    ret = 2020
    for i in range(l,r+1,1):
        for j in range(l,r+1,1):
            ret = min(ret,i*j%2019)

print(ret)
Problem p02995 (python)

Fixed submission:
from fractions import gcd
 
def main():
    a,b,c,d = map(int,input().split(" "))
    n = b - a + 1
    cdiv = b//c - (a-1)//c
    ddiv = b//d - (a-1)//d
    cddiv = b//(c * d // gcd(c, d))  - (a-1)//(c * d // gcd(c, d))
    print(n - cdiv -ddiv + cddiv)
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math 
a,b,c,d = map(int,input().split(" "))
count = 0

u = b - a + 1

cd = c * d // math.gcd(c, d)

c_num = b//c - (a-1)//c
d_num = b//d - (a-1)//d
cd_num = b//cd - (a-1)//cd

print(u - (c_num + d_num - cd_num))
Problem p03074 (python)

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

if s[0] == "0":
    s_num = [0]
else:
    s_num = []
pre = s[0]
num = 0

for i in s:
    if pre == i:
        num += 1
    else:
        s_num.append(num)
        num = 1
        pre = "1" if pre == "0" else "0"
else:
    s_num.append(num)

sums = [0]

for i,e in enumerate(s_num):
    sums.append(sums[i] + e)

ret = 0
sums_len = len(sums)-1
for i in range(0,len(sums),2):
    ret = max(ret,(sums[min(i+k*2+1,sums_len)] - sums[i]))
 
print(ret)

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

if s[0] == "0":
    s_num = [0]
else:
    s_num = []
pre = s[0]
num = 0

for i in s:
    if pre == i:
        num += 1
    else:
        s_num.append(num)
        num = 1
        pre = "1" if pre == "0" else "0"
else:
    s_num.append(num)

sums = [s_num[0]]

for i,e in enumerate(s_num[1:]):
    sums.append(sums[i] + e)

ret = 0
sums_len = len(sums)-1
for i in range(len(s_num)//2+1,2):
    ret = max(ret,(sums[min(i+k*2+1,sums_len)] - sums[i]))
 
print(ret)

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

s_num = []
s_first = s[0]
pre = s[0]
num = 0

for i in s:
    if pre == i:
        num += 1
    else:
        s_num.append(num)
        num = 1
        pre = "1" if pre == "0" else "0"
else:
    s_num.append(num)
ret = 0
if s_first == "0":
    ret = max(ret,sum(s_num[0:(2*k)]))
    for i in range(1,len(s_num)//2):
        ret = max(ret,sum(s_num[((i-1)*2+1):(2*(i+k))]))
else:
    ret = max(sum(s_num[0:(2*k+1)]))
    for i in range(1,len(s_num)//2):
        ret = max(ret,(sum(s_num[(i*2):(2*(k+i)+1)])))
 
print(ret)

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

s_num = []
s_first = s[0]
pre = s[0]
num = 0

for i in s:
    if pre == i:
        num += 1
    else:
        s_num.append(num)
        num = 1
        pre = "1" if pre == "0" else "0"
else:
    s_num.append(num)
ret = 0
if s_first == "0":
    ret.append(sum(s_num[0:(2*k)]))
    for i in range(1,len(s_num)//2):
        ret = max(ret,sum(s_num[((i-1)*2+1):(2*(i+k))]))
else:
    ret.append(sum(s_num[0:(2*k+1)]))
    for i in range(1,len(s_num)//2):
        ret = max(ret,(sum(s_num[(i*2):(2*(k+i)+1)])))
 
print(ret)
Problem p02687 (python)

Fixed submission:
val = input()
if val=="ABC":
  print("ARC")
elif val=="ARC":
  print("ABC")

Buggy submission (verdict: Runtime Error):
str = input();
if　str=="ABC":
  print("ARC")
elif str=="ARC":
  print("ABC")
Problem p02687 (python)

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

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

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

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

Buggy submission (verdict: Runtime Error):
S = input()
  if S == "ARC":
     print("ABC")
  elif S == "ABC":
       print("ARC")

Buggy submission (verdict: Runtime Error):
S = input()
  if S == int("ARC") :
     print("ABC")
  elif S == int('ABC'):
       print('ARC')

Buggy submission (verdict: Runtime Error):
S = input()
  if S == 'ARC':
     print('ABC')
  elif S == 'ABC':
       print('ARC')

Buggy submission (verdict: Runtime Error):
S = input()
if S = int('ARC')
   print('ABC')
if S = int('ABC')
   print('ARC')

Buggy submission (verdict: Runtime Error):
if S = ABC
   print('ARC')
elif S = ARC
     print('ABC')
Problem p03160 (python)

Fixed submission:
n = int(input())
arr = [int(s) for s in input().split()]
dp = [-1]*n
dp[0] = 0
dp[1] = abs(arr[0]-arr[1])
for i in range(2,n):
    dp[i] = min(abs(arr[i-1]-arr[i])+dp[i-1],abs(arr[i-2]-arr[i])+dp[i-2])
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
def calc(arr,dp,n,ind):
    if ind==n-1:
        return 0
    if ind>=n:
        return 99999999
    if dp[ind]!=-1:
        return dp[ind]
    left = abs(arr[ind]-arr[ind+1]) + calc(arr,dp,n,ind+1)
    right = 99999999
    if ind+2<n:
        right = abs(arr[ind]-arr[ind+2]) + calc(arr,dp,n,ind+2)
    dp[ind] = min(left,right)
    return dp[ind]
n = int(input())
arr = [int(s) for s in input().split()]
dp = [-1]*n
print(calc(arr,dp,n,0))