Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import numpy as np

N = int(input())
a = np.fromstring(input(), sep=" ", dtype=np.int64)
# b = np.bitwise_xor.reduce(a)
# c = np.bitwise_xor(a, b)
# print(*c, sep=" ")
for n in range(N):
    print(np.bitwise_xor.reduce(a) ^ a[n])


### FIXED CODE ###

import numpy as np

N = int(input())
a = np.fromstring(input(), sep=" ", dtype=np.int64)
b = np.bitwise_xor.reduce(a)
c = np.bitwise_xor(a, b)
print(*c, sep=" ")
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
inp = sys.stdin.buffer.readline
def inpS(): return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines 
MOD = 10**9+7

S = inpS()
N = len(S)
dp = [0]*13

dp[0] = 1
mul = 1
for i in range(N-1, -1, -1):
  nextDP = [0]*13
  s = S[i]
  if s == "?":
    for dgt in range(10):
      for mo in range(13):
        ind = (dgt*mul+mo)%13
        nextDP[ind] += dp[mo]
        nextDP[ind] %= MOD        
  else:
    dgt = int(S[i])
    for mo in range(13):
      ind = (dgt*mul+mo)%13
      nextDP[ind] += dp[mo]
      nextDP[ind] %= MOD    
  mul *= 10
  mul %= 13
  dp = nextDP
print(dp[5])    
      

### FIXED CODE ###

import numpy as np
MOD = 10 ** 9 + 7

S = [int(x) if x != "?" else -1 for x in input()]
N = len(S)

# 現在考えてる一つ前の桁数で、余りが i になる整数の個数
r = [0]*13

# まず一つ目の値が１の位とする
s = S[0]
if s != -1:
  r[s] = 1
else:
  for i in range(10):
    r[i] = 1

# 桁を進めながら個数をカウント
for i in range(1, N):
    # dp[j]
    # 現在考えている桁(i)を除く、余りが j となる整数の個数
    dp = [0]*26
    # 桁が一つ上がるので、一つ前の余りが 10 倍になる
    for j in range(13):
      dp[j*10%13] += r[j] % MOD
    # アクセスを高速にするため２倍の長さとる (dp[i] == dp[i + 13])
    dp[13:26] = dp[0:13]
    r = [0]*13
    s = S[i]
    if s == -1:
      w = sum(dp[4:14])
      for j in range(13):
        r[j] += w
        w += dp[j+1] -dp[j+4]
    else:
      for j in range(13):
        r[j] += dp[13-s+j]
print(r[5]%MOD)
### BUGGY CODE ###

N = int(input())
S = list(input())
turn_sum_list = []
for i in range(N):
    turn_east = S[:i].count("W")
    turn_west = S[i:].count("E")
    turn_sum = turn_west + turn_east
    turn_sum_list.append(turn_sum)
print(min(turn_sum_list))

### FIXED CODE ###

N = int(input())
S = list(input())
w_count = 0
e_count = 0
count_sum = [0 for k in range(N)]
for i in range(1,N):
    if S[i - 1] == "W":
        w_count += 1
    count_sum[i] += w_count
for q in range(N-2,-1,-1):
    if S[q + 1] == "E":
        e_count += 1
    count_sum[q] += e_count
print(min(count_sum))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import numpy as np

def solve():
    N, K = map(int, input().split())
    C = np.array(list(map(int,input().split())))
    D = list()
    for i in range(N-K+1):
      c = C[i:i+K]
      l, r = min(min(c),0), max(max(c),0)
      d = -2*l + r if -l < r else  -l + 2*r
      D.append(d)
    return str(min(D))

if __name__ == '__main__':
    print(solve())

### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np

def solve():
    N, K = map(int, input().split())
    C = np.array(list(map(int,input().split())))
    z = (C<0).sum()
    D = set()
    for i in range(N-K+1):
        l = -min(C[i],0)
        r = max(C[i+K-1],0)
        d = 2*l+r if l < r else 2*r+l
        D.add(d)
    return str(min(D))

if __name__ == '__main__':
    print(solve())
### BUGGY CODE ###

