Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

lst = [0 for i in range(2019)]
lst[0] = 1

amari = 0
for i in range(1, len(s)+1):
    amari = (amari + int(s[-i])*(10**(i-1))) % 2019
    lst[amari] += 1

ans = 0
for i in range(2019):
    num = lst[i]
    ans += num * (num-1) // 2

print(ans)

Fixed submission:
s = input()

lst = [0 for i in range(2019)]
lst[0] = 1

amari = 0
tmp = 1
for i in range(1, len(s)+1):
    amari = (amari + int(s[-i])*tmp) % 2019
    lst[amari] += 1
    tmp = (tmp*10) % 2019

ans = 0
for i in range(2019):
    num = lst[i]
    ans += num * (num-1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

lst = [0 for i in range(2019)]
lst[0] = 1

for i in range(len(s)):
    amari = int(s[i:]) % 2019
    lst[amari] += 1

ans = 0
for i in range(2019):
    num = lst[i]
    ans += num * (num-1) // 2

print(ans)

Fixed submission:
s = input()

lst = [0 for i in range(2019)]
lst[0] = 1

amari = 0
tmp = 1
for i in range(1, len(s)+1):
    amari = (amari + int(s[-i])*tmp) % 2019
    lst[amari] += 1
    tmp = (tmp*10) % 2019

ans = 0
for i in range(2019):
    num = lst[i]
    ans += num * (num-1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

lst = [0 for i in range(2019)]
lst[0] = 1

for i in range(len(s)):
    amari = int(s[i:]) % 2019
    lst[amari] += 1

ans = 0
for i in range(2019):
    num = lst[i]
    ans += num * (num-1) // 2

print(ans)

Fixed submission:
s = input()

lst = [0 for i in range(2019)]
lst[0] = 1

amari = 0
tmp = 1
for i in range(1, len(s)+1):
    amari = (amari + int(s[-i])*tmp) % 2019
    lst[amari] += 1
    tmp = (tmp*10) % 2019

ans = 0
for i in range(2019):
    num = lst[i]
    ans += num * (num-1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

ans = 0
for i in range(1, 10**5):
    num = str(2019*i)
    if num in s:
        for j in range(len(s)-len(num)+1):
            if num == s[j:j+len(num)]:
                ans += 1

print(ans)

Fixed submission:
s = input()

lst = [0 for i in range(2019)]
lst[0] = 1

amari = 0
tmp = 1
for i in range(1, len(s)+1):
    amari = (amari + int(s[-i])*tmp) % 2019
    lst[amari] += 1
    tmp = (tmp*10) % 2019

ans = 0
for i in range(2019):
    num = lst[i]
    ans += num * (num-1) // 2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

ans = 0
for i in range(n-2):
    s_i = s[i]
    for j in range(i+1, n-1):
        if s[j] == s_i: continue
        s_j = s[j]
        j_i = j-i
        for k in range(j+1, n):
            if k-j == j_i: continue
            if s[k] != s_i and s[k] != s_j:
                ans += 1

print(ans)

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

num_r, num_g, num_b = 0, 0, 0
for i in range(n):
    if s[i] == 'R': num_r += 1
    elif s[i] == 'G': num_g += 1
    else: num_b += 1

hiku = 0
for i in range(n-2):
    s_i = s[i]
    for j in range(i+1, n-1):
        if s[j] == s_i: continue
        s_j = s[j]
        j_i = j-i
        if j+j_i < n:
            miru = s[j+j_i]
            if miru != s_i and miru != s_j:
                hiku += 1
        else:
            break

print(num_r*num_g*num_b-hiku)
Buggy python submission (verdict: Runtime Error):
k = int(input())

def hantei(n):
    string = str(n)
    length = len(string)
    ret = True
    for i in range(length-1):
        if abs(int(string[i]) - int(string[i+1])) > 1:
            ret = False
            break
    return ret

lst = [i for i in range(10)]
dic = {}
dic[1] = lst.copy()
keta = 2
while len(lst) < k+1:
    new = []
    for i in range(1, 10):
        tasu = i*(10**(keta-1))
        for j in sorted(dic.keys()):
            temp_lst = dic[j]
            bit = 0
            for youso in temp_lst:
                num = tasu + youso
                if hantei(num):
                    new.append(num)
                    bit = 1
                elif bit == 1:
                    break
    dic[keta] = new.copy()
    lst.extend(new)
    keta += 1

print(lst[k])

Fixed submission:
k = int(input())

def hantei(n):
    string = str(n)
    length = len(string)
    ret = True
    for i in range(length-1):
        if abs(int(string[i]) - int(string[i+1])) > 1:
            ret = False
            break
    return ret

lst = [i for i in range(10)]
dic = {}
dic[1] = lst.copy()
keta = 2
while len(lst) < k+1:
    new = []
    for i in range(1, 10):
        tasu = i*(10**(keta-1))
        for j in sorted(dic.keys()):
            temp_lst = dic[j]
            bit = 0
            for youso in temp_lst:
                num = tasu + youso
                if hantei(num):
                    new.append(num)
                    bit = 1
                elif bit == 1:
                    break
    dic[keta] = new.copy()
    lst.extend(new)
    keta += 1

print(lst[k])
Buggy python submission (verdict: Time Limit Exceeded):
n, x, y = map(int, input().split())

d = []
for i in range(n):
    lst = [0 for _ in range(n)]
    temp = i+1
    umeru = 1
    while temp <= n-1:
        lst[temp] = umeru
        umeru += 1
        temp += 1
    temp = i-1
    umeru = 1
    while temp >= 0:
        lst[temp] = umeru
        umeru += 1
        temp -= 1
    d.append(lst)

d[x-1][y-1] = 1
d[y-1][x-1] = 1

lst = [x-1, y-1]
for k in lst:
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j],d[i][k] + d[k][j])

ans = [0 for _ in range(n)]
for i in range(n):
    for j in range(i+1, n):
        ans[d[i][j]] += 1

for i in range(1, n):
    print(ans[i])

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

d = []
for i in range(n):
    lst = [0 for _ in range(n)]
    temp = i+1
    umeru = 1
    while temp <= n-1:
        lst[temp] = umeru
        umeru += 1
        temp += 1
    temp = i-1
    umeru = 1
    while temp >= 0:
        lst[temp] = umeru
        umeru += 1
        temp -= 1
    d.append(lst)

d[x-1][y-1] = 1
d[y-1][x-1] = 1

lst = [x-1, y-1]
for k in lst:
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j],d[i][k] + d[k][j])

