Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())

def get_cd(x1,x2):
    cd=[]
    for i in range(1,min(x1,x2)+1):
        if x1%i==0 and x2%i==0:
            cd.append(i)
    return cd

cd_AB=get_cd(A,B)

for j in range (0,len(cd_AB)-1):
    for k in range(j+1,len(cd_AB)):
            if(len(get_cd(cd_AB[j],cd_AB[k]))>1):
                cd_AB[k]=0

print(len(cd_AB)-cd_AB.count(0))

Fixed submission:
N=int(input())

if(N%2==0):
    p=0.5
else:
    p=(N+1)/(2*N)
print(p)
Buggy python submission (verdict: Runtime Error):
import heapq
N,M=map(int,input().split())
A=[-int(x) for x in input().split()]
heapq.heapify(A)
    
for i in range(0,M):
    tmp=heapq.heappop(A)
    heapq.heappush(A,-int(-tmp/2))
print(-sum(A))

Fixed submission:
S=input()

if(S=="Sunny"):
    print("Cloudy")
elif(S=="Cloudy"):
    print("Rainy")
elif(S=="Rainy"):
    print("Sunny")
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int,input().split())
A=[]
score=[K]*N
for i in range(0,Q):
    A.append(int(input())-1)
        
for j in range(0,N):
    score[j]=score[j]-(Q-A.count(j))
    if(score[j]>0):
        print("Yes")
    else:
        print("No")
    

Fixed submission:
N,K,Q=map(int,input().split())
A=[0]*N
score=[K]*N
for i in range(0,Q):
    a=int(input())
    A[a-1]+=1
        
for j in range(0,N):
    score[j]=score[j]-(Q-A[j])
    if(score[j]>0):
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int,input().split())
A=[]
score=[K]*N
for i in range(0,Q):
    A.append(int(input()))

for j in range(0,N):
    score[j]=score[j]-(Q-A.count(j+1))
    if(score[j]>0):
        print("Yes")
    else:
        print("No")
    

Fixed submission:
N,K,Q=map(int,input().split())
A=[0]*N
score=[K]*N
for i in range(0,Q):
    a=int(input())
    A[a-1]+=1
        
for j in range(0,N):
    score[j]=score[j]-(Q-A[j])
    if(score[j]>0):
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M=map(int,input().split())
A=[int(x) for x in input().split()]
A.sort(reverse=True)

for i in range(0,M):
    A[0]=int(A[0]/2)
    flag=0
    while(flag!=1):
        for j in range(0,N-1):
            if(A[j]>A[j+1]):
                flag=1
                break
            else:
                tmp=A[j]
                A[j]=A[j+1]
                A[j+1]=tmp
        
print(sum(A))

Fixed submission:
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(A)
    
for i in range(0,M):
    tmp=heapq.heappop(A)
    heapq.heappush(A,-int(-tmp/2))
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M=map(int,input().split())
A=[int(x) for x in input().split()]

for i in range(0,M):
    A[np.argmax(A)]=int(A[np.argmax(A)]/2)

print(sum(A))

Fixed submission:
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(A)
    
for i in range(0,M):
    tmp=heapq.heappop(A)
    heapq.heappush(A,-int(-tmp/2))
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M=map(int,input().split())
A=[int(x) for x in input().split()]
A.sort(reverse=True)

for i in range(0,M):
    A[np.argmax(A)]=int(A[np.argmax(A)]/2)

print(sum(A))

Fixed submission:
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(A)
    
for i in range(0,M):
    tmp=heapq.heappop(A)
    heapq.heappush(A,-int(-tmp/2))
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):

N,M=map(int,input().split())
A=[int(x) for x in input().split()]
A.sort(reverse=True)

for i in range(0,M):
    A[0]=int(A[0]/2)
    A.sort(reverse=True)

print(sum(A))

Fixed submission:
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(A)
    
for i in range(0,M):
    tmp=heapq.heappop(A)
    heapq.heappush(A,-int(-tmp/2))
