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

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

N = int(input())
A = list(map(int, input().split()))

L = [0 for _ in range(N)]
R = [0 for _ in range(N)]

L[0], R[N - 1] = A[0], A[N - 1]

for i in range(N-1): # i=0,1,...N-2
    L[i + 1] = gcd(L[i], A[i + 1])
    R[N - i - 2] = gcd(R[N - i - 1], A[N - i - 2])

print(max(L[N-2], R[1], *(gcd(L[i], R[i+2]) for i in range(N-2))))

Buggy submission (verdict: Runtime Error):
def gcd(*A):
    if len(A) == 1:
        return A[0]
    elif len(A) == 2:
        a, b = A
        tmp = a % b
        while tmp != 0:
            a, b = b, tmp
            tmp = a % b
        return b
    elif len(A) > 2:
        return gcd(gcd(*A[:2]), *A[2:])

N = int(input())
A = list(map(int, input().split()))
print(max(gcd(*(A[j] for j in range(N) if i != j)) for i in range(N)))

Buggy submission (verdict: Runtime Error):
def gcd(*A):
    if len(A) == 2:
        a, b = A
        tmp = a % b
        while tmp != 0:
            a, b = b, tmp
            tmp = a % b
        return b
    else:
        return gcd(gcd(*A[:2]), *A[2:])

N = int(input())
A = list(map(int, input().split()))
print(max(gcd(*(A[j] for j in range(N) if i != j)) for i in range(N)))
Problem p03062 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
neg = [a for a in A if a < 0]
A = list(map(abs, A))

if len(neg) % 2 == 0:
    print(sum(A))
else:
    print(sum(A) - 2 * min(A))

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

A = list(map(int), input().split())
if N % 2 == 0:
    print(sum(map(abs, A)))
else:
    neg = [a for a in A if a < 0]
    c = max(neg) if len(neg) > 0 else 0
    print(sum(map(abs, A)) - 2 * c)

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

A = list(map(int), input().split())
if N % 2 == 0:
    print(sum(map(abs, A)))
else:
    print(sum(map(abs, A)) - 2 * max([a for a in A if a <= 0]))
Problem p03059 (python)

