Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import itertools
import math 

a,b = map(int,input().split())

def divisor(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
"""
if is_prime(a) and is_prime(b):
    print(1)
    import sys
    sys.exit()
"""

a_L = divisor(a)
b_L = divisor(b)

kouyaku = set(a_L) & set(b_L)

new_L = []


for val in kouyaku:
    if is_prime(val):
        new_L.append(val)


new_L.append(1)
print(len(new_L))


Fixed submission:
n = int(input())

L = []

import sys
if n ==0:
    print(0.0)
    sys.exit()

for val in range(n+1):
    if val % 2 ==1:
        L.append(val)
print(len(L)/n)

Buggy python submission (verdict: Runtime Error):
import itertools
import math 

a,b = map(int,input().split())

def divisor(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
"""
if is_prime(a) and is_prime(b):
    print(1)
    import sys
    sys.exit()
"""

a_L = divisor(a)
b_L = divisor(b)

kouyaku = set(a_L) & set(b_L)

new_L = []


for val in kouyaku:
    if is_prime(val):
        new_L.append(val)


new_L.append(1)
print(len(new_L))


Fixed submission:
n = int(input())

L = []

import sys
if n ==0:
    print(0.0)
    sys.exit()

for val in range(n+1):
    if val % 2 ==1:
        L.append(val)
print(len(L)/n)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split(" ")))
list = [a.index(x)+1 for x in range(1, n+1)]
print(*list)

Fixed submission:
n = int(input())


a_L = list(map(int,input().split()))

d = {}

for val in range(n):
    d[val] = a_L[val]

#print(d)
ans = sorted(d.items(),key=lambda x:x[1])
#print(ans)

ans_L = []

for val in ans:
    ans_L.append(str(val[0]+1))

print(" ".join(ans_L))
Buggy python submission (verdict: Runtime Error):
import heapq

n,m = map(int,input().split())
a_L = list(map(lambda x:int(x) * -1,input().split()))

q = heapq.heapify(a_L)


for val in range(0,m):
    a_min = heapq.heappop(q)
    a_min = (-1 * a_min)//2 * -1
    heapq.heappush(q,a_min)
    print(a_L)

print(-sum(q))


Fixed submission:
import heapq

n,m = map(int,input().split())
a_L = list(map(lambda x:int(x) * -1,input().split()))

heapq.heapify(a_L)
#a_L = list(sorted(a_L))
#max_num = a_L[0]
#a_L.append(max_num)

for val in range(0,m):
    a_min = heapq.heappop(a_L)
    a_min = (-1 * a_min)//2 * -1
    heapq.heappush(a_L,a_min)

print(-sum(a_L))

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

#a_L = list(sorted(a_L))
#max_num = a_L[0]
#a_L.append(max_num)

for val in range(0,m):
    a_L = list(sorted(a_L))
    a_L[-1] = a_L[-1] //2

print(sum(a_L))



Fixed submission:
import heapq

n,m = map(int,input().split())
a_L = list(map(lambda x:int(x) * -1,input().split()))

heapq.heapify(a_L)
#a_L = list(sorted(a_L))
#max_num = a_L[0]
#a_L.append(max_num)

for val in range(0,m):
    a_min = heapq.heappop(a_L)
    a_min = (-1 * a_min)//2 * -1
    heapq.heappush(a_L,a_min)

print(-sum(a_L))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# 整数の入力
masu_size = int(input())
# スペース区切りの整数の入力
takasa_L = list(map(int, input().split()))
# 文字列の入力

counter_L = []
for m in range(0,masu_size):
    #print(m)
    counter = 0

    for h in range(m,masu_size):
        try:
            diff = takasa_L[h] - takasa_L[h+1]
        except:
            counter_L.append(counter)
            break
        if diff >= 0:
            counter +=1
        else:
            counter_L.append(counter)
            break

print(max(counter_L))


Fixed submission:
import copy
n = int(input())
r_L = list(map(int,input().split()))
l_L = copy.deepcopy(r_L)
l_L.reverse()


r_ans,l_ans = 0,0
r_ans_L,l_ans_L = [],[]

for val in range(n-1):
    if r_L[val] >= r_L[val+1]:
        r_ans += 1
    else:
        r_ans_L.append(r_ans)
        r_ans = 0
    