print(-sum(A))

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[int(x) for x in input().split()]
A.sort(reverse=True)
print(A)
for i in range(0,M):
    A[0]=int(A[0]/2)
    A.sort(reverse=True)
    print(A)

print(sum(A))

Fixed submission:
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(A)
    
for i in range(0,M):
    tmp=heapq.heappop(A)
    heapq.heappush(A,-int(-tmp/2))
print(-sum(A))
Buggy python submission (verdict: Runtime Error):
import numpy as np
def lcm(x,y):
    return int(x*y/np.gcd(x,y))
A,B,C,D=map(int,input().split())

S=B-A+1
if(A%C==0):
    n_C=B//C-A//C+1
else:
     n_C=B//C-A//C

if(A%D==0):
    n_D=B//D-A//D+1
else:
    n_D=B//D-A//D

if(A%lcm(C,D)==0):
    n_CD=B//lcm(C,D)-A//lcm(C,D)+1
else:
    n_CD=B//lcm(C,D)-A//lcm(C,D)
    
print(S-n_C-n_D+n_CD)

Fixed submission:
def gcd(a,b):
    if(a<b):
        tmp=b
        b=a
        a=tmp
    while(a%b!=0):
        tmp_1=b
        tmp_2=a%b
        a=tmp_1
        b=tmp_2
    return b
    
def lcm(x,y):
    return int(x*y/gcd(x,y))

A,B,C,D=map(int,input().split())

S=B-A+1
if(A%C==0):
    n_C=B//C-A//C+1
else:
     n_C=B//C-A//C

if(A%D==0):
    n_D=B//D-A//D+1
else:
    n_D=B//D-A//D

if(A%lcm(C,D)==0):
    n_CD=B//lcm(C,D)-A//lcm(C,D)+1
else:
    n_CD=B//lcm(C,D)-A//lcm(C,D)
    
print(S-n_C-n_D+n_CD)
Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=[int(x)for x in input().split()]

count=0
D=0
for i in range(0,N+1):
    if(D>X):
        break
    else:
        count+=1
        D=D+L[i]
print(count)

Fixed submission:
N,X=map(int,input().split())
L=[int(x)for x in input().split()]

count=0
D=0
n=0
for i in range(0,N):
    n+=1
    if(D>X):
        break
    else:
        count+=1
        D=D+L[i]
    
if(n==N and D<=X):
    count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=[int(x)for x in input().split()]

count=1
D=1
for i in range(0,N+1):
    if(D>X):
        break
    else:
        D=D+L[i]
        count+=1

print(count)

Fixed submission:
N,X=map(int,input().split())
L=[int(x)for x in input().split()]

count=0
D=0
n=0
for i in range(0,N):
    n+=1
    if(D>X):
        break
    else:
        count+=1
        D=D+L[i]
    
if(n==N and D<=X):
    count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Ai = [int(i) for i in input().split()]

leftSum = 0
rightSum = 0
K = N

for i in range(0,N):
    if(leftSum < rightSum):
        leftSum = leftSum + Ai.pop(0)
        K = K-1
    else:
        rightSum = rightSum + Ai.pop(K-1)
        K = K-1
print(abs(leftSum-rightSum))

Fixed submission:
N = int(input())
Ai = [int(i) for i in input().split()]

leftSum = 0
rightSum = 0
K = N
L = 0

for i in range(0,N):
    if(leftSum < rightSum):
        leftSum = leftSum + Ai[L]
        L = L+1
    else:
        rightSum = rightSum + Ai[K-1]
        K = K-1
print(abs(leftSum-rightSum))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Ai = [int(i) for i in input().split()]

leftSum = 0
rightSum = 0


for i in range(0,N):
    if(leftSum < rightSum):
        leftSum = leftSum + Ai.pop(0)
    else:
        rightSum = rightSum + Ai.pop(len(Ai)-1)
ans = abs(leftSum-rightSum)
print(ans)

Fixed submission:
N = int(input())
Ai = [int(i) for i in input().split()]

leftSum = 0
rightSum = 0
K = N
L = 0

