Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
temp=0
count=0
for i in range(1,N+1):
    for j in range(temp,N):
        if (a[j]==i and count+1 == i):
            count=count+1
            temp=j
            break           
if count==0:
    print("-1")
else:
    print(N-count)

Fixed submission:
a=int(input())
b=int(input())
if a!=3 and b!=3:
    print("3")
elif a!=2 and b!=2:
    print("2")
elif a!=1 and b!=1:
    print("1")

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a=!3 and b=!3:
    print("3")
elif a=!2 and b=!2:
    print("2")
elif a=!1 and b=!1:
    print("1")

Fixed submission:
a=int(input())
b=int(input())
if a!=3 and b!=3:
    print("3")
elif a!=2 and b!=2:
    print("2")
elif a!=1 and b!=1:
    print("1")
Buggy python submission (verdict: Runtime Error):
input1 = int(input())
input2 = input()
inputbox = list(input2)
i=0
count = 0
for i in range(1000):
        c = [int(i/100),int(i/10)%10,i%10]
        f = 0
        for j in range(input1):
            if int(inputbox[j])==c[f]:
                f=f+1
            if f==3:
                break
        if f==3:
            count = count + 1
            
print(count)

Fixed submission:
input1 = input()
input2 = input()
inputbox1 = input1.split()
inputbox2 = input2.split()

if inputbox1[0] == inputbox2[0]:
    print("0")
else:
    print("1")

Buggy python submission (verdict: Runtime Error):
input1 = int(input())
input2 = input()
#input1 = len(input2)
kesu = input1 - 1
inputbox = list(input2)
li=[0 for _ in range(1000)]
kazu =""
number = []
i=0
while i < input1-2:
    number.clear()
    number.append(inputbox[i])
    j=0
    while j < input1 - 2 - i:
        number.append(inputbox[j+i+1])
        k=0
        while k < input1 - 2 - i - j:
            number.append(inputbox[k+j+i+2])
            kazu=""
            for n in range(3):
                kazu = kazu+str(number[n])
            kazu1 = int(kazu)
            li[kazu1]=1
            number.pop()
            k=k+1
        j=j+1
        number.pop()
    i=i+1

count = 0
for i in range (1000):
    if li[i] == 1:
        count =count+1

print(count)
  

Fixed submission:
input1 = input()
input2 = input()
inputbox1 = input1.split()
inputbox2 = input2.split()

if inputbox1[0] == inputbox2[0]:
    print("0")
else:
    print("1")
Buggy python submission (verdict: Runtime Error):
import math 

def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。
    # ref = random.choice(arr)
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right

def costsum(x,y):
    siguma =0
    Asort = quick_sort(x)
    Fsort = quick_sort(y)
    for i in range(N):
        siguma = siguma + Asort[i]*Fsort[N-i-1]
    return siguma
def maxseki(x,y):
    seki = 0
    count = 0
    Asort = quick_sort(x)
    Fsort = quick_sort(y)
    for i in range(N):
        if seki < Asort[i]*Fsort[N-i-1]:
            seki = Asort[i]*Fsort[N-i-1]
            count = i
    return count

input1 = input()
input2 = input()
input3 = input()

hairetu1 = input1.split()
hairetu2 = input2.split()
hairetu3 = input3.split()
N = int(hairetu1[0])
K = int(hairetu1[1])
A = [int(s) for s in hairetu2] 
F = [int(t) for t in hairetu3]

Asort = quick_sort(A)
Fsort = quick_sort(F)

for i in range(K):
    s=maxseki(Asort,Fsort)
    Asort[s]=Asort[s]-1


P = maxseki(Asort,Fsort)
maxcost = Asort[P]*Fsort[N-P-1]
if maxcost < 0:
    maxcost =0
print (maxcost)


    

Fixed submission:
a = input()
b = a.split()
c1 = int(b[0])
c2 = int(b[1])
if (1 <= c1 <= 9 and 1 <= c2 <= 9 ):
    ans = c1*c2
else:
    ans = -1

