Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = [list(map(int, input().split())) for _ in range(3)]
    n = int(input())
    b = [int(input()) for i in range(n)]
    ai = [[1]*3 for _ in range(3)]
    for i in range(3):
        for j in range(3):
            if a[i][j] in b:
                ai[i][j] = 0
    ans = "No"
    for k in range(3):
        if sum(ai[k])== 0:
            ans = "Yes"
    for l in range(3):
        if ai[0][k]+ai[1][k]+ai[2][k] == 0:
            ans = "Yes"
    if ai[0][0]+ai[1][1]+ai[2][2] == 0 or ai[0][2]+ai[2][0]+ai[1][1] == 0:
        ans = "Yes"
    print(ans)

Fixed submission:
c = list(map(int,input().split())) + list(map(int,input().split())) + list(map(int,input().split()))
n = int(input())
d = [0]*9
for i in range(n):
    m = int(input())
    for j in range(9):
        if c[j] == m:
            d[j] = 1
if (d[0],d[1],d[2]) == (1,1,1) or (d[3],d[4],d[5]) == (1,1,1) or (d[6],d[7],d[8]) == (1,1,1)\
    or (d[0],d[3],d[6]) == (1,1,1) or (d[1],d[4],d[7]) == (1,1,1) or (d[2],d[5],d[8]) == (1,1,1)\
        or (d[0],d[4],d[8]) == (1,1,1) or (d[2],d[4],d[6]) == (1,1,1):
        print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
,m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]
for i in range(1001):
    if m == 0 and n == 1:
        print(0)
        break
    elif m==0:
        print("1"*n)
        break

    for j,k in sc:
        if len(str(i)) < j or len(str(i)) != n:
            break
        elif  int(str(i)[j-1]) != k:
            break

    else:
        print(i)
        break
else:
    print(-1)

Fixed submission:
n,m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]
for i in range(1000):
    num = str(i)
    if len(num) == n and all(num[s-1]==str(c) for s,c in sc):
        print(i)
        break
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n = int(input())
li = [input() for _ in range(n)]
a = Counter(li)
keys = [k for k, v in a.items() if v == max(a.values())]
keys = sorted(keys)
for i in keys:
    print(i)

Fixed submission:
from collections import Counter
n = int(input())
li = [input() for _ in range(n)]
a = Counter(li)
mx = max(a.values())
keys = [k for k, v in a.items() if v == mx]
keys = sorted(keys)
for i in keys:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
p = [(int(i)+1)/2 for i in input().split()]
ans = 0
for i in range(n-k+1):
    ans = max(sum(p[i:i+k]),ans)
print(ans)

