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

import math


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def using_sqrt(limit):
    n = []
    for k in range(2, limit + 1):
        factor = 0

        # 2以外の偶数は素数ではないので無視する
        if k % 2 == 0 and k != 2:
            continue

        # 繰り返しの上限を対象の平方根にする
        for divisor in range(2, math.floor(math.sqrt(k)) + 1):
            if k % divisor == 0:
                factor += 1

        if factor == 0:
            n.append(k)

    return n


def isPrime(limit):
    for k in range(limit, limit + 1):
        factor = 0

        # 2以外の偶数は素数ではないので無視する
        if k % 2 == 0 and k != 2:
            continue

        # 繰り返しの上限を対象の平方根にする
        for divisor in range(2, math.floor(math.sqrt(k)) + 1):
            if k % divisor == 0:
                factor += 1

        if factor == 0:
            return True
    return False


n = int(input())
prime = using_sqrt(50**5)
prev = []

if n > 1 and isPrime(n):
    print(1)
    exit()


def check(n, prev):
    divs = make_divisors(int(n))
    flag = False
    for i in divs[1:]:
        for p in prime:
            e = math.log(i, p)
            if e.is_integer() and i not in prev:
                prev.append(i)
                flag = True
                check(n/i, prev)
                break
        if flag:
            break


check(n, prev)
print(len(prev))

### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


n = int(input())
if n == 1:
    print(0)
    exit()
z = factorization(n)
cnt = 0
for item in z:
    p = item[0]
    e = item[1]
    num = 1
    while e >= num:
        e -= num
        cnt += 1
        num += 1

print(cnt)
### BUGGY CODE ###

# coding: utf-8

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def dfs(v, p = -1):
    deg[v] = len(U[v])
    dp[v] = [0] * deg[v]
    ans = 1
    for i in range(deg[v]):
        u = U[v][i]
        if u == p:
            par[v] = i
            continue
        dp[v][i] = dfs(u, v)
        ans *= dp[v][i] + 1
        ans %= M
    return(ans)

def bfs(v, ans_p = 0, p = -1):
    if p != -1:
        dp[v][par[v]] = ans_p
    lmul = [1] * (deg[v] + 1)
    rmul = [1] * (deg[v] + 1)
    for i in range(1, deg[v] + 1):
        lmul[i] = lmul[i - 1] * (dp[v][i - 1] + 1) % M
        rmul[-i - 1] = rmul[-i] * (dp[v][-i] + 1) % M
    ans[v] = rmul[0]
    for i in range(deg[v]):
        u = U[v][i]
        if u == p:
            continue
        bfs(u, lmul[i] * rmul[i + 1] % M, v)

N, M = map(int, input().split()) # 1 <= N <= 10^5, 2 <= M <= 10^9
U = [list() for _ in range(N)]
for x, y in [map(int, input().split()) for _ in range(N - 1)]:
    U[x - 1].append(y - 1)
    U[y - 1].append(x - 1)
deg = [0] * N
par = [0] * N
dp = [None] * N
ans = [0] * N
dfs(0)
bfs(0)
print("\n".join([str(x) for x in ans]))


### FIXED CODE ###

# coding: utf-8

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def dfs(v, p = -1):
    deg[v] = len(U[v])
    dp[v] = [0] * deg[v]
    ans = 1
    for i in range(deg[v]):
        u = U[v][i]
        if u == p:
            par[v] = i
            continue
        dp[v][i] = dfs(u, v)
        ans *= dp[v][i] + 1
        ans %= M
    return(ans)

def bfs(v, ans_p = 0, p = -1):
    if p != -1:
        dp[v][par[v]] = ans_p
    lmul = [1] * (deg[v] + 1)
    rmul = [1] * (deg[v] + 1)
    for i in range(1, deg[v] + 1):
        lmul[i] = lmul[i - 1] * (dp[v][i - 1] + 1) % M
        rmul[-i - 1] = rmul[-i] * (dp[v][-i] + 1) % M
    ans[v] = rmul[0]
    for i in range(deg[v]):
        u = U[v][i]
        if u == p:
            continue
        bfs(u, lmul[i] * rmul[i + 1] % M, v)

N, M = map(int, input().split()) # 1 <= N <= 10^5, 2 <= M <= 10^9
U = [list() for _ in range(N)]
for x, y in [map(int, input().split()) for _ in range(N - 1)]:
    U[x - 1].append(y - 1)
    U[y - 1].append(x - 1)
