Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#!python3

iim = lambda: map(int, input().rstrip().split())

def f1(n, num):
    if num == 0:
        return
    for i in range(num-1):
        print(n, end= " ")
    print(n, end="")

def NKS(N, K, S):
    M5 = 10**5
    M9 = 10**9

    for i in range(K):
        yield S

    tmp = S + 1 if S < M9 else 1
    for i in range(N-K):
        print(tmp)

def resolve():
    N, K, S = iim()

    it = NKS(N, K, S)
    for i in range(N-1):
        print(next(it), end=" ")
    print(next(it))

if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def NKS(N, K, S):
    M5 = 10**5
    M9 = 10**9

    for i in range(K):
        yield S

    tmp = S + 1 if S < M9 else 1
    for i in range(N-K):
        yield tmp

def resolve():
    N, K, S = iim()

    it = NKS(N, K, S)
    for i in range(N-1):
        print(next(it), end=" ")
    print(next(it))

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
#!python3

iim = lambda: map(int, input().rstrip().split())

from collections import deque

def resolve():
    H, W = iim()

    M = [input() for i in range(H)]

    def search(y, x):
        q = []
        m = [[0]*W for i in range(H)]

        q = deque([(y,x, 0)])
        ans = 0
        while q:
            y, x, k = q.popleft()
            m[y][x] = 1
            ans = max(ans, k)
            for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
                yy = y + i
                xx = x + j

                if 0 <= xx < W and 0 <= yy < H:
                    if M[yy][xx] == "." and m[yy][xx] == 0:
                        q.append((yy, xx, k+1))

        return ans

    ans = 0
    for y in range(H):
        for x in range(W):
            if M[y][x] == ".":
                ans = max(ans, search(y, x))
    print(ans)
if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

from collections import deque

def resolve():
    H, W = iim()

    M = [input() for i in range(H)]

    def search(y, x):
        q = []
        m = [[0]*W for i in range(H)]

        m[y][x] = 1
        q = deque([(y,x, 0)])
        ans = 0
        while q:
            y, x, k = q.popleft()
            ans = max(ans, k)
            for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
                yy = y + i
                xx = x + j

                if 0 <= xx < W and 0 <= yy < H:
                    if M[yy][xx] == "." and m[yy][xx] == 0:
                        m[yy][xx] = 1
                        q.append((yy, xx, k+1))

        return ans

    ans = 0
    for y in range(H):
        for x in range(W):
            if M[y][x] == ".":
                ans = max(ans, search(y, x))
    print(ans)
if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
#!python3

def resolve():
    N, K = map(int, input().rstrip().split())
    R, S, P = map(int, input().rstrip().split())
    T = input().rstrip().split()

    score = {"r":  P, "s": R, "p": S}

    s = 0
    for i in range(i, K):
        s += score[T[i]]

    for i in range(K, N):
        if T[i-K] == T[i]:
            continue
        s += score[T[i]]

    print(s)

if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

def resolve():
    N, K = map(int, input().rstrip().split())
    R, S, P = map(int, input().rstrip().split())
    T = list(input().rstrip())

    score = {"r":  P, "s": R, "p": S}

    s = 0
    for i in range(K):
        s += score[T[i]]

    for i in range(K, N):
        if T[i-K] == T[i]:
            T[i] = ""
            continue
        s += score[T[i]]

    print(s)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Runtime Error):
#!python3

def resolve():
    N, K = map(int, input().rstrip().split())
    R, S, P = map(int, input().rstrip().split())
    T = input().rstrip().split()

    score = {"r":  P, "s": R, "p": S}

    s = 0
    for i in range(i, K):
        s += score[T[i]]

    for i in range(K, N):
        if T[i-K] == T[i]:
            continue
        s += score[T[i]]

    print(s)

if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

def resolve():
    N, K = map(int, input().rstrip().split())
    R, S, P = map(int, input().rstrip().split())
    T = list(input().rstrip())

    score = {"r":  P, "s": R, "p": S}

    s = 0
    for i in range(K):
        s += score[T[i]]

    for i in range(K, N):
        if T[i-K] == T[i]:
            T[i] = ""
            continue
        s += score[T[i]]

    print(s)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
#!python3