Fixed submission:
a,b,t = map(int, input().split())
ans = ((t+0.5) // a)*b
print(int(ans))

Buggy submission (verdict: Runtime Error):
a,b,t = map(int, input().split())
ans = ((T+0.5) // a)*b
print(int(ans))

Buggy submission (verdict: Runtime Error):
a,b,t = map(int, input().split())
print(((T+0.5) // a)*b)
Problem p03059 (python)

Fixed submission:
A, B, T = map(int, input().split())
result = T // A * B

print(result)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
inp_ints = list(map(int, input().split()))
# ints = list(set(inp_ints))

uniq_ints = list(set(inp_ints))
ints = uniq_ints
for m in uniq_ints:
    if inp_ints.count(m) >= 2:
        ints.append(m)

gcd = 0
result = 1
for i in range(len(ints)):
    gcd = 0
    for m in ints[:i]:
        gcd = math.gcd(gcd, m)
    for m in ints[i+1:]:
        gcd = math.gcd(gcd, m)
    if gcd > result:
        result = gcd

print(result)

Buggy submission (verdict: Runtime Error):
import fractions

N = int(input())
inp_ints = list(map(int, input().split()))
ints = list(set(inp_ints))
""" uniq_ints = list(set(inp_ints))

ints = uniq_ints
for m in uniq_ints:
    if inp_ints.count(m) >= 2:
        ints.append(m) """

gcd = 0
result = 1
for i in range(len(ints)):
    gcd = 0
    for m in ints[:i]:
        gcd = fractions.gcd(gcd, m)
    for m in ints[i+1:]:
        gcd = fractions.gcd(gcd, m)
    if gcd > result:
        result = gcd

print(result)

Buggy submission (verdict: Runtime Error):
import fractions

N = int(input())
inp_ints = list(map(int, input().split()))
ints = list(set(inp_ints))
""" uniq_ints = list(set(inp_ints))

ints = uniq_ints
for m in uniq_ints:
    if inp_ints.count(m) >= 2:
        ints.append(m) """

gcd = 0
result = 1
holed_ints = []
for i in range(len(ints)):
    holed_ints = ints[:i] + ints[i+1:]
    gcd = 0
    for j in range(len(ints)-1):
        gcd = fractions.gcd(gcd, holed_ints[j])
    if gcd > result:
        result = gcd

print(result)
Problem p03061 (python)

Fixed submission:
import fractions

integral_count = int(input())
blackboard_integers = list(map(int, input().split()))

gcd_integers = list(set(blackboard_integers))

gcd = 0
result = 1
for i in range(len(gcd_integers)):
    gcd = 0
    if blackboard_integers.count(gcd_integers[i]) >= 2:
        for n in gcd_integers:
            gcd = fractions.gcd(gcd, n)
    else:
        for n in gcd_integers[:i]:
            gcd = fractions.gcd(gcd, n)
        for n in gcd_integers[i+1:]:
            gcd = fractions.gcd(gcd, n)
    if gcd > result:
        result = gcd

print(result)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
inp_ints = list(map(int, input().split()))
# ints = list(set(inp_ints))

uniq_ints = list(set(inp_ints))
ints = uniq_ints
for m in uniq_ints:
    if inp_ints.count(m) >= 2:
        ints.append(m)

gcd = 0
result = 1
for i in range(len(ints)):
    gcd = 0
    for m in ints[:i]:
        gcd = math.gcd(gcd, m)
    for m in ints[i+1:]:
        gcd = math.gcd(gcd, m)
    if gcd > result:
        result = gcd

print(result)

Buggy submission (verdict: Runtime Error):
import fractions

N = int(input())
inp_ints = list(map(int, input().split()))
ints = list(set(inp_ints))
""" uniq_ints = list(set(inp_ints))

ints = uniq_ints
for m in uniq_ints:
    if inp_ints.count(m) >= 2:
        ints.append(m) """

gcd = 0
result = 1
holed_ints = []
for i in range(N):
    holed_ints = ints[:i] + ints[i+1:]
    gcd = 0
    for j in range(N-1):
        gcd = fractions.gcd(gcd, holed_ints[j])
    if gcd > result:
        result = gcd

print(result)

Buggy submission (verdict: Runtime Error):
import fractions

N = int(input())
inp_ints = list(map(int, input().split()))
ints = list(set(inp_ints)) * 2
""" uniq_ints = list(set(inp_ints))

ints = uniq_ints
for m in uniq_ints:
    if inp_ints.count(m) >= 2:
        ints.append(m) """

gcd = 0
result = 1
holed_ints = []
for i in range(N):
    holed_ints = ints[:i] + ints[i+1:]
    gcd = 0
    for j in range(N-1):
        gcd = fractions.gcd(gcd, holed_ints[j])
    if gcd > result:
        result = gcd

print(result)

Buggy submission (verdict: Runtime Error):
import fractions

N = int(input())
ints = list(map(int, input().split())).sort()

gcd = 0
result = 1
holed_ints = []
for i in range(len(ints)):
    holed_ints = ints[:i] + ints[i+1:]
    gcd = 0
    for j in range(len(holed_ints)):
        gcd = fractions.gcd(gcd, holed_ints[j])
        if gcd == 1:
            break
    if gcd > result:
        result = gcd

print(result)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
ints = list(map(int, input().split()))
ints.sort(reverse=True)

gcd = 0
result = 1
holed_ints = []
for i in range(N):
    holed_ints = ints[:i] + ints[i+1:]
    gcd = 0
    for j in range(N-1):
        gcd = math.gcd(gcd, holed_ints[j])
        if gcd == 1:
            break
    if gcd > result:
        result = gcd

print(result)
Problem p03076 (python)

Fixed submission:
cooking_times = [int(input()) for i in range(5)]
fractional_times = []
result = 0

for time in cooking_times:
    if time % 10 == 0:
        result += time
    else:
        result += time - time % 10
        fractional_times.append(time % 10)

if fractional_times != []:
    result += (len(fractional_times) - 1) * 10
    result += min(fractional_times)

print(result)

Buggy submission (verdict: Runtime Error):
cooking_times = [int(input()) for i in range(5)]
fractional_times = []
result = 0

for time in cooking_times:
    if time % 10 == 0:
        result += time
    else:
        result += time - time % 10
        fractional_times.append(time % 10)

result += (len(fractional_times) - 1) * 10
result += min(fractional_times)

print(result)
Problem p03085 (python)

Fixed submission:
BASE_PAIRS = [['A', 'T'], ['C', 'G']]
base_b = input()
result = ''

for i in range(len(BASE_PAIRS)):
    if base_b in BASE_PAIRS[i]:
        paired_base_index = (BASE_PAIRS[i].index(base_b)+1) % 2
        result = BASE_PAIRS[i][paired_base_index]

print(result)

Buggy submission (verdict: Runtime Error):
BASE_PAIRS = [['A', 'T'], ['C', 'G']]
base_b = input()
paired_base_index = ValueError
result = ''

for i in range(len(BASE_PAIRS)):
    paired_base_index = BASE_PAIRS[i].index(base_b)
    if paired_base_index != ValueError:
        result = BASE_PAIRS[i][(paired_base_index+1) % 2]
        break

print(result)
Problem p03085 (python)

Fixed submission:
b = input()
if b == 'A':
  print('T')
elif b == 'T':
  print('A')
elif b == 'C':
  print('G')
elif b == 'G':
  print('C')
else:
  pass

Buggy submission (verdict: Runtime Error):
if b == 'A':
  print('T')
elif b == 'T':
  print('A')
elif b == 'C':
  print('G')
elif b == 'G':
  print('C')
Problem p03071 (python)

Fixed submission:
a, b = map(int, input().strip().split(' '))
ans = 0
for i in range(2):
    if a >= b:
        ans += a
        a -= 1
    else:
        ans += b
        b -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, raw_input().split)
ans = 0
for i in range(2):
  if a >= b:
    ans += a
    a -= 1
  else:
    ans += b
    b -= 1
print(ans)
Problem p03086 (python)

Fixed submission:
s = input().strip()

ok_list = ['A', 'T', 'C', 'G']

max_len, i = 0, 0

while i < len(s):
    if s[i] in ok_list:
        l = 0
        while i < len(s) and s[i] in ok_list:
            i += 1
            l += 1

        if l > max_len:
            max_len = l

    else:
         i += 1

print(max_len)

Buggy submission (verdict: Runtime Error):
s = input().strip()

flag = 0
ok_list = ['A', 'T', 'C', 'G']

max_len = 0
start, end, i = 0, 0, 0

while i < len(s):
    if s[i] in ok_list:
        l = 0
        while s[i] in ok_list:
            i += 1
            l += 1

        if l > max_len:
            max_len = l

    else:
         i += 1

print(max_len)

Buggy submission (verdict: Runtime Error):
s = input().strip()

flag = 0
ok_list = ['A', 'T', 'C', 'G']

max_len = 0
start, end, i = 0, 0, 0

while i < len(s):
    while s[i] not in ok_list:
        i += 1
    start = i

    while s[i] in ok_list:
        i += 1
    end = i

    tmp = s[start:end]
    if len(tmp) > max_len:
        max_len = len(tmp)


print(max_len)
Problem p03059 (python)

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

Buggy submission (verdict: Runtime Error):
from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])
print(max(gcd(b[i-1], c[i+1]) for i in range(1, n+1)))
#sample answer.
Problem p03060 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
cnt=0
for i in range(n):
  if v[i]-c[i]>0:
    cnt+=v[i]-c[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
cnt=0
for _ in range(n):
  if v[i]-c[i]>0:
    cnt+=v[i]-c[i]
print(cnt)
Problem p03061 (python)

Fixed submission:
from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])
print(max(gcd(b[i-1], c[i+1]) for i in range(1, n+1)))
#sample answer.

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
a=[0]+list(map(int,input().split()))+[0]
b=a[::-1]
l=[0]*n
r=[0]*n
ans=[]
for i in range(1,n):
  l[i]=math.gcd(l[i-1],a[i-1])
