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

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dp1 = [n] * (n+1)
for i in range(n+1):
    if i>=a[0]:
        dp1[i] = max(dp1[i],dp1[i-a[0]]-a[0]+b[0])
    if i>=a[1]:
        dp1[i] = max(dp1[i],dp1[i-a[1]]-a[1]+b[1])
    if i>=a[2]:
        dp1[i] = max(dp1[i],dp1[i-a[2]]-a[2]+b[2])
n=dp1[n]
dp2 = [n] * (n+1)
for i in range(n+1):
    if i>=b[0]:
        dp2[i] = max(dp2[i],dp2[i-b[0]]-b[0]+a[0])
    if i>=b[1]:
        dp2[i] = max(dp2[i],dp2[i-b[1]]-b[1]+a[1])
    if i>=b[2]:
        dp2[i] = max(dp2[i],dp2[i-b[2]]-b[2]+a[2])


print(dp2[n])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dp1 = [0] * (n+1)
for i in range(n+1):
    if i>=a[0]:
        dp1[i] = max(dp1[i],dp1[i-a[0]]+b[0])
    if i>=a[1]:
        dp1[i] = max(dp1[i],dp1[i-a[1]]+b[1])
    if i>=a[2]:
        dp1[i] = max(dp1[i],dp1[i-a[1]]+b[2])
n=dp1[n]
dp2 = [0] * (n+1)
for i in range(n+1):
    if i>=b[0]:
        dp2[i] = max(dp2[i],dp2[i-b[0]]+a[0])
    if i>=b[1]:
        dp2[i] = max(dp2[i],dp2[i-b[1]]+a[1])
    if i>=b[2]:
        dp2[i] = max(dp2[i],dp2[i-b[1]]+a[2])


print(dp2[n])
Problem p03014 (python)

Fixed submission:
h,w = map(int,input().split())
s = ["#"*(w+2)]+["#"+input()+"#" for _ in range(h)]+["#"*(w+2)]
res = 0
l = [[0 for _ in range(w+2)] for _ in range(h+2)]
r = [[0 for _ in range(w+2)] for _ in range(h+2)]
d = [[0 for _ in range(w+2)] for _ in range(h+2)]
u = [[0 for _ in range(w+2)] for _ in range(h+2)]
for i in range(1,h+1):
    for j in range(1,w+1):
       if s[i][j]==".":
           l[i][j]=l[i][j-1]+1 
           d[i][j]=d[i-1][j]+1 
for i in range(h,0,-1):
    for j in range(w,0,-1):
       if s[i][j]==".":
           r[i][j]=r[i][j+1]+1 
           u[i][j]=u[i+1][j]+1 


for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j] == ".":
            res = max(res,l[i][j]+r[i][j]+u[i][j]+d[i][j]-3)
            if res == h+w-1:break

print(res)

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
s = ["#"*(w+2)]+["#"+input()+"#" for _ in range(h)]+["#"*(w+2)]
res = 0
def migi(i,j):
    if s[i][j+1] == ".":
        return migi(i,j+1)+1
    else:
        return 0
def hidari(i,j):
    if s[i][j-1] == ".":
        return hidari(i,j-1)+1
    else:
        return 0
def ue(i,j):
    if s[i-1][j] == ".":
        return ue(i-1,j)+1
    else:
        return 0
def shita(i,j):
    if s[i+1][j] == ".":
        return shita(i+1,j)+1
    else:
        return 0
    
for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j] == ".":
            res = max(res,migi(i,j)+hidari(i,j)+ue(i,j)+shita(i,j)+1)
            if res == h+w-1:break

print(res)

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
s = [input() for _ in range(h)]
res = 0
def migi(i,j):
    if j >= w-1:
        return 0
    if s[i][j+1] == ".":
        return migi(i,j+1)+1
    else:
        return 0
def hidari(i,j):
    if j <= 0:
        return 0
    if s[i][j-1] == ".":
        return hidari(i,j-1)+1
    else:
        return 0
def ue(i,j):
    if i <= 0:
        return 0
    if s[i-1][j] == ".":
        return ue(i-1,j)+1
    else:
        return 0
def shita(i,j):
    if i >= h-1:
        return 0
    if s[i+1][j] == ".":
        return shita(i+1,j)+1
    else:
        return 0
    
for i in range(h):
    for j in range(w):
        if s[i][j] == ".":
            res = max(res,migi(i,j)+hidari(i,j)+ue(i,j)+shita(i,j)+1)
            if res == h+w-1:break