def resolve():
    N, u, v = map(int, input().rstrip().split())
    N1 = N + 1

    d = [[] for _ in range(1, N1)]
    for i in range(1, N):
        a, b = map(int, input().rstrip().split())

        d[a].append(b)
        d[b].append(a)

    from collections import deque

    def f(x):
        q = deque()
        q.append(x)
        X = [-1] * N1

        while q:
            x = q.popleft()
            for i in d[x]:
                if X[i] == -1:
                    X[i] = X[x] + 1
                    q.append(i)
        return q

    U = f(u)
    V = f(v)

    m = 0
    for uu, vv in zip(U, V):
        if uu < vv:
            if vv > m:
                m = vv
    print(m-1)

if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

def resolve():
    N, u, v = map(int, input().rstrip().split())
    N1 = N + 1

    d = [[] for _ in range(0, N1)]
    for i in range(1, N):
        a, b = map(int, input().rstrip().split())

        d[a].append(b)
        d[b].append(a)

    from collections import deque

    def f(x):
        q = deque()
        q.append(x)
        X = [-1] * N1

        X[x] = 0
        while q:
            x = q.popleft()
            for i in d[x]:
                if X[i] == -1:
                    X[i] = X[x] + 1
                    q.append(i)
        return X

    U = f(u)
    V = f(v)

    m = 0
    for uu, vv in zip(U, V):
        if uu < vv:
            if vv > m:
                m = vv
    print(m-1)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
s = input()
ans = ""
for char in s:
    if char != 'B':
        ans += char
    else:
        if ans == "":
            pass
        else:
            len = len(ans)
            ans = ans[0:len - 1]
print(ans)


Fixed submission:
s = input()
ans = ""
for char in s:
    if char != 'B':
        ans += char
    else:
        if ans == "":
            pass
        else:
            le = len(ans)
            ans = ans[0:le - 1]
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys


def LI():
    return list(map(int, input().split()))


def gcd(x, y):
    if x == 0:
        return y
    else:
        return gcd(y % x, x)


N = LI()
A = LI()
g = 0
for a in A:
    g = gcd(g, a)
if g != 1:
    print("not coprime")
    sys.exit()

sosu = [True]*(10**6)
sosu[0] = sosu[1] = False
for i in range(2, 10**6):
    if not sosu[i]:
        continue
    for j in range(i*i, 10**6, i):
        sosu[j] = False

used = [False]*(10**6)
prime = [a for a in A if sosu[a]]
for i in prime:
    used[i] = True
not_prime = [a for a in A if not sosu[a]]
ruto_prime = [a for a in range(1000) if sosu[a]]
for i in not_prime:
    for j in ruto_prime:
        if i == 1:
            break
        if i % j != 0:
            continue
        if used[j]:
            print("setwise coprime")
            sys.exit()
        used[j] = True
        while i % j == 0:
            i //= j
    if i > 1:
        if used[i]:
            print("setwise coprime")
        used[i] = True
print("pairwise coprime")


Fixed submission:
import sys


def LI():
    return list(map(int, input().split()))


def gcd(x, y):
    if x == 0:
        return y
    else:
        return gcd(y % x, x)


input()
A = LI()

g = 0
for a in A:
    g = gcd(g, a)
if g != 1:
    print("not coprime")
    sys.exit()

sosudayo = [True] * 1100000
sosudayo[0] = False
sosudayo[1] = False
for i in range(2, 1100000):
    if not sosudayo[i]:
        continue
    for j in range(i*i, 1100000, i):
        sosudayo[j] = False

used = [False] * 1100000
sosu = [a for a in A if sosudayo[a]]
for i in sosu:
    used[i] = True
ruto_sosu = [a for a in range(1100) if sosudayo[a]]
not_sosu = [a for a in A if not sosudayo[a]]

for i in not_sosu:
    for j in ruto_sosu:
        if i == 1:
            break
        if i % j != 0:
            continue
        if used[j]:
            print("setwise coprime")
            sys.exit()
        used[j] = True
        while i % j == 0:
            i //= j
    if i > 1:
        if used[i]:
            print("setwise coprime")
            sys.exit()
        used[i] = True

print("pairwise coprime")
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
like = 7
ans = -1
for i in range(1, K+1):
    if like % K == 0:
        ans = i
        break
    like =like*10+7
print(ans)

Fixed submission:
K = int(input())
like = 7
ans = -1
for i in range(K):
    if like % K == 0:
        ans = i+1
        break
    like = (like*10+7) % K
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans=0