for j in range(1,n):
  r[i]=math.gcd(r[i-1],b[i-1])
c=b[::-1]
for k in range(n):
  ans.append(math.gcd(l[k],r[k]))
print(max(ans))
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
if a==b:
  print(a+b)
elif a<b:
  print(b+b-1)
else:
  print(a+a-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
i=0
cnt=0
for j in h:
  if i<=j:
    cnt+=1
    i=j
print(cnt)
Problem p03078 (python)

Fixed submission:
x,y,z,k = map(int,input().split())
lisa = list(map(int,input().split()))
lisb = list(map(int,input().split()))
lisc = list(map(int,input().split()))
lisa.sort(reverse=True)
lisb.sort(reverse=True)
lisc.sort(reverse=True)
an = []
ans = []
for num in lisb:
    for nu in lisa:
        an.append(num+nu)
an.sort(reverse=True)
an = an[:min(3001,x*y*z+1)]
for num in lisc:
    for nu in an:
        ans.append(num+nu)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])
#sample code.

Buggy submission (verdict: Runtime Error):
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
tem=[]
ans=[]

for i in a:
  for j in b:
    tem.append(i+j)
    
tem=tem[:min(3001,x*y*z+1)]

for k in c:
  for l in tem:
    ans.append(k+l)
    
ans.sort()

