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

n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]
ans = [k-q] * n
for i in set(a):
    ans[i-1] += a.count(i)
for k in ans:
    if k > 0:
        print('Yes')
    else:
        print('No')
        

### FIXED CODE ###

from collections import Counter
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]
ans = ['No'] * n
c = Counter(a)
for i in range(1, n+1):
    if c[i] > q - k:
        ans[i-1] = 'Yes'
for k in ans:
    print(k)
### BUGGY CODE ###

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

sum = 0
sum_p = 0
sum_l = []

for i in range(len(p) - K + 1):
    l = p[i:K]
    # print(l)
    for j in l:
        for k in range(j):
            k += 1
            sum += k / j
        # print(sum)
        sum_p += sum
        sum = 0
    sum_l.append(sum_p)
    sum_p = 0
    K += 1

print(max(sum_l))


### FIXED CODE ###

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

for i in range(len(p)):
    p[i] = (p[i] + 1) / 2

sum = 0
S = [0]

for i in p:
    sum += i
    S.append(sum)

# print(S)

max = 0

for i in range(len(p) - K + 1):
    s = S[i + K] - S[i]
    # print(s)
    if max < s:
        max = s

print(max)
### BUGGY CODE ###

n=int(input())
a = list(map(int, input().rstrip().split()))
m=0
count=0
for i in range(0,n):
  k=i
  for j in range(i+1,n):
    if(a[j]>a[k]):
      break
    k+=1
    count+=1
  if(count>m):
    m=count
  count=0
print(m)



### FIXED CODE ###

n = int(input())

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

x = 0
y = 0

for i in range(1, n):
    if(a[i] <= a[i-1]):
        y +=1
    else:
        x = max(x,y)
        y = 0

print(max(x,y))
### BUGGY CODE ###

import numpy as np

mod = 998244353
n, s = map(int, input().split())
arr = list(map(int, input().split()))
dp = np.zeros((n + 1, s + 1))
dp[0, 0] = 1

for i in range(1, n + 1):
    var = arr[i - 1]
    for j in range(0, s + 1):
        dp[i, j] = 2 * dp[i - 1, j]
        dp[i, j] %= mod
        if j - var >= 0 and dp[i, j - var] != 0:
            dp[i, j] += dp[i - 1, j - var]
            dp[i, j] %= mod
print(int(dp[n, s]))

### FIXED CODE ###

mod = 998244353
n, s = map(int, input().split())
arr = list(map(int, input().split()))
dp = [[0] * (s + 1) for _ in range(n + 1)]
dp[0][0] = 1

for i in range(1, n + 1):
    var = arr[i - 1]
    for j in range(0, s + 1):
        dp[i][j] = 2 * dp[i - 1][j]
        dp[i][j] %= mod
        if j - var >= 0 and dp[i - 1][j - var] != 0:
            dp[i][j] += dp[i - 1][j - var]
            dp[i][j] %= mod
print(int(dp[n][s]))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def main():
    N,P = map(int,input().split())
    if N==1:
        print(P)
    else:
        ans = 1
        insuu = 2
        while insuu**N<=P:
            if P%(insuu**N)==0:
                ans *= insuu
                P //= insuu**N
            else:
                insuu += 1
        print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N,P = map(int,input().split())
    if N==1:
        print(P)
    elif N>50:
        print(1)
    else:
        ans = 1
        insuu = 2
        while insuu**N<=P:
            if P%(insuu**N)==0:
                ans *= insuu
                P //= insuu**N
            else:
                insuu += 1
        print(ans)

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

def fact(X):
    res = 1
    for i in range(1,X+1):
        res *= i
    return res

N, M = map(int,input().split())
N, M = max(N,M), min(N,M)
mod = 10**9 + 7
if N-M != 1 and N != M:
    ans = 0