def f(L):
    X=0
    T=1
    for x in L[::-1]:
        X+=T*x
        T*=2
    return X

def h(M,L):
    X=[1]*(L+1)
    for i in range(2,L+2):
        X[-i]=(X[-(i-1)]*2)%M
        
    return X

N=int(input())
X=input()
Zero="0"*N

X=list(map(int,X))

H=X.count(1)
Z=f(X)
G=1<<N

A=[]
for i in range(N):
    G>>=1
    
    if X[i]==0:
        J=H+1
    else:
        J=H-1
    
    if J==0:
        A.append(0)
        continue

    Y=Z^G
    B=h(J,N-1)

    V=0
    for i in range(1,N+1):
        V+=B[-i]*(Y%2)
        V%=J
        Y>>=1
        
    Y=V%J
    I=1
    try:
        while True:
            Y=Y%bin(Y).count("1")
            I+=1
    except ZeroDivisionError:
        A.append(I)

print("\n".join(map(str,A)))


### FIXED CODE ###

N=int(input())
X=input()
Y=int(X,2)

J=X.count("1")

A=[0]*N
A[-1]=1
for i in range(2,N+1):
    A[-i]=(A[-(i-1)]*2)%(J+1)

B=[0]*N
if J>1:
    B[-1]=1
    for j in range(2,N+1):
        B[-j]=(B[-(j-1)]*2)%(J-1)


H=[0]*N

Q,R=divmod(Y,J+1)
if J>1:
    S,T=divmod(Y,J-1)
else:
    S=T=0

for i in range(N):
    if X[i]=="0":
        U=(R+A[i])%(J+1)
    else:
        if J==1:
            continue
        U=(T-B[i])%(J-1)
        
        
    I=1
    while U>0:
        U=U%bin(U).count("1")
        I+=1
    H[i]=I

print("\n".join(map(str,H)))
### BUGGY CODE ###

N, K = map(int, input().split())
from itertools import combinations_with_replacement

# a+b % K == 0
# b+c % K == 0
# c+a % K == 0

# a が Kで割り切れる場合
#   -> bもcもKで割り切れる
#   -> a,b,cともにKの倍数
#   -> Kの倍数の個数(N//K) ** 3

# a がKで割れきれない場合
#   -> 同じくbもcもKで割り切れない
#   Q. Kが奇数の場合
#     -> それを満たす(a,b,c)の組み合わせはあり得ない
#   よってKは偶数
#     K=2のとき例より (a,b,c)=(1,1,1),(1,3,3),...
#     K=4のとき(a,b,c)=(2,2,2),(2,6,6),...
#     K=6のとき(a,b,c)=(3,3,3),(3,3,9),...
#   よりa % K == K/2である必要がある
#     a = x*K+K/2 (x=0以上の整数)

num_double = N//K
if K % 2 == 1:
    # Kが奇数の場合
    #  (1) (a,b,c)ともにKの倍数
    print(num_double ** 3)
else:
    # Kが偶数の場合,
    #  (1) (a,b,c)ともにKの倍数
    #  (2) (a,b,c)がいずれも Kで割った余りがK/2となる
    s = K // 2
    nums = [a for a in range(s, N+1, K)]
    count = 0
    for a, b, c in combinations_with_replacement(nums, 3):
        if a == b and b == c:
            count += 1
        elif a == b or b == c:
            count += 3
        else:
            count += 6
    print(num_double ** 3 + count)


### FIXED CODE ###

N, K = map(int, input().split())


def combination(n, r):
    ans = 1
    for i in range(r):
        ans *= n - i
    for i in range(r):
        ans //= i + 1
    return ans


# a+b % K == 0
# b+c % K == 0
# c+a % K == 0

# a が Kで割り切れる場合
#   -> bもcもKで割り切れる
#   -> a,b,cともにKの倍数
#   -> Kの倍数の個数(N//K) ** 3