print(ans)
Buggy python submission (verdict: Runtime Error):
input1 = input()
input2 = input()
#input1 = "5"
#input2 = "abccd"
N = int(input1)
hairetu = list(input2)

i=0
s=0
a=0

for s in range (i,N-2):
    if hairetu[s]==hairetu[s+1]:
        for n in range (s,N-s):
            hairetu[n]=hairetu[n+1]
            N=N-1
        a = hairetu.pop(n)
p = len(hairetu)
print(p)

Fixed submission:

input1 = input()
input2 = input()
#input1 = "20"
#input2 = "xxzaffeeeeddfkkkkllq"
N = int(input1)
hairetu = list(input2)

i=0
s=0
a=0

for s in range (N*N):
    if len(hairetu)<i+2:
        break
    elif hairetu[i]==hairetu[i+1]:
        a = hairetu.pop(i+1)
    else:
        i=i+1

    
p = len(hairetu)
print(p)
Buggy python submission (verdict: Runtime Error):
import itertools as it

N,M,X=map(int,input().split())
book = [[int(_) for _ in input().split()] for i in range(N)]

combs = it.product([0, 1], repeat=N)
prices = []
for comb in combs:
	bag = [0] * M
	for i in range(N):
		if comb[i] == 0:
			continue
		else:
			for j in range(M):
				bag[j]+=book[i][j]
	if min(bag[1:]) < X:
		continue
	else:
		prices.append(bag[0])

if len(prices) == 0:
	print(-1)
else:
	print(min(prices))

Fixed submission:
import itertools as it

N,M,X=map(int,input().split())
book = [[int(_) for _ in input().split()] for i in range(N)]

combs = it.product([0, 1], repeat=N)
prices = []
for comb in combs:
	bag = [0] * (M+1)
	for i in range(N):
		if comb[i] == 0:
			continue
		else:
			for j in range(M+1):
				bag[j]+=book[i][j]
	if min(bag[1:]) < X:
		continue
	else:
		prices.append(bag[0])

if len(prices) == 0:
	print(-1)
else:
	print(min(prices))
Buggy python submission (verdict: Runtime Error):
import math
na = lambda: list(map(int, input().split()))
A,B,C,D = na()
ee = (C * D)//math.gcd(C, D)
A = A-1
cc = B//C
dd = B//D
ansb = cc+dd-B//ee
ansa = A//C+A//D-A//ee
print(B-A-(ansb-ansa))

Fixed submission:
import fractions
na = lambda: list(map(int, input().split()))
A,B,C,D = na()
ee = (C * D)//fractions.gcd(C, D)
A = A-1
cc = B//C
dd = B//D
ansb = cc+dd-B//ee
ansa = A//C+A//D-A//ee
print(B-A-(ansb-ansa))

Buggy python submission (verdict: Runtime Error):


import math
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()

A,B,C,D = na()
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
ee = lcm(C,D)
A = A-1
cc = B//C
dd = B//D
ansb = cc+dd-B//ee

ansa = A//C+A//D-A//ee

print(B-A-(ansb-ansa))


Fixed submission:
import fractions
na = lambda: list(map(int, input().split()))
A,B,C,D = na()
ee = (C * D)//fractions.gcd(C, D)
A = A-1
cc = B//C
dd = B//D
ansb = cc+dd-B//ee
ansa = A//C+A//D-A//ee
print(B-A-(ansb-ansa))

Buggy python submission (verdict: Runtime Error):

ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()

A,B,C,D = na()
from functools import reduce


def gcd(*numbers):
    """
    Return the greatest common divisor of 1 or more integers
    Examples
    --------
    >>> gcd(5)
    5
    >>> gcd(30, 40)
    10
    >>> gcd(120, 40, 60)
    20
    """
    # Am I terrible for doing it this way?
    from math import gcd

    return reduce(gcd, numbers)



def lcm(*numbers):
    def lcm(a, b):
        return (a * b) // gcd(a, b)

    return reduce(lcm, numbers, 1)
ee = lcm(C,D)
A = A-1
cc = B//C
dd = B//D
ansb = cc+dd-B//ee

