Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
 
import functools
 
MOD = 1000000007
fact = []
 
def main():
    h, w, a, b = map(int, input().split())
    init_fact(200000, MOD)
    mp = get_list_middle_points(h, w, a, b)
    res = 0
    for y, x in mp:
        res += count(1, 1, x, y) * count(x, y, w, h)
        res %= MOD
    print(res)
 
def count(x1, y1, x2, y2):
    dx = abs(x1 - x2)
    dy = abs(y1 - y2)
    count = combi(dx + dy, dx, MOD)
    return count
 
def get_list_middle_points(h, w, a, b):
    li = []
    y = h - a
    x = b + 1
    while (y >= 1 and x <= w):
        li.append((y, x))
        y -= 1
        x += 1
    return li
 
def combi(n, k, mod):
    numera = fact[n]
    denomi = (fact[n - k] * fact[k]) % mod
    return (numera * inv(denomi, mod)) % mod
 
def init_fact(maxn, mod):
    assert len(fact) == 0
    fact.append(1)
    for i in range(1, maxn + 1):
        fact.append((fact[i - 1] * i) % mod)
 
def inv(n, mod):
    return pow(n, mod - 2, mod)
 
def pow(n, p, mod):
    if p == 0:
        return 1
    elif p % 2 == 0:
        x = pow(n, p // 2, mod)
        return (x * x) % mod
    else:
        x = pow(n, p - 1, mod)
        return (x * n) % mod
 
main()

Fixed submission:
#!/usr/bin/env python3

def main():
    n, k = map(int, input().split())
    dk = list(map(int, input().split()))
    assert len(dk) == k

    us = set(usable(dk))
    print(form(us, n))

def form(us, n):
    for res in range(n, 10 ** 5):
        fla = True
        for c in str(res):
            if int(c) not in us:
                fla = False
                break
        if fla:
            return res
    raise Exception

def usable(dk):
    res = []
    for i in range(10):
        if i not in dk:
            res.append(i)
    return res

main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

import functools

MOD = 1000000007
fact = []

def main():
    h, w, a, b = map(int, input().split())
    init_fact(200000, MOD)
    mp = get_list_middle_points(h, w, a, b)
    res = 0
    for y, x in mp:
        res += count(1, 1, x, y) * count(x, y, w, h)
        res %= MOD
    print(res)

def count(x1, y1, x2, y2):
    dx = abs(x1 - x2)
    dy = abs(y1 - y2)
    count = combi(dx + dy, dx, MOD)
    return count

def get_list_middle_points(h, w, a, b):
    li = []
    y = h - a
    x = b + 1
    while (y >= 1 and x <= w):
        li.append((y, x))
        y -= 1
        x += 1
    return li

def combi(n, k, mod):
    numera = fact[n]
    denomi = (fact[n - k] * fact[k]) % mod
    return (numera * inv(denomi, mod)) % mod

def init_fact(maxn, mod):
    assert len(fact) == 0
    fact.append(1)
    for i in range(1, maxn + 1):
        fact.append((fact[i - 1] * i) % mod)

def inv(n, mod):
    return pow(n, mod - 2, mod)

def pow(n, p, mod):
    if p == 0:
        return 1
    elif p % 2 == 0:
        x = pow(n, p // 2, mod)
        return (x * x) % mod
    else:
        x = pow(n, p - 1, mod)
        return (x * n) % mod

main()


Fixed submission:
#!/usr/bin/env python3
 
import functools
 
MOD = 1000000007
fact = []
 
def main():
    h, w, a, b = map(int, input().split())
    init_fact(200000, MOD)
    mp = get_list_middle_points(h, w, a, b)
    res = 0
    for y, x in mp:
        res += count(1, 1, x, y) * count(x, y, w, h)
        res %= MOD
    print(res)
 
def count(x1, y1, x2, y2):
    dx = abs(x1 - x2)
    dy = abs(y1 - y2)
    count = combi(dx + dy, dx, MOD)
    return count
 
def get_list_middle_points(h, w, a, b):
    li = []
    y = h - a
    x = b + 1
    while (y >= 1 and x <= w):
        li.append((y, x))
        y -= 1
        x += 1
    return li
 
def combi(n, k, mod):
    numera = fact[n]
    denomi = (fact[n - k] * fact[k]) % mod
    return (numera * inv(denomi, mod)) % mod
 
def init_fact(maxn, mod):
    assert len(fact) == 0
    fact.append(1)
    for i in range(1, maxn + 1):
        fact.append((fact[i - 1] * i) % mod)
 
def inv(n, mod):
    return pow(n, mod - 2, mod)
 
def pow(n, p, mod):
    if p == 0:
        return 1
    elif p % 2 == 0:
        x = pow(n, p // 2, mod)
        return (x * x) % mod
    else:
        x = pow(n, p - 1, mod)
        return (x * n) % mod
 
main()
Buggy python submission (verdict: Runtime Error):
N,K,Q = map(int,input().split(" "))
a=[]
a2={}

for i in range(Q):
  a.append(input())
  
for i in range(N):
  a2[i+1] = a.count(str(i+1))

for i in range(N):
  if a2[i+1] >= Q-K+1:
    print("Yes")
  else:
    print("No")

Fixed submission:
a = ["Sunny","Cloudy","Rainy"]

def f():
  S = input() 
  return a[(a.index(S) + 1) % 3]

print(f())

Buggy python submission (verdict: Runtime Error):
N,K,Q = map(int,input().split(" "))
a=[]
a2={}

for i in range(Q):
  a.append(input())
  
for i in range(N):
  a2[i+1] = a.count(str(i+1))

for i in range(N):
  if a2[i+1] >= Q-K+1:
    print("Yes")
  else:
    print("No")

Fixed submission:
a = ["Sunny","Cloudy","Rainy"]

def f():
  S = input() 
  return a[(a.index(S) + 1) % 3]

print(f())
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split(" "))
a=[]
a2={}

for i in range(Q):
  a.append(input())
  
for i in range(N):
  a2[i+1] = a.count(str(i+1))

for i in range(N):
  if a2[i+1] >= Q-K+1:
    print("Yes")
  else:
    print("No")

Fixed submission:
N,K,Q = map(int,input().split(" "))
a2={}
for i in range(Q):
  j = input()
  if j not in a2:
    a2[j] = 1
  else:
    a2[j] += 1
    
for i in range(N):
  if str(i+1) not in a2:
    a2[str(i+1)] = 0
  if a2[str(i+1)] >= Q-K+1:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split(" "))
#正解者のリスト、正解順
a=[]
#番号：正解数
a2={}

for i in range(Q):
  a.append(input())
  
#参加者の得点リスト、順番に並んでる
b = []

for i in range(N):
  b.append(0)

  
for i in range(N):
  a2[i+1] = a.count(str(i+1))

for i in range(N):
  if a2[i+1] >= Q-K+1:
    print("Yes")
  else:
    print("No")

Fixed submission:
N,K,Q = map(int,input().split(" "))
a2={}
for i in range(Q):
  j = input()
  if j not in a2:
    a2[j] = 1
  else:
    a2[j] += 1
    
for i in range(N):
  if str(i+1) not in a2:
    a2[str(i+1)] = 0
  if a2[str(i+1)] >= Q-K+1:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
from collections import Counter
x,n = map(int,input().split())
p = list(map(int,input().split()))

num_list = list(range(1,101))
y = (num_list + p)

counter = Counter(y)
result =  [elem for elem in y if counter[elem] < 2]


ans = 10 *100000000000

for i in result:
    temp = abs(i - x)
    if ans > temp:
        ans = temp
        res = i
print(res)


Fixed submission:
from collections import Counter
x,n = map(int,input().split())
p = list(map(int,input().split()))

num_list = list(range(-200,201))
y = (num_list + p)

counter = Counter(y)
result =  [elem for elem in y if counter[elem] < 2]


ans = 10 *100000000000

for i in result:
    temp = abs(i - x)
    if ans > temp:
        ans = temp
        res = i
print(res)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
x,n = map(int,input().split())
p = list(map(int,input().split()))

num_list = list(range(1,101))
y = (num_list + p)

counter = Counter(y)
result =  [elem for elem in y if counter[elem] < 2]


ans = 10 *100000000000

for i in result:
    temp = abs(i - x)
    if ans >= temp:
        ans = temp
        res = i
print(res)


Fixed submission:
from collections import Counter
x,n = map(int,input().split())
p = list(map(int,input().split()))

num_list = list(range(-200,201))
y = (num_list + p)

counter = Counter(y)
result =  [elem for elem in y if counter[elem] < 2]


ans = 10 *100000000000

for i in result:
    temp = abs(i - x)
    if ans > temp:
        ans = temp
        res = i
print(res)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
x,n = map(int,input().split())
p = list(map(int,input().split()))

num_list = list(range(1,101))
y = (num_list + p)

counter = Counter(y)
result =  [elem for elem in y if counter[elem] < 2]
#print(result)

ans = 10 *100000000000

for i in result:
    temp = abs(i - x)
    if ans > temp:
        ans = temp
        res = i
print(res)


Fixed submission:
from collections import Counter
x,n = map(int,input().split())
p = list(map(int,input().split()))

num_list = list(range(-200,201))
y = (num_list + p)

counter = Counter(y)
result =  [elem for elem in y if counter[elem] < 2]


ans = 10 *100000000000

for i in result:
    temp = abs(i - x)
    if ans > temp:
        ans = temp
        res = i
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
#import numpy as np
import math
n = int(input())
a= list(map(int,input().split()))

ans = a[0]

for i in range(1,n):
    if a[i] == 0:
        print("0")
        exit()
    elif a[i] > 10**18:
        print("-1")
        exit()
    else:
        ans *= a[i]

if ans > 10**18:
    ans = -1
print(ans)
    
    

Fixed submission:
#import numpy as np
import math
n = int(input())
a= list(map(int,input().split()))
a.sort(reverse=1)

ans = a[0]

for i in range(1,n):
    if a[-1] == 0:
        print("0")
        exit()
    elif a[i] > 10**18:
        print("-1")
        exit()
    elif ans > 10**18:
        print("-1")
        exit()
    else:
        ans *= a[i]

if ans > 10**18:
    ans = -1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a= list(map(int,input().split()))

ans = a[0]

for i in range(1,n):
    if a[i] == 0:
        print("0")
        exit()
    else:
        ans *= a[i]

if ans > 10**18:
    ans = -1
print(ans)
    
    

Fixed submission:
#import numpy as np
import math
n = int(input())
a= list(map(int,input().split()))
a.sort(reverse=1)

ans = a[0]

for i in range(1,n):
    if a[-1] == 0:
        print("0")
        exit()
    elif a[i] > 10**18:
        print("-1")
        exit()
    elif ans > 10**18:
        print("-1")
        exit()
    else:
        ans *= a[i]

if ans > 10**18:
    ans = -1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
a= list(map(int,input().split()))
import functools
import operator

x = functools.partial(functools.reduce, operator.mul)
ans = x(a)
if ans > 10 ** 18:
    ans = -1

print(ans)


Fixed submission:
#import numpy as np
import math
n = int(input())
a= list(map(int,input().split()))
a.sort(reverse=1)

ans = a[0]

for i in range(1,n):
    if a[-1] == 0:
        print("0")
        exit()
    elif a[i] > 10**18:
        print("-1")
        exit()
    elif ans > 10**18:
        print("-1")
        exit()
    else:
        ans *= a[i]

if ans > 10**18:
    ans = -1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split()) #n任 k種類
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))