print(res)
Problem p03086 (python)

Fixed submission:
import re

s = input()
n = len(s)
res = 0
for i in range(0, n):
    j = i
    tempres = 0
    while j < n and (s[j] == "A" or s[j] == "G" or s[j] == "C" or s[j] == "T"):
        j += 1
        tempres += 1
    res = max(res, tempres)

print(res)

Buggy submission (verdict: Runtime Error):
import re

s = input()
pat = r"[ACGT]+"
atgc = re.findall(pat, s)
ress = []
for i in atgc:
    ress.append(len(i))

print(max(ress))
Problem p03128 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
mm=[0,2,5,5,4,5,6,3,7,6]

dp=[0]
m = [mm[i] for i in range(10) if i in a]
for i in range(1,n+1):
    tres=[-10**10]
    for sm in m:
        if i - sm >= 0:
            tres.append(dp[i-sm]+1)
    dp.append(max(tres))
k=dp[n]
res = []
a.sort(reverse=True)
while n > 0:
    for sa in a:
        if n-mm[sa] >= 0 and dp[n-mm[sa]]==dp[n]-1:
            res.append(sa)
            n -= mm[sa]
            break

print("".join(map(str,res)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
mm=[0,2,5,5,4,5,6,3,7,6]

dp=[0]
m = [mm[i] for i in range(10) if i in a]
for i in range(1,n+1):
    tres=[-10**10]
    for sm in m:
        if i - sm >= 0:
            tres.append(dp[i-sm]+1)
    dp.append(max(tres))
k=dp[n]
res = []
a.sort(reverse=True)
while n > 0:
    for sa in a:
        if dp[n-mm[sa]]==dp[n]-1:
            res.append(sa)
            n -= mm[sa]
            break

print("".join(map(str,res)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
mm=[0,2,5,5,4,5,6,3,7,6]

dp=[0]
m = [mm[i] for i in range(n) if i in a]
for i in range(1,n+1):
    tres=[-10**10]
    for sm in m:
        if i - sm >= 0:
            tres.append(dp[i-sm]+1)
    dp.append(max(tres))
k=dp[n]
res = []
a.sort(reverse=True)
while n > 0:
    for sa in a:
        if dp[n-mm[sa]]==dp[n]-1:
            res.append(sa)
            n -= mm[sa]
            break

print("".join(map(str,res)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
mm=[0,2,5,5,4,5,6,3,7,6]

dp=[0]
m = [mm[i] for i in range(n) if i in a]
for i in range(1,n+1):
    tres=[-10**10]
    for sm in m:
        if i - sm >= 0:
            tres.append(dp[i-sm]+1)
    dp.append(max(tres))
k=dp[n]
res = []
a.sort(reverse=True)
for i in range(k):
    for sa in a:
        if dp[n-mm[sa]]==dp[n]-1:
            res.append(sa)
            n -= mm[sa]
            break

print("".join(map(str,res)))
Problem p03241 (python)

Fixed submission:
def main():
    n,m = map(int,input().split())

    start = m//n

    for i in range(start,0,-1):
        if m%i==0:
            print(i)
            break

main()

Buggy submission (verdict: Runtime Error):
import math
def main():
    n,m = map(int,input().split())

    start = min(m//n,math.sqrt(m))

    for i in range(start,0,-1):
        if m%i==0:
            print(i)
            break

main()
Problem p03289 (python)

Fixed submission:
s=input()
flag = "AC"
if s[0] != "A":
    flag = "WA"
else:
    if not "C" in s[2:-1]:
        flag = "WA"
    else:
        ls = [c for c in s]
        ls.remove("A")
        ls.remove("C")
        for c in ls:
            if c.isupper():
                flag = "WA"
print(flag)

Buggy submission (verdict: Runtime Error):
s=input()
flag = "AC"
if s[0] != "A":
    flag = "WA"
if not "C" in s[2:-1]:
    flag = "WA"
ls = [c for c in s]
ls.remove("A")
ls.remove("C")
for c in ls:
    if c.isupper():
        flag = "WA"
print(flag)
Problem p03309 (python)

Fixed submission:
import math
n=int(input())
a=list(map(int,input().split()))

for i in range(n):
    a[i] -= i+1

# ave = sum(a)/n
# ave1= math.ceil(ave)
# ave2= math.floor(ave)


# print(min(sum([abs(a[i]-ave1) for i in range(n)]),sum([abs(a[i]-ave2) for i in range(n)])))

a.sort()
med1=a[n//2-1]
med3=a[n//2]

print(min(sum([abs(a[i]-med1) for i in range(n)]),sum([abs(a[i]-med3) for i in range(n)])))

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

for i in range(n):
    a[i] -= i+1

# ave = sum(a)/n
# ave1= math.ceil(ave)
# ave2= math.floor(ave)


# print(min(sum([abs(a[i]-ave1) for i in range(n)]),sum([abs(a[i]-ave2) for i in range(n)])))

a.sort()
med1=a[n//2-1]
med2=a[n//2-2]
med3=a[n//2]

print(min(sum([abs(a[i]-med1) for i in range(n)]),sum([abs(a[i]-med2) for i in range(n)]),sum([abs(a[i]-med3) for i in range(n)])))
Problem p03388 (python)

Fixed submission:
import math
import decimal

def hantei(f,p):
    if f*f<p :
        return True
    return False


def nibun2(l,r,p):
    if r == l:
        return l
    f = (l+r+1)//2
    if hantei(f,p):
        return nibun2(f,r,p)
    else:
        return nibun2(l,f-1,p)

r=[]
q=int(input())
for _ in range(q):
    a,b=map(int,input().split())
    p=a*b
    if p ==1:res = 0
    else:
        t = nibun2(0,10**20,p)
        res = t*2-1
        if (p-1)//t ==t:res -= 1
        if a==b:res+=1
    r.append(res)

print("\n".join(map(str,r)))

Buggy submission (verdict: Runtime Error):
import math
r=[]
q=int(input())
for _ in range(q):
    a,b=map(int,input().split())
    p=a*b
    t = math.floor(math.sqrt(p-1))
    res = t*2-1
    if (p-1)//t ==t:res -= 1
    if a==b:res+=1
    r.append(res)

print("\n".join(map(str,r)))
Problem p03550 (python)

Fixed submission:
n,Z,W=map(int,input().split())
a=list(map(int,input().split()))
res = abs(a[-1]-W)
if len(a) > 1:
    res = max(res,abs(a[-1]-a[-2]))
print(res)

Buggy submission (verdict: Runtime Error):
n,Z,W=map(int,input().split())
a=list(map(int,input().split()))
res = max(abs(a[-1]-W),abs(a[-1]-a[-2]))
print(res)
Problem p03597 (python)

Fixed submission:
n=int(input())
a=int(input())
print(n*n-a)

Buggy submission (verdict: Runtime Error):
n,a=map(int,input().split())
print(n*n-a)
Problem p03626 (python)

Fixed submission:
n = int(input())
s1=input()
s2=input()
mod = 10**9+7
l = []
for i in range(0,n-1):
    if s1[i] != s1[i+1]:
        if s1[i] != s2[i]:
            l.append(0)
        else:
            l.append(1)
if s1[n-1]==s2[n-1]:
    l.append(1)
else:
    l.append(0)
if l[0]:
    res = 3
else:
    res = 6

for i in range(1,len(l)):
    if l[i-1] and l[i]:
        res *= 2
    elif l[i-1] and  not l[i]:
        res *= 2
    elif not l[i-1] and not l[i]:
        res *= 3

print(res % mod)

Buggy submission (verdict: Runtime Error):
n = int(input())
s1=input()
s2=input()
mod = 10**9+7
l = []
for i in range(0,n-1):
    if s1[i] != s1[i+1]:
        if s1[i] != s2[i]:
            l.append(0)
        else:
            l.append(1)
if s1[n-1]==s2[n-1]: l.append(1)
if l[0]:
    res = 3
else:
    res = 6

for i in range(1,len(l)):
    if l[i-1] and l[i]:
        res *= 2
    elif l[i-1] and  not l[i]:
        res *= 2
    elif not l[i-1] and not l[i]:
        res *= 3

print(res % mod)
Problem p03640 (python)

Fixed submission:
h,w  = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
res = []
for _ in range(h):
    res.append([])
line = 0

def insert(res,i,l):
    if l %2 == 0:
        res[l].append(str(i+1))
    else:
        res[l].insert(0,str(i+1))

for i in range(0,n):
    ammount=a[i]
    while len(res[line]) < w and ammount > 0:
        insert(res,i,line)
        ammount -= 1
    if len(res[line]) == w:
        line += 1
    while ammount >= w:
        res[line] = [str(i+1) for _ in range(w)]
        ammount -= w
        line += 1
    if ammount > 0:
        res[line] = [str(i+1) for _ in range(ammount)]

for i in range(0,h):
    print(' '.join(res[i]))

Buggy submission (verdict: Runtime Error):
h,w  = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
res = []
for _ in range(h):
    res.append("")
line = 0

def insert(res,i,l):
    if l %2 == 0:
        res[l] = res[l] + str(i+1)
    else:
        res[l] = str(i+1) + res[l]

for i in range(0,n):
    ammount=a[i]
    while len(res[line]) < w and ammount > 0:
        insert(res,i,line)
        ammount -= 1
    if len(res[line]) == w:
        line += 1
    while ammount >= w:
        res[line] = str(i+1) * w
        ammount -= w
        line += 1
    if ammount > 0:
        res[line] = str(i+1) * ammount

res_se = []
for st in res:
    res_se.append(list(st))

for i in range(0,h):
    print(' '.join(res_se[i]))

Buggy submission (verdict: Runtime Error):
h,w  = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
res = []
for _ in range(h):
    res.append("")
line = 0

def insert(res,i,l):
    if l %2 == 0:
        res[l] = res[l] + str(i+1)
    else:
        res[l] = str(i+1) + res[l]

for i in range(0,n):
    ammount=a[i]
    while len(res[line]) < w and ammount > 0:
        insert(res,i,line)
        ammount -= 1
    if len(res[line]) == w:
        line += 1
    while ammount >= w:
        res[line] = str(i+1) * w
        ammount -= w
        line += 1
    if ammount > 0:
        res[line] = str(i+1) * ammount

length = len(res)
for i in range(length):
    print(res[i])

Buggy submission (verdict: Runtime Error):
h,w  = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
res = []
for _ in range(h):
    res.append("")
line = 0

def insert(res,i,l):
    if l %2 == 0:
        res[l] = res[l] + str(i+1)
    else:
        res[l] = str(i+1) + res[l]

for i in range(0,n):
    ammount=a[i]
    while len(res[line]) < w and ammount > 0:
        insert(res,i,line)
        ammount -= 1
    if len(res[line]) == w:
        line += 1
    while ammount >= w:
        res[line] = str(i+1) * w
        ammount -= w
        line += 1
    if ammount > 0:
        res[line] = str(i+1) * ammount

print('\n'.join(map(str, res)))
Problem p03696 (python)

Fixed submission:
n = int(input())
s = input()
l = s.count("(")
r = s.count(")")
lmax = 0
if n == 1:
    print("()")
elif l == 0:
    print("("* r + s)
elif r == 0:
    print(s + ")"*l)
else:
    l = 0
    r = 0
    for c in s:
        if c == "(":
            l += 1
        else:
            r += 1
        lmax = max(r-l, lmax,0)
    
    res = "(" * lmax + s 

    l = res.count("(")
    r = res.count(")")

    if l > r:
        res = res + ")" * (l-r)

    elif r > l:
        res = "(" * (r-l) + res

    print(res)

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

lcount = 0
rcount = 0

while s[lcount] == ")":
    lcount += 1

while s[n-1-rcount] == "(":
    rcount += 1

res = "(" * lcount + s + ")" * rcount

l = s.count("(")
r = s.count(")")

if l > r:
    res = res + ")" * (l-r)

elif r > l:
    res = "(" * (r-l) + res

print(res)
Problem p04026 (python)

Fixed submission:
s=input()
n=len(s)
res = -1
leng = 0
for i in range(n-2):
    if s[i] == s[i+1]:
        res = i+1
        leng = 2
        break
    elif s[i] == s[i+2]:
        res = i+1
        leng = 3
        break
if s[-2] == s[-1]:
    res = n-1
    leng = 2

if res == -1:
    print("-1 -1")
elif leng == 2:
    print(str(res)+" "+str(res+1))
else:
    print(str(res)+" "+str(res+2))

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
res = -1
leng = 0
for i in range(n-2):
    if s[i] == s[i+1]:
        res = i+1
        leng = 2
        break
    elif s[i] == s[i+2]:
        res = i+1
        leng = 3
        break
if s[-2] == s[-1]:
    res = i+1
    leng = 2

if res == -1:
    print("-1 -1")
elif leng == 2:
    print(str(res)+" "+str(res+1))
else:
    print(str(res)+" "+str(res+2))
Problem p02677 (python)

Fixed submission:
import sys
import math
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

def solve(a,b,c,d):
    angle = abs(0.5 * (60 * c + d) - 6 * d)
    distance = math.sqrt(pow(a,2) + pow(b,2) - (2*a*b*math.cos(math.radians(angle))))
    return distance

def main():
    a,b,c,d = invr()
    print(solve(a,b,c,d))

main()

Buggy submission (verdict: Runtime Error):
import sys
import math
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()

def invr():
    return(map(int,input().split()))

def solve(s,k):
    len1 = len(s)
    if len1 > k:
        corte = ''
        for i in range(k):
            corte += s[i]
        corte += '...'
        return corte
      
	return s

def main():
    k = inp()
    print(solve(input(),k))


main()
Problem p03076 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a,b,c,d,e]
h = 0
j =[]
for i in range(0, 5):
    f = l[i] // 10
    g = l[i] % 10
    if not(g == 0):
        f = f + 1
        j.append(g)
    f = f * 10
    h = h + f
    
if not(j == []):
    h = h + min(j) -10
print(h)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a,b,c,d,e]
h = 0
j =[]
for i in range(0, 5):
    f = l[i] // 10
    g = l[i] % 10
    if not(g == 0):
        f = f + 1
        j.append(g)
    f = f * 10
    h = h + f
    
if not(g == []):
    h = h + min(j) -10
print(h)
Problem p03086 (python)

Fixed submission:
s = input()
lis=[]
for i in range(len(s)):
    if s[i] not in "ACGT":
        lis.append(i)
len_max = 0
for i in range(len(lis)-1):
    len_max = max(len_max,lis[i+1]-lis[i]-1)

if lis != []:
    print(max(len_max,lis[0],len(s)-lis[-1]-1))
else:
    print(len(s))

Buggy submission (verdict: Runtime Error):
s = input()
lis=[]
for i in range(len(s)):
    if s[i] not in "ACGT":
        lis.append(i)
len_max = 0
for i in range(len(lis)-1):
    len_max = max(len_max,lis[i+1]-lis[i]-1)
print(max(len_max,lis[0],len(s)-lis[-1]-1))
Problem p03161 (python)

Fixed submission:
import numpy as np

N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = np.zeros(N, dtype=int)
h = np.array(h)
 
for i in range(1, N):
    start = max(0, i-K)
    dp[i] = min(dp[start:i] + np.abs(h[i] - h[start:i]))
 
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = np.zeros(N, dtype=int)
h = np.array(h)
 
for i in range(1, N):
    start = max(0, i-K)
    dp[i] = min(dp[start:i] + np.abs(h[i] - h[start:i]))
 
print(dp[-1])
Problem p03164 (python)

Fixed submission:
import numpy as np
N,W=map(int,input().split())
dp=np.ones(10**5+1, dtype='int64')
dp[0]=0
dp[1:]=dp[1:]*(10**9+1)
for i in range(N):
    wi,vi=map(int,input().split())
    dp[vi:]=np.minimum(dp[vi:],dp[:-vi]+wi)
print(np.max(np.where(dp <= W)))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,W = map(int,input().split())
w,v = [],[]
for i in range(N):
    a,b = map(int,input().split())
    w += [a]
    v += [b]
dp = np.zeros(W+1,dtype = int)
for i in range(N):
    dp[w[i]:] = np.maximum(dp[:-w[i]]+v[i],dp[w[i]:])
print(dp[-1])
Problem p03210 (python)

Fixed submission:
N = input()
N = int(N)
if N == 7 or N == 5 or N == 3:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
X= input()
X = int(X)
if X == 7 or X == 5 or X == 3:
  print "YES"
else:
  print "NO"
Problem p03262 (python)

Fixed submission:
import fractions
from functools import reduce
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(fractions.gcd,l))

Buggy submission (verdict: Runtime Error):
import fractions
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(fractions.gcd,l))

Buggy submission (verdict: Runtime Error):
import math
from fractions import gcd
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(fractions.gcd,l))

Buggy submission (verdict: Runtime Error):
import math
from fractions import gcd
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(gcd,l))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N,X = map(int,input().split())
l = list(map(lambda x: abs(int(x)-X),input().split()))
print(reduce(math.gcd,l))
Problem p03274 (python)

Fixed submission:
N,K = map(int,input().split())
X = list(map(int,input().split()))
m = 2*(abs(X[-1])+abs(X[0]))
for i in range(N-K+1):
    if X[i] > 0:
        d = X[i+K-1]
    elif X[i+K-1] < 0:
        d = -X[i]
    else:
        d = X[i+K-1]-X[i]+min(-X[i],X[i+K-1])
    m = min(m,d)
print(m)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
X = list(map(int,input().split()))
m = float("inf")
for i in range(N-K+1):
    if X[i] > 0:
        d = X[i+K-1]
    elif X[i+K-1] < 0:
        bgd = -X[i]
    else:
        d = X[i+K-1]-X[i]+min(-X[i],X[i+K-1])
    m = min(m,d)
print(m)
Problem p03433 (python)

Fixed submission:
n = int(input())
a = int(input())
if n%500 > a:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
if n%500 > A:
    print("No")
else:
    print("Yes")
Problem p03544 (python)

Fixed submission:
N = int(input())
L0 = 2
L1 = 1
for i in range(N-1):
    L = L0 + L1
    L0,L1 = L1,L
if N == 1:
    print(1)
else:
    print(L)

Buggy submission (verdict: Runtime Error):
N = int(input())
L0 = 2
L1 = 1
for i in range(N-1):
    L = L0 + L1
    L0,L1 = L1,L
print(L)
Problem p03730 (python)

Fixed submission:
import fractions
A,B,C = map(int,input().split())
if C%fractions.gcd(A,B) == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import math
A,B,C = map(int,input().split())
if C%math.gcd(A,B) == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import math
A,B,C = map(int,input().split())
if C%math.gcd(A,B) == 0:
    print("YES")
else:
    print("NO")
Problem p03852 (python)

Fixed submission:
c = input()
if c in ["a","i","u","e","o"]:
    print("vowel")
else:
    print("consonant")

Buggy submission (verdict: Runtime Error):
c = input()
if c in ["a","i","u","e","o"]:
    print("vowel")
else:
    print(consonant)
Problem p03679 (python)

Fixed submission:
input_list = input().split(" ")
syoumi = int(input_list[0])
mae = int(input_list[1])
eat = int(input_list[2])
if eat <= mae:
  print("delicious")
elif (eat - mae) <= syoumi:
  print("safe")
else:
  print("dangerous")

Buggy submission (verdict: Runtime Error):
input_list = input().split(" ")
syoumi = int(input_list[0])
mae = int(input_list[1])
eat = int(input_list[2])
if eat < mae:
  print("delicious")
else if (eat - mae) < syoumi:
  print("safe")
else:
  print("dangerous")
Problem p02717 (python)

Fixed submission:
a,b,c=input().split()
print(c+" "+a+" "+b)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
y=[10**18]
f=0
for i in range (10**18):
    x=a-b
    if x<0:
        y.append(x*(-1))
        a=x*(-1)
    else :
        y.append(x)
        a=x
    if y[i]<=y[i+1]:
        f=y[i]
        break

print(f)
Problem p02730 (python)

Fixed submission:
X=input()
L=X[::-1]
N=len(X)
if N % 2 == 1:
    if L==X:
        a=int((N-1)/2)
        b=int((N+3)/2)
        Ya=X[0:a]
        LYa=Ya[::-1]
        Yb=X[b-1:N]
        LYb=Yb[::-1]
        if LYa ==Ya and LYb == Yb:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
X=input()
L=X[::-1]
if N % 2 == 1:
    if L==X:
        N=len(X)
        a=int((N-1)/2)
        b=int((N+3)/2)
        Ya=X[0:a]
        LYa=Ya[::-1]
        Yb=X[b-1:N]
        LYb=Yb[::-1]
        if LYa ==Ya and LYb == Yb:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
P = set(list(map(int, input().split())))

targets = set(range(-101, 102)) - P
if targets:
    print(min([(target, abs(X - target)) for target in targets], key=lambda x: x[1])[0])
else:
    print(X)

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

targets = set(range(1, 101)) - P
print(min([(target, abs(X - target)) for target in targets], key=lambda x: x[1])[0])
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):
from math import sqrt

a, b, c = map(int, input().split())
A = sqrt(c) - (sqrt(a) + sqrt(b))
B = 0.0

if abs(A - B) <= max(1e-09 * max(abs(A), abs(B)), 0.0):

    print("Yes")
else:
    print("No")