deg = [0] * N
par = [0] * N
dp = [None] * N
ans = [0] * N
dfs(0)
bfs(0)
print("\n".join([str(x) for x in ans]))
### BUGGY CODE ###

import fractions
import copy
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
	B = copy.copy(A)
	del B[i]
	tmp = B[0]
	for j in range(1, N - 1):
		tmp = fractions.gcd(tmp, B[j])
	ans = max(ans, tmp)
print(ans)


### FIXED CODE ###

from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
Asort = sorted(A)[:: -1]
L = [0] * N  #左からi番目までのgcdをメモった配列
R = [0] * N  #右からi番目までのgcdをメモった配列
L[0] = A[0]
R[0] = A[N - 1]
for i in range(1, N):
	L[i] = gcd(L[i - 1], A[i])
	R[i] = gcd(R[i - 1], A[N - 1 - i])
ans = max(L[N - 2], R[N - 2])
for j in range(1, N - 1):
	ans = max(ans, gcd(L[j - 1], R[N - j - 2]))
print(ans)
### BUGGY CODE ###

import sys
import heapq
sys.setrecursionlimit(10 ** 6)
def main():
    import sys
    input = sys.stdin.readline
    
    n,a,b = map(int,input().split())
    H = []
    for _ in range(n):
        h = int(input())
        H.append(-h)
    heapq.heapify(H)
    ans = 0
    dm = 0
    d = a-b
    while True:
        mx = heapq.heappop(H)
        if mx+dm <0:
            mx += d
            dm += b
            ans += 1
            heapq.heappush(H, mx)
        else:
            break
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import math
n,a,b = map(int,input().split())
H = list(int(input()) for _ in range(n))
l,r = 0, 10**9
d = a-b
while r-l>1:
    mid = (r+l)//2
    tmp = 0
    for h in H:
        if h <= mid*b:
            continue
        tmp += math.ceil((h-mid*b)/d)
    if tmp <= mid:
        r = mid
    else:
        l = mid
print(r)
### BUGGY CODE ###

N=int(input())
V=[int(i) for i in input().split()]

def separate(a):
    b,c=[],[]
    for i in range(len(a)):
        if i%2==1:
            b.append(a[i])
        else:
            c.append(a[i])
    return [b,c]

def appearGetter(a):
    b = list(set(a))
    c=[]
    for i in b:
        c.append([i,a.count(i)])
    return c
    
sep = separate(V)
oddApp=appearGetter(sep[0])
evenApp=appearGetter(sep[1])

oddApp.sort(key=lambda x:x[1])
evenApp.sort(key=lambda x:x[1])

ans=0
if oddApp[-1][0]!=evenApp[-1][0]:
    ans = len(V)-oddApp[-1][1]-evenApp[-1][1]
else:
    if len(oddApp)==1:
        oddApp.append([0,0])
    if len(evenApp)==1:
        evenApp.append([0,0])
    ans1 = len(V)-oddApp[-1][1]-evenApp[-2][1]
    ans2 = len(V)-oddApp[-2][1]-evenApp[-1][1]
    ans = min(ans1,ans2)

print(ans)

### FIXED CODE ###

import collections

N=int(input())
V=[int(i) for i in input().split()]

