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

s = input()
k = int(input())

kn = len(s) * k
k_list = set(s)
for i in range(2, len(s)+1):
    if len(k_list) >= kn:
        break
    for j in range(len(s)+1-i):
        sub = s[j:j+i]
        k_list.add(sub)

k_list = list(k_list)
k_list.sort()
print(k_list[k-1])

### FIXED CODE ###

s = input()
k = int(input())

kn = len(s) * k
k_list = set(s)

for i in range(2, k+1):
    for j in range(len(s)):
        k_list.add(s[j:j+i])

k_list = list(k_list)
k_list.sort()
print(k_list[k-1])
### BUGGY CODE ###

L, R = map(int, input().split())
min_mod = 10**9
for i in range(L, R):
    for j in range(i + 1, min(L + 2019, R + 1)):
        min_mod = min(min_mod, (i * j) % 2019)
print(min_mod)


### FIXED CODE ###

L, R = map(int, input().split())
min_mod = 10**9
for i in range(L, min(L + 2019, R + 1)):
    for j in range(i + 1, min(L + 2019, R + 1)):
        min_mod = min(min_mod, (i * j) % 2019)
print(min_mod)
### BUGGY CODE ###

n=int(input())
a=list(input().split())
ans=[]
for i in range(n):
    ans.append(a[i])
    ans.reverse()
print(' '.join(ans))

### FIXED CODE ###

n=int(input())
a=list(input().split())
if n > 3:
    ans=''
    ans += ' '.join(a[::-2])
    if n%2==0:
        ans += ' ' + ' '.join(a[0::2])
    else:
        ans += ' ' + ' '.join(a[1::2])
    print(ans)
else:
    ans=[]
    for i in range(n):
        ans.append(a[i])
        ans.reverse()
    print(' '.join(ans))
### BUGGY CODE ###

from collections import Counter as co
from itertools import combinations as com
n=int(input())
a=0
l=[list(sorted(co(input()).items())) for i in range(n)]
for d,s in com(range(n),2):
  if l[d]==l[s]:a+=1
print(a)

### FIXED CODE ###

from collections import Counter as co
from operator import mul
from functools import reduce

def combinations_count(n, r):
  r = min(r, n - r)
  numer = reduce(mul, range(n, n - r, -1), 1)
  denom = reduce(mul, range(1, r + 1), 1)
  return numer//denom


n=int(input())
a=0
l=[''.join(list(map(str,sum(sorted(list(map(list,co(input()).items()))),[])))) for i in range(n)]
for d,s in co(l).items():
  if s>=2:a+=combinations_count(s, 2)
print(a)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

class mint:
    def __init__(self, x):
        self.__x = x % md

    def __str__(self):
        return str(self.__x)

    def __add__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x + other)

    def __sub__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x - other)

    def __rsub__(self, other):
        return mint(other - self.__x)

    def __mul__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * other)

    __radd__ = __add__
    __rmul__ = __mul__

    def __truediv__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * pow(other, md - 2, md))

    def __pow__(self, power, modulo=None):
        return mint(pow(self.__x, power, md))

md=10**9+7
def main():
    n,m=MI()
    xx=LI()
    yy=LI()
    ans=mint(0)
    for i in range(n-1):
        for j in range(m-1):
            s=(xx[i+1]-xx[i])*(yy[j+1]-yy[j])
            ans+=s*(i+1)*(n-i-1)*(j+1)*(m-j-1)
    print(ans)

main()

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

class mint:
    def __init__(self, x):
        self.__x = x % md

    def __str__(self):
        return str(self.__x)

    def __add__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x + other)

    def __sub__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x - other)

    def __rsub__(self, other):
        return mint(other - self.__x)

    def __mul__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * other)

    __radd__ = __add__
    __rmul__ = __mul__

    def __truediv__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * pow(other, md - 2, md))

    def __pow__(self, power, modulo=None):
        return mint(pow(self.__x, power, md))

md=10**9+7
def main():
    n,m=MI()
    xx=LI()
    yy=LI()
    ans=mint(0)
    byj=mint(0)
    for j in range(m - 1):
        byj+=(j+1)*(m-j-1)*(yy[j+1]-yy[j])
    for i in range(n-1):
        ans+=(xx[i+1]-xx[i])*(i+1)*(n-i-1)*byj

    print(ans)