Fixed submission:
n,k = map(int, input().split())
p = [(int(i)+1)/2 for i in input().split()]
ansi = sum(p[0:k-1])
ans = 0
for i in range(k-1,n):
    a1 = p[i-k+1]
    if ansi + p[i] >= ans:
        ans = ansi + p[i]
    ansi = ansi - a1 + p[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
h = int(input())
x = "1"*(h//2 + 1)
print(int(x,2))

Fixed submission:
h = int(input())
x = "1"*(len(bin(h))-2)
print(int(x,2))

Buggy python submission (verdict: Runtime Error):
h = int(input())
n = h//2
x = "0b1"+("0"*(n+1))
# print(x)
# print((int(x,2)))
print(int((1-(int(x,2)))/(1-2)))
#print(int((1-2**(n+1))/(1-2)))

Fixed submission:
h = int(input())
x = "1"*(len(bin(h))-2)
print(int(x,2))

Buggy python submission (verdict: Runtime Error):
h = int(input())
n = h//2
print(int((1-2**(n+1))/(1-2)))

Fixed submission:
h = int(input())
x = "1"*(len(bin(h))-2)
print(int(x,2))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = 0
a = [i for i in range(n+1) if i%10 != 0]
for i in a:
    for j in a:
        if str(i)[0] == str(j)[-1] and str(j)[0] == str(i)[-1]:
            c += 1
print(c)

Fixed submission:
n = int(input())
tbl=[[0 for j in range(10)] for i in range(10)]
for i in range(1,n+1):
    s= str(i)
    h=int(s[0])
    b=int(s[-1])
    tbl[h][b]+=1
ans = 0
for i in range(10):
    for j in range(10):
        ans+=tbl[i][j]*tbl[j][i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
l = []
if n == k:
    l = [s]*n
    for i in range(n):
        print(a[i], end=" ")
else:
    if s%2:
        for i in range(k+1):
            print(i)
            if i%2:
                l += [int(s/2)]
            else:
                l += [int(s/2)+1]
        if s == 1 or s == 3:
            l += [100]*(n-(k+1))
        else:
            l += [1]*(n-(k+1))
    elif s != 2:
        l = [int(s/2)]*(k+1) + [int(s/2)+1]*(n-k-1)
    else:
        l = [int(s/2)]*(k+1) + [100]*(n-k-1)
        
    for i in range(n):
        print(l[i], end=" ")

Fixed submission:
n,k,s = map(int,input().split())
for i in range(1,n+1):
    if i <=k:
        print(s)
    elif s == 10**9:
        print(1)
    else:
        print(10**9)
Buggy python submission (verdict: Runtime Error):
s = int(input())
print(str(ord(s)+1))

Fixed submission:
a = [chr((ord("a") + i)) for i in range(26)]
b = input()
for i in range(len(a)):
  if b == a[i]:
    print(a[i+1])
Buggy python submission (verdict: Runtime Error):
import itertools
n = int(input())
c1 = tuple(map(int, input().split()))
c2 = tuple(map(int, input().split()))
a = []
for i in range(1,n+1):
    a.append(i)
b = sorted(list(itertools.permutations(a)))
for i in range(len(b)):
    if b[i] == c1:
        d = i
    elif b[i] == c2:
        e = i
print(abs(d-e))

Fixed submission:
import itertools
n = int(input())
c1 = tuple(map(int, input().split()))
c2 = tuple(map(int, input().split()))
a = []
for i in range(1,n+1):
    a.append(i)
b = sorted(list(itertools.permutations(a)))
for i in range(len(b)):
    if b[i] == c1:
        d = i
    if b[i] == c2:
        e = i
print(abs(d-e))
Buggy python submission (verdict: Runtime Error):
from math import gcd
s,t = map(int,input().split())
d = s * t // gcd(s, t)
print(d)

Fixed submission:
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) 
    
s,t = map(int,input().split())
d = s * t // gcd(s, t)
print(d)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
j = 0
d = 0
c0 = 0
l = sorted(list(set(a)))
for i in l:
    if i == j+1:
        j = i
        if i in a[c0:]:
            for k in range(len(a[c0:])):
                if i == a[c0:][k]:
                    p=k
                    break
            c = p+(n-len(a[c0:]))
        else:break
        if c >= c0:
            d += 1
            c0 = c
        else:break
    else:break
print(n-d if d !=0 else -1)

Fixed submission:
from collections import deque
n = int(input())
a = list(map(int, input().split()))
a = deque(a)
d = 0
i = 1
for _ in range(n):
    b = a.popleft()
    if i == b:
        d +=1
        i += 1
        
print(n-d if d !=0 else -1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
j = 0
d = 0
c0 = 0
l = sorted(list(set(a)))
for i in l:
    if i == j+1:
        j = i
        if i in a[c0:]:
            c = a[c0:].index(i)+(n-len(a[c0:]))
        else:break
        if c >= c0:
            d += 1
            c0 = c
        else:break
    else:break
print(n-d if d !=0 else -1)

Fixed submission:
from collections import deque
n = int(input())
a = list(map(int, input().split()))
a = deque(a)
d = 0
i = 1
for _ in range(n):
    b = a.popleft()
    if i == b:
        d +=1
        i += 1
        
print(n-d if d !=0 else -1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
j = 0
d = 0
c0 = 0
l = sorted(list(set(a)))
for i in l:
    if i == j+1:
        j = i
        if i in a[c0:]:
            for 
            c = a[c0:].index(i)+(n-len(a[c0:]))
        else:break
        if c >= c0:
            d += 1
            c0 = c
        else:break
    else:break
print(n-d if d !=0 else -1)

Fixed submission:
from collections import deque
n = int(input())
a = list(map(int, input().split()))
a = deque(a)
d = 0
i = 1
for _ in range(n):
    b = a.popleft()
    if i == b:
        d +=1
        i += 1
        
print(n-d if d !=0 else -1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n//1.08 * 1.08 == n:
  print(n//1.08)
else (n//1.08+1)*1.08 == n:
  print(n//1.08+1)
else:
  print(":(")

Fixed submission:
import math
N = int(input())
X = math.ceil(N / 1.08)
if int(X*1.08) == N:
    print(X)
else:
    print(':(')
Buggy python submission (verdict: Runtime Error):
a = int(input())
c = [j for j in range(1,int(a**0.5)) if a%j==0]
print((max(c)-1) + (a//max(c)-1))

Fixed submission:
n = int(input())
c = max([i for i in range(1,int(n**0.5+1)) if n%i==0])
print(c+n//c-2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
c = max([i for i in range(1,int(n**0.5)) if n%i==0])
print(c+n//c-2)

Fixed submission:
n = int(input())
c = max([i for i in range(1,int(n**0.5+1)) if n%i==0])
print(c+n//c-2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
c = max([i for i in range(1,int(n**0.5)) if n%i==0])
print(c+n//c-2)

Fixed submission:
n = int(input())
c = max([i for i in range(1,int(n**0.5+1)) if n%i==0])
print(c+n//c-2)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(max(0,a-(2*b))

Fixed submission:
a,b = map(int,input().split())
print(max(0,a-(2*b)))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
d = int(input())
d = list(map(int,input().split()))
n = 3
ans = 0
for i in itertools.combinations(d,n):
    if i[0] < i[1]+i[2] and i[1] < i[0]+i[2] and i[2] < i[1]+i[0]:
        ans += 1
print(ans)

Fixed submission:
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
ans = 0
for i in range(n):
    for j in range(i+1,n):
        k = bisect.bisect_left(l,l[i]+l[j])
        if k > j:
            ans += k - j -1 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(1,n+1):
    b.append(a.index(i)+1)
b =map(str,b)
print(" ".join(b))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0]*n
for i in range(n):
    b[a[i]-1] = i+1
print(" ".join(map(str,b)))
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int, input().split())
a = [input() for _ in range(q)]
for i in range(n):
    b = a.count(str(i+1))
    print("No" if q-b >= k else "Yes")

Fixed submission:
n,k,q=map(int,input().split())
a=[0]*n
for _ in range(q):
    a[int(input())-1] += 1
c = sum(a)
for i in a:
    if (c-i)>=k:
        print("No")
    else:
        print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
n,k,q=map(int,input().split())
a=[0]*n
for _ in range(q):
    a[int(input())-1] += 1
for i in a:
    if (sum(a)-i)>=k:
        print("No")
    else:
        print("Yes")

Fixed submission:
n,k,q=map(int,input().split())
a=[0]*n
for _ in range(q):
    a[int(input())-1] += 1
c = sum(a)
for i in a:
    if (c-i)>=k:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
count = [0]*n
l = []
for i in range(n):
    a = ''.join(sorted(input()))
    if a in l:
        count[l.index(a)] += 1
    else:
        l.append(a)
print(sum(int((i+1)*i/2) for i in count if i != 0))

Fixed submission:
from collections import Counter
n = int(input())
a = [""]*n
for i in range(n):
    a[i] = ''.join(sorted(input()))
b = list(Counter(a).values())
print(sum(int((i-1)*i/2) for i in b))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
count = 0
l = []
for i in range(n):
    a = ''.join(sorted(input()))
    count += l.count(a)
    l.append(a)
print(count)

Fixed submission:
from collections import Counter
n = int(input())
a = [""]*n
for i in range(n):
    a[i] = ''.join(sorted(input()))
b = list(Counter(a).values())
print(sum(int((i-1)*i/2) for i in b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
for i in range(n):
    print(max(a[0:i]+a[i+1:n]))

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a)
for i in range(n):
    if a[i] == b[-1]:
        print(b[-2])
    else:
        print(b[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
l1 = [] #odd *-1
l2 = [] #even *-1
ans = []
for i in range(n):
    if i%2:
        l1.append(-1*l[i])
    else:
        l1.append(l[i])

for j in range(n):
    if j%2:
        l2.append(l[j])
    else:
        l2.append(-1*l[j])

for k in range(n):
    if k%2:
        ans.append(sum(l2[k:])+sum(l1[:k]))
    else:
        ans.append(sum(l1[k:])+sum(l2[:k]))

print(' '.join(map(str,ans)))

Fixed submission:
from itertools import accumulate
n = int(input())
l = list(map(int,input().split()))
l1 = [] #odd *-1
l2 = [] #even *-1
ans = []
for i in range(n):
    if i%2:l1.append(-1*l[i])
    else:l1.append(l[i])
for j in range(n):
    if j%2:l2.append(l[j])
    else:l2.append(-1*l[j])

a = [0]+list(accumulate(l2[::-1]))
b = [0]+list(accumulate(l1))
c = [0]+list(accumulate(l1[::-1]))
d = [0]+list(accumulate(l2))
for k in range(n):
    if k%2:
        ans.append(a[~k]+b[k])
    else:
        ans.append(c[~k]+d[k])

print(' '.join(map(str,ans)))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ans = 0
while True:
    a = s.replace("ABC", "BCA", 1)
    if s == a:
        break
    else:
        s = a
        ans += 1
print(ans)

Fixed submission:
s = input()
s = s.replace("BC","D")
a,ans = 0,0
#Dより前にあるB,C意外でつながったAの数をカウント
for i in s:
    if i == "A":
        a += 1
    elif i == "D":
        ans += a
    else:
        a = 0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ans = 0
while s.count("ABC")!=0:
    s = s.replace("ABC", "BCA", 1)
    ans += 1
print(ans)

Fixed submission:
s = input()
s = s.replace("BC","D")
a,ans = 0,0
#Dより前にあるB,C意外でつながったAの数をカウント
for i in s:
    if i == "A":
        a += 1
    elif i == "D":
        ans += a
    else:
        a = 0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n,m = map(int, input().split())
a = sorted(list(map(int,input().split())))
bc = [list(map(int, input().split())) for _ in range(m)]
bc.sort(key=lambda x:(-x[1])) 
for b,c in bc:
    index = bisect.bisect_left(a, c)
    d = min(index,b)
    for j in range(d):
        a[j] = c
    a.sort()

print(sum(a))
    


Fixed submission:
n,m = map(int, input().split())
a = sorted(list(map(int,input().split())))
d = [list(map(int, input().split())) for _ in range(m)]
d.sort(key=lambda x:(-x[1]))
e = []
for b,c in d:
    e += [c]*b
    if len(e) >= n:
        break
e = sorted(e)[::-1]
ans = 0
j = 0
for i in range(n):
    if j < len(e):
        if a[i] >= e[j]:
            ans += a[i]
        else:
            ans += e[j]
            j += 1
    else:
        ans += a[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int, input().split())
ans = 0
for i in range(3001):
    for j in range(3001):
        a = (n - r*i - g*j)/b
        if a == int(a) and a >= 0:
            ans += 1
print(ans)

Fixed submission:
r,g,b,n = map(int, input().split())
ans = 0
for i in range(3001):
    for j in range(3001):
        a = (n - r*i - g*j)/b
        if a == int(a) and a >= 0:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a = [int(input()) for i in range(6)]
for i in range(0:4):
  if a[i+1]-a[i]>a[5]:
    print(":(")
else:
  print("Yay!")

Fixed submission:
a = [int(input()) for i in range(6)]
for i in range(0,5):
    for j in range(0,5):
        if abs(a[i]-a[j]) > a[5]:
            print(":(")
            exit()
else:
    print("Yay!")
Buggy python submission (verdict: Runtime Error):
a = [int(input()) for i in range(5)]
A = min([j%10 for j in a if j%10 != 0])
b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
b += sum([l for l in a if l%10 ==0])
print(b-(10-A))

Fixed submission:
a = [int(input()) for i in range(5)]
if all(n%10==0 for n in a):
    b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
    b += sum([l for l in a if l%10 ==0])
    print(b)
else:
    A = min([j%10 for j in a if j%10 != 0])
    b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
    b += sum([l for l in a if l%10 ==0])
    print(b-(10-A))

Buggy python submission (verdict: Runtime Error):
a = [int(input()) for i in range(5)]
A = min([j%10 for j in a if j%10 != 0])
b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
b += sum([l for l in a if l%10 ==0])
print(b-(10-A))

Fixed submission:
a = [int(input()) for i in range(5)]
if all(n%10==0 for n in a):
    b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
    b += sum([l for l in a if l%10 ==0])
    print(b)
else:
    A = min([j%10 for j in a if j%10 != 0])
    b = sum([((k//10)+1)*10 for k in a if k%10 != 0])
    b += sum([l for l in a if l%10 ==0])
    print(b-(10-A))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(5)]
print(math.ceil(n/min(a))+4)

Fixed submission:
import math
n = int(input())
tra = [int(input()) for i in range(5)]
print(math.ceil(n/min(tra))+4)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
a = [int(input()) for _ in range(n)]
print(math.ceil(n/min(a))+4)

Fixed submission:
import math
n = int(input())
tra = [int(input()) for i in range(5)]
print(math.ceil(n/min(tra))+4)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
tra = [int(input()) for i in range(5)]
box = [0]*6
box[0] = n
c = 0
while box[5] != n:
    box[5] += min(box[4],tra[4]) 
    for i in range(4,0,-1):
        box[i] = box[i] + min(box[i-1],tra[i-1]) - min(box[i],tra[i])
    box[0] -= min(box[0],tra[0])
    c += 1
print(c)

Fixed submission:
import math
n = int(input())
tra = [int(input()) for i in range(5)]
print(math.ceil(n/min(tra))+4)
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int, input().split())
s = input()
for _ in range(q):
    l,r = map(int, input().split())
    print(s[l-1:r].count("AC"))

Fixed submission:
n,q=map(int,input().split())
s=input()
t=[0]*(n+1)
for i in range(n-1):
    t[i+1]=t[i]+(1 if s[i:i+2]=="AC" else 0)
for i in range(q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]
for i in range(q):
    print(s[lr[i][0]-1:lr[i][1]].count("AC"))

Fixed submission:
n,q=map(int,input().split())
s=input()
t=[0]*(n+1)
for i in range(n-1):
    t[i+1]=t[i]+(1 if s[i:i+2]=="AC" else 0)
for i in range(q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
a.sort(key=lambda x:(x[0],x[1]))
c = 0
ans = 0
for i in range(n):
    for j in range(a[i][1]):
        if c < m:
            c += 1
            ans += a[i][0]
print(ans)

Fixed submission:
n,m = map(int,input().split())
a = [list(map(int, input().split())) for _ in range(n)]
a.sort(key=lambda x:(x[0]))
c = 0
mony = 0
for i in a:
    if c + i[1] < m:
        c += i[1]
        mony += i[0]*i[1]
    else:
        for j in range(i[1]):
            c += 1
            mony += i[0]
            if c >= m:
                break
        break
print(mony)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
i = 0
c = 0
for _ in range(10**8):
    if len(s)==0 or i == len(s)-1:
        break
    if s[i] != s[i+1]:
        s = s[:i]+s[i+2:]
        c += 1
        i = 0
        continue
    i += 1
print(c*2)

Fixed submission:
s = input()
print(min(s.count("1"),s.count("0"))*2)
Buggy python submission (verdict: Runtime Error):
N,A = map(int, input().split())
pritn(N/A)

Fixed submission:
N,A = map(int, input().split())
print(N/A)
Buggy python submission (verdict: Runtime Error):
ai=[s]
for i in range(1000000):
    if s%2:
        s =3*s+1
        ai.append(s)
    else:
        s = s//2
        ai.append(s)
    print(ai)
    if len(ai) != len(set(ai)):
        c=0
        for j in range(len(ai)):
            if ai.count(ai[j])==2:
                c +=1
                if c ==2:
                    print(j+1)
                    break
        exit()

Fixed submission:
n = int(input())
ans = 1
while(n != 4 and n != 2 and n != 1):
    ans += 1
    if n%2 == 0:
        n = n//2
    else:
        n = 3*n+1
print(ans+3)
Buggy python submission (verdict: Runtime Error):
a = input()
b = "keyence"
j = 0
for i in a:
  if i==b[j]:
    j+=1
print("YES" if j == 7 else "NO")

Fixed submission:
s = input()
k = "keyence"
for i in range(8):
    if s.startswith(k[:i]) and s.endswith(k[i:]):
        print("YES")
        break
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
a = list(map(int,input().split()))
dp = [0]*(n)
dp[1] = abs(a[1]-a[0]) 

for i in range(2,n):
    c = float("inf")
    for j in range(1,min(k,i)+1):
        c = min(c,dp[i-j] + abs(a[i] -a[i-j]))
    dp[i] = c
print(dp[n-1])

Fixed submission:
n,k = map(int, input().split())
l = list(map(int,input().split()))
dp = [0]*n
dp[1] = abs(l[1] - l[0])

for i in range(2,n):
    c = float("inf")
    #1個前から飛んでく、2個前から、、、k個前から飛んでくる最小のコストを求める
    for j in range(min(k,i)):
        c = min(dp[i-(j+1)]+abs(l[i]-l[i-(j+1)]),c)
    dp[i] = c
print(dp[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
l = list(map(int,input().split()))
dp = [0]*n
dp[1] = abs(l[1] - l[0])

for i in range(2,n):
    c = float("inf")
    #1個前から飛んでく、2個前から、、、k個前から飛んでくる最小のコストを求める
    for j in range(min(k,i)):
        c = min(dp[i-(j+1)]+abs(l[i]-l[i-(j+1)]),c)
    dp[i] = c
print(dp[n-1])

Fixed submission:
n,k = map(int, input().split())
l = list(map(int,input().split()))
dp = [0]*n
dp[1] = abs(l[1] - l[0])

for i in range(2,n):
    c = float("inf")
    #1個前から飛んでく、2個前から、、、k個前から飛んでくる最小のコストを求める
    for j in range(min(k,i)):
        c = min(dp[i-(j+1)]+abs(l[i]-l[i-(j+1)]),c)
    dp[i] = c
print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
d = int(input())
print("Christmas" if d=25 else "Christmas Eve" if d =24 else "Christmas Eve Eve" if d=23 else "Christmas Eve Eve Eve")

Fixed submission:
d = int(input())
print("Christmas" if d==25 else "Christmas Eve" if d==24 else "Christmas Eve Eve" if d==23 else "Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
h = sorted([int(input()) for i in range(n)])
c = 10**10
for i in range(n-k+1):
    c = min(h[i+2]-h[i],c)
print(c)

Fixed submission:
n,k = map(int, input().split())
h = sorted([int(input()) for i in range(n)])
c = 10**10
for i in range(n-k+1):
    c = min(h[i+k-1]-h[i],c)
print(c)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
s = sorted(Counter(input()).values)
t = sorted(Counter(input()).values)
print("Yes" if s==t else "No")

Fixed submission:
from collections import Counter
s=sorted(Counter(input()).values())
t=sorted(Counter(input()).values())
print("Yes" if s==t else "No")
Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
a = list(map(int, input().split()))
b = [0]*(n-1)
for i in range(n-1):
    b[i]= a[i+1]-a[i]
c = 0
for j in b:
    c = gcd(c, j)
print(c)

Fixed submission:
from fractions import gcd
n,x = map(int,input().split())
a = list(map(int, input().split()))
a.append(x)
a = sorted(a)
b = [0]*n
for i in range(n):
    b[i]= a[i+1]-a[i]
c = 0
for j in b:
    c = gcd(c, j)
print(c)
Buggy python submission (verdict: Runtime Error):
print("Yay!" if int(input())<9 and int(input())<9 else ":(")

Fixed submission:
a,b = map(int, input().split())
print("Yay!" if a<9 and b<9 else ":(" )