ansa = A//C+A//D-A//ee

print(B-A-(ansb-ansa))


Fixed submission:
import fractions
na = lambda: list(map(int, input().split()))
A,B,C,D = na()
ee = (C * D)//fractions.gcd(C, D)
A = A-1
cc = B//C
dd = B//D
ansb = cc+dd-B//ee
ansa = A//C+A//D-A//ee
print(B-A-(ansb-ansa))
Buggy python submission (verdict: Runtime Error):
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,M = na()
MOD=1000000007
#壊れいている段の数
a=[]
if M>0:
    p=ni()
    a.append(p)
tmp=0
for i in range(M-1):
    tmp=ni()
    if(tmp-1==p):
        #a.append(tmp)
        print(0)
        exit()
    else:
        a.append(tmp)
dp = [0]*(N+1)
dp[0]=1
dp[1]=1
j=0
if(a[0]==0):
    j+=1
    dp[0]=0
if(a[0]==1):
    j+=1
    dp[1]=0
if(N==1):
    t= 1 if M>0 else 0
    print(t)
    exit()
if(N==2):
    for i in a:
        dp[i]=0
    print(dp[0]+dp[1])
    exit()


flag=True
for i in range(2,N+1):
    dp[i]=dp[i-1]+dp[i-2]
    dp[i]%=MOD
    if a[-1]<i or j>=len(a):
        flag=False
    if(flag and a[j]==i):
        dp[i]=0
        j+=1
    
#print(dp,a)
#print(dp)
print(dp[N])

Fixed submission:
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,M = na()
MOD=1000000007
#壊れいている段の数
a=[]
dp = [0]*(N+1)
dp[0]=1
a = [ni() for i in range(M)]
isbro = [1]*(N+1)
for i in range(M):
    isbro[a[i]]=0
#print(isbro)
for i in range(N):
    if(i-1>=0):
        dp[i+1] = dp[i]*isbro[i] + dp[i-1]*isbro[i-1]
    else:
        dp[i+1] = dp[i]*isbro[i]
    dp[i+1]%=MOD
#print(dp)
print(dp[N])

Buggy python submission (verdict: Runtime Error):
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,M = na()
MOD=1000000007
#壊れいている段の数
a=[]
if M>0:
    p=ni()
    a.append(p)
tmp=0
for i in range(M-1):
    tmp=ni()
    if(tmp-1==p):
        #a.append(tmp)
        print(0)
        exit()
    else:
        a.append(tmp)
dp = [0]*(N+1)
dp[0]=1
dp[1]=1
j=0
if(a[0]==0):
    j+=1
    dp[0]=0
if(a[0]==1):
    j+=1
    dp[1]=0


flag=True
for i in range(2,N+1):
    dp[i]=dp[i-1]+dp[i-2]
    dp[i]%=MOD
    if(flag and a[j]==i):
        dp[i]=0
        j+=1
    if a[-1]<i or j==len(a):
        flag=False
#print(dp,a)
#print(dp)
print(dp[N])

Fixed submission:
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N,M = na()
MOD=1000000007
#壊れいている段の数
a=[]
dp = [0]*(N+1)
dp[0]=1
a = [ni() for i in range(M)]
isbro = [1]*(N+1)
for i in range(M):
    isbro[a[i]]=0
#print(isbro)
for i in range(N):
    if(i-1>=0):
        dp[i+1] = dp[i]*isbro[i] + dp[i-1]*isbro[i-1]
    else:
        dp[i+1] = dp[i]*isbro[i]
    dp[i+1]%=MOD