main()
### BUGGY CODE ###

def main():
    h,w = map(int,input().split()) 
    x=[[-1 for _ in range(w)] for _ in range(h)]
    a=[]
    que=[]
    for _ in range(h):
        a.append(list(input()))
    for i in range(h):
        for j in range(w):
            if a[i][j]=="#":
                que.append([i,j])
                x[i][j]=0
    ans=0
    while que!=[]:
        [i,j]=que[0]
        que.pop(0)
        if j<w-1 and x[i][j+1]==-1:
            que.append([i,j+1])
            x[i][j+1]=x[i][j]+1
            if ans < x[i][j]+1:
                ans=x[i][j]+1
        if 0<j and x[i][j-1]==-1:
            que.append([i,j-1])
            x[i][j-1]=x[i][j]+1
            if ans < x[i][j]+1:
                ans=x[i][j]+1
        if i<h-1 and x[i+1][j]==-1:
            que.append([i+1,j])
            x[i+1][j]=x[i][j]+1
            if ans < x[i][j]+1:
                ans=x[i][j]+1
        if 0<i and x[i-1][j]==-1:
            que.append([i-1,j])
            x[i-1][j]=x[i][j]+1
            if ans < x[i][j]+1:
                ans=x[i][j]+1
    print(ans)
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    h,w = map(int,input().split())
    a=[]
    que=[]
    for _ in range(h):
        a.append(list(input()))
    for i in range(h):
        for j in range(w):
            if a[i][j]=="#":
                que.append([i,j])
                a[i][j]=0
    ans=0
    while que!=[]:
        tank=[]
        for i,j in que:
            if j<w-1 and a[i][j+1]==".":
                tank.append([i,j+1])
                a[i][j+1]=a[i][j]+1
            if 0<j and a[i][j-1]==".":
                tank.append([i,j-1])
                a[i][j-1]=a[i][j]+1
            if i<h-1 and a[i+1][j]==".":
                tank.append([i+1,j])
                a[i+1][j]=a[i][j]+1
            if 0<i and a[i-1][j]==".":
                tank.append([i-1,j])
                a[i-1][j]=a[i][j]+1
        que=tank
        ans+=1
    print(ans-1)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
for i in range(m):
    b,c=map(int,input().split())
    for j in range(b):
        if a[j]<c:
            a[j]=c
        else:
            break
    a.sort()
print(sum(a))

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
b=[[a[i],1] for i in range(n)]
for i in range(m):
    x,y=map(int,input().split())
    b.append([y,x])
b.sort(reverse=True)
ans=0
cnt=n
for i in range(len(b)):
    use=min(b[i][1],cnt)
    ans+=use*b[i][0]
    cnt-=use
print(ans)
### BUGGY CODE ###

k,s = list(map(int,input().split()))
ans = [1 for x in range(k+1) for y in range(k+1) for z in range(k+1) if x + y + z == s]
print(len(ans))

### FIXED CODE ###

k,s = list(map(int,input().split()))
ans = [1 for x in range(k+1) for y in range(k+1) if 0 <= s - (x+y) <= k]
print(len(ans))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import collections
import itertools


def main():
    n = int(input())
    a_i = tuple(map(int, input().split()))

    count_item = {}
    all_cnt = 0
    for items in collections.Counter(a_i).items():
        if items[1] >= 2:
            pre_cnt = 0
            if items[1] >= 3:
                pre_cnt = len(list(itertools.combinations(range(items[1] - 1), 2)))

            now_cnt = len(list(itertools.combinations(range(items[1]), 2)))
            count_item[items[0]] = (now_cnt, pre_cnt)
            all_cnt += now_cnt
        else:
            count_item[items[0]] = (0, 0)

    for k in a_i:
        items = count_item[k]
        print(all_cnt - (items[0] - items[1]))


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import collections
import itertools