l_ans_L.append(l_ans)
r_ans_L.append(r_ans)

print(max(max(l_ans_L),max(r_ans_L)))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# 整数の入力
masu_size = int(input())
# スペース区切りの整数の入力
takasa_L = list(map(int, input().split()))
# 文字列の入力

counter_L = []
for m in range(0,masu_size):
    #print(m)
    counter = 0

    for h in range(m,masu_size):
        try:
            diff = takasa_L[h] - takasa_L[h+1]
        except:
            counter_L.append(counter)
            break
        if diff >= 0:
            counter +=1
        else:
            counter_L.append(counter)
            break

print(max(counter_L))


Fixed submission:
import copy
n = int(input())
r_L = list(map(int,input().split()))
l_L = copy.deepcopy(r_L)
l_L.reverse()


r_ans,l_ans = 0,0
r_ans_L,l_ans_L = [],[]

for val in range(n-1):
    if r_L[val] >= r_L[val+1]:
        r_ans += 1
    else:
        r_ans_L.append(r_ans)
        r_ans = 0
    



l_ans_L.append(l_ans)
r_ans_L.append(r_ans)

print(max(max(l_ans_L),max(r_ans_L)))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# 整数の入力
masu_size = int(input())
# スペース区切りの整数の入力
takasa_L = list(map(int, input().split()))
# 文字列の入力

counter_L = []
for m in range(0,masu_size):
    #print(m)
    counter = 0

    for h in range(m,masu_size):
        now_h = takasa_L[h]
        try:
            next_h = takasa_L[h+1]
        except:
            counter_L.append(counter)
            break
        #print(now_h,next_h)
        if now_h >= next_h:
            counter += 1
        else:
            counter_L.append(counter)
            break

print(max(counter_L))

Fixed submission:
import copy
n = int(input())
r_L = list(map(int,input().split()))
l_L = copy.deepcopy(r_L)
l_L.reverse()


r_ans,l_ans = 0,0
r_ans_L,l_ans_L = [],[]

for val in range(n-1):
    if r_L[val] >= r_L[val+1]:
        r_ans += 1
    else:
        r_ans_L.append(r_ans)
        r_ans = 0
    



l_ans_L.append(l_ans)
r_ans_L.append(r_ans)