#初項a、公差d=a、n項までの和
for a in range(1,N+1):
    n=N//a
    S=((2*a+(n-1)*a)*n)//2
    ans=ans+S
print(ans)


Fixed submission:
N = int(input())
ans=0

#初項a、公差d=a、n項までの和
for a in range(1,N+1):
    n=N//a
    ans=(n*(2*a+(n-1)*a))//2+ans
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
import math
def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def yakusu(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num


ans = 0
for i in range(1, N+1):
    ans = yakusu(i)*i+ans

print(ans)


Fixed submission:
N = int(input())
ans=0

#初項a、公差d=a、n項までの和
for a in range(1,N+1):
    n=N//a
    ans=(n*(2*a+(n-1)*a))//2+ans
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
total=sum(A)
for i in range(Q):
    B, C = map(int, input().split())
    x=A.count(B)
    if x>0:
        total=total-B*x+C*x
        A.extend([C]*x)
    print(total)



Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
total=sum(A)
A=Counter(A)
for i in range(Q):
    B, C = map(int, input().split())
    total=total-(A[B]*B)+(C*A[B])
    A[C] = A[C]+A[B]
    A[B]=0
    print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
total=sum(A)
for i in range(Q):
    B, C = map(int, input().split())
    x=A.count(B)
    if x>0:
        for j in range(0,x):
            y=A.index(B)
            total=total-A[y]+C
            A[y]=C
    print(total)



Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
total=sum(A)
A=Counter(A)
for i in range(Q):
    B, C = map(int, input().split())
    total=total-(A[B]*B)+(C*A[B])
    A[C] = A[C]+A[B]
    A[B]=0
    print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
total=sum(A)
for i in range(Q):
    B, C = map(int, input().split())
    for j in range(N):
        if A[j]==B:
            total=total-B+C
            A[j]=C
    print(total)


Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
total=sum(A)
A=Counter(A)
for i in range(Q):
    B, C = map(int, input().split())
    total=total-(A[B]*B)+(C*A[B])
    A[C] = A[C]+A[B]
    A[B]=0
    print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
total=0
for i in range(Q):
    B, C = map(int, input().split())
    for j in range(N):
        if A[j]==B:
            A[j]=C
        total=total+A[j]
    print(total)
    total=0



Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
total=sum(A)
A=Counter(A)
for i in range(Q):
    B, C = map(int, input().split())
    total=total-(A[B]*B)+(C*A[B])
    A[C] = A[C]+A[B]
    A[B]=0
    print(total)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Nlist = []  # Aを順番に入れていきます
count = 0  # inputのリスト位置
ans = [0]*N  # 割り切れる場合と同じ場合に1を入れる
for A in input().split():
    for i in range(len(Nlist)):
        if int(A) == Nlist[i]:
            ans[count] = 1
            ans[i] = 1
        elif int(A) % Nlist[i] == 0:
            ans[count] = 1
        elif Nlist[i] % int(A) == 0:
            ans[i] = 1
    Nlist.append(int(A))
    count = count+1
print(ans.count(0))#同じではない場合と割り切れない場合は初期値0のまま


Fixed submission:
from collections import Counter
N = int(input())
anslist = set([])
A = list(map(int, input().split()))
Amax = max(A)
for i in A:
    j = i*2
    while j <= Amax:
        anslist.add(j)
        j += i

anslist = list(anslist)
anslist.extend(A)
anslist = Counter(anslist)

A = Counter(A)
cnt=0
for  k,v in A.items():
    if v!=1:
        del anslist[k]
    else:
        cnt+=1

ans = Counter(anslist.values())
print(cnt-ans[2])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Nlist = []  # Aを順番に入れていきます
count = 0  # inputのリスト位置
ans = [0]*N  # 割り切れる場合と同じ場合に1を入れる
for A in input().split():
    for i in range(len(Nlist)):
        if int(A) == Nlist[i]:
            ans[count] = 1
            ans[i] = 1
        elif int(A) % Nlist[i] == 0:
            ans[count] = 1
        elif Nlist[i] % int(A) == 0:
            ans[i] = 1
    Nlist.append(int(A))
    count = count+1
print(ans.count(0))#同じではない場合と割り切れない場合は初期値0のまま


Fixed submission:
from collections import Counter
N = int(input())
anslist = set([])
A = list(map(int, input().split()))
Amax = max(A)
for i in A:
    j = i*2
    while j <= Amax:
        anslist.add(j)
        j += i

anslist = list(anslist)
anslist.extend(A)
anslist = Counter(anslist)

A = Counter(A)
cnt=0
for  k,v in A.items():
    if v!=1:
        del anslist[k]
    else:
        cnt+=1

ans = Counter(anslist.values())
print(cnt-ans[2])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Nlist = list(map(int, input().split()))
total = 1

for i in range(N):
    total = total*Nlist[i]

if total > 1000000000000000000:
        total = -1
print(total)


Fixed submission:
import sys
N = int(input())
Nlist = list(map(int, input().split()))
total = 1

if Nlist.count(0)>=1:
    total = 0
    print(total)
    sys.exit()


for i in range(N):
    total = total*Nlist[i]
    if total > 1000000000000000000:
        total = -1
        break

print(total)
Buggy python submission (verdict: Runtime Error):
from collections import deque
N, M = map(int, input().split())
road = [[] for _ in range(M+1)]
ans = [-1]*(N+1)
d = deque()
for i in range(M):
    A, B = map(int, input().split())
    road[A].append(B)
    road[B].append(A)
d.append(1)
while len(d) != 0:
    look = d.popleft()
    for i in road[look]:
        if ans[i] == -1:
            d.append(i)
            ans[i] = look

print("Yes")
for i in range(2, N+1):
    print(ans[i])


Fixed submission:
from collections import deque
N, M = map(int, input().split())
Mlist = [[] for _ in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    Mlist[a].append(b)
    Mlist[b].append(a)

ans = [0] * (N+1)

d = deque()
d.append(1)
count = 0
while count != N:
    Q = d.popleft()
    for i in Mlist[Q]:
        if ans[i] == 0:
            ans[i] = Q
            d.append(i)
            count = count+1
print('Yes')
for i in range(N-1):
    print(ans[i+2])
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
total = 0
for x in range(1, K+1):
    for y in range(1, K+1):
        for z in range(1, K+1):
            total = total+math.gcd(x, math.gcd(y, z))
print(total)


Fixed submission:
import math
K = int(input())
total = 0
for x in range(1, K+1):
    for y in range(1, K+1):
        a=math.gcd(x, y)
        for z in range(1, K+1):
            total = total+math.gcd(z, a)
print(total)
Buggy python submission (verdict: Runtime Error):
import heapq
X, Y, A, B, C = map(int, input().split())
Av = list(map(int, input().split()))
Bv = list(map(int, input().split()))
Cv = list(map(int, input().split()))
heapq.heapify(Av)
heapq.heapify(Bv)
heapq.heapify(Cv)
for i in range(A-X):
    heapq.heappop(Av)
for i in range(B-Y):
    heapq.heappop(Bv)
if C > X+Y:
    for i in range(C-(X+Y)):
        heapq.heappop(Cv)
    NotTake = X+Y
else:
    NotTake = C
C = NotTake
for _ in range(NotTake):
    Amin = heapq.heappop(Av)
    Bmin = heapq.heappop(Bv)
    Cmin = heapq.heappop(Cv)
    if X > 0 and Amin == min(Amin, Bmin, Cmin):
        heapq.heappush(Bv, Bmin)
        heapq.heappush(Cv, Cmin)
        X -= 1
    elif Y > 0 and Bmin == min(Bmin, Cmin):
        heapq.heappush(Av, Amin)
        heapq.heappush(Cv, Cmin)
        Y -= 1
    elif C > 0:
        heapq.heappush(Av, Amin)
        heapq.heappush(Bv, Bmin)
        C -= 1
    else:
        break
print(sum(Av)+sum(Bv)+sum(Cv))

Fixed submission:
import heapq
import sys
X, Y, A, B, C = map(int, input().split())
Av = list(map(int, input().split()))
Bv = list(map(int, input().split()))
Cv = list(map(int, input().split()))
heapq.heapify(Av)
heapq.heapify(Bv)
heapq.heapify(Cv)
for i in range(A-X):
    heapq.heappop(Av)
for i in range(B-Y):
    heapq.heappop(Bv)
if C > X+Y:
    for i in range(C-(X+Y)):
        heapq.heappop(Cv)
    NotTake = X+Y
else:
    NotTake = C
total = X+Y
C = NotTake
for _ in range(NotTake):
    Amin = heapq.heappop(Av)
    Bmin = heapq.heappop(Bv)
    Cmin = heapq.heappop(Cv)
    if X > 0 and Amin == min(Amin, Bmin, Cmin):
        heapq.heappush(Bv, Bmin)
        heapq.heappush(Cv, Cmin)
        X -= 1
    elif Y > 0 and Bmin == min(Bmin, Cmin):
        heapq.heappush(Av, Amin)
        heapq.heappush(Cv, Cmin)
        Y -= 1
    elif C > 0:
        heapq.heappush(Av, Amin)
        heapq.heappush(Bv, Bmin)
        C -= 1
    if X == 0 or Y == 0 or C == 0:
        break
NotTake = X+Y+C-total
if X == 0:
    Iv = Bv
    Jv = Cv
    I = Y
    J = C
elif Y == 0:
    Iv = Av
    Jv = Cv
    I = X
    J = C
else:
    print(sum(Av)+sum(Bv)+sum(Cv))
    sys.exit()

for _ in range(NotTake):
    Imin = heapq.heappop(Iv)
    Jmin = heapq.heappop(Jv)
    if I > 0 and Imin == min(Imin, Jmin):
        heapq.heappush(Jv, Jmin)
        I -= 1
    elif J > 0:
        heapq.heappush(Iv, Imin)
        J -= 1
    if J == 0 or I == 0:
        break

print(sum(Av)+sum(Bv)+sum(Cv))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ans = 0
for x in range(10):
    for y in range(10):
        for z in range(10):
            for i in range(N):
                if x != int(S[i]):
                    continue
                for j in range(i+1, N):
                    if y != int(S[j]):
                        continue
                    for k in range(j+1, N):
                        if z != int(S[k]):
                            continue
                        ans += z == int(S[k])
                        break
                    break
                break
print(ans)


Fixed submission:
N = int(input())
S = input()
ans = 0
for x in range(10):
    for y in range(10):
        for z in range(10):
            for i in range(N):
                if x != int(S[i]):
                    continue
                for j in range(i+1, N):
                    if y != int(S[j]):
                        continue
                    for k in range(j+1, N):
                        if z != int(S[k]):
                            continue
                        ans += z == int(S[k])
                        break
                    break
                break
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
ans = "Yes"
if N % 2 != 0:
    ans = "No"
else:
    N = int(N/2)
    for i in range(0, N):
        if S[i] != S[i+3]:
            ans = "No"
            break
print(ans)


Fixed submission:
N = int(input())
S = input()
ans = "Yes"
if N % 2 != 0:
    ans = "No"
else:
    N = int(N/2)
    for i in range(0, N):
        if S[i] != S[i+N]:
            ans = "No"
            break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
L = list(map(int, input().split()))
A = list(itertools.combinations(L, 3))
ans = 0
for i in A:
    if i[0] >= i[1]+i[2]:
        continue
    if i[1] >= i[0]+i[2]:
        continue
    if i[2] >= i[1]+i[0]:
        continue
    ans += 1

print(ans)


Fixed submission:
import bisect
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N-1, 1,-1):
    for j in range(i-1,0,-1):
        x = L[i]-L[j]
        maxindex = bisect.bisect_right(L, x)
        if j>maxindex:
            ans += j-maxindex

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
L = list(map(int, input().split()))
A = list(itertools.combinations(L, 3))
ans = 0
for i in A:
    if i[0] >= i[1]+i[2]:
        continue
    if i[1] >= i[0]+i[2]:
        continue
    if i[2] >= i[1]+i[0]:
        continue
    ans += 1

print(ans)


Fixed submission:
import bisect
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N-1, 1,-1):
    for j in range(i-1,0,-1):
        x = L[i]-L[j]
        maxindex = bisect.bisect_right(L, x)
        if j>maxindex:
            ans += j-maxindex

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import bisect
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
for _ in range(M):
    x=math.floor(A.pop(N-1)/2)
    bisect.insort(A,x)
print(sum(A))


Fixed submission:
import math
import bisect
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
for _ in range(M):
    x=math.floor(A.pop(N-1)/2)
    bisect.insort(A,x)
print(sum(A))