elif N != M:
    factN = fact(N)
    ans = (factN*factN//N)%mod
else:
    factN = fact(N)
    ans = (factN*factN*2)%mod
print(ans)

### FIXED CODE ###

import math
N, M = map(int,input().split())
N, M = max(N,M), min(N,M)
mod = 10**9 + 7
if N-M != 1 and N != M:
    ans = 0
elif N != M:
    factN = math.factorial(N)
    ans = (factN*factN//N)%mod
else:
    factN = math.factorial(N)
    ans = (factN*factN*2)%mod
print(ans)
### BUGGY CODE ###

import math

k=int(input())
ans=3*k**2-3*k+1
for i in range(2,k+1):
    for j in range(2,k+1):
        for l in range(2,k+1):
            ans+=math.gcd(math.gcd(i,j), l)
            #print(gcd(i,j,l))
print(ans)

### FIXED CODE ###

from math import gcd

k=int(input())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            ans+=gcd(gcd(i,j), l)
            #print(gcd(i,j,l))
print(ans)
### BUGGY CODE ###

n, w = [int(i) for i in input().split()]
wv = [[int(i) for i in input().split()] for _ in range(n)]

# i番目以降の品物で、容量がjのときの価値の最大値


def value(i, j):
    # もう品物がない
    if i == n:
        ret = 0
    # 品物が入らない
    elif j < wv[i][0]:
        ret = value(i+1, j)
    # 品物を入れない場合と入れる場合
    else:
        ret = max(value(i+1, j), value(i+1, j-wv[i][0]) + wv[i][1])
    return ret


print(value(0, w))


### FIXED CODE ###

import collections


Item = collections.namedtuple("Item", ("weight", "value"))


def main():
    N, W = [int(i) for i in input().split()]
    items = [Item(int(i), int(j))for (i, j) in [input().split() for _ in range(N)]]
    # 選択肢をn番目の品物まで、重さを最大wとしたときの価値の最大値
    dp = [[0] * (W + 1) for _ in range(N + 1)]

    # n番目の品物まで含む
    for n in range(1, N + 1):
        # 重さの最大値がw
        for w in range(W + 1):
            # n番目の品物
            item = items[n - 1]
            # 買う（＝買える）
            if w - item.weight >= 0:
                dp[n][w] = max(dp[n][w], dp[n - 1][w - item.weight] + item.value)
            # 買わない（＝買えない）場合も行う
            dp[n][w] = max(dp[n][w], dp[n - 1][w])

    ans = dp[N][W]
    print(ans)


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

N=int(input())
A=list(map(int,input().split()))
count=[0]*N
def f(K,L):
  B = L[0:K]+L[K+1:] #popを使うとなぜか元のAまで変化してしまう
  C=list(set(B))
  c = [0]*len(C)
  d = [0]*len(C)
  x=0
  for i in range(len(C)):
    c[i] = B.count(C[i])
    d[i] = int((c[i])*(c[i]-1)/2)
    x += d[i]
  return x


for k in range(N):
  count[k]=f(k,A)

for i in range(len(count)):
  print(count[i])

### FIXED CODE ###

import sys
from collections import Counter
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=Counter(L)
x=0
for a in C.values():
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-C[L[K]]+1)
### BUGGY CODE ###

N = int(input())
As = list(map(int,input().split()))
ans = 1
for A in As:
  ans *= A
if ans > 10 ** 18:
    ans = -1
print(ans)

### FIXED CODE ###

N = int(input())
As = list(map(int,input().split()))
if 0 in As:
  ans = 0
else:
  ans = 1
  for A in As:
    ans *= A
    if ans > 10 ** 18:
      ans = -1
      break
print(ans)
### BUGGY CODE ###

from queue import Queue
H,W=map(int,input().split())
s=[list(input()) for _ in range(H)]

white=sum([1 if s[y][x]=='.' else 0 for x in range(W) for y in range(H)])
used=[[False for x in range(W)] for y in range(H)]
q=Queue()
q.put((0,0,1))
while True:
    if q.empty():
        print(-1)
        break
    x,y,l=q.get()
    if x==W-1 and y==H-1:
        print(white-l)
        break
    used[y][x]=True
    for d in [(1,0),(0,1),(-1,0),(0,-1)]:
        nx=x+d[0]
        ny=y+d[1]
        if ny>=0 and ny<H and nx>=0 and nx<W and not used[ny][nx]:
            if s[ny][nx]=='.':
                q.put((nx,ny,l+1))
    


### FIXED CODE ###

from collections import deque
H,W=map(int,input().split())
white=0
s=[]
for y in range(H):
    line=input()
    white+=line.count('.')
    s.append(list(line))

q = deque([(0,0,1)])
q_append=q.append
q_popleft=q.popleft
while q:
    x,y,l=q_popleft()
    if s[y][x]!='.':
        continue
    if x==W-1 and y==H-1:
        print(white-l)
        break
    s[y][x]='*'
    for d in [(1,0),(0,1),(-1,0),(0,-1)]:
        nx, ny=(x+d[0],y+d[1])
        if 0<=nx<W and 0<=ny<H:
            q_append((nx,ny,l+1))
else:
    print(-1)
### BUGGY CODE ###

hlist = list(str(input()))
ch = 0
hh = 0
f = 0 #홍수구역인지 아닌지 판단
s = 0
slist = []
chlist = []
for i in range(len(hlist)):
    if (hlist[i] == '/'):
        ch += 1
    elif (hlist[i] == '\\' ):
        ch -= 1
    chlist.append(ch)
for i in range(len(hlist)):
    ch = chlist[i]
    
    if (hh > max(chlist[i:])):
        hh = max(chlist[i:])
    elif (ch > hh):
        hh = ch
    elif (ch < hh):
        f = 1
    elif (ch == hh and chlist[i] == chlist[i-1] + 1):
        f = 0
        s += 1/2
        slist.append(s)
    
    if (f == 1):
        if (hlist[i] == '/'):
            s += (hh - ch + 1/2)
        elif (hlist[i] == '\\'):
            s += (hh - ch - 1/2)
        elif (hlist[i] == '_'):
            s += (hh - ch)
    elif (f == 0):
        s = 0

print(int(sum(slist)))
if len(slist) != 0:
    print(len(slist), end = ' ')
else:
    print(len(slist), end = '')
for i in range(len(slist)):
    if (i == len(slist) - 1):
        print(int((slist[i])), end = '')
    else:
        print(int((slist[i])), end = ' ')
print()


### FIXED CODE ###

s=j=0
a=[];b=[];d=[]
for i,x in enumerate(input()):
    if x=='\\':a+=[i]
    elif x=='/' and a:
        j=a.pop()
        c=i-j;s+=c
        while b and b[-1]>j:c+=d.pop();b.pop()
        b+=[j];d+=[c]
print(s)
print(len(b),*(d))
### BUGGY CODE ###

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

p_=[]
for i in range(len(p)):
  p_.append((1+p[i])/2)
ans=0
for i in range(N+2-K):
  s=sum(p_[i:i+K])
  ans=max(ans,s)
print(ans)

### FIXED CODE ###

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

p_=[]
for i in range(len(p)):
  p_.append((1+p[i])/2)
 
import itertools
c=list(itertools.accumulate(p_))

ans=0
if N!=K:
  
  for i in range(0,N-K):
    s=c[i+K]-c[i]
    ans=max(ans,s)
else:
  ans=c[K-1]
print(ans)
### BUGGY CODE ###

# -*- coding:utf8 -*-

n,k,q = map(int, input().split())
a = [int(input()) for _ in range(q)]
pb = k - q
for i in range(1, n + 1):
    p = pb + a.count(i)
    if p > 0:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

# -*- coding:utf8 -*-
from collections import Counter

n,k,q = map(int, input().split())
a = Counter([int(input()) for _ in range(q)])
if k > q:
    for _ in range(n):
        print('Yes')
else:
    d = q - k + 1
    for i in range(1, n + 1):
        if not a[i]:
            print('No')
        else:
            if a[i] >= d:
                print('Yes')
            else:
                print('No')
### BUGGY CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    for i in range(1, N + 1):

        if i == N:
            print(A.index(i) + 1)
        else:
            print(A.index(i) + 1, end=" ")
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    l = [None] * N
    for i in range(0, N):
        l[A[i] - 1] = str(i + 1)
    print(" ".join(l))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


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

N=input()
input = [int(input()) for i in range(int(N))]
max=-10000000000
for i,x in enumerate(input):
	for j,y in enumerate(input):
		if j>i:
			if max < input[j]-input[i]:
				max = input[j]-input[i]
print(max)
	

### FIXED CODE ###

N=input()
input = [int(input()) for i in range(int(N))]
maxv=-10000000000
minv=10000000000
for i,x in enumerate(input):
	maxv = max(maxv, input[i]-minv)
	minv = min(minv, input[i])
print(maxv)
### BUGGY CODE ###

#!/usr/bin/env python3
import math

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, K = map(int, input().split())
    A = [int(i) for i in input().split()]

    dv = []
    for _ in range(int(math.log2(K)) + 1):
        l = [0] * N
        dv.append(l)
    
    for n in range(N):
        dv[0][n] = A[n] - 1
    
    for k in range(1, int(math.log2(K)) + 1):
        for n in range(N):
            dv[k][n] = dv[k - 1][dv[k - 1][n]]
    
    a = []
    for i in range(60):
        if K>>i & 1:
            a.append(i)

    now = 0
    for i in reversed(a):
        now = dv[i][now]
    print(now + 1)





    pass

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    N, K = map(int, input().split())
    A = [int(a) for a in input().split()]

    count = 0
    now = 1
    visited = [-1] * N
    visited[now - 1] = 0 # 町1 は0かいでいける
    while count < K:
        now = A[now - 1]
        count += 1
        if visited[now - 1] == -1:
            visited[now - 1] = count
        else:
            loop = count - visited[now - 1]
            rest = (K - visited[now - 1]) % loop
            #print("resr", rest)
            if rest == 0:
                break
            for i in range(len(visited)):
                if visited[i] == visited[now - 1] + rest:
                    now = i + 1
                    count = K # break
                    break
    #print(visited[0])
    print(now)




    pass

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

s = input()
q = int(input())
for i in range(q):
    T = input().split()
    if T[0] == '1':
        s = s[::-1]
    else:
        if T[1] == '1':
            s = T[2] + s
        else:
            s = s + T[2]
print(s)

### FIXED CODE ###

from collections import deque

s = deque(input())
q = int(input())
flip = 1
for i in range(q):
    T = input().split()
    if T[0] == '1':
        flip *= -1
    else:
        _flip = 1 if T[1]=='1' else -1
        if (flip * _flip)==1:
            s.appendleft(T[2])
        else:
            s.append(T[2])
print("".join(s) if flip==1 else "".join(reversed(s)))
### BUGGY CODE ###

from itertools import permutations
import sys
N, M, R = map(int, input().split())
rs = [x - 1 for x in map(int, input().split())]
# グラフを作る
dist = [[float('inf')] * (N) for _ in range(N)]
for e in sys.stdin:
    A, B, C = map(int, e.split())
    dist[A - 1][B - 1] = dist[B - 1][A - 1] = C
# ワーシャルフロイドで全頂点間距離算出
for k in range(N):
    for i in range(N):
        for j in range(N):
            if dist[i][j] > dist[i][k] + dist[k][j]:
                dist[i][j] = dist[i][k] + dist[k][j]
# 組み合わせ全探索
ans = float('inf')
for p in permutations(rs):
    tmp = 0
    for u, v in zip(p, p[1:]):
        tmp += dist[u][v]
        if tmp > ans:
            break
    else:
        ans = tmp
print(ans)

### FIXED CODE ###

from itertools import permutations
import sys
def main():
    N, M, R = map(int, input().split())
    rs = [x - 1 for x in map(int, input().split())]
    # グラフを作る
    dist = [[float('inf')] * (N) for _ in range(N)]
    for e in sys.stdin:
        A, B, C = map(int, e.split())
        dist[A - 1][B - 1] = dist[B - 1][A - 1] = C
    # ワーシャルフロイドで全頂点間距離算出
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if dist[i][j] > dist[i][k] + dist[k][j]:
                    dist[i][j] = dist[i][k] + dist[k][j]
    # 組み合わせ全探索
    ans = float('inf')
    for p in permutations(rs):
        tmp = 0
        for u, v in zip(p, p[1:]):
            tmp += dist[u][v]
            if tmp > ans:
                break
        else:
            ans = tmp
    print(ans)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

N,Q = map(int,input().split())
S = input()
l,r = [],[]
index = []
for i in range(Q):
    tmp1,tmp2 = map(int,input().split())
    l.append(tmp1)
    r.append(tmp2)
for i in range(len(S) - 1):
    if(S[i] == 'A' and S[i+1] == 'C'):
        index.append(i+1)
def f(l,r):
    ans = [i for i in index if l-1 < i <= r-1]
    return len(ans)

for i in range(Q):
    print(f(l[i],r[i]))

### FIXED CODE ###

N,Q = map(int,input().split())
S = input()
l,r = [],[]
index = []
for i in range(Q):
    tmp1,tmp2 = map(int,input().split())
    l.append(tmp1)
    r.append(tmp2)
counter = 0
index.append(counter)
for i in range(1,len(S)):
    if(S[i-1] == 'A' and S[i] == 'C'):
        counter += 1
    index.append(counter)
def f(l,r):
    return index[r-1] - index[l-1]
for i in range(Q):
    print(f(l[i],r[i]))
### BUGGY CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))
S = list(str(input()))
S.reverse()
extra = 0
each_extras = [[0 for i in range(10)] for i in range(S.count("?"))]
cnt = 0
for i in range(len(S)):
    if S[i] != "?":
        extra += int(S[i]) * 10 ** i
    else:
        each_extras[cnt] = []
        for x in range(10):
            each_extras[cnt].append(x * 10 ** i % 13)
            # each_extras[cnt][x * 10 ** i % 13] = 1
        cnt += 1

# print(each_extras)

# print(extra)
dp = [[0 for i in range(13)] for j in range(cnt+1)]
dp[0][extra % 13] = 1
for i in range(cnt):
    for extras in each_extras[i]:
        for j in range(13):
            dp[i+1][(extras + j)%13] += dp[i][j]
            dp[i+1][(extras + j)%13] %= mod
    for j in range(13):
        dp[i+1][j] = dp[i+1][j] % mod

# print(dp)
print(dp[-1][5] % mod)


### FIXED CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))


"""
S.reverse()
extra = 0
each_extras = [[0 for i in range(10)] for i in range(S.count("?"))]
cnt = 0
for i in range(len(S)):
    if S[i] != "?":
        extra += int(S[i]) * 10 ** i
    else:
        each_extras[cnt] = []
        for x in range(10):
            each_extras[cnt].append(x * 10 ** i % 13)
            # each_extras[cnt][x * 10 ** i % 13] = 1
        cnt += 1

# print(each_extras)

# print(extra)
dp = [[0 for i in range(13)] for j in range(cnt+1)]
dp[0][extra % 13] = 1
for i in range(cnt):
    for extras in each_extras[i]:
        for j in range(13):
            dp[i+1][(extras + j)%13] += dp[i][j]
            dp[i+1][(extras + j)%13] %= mod
    for j in range(13):
        dp[i+1][j] = dp[i+1][j] % mod


# print(dp)
print(dp[-1][5] % mod)
"""


S = list(str(input()))

dp = [[0 for i in range(13)]for j in range(len(S)+1)]
dp[0][0] = 1
S.reverse()
mul = 1
for i in range(len(S)):
    if S[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i+1][(mul*j+k)%13] += dp[i][k]
                dp[i+1][(mul*j+k)%13] %= mod
    else:
        for k in range(13):
            dp[i+1][(int(S[i])*mul+k)%13] += dp[i][k]
            dp[i+1][(int(S[i])*mul+k)%13] %= mod
    mul *= 10
    mul %= 13

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

R, C, K = map(int, input().split())
item = [[0]*C for _ in range(R)]
for _ in range(K):
    r, c, v = map(int, input().split())
    item[r-1][c-1] = v

DP = [[[0, 0, 0, 0] for _ in range(C)] for _ in range(R)]

for i in range(R):
    for j in range(C):
        if i == 0 and j == 0:
            if item[i][j]:
                DP[i][j][1] = item[i][j]

        elif i == 0:
            if item[i][j]:
                DP[i][j][1] = max(DP[i][j-1][0]+item[i][j], DP[i][j-1][1])
                DP[i][j][2] = max(DP[i][j-1][1]+item[i][j], DP[i][j-1][2])
                DP[i][j][3] = max(DP[i][j-1][2]+item[i][j], DP[i][j-1][3])
            else:
                DP[i][j][1] = DP[i][j-1][1]
                DP[i][j][2] = DP[i][j-1][2]
                DP[i][j][3] = DP[i][j-1][3]

        elif j == 0:
            if item[i][j]:
                DP[i][j][1] = max(DP[i-1][j]) + item[i][j]
            else:
                DP[i][j][0] = max(DP[i - 1][j])

        else:
            if item[i][j]:
                DP[i][j][0] = max(DP[i][j-1][0], max(DP[i-1][j]))
                DP[i][j][1] = max(DP[i][j-1][0]+item[i][j], DP[i][j-1][1], max(DP[i-1][j])+item[i][j])
                DP[i][j][2] = max(DP[i][j-1][1]+item[i][j], DP[i][j-1][2])
                DP[i][j][3] = max(DP[i][j-1][2]+item[i][j], DP[i][j-1][3])
            else:
                DP[i][j][0] = max(DP[i][j-1][0], max(DP[i-1][j]))
                DP[i][j][1] = DP[i][j-1][1]
                DP[i][j][2] = DP[i][j-1][2]
                DP[i][j][3] = DP[i][j-1][3]

print(max(DP[R-1][C-1]))

### FIXED CODE ###

import sys

R, C, K = map(int, input().split())
item = [[0] * (C + 1) for _ in range(R + 1)]  # dp配列と合わせるために, 0行目, 0列目を追加している.
for s in sys.stdin.readlines():
    r, c, v = map(int, s.split())
    item[r][c] = v

dp = [[[0] * (C + 1) for _ in range(R + 1)] for _ in range(4)]
for i in range(R + 1):
    for j in range(C + 1):
        for k in range(4):
            here = dp[k][i][j]
            # 次の行に移動する場合
            if i + 1 <= R:
                # 移動先のアイテムを取らない場合
                dp[0][i + 1][j] = max(dp[0][i + 1][j], here)
                # 移動先のアイテムを取る場合
                dp[1][i + 1][j] = max(dp[1][i + 1][j], here + item[i + 1][j])
            # 次の列に移動する場合
            if j + 1 <= C:
                # 移動先のアイテムを取らない場合
                dp[k][i][j + 1] = max(dp[k][i][j + 1], here)
                # 現在のkが3未満のときのみ, 移動先のアイテムを取ることが可能
                if k < 3:
                    dp[k + 1][i][j + 1] = max(dp[k + 1][i][j + 1], here + item[i][j + 1])
ans = 0
for k in range(4):
    ans = max(ans, dp[k][-1][-1])
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
N = int(input())
L = list(map(int,input().split()))
count =0

L.sort(reverse = True)
for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i] < L[j] +L[k] and L[j] < L[k] + L[i] and L[k] < L[i] +L[j]:
                count += 1
            else: 
                break
                