for i in range(0,N):
    if(leftSum < rightSum):
        leftSum = leftSum + Ai[L]
        L = L+1
    else:
        rightSum = rightSum + Ai[K-1]
        K = K-1
print(abs(leftSum-rightSum))
Buggy python submission (verdict: Time Limit Exceeded):
tmp = int(input())
timing = [int(i) for i in input().split()]
ans = []
for i in range(0,tmp):
    #ans.append(timing.index(i+1)+1)
    print(timing.index(i+1)+1,end="")
    if i <tmp-1:
        print(" ",end="")

Fixed submission:
tmp = int(input())
timing = [int(i) for i in input().split()]
num_dict = {}
for i  in range(0,tmp):
    num_dict[timing[i]] = i+1

for i in range (0,tmp):
    print(num_dict.pop(i+1),end="")
    if i <tmp-1:
        print(" ",end="")

#for i in range(0,tmp):
#    #ans.append(timing.index(i+1)+1)
#    print(timing.index(i+1)+1,end="")
#
Buggy python submission (verdict: Runtime Error):
tmp = int(input())
A = []
for i in range(0,tmp):
    A.append(int(input()))
sum = 0
for i in range(0,tmp):
    sum = sum + 1/A.pop()

print(1/sum)

Fixed submission:
tmp = int(input())
A = [int(i) for i in input().split()]
sum = 0
for i in range(0,tmp):
    sum = sum + 1/A.pop()
print(1/sum)
Buggy python submission (verdict: Time Limit Exceeded):
H, W, K = map(int, input().split())
cake = [input() for _ in range(H)]
memo = [[0] * W for _ in range(H)]
cake_count_row = [0] * H

for y in range(H):
    count = 0
    for x in range(W):
        if cake[y][x] == "#":
            count += 1
    cake_count_row[y] = count

count = 1
for y in range(H):
    first = True
    if cake_count_row[y] == 0:
        continue 
    for x in range(W):
        if cake[y][x] == "#":
            if first:
                first = False
            else:
                count += 1
        memo[y][x] = count
    if first == False:
        count += 1

for _ in range(H - 1):
    for y in range(H - 1):
        if cake_count_row[y] == 0:
            for x in range(W):
                memo[y][x] = memo[y + 1][x]

for _ in range(H - 1):
    for y in range(H - 1, 0, -1):
        if cake_count_row[y] == 0:
            for x in range(W):
                memo[y][x] = memo[y - 1][x]

for i in range(H):
    print(" ".join(list(map(str, memo[i]))))

Fixed submission:
H, W, K = map(int, input().split())
cake = [input() for _ in range(H)]
memo = [[0] * W for _ in range(H)]
cake_count_row = [0] * H

for y in range(H):
    count = 0
    for x in range(W):
        if cake[y][x] == "#":
            count += 1
    cake_count_row[y] = count

count = 1
for y in range(H):
    first = True
    if cake_count_row[y] == 0:
        continue 
    for x in range(W):
        if cake[y][x] == "#":
            if first:
                first = False
            else:
                count += 1
        memo[y][x] = count
    if first == False:
        count += 1

copy_y_save = -1
for y in range(1, H):
    if cake_count_row[y] == 0:
        for x in range(W):
            memo[y][x] = memo[y - 1][x]

for y in range(H - 2, -1, -1):
    if cake_count_row[y] == 0:
        for x in range(W):
            memo[y][x] = memo[y + 1][x]

for i in range(H):
    print(" ".join(list(map(str, memo[i]))))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
l = list(map(int, input().split()))
count = 0
for i in range(n - 2):
    for j in range(i + 1 , n - 1):
        l_np = np.array(l[j + 1:n])
        count += np.count_nonzero((l_np > abs(l[i] - l[j])) & (l_np < l[i] + l[j]))
print(count)

'''
print("")
print("i=" +str(i)+ ", j=" + str(j))
print("l[i]=" + str(l[i]) + ", l[j]" + str(l[j]))
print("差 = " + str(abs(l[i] - l[j])) + ", 和 = " + str(l[i] + l[j]))
print("計算対象 = " + str(l_np))
print("個数 = " + str(np.count_nonzero((l_np > abs(l[i] - l[j])) & (l_np < l[i] + l[j]))))
'''