#print(dp)
print(dp[N])
Buggy python submission (verdict: Runtime Error):
N = int(input())
def make_divisors(n):
    divisors = []
    divisors.append(1)
    ans=0
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            #divisors.append(i)
            #print(i)
            if(N%(i-1)==N//(i-1)):
                ans+=i
            if i != n // i:
                #divisors.append(n//i)
                if(N%(n//i-1)==N//(n//i-1)):
                    ans+=n//i-1
                #print(n//i)
    if(N%(N-1)==N//(N-1)):
        ans+=N-1
    print(ans)
    return divisors

res = make_divisors(N)
#print(res)

Fixed submission:
N = int(input())
def make_divisors(n):
    divisors = []
    divisors.append(1)
    ans=0
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            #divisors.append(i)
            #print(i)
            if(N%(i-1)==N//(i-1)):
                ans+=i
            if i != n // i:
                #divisors.append(n//i)
                if(N%(n//i-1)==N//(n//i-1)):
                    ans+=n//i-1
                #print(n//i)
    if(N%(N-1)==N//(N-1)):
        ans+=N-1
    print(ans)
    return divisors

if(N==1):
    print(0)
else:
    res = make_divisors(N)
#print(res)
Buggy python submission (verdict: Runtime Error):
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)

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)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
#DPテーブル作成
dp = [10**10]*(len(H)+K)

dp[0]=0

for i in range(N):
    for j in range(1,K+1):
        if(i+j<N):
            dp[i+j]=min(dp[i+j],dp[i]+abs(H[i]-H[i+j]))

print(dp[N-1])
#print(dp)

Fixed submission:
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
#DPテーブル作成
dp = [10**10]*(N)

dp[0]=0

for i,hi in enumerate(H):
    if i ==0:
        continue
    s = i-K if i-K>=0 else 0
    dp[i] = min([dpk+abs(hi-hk) for dpk,hk in zip(dp[s:i],H[s:i])])
print(dp[-1])
#print(dp)

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
#DPテーブル作成
dp = [10**10]*(len(H)+100)

dp[0]=0

for i in range(N):
    for j in range(K):
        dp[i+j]=min(dp[i+j],dp[i]+abs(H[i]-H[i+j]))

print(dp[N])

Fixed submission:
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
#DPテーブル作成
dp = [10**10]*(N)

dp[0]=0

for i,hi in enumerate(H):
    if i ==0:
        continue
    s = i-K if i-K>=0 else 0
    dp[i] = min([dpk+abs(hi-hk) for dpk,hk in zip(dp[s:i],H[s:i])])
print(dp[-1])
#print(dp)
Buggy python submission (verdict: Runtime Error):
314159265 358979323846264338

Fixed submission:
x,y=list(map(int,input().split()))
c=0
while(True):
    if(x<=y):
        x=x*2
        c+=1
    else:
        break

print(c)
Buggy python submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
N=ni()
A=na()
A.sort()
n=0
ans=0
for i in range(N-1):
    n+=1
    if(A[i]==A[i+1]):
        continue
    else:
        if(n==A[i]):
            n=0
            continue
        elif(n>A[i]):
            ans=n-A[i]
        else:
            ans=n
        n=0

if(A[-1]!=A[-2]):
    ans+=1


print(ans)

Fixed submission:
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
N=ni()
A=na()
A.sort()
dic={}
ans=0
for i in A:
    if(i in dic):
        dic[i]+=1
    else:
        dic[i]=1
for key, value in dic.items():
    if(key==value):
        continue
    elif(key>value):
        ans+=value
    else:
        ans+=value-key


print(ans)
Buggy python submission (verdict: Runtime Error):
N,Z,W =list(map(int,input().split()))

A=list(map(int,input().split()))
print(max(abs(W-A[-1]),abs(A[-1]-A[-2])))

Fixed submission:
N,Z,W =list(map(int,input().split()))

A=list(map(int,input().split()))
if(N==1):
    print(abs(A[0]-W))
else:
    print(max(abs(W-A[-1]),abs(A[-1]-A[-2])))

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

A=list(map(int,input().split()))
print(max(abs(W-A[-1]),abs(A[-1]-A[-2])))

Fixed submission:
N,Z,W =list(map(int,input().split()))

A=list(map(int,input().split()))
if(N==1):
    print(abs(A[0]-W))
else:
    print(max(abs(W-A[-1]),abs(A[-1]-A[-2])))
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())
for i in range(M):
     N = N - int(input())
if N >= 0:
    print(N)
else:
    print(-1)

Fixed submission:
N = input()
A = input()
M = [int(x) for x in N.split(' ')]
B = [int(x) for x in A.split(' ')]
for i in range(M[1]):
     M[0] = M[0] - B[i]
if M[0] >= 0:
    print(M[0])
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())
for i in range(M):
     N = N - int(input())
if N >= 0:
    print(N)
else:
    print(-1)

Fixed submission:
N = input()
A = input()
M = [int(x) for x in N.split(' ')]
B = [int(x) for x in A.split(' ')]
for i in range(M[1]):
     M[0] = M[0] - B[i]
if M[0] >= 0:
    print(M[0])
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
N = input()
M = input()
sumA = 0
for i in range(int(M)):
    sumA += int(input())
playday = int(N)-sumA
if playday >= 0:
    print(playday)
else:
    print(-1)

Fixed submission:
N = input()
A = input()
M = [int(x) for x in N.split(' ')]
B = [int(x) for x in A.split(' ')]
for i in range(M[1]):
     M[0] = M[0] - B[i]
if M[0] >= 0:
    print(M[0])
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
count = 0
while S !=T:
    if count > len(S):
        ans = "No"
        break
    else:
        S = S[-1:] + S[:-1]
        ans = "Yes"
        count +=1
print(ans)

Fixed submission:
S = input()
T = input()
count = 0
ans = "Yes"
while S !=T:
    if count > len(S):
        ans = "No"
        break
    else:
        S = S[-1:] + S[:-1]
        ans = "Yes"
        count +=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = list(map(int, input().split()))

ns_points = [k] * n

for i in range(q):
    a = int(input())
    ns_points = list(map(lambda x: x - 1, ns_points))
    ns_points[a - 1] += 1

for points in ns_points:
    if points <= 0:
        print('No')
    else:
        print('Yes')

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

ns_points = [k] * n
ns_corrects = [0] * n
for i in range(q):
    ns_corrects[int(input())-1] += 1


for j in range(len(ns_points)):
    if ns_points[j] - (q - ns_corrects[j]) <= 0:
        print('No')
    else:
        print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = [input() for i in range(N)]

s_sorted = list(map(''.join, list(map(sorted, s))))

cnt = 0
while(s_sorted):
    k = s_sorted.pop(0)
    tmp_key = [i for i, x in enumerate(s_sorted) if x == k]
    cnt += sum(range(len(tmp_key) + 1))
    while(tmp_key):
        k = s_sorted.pop(tmp_key.pop())

print(cnt)

Fixed submission:
N = int(input())
s = [input() for i in range(N)]

s_sorted = list(map(''.join, list(map(sorted, s))))

s_dict = dict()
for k in s_sorted:
    if k in s_dict:
        s_dict[k] += 1
    else:
        s_dict[k] = 1

cnt = 0
for k in s_dict:
    cnt += sum(range(s_dict[k]))

print(cnt)

Buggy python submission (verdict: Runtime Error):
def sigma(n):
    if n <= 1:
        return n
    else:
        return n + sigma(n-1)


N = int(input())
s = [input() for i in range(N)]

s_sorted = list(map(''.join, list(map(sorted, s))))

s_dict = dict()
for k in s_sorted:
    if k in s_dict:
        s_dict[k] += 1
    else:
        s_dict[k] = 1

cnt = 0
for k in s_dict:
    cnt += sigma(s_dict[k] - 1)

print(cnt)


Fixed submission:
N = int(input())
s = [input() for i in range(N)]

s_sorted = list(map(''.join, list(map(sorted, s))))

s_dict = dict()
for k in s_sorted:
    if k in s_dict:
        s_dict[k] += 1
    else:
        s_dict[k] = 1

cnt = 0
for k in s_dict:
    cnt += sum(range(s_dict[k]))

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

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

dp = [0] * (n + 1)
dp[0] = 1
for now in range(0, n + 1):
    for next_step in range(now + 1, min(n + 1, now + 3)):
        if not next_step in a:
            dp[next_step] += dp[now]
            dp[next_step] %= 1000000007

print(dp[n])

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

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

dp = [0] * (n + 1)
dp[0] = 1
for now in range(0, n + 1):
    for next_step in range(now + 1, min(n + 1, now + 3)):
        if not next_step in a:
            dp[next_step] += dp[now]
            dp[next_step] %= 1000000007

print(dp[n])

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
 
a = []
for i in range(m):
    a.append(int(input()))
 
dp = [0] * (n + 1)
dp[0] = 1
for now in range(0, n + 1):
    for next_step in range(now + 1, min(n + 1, now + 3)):
        if not next_step in a:
            dp[next_step] += dp[now]
            dp[next_step] %= 1000000007

print(dp[n])

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

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

dp = [0] * (n + 1)
dp[0] = 1
for now in range(0, n + 1):
    for next_step in range(now + 1, min(n + 1, now + 3)):
        if not next_step in a:
            dp[next_step] += dp[now]
            dp[next_step] %= 1000000007

print(dp[n])

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
 
a = []
for i in range(m):
    a.append(int(input()))
 
dp = [0] * (n + 1)
dp[0] = 1
for now in range(0, n + 1):
    print(now, dp[now])
    for next_step in range(now + 1, min(n + 1, now + 3)):
        if not next_step in a:
            dp[next_step] += dp[now]
            dp[next_step] %= 1000000007

print(dp[n])

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

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

dp = [0] * (n + 1)
dp[0] = 1
for now in range(0, n + 1):
    for next_step in range(now + 1, min(n + 1, now + 3)):
        if not next_step in a:
            dp[next_step] += dp[now]
            dp[next_step] %= 1000000007

print(dp[n])
Buggy python submission (verdict: Runtime Error):
N = int(input())


ss = list()
for i in range(N):
    s, p = input().split()
    ss = ss.append([s, int(p), i])

ss_sorted = sorted(ss, key = lambda x:(x[0], -x[1]))

print([out[2] for out in ss_sorted])

Fixed submission:
N = int(input())

ss = dict()
sss = dict()
for i in range(N):
    s, p = input().split()
    sss[s, p] = i + 1
    if s in ss:
        ss[s] = ss[s] + ',' + p
    else:
        ss[s] = p

ss_sorted = sorted(ss.items())

for tmp_ss in ss_sorted:
    s = tmp_ss[0]
    ps = list(map(int, tmp_ss[1].split(',')))
    ps.sort(reverse=True)
    for p in ps:
        print(sss[s, str(p)])
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

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

h = []
[h.append(int(input())) for i in range(N)]

hCombi = list(itertools.combinations(h, K))
hMax = list(map(max, hCombi))
hMin = list(map(min, hCombi))
print(min([hMax[i] - hMin[i] for i in range(len(hMax))]))

Fixed submission:
N, K = list(map(int, input().split()))

h = []
for i in range(N):
    h.append(int(input()))

h.sort()

minDistance = 10 ** 9
for i in range(0, N - K + 1):
    if h[i + K - 1] - h[i] < minDistance:
        minDistance = h[i + K - 1] - h[i]

print(minDistance)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

b = []

for i in range(n):
    b.append(a[i])
    b.reverse()

b = list(map(str, b))
print(' '.join(b))

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

a_even = a[0::2]
a_odd  = a[1::2] 

# even
if (n - 1) % 2 == 0: # 0-(n-1)の実施なので(n-1)の偶奇を判定
    b = a_even.copy()
    b.reverse()
    b = b + a_odd
# odd
else:
    b = a_odd.copy()
    b.reverse()
    b = b + a_even

b = list(map(str, b))
print(' '.join(b))

Buggy python submission (verdict: Runtime Error):
!pip install numpy

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

a_even = a[0::2]
a_odd  = a[1::2] 

# even
if (n - 1) % 2 == 0: # 0-(n-1)の実施なので(n-1)の偶奇を判定
    b = a_even.copy()
    b.reverse()
    b = b + a_odd
# odd
else:
    b = a_odd.copy()
    b.reverse()
    b = b + a_even

b = list(map(str, b))
print(' '.join(b))