oddSeq,evenSeq=[],[]
for i in range(N//2):
    oddSeq.append(V[i*2])
    evenSeq.append(V[i*2+1])

oddCounter = collections.Counter(oddSeq)
evenCounter = collections.Counter(evenSeq)

oddMostCommonNumber = oddCounter.most_common()[0][0]
evenMostCommonNumber = evenCounter.most_common()[0][0]

oddMostCommonTimes = oddCounter.most_common()[0][1]
evenMostCommonTimes = evenCounter.most_common()[0][1]

odd2ndCommonNumber = 0
even2ndCommonNumber = 0

odd2ndCommonTimes = 0
even2ndCommonTimes = 0

if len(oddCounter.most_common())!=1:
    odd2ndCommonNumber = oddCounter.most_common()[1][0]
    odd2ndCommonTimes = oddCounter.most_common()[1][1]
if len(evenCounter.most_common())!=1:
    even2ndCommonNumber = evenCounter.most_common()[1][0]
    even2ndCommonTimes = evenCounter.most_common()[1][1]

ans=-1
if evenMostCommonNumber!=oddMostCommonNumber:
    ans = N-oddMostCommonTimes-evenMostCommonTimes
else:
    ans1 = N-oddMostCommonTimes-even2ndCommonTimes
    ans2 = N-odd2ndCommonTimes-evenMostCommonTimes
    ans = min(ans1,ans2)
print(ans)
### BUGGY CODE ###

n = int(input())
a = sorted(list(map(int, input().split())))
while True:
    a = sorted(list(set(a)))
    tmp = sorted(a[:])
    for i in tmp:
        if i == a[0]:
            continue
        elif i % a[0] == 0:
            a.remove(i)
        else:
            a.append(i % a[0])
            a.remove(i)
    a.sort()
    if len(a) == 1:
        break
print(a[0])


### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())))
while True:
    a = sorted(list(set(a)))
    tmp = sorted(a[:])
    for i in tmp:
        if i == a[0]:
            continue
        elif i % a[0] == 0:
            a.remove(i)
        else:
            a.append(i % a[0])
            if i % a[0] == 1:
                print(1)
                exit()
            a.remove(i)
    if len(a) == 1:
        break
print(a[0])
### BUGGY CODE ###

a, b, k = map(int, input().split())
for i in range(a,b+1):
    if i < a+k or i > b-k:
        print(i)

### FIXED CODE ###

a, b, k = map(int, input().split())
if b - a < k * 2:
    for i in range(a,b+1):
        print(i)
else:
    ans = []
    for i in range(a,a+k):
        if i < a+k: ans.append(i)
    for i in range(b-k+1, b+1):
        if i > b-k and i not in ans: ans.append(i)
    for i in ans: print(i)
### BUGGY CODE ###

from collections import deque
import sys
n,p=map(int,input().split())

e=[]
for _ in range(n):
    s,t,x = map(int,input().split())
    e.append((s-x,1,x))
    e.append((t-x,-1,x))
e.sort()
q = deque()
for _ in range(p):
    q.append(int(input()))
s=set()

for t,f,x in e:
    while t > q[0]:
        q.popleft()
        if s:
            print(min(s))
        else:
            print(-1)
        if not q:
            sys.exit()
    if f == 1:
        s.add(x)
    else:
        s.remove(x)
        
while q:
    q.pop()
    print(-1)


### FIXED CODE ###

import sys
input = sys.stdin.readline
 
n,q = map(int,input().split())
imos = []
for i in range(n):
    s,t,x = map(int,input().split())
    imos.append((s-x,x))
    imos.append((t-x,-x))
ans = set()
j = 0
for i in range(q):
    d = int(input())
    imos.append((d,1e100))
imos.sort()
m = 1e100
flag = False
for t,stop in imos:
    if stop == 1e100:
        if ans:
            if not flag:
                m = min(ans)
                flag = True
            print(m)
        else:
            print(-1)
    elif stop > 0:
        ans.add(stop)
        if stop < m:
            m = stop
            flag = True
    else:
        ans.remove(-stop)
        if m == -stop:flag = False
### BUGGY CODE ###

def main():
  _max = max
  _range = range
  _input = input
  h, w = map(int, _input().split())
  s = [_input() + '#' for _ in _range(h)]
  s.append('#' * (w + 1))

  rt = [[-1] * w for _ in _range(h + 1)]

  tstart = [-1] * (w + 1)
  for i in _range(h + 1):
    si = s[i]
    rti = rt[i]
    ystart = -1
    for j in _range(w + 1):
      tj = tstart[j]
      if si[j] == '#':
        if ystart != -1:
          jy = j - ystart
          for k in _range(ystart, j):
            rti[k] += jy
          ystart = -1
        if tj != -1:
          itj = i - tj
          for k in _range(tj, i):
            rt[k][j] += itj
          tstart[j] = -1
      else:
        if ystart == -1:
          ystart = j
        if tj == -1:
          tstart[j] = i

  print(_max(_max(l) for l in rt))

main()


### FIXED CODE ###

h, w = map(int, input().split())
s = [input() + '#' for _ in range(h)]
s.append('#' * w)

yoko = [[0] * w for _ in range(h)]
for i in range(h):
  if s[i][0] == '.':
    start = 0
  else:
    start = -1
  for j in range(1, w + 1):
    if s[i][j] == '#':
      if start != -1:
        for k in range(start, j):
          yoko[i][k] = j - start
        start = -1
    else:
      if start == -1:
        start = j

tate = [[0] * w for _ in range(h)]
for i in range(w):
  if s[0][i] == '.':
    start = 0
  else:
    start = -1
  for j in range(1, h + 1):
    if s[j][i] == '#':
      if start != -1:
        for k in range(start, j):
          tate[k][i] = j - start
        start = -1
    else:
      if start == -1:
        start = j
result = 0
for i in range(h):
  for j in range(w):
    t = yoko[i][j] + tate[i][j] - 1
    if t > result:
      result = t

print(result)
### BUGGY CODE ###

from collections import deque
import numpy as np


def solve():
    H, W, N = map(int, input().split())
    # print("H, W", H, W)
    # print("N", N)

    blacks = deque()
    for _ in range(N):
        blacks.append(tuple(map(int, input().split())))

    TABLE = deque()
    for _ in range(H + 1):
        TABLE.append(0)

    dx = W
    for pos in blacks:
        x = dx - pos[1]
        y = pos[0]
        # print(y, x)
        TABLE[y] = TABLE[y] | 2**x

    RES_TABLE = [0 for _ in range(10)]
    fLAG_DICT = {0: 0, 1: 1, 2: 1, 3: 2, 4: 1, 5: 2, 6: 2, 7: 3}
    for y in range(1, H + 1, 1):
        if y + 2 > H:
            break

        lis = []
        top_middle_bottom = []
        for y2 in range(y, y + 3):
            line = TABLE[y2]
            lines = []
            for head in range(W - 1, -1, -1):
                tail = (head - 2)
                if tail >= 0:
                    key = line >> tail & 0b111
                    lines.append(fLAG_DICT[key])
            top_middle_bottom.append(np.array(lines))

        total = sum(top_middle_bottom)
        for t in total:
            RES_TABLE[t] += 1

    return RES_TABLE


if __name__ == '__main__':
    res = solve()
    for lis in res:
        print(lis)


### FIXED CODE ###

from collections import deque


def solve():
    H, W, N = list(map(int, input().split()))
    # print(H, W, N)

    # 座標は(y, x)
    blacks = {}
    for _ in range(N):
        pos = input().split()
        blacks[(int(pos[0]), int(pos[1]))] = 0

    # print(blacks)

    # [*][*][*]
    # [*][c][*]
    # [*][*][*]
    # ある座標から, それを中心にした9つの座標を返す
    def center_of_boxes_from_point(y, x):
        center_pos_lis = deque()

        for dy in range(-1, 2):
            for dx in range(-1, 2):
                cy = y + dy
                cx = x + dx
                if 1 <= cy <= H and 1 <= cx <= W:
                    center_pos_lis.append((cy, cx))
        return center_pos_lis

    ANS_TABLE = [0 for _ in range(10)]

    # 探索を終了したboxを保存する
    # keyはboxの中心の座標
    done_boxes = {}
    for blk in blacks:
        # print(blk)
        y, x = blk
        boxes = center_of_boxes_from_point(y, x)

        # boxを探索して黒マスをカウントする
        for center_of_box in boxes:
            if center_of_box not in done_boxes:
                y, x = center_of_box
                if 2 <= y < H and 2 <= x < W:
                    count = 0
                    for dy in range(-1, 2):
                        for dx in range(-1, 2):
                            cy = y + dy
                            cx = x + dx
                            if (cy, cx) in blacks:
                                count += 1
                    # print(center_of_box, count)
                    ANS_TABLE[count] += 1
                    done_boxes[center_of_box] = 0

    # print('total boxes', (W - 2) * (H - 2))
    ANS_TABLE[0] = (W - 2) * (H - 2) - sum(ANS_TABLE)

    return ANS_TABLE


if __name__ == '__main__':
    res = solve()
    for r in res:
        print(r)
### BUGGY CODE ###

import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
import itertools

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()


N = i_i()
S = i_s()

p = itertools.combinations(S, 3)
print(len(set(list(p))))


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

ans = 0
for i in range(1000):
    t = str(i).zfill(3)
    t1 = S.find(t[0])
    if t1 == -1:
        continue
    t2 = S.find(t[1], t1+1)
    if t2 == -1:
        continue
    t3 = S.find(t[2], t2+1)
    if t3 == -1:
        continue
    ans += 1

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

N = int(input())

A = []

for i in range(N):
	b= input()
	if (" " in b):
		b, c = b.split()
		c = int(c)
	
	if b == "insert":
		A.insert(0, c)
	elif b == "delete":
		if (c in A):
			A.remove(c)
	elif b == "deleteFirst":
		A.pop(0)
	elif b == "deleteLast":
		A.pop()

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

### FIXED CODE ###

from collections import deque

N = int(input())

A = deque()

for i in range(N):
	b= input()
	if b == "deleteFirst":
		A.popleft()
	elif b == "deleteLast":
		A.pop()
	else:
		b, c = b.split()
		c = int(c)
	
		if b == "insert":
			A.appendleft(c)
		elif b == "delete":
			if (c in A):
				A.remove(c)

print(" ".join(map(str, A)))
### BUGGY CODE ###

import re
n,m,k=map(int,input().split())
friend=[set() for _ in range(n+1)]
block=[set([i]) for i in range(n+1)]
for _ in range(m):
    a,b=map(int,input().split())
    friend[a].add(b)
    friend[b].add(a)

for _ in range(k):
    c,d=map(int,input().split())
    block[c].add(d)
    block[d].add(c)

ans=[]
friend_kouho=[friend[i] for i in range(n+1)]
#print(friend_kouho)
#print(block)
for i in range(1,n+1):
#    print("friend_kouho:"+str(friend_kouho))
    friend_assume=friend_kouho[i]
    temp=set()
    while(True):
        for j in list(friend_assume):
            temp = temp | friend[j]

#        print(i,temp,friend_assume,friend[i])

        if(len(temp)==0):
            ans.append(0)
            break
        elif(len(temp - friend_assume)>0):
            friend_assume = friend_assume | temp
        elif(len(temp - friend_assume)==0):
            friend_kouho[i] = friend_assume - block[i] - friend[i]
            ans.append(len(friend_kouho[i]))
            break
print(re.sub('[\[\],]','',str(ans)))

### FIXED CODE ###

n,m,k=map(int,input().split())

class UnionFind:
    def __init__(self,n):
        self.group=[i for i in range(n)]
        self.size=[1 for i in range(n)]

    def find(self,x):
        if(self.group[x]==x):
            return x
        else:
            return self.find(self.group[x])

    def unite(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if(x==y):
            pass
        elif(self.sizeof(y) > self.sizeof(x)):
            self.group[x] = self.group[y]
            self.size[y] += self.size[x]
            self.size[x]=0
        else:
            self.group[y] = self.group[x]
            self.size[x] += self.size[y]
            self.size[y]=0

    def sizeof(self,a):
        return self.size[self.find(a)]

    def same(self,x,y):
        return self.find(x)==self.find(y)

uf=UnionFind(n)
friends=[0 for _ in range(n)]
blocks=[0 for _ in range(n)]


for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    friends[a]+=1
    friends[b]+=1
    uf.unite(a,b)

for i in range(k):
    c,d=map(int,input().split())
    c-=1
    d-=1
    if(uf.same(c, d)):
        blocks[c]+=1
        blocks[d]+=1

ans=[]
for i in range(n):
    ans.append(uf.sizeof(i) - friends[i] - blocks[i]  - 1)
print(*ans)
### BUGGY CODE ###

import itertools
import copy

N = int(input())
L = [int(i) for i in input().split()]

l=list(itertools.combinations(L,3))
result = 0

for i in l:
    i = list(i)
    isOk=True
    for index,j in enumerate(i):
        k = copy.copy(i)
        k.pop(index)
        if j>=sum(k):
            isOk=False
    if isOk:
        result+=1

print(result)

### FIXED CODE ###

from bisect import bisect_left

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

for aIndex,a in enumerate(L[:N-2]):
    for bIndex,b in enumerate(L[aIndex+1:N-1]):
        bIndex = aIndex + bIndex + 1
        ab = a+b
        n = bisect_left(L,ab) - bIndex - 1
        result += n
print(result)
### BUGGY CODE ###

n=int(input())
a=[i+1 for i in range(n)]
b=[i+1 for i in range(n)]
c=b[-1]
b.insert(0,c)
del b[-1]
ans=0
for i in range(n):
  ans+=b[i]%a[i]
print(ans)

### FIXED CODE ###

n=int(input())
print((n-1)*n//2)
### BUGGY CODE ###

n,m=map(int,input().split())
if n==1:
  print(m)
  exit()
for i in range(n,m+1):
  if m%i==0:
    print(m//i)
    exit()
print(1)

### FIXED CODE ###

n,m=map(int,input().split())
for i in range(2,m):
  if i*i>m:
    print(1)
    exit()
  if m%i==0:
    break
for i in range(n,m+1):
  if m%i==0:
    print(m//i)
    exit()
### BUGGY CODE ###

S = input()

from collections import deque

q = deque()
if len(S) > 5: #4文字以下ならそもそもバツ→入れない
  q.append(S)
#ここに、次にチェックする文字列を入れていく
#今回はque(fi-fo)として使うので、popleftを使う

flag = False
while(q):
  nows = q.popleft()
  nows5 = nows[0:5]
  nowsfrom5 = nows[5:]
  if nows[0:5] == 'dream':
    if nows[5:] == '':
      flag = True
      break
    else:
      if not(len(nowsfrom5)<=4): q.append(nows[5:])
    if nows[0:7] == 'dreamer':
      if nows[7:] == '':
        flag = True
        break
      else:
        if not(len(nows[7:])<=4): q.append(nows[7:])
  elif nows[0:5] == 'erase':
    if nows[5:] == '':
        flag = True
        break
    else:
      if not(len(nowsfrom5)<=4): q.append(nowsfrom5)
    if nows[0:6] == 'eraser':
      if nows[6:] == '':
        flag = True
        break
      else: 
        if not(len(nows[6:])<=4): q.append(nows[6:])

print('YES' if flag else 'NO')

### FIXED CODE ###

S = input()

from collections import deque

q = deque()
if len(S) > 5: #4文字以下ならそもそもバツ→入れない
  q.append((len(S), S))
#ここに、次にチェックする文字列を入れていく
#今回はque(fi-fo)として使うので、popleftを使う

flag = False
while(q):
  nowlen, nows = q.popleft()
  nows5 = nows[0:5]
  nowsfrom5 = nows[5:]
  if nows5 == 'dream':
    if nowlen == 5:
      flag = True
      break
    else:
      if nowlen>=10: q.append((nowlen-5, nowsfrom5))
    if nows[0:7] == 'dreamer':
      if nowlen == 7:
        flag = True
        break
      else:
        if nowlen>=12: q.append((nowlen-7, nows[7:]))
  elif nows5 == 'erase':
    if nowlen == 5:
        flag = True
        break
    else:
      if nowlen>=10: q.append((nowlen-5, nowsfrom5))
    if nows[0:6] == 'eraser':
      if nowlen == 6:
        flag = True
        break
      else: 
        if nowlen>=11: q.append((nowlen-6, nows[6:]))

print('YES' if flag else 'NO')
### BUGGY CODE ###

from collections import deque

h,w=map(int, input().split())
a = [input() for i in range(h)]
visited = [[-1]*w for i in range(h)]
black = []
for i,row in enumerate(a):
    for j,c in enumerate(row):
        if c == '#':
            black.append((i,j))
            visited[i][j] = 0

queue = deque(black)

while queue:
    y,x = queue.popleft()
    dydx = [[1,0],[-1,0],[0,1],[0,-1]]
    for j,k in dydx:
        newy,newx = y+j,x+k 
        if newy < 0 or newy >= h:continue 
        if newx < 0 or newx >= w:continue 
        if visited[newy][newx] == -1:
            visited[newy][newx] = visited[y][x] + 1
            queue.append((newy,newx))

ans = 0
for row in visited:
    for j in row:
        ans = max(ans,j)

print(ans)


### FIXED CODE ###

from collections import deque

h,w=map(int, input().split())
a = [input() for i in range(h)]
visited = [[-1]*w for i in range(h)]
black = []
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            black.append((i,j))
            visited[i][j] = 0

queue = deque(black)


while queue:
    y,x = queue.popleft()
    dydx = [[1,0],[-1,0],[0,1],[0,-1]]
    for j,k in dydx:
        newy,newx = y+j,x+k 
        if newy < 0 or newy >= h:continue 
        if newx < 0 or newx >= w:continue 
        if visited[newy][newx] == -1:
            visited[newy][newx] = visited[y][x] + 1
            queue.append((newy,newx))

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans,visited[i][j])

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

N,M=map(int,input().split())
A=list(map(int,input().split()))
for i in range(M):
    A.sort(reverse=True)
    A[0]=A[0]//2
print(sum(A))

### FIXED CODE ###

import heapq
N,M=map(int,input().split())
A=list(map(lambda x: x*(-1),list(map(int,input().split()))))
A.sort()
B=[]
for i in range(N):
    heapq.heappush(B,A[i])
for i in range(M):
    heapq.heappush(B,(((heapq.heappop(B))*(-1))//2)*(-1))
print((sum(B))*(-1))