# a がKで割れきれない場合
#   -> 同じくbもcもKで割り切れない
#   Q. Kが奇数の場合
#     -> それを満たす(a,b,c)の組み合わせはあり得ない
#   よってKは偶数
#     K=2のとき例より (a,b,c)=(1,1,1),(1,3,3),...
#     K=4のとき(a,b,c)=(2,2,2),(2,6,6),...
#     K=6のとき(a,b,c)=(3,3,3),(3,3,9),...
#   よりa % K == K/2である必要がある
#     a = x*K+K/2 (x=0以上の整数)

num_double = N//K
if K % 2 == 1:
    # Kが奇数の場合
    #  (1) (a,b,c)ともにKの倍数
    print(num_double ** 3)
else:
    # Kが偶数の場合,
    #  (1) (a,b,c)ともにKの倍数
    #  (2) (a,b,c)がいずれも Kで割った余りがK/2となる
    s = K // 2
    nums = [a for a in range(s, N+1, K)]
    n = len(nums)
    count = 0
    count += 6 * combination(n, 3)  # a,b,cがいずれも異なる値になるケースはnC3通り 順列は6倍
    count += 3 * n * (n-1)   # a,b,cのうち2つが同じ値になるケースはn(n-1)通り 順列は3倍
    count += n  # a,b,cが同じ値になるケースはn通り
    print(num_double ** 3 + count)
### BUGGY CODE ###

import sys
from collections import deque

def input():
    return sys.stdin.readline().strip()

def main():
    H,W = map(int,input().split())
    A = [list(input()) for _ in range(H)]

    def bfs(x,y,A):
        que = deque()
        que.append((x,y))

        while que:
            x,y = que.popleft()
            if A[y][x] == '#':
                A[y][x] = 0
            for dx,dy in ((-1,0),(1,0),(0,-1),(0,1)):
                sx = x + dx
                sy = y + dy
                if sx < 0 or sx >= W or sy < 0 or sy >= H or A[sy][sx] == '#':
                    continue
                cnt = A[y][x] + 1
                if A[sy][sx] == '.':
                    que.append((sx,sy))
                    A[sy][sx] = cnt
                elif A[sy][sx] > cnt:
                    que.append((sx,sy))
                    A[sy][sx] = cnt

    for x in range(W):
        for y in range(H):
            if A[y][x] == '#':
                bfs(x,y,A)
    ans = 0
    for a in A:
        ans = max(ans,max(a))
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
from collections import deque

def input():
    return sys.stdin.readline().strip()

def main():
    H,W = map(int,input().split())
    A = [list(input()) for _ in range(H)]

    que = deque()
    for x in range(W):
        for y in range(H):
            if A[y][x] == '#':
                que.append((x,y,0))        
    ans = 0
    while que:
        x,y,c = que.popleft()
        for dx,dy in ((-1,0),(1,0),(0,-1),(0,1)):
            sx = x + dx
            sy = y + dy
            if sx < 0 or sx >= W or sy < 0 or sy >= H or A[sy][sx] == '#':
                continue
            if A[sy][sx] == '.':
                que.append((sx,sy,c+1))
                A[sy][sx] = c + 1
                ans = max(ans,c+1)
    print(ans)

if __name__ == "__main__":
    main()
### BUGGY CODE ###

N, S = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
dp = [-1 for _ in range(S+1)]
visited = [0]
dp[0] = 1
dp = tuple(dp)
for k in range(N):
  a = A[k]
  nextdp = list(dp)
  nextvisit = []
  for item in visited:
    #process1 追加する
    if item + a <= S:
      if nextdp[item+a] == -1:
        nextvisit.append(item+a)
        nextdp[item+a] = 0
      nextdp[item+a] += dp[item]
      nextdp[item+a] %= mod
    #process2 追加しない
    nextdp[item] += dp[item]
    nextdp[item] %= mod
  dp = tuple(nextdp)
  visited.extend(nextvisit)

print(max(dp[-1], 0))


### FIXED CODE ###

N, S = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
dp = [0 for _ in range(S+1)]
visited = [0]
dp[0] = 1
dp = tuple(dp)
for k in range(N):
  a = A[k]
  nextdp = list(dp)
  nextvisit = []
  for item in visited:
    #process1
    if item + a <= S:
      if nextdp[item+a] == 0:
        nextvisit.append(item+a)
      nextdp[item+a] += dp[item]
      nextdp[item+a] %= mod
    #process2
    if item <= S:
      nextdp[item] += dp[item]
      nextdp[item] %= mod
  dp = tuple(nextdp)
  visited.extend(nextvisit)