sunuke =[0] * n
for i in range(n-1):
    #print("d[i]",d[i])
    for j in range(int(d[i])):
        temp = a[i][j] -1 
        sunuke[temp] += 1

print(sunuke.count(0))



Fixed submission:
n,k = map(int,input().split()) #n任 k種類
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))


sunuke =[0] * n
for i in range(k):
    #print("d[i]",d[i])
    for j in range(int(d[i])):
        temp = a[i][j] -1 
        sunuke[temp] += 1

#print(sunuke)
print(sunuke.count(0))
Buggy python submission (verdict: Time Limit Exceeded):

import math
x = int(input())

a = math.floor(x ** (1/5)) 

b = -1
while True:
    if a**5 -b**5 == x:
        break
    b = abs(b+1)

print(a,b)



Fixed submission:
x = int(input())


for i in range(-500,500):
    for j in range(-500,500):
        if x == i**5 - j ** 5:
            print(i,j)
            exit()

Buggy python submission (verdict: Runtime Error):

x = int(input())

a = math.floor(x ** (1/5)) 

b = -1
while True:
    if a**5 -b**5 == x:
        break
    b = abs(b+1)

print(a,b)



Fixed submission:
x = int(input())


for i in range(-500,500):
    for j in range(-500,500):
        if x == i**5 - j ** 5:
            print(i,j)
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = map(int,input().split())