for m in range(k):
  print(ans[m])
Problem p03080 (python)

Fixed submission:
n=int(input())
s=list(input())
cnt=0
for i in s:
  if 'R'==i:
    cnt+=1
if cnt>n-cnt:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(input())
for i in s:
  if 'R'==i:
    cnt+=1
if cnt<n-cnt:
  print('B')
else:
  print('R')
Problem p03101 (python)

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

Buggy submission (verdict: Runtime Error):
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int,input().split())) for _ in range(N)]
cnt=0
for a in A:
  ans=C
  for i in range(M):
    ans+=a[i]*B[i]
  if ans>0:
    cnt+=1
print(cnt)
Problem p03109 (python)

Fixed submission:
y,m,d=map(int,input().split("/"))
if m<5:
  print("Heisei")
else:
  print("TBD")

Buggy submission (verdict: Runtime Error):
y,m,d=map(int,input().solit("/"))
if m<5:
  print("Heisei")
else:
  print("TBD")
Problem p03110 (python)

Fixed submission:
N = int(input())
XU = [[_ for _ in input().split()] for _ in range(N)]
ans = 0
for x, u in XU:
    if u == 'BTC':
        ans += float(x) * 380000
    else:
        ans += int(x)
print(ans)
#copy code.

Buggy submission (verdict: Runtime Error):
n=int(input())
sub=dict()
for _ in range(n):
  x,u=input().split()
  if u in sub:
    sub[u]+=x
  else:
    sub[u]=x
print(float(sub["JPY"])+float(sub["BTC"])*380000.0)

Buggy submission (verdict: Runtime Error):
n=int(input())
sub=dict()
for _ in range(n):
  x,u=input().split()
  if u in sub:
    sub[u]+=x
  else:
    sub[u]=x
print(int(sub["JPY"])+int(sub["TBD"])*380000.0)
Problem p03111 (python)

Fixed submission:
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF=10**9

def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))
#example answer

Buggy submission (verdict: Runtime Error):
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF=10**9

def dfs(cur, a, b, c):
if cur == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
ret0 = dfs(cur + 1, a, b, c)
ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))
#example answer
Problem p03112 (python)