print(dp[-1])
### BUGGY CODE ###


N,K = map(int,input().split())

xy = []

for i in range(N):

    x,y = map(int,input().split())

    xy.append([x,y])

ans = float("inf")

for p1 in range(N):

    for p2 in range(N):

        for p3 in range(N):

            for p4 in range(N):


                left = min(xy[p1][0],xy[p2][0],xy[p3][0],xy[p4][0])
                down = min(xy[p1][1],xy[p2][1],xy[p3][1],xy[p4][1])
                right = max(xy[p1][0],xy[p2][0],xy[p3][0],xy[p4][0])
                up = max(xy[p1][1],xy[p2][1],xy[p3][1],xy[p4][1])

                able = 0
                nable = 0
                for i in range(N):

                    nx = xy[i][0]
                    ny = xy[i][1]
                    if left <= nx and nx <= right and down <= ny and ny <= up:
                        able += 1
                    else:
                        nable += 1

                    if able >= K or nable > N-K:
                        break

                if able >= K:
                    now = max(1,right-left) * max(1,up-down)
                    ans = min(ans,now)

print (ans)


### FIXED CODE ###


N,K = map(int,input().split())

xy = []
xlis = []
ylis = []

for i in range(N):

    x,y = map(int,input().split())

    xy.append([x,y])

    if x not in xlis:
        xlis.append(x)
    if y not in ylis:
        ylis.append(y)

ans = float("inf")
xlis.sort()
ylis.sort()

for rp in range(len(xlis)):

    right = xlis[rp]

    for lp in range(rp+1):

        left = xlis[lp]

        for upp in range(len(ylis)):

            up = ylis[upp]

            for dp in range(upp+1):

                down = ylis[dp]

                able = 0
                nable = 0
                for i in range(N):

                    nx = xy[i][0]
                    ny = xy[i][1]
                    if left <= nx and nx <= right and down <= ny and ny <= up:
                        able += 1
                    else:
                        nable += 1

                    if able >= K or nable > N-K:
                        break

                if able >= K:
                    now = max(1,right-left) * max(1,up-down)
                    ans = min(ans,now)

print (ans)
### BUGGY CODE ###

def main():
    n = int(input())
    d = [list(map(int, input().split())) for _ in range(n)]

    ans = 0
    for i in range(n):
        for j in range(n):
            if i == j:
                continue
            flag = True
            for k in range(n):
                if k == i or k == j:
                    continue
                if d[i][j] > d[i][k]+d[k][j]:
                    print(-1)
                    exit()
                elif d[i][j] == d[i][k]+d[k][j]:
                    flag = False
                else:
                    pass
            if flag:
                ans += d[i][j]
    #print(ans)
    print(ans//2)

if __name__ == '__main__':
    main()


### FIXED CODE ###

n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]

def warshal_floyd(d):
  for k in range(n):
    for i in range(n):
      for j in range(n):
        d[i][j] = min(d[i][j], d[i][k]+d[k][j])
  return d

import copy
B = copy.deepcopy(A)
B = warshal_floyd(B)

ans = 0
for i in range(n):
    for j in range(n):
        if B[i][j] < A[i][j]:
            print(-1)
            exit()
        else:
            for k in range(n):
                if k == i or k == j:
                    continue
                if B[i][j] == B[i][k] + B[k][j]:
                    break
            else:
                ans += A[i][j]
ans //=2
print(ans)
### BUGGY CODE ###

s = input()
k = int(input())
substrings = []
index = []
for ss in sorted(list(set(s))):
  index_list = [n for n, v in enumerate(s) if v == ss]
  index.append(index_list)

for ind in index:
  for i in ind:##初期位置
    for j in range(1,len(s)-i+1):##長さ
      substrings.append(s[i:i+j])
  if len(set(substrings)) >= k:
    break
  

print(sorted(list(set(substrings)))[k-1])

### FIXED CODE ###