x = 0
now = 0
result = 0

    

for i in range(n+1):
    if x > b:
        break
    x = i
    now = (((a * x)//b)) - (a * (x//b))
    #now = math.ceil(((a * x)/b)) - (a * math.ceil(x/b))
    #print("now=",now,"x=",x)
    #print(result,now)
    result = max(result,now)

print(result)
    



Fixed submission:

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

x = min(b-1,n)

print((((a * x)//b)) )

Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = map(int,input().split())

x = 0
now = 0
result = 0
for i in range(n+1):
    x = i
    if x >b:
        continue
    now = (((a * x)//b)) - (a * (x//b))
    #now = math.ceil(((a * x)/b)) - (a * math.ceil(x/b))
    #print("now=",now,"x=",x)
    #print(result,now)
    result = max(result,now)

print(result)
    



Fixed submission:

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

x = min(b-1,n)

print((((a * x)//b)) )

Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = map(int,input().split())

x = 0
now = 0
result = 0
for i in range(n+1):
    x = i
    now = (((a * x)//b)) - (a * (x//b))
    #now = math.ceil(((a * x)/b)) - (a * math.ceil(x/b))
    #print("now=",now,"x=",x)
   
    result = max(result,now)

print(result)
    



Fixed submission:

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

x = min(b-1,n)

print((((a * x)//b)) )

Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = map(int,input().split())

x = 0
now = 0
result = 0
for i in range(n+1):
    x = i
    now = (((a * x)//b)) - (a * (x//b))
    #now = math.ceil(((a * x)/b)) - (a * math.ceil(x/b))
    #print("now=",now,"x=",x)
   
    result = max(result,now)

print(result)
    



Fixed submission:

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

x = min(b-1,n)

print((((a * x)//b)) )
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split())) #上司の社員番号

for i in range(1,n+1):
    print(a.count(i))


Fixed submission:
import math
r = int(input())
print(r*2*math.pi)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split())) #上司の社員番号

for i in range(1,n+1):
    print(a.count(i))


Fixed submission:
import collections
n = int(input())
a = list(map(str,input().split())) #上司の社員番号

result = collections.Counter(a)

for i in range(1,n+1):
    print(result[str(i)])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split())) #上司の社員番号

for i in range(1,n+1):
    print(a.count(i))


Fixed submission:
import collections
n = int(input())
a = list(map(str,input().split())) #上司の社員番号

result = collections.Counter(a)

for i in range(1,n+1):
    print(result[str(i)])
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

k = int(input())
result = 0
for x in range(1,k+1):
    for y in range(1,k+1):
        for z in range(1,k+1):
            result += gcd(x,y,z)
print(result)


Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

k = int(input())
result = 0
for x in range(1,k+1):
    for y in range(1,k+1):
        for z in range(1,k+1):
            result += gcd(x,y,z)
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = str(input())
count = 0
i = 0
j = 0
k = 0
for i in range(0,n):
    if i > j  :
        break
    for j in range(i,n):
        if j > k :
            break
        for k in range(j,n):
            if i >= j or j >= k or i >= k :
                continue
            if (s[i] != s[j] and s[i] != s[k] and s[j] != s[k] )and (j - i != k - j):
                count += 1
                #print(i,j,k)
print(count)

Fixed submission:
n = int(input())
s = str(input())

R = s.count("R")
G = s.count("G")
B = s.count("B")

counter = R * G * B 
#j-i != k-j
# 1 2 3 ,1 3 5

for i in range(n-1):
    for j in range(i+1,(n+i+1)//2):
        if s[i] != s[j] and s[i] != s[2*j-i] and s[2*j -i] != s[j] :
            counter -= 1

print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = str(input())
count = 0
i = 0
j = 0
k = 0
for i in range(0,n):
    if i > j  :
        break
    for j in range(0,n):
        if j > k :
            break
        for k in range(0,n):
            if i >= j or j >= k or i >= k :
                continue
            if (s[i] != s[j] and s[i] != s[k] and s[j] != s[k] )and (j - i != k - j):
                count += 1
                #print(i,j,k)
print(count)

Fixed submission:
n = int(input())
s = str(input())

R = s.count("R")
G = s.count("G")
B = s.count("B")

counter = R * G * B 
#j-i != k-j
# 1 2 3 ,1 3 5

for i in range(n-1):
    for j in range(i+1,(n+i+1)//2):
        if s[i] != s[j] and s[i] != s[2*j-i] and s[2*j -i] != s[j] :
            counter -= 1

print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = str(input())
count = 0
for i in range(0,n):
    for j in range(0,n):
        for k in range(0,n):
            if i >= j or j >= k or i >= k :
                continue
            if (s[i] != s[j] and s[i] != s[k] and s[j] != s[k] )and (j - i != k - j):
                count += 1
                #print(i,j,k)
print(count)

Fixed submission:
n = int(input())
s = str(input())

R = s.count("R")
G = s.count("G")
B = s.count("B")

counter = R * G * B 
#j-i != k-j
# 1 2 3 ,1 3 5

for i in range(n-1):
    for j in range(i+1,(n+i+1)//2):
        if s[i] != s[j] and s[i] != s[2*j-i] and s[2*j -i] != s[j] :
            counter -= 1

print(counter)
Buggy python submission (verdict: Runtime Error):

l = int(input())
result = 0

if l % 3 == 0:
    result = (l /3) ** 3
else:
    


print(result)
    

Fixed submission:
l = int(input())
result = ((l /3) ** 3)
print(round(result,7))
Buggy python submission (verdict: Runtime Error):
import math
h,w = map(int,(input().split()))
h = math.floor(h)
w = math.floor(w)
sum = h * w

if h == 1 and w ==1:
    print("1")
elif h % 2 == 0:
    result = math.floor(sum /2)
    print(result)
else:
    result = math.floor(sum /2 + 1)
    print(result)

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

left = 4 * a * b
d = c -a -b
right =d * d

if d < 0:
    print("No")
elif left < right:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int,(input().split()))



left = 4 * a * b
d = c -a -b
right =d * d

if d < 0:
    print("No")
elif left < right 
    print("Yes")
else:
    print("No")

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

left = 4 * a * b
d = c -a -b
right =d * d

if d < 0:
    print("No")
elif left < right:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
h,n = map(int,input().split())
a = input().split()
a.sort()
sum = int(a[-1]) + int(a[-2])
result = h - sum
if result <= 0:
    print("Yes")
else:
    print("No")

Fixed submission:
h,n = map(int,input().split())
a = list(map(int,input().split()))
goukei = sum(a)
result = h - goukei

if result <= 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
h,n = map(int,input().split())
a = input().split()
a.sort()

sum = int(a[-1]) + int(a[-2])

result = h - sum
if result <= 0:
    print("Yes")
else:
    print("No")

Fixed submission:
h,n = map(int,input().split())
a = list(map(int,input().split()))
goukei = sum(a)
result = h - goukei

if result <= 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
#h:体力 n:必殺技の数
#a:必殺技の威力

h,n = map(int,input().split())
a = input().split()
a.sort()

sum = int(a[-1]) + int(a[-2])

result = h - sum
if result <= 0:
    print("Yes")
else:
    print("No")
    

Fixed submission:
h,n = map(int,input().split())
a = list(map(int,input().split()))
goukei = sum(a)
result = h - goukei

if result <= 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())
p = list(map(int,input().split()))


cnt = 0

for i in range(n):
    now_list = p[0:i+1]
    Pi = p[i]
    Pj = min(now_list)
    #print(now_list,Pi,Pj)
    if Pi > Pj:
        cnt += 1
print(n-cnt)


     

Fixed submission:
import math
n = int(input())
p = list(map(int,input().split()))

temp = 11111111111111111
cnt = 0
for i in p:
    temp = min(temp,i)
    if temp >= i:
        cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
cnt = 0
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        cnt += 1
print(cnt)

Fixed submission:
n = int(input())
s = str(input())
cnt = 0
for i in range(n-2):
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,(input().split()))
print((a * b) // math.gcd(a,b))

Fixed submission:
from fractions import gcd
a,b = map(int,(input().split()))
print((a * b) // gcd(a,b))

Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,(input().split()))
print((a * b) // math.gcd(a,b))

Fixed submission:
from fractions import gcd
a,b = map(int,(input().split()))
print((a * b) // gcd(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,(input().split())))

#n 買う商品数
#m 割引券の数
#a 値段

a.sort()
for i in range(m):
    tmp = a.pop(-1) //2
    a.append(tmp)
    a.sort()
print(sum(a))

    

Fixed submission:
n,m = map(int,input().split())
#a = list(map(int,(input().split())))
a = list(map(lambda x: int(x)*(-1), input().split()))

import heapq
#n 買う商品数
#m 割引券の数
#a 値段
heapq.heapify(a)
while True:
   # print(a)
    tmp = (-1) * heapq.heappop(a) //2
    heapq.heappush(a,-1 * tmp)
    m -= 1
    if m == 0:
        break
print(-1*sum(a))

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

#n 買う商品数
#m 割引券の数
#a 値段

a.sort()
for i in range(m):
    tmp = a.pop(-1) //2
    a.append(tmp)
    a.sort()
print(sum(a))

    

Fixed submission:
n,m = map(int,input().split())
#a = list(map(int,(input().split())))
a = list(map(lambda x: int(x)*(-1), input().split()))

import heapq
#n 買う商品数
#m 割引券の数
#a 値段
heapq.heapify(a)
while True:
   # print(a)
    tmp = (-1) * heapq.heappop(a) //2
    heapq.heappush(a,-1 * tmp)
    m -= 1
    if m == 0:
        break
print(-1*sum(a))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,(input().split()))

count = 1
while True:
    if count ==1:
        temp = a * count 
    else:
        temp = a + ((a-1) * (count -1))
    if temp >= b:
        print(count)
        exit()
    else:
        count += 1

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

count = 0
temp = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        temp += 1
    else:
        temp = 0
    count = max(count,temp)
print(count)