Fixed submission:
import bisect
A, B, Q = map(int, input().split())
INF=10**18
s=[-INF] + [int(input()) for i in range(A)] + [INF]
t=[-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
  x = int(input())
  b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
  res = INF
  for S in [s[b - 1], s[b]]:
    for T in [t[d - 1], t[d]]:
      d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
      res = min(res, d1, d2)
  print(res)
#copy code.

Buggy submission (verdict: Runtime Error):
import bisect
a,b,q=map(int,input().split())
inf=10**18
s=[-inf]+[int(input()) for _ in range(a)]+[inf]
t=[-inf]+[int(input()) for _ in range(b)]+[inf]
for _ in range(q):
  x=int(input())
  b,d=bisect.bisect_right(s,x),bisect.bisect_right(t,x)
  res=inf
  for i in [s[b-1],s[b]]:
    for j in [t[d-1],s[d]]:
      d1,d2=abs(i-x)+abs(i-j),abs(j-x)+abs(j-i)
      res=min(res,d1,d2)
  print(res)
#copy code.

Buggy submission (verdict: Runtime Error):
import bisect
a,b,q=map(int,input())
inf=10**18
s=[-inf]+[int(input()) for _ in range(a)]+[inf]
t=[-inf]+[int(input()) for _ in range(b)]+[inf]
for _ in range(q):
  x=int(input())
  b,d=bisect.bisect_right(s,x),bisect.bisect_right(t,x)
  res=inf
  for i in [s[b-1],s[b]]:
    for j in [t[d-1],s[d]]:
      d1,d2=abs(i-x)+abs(i-j),abs(j-x)+abs(j-i)
      res=min(res,d1,d2)
  print(res)
#copy code.

Buggy submission (verdict: Runtime Error):
import bisect
a,b,q=map(int,input())
inf=10**18
s=[-inf]+[int(input()) for _ in range(a)]+[inf]
t=[-inf]+[int(input()) for _ in range(b)]+[inf]
for _ in range(q):
  x=int(input())
  b,d=bisect_right(s,x),bisect_right(t,x)
  res=inf
  for i in [s[b-1],s[b]]:
    for j in [t[d-1],s[d]]:
      d1,d2=abs(i-x)+abs(i-j),abs(j-x)+abs(j-i)
      res=min(res,d1,d2)
  print(res)

Buggy submission (verdict: Runtime Error):
A,B,Q=map(int,input().split())
INF=10**18
S=[-INF]+[int(input()) for _ in range(A)]+[INF]
T=[-INF]+[int(input()) for _ in range(B)]+[INF]
X=[int(input()) for _ in range(Q)]

def binary_serch(a,x,st=0,end=len(a)):
  while st<end:
    i=len(a)//2
    if x<a[i]:
      end=i
    elif a[i]<x:
      st=i+1
  return st

for x in X:
  s,t=binary_serch(S,x),binary_serch(T,x)
  ans=INF
  for j in [S[i],S[i+1]]:
    for k in [T[i],T[i+1]]:
      cnd1,cnd2=abs(j-x)+abs(k-j),abs(k-x),abs(j-k)
      ans(min(ans,cnd1,cnd2))
  print(ans)
Problem p03136 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
ans="Yes"
for i in l:
  if i>=sum(l)-i:
    ans="No"
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
ans="Yes"
for i in l:
  if i>=sum(L)-i:
    ans="No"
print(ans)
Problem p03140 (python)

Fixed submission:
n=int(input())
s=[list(input()) for _ in range(3)]
cnt=0
for i in range(n):
  cnt+=len(set([s[0][i],s[1][i],s[2][i]]))-1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[list(input()) for _ in range(3)]
cnt=0
for i in range(len(s)):
  cnt+=len(set([s[0][i],s[1][i],s[2][i]]))-1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[i for i in range(3)]
cnt=0
for j in range(n):
  cnt+=len(set(s[0][j],s[1][j],s[2][j])-1
print(cnt)
Problem p03146 (python)

Fixed submission:
s=int(input())
a=[s]
i=1
while len(a)==len(set(a)):
  if a[i-1]%2==0:
    a.append(a[i-1]//2)
  else:
    a.append(a[i-1]*3+1)
  i+=1
print(i)

Buggy submission (verdict: Runtime Error):
s=int(input())
a=[s]
i=1
while len(a)==len(set(a)):
  if a[i-1]%2=0:
    a.append(a[i-1]//2)
  else:
    a.append(a[i-1]*3+1)
  i+=1
print(i)
Problem p03147 (python)

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

ans = 0
pre = 0
for i in h:
    if pre < i:
        ans += i-pre

    pre = i

print(ans)
#copy code

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
cnt=0
while set(h)=={0}
  if h not in 0:
    for i in range(len(h)):
      h[i]=h[i]-min(h)
      cnt+=min(h)
  else:
    for i in range(len(h)):
      l=[]
      if h[i]==0:
      else:
        l.append(h[i])
        continue
      cnt+=min(l)
print(cnt)
Problem p03150 (python)

Fixed submission:
s = input()
for i in range(0, 8):
    if s[:i] + s[-(7-i):] == "keyence":
        print("YES")
        exit()
print("NO")
#copy code

Buggy submission (verdict: Runtime Error):
s=list(input())
n=["k","e","y","e","n","c","e"]
ans=0
for i in n:
  for j in s:
    s.remove(j)
    if i==J:
      ans+=1
      break
  if ans==7:
    break
if ans=7:
  print("YES")
else:
  print("NO")
Problem p03161 (python)

Fixed submission:
import numpy as np
n,k = map(int,input().split())
h = np.array(list(map(int,input().split())))
ans = np.zeros(n, dtype=int)
for i in range(1, n):
    s = max(i-k, 0)
    ans[i] = np.min(ans[s:i]+np.abs(h[s:i]-h[i]))
print(ans[-1])
#copy code

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = (list(map(int,input().split())))
ans =[0]*n
for i in range(1, n):
    s = max(i-k, 0)
    ans[i] = min(ans[s:i]+abs(h[s:i]-h[i]))
print(ans[-1])
#copy code
Problem p03163 (python)

Fixed submission:
import numpy as np 

N, W = map(int, input().split())
w_all = np.zeros(W + 1, dtype=int)

for i in range(N):
  w, v = map(int, input().split())
  w_all[w:] = np.maximum(w_all[w:], w_all[:-w] + v)

print(w_all[W])

Buggy submission (verdict: Runtime Error):
import numpy as np

n,l=map(int,inut().split())
w_all=np.zeros(l+1,dtype=int)

for _ in range(n):
  w,v=map(int,input().split())
  w_all=np.maximum(w_all[w:],w_all[:-w]+v)
  
print(w_all[w])
Problem p03187 (python)

Fixed submission:
L,N = list(map(int,input().split()))
X=[]
Y=[]
SX=[0]
SY=[0]
sx=0
sy=0
for i in range(N):
   x=int(input())
   X.append(x)
   sx+=x
   SX.append(sx)
   Y.append(L-x)
   sy+=L-x
   SY.append(sy)   

max_score=0   
for i in range(N):
    if i>N-i-1:
        max_score=max(2*(SX[i]-SX[2*i-N])+2*(SY[N]-SY[i+1])+Y[i],max_score)
    elif i<N-i-1:
        max_score=max(2*(SX[i]-SX[0])+2*(SY[2*i+2]-SY[i+1])+X[i],max_score)

        
    ind = min(i,N-i-1)
    max_score=max(2*(SX[i]-SX[i-ind])+2*(SY[i+ind+1]-SY[i+1])+X[i],max_score)
    max_score=max(2*(SX[i]-SX[i-ind])+2*(SY[i+ind+1]-SY[i+1])+Y[i],max_score)


print(max_score)
#copy code.

Buggy submission (verdict: Runtime Error):
l,n=map(int,input().split())
x=[int(input()) for i in range(n)]
y=x[::-1]
a=[]
b=[]
for j in x:
    a=abs(0-x[i])
    b=abs(l-y[i])
s=max(a[0],b[0])
for k in range(1,n):
    e+=max(a[k]+b[x])
print(e)
Problem p03206 (python)

Fixed submission:
d=int(input())
print("Christmas"+" Eve"*(25-d))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=[int(input()) for _ in range(n)]
h.sort()
ans=0

for i in range(n-k+1):
  if ans>h[i+k-1]-h[i]:
    ans=h[i+k-1]-h[i]
    
print(ans)
Problem p03210 (python)

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

Buggy submission (verdict: Runtime Error):
s=input()
l=[]
for i in range(len(s)-2):
  l.append(abs(753-int(s[i:i+3])))
print(min(l))

Buggy submission (verdict: Runtime Error):
n=int(input())
print(["NO","YES"][if n in [7,5,3]])
Problem p03212 (python)

Fixed submission:
n=int(input())

def dfs(s):
  if int(s)>n:
    return 0
  cnt=1 if all(s.count(i)>0 for i in '753') else 0
  for j in '753':
    cnt+=dfs(s+j)
  return cnt
  
print(dfs('0'))

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

def dfs(s):
  if int(s)>n:
    return 0
  cnt=1 if all(s.count(i)>0 for i in '753') else 0
  for j in '753':
    cnt+=dfs(s+j)
  retunr cnt
  
print(dfs('0')
Problem p03239 (python)

Fixed submission:
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for i in range(n)]
a=[]
for j in ct:
  if j[1]<=t:
    a.append(j[0])
if len(a)==0:
  print("TLE")
else:
  print(min(a))

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for i in range(n)]
a=[]
for j in ct:
  if j[1]<t:
    a.append(j[0])
print(min(a))