ans = [0 for _ in range(n)]
for i in range(n):
    for j in range(i+1, n):
        ans[d[i][j]] += 1

for i in range(1, n):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort()
q.sort()
r.sort()

ans = 0
for i in range(x):
    if p[-1] >= r[-1]:
        ans += p.pop()
    else:
        ans += r.pop()

for i in range(y):
    if q[-1] >= r[-1]:
        ans += q.pop()
    else:
        ans += r.pop()

print(ans)

Fixed submission:
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort()
q.sort()
r.sort()

ans = 0
while x != 0 or y != 0:
    if r != []:
        if x > 0 and y > 0:
            maxi = max(p[-1], q[-1], r[-1])
            if maxi == p[-1]:
                ans += p.pop()
                x -= 1
            elif maxi == q[-1]:
                ans += q.pop()
                y -= 1
            else:
                ans += r.pop()
                if p[-x] > q[-y]:
                    y -= 1
                else:
                    x -= 1
        elif x == 0:
            maxi = max(q[-1], r[-1])
            if maxi == q[-1]:
                ans += q.pop()
                y -= 1
            else:
                ans += r.pop()
                y -= 1
        else:
            maxi = max(p[-1], r[-1])
            if maxi == p[-1]:
                ans += p.pop()
                x -= 1
            else:
                ans += r.pop()
                x -= 1
    else:
        if x > 0 and y > 0:
            maxi = max(p[-1], q[-1])
            if maxi == p[-1]:
                ans += p.pop()
                x -= 1
            elif maxi == q[-1]:
                ans += q.pop()
                y -= 1
        elif x == 0:
            ans += q.pop()
            y -= 1
        else:
            ans += p.pop()
            x -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = input()

# 上の段:その桁をピッタリ払った, 下の段:その桁を払わなかった(上の桁で1多く払った)
dp = [[0 for i in range(len(n))] for j in range(2)]

dp[0][0] = int(n[0])
dp[1][0] = 1 + 10 - int(n[0])

for i in range(1, len(n)):
    dp[0][i] = min(dp[0][i-1], dp[1][i-1]) + int(n[i])
    dp[1][i] = min(dp[0][i-1]+1+10-int(n[i]), dp[1][i-1]-1+10-int(n[i]))