Fixed submission:
import bisect

n = int(input())
l = list(map(int,input().split()))
l.sort()

count = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        k = bisect.bisect_left(l, l[i] + l[j])
        count += k - j - 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
out = [""] * n
count = 0
out_str = ""
for i in range(n):
    out_str += str(a.index(i + 1) + 1) + " "

print(out_str[:-1])


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
out = [""] * n
out_str = ""
for i in range(n):
    out[a[i] - 1] = str(i + 1)
        
out_str = " ".join(out)
 
print(out_str)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
out = [0] * n
count = 0
out_str = ""
for i in range(n):
    out[a[i] - 1] = i + 1
        
for i in range(n):
    out_str = out_str + str(out[i]) + " "

print(out_str[:-1])


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
out = [""] * n
out_str = ""
for i in range(n):
    out[a[i] - 1] = str(i + 1)
        
out_str = " ".join(out)
 
print(out_str)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
out = [0] * n
count = 0
out_str = ""
for j in range(n):
    for i in range(n):
        if j + 1 == a[i]:
            out[j] = i + 1
            break

for i in range(n):
    out_str = out_str + str(out[i]) + " "

print(out_str[:-1])


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
out = [""] * n
out_str = ""
for i in range(n):
    out[a[i] - 1] = str(i + 1)
        
out_str = " ".join(out)
 
print(out_str)
Buggy python submission (verdict: Time Limit Exceeded):
import math
def is_prime(n):
    if n == 1: return False
    # 2以外の偶数は素数ではないので無視する
    if n != 2:
        if n % 2 == 0:
            return False
    # 3以外の偶数は素数ではないので無視する
    if n != 3:
        if n % 3 == 0:
            return False
    # 5以外の偶数は素数ではないので無視する
    if n != 5:
        if n % 5 == 0:
            return False
    # 7以外の偶数は素数ではないので無視する
    if n != 7:
        if n % 7 == 0:
            return False
    # 11以外の偶数は素数ではないので無視する
    if n != 11:
        if n % 11 == 0:
            return False
            
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

a, b = map(int, input().split())
count = 1
for i in range(2,min(a,b)+1):
    if a % i == 0 and b % i == 0:
        if is_prime(i) == True:
            count += 1

print(count)


Fixed submission:
# 再帰関数の最大回数を増やす
import sys
sys.setrecursionlimit(1000000)

import math

def gcd(i, j):
    """
    2値 i, j の最大公約数を求める。
    """

    if j == 0:
        return i
    else:
        return gcd(j, i % j)

def factorize(n):
    """
    素因数分解した個数を返す
    """
    count = 1
    rep = math.ceil(math.sqrt(n))
    for i in range(2, rep + 1):
        if n % i != 0:
            continue
        else:
            count += 1
            while n % i == 0:
                n /= i
        if n == 1:
            return count
    if n != 1:
        count += 1
    return count

def main():
    a, b = map(int, input().split())

    #最大公約数を求める
    x = gcd(a, b)

    #最大公約数を素因数分解する
    count = factorize(x)

    #結果を出力する
    print(count)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import math
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

a, b = map(int, input().split())
count = 1
for i in range(1,min(a,b)+1):
    if a % i == 0 and b % i == 0:
        if is_prime(i) == True:
            count += 1

print(count)


Fixed submission:
# 再帰関数の最大回数を増やす
import sys
sys.setrecursionlimit(1000000)

import math

def gcd(i, j):
    """
    2値 i, j の最大公約数を求める。
    """

    if j == 0:
        return i
    else:
        return gcd(j, i % j)

def factorize(n):
    """
    素因数分解した個数を返す
    """
    count = 1
    rep = math.ceil(math.sqrt(n))
    for i in range(2, rep + 1):
        if n % i != 0:
            continue
        else:
            count += 1
            while n % i == 0:
                n /= i
        if n == 1:
            return count
    if n != 1:
        count += 1
    return count