s = input()
k = int(input())
substrings = []
index = []
for ss in sorted(list(set(s))):
  index_list = [n for n, v in enumerate(s) if v == ss]
  for i in index_list:##初期位置
    for j in range(1,min(k+1,len(s)-i+1)):##長さ
      substrings.append(s[i:i+j])
  if len(set(substrings)) >= k:
    break
print(sorted(list(set(substrings)))[k-1])
### BUGGY CODE ###

n=int(input())
li = list(input().split())
ans=[]
a=""
for i in range(1,n+1):
  print(li.index(str(i))+1,end=" ")

### FIXED CODE ###

n=int(input())
li = list(map(int,input().split()))
ans=[0]*n
a=""
for (i,x) in zip(range(0,n), li):
  ans[x-1]=i+1
print(' '.join(map(str, ans)))
### BUGGY CODE ###

import numpy as np
N=int(input())
a=list(map(int,input().split()))
b=np.prod(a,dtype='int64')
count=0
while b%2==0:
    b/=2
    count+=1
print(count)

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
count=0
for i in a:
    while i%2==0:
        i/=2
        count+=1
print(count)
### BUGGY CODE ###

S=input()
for i in range(1,10)[::-1]:
    s = "S"*i +"T"*i
    while s in S:
        S=S.replace(s,"")
print(len(S))

### FIXED CODE ###

from collections import deque
S=list(map(lambda x: 1 if x=="T" else 0,input()))

q=deque()

for i in S:

    if i:
        if (not q) or q[-1]!=0:
            q.append(i)
        elif q and q[-1]==0:
            q.pop()
    else:
        q.append(i)
print(len(q))
### BUGGY CODE ###

# abc148_e.py
from sys import stdin
def f(n):
	sum = 1
	while n >= 2:
		sum = sum * n
		n = n - 2
	return sum
N = int(stdin.readline().rstrip())
sum = f(N)
#print(sum)
l = [int(x) for x in list(str(sum))]
l.reverse();
cnt = 0
for i in l:
	if i == 0:
		cnt = cnt + 1
	else:
		break
print(cnt)


### FIXED CODE ###

n = int(input())
if n % 2 == 1:
 print(0)
else:
 i = 10
 ans = 0
 while i <= n:
  ans += n // i
  i *= 5
 print(ans)
### BUGGY CODE ###

N, X, Y = map(int, input().split())
dis = []

for i in range(1, N+1):
  for j in range(i, N+1):
    dis.append(min(j-i, abs(X-i)+1+abs(j-Y), abs(Y-i)+1+abs(j-X)))
    
for i in range(1, N):
  ans = dis.count(i)
  print(ans)

### FIXED CODE ###

N, X, Y = map(int, input().split())
dis = [0]*(N-1)

for i in range(1, N+1):
  for j in range(i+1, N+1):
    kyori = min(j-i, abs(X-i)+1+abs(j-Y), abs(Y-i)+1+abs(j-X))
    dis[kyori-1] += 1
    
for ans in dis:
  print(ans)
### BUGGY CODE ###

buffer = list(input())
S = [int(n) for n in buffer]
N = len(S)
i = 0
count = 0
while(1):
    
    if(S == [] or N == 1):
        break
    elif(S[i] != S[i + 1]):
        S.pop(i)
        S.pop(i)
        i = 0
        count += 2
        N = len(S)
    else:
        i += 1
        if(i == (N - 1)):
            break
print(count)

### FIXED CODE ###

S = list(input())
count_bule = S.count('0')
count_red = S.count('1')
count_min = min(count_bule, count_red)
print(2 * count_min)
### BUGGY CODE ###

#40
import sys
a,b = map(int,input().split())
cou = 0

if a<=0 and b>=0:
    print("Zero")
    sys.exit()
elif a>=0 and b<=0:
    print("Zero")
    sys.exit()
    
if a>0 and b>0:
    print("Positive")
    sys.exit()
else:
    cou = 1
    while a != b:
        cou +=1
    if cou %2 == 0:
        print("Positive")
    else:
        print("Negative")


### FIXED CODE ###