def main():
    n = int(input())
    a_i = tuple(map(int, input().split()))

    count_item = {}
    all_cnt = 0
    for items in collections.Counter(a_i).items():
        if items[1] >= 2:
            now_cnt = int(items[1] * (items[1] - 1) / 2)
            pre_cnt = now_cnt - items[1] + 1
            count_item[items[0]] = (now_cnt, pre_cnt)
            all_cnt += now_cnt
        else:
            count_item[items[0]] = (0, 0)

    for k in a_i:
        items = count_item[k]
        print(all_cnt - (items[0] - items[1]))


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

# D - Dice in Line

N, K = map(int, input().split())
P = [int(p) for p in input().split()]

Q = [0] * N
for i in range(N):
    Q[i] = ((1 + P[i]) * P[i] / 2) / P[i]

R = [0] * (N - K + 1)
for i in range(N - K + 1):
    R[i] += sum(Q[i:i + K])

print(max(R))


### FIXED CODE ###

# D - Dice in Line

N, K = map(int, input().split())
P = [int(p) for p in input().split()]

Q = [0] * (N + 1)
for i in range(N):
    q = ((1 + P[i]) * P[i] / 2) / P[i]
    Q[i + 1] = Q[i] + q

mx = 0
for i in range(N - K + 1):
    mx = max(mx, Q[i + K] - Q[i])

print(mx)
### BUGGY CODE ###

N,K,Q=map(int,input().split())
score=[K for i in range(N)]
for i in range(Q):
  A=int(input())
  for j in range(N):
    score[j]-=1
  score[A-1]+=1
for i in range(N):
  if(score[i]<=0):
    print("No")
  else:
    print("Yes")

### FIXED CODE ###

N,K,Q=map(int,input().split())
count=[0 for i in range(N)]
for i in range(Q):
  A=int(input())
  count[A-1]+=1
for i in range(N):
  if(count[i]>Q-K):
    print("Yes")
  else:
    print("No")
### BUGGY CODE ###

import fractions
  
N = int(input())
A = list(map(int, input().split()))

ans = 0
MOD = 10**9 + 7

LCM = A[0]
for i in range(1, N):
    LCM *= A[i]//fractions.gcd(LCM, A[i])
    
for a in A:
  ans += LCM//a
  
print(ans%MOD)

### FIXED CODE ###

import fractions
  
N = int(input())
A = list(map(int, input().split()))

ans = 0
MOD = 10**9 + 7

LCM = A[0]
for i in range(1, N):
    LCM *= A[i]//fractions.gcd(LCM, A[i])
    
for a in A:
  ans += LCM//a
  
print(ans%MOD)
### BUGGY CODE ###

N = int(input())
A = [[int(a) for a in input().split()] for _ in range(N)]

mod = 10**9+7

dp = [0]*(2**N)
dp[0] = 1

for s in range(1, 2**N):
    i = bin(s).count("1")
    cnt = 0
    for j in range(N):
        if A[i-1][j] == 1 and s&(1<<j):
            cnt += dp[s^(1<<j)]%mod
    dp[s] = cnt%mod
            
print(dp[-1]%mod)

### FIXED CODE ###

N = int(input())
A = [[int(a) for a in input().split()] for _ in range(N)]

mod = 10**9+7

dp = [0]*(2**N)
dp[0] = 1

POPCOUNT_TABLE16 = [0] * 2**16
for index in range(len(POPCOUNT_TABLE16)):
    POPCOUNT_TABLE16[index] = (index & 1) + POPCOUNT_TABLE16[index >> 1]

def popcnt(v):
    return (POPCOUNT_TABLE16[ v        & 0xffff] +
            POPCOUNT_TABLE16[(v >> 16) & 0xffff] +
            POPCOUNT_TABLE16[(v >> 32) & 0xffff] +
            POPCOUNT_TABLE16[(v >> 48)         ])


for s in range(1, 2**N):
    i = popcnt(s)
    cnt = 0
    for j in range(N):
        if A[i-1][j] == 1 and s&(1<<j):
            cnt += dp[s^(1<<j)]%mod
    dp[s] = cnt%mod
            
print(dp[-1]%mod)
### BUGGY CODE ###

N = int(input())
S = input()

ans = 0
for i in range(N):
  j_start = ans + 1
  j_end = (N - i) // 2 + 1
  for j in range(j_start, j_end):
    base = S[i:i+j]
    if base in S[i+j:]:
      ans = max(ans, j)