def main():
    a, b = map(int, input().split())

    #最大公約数を求める
    x = gcd(a, b)

    #最大公約数を素因数分解する
    count = factorize(x)

    #結果を出力する
    print(count)

main()
Buggy python submission (verdict: Time Limit Exceeded):
def calc_half(n):
    return int(n /  2)

n, m = map(int, input().split())
a = list(map(int, input().split()))
a_half = list(map(calc_half, a))

for m_num in range(m):
    max_index = a.index(max(a))
    a[max_index] = a_half[max_index]
    a_half[max_index] = calc_half(a_half[max_index])

print(sum(a))


Fixed submission:
import heapq
def calc_Inversion(num):
    return num * -1

n, m = map(int, input().split())
a = list(map(calc_Inversion, list(map(int, input().split()))))

heapq.heapify(a)

for m_num in range(m):
    heapq.heappush(a, int(heapq.heappop(a) / 2))

print(sum(a) * -1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
max_count = 0
count = 0
for i in range(1, n):
    if h[i - 1] >= h[i]:
        count += 1
    else:
        if max_count < count:
            max_count = count
        count = 0
if max_count < count:
    max_count = count
print(max_count)

Fixed submission:
s = input()
t = input()
count = 0
for i in range(len(s)):
    if s[i] == t[i]:
        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
count = 0
for i in range(n):
    count += i
print(count)

Fixed submission:
n = int(input())
print(n * (n - 1) // 2)
Buggy python submission (verdict: Runtime Error):
3
500 300 200

Fixed submission:
import heapq

n = int(input())
v = list(map(int, input().split()))

heapq.heapify(v)
work = heapq.heappop(v)

for _ in range(n - 1):
    work += heapq.heappop(v)
    work /= 2

print(work)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = sorted(["".join(sorted((input()))) for i in range(n)])
count = 0

for j in range(n - 1):
    for k in range(j + 1, n):
        if s[j] == s[k]:
            count += 1

print(count)

Fixed submission:
from operator import itemgetter

n = int(input())
s = [sorted(input()) for _ in range(n)]

# 2次元配列の文字を、左から優先にソート
s_sort = sorted(s, key = itemgetter(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))

count = 0
s_count = 0

l = s_sort[0]

for i in range(1, n):
    if l == s_sort[i]:
        #同じ文字があるごとにカウントの数が増える（同じ文字が2つなら1個の組み合わせ、3つなら3つの組み合わせがある）
        s_count += 1
        count += s_count
    else:
        l = s_sort[i]
        s_count = 0

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n = int(input())
s = []
count = 0

for i in range(n):
    inp = sorted(input())
    s.append(inp)

for j in range(n - 1):
    for k in range(j + 1, n):
        if s[j] == s[k]:
            count += 1

print(count)

Fixed submission:
from operator import itemgetter

n = int(input())
s = [sorted(input()) for _ in range(n)]

# 2次元配列の文字を、左から優先にソート
s_sort = sorted(s, key = itemgetter(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))

count = 0
s_count = 0

l = s_sort[0]

for i in range(1, n):
    if l == s_sort[i]:
        #同じ文字があるごとにカウントの数が増える（同じ文字が2つなら1個の組み合わせ、3つなら3つの組み合わせがある）
        s_count += 1
        count += s_count
    else:
        l = s_sort[i]
        s_count = 0

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = []
count = 0

for i in range(n):
    inp = sorted(input())
    s.append(inp)

for j in range(n - 1):
    for k in range(j + 1, n):
        if s[j] == s[k]:
            count += 1
            
print(count)

Fixed submission:
from operator import itemgetter

n = int(input())
s = [sorted(input()) for _ in range(n)]

# 2次元配列の文字を、左から優先にソート
s_sort = sorted(s, key = itemgetter(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))

count = 0
s_count = 0

l = s_sort[0]

for i in range(1, n):
    if l == s_sort[i]:
        #同じ文字があるごとにカウントの数が増える（同じ文字が2つなら1個の組み合わせ、3つなら3つの組み合わせがある）
        s_count += 1
        count += s_count
    else:
        l = s_sort[i]
        s_count = 0

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
input = stdin.readline

N = int(input())
A = [int(input()) for _ in range(N)]

for i in range(N):
    if i == 0:
        print(max(A[1:N]))
    elif i == N -1:
        print(max(A[0:N-1]))
    else:
        print(max([max(A[0:i]), max(A[i+1:N])]))
    



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

N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A)
first = B[-1]
second = B[-2]

for i in range(N):
    if A[i] == first:
        print(second)
    else:
        print(first)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

# 解法メモ
# ひとつでも山の雨の量がわかれば全て求まる
# 3つの山があり、1つめの山の値をxとしたとき
# 1つめ: x
# 2つめ：A1 - x
# 3つめ：A2 - (A1 - x)
# 1つめ：A3 - (A2 - (A1 - x))
# 1つめ２つを式にする
# x = A3 - (A2 - (A1 - x))
# x = A3 - A2 + A1 - x
# 2x = A3 - A2 + A1
summary = 0

for i in range(N):
    if i % 2 == 0:
        summary += A[i]
    else:
        summary -= A[i]

for i in range(N):
    print(summary)
    summary = (A[i] - (summary//2)) * 2


Fixed submission:
N, A, B = map(int, input().split())

if A * N < B:
    B = A * N

print(B)
Buggy python submission (verdict: Runtime Error):
import numpy as np
L, R = map(int, input().split())

LR = np.arange(L, R+1, dtype="int64")
LR %= 2019
LR.sort

print(LR[0] * LR[1])


Fixed submission:
L, R = map(int, input().split())

R = min(R, L + 2019)
out = 2020
for i in range(L, R):
    for j in range(i + 1, R + 1):
        out = min(out, (i * j) % 2019)

print(out)

Buggy python submission (verdict: Runtime Error):
import numpy as np
L, R = map(int, input().split())

LR = np.arange(L, R+1, dtype="int")
LR %= 2019
LR.sort

print(LR[0] * LR[1])


Fixed submission:
L, R = map(int, input().split())

R = min(R, L + 2019)
out = 2020
for i in range(L, R):
    for j in range(i + 1, R + 1):
        out = min(out, (i * j) % 2019)

print(out)
Buggy python submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline


def chmax(a, b):
    """
    2値の大きい値を返す

    Args:
        a   (int)   : 値１
        b   (int)   : 値２
    Return:
        a   (int)   : aまたはbの大きい値
    """
    if a < b:
        a = b
    return a


def main():

    N, W = map(int, readline().split())

    # knopsock[n][0] = w    :   n = 品物の位置 , w = 重さ
    # knopsock[n][1] = v    :   n = 品物の位置 , v = 価値
    knapsack = [list(map(int, readline().split())) for _ in range(N)]

    # db[n][w] = v          :   w = 現在の重さ, n = 見てきた品物の数, v = 現在の価値
    dp = [[0] * (W + 1) for _ in range(N + 1)]

    for n in range(1, N + 1):
        for w in range(W + 1):
            if w - knapsack[n - 1][0] < 0:
                dp[n][w] = dp[n - 1][w]
            else:
                dp[n][w] = chmax(dp[n - 1][w], dp[n - 1]
                                 [w - knapsack[n - 1][0]] + knapsack[n - 1][1])

    print(dp[N][W])


if __name__ == "__main__":
    main()


Fixed submission:
# --------------------------------------
# 関数定義
# --------------------------------------


def chmin(a, b):
    if a > b:
        a = b
    return a

# --------------------------------------
# メイン処理
# --------------------------------------


def main():
    INF = 10 ** 10
    N = int(input())
    h = list(map(int, input().split()))

    dp = [INF] * N
    dp[0] = 0

    for i in range(1, N):
        dp[i] = chmin(dp[i], dp[i-1] + abs(h[i]-h[i-1]))
        if i >= 2:
            dp[i] = chmin(dp[i], dp[i-2] + abs(h[i]-h[i-2]))

    print(dp[N - 1])


# --------------------------------------
# 実行
# --------------------------------------
if __name__ == "__main__":
    main()