#40
import sys
a,b = map(int,input().split())
cou = 0

if a<=0 and b>=0:
    print("Zero")
    sys.exit()
elif a>=0 and b<=0:
    print("Zero")
    sys.exit()
    
if a>0 and b>0:
    print("Positive")
    sys.exit()
else:
    cou = abs(b-a) +1
    if cou %2 == 0:
        print("Positive")
    else:
        print("Negative")
### BUGGY CODE ###

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

for i in range(m):
    if lm[i] in ln:
        ln.remove(lm[i])
    else:
        print("NO")
        exit()

print("YES")

### FIXED CODE ###

import sys
from collections import Counter
 
N = int(input())
s1 = list(map(int,input().split()))
M = int(input())
s2 = list(map(int,input().split()))
 
c1 = Counter(s1)
c2 = Counter(s2)
 
for k,v in c2.items():
    if k in c1:
        if v > c1[k]:
            print('NO')
            sys.exit()
    else:
        print('NO')
        sys.exit()
print('YES')
### BUGGY CODE ###

import fractions
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
def lcm_base(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm(*numbers):
    return reduce(lcm_base,numbers,1)
num=lcm(*a)
m=1
for i in range(n):
  m*=a[i]
l=0
for i in range(n):
  l+=num//a[i]
  l=l%((10**9)+7)
print(l)
  
  
  
  
  
  


### FIXED CODE ###

import fractions
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
p=10**9+7
def lcm_base(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm(*numbers):
    return reduce(lcm_base,numbers,1)
num=lcm(*a)
l=0
for i in range(n):
  l+=num*pow(a[i],p-2,p)
print(l%p)
### BUGGY CODE ###

nk = [int(s) for s in input().split()]
n = nk[0]
k = nk[1]

p = [int(s) for s in input().split()]
t = 0
for x in range(n-k+1):
  if sum(p[x:x+k]) >= t:
    t = sum(p[x:x+k])

print((t+k)/2)
  

### FIXED CODE ###

nk = [int(s) for s in input().split()]
n = nk[0]
k = nk[1]

p = [int(s)+1 for s in input().split()]
l = [sum(p[:k])]

for x in range(n-k):
  l.append(l[x]-p[x]+p[x+k])
print(max(l)/2)
### BUGGY CODE ###

N = int(input())
S = input()
s = S[:]
while '()' in s:
    s.replace('()', '')
ans = '(' * s.count(')') + S + ')' * s.count('(')
print(ans)


### FIXED CODE ###

N = int(input())
S = input()
s = S[:]
while '()' in s:
    s = s.replace('()', '')
ans = '(' * s.count(')') + S + ')' * s.count('(')
print(ans)
### BUGGY CODE ###

from bisect import insort
n, k = map(int, input().split())
array = []

for _ in range(n):
    a, b = map(int, input().split())
    insort(array, (a, b))

for a, b in array:
    k -= b
    if k <= 0:
        break

print(a)


### FIXED CODE ###

from collections import Counter

n, k = map(int, input().split())
counter = Counter()
for _ in range(n):
    a, b = map(int, input().split())
    counter[a] += b

for key in sorted(counter.keys()):
    k -= counter[key]
    if k <= 0:
        break
print(key)
### BUGGY CODE ###


import sys
sys.setrecursionlimit(200005)

n, q = [int(i) for i in input().split()]

tree = [[] for _ in range(n+1)]
for _ in range(n-1):
    a, b = [int(i) for i in input().split()]
    tree[a].append(b)
    tree[b].append(a)

counter = [0] * (n+1)
for _ in range(q):
    p, x = [int(i) for i in input().split()]
    counter[p] += x

que = [[0,1]]
while len(que) > 0:
    parent, node = que.pop(0)
    for leaf in tree[node]:
        if leaf == parent:
            continue
        counter[leaf] += counter[node]
        que.append([node, leaf])

for counter_i in counter[1:]:
    print(counter_i, end=" ")


### FIXED CODE ###

from collections import deque

n, q = [int(i) for i in input().split()]

tree = [[] for _ in range(n+1)]
for _ in range(n-1):
    a, b = [int(i) for i in input().split()]
    tree[a].append(b)
    tree[b].append(a)

counter = [0] * (n+1)
for _ in range(q):
    p, x = [int(i) for i in input().split()]
    counter[p] += x

queue = deque([[0,1]])
while queue:
    parent, node = queue.popleft()
    for leaf in tree[node]:
        if leaf == parent:
            continue
        counter[leaf] += counter[node]
        queue.append([node, leaf])

print(*counter[1:])
### BUGGY CODE ###

from itertools import combinations as c

n,a=map(int,input().split())
l=list(map(int,input().split()))
v=0
for i in range(1,n+1):
  v+=sum([1 for j in c(l,i) if sum(j)==a*i])
print(v)

### FIXED CODE ###

n,a=map(int,input().split())
l=list(map(int,input().split()))
x=max(l)
x=max(x,a)
dp=[[[0 for _ in range(n*x+1)] for _ in range(n+1)] for _ in range(n+1)]

for j in range(n+1):
  for k in range(n+1):
    for s in range(n*x+1):
      if j==0 and k==0 and s==0:
        dp[j][k][s]=1
      elif j>=1 and s<l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]
      elif j>=1 and k>=1 and s>=l[j-1]:
        dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-l[j-1]]
      else:
        dp[j][k][s]=0