print(ans)

### FIXED CODE ###

N = int(input())
S = input()

ans = 0
for i in range(N):
  j_start = ans + 1
  j_end = (N - i) // 2 + 1
  for j in range(j_start, j_end):
    base = S[i:i+j]
    if base in S[i+j:]:
      ans = max(ans, j)
    else:
      break


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

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

A.sort(reverse = True)
if N % 2 == 1:
  if A.count(A[-1]) == 0:
    print(0)
    exit(0)
else:
  if A.count(A[-1]) == 1:
    print(0)
    exit(0)
res = 1
temp = 0
for i in range(N):
  if A.count(A[i]) == 2:
    if temp == A[i]:
      continue
    res *= 2
  else:
    if i == N - 1:
      continue
    res = 0
    break
  temp = A[i]
print(res)

### FIXED CODE ###

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

A.sort()
mod = 10 ** 9 + 7
i = 0
res = 0
if N == 1:
  if A[0] == 0:
    print(1)
  else:
    print(0)
  exit(0)
if N % 2 == 1:
  res = 1
  i = 1
  if A[0] == A[1]:
    print(0)
    exit(0)
  if A[0] == 1:
    print(0)
    exit(0)
else:
  res = 2
  i = 2
  if A[0] != A[1]:
    print(0)
    exit(0)
  if A[0] == 0:
    print(0)
    exit(0)