print(min(dp[0][len(n)-1], dp[1][len(n)-1]))

Fixed submission:
n = input()

# 上の段:その桁をピッタリ払った, 下の段:その桁を払わなかった(上の桁で1多く払った)
dp = [[0 for i in range(len(n))] for j in range(2)]

dp[0][0] = int(n[0])
dp[1][0] = 1 + 10 - int(n[0])

for i in range(1, len(n)):
    dp[0][i] = min(dp[0][i-1], dp[1][i-1]) + int(n[i])
    dp[1][i] = min(dp[0][i-1]+1+10-int(n[i]), dp[1][i-1]-1+10-int(n[i]))

print(min(dp[0][len(n)-1], dp[1][len(n)-1]))
Buggy python submission (verdict: Runtime Error):
n = input()
k = int(input())

keta = len(n)

# dp0 = ヨユーなやつ, dp1 = ギリなやつ
dp0 = [[0 for j in range(keta+1)] for i in range(keta+1)]
dp1 = [[0 for j in range(keta+1)] for i in range(keta+1)]

dp1[0][0] = 1

for i in range(keta):
    for j in range(keta+1):
        # ギリギリのやつ(dp1)の処理
        if n[i] == '0': # i+1桁目が0の場合
            dp1[i+1][j] = dp1[i][j] # 真上からスライド
        else: # i+1桁目が1~9の場合
            if j < keta:
                dp1[i+1][j+1] = dp1[i][j] # 左上からスライド
        
        # ヨユーなやつ(dp0)の処理
        if n[i] == '0': # i+1桁目が0の場合
            # i桁目がヨユーな状態ではi+1桁目には何でも入れられる
            dp0[i+1][j] += dp0[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp0[i][j] * 9 # i+1桁目に1~9を入れた場合
            # i桁目までギリだったときの、i+1桁目のヨユーなやつのカウント
                # 何もない(ギリである0しか入れられないため)
        else: # i+1桁目が1~9の場合
            # i桁目がヨユーな状態ではi+1桁目には何でも入れられる
            dp0[i+1][j] += dp0[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp0[i][j] * 9 # i+1桁目に1~9を入れた場合
            # i桁目までギリだったときの、i+1桁目のヨユーなやつのカウント
            dp0[i+1][j] += dp1[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp1[i][j] * (ord(n[i])-ord('0')-1) # i+1桁目にrange(1, n[i])を入れた場合

print(dp0[keta][k] + dp1[keta][k])

Fixed submission:
n = input()
k = int(input())

keta = len(n)

# dp0 = ヨユーなやつ, dp1 = ギリなやつ
dp0 = [[0 for j in range(keta+1)] for i in range(keta+1)]
dp1 = [[0 for j in range(keta+1)] for i in range(keta+1)]

dp1[0][0] = 1

for i in range(keta):
    for j in range(keta+1):
        # ギリギリのやつ(dp1)の処理
        if n[i] == '0': # i+1桁目が0の場合
            dp1[i+1][j] = dp1[i][j] # 真上からスライド
        else: # i+1桁目が1~9の場合
            if j < keta:
                dp1[i+1][j+1] = dp1[i][j] # 左上からスライド
        
        # ヨユーなやつ(dp0)の処理
        if n[i] == '0': # i+1桁目が0の場合
            # i桁目がヨユーな状態ではi+1桁目には何でも入れられる
            dp0[i+1][j] += dp0[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp0[i][j] * 9 # i+1桁目に1~9を入れた場合
            # i桁目までギリだったときの、i+1桁目のヨユーなやつのカウント
                # 何もない(ギリである0しか入れられないため)
        else: # i+1桁目が1~9の場合
            # i桁目がヨユーな状態ではi+1桁目には何でも入れられる
            dp0[i+1][j] += dp0[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp0[i][j] * 9 # i+1桁目に1~9を入れた場合
            # i桁目までギリだったときの、i+1桁目のヨユーなやつのカウント
            dp0[i+1][j] += dp1[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp1[i][j] * (ord(n[i])-ord('0')-1) # i+1桁目にrange(1, n[i])を入れた場合

if k > keta:
    print(0)
else:
    print(dp0[keta][k] + dp1[keta][k])
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
p, s = [], []
for i in range(n):
    pi, si = input().split()
    p.append(int(pi))
    s.append(si)

lst_ac = [0 for i in range(n+1)]
for i in range(n):
    if s[i] == 'AC':
        lst_ac[p[i]] = 1
ans_ac = sum(lst_ac)

out = 0
for i in range(n):
    if s[i] == 'WA' and lst_ac[p[i]] == 1:
        out += 1

print(ans_ac, out)

Fixed submission:
n, m = map(int, input().split())
p, s = [], []
for i in range(m):
    pi, si = input().split()
    p.append(int(pi))
    s.append(si)

lst_ac = [0 for i in range(n+1)]
for i in range(m):
    if s[i] == 'AC':
        lst_ac[p[i]] = 1
ans_ac = sum(lst_ac)

out = 0
for i in range(m):
    if s[i] == 'WA' and lst_ac[p[i]] == 1:
        out += 1
    if s[i] == 'AC' and lst_ac[p[i]] == 1:
        lst_ac[p[i]] = 2

print(ans_ac, out)
Buggy python submission (verdict: Time Limit Exceeded):
def change_n_shinsu(x, n):
    ans = ''
    while True:
        shou = x // n
        amari = x % n
        if shou == 0 and amari == 0:
            break
        ans = str(amari) + ans
        x = shou
    ans = ans.zfill(60)
    return ans

n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7

zero = [0 for i in range(60)]
one = [0 for i in range(60)]

for i in range(n):
    ai = change_n_shinsu(a[i], 2)
    for j in range(60):
        if ai[j] == '0':
            zero[j] += 1
        else:
            one[j] += 1

zero = zero[::-1]
one = one[::-1]

ans = 0
for i in range(60):
    kumi = (zero[i] * one[i]) % mod
    num = pow(2, i, mod)
    ans += (kumi * num) % mod
    ans %= mod
print(ans)

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

wa = 0
kazu = 10**9 + 7
for i in range(60):
    b = 0
    for j in a:
        b += j & 1
    wa = (wa + b*(n-b)*(1<<i)) % kazu
    for j in range(n):
        a[j] = a[j] >> 1

print(wa)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

lst = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            moji1 = lst[i]
            moji2 = lst[j]
            moji3 = lst[k]
            cnt = 0
            kuraberu = [moji1, moji2, moji3]
            for moji in s:
                if moji == kuraberu[cnt]:
                    cnt += 1
                if cnt == 3:
                    ans += 1
                    break

print(ans)

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

lst = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            moji1 = lst[i]
            moji2 = lst[j]
            moji3 = lst[k]
            cnt = 0
            kuraberu = [moji1, moji2, moji3]
            for moji in s:
                if moji == kuraberu[cnt]:
                    cnt += 1
                if cnt == 3:
                    ans += 1
                    break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

lst = []
cnt = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            mojiretu = s[i] + s[j] + s[k]
            if mojiretu not in lst:
                cnt += 1
                lst.append(mojiretu)

print(cnt)

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

lst = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            moji1 = lst[i]
            moji2 = lst[j]
            moji3 = lst[k]
            cnt = 0
            kuraberu = [moji1, moji2, moji3]
            for moji in s:
                if moji == kuraberu[cnt]:
                    cnt += 1
                if cnt == 3:
                    ans += 1
                    break

print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] = a[i] % k

ruiseki = [0]
for i in range(n):
    ruiseki.append((a[i]+ruiseki[-1])%k)

mini = 0
dic = {}
ans = 0
for j in range(1, n+1):
    if j-k+1 > mini:
        dic[(ruiseki[mini]-mini)%k] -= 1
        mini += 1
    if (ruiseki[j-1]-(j-1))%k in dic:
        dic[(ruiseki[j-1]-(j-1))%k] += 1
    else:
        dic[(ruiseki[j-1]-(j-1))%k] = 1
    if (ruiseki[j]-j)%k in dic:
        ans += dic[(ruiseki[j]-j)%k]
print(ans)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] = a[i] % k

if k == 1:
    print(0)
    exit()

ruiseki = [0]
for i in range(n):
    ruiseki.append((a[i]+ruiseki[-1])%k)

mini = 0
dic = {}
ans = 0
for j in range(1, n+1):
    if j-k+1 > mini:
        dic[(ruiseki[mini]-mini)%k] -= 1
        mini += 1
    if (ruiseki[j-1]-(j-1))%k in dic:
        dic[(ruiseki[j-1]-(j-1))%k] += 1
    else:
        dic[(ruiseki[j-1]-(j-1))%k] = 1
    if (ruiseki[j]-j)%k in dic:
        ans += dic[(ruiseki[j]-j)%k]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
lst = []
for i in range(m):
    lsti = list(map(int, input().split()))
    lst.append(lsti)

lst.sort(key= lambda x: x[2], reverse=True)
lst.sort(key= lambda x: x[0])

d = [10**18 for i in range(n+1)]
d[1] = 0
for lsti in lst:
    l = lsti[0]
    r = lsti[1]
    c = lsti[2]
    if l == 1:
        for i in range(l+1, r+1):
            d[i] = c
    else:
        for i in range(l+1, r+1):
            d[i] = min(d[i], d[l]+c)

if d[n] == 10**18:
    print(-1)
else:
    print(d[n])

Fixed submission:
n, m = map(int, input().split())
lst = []
for i in range(m):
    lsti = list(map(int, input().split()))
    lst.append(lsti)

lst.sort(key= lambda x: x[2], reverse=True)
lst.sort(key= lambda x: x[0])

d = [10**18 for i in range(n+1)]
d[1] = 0
for lsti in lst:
    l = lsti[0]
    r = lsti[1]
    c = lsti[2]
    if l == 1:
        for i in range(l+1, r+1):
            d[i] = c
    else:
        for i in range(l+1, r+1):
            j = l+1+r-i
            if d[l]+c < d[j]:
                d[j] = d[l] + c
            else:
                break

if d[n] == 10**18:
    print(-1)
else:
    print(d[n])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            a, b, c = l[i], l[j], l[k]
            if a < b+c and b < c+a and c < a+b:
                ans += 1
            else:
                break

print(ans)

Fixed submission:
import bisect

n = int(input())
l = list(map(int, input().split()))
l.sort()
l_copy = l.copy()
l_copy = l_copy[::-1]

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        rest = l_copy[i] - l_copy[j]
        ind = bisect.bisect_right(l, rest)
        ind = n - ind - 1
        if ind <= j:
            break
        else:
            ans += ind - j

print(ans)

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

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            a, b, c = l[i], l[j], l[k]
            if a < b+c and b < c+a and c < a+b:
                ans += 1

print(ans)

Fixed submission:
import bisect

n = int(input())
l = list(map(int, input().split()))
l.sort()
l_copy = l.copy()
l_copy = l_copy[::-1]

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        rest = l_copy[i] - l_copy[j]
        ind = bisect.bisect_right(l, rest)
        ind = n - ind - 1
        if ind <= j:
            break
        else:
            ans += ind - j

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, k, q = map(int, input().split())
a = [0 for i in range(q)]
for i in range(q):
    a[i] = int(input())

point = [k for i in range(n)]
point = np.array(point)

for i in range(q):
    point = point - 1
    point[a[i]-1] += 1

for i in range(n):
    if point[i] > 0:
        print('Yes')
    else:
        print('No')

Fixed submission:
n, k, q = map(int, input().split())
a = [0 for i in range(q)]

line = q - k + 1
point = [0 for i in range(n)]
for i in range(q):
    ai = int(input()) - 1
    point[ai] += 1

for i in range(n):
    if point[i] >= line:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
import bisect
from collections import deque

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

a.sort()

a = deque(a)

for i in range(m):
    saidai = a.pop()
    sounyu = saidai // 2
    bisect.insort(a, sounyu)

print(sum(a))

Fixed submission:
import heapq
import numpy as np

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

a.sort()
a = np.array(a)
a = -1 * a
a = list(a)
heapq.heapify(a)

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

print(-1 * sum(a))

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

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

a.sort()

for i in range(m):
    saidai = a.pop()
    sounyu = saidai // 2
    bisect.insort(a, sounyu)

print(sum(a))

Fixed submission:
import heapq
import numpy as np

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

a.sort()
a = np.array(a)
a = -1 * a
a = list(a)
heapq.heapify(a)

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

print(-1 * sum(a))

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

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

a.sort()

for i in range(m):
    saidai = a.pop()
    sounyu = saidai // 2
    bisect.insort(a, sounyu)

print(sum(a))

Fixed submission:
import heapq
import numpy as np

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

a.sort()
a = np.array(a)
a = -1 * a
a = list(a)
heapq.heapify(a)

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

print(-1 * sum(a))