s=0
for k in range(1,n+1):
  s+=dp[n][k][k*a]

print(s)
### BUGGY CODE ###

import numpy as np
import sys
n,m = map(int,input().split())
list_a = list(map(int,input().split()))
#b_list = list(map(int,input().split()))
#print(" ".join(map(str,c_list)))
list_a.sort(reverse = True)
a_max = list_a[0] // 2
list_a[0] = a_max
count = 1
if m == 1:
    print(sum(list_a))
    sys.exit()
if n == 1:
    for i in range(m-1):
        list_a[0]  = list_a[0] // 2
    print(sum(list_a))
    sys.exit()
for i in range(m-1):
    if list_a[np.argmax(list_a[0:count])] < list_a[count]:
        #print(list_a[np.argmax(list_a[0:count])],list_a[count])
        list_a[count] = list_a[count] // 2 
        if count < len(list_a) - 1:
            count += 1
    else:
        list_a[np.argmax(list_a[0:count])] = list_a[np.argmax(list_a[0:count])] // 2
        #print(list_a[np.argmax(list_a[0:count])])
print(sum(list_a))
"""
for i in range(m):
    count = 0
    while count == 0:

        for j in range(n):
            
            if list_a[j] > a_max:
                list_a[j] = list_a[j]//2
                a_max = a_max//2
                count = 1 
                print("c=1")
                print(a_max)
                print(list_a)
                break
        if count == 0:
            a_max -= 1
            print("c=0")
    
print(list_a)
"""

### FIXED CODE ###

import sys
n,m = map(int,input().split())
lst_a = list(map(int,input().split()))
temp = 0
cnt = 0
fin = 0
loop = 0
debug = 0
temp2 = 0
if n == 1:
    for i in range(m):
        lst_a[0] //= 2
    print(lst_a[0])
    sys.exit()
while debug < 10:
    loop = 0
    #temp2 = temp
    temp = 0
    lst_a.sort(reverse=True)
    while loop < n-1:
        lst_a[loop] //= 2
        cnt += 1
        temp = max(temp,lst_a[loop])
        if cnt == m:
            #print(lst_a)
            print(sum(lst_a))
            sys.exit()
        if temp > max(lst_a[loop],lst_a[loop + 1]):
            break
        if lst_a[loop + 1] > lst_a[loop]:
            loop += 1
        
        
        
"""        if lst_a[loop] >= max(lst_a[loop + 1],temp):
            lst_a[loop] //= 2
            temp = max(lst_a[loop],lst_a[loop+1])
            cnt += 1
            if cnt == m:
                print(sum(lst_a))
                sys.exit()
            if temp > lst_a[loop + 1]:
                break
            
            
        loop += 1
    
    #debug += 1
print(lst_a[99999])
# print(temp)
# print(cnt)
# print(lst_a)
# print(sum(lst_a))
"""