print(max(max(l_ans_L),max(r_ans_L)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_L = list(range(1,n+1))
a_L.pop()

print(sum(a_L))


Fixed submission:
n = int(input())
print(n*(n-1)//2)
Buggy python submission (verdict: Runtime Error):
s = input()
a_L = deque([val for val in s])

div_L = [""]
moji = ""

counter = 0

while a_L:
    tmp = a_L.popleft()
    moji += tmp
    if moji !=  div_L[counter]:
        div_L.append(moji)
        moji = ""
        counter += 1

print(len(div_L)-1)


Fixed submission:
from collections import deque
s = input()
a_L = deque([val for val in s])

div_L = [""]
moji = ""

counter = 0

while a_L:
    tmp = a_L.popleft()
    moji += tmp
    if moji !=  div_L[counter]:
        div_L.append(moji)
        moji = ""
        counter += 1

print(len(div_L)-1)
Buggy python submission (verdict: Runtime Error):
import collections
from scipy.special import comb

n = int(input())
str_L = []

for val in range(n):
    s = input()
    s_L = [i for i in s]
    s_L.sort()
    s = "".join(s_L)
    str_L.append(s)


c = collections.Counter(str_L)

str_L = list(set(str_L))


ans = 0
r = 2

for val in str_L:
    n = c[val]
    ans = ans + comb(n, r, exact=True)

print(ans)


Fixed submission:
import collections
import math

n = int(input())
str_L = []

for val in range(n):
    s = input()
    s_L = [i for i in s]
    s_L.sort()
    s = "".join(s_L)
    str_L.append(s)


c = collections.Counter(str_L)

str_L = list(set(str_L))


ans = 0
r = 2

def combinations_count(n, r):
    try:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    except:
        return 0

for val in str_L:
    n = c[val]
    #print(n,r)
    ans = ans + combinations_count(n,r) #comb(n, r, exact=True)

print(ans)

Buggy python submission (verdict: Runtime Error):
import collections
from scipy.special import comb

n = int(input())
str_L = []

for val in range(n):
    s = input()
    s_L = [i for i in s]
    s_L.sort()
    s = "".join(s_L)
    str_L.append(s)


c = collections.Counter(str_L)

str_L = list(set(str_L))


ans = 0
r = 2

for val in str_L:
    n = c[val]
    ans = ans + comb(n, r, exact=True)

print(ans)


Fixed submission:
import collections
import math

n = int(input())
str_L = []

for val in range(n):
    s = input()
    s_L = [i for i in s]
    s_L.sort()
    s = "".join(s_L)
    str_L.append(s)


c = collections.Counter(str_L)

str_L = list(set(str_L))


ans = 0
r = 2

def combinations_count(n, r):
    try:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    except:
        return 0

for val in str_L:
    n = c[val]
    #print(n,r)
    ans = ans + combinations_count(n,r) #comb(n, r, exact=True)

print(ans)

Buggy python submission (verdict: Runtime Error):
import collections
from scipy.special import comb

n = int(input())
str_L = []

for val in range(n):
    s = input()
    s_L = [i for i in s]
    s_L.sort()
    s = "".join(s_L)
    str_L.append(s)

print(str_L)

c = collections.Counter(str_L)
print(c)

str_L = list(set(str_L))


ans = 0
r = 2

for val in str_L:
    n = c[val]
    ans = ans + comb(n, r, exact=True)

print(ans)


Fixed submission:
import collections
import math

n = int(input())
str_L = []

for val in range(n):
    s = input()
    s_L = [i for i in s]
    s_L.sort()
    s = "".join(s_L)
    str_L.append(s)


c = collections.Counter(str_L)

str_L = list(set(str_L))


ans = 0
r = 2

def combinations_count(n, r):
    try:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    except:
        return 0

for val in str_L:
    n = c[val]
    #print(n,r)
    ans = ans + combinations_count(n,r) #comb(n, r, exact=True)

print(ans)
Buggy python submission (verdict: Runtime Error):
s = int(input())

# (0,0),(0,x),(x,y)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

yakusu = make_divisors(s)[1]


print(0,0,int(s/yakusu),0,0,int(yakusu))

Fixed submission:
S = int(input())
X1, Y1, X2, Y2 = 0, 0, 10**9, 1
shou, amari = divmod(S, 10**9)
 
if amari == 0:
    Y3 = shou
    X3 = 0
else:
    Y3 = shou + 1
    X3 = -(amari - 10**9)
 
print(X1, Y1, X2, Y2, X3, Y3)

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

# (0,0),(0,x),(x,y)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

yakusu = make_divisors(s)[1]


print(0,0,int(s/yakusu),0,0,int(yakusu))


Fixed submission:
S = int(input())
X1, Y1, X2, Y2 = 0, 0, 10**9, 1
shou, amari = divmod(S, 10**9)
 
if amari == 0:
    Y3 = shou
    X3 = 0
else:
    Y3 = shou + 1
    X3 = -(amari - 10**9)
 
print(X1, Y1, X2, Y2, X3, Y3)

Buggy python submission (verdict: Time Limit Exceeded):
import sys

s = int(input())

# (0,0),(0,x),(x,y)

for val in range(1,10**9):
    if (s/val < 10**9) and s%val==0 :
        print(0,0,val,0,0,int(s/val))
        sys.exit(0)


Fixed submission:
S = int(input())
X1, Y1, X2, Y2 = 0, 0, 10**9, 1
shou, amari = divmod(S, 10**9)
 
if amari == 0:
    Y3 = shou
    X3 = 0
else:
    Y3 = shou + 1
    X3 = -(amari - 10**9)
 
print(X1, Y1, X2, Y2, X3, Y3)
Buggy python submission (verdict: Runtime Error):
l,r = map(int,input().split())


from itertools import combinations

A = list(range(l,r+1))

ans_L = [i[0]*i[1]%2019 for i in combinations(A,2)]
print(sorted(ans_L)[0])

Fixed submission:
from itertools import combinations
import sys

l,r = map(int,input().split())

if r-l> 2019:
    print(0)
    sys.exit(0)

A = list(range(l,r+1))

ans_L = [i[0]*i[1]%2019 for i in combinations(A,2)]
print(sorted(ans_L)[0])
Buggy python submission (verdict: Runtime Error):
import copy

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

n_L = list(range(n))
a_L = list(map(lambda x:l+x,n_L))
# out of rangeを防ぐため
a_L.append(0)

allsum = sum(a_L)

result_L = []


diff = abs(allsum-sum(a_L[1:]))

for val in range(n):
    b_L = copy.copy(a_L)
    b_L.pop(val)
    temp_sum = sum(b_L)

    if abs(allsum-temp_sum) <= diff:
        result = temp_sum
    diff = abs(allsum-temp_sum)

print(result)


Fixed submission:
s = input()
 
tmp = ""
for val in s:
  if tmp == val:
    print("Bad")
    import sys
    sys.exit(0)
  tmp = val
 
print("Good")

Buggy python submission (verdict: Runtime Error):
s = input()

tmp = ""
for val in s:
  if tmp == val:
    print("Bad")
    import sys.exit(0)
  tmp = val

print("Good")

Fixed submission:
s = input()
 
tmp = ""
for val in s:
  if tmp == val:
    print("Bad")
    import sys
    sys.exit(0)
  tmp = val
 
print("Good")
Buggy python submission (verdict: Time Limit Exceeded):
# 多分TLRE
a,b,c,d = map(int,input().split())

ans_L = []
for val in range(a,b+1):
    if val % c !=0 and val % d!=0:
        ans_L.append(val)
print(len(ans_L))


Fixed submission:
import fractions
A,B,C,D=map(int,input().split())
A-=1
f=fractions.gcd(C,D)
f2=C*D//f
ans = B-A-(B//C-A//C+B//D-A//D-B//f2+A//f2)
print(ans)
Buggy python submission (verdict: Runtime Error):
w,h,x,y = map(int,input().split())

print(w*h/2)
if x == w/2 and y == h/2:
        print(1)
else:
        print(0)


Fixed submission:
x,a = map(int,input().split(" "))

if x < a:
    print(0)
else:
    print(10)

Buggy python submission (verdict: Runtime Error):
import sys

n,x = map(int,input().split())
n = n+1

l_L = list(map(int,input().split()))


counter = 0
next_jump = 0
for val in range(0,n):
    #if next_jump <= x:
    if next_jump < x:
        next_jump = next_jump + l_L[val-1]
        counter += 1
    else:
        print(counter)
        sys.exit(0)

Fixed submission:
x,a = map(int,input().split(" "))

if x < a:
    print(0)
else:
    print(10)
Buggy python submission (verdict: Runtime Error):
import sys

n,x = map(int,input().split())
n = n+1

l_L = list(map(int,input().split()))


counter = 0
next_jump = 0
for val in range(1,n+1):
    if next_jump <= x:
        next_jump = next_jump + l_L[val-1]
        counter += 1
    else:
        print(counter)
        sys.exit(0)
print(counter)

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

d = 0
counter = 1
for val in range(n):
    d = d + L[val]
    if d <= x:
        counter +=1

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

tmp = set()

for val in range(m):
    l,r = map(int,input().split())
    tmp = set(list(range(l,r+1)))
    if val ==0:
        seki = tmp
    else:
        seki = seki & tmp

print(len(list(seki)))


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

l_L,r_L = [],[]

for val in range(m):
    l,r = map(int,input().split())

    l_L.append(l)
    r_L.append(r)

r = min(r_L)
l = max(l_L)

if r-l >= 0:
    print(r-l+1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
n,k= map(int,input().split())
s = input()

s = [val for val in s]

s[k]=s[k].lower()

print("".join(s))


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

s = [val for val in s]

s[k-1]=s[k-1].lower()

print("".join(s))
Buggy python submission (verdict: Runtime Error):
import math

n,k = map(int,input().split())

ans = 0
for val in range(1,n+1):
    #print(val,",",math.log2(k)-math.log2(val))
    x = math.ceil(math.log2(k)-math.log2(val))
    ans = ans + 1/n * (1/2)**x 
print(ans)


Fixed submission:
import math

n, k = map( int, input().split())
 
ans = 0
for i in range(1, n + 1):
  a = max( 0 , math.ceil(math.log( k / i, 2 )))
  ans += ( 1 / n ) * ( 0.5 ** a )
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
L = ["A","C","G","T"]

counter = 0
ans_L = []
for val in s:
    if val in L:
        counter += 1
    else:
        ans_L.append(counter)
        counter = 0

print(max(ans_L))

Fixed submission:
s = input()
L = ["A","C","G","T"]

counter = 0
ans_L = []
for val in s:
    if val in L:
        counter += 1
    else:
        ans_L.append(counter)
        counter = 0
ans_L.append(counter)

print(max(ans_L))

Buggy python submission (verdict: Runtime Error):
s = input()
L = ["A","C","G","T"]

counter = 0
ans_L = []
for val in s:
    if val in L:
        counter += 1
    else:
        ans_L.append(counter)
        counter = 0

print(max(ans_L))

Fixed submission:
s = input()
L = ["A","C","G","T"]

counter = 0
ans_L = []
for val in s:
    if val in L:
        counter += 1
    else:
        ans_L.append(counter)
        counter = 0
ans_L.append(counter)

print(max(ans_L))
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()

l_L,r_L = [],[]

for val in range(q):
    l,r = map(int,input().split())
    l_L.append(l-1)
    r_L.append(r-1)

s = list(s)
s.append(" ")

for val in range(n+1):
    if s[val] == "A" and s[val+1] == "C":
        s[val] = "*"


for val in range(q):
    tmp = s[l_L[val]:r_L[val]]
    print(tmp.count("*"))

Fixed submission:
N,Q = map(int,input().split())
s = input()

t = [0] * (N +1)


for i in range(N):
    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: Runtime Error):
n,m = map(int,input().split())

dic,new_dic = {},{}
for val in range(n):
    a,b = map(int,input().split())
    dic[a] = b

dic = sorted(dic.items(),key=lambda x:x[0])

for val in dic:
    new_dic[val[0]] = val[1]

ans = 0

print(new_dic)

for k,v in new_dic.items():
    if m - v > 0:
        ans += k*v

    elif m - v <=s 0:
        ans += k*m
        print(ans)
        exit()

    m = m-v

print(ans)


Fixed submission:
N, M = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]

#print(AB)
rest = M
ans = 0
for a, b in sorted(AB, key=lambda x: x[0]):
	
    if (b < rest):
        ans += a*b
        rest -= b
    else:
        ans += (a*rest)
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int,input().split())

ans = []
for val in range(1,101):
    if val % a == 0 and val %b ==0:
        ans.append(val)

print(ans[k+1])

Fixed submission:
a,b,k = map(int,input().split())

ans = []
for val in range(1,min(a,b)+1):
    #print(val)
    if a % val == 0 and b % val ==0:
        ans.append(val)
        #print(val)

print(ans[-k])
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())

if a%b==0:
    print(a+b)
else:
    print(a-b)

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

if b%a==0:
    print(a+b)
else:
    print(b-a)
Buggy python submission (verdict: Runtime Error):
n = list(input())
s_L = list(map(int,input().split())

s_L = list(sorted(s_L,reverse=True))
if s_L[0] < sum(s_L[1:]):
    print("Yes")
else:
    print("No")

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

s_L = list(sorted(s_L,reverse=True))
if s_L[0] < sum(s_L[1:]):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = list(input())
s_L = list(map(int,input().split())

s_L = sorted(s_L,reverse=True)
if s_L[0] < sum(s_L[1:]):
    print("Yes")
else:
    print("No")

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

s_L = list(sorted(s_L,reverse=True))
if s_L[0] < sum(s_L[1:]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
s = int(input())
 
t = [False] * 1000001
i = 1
while True:
  if t[s] == True:
    break
  t[s] = True
  i += 1
  if s % 2 == 0:
    s = s // 2
  else:
    s = 3 * s + 1
 
print(i)

Fixed submission:
a,b,c = map(int,input().split())
print(int(a*b/2))
Buggy python submission (verdict: Runtime Error):
n = int(input())
h_L = list(map(int,input().split()))

counter = 0


while h_L != []:

    for i in range(n):
        if h_L[i] == 0:
            counter += 1
            break
        else:
            h_L[i] -= 1

    if h_L[0] == 0:
        h_L.pop(0)

print(counter-1)

Fixed submission:
import sys
sys.setrecursionlimit(20000)

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

counter = 0


def devzero(l,moji=0):
    return_L,tmp = [],[]
    for val in l:
        if val != moji:
            tmp.append(val)
            #print(tmp)
        elif val == moji:
            return_L.append(tmp)
            tmp = []
    return_L.append(tmp)

    return return_L

def rec(L):
    global counter

    if L == []:
        return
    if 0 not in L:
        L = [i-1 for i in L]
        counter += 1
    L = devzero(L,moji=0)
    for val in L:
        rec(val)

if __name__=="__main__":
    rec(h_L)
    print(counter)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h_L = list(map(int,input().split()))

#dp = [float("inf")] * (10**4 + 1)
dp = [10**8] * 20

dp[0] = 0
dp[1] = abs(h_L[0]-h_L[1])

for i in range(2,n):
    #dp[i]
    # 1
    tmp1 = dp[i-1] + abs(h_L[i-1] - h_L[i])
    dp[i] = min(dp[i],tmp1)
    # 2
    tmp2 = dp[i-2] + abs(h_L[i-2] - h_L[i])
    dp[i] = min(dp[i],tmp2)
#print(dp)
print(dp[len(h_L)-1])

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

dp = [10**9] * n
dp[0] = 0
dp[1] = abs(h_L[1] - h_L[0])

for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(h_L[i-1] - h_L[i]),dp[i-2]+abs(h_L[i-2] - h_L[i]))

print(dp[n-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
h_L = list(map(int,input().split()))

#dp = [float("inf")] * (10**4 + 1)
dp = [float("inf")] * 20

dp[0] = 0
dp[1] = abs(h_L[0]-h_L[1])

for i in range(2,n):
    #dp[i]
    # 1
    tmp1 = dp[i-1] + abs(h_L[i-1] - h_L[i])
    dp[i] = min(dp[i],tmp1)
    # 2
    tmp2 = dp[i-2] + abs(h_L[i-2] - h_L[i])
    dp[i] = min(dp[i],tmp2)
#print(dp)
print(dp[len(h_L)-1])

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

dp = [10**9] * n
dp[0] = 0
dp[1] = abs(h_L[1] - h_L[0])

for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(h_L[i-1] - h_L[i]),dp[i-2]+abs(h_L[i-2] - h_L[i]))

print(dp[n-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
h_L = list(map(int,input().split()))

#dp = [float("inf")] * (10**4 + 1)
dp = [float("inf")] * 20

dp[0] = 0
dp[1] = abs(h_L[0]-h_L[1])

for i in range(1,len(h_L)):
    #dp[i]
    # 1
    tmp1 = dp[i-1] + abs(h_L[i-1] - h_L[i])
    dp[i] = min(dp[i],tmp1)
    # 2
    tmp2 = dp[i-2] + abs(h_L[i-2] - h_L[i])
    dp[i] = min(dp[i],tmp2)
#print(dp)
print(dp[len(h_L)-1])

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

dp = [10**9] * n
dp[0] = 0
dp[1] = abs(h_L[1] - h_L[0])

for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(h_L[i-1] - h_L[i]),dp[i-2]+abs(h_L[i-2] - h_L[i]))

print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h_L = list(map(int,input().split()))


dp = [float("inf")] * (20)
#dp = [float("inf")] * (10**5 + 1)
dp[0] = 0

for i in range(n):
    for j in range(1,k+1):
        #print(j,i+j)
        # i=1,j=1
        if i - j < 0:
            continue
        dp[i] = min(dp[i],dp[i-j]+abs(h_L[i] - h_L[i-j]))
        #print(i,j)
        #print(dp)

print(dp[n-1])

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


#dp = [float("inf")] * (20)
dp = [float("inf")] * (10**5 + 1)
dp[0] = 0

for i in range(n):
    for j in range(1,k+1):
        #print(j,i+j)
        # i=1,j=1
        if i - j < 0:
            continue
        dp[i] = min(dp[i],dp[i-j]+abs(h_L[i] - h_L[i-j]))
        #print(i,j)
        #print(dp)

print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
import fractions
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
    ans = fractions.gcd(ans, a[i])
print(ans)


Fixed submission:
n = int(input())
a_L = []
for val in range(n):
    a_L.append(int(input()))

a_L = sorted(a_L,reverse=True)
a_L[0] /=2
print(int(sum(a_L)))