print(count)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import bisect

N = int(input())
L = list(map(int,input().split()))

count = 0
L.sort()
for i in range(N-2):
    for j in range(i+1,N-1):
        k = bisect.bisect_left(L,L[i]+L[j])
        count += k - j - 1 
        
print(count)
### BUGGY CODE ###

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

pairs = list(itertools.combinations(range(n), 2))
ans = 0
for pair in pairs:
    if abs(pair[0]-pair[1]) == (a[pair[0]]+a[pair[1]]):
        ans += 1

print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
add_dic = {}
sub_dic = {}

for i in range(n):
    add_tmp = i + a[i]
    sub_tmp = i - a[i]
    if not add_tmp in add_dic.keys():
        add_dic[add_tmp] = 1
    else:
        add_dic[add_tmp] += 1
    if not sub_tmp in sub_dic.keys():
        sub_dic[sub_tmp] = 1
    else:
        sub_dic[sub_tmp] += 1

ans = 0
for k, v in add_dic.items():
    if k in sub_dic.keys():
        ans += v * sub_dic[k]
print(ans)
### BUGGY CODE ###

n,m = map(int,input().split())
A = list(map(int,input().split()))
B = sorted(A)
cnt = 1
for i in range(m):
    B = sorted(B)
    B[-1] //= 2
print(sum(B))

### FIXED CODE ###

import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
#入力
#解答
#出力
#Priority-queue
class PriorityQueue:

    def __init__(self,heap):
        self.heap = heap
        heapify(self.heap)
    
    def push(self,item):
        heappush(self.heap,item)
    
    def pop(self):
        return heappop(self.heap)
    
    def pushpop(self,item):
        return heappushpop(self.heap,item)
    
    def __call__(self):
        return self.heap

    def __len__(self):
        return len(self.heap)

n,m = map(int,input().split())
A = sorted(list(map(int,input().split())))
heap = []
q = PriorityQueue(heap)
for i in range(n):
    q.push(-A[i])

for i in range(m):
    a = q.pop()
    a *= -1
    a //=2
    a *= -1
    q.push(a)
print(-1*sum(heap))