while i < N - 1:
  if A[i] == A[i + 1]:
    if N % 2 == 0:
      if A[i] != 2 * (i / 2 + 1) - 1:
        res = 0
        break
    else:
      if A[i] != 2 * (i // 2 + 1):
        res = 0
        break
    res *= 2
    i += 2
  else:
    res = 0
    break
print(res % mod)
### BUGGY CODE ###

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

dp = [0] + [1000000000] * (N-1)

for i in range(N-1):
	for j in range(1, min(K+1, N-i)):
		if dp[i] + abs(h[i+j] - h[i]) < dp[i+j]:
			dp[i+j] = dp[i] + abs(h[i+j] - h[i])

print(dp[-1])

### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = np.array([0] * N)
#candi = np.array([0] * N)

for i in range(1, N):
	j = max(0, i-K)
	#print()
	#candi[j:i] = dp[j:i] + np.abs(h[i] - h[j:i])
	dp[i] = (dp[j:i] + np.abs(h[i] - h[j:i])).min()
	#print('j,i=',j,i)
	#print('dp[j:i]=',dp[j:i])
	#print('np.abs(h[i] - h[j:i]) = ', np.abs(h[i] - h[j:i]) )		
	#print('candi[j:i]=',candi[j:i])
	#dp[i] = candi[j:i].min()
	#print('dp=',dp)
				
print(dp[-1])
### BUGGY CODE ###

import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    n = I()
    s = list(S())
    itr = itertools.combinations(s,3)
    st = set()
    for i in itr:
        st.add(i)
    print(len(st))
main()

### FIXED CODE ###

import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    sys.setrecursionlimit(10**5)
    n = I()
    s = S()
    global cnt
    cnt = 0
    def tansaku(st,depth):
        global cnt
        for i in range(10):
            index = st.find(str(i))
            if index != -1:
                if depth == 0:
                    cnt += 1
                    # print(i)
                # print(st,i,index,depth)
                else:
                    tansaku(st[index+1:],depth-1)
    tansaku(s,2)

    print(cnt)

main()
### BUGGY CODE ###

def main():
    n = int(input())
    p = list(map(int, input().split()))
    count = 1
    for i in range(1, n):
        min_i = min(p[:i+1])
        if p[i] == min_i:
            count += 1
    print(count)


if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n = int(input())
    p = list(map(int, input().split()))
    count = 0
    min_num = n+1
    for i in p:
        if i < min_num:
            min_num = i
            count += 1
    print(count)


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

N, K = [int(x) for x in input().split(' ')]

x = 0

while True:
  if N < (K ** x):
    print(x)
  x+=1

### FIXED CODE ###

N, K = [int(x) for x in input().split(' ')]
 
x = 0
 
while True:
  if N < (K ** x):
    print(x)
    break
  x+=1
### BUGGY CODE ###

import math
import collections

def combinations_count(n, r):
	if n < 2:
		return 0
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

_ = int(input())
ns = input().split(" ")
cs = collections.Counter(ns)

c = 0
for n in ns:
	for k, v in cs.items():
		if v==1:
			c += 0
		elif n==k:
#			c += math.factorial(v-2)
			c += combinations_count(v-1, 2)
		else:
#			c += math.factorial(v-1)
			c += combinations_count(v, 2)
	print(c)
	c = 0

### FIXED CODE ###

N = int(input())
A = [int(a)-1 for a in input().split()]
X = [0] * N
for a in A:
	X[a] += 1
s = 0
for x in X:
	s += x * (x-1) // 2
for a in A:
	print(s - (X[a] - 1))
### BUGGY CODE ###

#https://img.atcoder.jp/agc016/editorial.pdf
def solve():
  n = int(input())
  a = list(int(i) for i in input().split())
  ans = 'Yes'
  alone = 0
  group = 0
  if max(a) - min(a) >= 2: ans = 'No'
  
  elif max(a) - min(a) == 1:
   for i in a:
     if i == max(a)-1 : alone += 1
     else: group += 1
   if alone < max(a) and 2*(max(a)-alone)<= group: pass
   else: ans = 'No'
  
  
  elif max(a) - min(a) == 0:
    if a[0] == n-1 or 2*a[0] <= n:
      pass
    else: ans = 'No'
  return ans

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

### FIXED CODE ###

#https://img.atcoder.jp/agc016/editorial.pdf
def solve():
  n = int(input())
  a = list(int(i) for i in input().split())
  ans = 'Yes'
  alone = 0
  group = 0
  ha = max(a)
  la = min(a)
  if ha - la >= 2: ans = 'No'
  
  elif ha - la == 1:
   for i in a:
     if i == ha-1 : alone += 1
     else: group += 1
   if alone < ha and 2*(ha-alone)<= group: pass
   else: ans = 'No'
  
  
  elif ha - la == 0:
    if a[0] == n-1 or 2*a[0] <= n:
      pass
    else: ans = 'No'
  return ans

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

N,K = (int(x) for x in input().split())
A = [int(x) for x in input().split()]

#print(N)
#print(K)
#print(A)

preX = 0
nowX = 1

for i in range(K,N+1):
#  print(str(i)+'学期')
  for x in range(K):
    nowX *= A[i-x-1]
#  print(nowX)
  if preX != 0:
    if preX < nowX:
      print('Yes')
    else:
      print('No')
  preX = nowX
  nowX = 1
  

### FIXED CODE ###

N,K = (int(x) for x in input().split())
A = [int(x) for x in input().split()]

#print(N)
#print(K)
#print(A)

preX = 0
nowX = 1

for i in range(K+1,N+1):
#  print(str(i)+'学期')
#  if i == K:
#    for x in range(K):
#      nowX *= A[x]
#  else:
#    nowX = int(preX / A[i-K-1]) * A[i-1]
#    print(str(preX) +', '+ str(nowX))
#    if preX < nowX:
#      print('Yes')
#    else:
#      print('No')
#  preX = nowX

  if A[i-K-1] < A[i-1]:
    print('Yes')
  else:
    print('No')
### BUGGY CODE ###

import math
N, M = map(int, input().split())
ans = 1
for i in range(2, M//N+1):
    if M % i == 0.0:
        if M // i >= N and ans < i:
            ans = i
        if M // (M // i) >= N and ans < (M // i):
            ans = M // i
print(ans)


### FIXED CODE ###

import math
N, M = map(int, input().split())
ans = 1

for i in range(1, int(math.sqrt(M))+1):
    if M % i == 0.0:
        if M // i >= N and ans < i:
            ans = i
        if M // (M // i) >= N and ans < (M // i):
            ans = M // i
print(ans)
### BUGGY CODE ###

H, W = map(int, input().split())
A = []
B = []
for _ in range(H):
    A.append(list(map(int, input().split())))
for _ in range(H):
    B.append(list(map(int, input().split())))
d = [[0]*W for _ in range(H)]
for h in range(H):
    for w in range(W):
        d[h][w] = abs(A[h][w]-B[h][w])

dp = [[set() for _ in range(W)] for _ in range(H)]
dp[0][0].add(d[0][0])
for h in range(H):
    for w in range(W):
        if h < H-1:
            dp[h+1][w] |= set(map(lambda x: x+d[h+1][w], dp[h][w]))
            dp[h+1][w] |= set(map(lambda x: abs(x-d[h+1][w]), dp[h][w]))
        if w < W-1:
            dp[h][w+1] |= set(map(lambda x: x+d[h][w+1], dp[h][w]))
            dp[h][w+1] |= set(map(lambda x: abs(x-d[h][w+1]), dp[h][w]))
print(min(dp[-1][-1]))

### FIXED CODE ###

def max2(x,y):
    return x if x > y else y

H, W = map(int, input().split())
A = []
B = []
ofs = 80*H*W
for _ in range(H):
    A.append(list(map(int, input().split())))
for _ in range(H):
    B.append(list(map(int, input().split())))
d = [[0]*W for _ in range(H)]
for h in range(H):
    for w in range(W):
        d[h][w] = abs(A[h][w]-B[h][w])

dp = [[0 for _ in range(W)] for _ in range(H)]
dp[0][0] = 1<<ofs
dp[0][0] = (dp[0][0]<<d[0][0])|(dp[0][0]>>d[0][0])
for h in range(H):
    for w in range(W):
        if h < H-1:
            dp[h+1][w] |= (dp[h][w]<<d[h+1][w])|(dp[h][w]>>d[h+1][w])
        if w < W-1:
            dp[h][w+1] |= (dp[h][w]<<d[h][w+1])|(dp[h][w]>>d[h][w+1])
res = dp[-1][-1]>>ofs
print((-res&res).bit_length()-1)
### BUGGY CODE ###

import copy
import sys
import math

def main():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    B = [0] * n

    k_max = 1 + math.ceil(math.log2(n))

    for i in range(min(k, k_max)):
        for j in range(n):
            l = max(0, j-A[j]) #座標iの電球が照らす範囲の左端
            r = min(n-1, j+A[j]) #座標iの電球が照らす範囲の右端
            B[l] += 1
            if (r+1 < n):
                B[r+1] -= 1 # 後ほど累積和にしたときに、照らす範囲の右端より外には影響が及ばないようにあらかじめ1引いておく

        for j in range(n-1):
            B[j+1] += B[j]

        A = copy.deepcopy(B)
        B = [0] * n

    print(*A)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
import sys
import math

def main():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    B = [0] * n

    # k_max = 1 + math.ceil(math.log10(n))

    for i in range(min(k, 41)):
        for j in range(n):
            l = max(0, j-A[j]) #座標iの電球が照らす範囲の左端
            r = min(n-1, j+A[j]) #座標iの電球が照らす範囲の右端
            B[l] += 1
            if (r+1 < n):
                B[r+1] -= 1 # 後ほど累積和にしたときに、照らす範囲の右端より外には影響が及ばないようにあらかじめ1引いておく

        for j in range(n-1):
            B[j+1] += B[j]

        A = copy.deepcopy(B)
        B = [0] * n

    print(*A)

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

N, M = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)

for i in range(M):
    A[0] //= 2
    A.sort(reverse=True)

print(sum(A))

### FIXED CODE ###

from math import ceil
import heapq

N, M = map(int, input().split())
heap = [-x for x in list(map(int, input().split()))]
heapq.heapify(heap)

for i in range(M):
    h = heapq.heappop(heap)
    h = ceil(h/2)
    heapq.heappush(heap, h)

ans = 0
for _ in range(N):
    h = heapq.heappop(heap)
    ans += -h

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

N = int(input())
A = list(map(int, input().split()))
count_list = []
for i in range(10**5):
  count_list.append(A.count(i))
Max = 0
for i in range(10**5-2):
  Max = max(Max, count_list[i]+count_list[i+1]+count_list[i+2])
print(Max)
  

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
count_list = [0]*10**5
for i in range(N):
  count_list[A[i]] += 1
Max = 0
for i in range(10**5-2):
  Max = max(Max, count_list[i]+count_list[i+1]+count_list[i+2])
print(Max)