Harryxun/stf_run huggingface dataset:
for input in input().split('\n')
        H, W = map(int, input.split())

        if H == 0 | W == 0:
                break

        countW, countH = 0, 0

        while True:
                if countH == H:
                        break
                while True:
                        if countW == W:
                                print('\n',end='')
                                countW = 0
                                break
                        print('#',end='')
                        countW += 1
                countH += 1

### FIXED CODE ###

while True:
        H, W = map(int, input().split())

        if H == 0 | W == 0:
                break

        countW, countH = 0, 0

        while True:
                if countH == H:
                        break
                while True:
                        if countW == W:
                                print('\n',end='')
                                countW = 0
                                break
                        print('#',end='')
                        countW += 1
                countH += 1
        print()
import numpy as np
N, M, Q = map(int, input().split())

#input
lst = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
    L, R = map(int, input().split())
    lst[R][L] += 1

lst = np.array(lst)
# print (lst)

#2次元累積和
for i in range(1, N + 1):
    lst[:,i] += lst[:, i - 1]
for j in range(1, N + 1):
    lst[j,:] += lst[j - 1, :]


#output
for _ in range(Q):
    p, q = map(int, input().split())
    print (lst[q, q] - lst[p-1, q] - lst[q, p-1] + lst[p-1, p-1])

# print (lst)


### FIXED CODE ###

import numpy as np
N, M, Q = map(int, input().split())

#input
lst = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
    L, R = map(int, input().split())
    lst[R][L] += 1

lst = np.array(lst)
# print (lst)

#2次元累積和
for i in range(1, N + 1):
    lst[:,i] += lst[:, i - 1]
for j in range(1, N + 1):
    lst[j,:] += lst[j - 1, :]


#output
for _ in range(Q):
    p, q = map(int, input().split())
    print (lst[q, q] - lst[p-1, q] - lst[q, p-1] + lst[p-1, p-1])

# print (lst)
s=list(input())
divide=["dream","erase","eraser","dreamer"]
#全探索する
def dfs(n):
        if n==len(s):#最後まで行ったらtrue
                return True
        for i in divide:
                if n+len(i)<=len(s) and "".join(s[n:n+len(i)])==i:
                        if dfs(n+len(i)):
                                return True
        return False
print("YES") if dfs(0) else print("NO")


### FIXED CODE ###

s=input().replace("eraser",",").replace("erase",",").replace("dreamer",",").replace("dream",",").replace(",","")
print("YES" if s=="" else "NO")
N=int(input())
ls=[[int(s) for s in input().split()] for i in range(N)]
flag2=1
for i in range(N):
  if ls[i][2]!=0:
    a=ls[i][0]
    b=ls[i][1]
    h_base=ls[i][2]
    ls.pop(i)
    flag2=0
    break
if flag2==0:
  for x in range(101):
    for y in range(101):
      ##x,yの高さを計算
      h=h_base+abs(x-a)+abs(y-b)
      ##他の条件と合うか？
      flag=1
      for e in ls:
        if h!=e[2]+abs(x-e[0])+abs(y-e[1]):
          flag=0
          break
      if flag==1:
        ans=[x,y,h]
        break
    if flag==1:
      break
else:
  xsum=0
  ysum=0
  for e in ls:
    xsum+=e[0]
    ysum+=e[1]
  ans=[5050-xsum,5050-ysum,1]
print(*ans)  
      
        
      
      
    
  

### FIXED CODE ###

N=int(input())
ls=[[int(s) for s in input().split()] for i in range(N)]
ans=[0,0,0]
for i in range(N):
  if ls[i][2]!=0:
    a=ls[i][0]
    b=ls[i][1]
    h_base=ls[i][2]
    ls.pop(i)
    break
for x in range(101):
  for y in range(101):
    ##x,yの高さを計算
    h=h_base+abs(x-a)+abs(y-b)
    ##他の条件と合うか？
    flag=1
    for e in ls:
      if (h!=e[2]+abs(x-e[0])+abs(y-e[1]) and e[2]>0): 
        flag=0
        break
      if (h>e[2]+abs(x-e[0])+abs(y-e[1]) and e[2]==0):
        flag=0
        break
    if flag==1:
      ans=[x,y,h]
      break
  if flag==1:
    break
print(*ans)
a,b,c = map(int,input().split())
if a == b + c or b == lc + a or c == a + b:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

l = map(int,raw_input().split())
if l[0] == l[1] + l[2] or l[1] == l[0] + l[2] or l[2] == l[0] + l[1]:
  print('Yes')
else:
  print('No')
n=int(input())
card=[]
for suit in ["S","H","C","D"]:
    for rank in list(map(str,range(1,14))):
        card.append(suit+" "+rank+" ")
for i in range(n):
    card.remove(input())
for c in card:
    print(c)  



### FIXED CODE ###

n=int(input())
card=[]
for suit in ["S","H","C","D"]:
    for rank in list(map(str,range(1,14))):
        card.append(suit+" "+rank)
for i in range(n):
    card.remove(input())
for c in card:
    print(c)
#coding:utf-8
import numpy as np

n=int(input())
x=list(map(int,input().split()))

for i in x[::-1]:
    print(str(i)+" ",end="")

print("")

### FIXED CODE ###

#coding:utf-8
n=int(input())
x=list(map(int,input().split()))

for i,a in enumerate(x[::-1]):
    if i==n-1:
        print(str(a))
    else:
        print(str(a)+" ",end="")
N = int(input())
L = list(map(int,input().split()))
cnt = 0
for n in range(N):
  if (i + 1) % 2 == 1 and L[n] % 2 == 0:
    cnt += 1
    
print(cnt)


### FIXED CODE ###

N = int(input())
L = list(map(int,input().split()))
cnt = 0
for n in range(N):
  if (n + 1) % 2 == 1 and L[n] % 2 == 1:
    cnt += 1
    
print(cnt)
import numpy as np
from numpy import linalg as LA


N, M = tuple(map(int, input().split(' ')))

mat = np.identity(N)
res = np.zeros(N)

for m in range(M):
    a, b = tuple(map(int, input().split(' ')))
    mat[a-1, b-1] = 1
    mat[b-1, a-1] = 1
    mat[a-1, a-1] = 1
    mat[b-1, b-1] = 1

Q = int(input())

for q in range(Q):
    v, d, c = tuple(map(int, input().split(' ')))
    x = LA.matrix_power(mat, d)
    res[x[v-1,:] > 0] = c


for i in range(N):
    print(int(res[i]))


### FIXED CODE ###

import numpy as np

def dp(v, d, c):
    if memo[v-1][d]:
        return

    memo[v-1][d] = True
    if d == 0:
        res[v-1] = str(c)
        return

    dp(v, d-1, c)
    for e in dic[v-1]:
        dp(e, d-1, c)


N, M = [int(e) for e in input().split(' ')]

dic = [[] for _ in range(N)]
memo = [[False]*11 for _ in range(N)]

for m in range(M):
    a, b = [int(e) for e in input().split(' ')]
    dic[a-1].append(b)
    dic[b-1].append(a)

Q = int(input())


vdc = [[int(e) for e in input().split(' ')] for _ in range(Q)]

res = ['0']*N

[dp(v, d, c) for v, d, c in vdc[::-1]]


print('\n'.join(res))
N=int(input())
H=list(map(int,input().split()))

countlist=[]
count=0

for i in range(N-1):
  if  H[i]>=H[i+1]:
    count+=1
  else:
    countlist.append(count)
    count=0
else:
  countlist.apend(count)
print(max(countlist))

### FIXED CODE ###

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

count_list = []
count = 0

for i in range(N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    count_list.append(count)
    count = 0
else:
  count_list.append(count)
    
print(max(count_list))
v = []
v = str(input()).split()
dif_max = -200000

for i in range(len(v)):
    v[i] = int(v[i])

len = v[0]
for i in range(2, len + 1, 1):
    for j in range(i + 1, len + 1, 1):
        dif = v[j] - v[i]
        dif_max = dif if dif_max < dif else dif_max

print("{}".format(dif_max))

### FIXED CODE ###

cnt = int(input())
dif_max = -1000000000
v_min = 1000000000

for i in range(cnt):
    buf = int(input())
    if i > 0:
        dif_max = dif_max if buf - v_min < dif_max else buf - v_min
    v_min = buf if buf < v_min else v_min
print(dif_max)
S = input()
R = 0
S = list(S)
temp = []
if len(S)-1 == 0:
    R = int(S)
for i in range(2**(len(S)-1)):
    for m in range(len(S)-1):
        if i+1 & 2**(m) > 0:
            temp.append(S[m] + "+")
        else:
            temp.append(S[m])
    temp.append(S[len(S)-1])
    temp = "".join(temp)
    R += eval(temp)
    temp = []    
print(R)

### FIXED CODE ###

S = input()
R = 0
S = list(S)
temp = []
for i in range(2**(len(S)-1)):
    for m in range(len(S)-1):
        if i+1 & 2**(m) > 0:
            temp.append(S[m] + "+")
        else:
            temp.append(S[m])
    temp.append(S[len(S)-1])
    temp = "".join(temp)
    R += eval(temp)
    temp = []    
print(R)
from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

N, W = [int(x) for x in stdin.readline().rstrip().split()]
wv = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]

# 最大公約数を求めてWを何とか小さくする
gcd_num = W
for i in range(N):
    gcd_num = fractions.gcd(gcd_num, wv[i][0])

W = W // gcd_num
for i in range(N):
    wv[i][0] = wv[i][0] // gcd_num

# 重さiでの価値の最大
# 品物の重複選択を許さない
dp = [[0] * (W+10) for _ in range(N+10)]

for i in range(N):
    weight, value = wv[i]
    dp[i+1] = dp[i][:]
    for j in range(weight, W+1):
        dp[i+1][j] = max(dp[i][j], dp[i][j-weight]+value)

print(dp[N][W])

### FIXED CODE ###

from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

N, W = [int(x) for x in stdin.readline().rstrip().split()]
wv = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]

max_weight = W+1
max_cost = sum([v for w, v in wv])

# cost時の最小の重さ
# dp[cost] = weight
# 計算量は最大でもN=100*vi=10^3の10^5
dp = [INF for _ in range(max_cost+10)]
dp[0] = 0

for w, v in wv:
    # 前からやると重複を許してしまうことになるので後ろから
    # max_cost~v
    for i in reversed(range(v, max_cost+1)):
        dp[i] = min(dp[i], dp[i-v]+w)

# max_cost~0
for i in reversed(range(max_cost+1)):
    if dp[i] <= W:
        print(i)
        break
# お約束
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
    return int(n) - 1
def parse(*args):
    return tuple(p(v) for p, v in zip(args, input().split()))

# Union-Find木
class uft:
    def __init__(self, n):
        self.height = [1] * n
        self.group = [-1] * n
    def root(self, v):
        if self.group[v] < 0:
            return v
        self.group[v] = self.root(self.group[v])
        return self.group[v]
    def size(self, v):
        return - self.group[self.root(v)]
    def equal(self, v1, v2):
        v1, v2 = self.root(v1), self.root(v2)
        return v1 == v2
    def merge(self, v1, v2):
        if self.equal(v1, v2):
            return False
        if self.height[v1] < self.height[v2]:
            self.group[v2] += self.group[v1]
            self.group[v1] = v2
            self.height[v2] = max(self.height[v1] + 1, self.height[v2])
        else:
            self.group[v1] += self.group[v2]
            self.group[v2] = v1
            self.height[v1] = max(self.height[v1], self.height[v2] + 1)
        return True

# エントリーポイント
def main():
    N, M = parse(int, int)
    AB = [parse(int1, int1) for _ in range(M)]

    fuben = N * (N - 1) // 2
    g, rs = uft(N), [fuben]
    for a, b in reversed(AB):
        if not g.equal(a, b):
            fuben -= g.size(a) * g.size(b)
            g.merge(a, b)
        rs += [fuben]
    for r in reversed(rs):
        print(r)

main()


### FIXED CODE ###

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]

uft = [-1] * N
def uft_root(a):
	if uft[a] < 0:
		return a
	uft[a] = uft_root(uft[a])
	return uft[a]

def uft_same(a, b):
	return (uft_root(a) == uft_root(b))

def uft_size(a):
	return -uft[uft_root(a)]

def uft_merge(a, b):
	if uft_same(a, b):
		return
	hi, lo = uft_root(a), uft_root(b)
	if -uft[hi] < -uft[lo]:
		hi, lo = lo, hi
	uft[hi] += uft[lo]
	uft[lo] = hi

result = [(N * (N - 1)) // 2]
for a, b in AB[::-1]:
	a, b = a - 1, b - 1
	if uft_same(a, b):
		result += [result[-1]]
		continue
	result += [result[-1] - (uft_size(a) * uft_size(b))]
	uft_merge(a, b)

for l in result[::-1][1:]:
	print(l)
import math

# D - Maximum Average Sets
# 問題URL:http://abc057.contest.atcoder.jp/tasks/abc057_d

# N:商品の数　A個以上B個以下の範囲で選ぶ
N, A, B = map(int, input().split())
# C：最大価値組み合わせ総数
C = 0
# cnt:カウンター
cnt = 0

# 商品価値をリストに入れる
V = [int(value) for value in input().split()]
# 商品価値が高い順に並び替え
V.sort(reverse=True)

# 商品価値が高いものから出来るだけ少なく（＝A個）選ぶのが最も平均価値が高くなる
S = V[0:A]
ave = sum(S) / A
print(ave)

if V[0]== V[A-1]: # もしもA個選んだ中の商品価値が全て同じだったら
    for i in range(N):
        
        # N個の商品の中に最大価値値を持つものがいくつあるか調べる
        if V[0] == V[i]:
            cnt += 1
    
    j = A
    while j <= B and V[-i] == min(S):
        C = C + math.factorial(cnt) / ( math.factorial(cnt - i) * math.factorial(i))
        j += 1
    

else: # 商品価値が均一でなかったのなら
    Vs = V.count(min(S)) # A個選んだ中で最も低い価値を持つ商品は、もともとの商品リストの中にいくつあるか
    Ss = S.count(min(S)) # A個選んだ時中で最も低い価値を持つ商品はいくつあるか
    
    # nCk = n! /( (n-k)! * k! )に基づきCを計算
    C = math.factorial(Vs) / (math.factorial(Vs - Ss) * math.factorial(Ss) )

print(C)

### FIXED CODE ###

# 元ソースコード：http://abc057.contest.atcoder.jp/submissions/1183710
# 初心者の実験用です

import math
N,A,B = map(int,input().split())
V = list(map(int,input().split()))
V.sort()
S = V[-A:]
avgmax = sum(S) / A
print(avgmax)
 
Vs = V.count(min(S))
Ss = S.count(min(S))
if min(S) != max(S):
	C = math.factorial(Vs) // (math.factorial(Vs -Ss) * math.factorial(Ss))
	print(C)
else:
	i = A
	C = 0
	while i <= B and V[-i] == min(S):
		c = math.factorial(Vs) // (math.factorial(Vs -i) * math.factorial(i))
		C = C + c
		i = i + 1
	print(C)
s = int(input())
w = int(input())

if w >= s:
  print("unsafe")
elif w < s:
  print("safe")

### FIXED CODE ###

s,w  = map(int,input().split())
if w >= s:
  print("unsafe")
elif w < s:
  print("safe")
N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
    k=ceil(math.log2(K/i))
    k=max(0,k)
    ans+=(1/N)*(1/2)**k
print(ans)


### FIXED CODE ###

import math
from math import ceil
N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
    k=ceil(math.log(K/i,2))
    k=max(0,k)
    ans+=(1/N)*(1/2)**k
print(ans)
def retry(list_S, ans, start_ii=0):
    if start_ii > len(list_S) - 3:
        return ans

    for start_i in range(start_ii, len(list_S) - 3):
        for last_i in range(start_i + 3, len(list_S)):
            tmp = ''.join(list_S[start_i:last_i + 1])

            if (int(tmp) % 2019) == 0:
                ans += 1
                retry(list_S, ans, last_i)

    return ans


def resolve():
    S = input()
    list_S = list(S)
    ans = 0

    print(retry(list_S, ans))


resolve()

### FIXED CODE ###

from collections import defaultdict


def resolve():
    s = input()

    cnt = defaultdict(int)
    cnt[0] += 1
    tmp = 0
    for i, c in enumerate(s[::-1]):
        c = int(c)
        tmp = (tmp + c * pow(10, i, 2019)) % 2019
        cnt[tmp] += 1

    ans = sum(c * (c - 1) // 2 for c in cnt.values())
    print(ans)


resolve()
S = input()
W = int(input())
res = ''
for i in range((len(S) + W - 1) // W):
    res = ''.join((res, S[3 * i]))
print(res)

### FIXED CODE ###

S = input()
W = int(input())
res = ''
for i in range((len(S) + W - 1) // W):
    res = ''.join((res, S[W * i]))
print(res)
a,b,c=map(upper(),input().split())
print(a[0],b[0],c[0])

### FIXED CODE ###

a,b,c=input().split()
s=a[0].upper() + b[0].upper() + c[0].upper()
print(s)
S = str(input())
T = str(input())
lens = len(S)
lent = len(T)
ans = []

for i in range(s-t + 1):
      count = 0
      U = S[i: i+t]
      for i in range(t):
            if U[j] != T[j]:
                count += 1
      ans.append(count)
print(min(ans))

### FIXED CODE ###

S = str(input())
T = str(input())
lens = len(S)
lent = len(T)
ans = []

for i in range(lens-lent + 1):
      count = 0
      U = S[i: i+lent]
      for j in range(lent):
            if U[j] != T[j]:
                count += 1
      ans.append(count)
print(min(ans))
import math

def lcm(a,b):
    return a*b//math.gcd(a,b)

n = int(input())
t = [ int(input()) for _ in range(n)]
ans = 1
for i in range(n):
    ans = lcm(ans, t[i])
print(ans)

### FIXED CODE ###

def gcd(a,b):
    while b != 0:
        a,b = b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

n = int(input())
t = [ int(input()) for _ in range(n)]
ans = 1
for i in range(n):
    ans = lcm(ans, t[i])
print(ans)
N = input()
dic = {}
max = 0
for i in range(int(N)):
  word = input()
  if word not in dic.keys():
    
    if max == 0:
      max += 1
    dic['word'] = 1
    
  else:
    
    if max == dic['word']:
      max += 1
    dic['word'] += 1
    
candidates = sorted([word for word in dic.keys() if dic[key] == max])
for word in candidates:
  print(word)

### FIXED CODE ###

N = input()
dic = {}
max = 0
for i in range(int(N)):
  word = input()
  if word not in dic.keys():
    
    if max == 0:
      max += 1
    dic[word] = 1
    
  else:
    
    if max == dic[word]:
      max += 1
    dic[word] += 1

candidates = sorted([word for word in dic.keys() if dic[word] == max])
for word in candidates:
  print(word)
def cod(s):
    return s[:4] + ' ' + s[4:]
k = sys.argv[1]
cod(k)

### FIXED CODE ###

# -*- coding: utf-8 -*-
s = raw_input()
print s[:4] + ' ' + s[4:]
W,H,x,y = map(int,input().split())
flg = 0
if W/2 == x and H/2 ==y:
    ans = (W*H)/2
    flg = 1
elif W/2 == x or H/2 ==y:
    ans = (W*H)/2
    flg = 0
else:
    tatemax = min(W-x,x)*H
    yokomax = min(H-y,y)*W
    if tatemax == yokomax:
        ans = tatemax
        flg =1
    else:
        ans = max(tatemax,yokomax)
        flg =0
print(str(ans)+ " " + str(flg))

### FIXED CODE ###

N,M = map(int,input().split())
print(("0","10")[N >= M])
MOD = 10 ** 9 + 7

N, K = mii()
A = lmii()

S = []
T = []

for a in A:
    if a < 0:
        T.append(a)
    else:
        S.append(a)

lenS = len(S)
lenT = len(T)

ok = False
if lenS > 0:
    if N == K:
        ok = lenT % 2 == 0
    else:
        ok = True
else:
    ok = K % 2 == 0

ans = 1
if not ok:
    A.sort(key=lambda x: abs(x))
    for i in range(K):
        ans *= A[i]
        ans %= MOD
else:
    S.sort()
    T.sort(reverse=True)
    if K % 2 == 1:
        ans *= S.pop()
    P = []
    while len(S) >= 2:
        x = S.pop()
        x *= S.pop()
        P.append(x)
    while len(T) >= 2:
        x = T.pop()
        x *= T.pop()
        P.append(x)
    P.sort(reverse=True)
    for i in range(K//2):
        ans *= P[i]
        ans %= MOD

print(ans)

### FIXED CODE ###

MOD = 10 ** 9 + 7

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

S = []
T = []

for a in A:
    if a < 0:
        T.append(a)
    else:
        S.append(a)

lenS = len(S)
lenT = len(T)

ok = False
if lenS > 0:
    if N == K:
        ok = lenT % 2 == 0
    else:
        ok = True
else:
    ok = K % 2 == 0

ans = 1
if not ok:
    A.sort(key=lambda x: abs(x))
    for i in range(K):
        ans *= A[i]
        ans %= MOD
else:
    S.sort()
    T.sort(reverse=True)
    if K % 2 == 1:
        ans *= S.pop()
    P = []
    while len(S) >= 2:
        x = S.pop()
        x *= S.pop()
        P.append(x)
    while len(T) >= 2:
        x = T.pop()
        x *= T.pop()
        P.append(x)
    P.sort(reverse=True)
    for i in range(K//2):
        ans *= P[i]
        ans %= MOD

print(ans)
A = int(input())
B = int(input())
C = int(input())
K = int(input())

if K >A+B :
  print(A-(K-A-B))
else :
  print(A)

### FIXED CODE ###

A,B,C,K = map(int,input().split())

if K >A+B:
  print(A-1*(K-A-B))
elif A > K :
  print(K)
else :
  print(A)
N = int(input())
s = [input() for _ in range(N)]
M = int(input())
t = [input() for _ in range(M)]

s.sort()
t.sort()

ans = 0
sset = set(s)

for si in sset:
    ans = max(ans, s.count(si)-t.coutn(si))
print(ans)

### FIXED CODE ###

N = int(input())
s = [input() for _ in range(N)]
M = int(input())
t = [input() for _ in range(M)]

s.sort()
t.sort()

ans = 0
sset = set(s)

for si in sset:
    ans = max(ans, s.count(si)-t.count(si))
print(ans)
N, M = [int(x) for x in input().split()]
a = [int(input()) for _ in range(M)]
p = 10 ** 9 + 7

fib = [1, 1] + [None] * (N - 1)
for i in range(2, N + 1):
    fib[i] = (fib[i - 1] + fib[i - 2]) % p

for j in range(M):
    if a[j] == N or (j + 1 < M and a[j] + 1 == a[j + 1]):
        ans = 0
        break
        
    if j == 0:
        ans = fib[a[j] - 1]
    else:
        ans *= fib[a[j] - 1 - (a[j - 1] + 1)]
        ans %= p
else:
    ans *= fib[N - a[M - 1] - 1]
    ans %= p

print(ans)


### FIXED CODE ###

N, M = [int(x) for x in input().split()]
a = [int(input()) for _ in range(M)]
p = 10 ** 9 + 7

if M == 0:
    a = [-1]

fib = [1, 1] + [None] * (N - 1)
for i in range(2, N + 1):
    fib[i] = (fib[i - 1] + fib[i - 2]) % p

ans = 1
for j in range(M):
    if a[j] == N or (j + 1 < M and a[j] + 1 == a[j + 1]):
        ans = 0
        break

    if j == 0:
        ans = fib[a[j] - 1]
    else:
        ans *= fib[a[j] - 1 - (a[j - 1] + 1)]
        ans %= p
else:
    ans *= fib[N - a[M - 1] - 1]
    ans %= p

print(ans)
import collections

def conv(cc, ks, K):
    tm=max([sum(cc[j:j+(ks+1)]) for j in range(len(cc)-(ks-1))])
    if tm>=K:
        return ks
    else:
        return conv(cc, ks+1, K)

N, K=map(int, input().split())
h=[int(input()) for i in range(N)]

cc=list(collections.Counter(h).values())

print(conv(cc,0,K))

### FIXED CODE ###

D=int(input())

if D==25:
  print('Christmas')
elif D==24:
  print('Christmas Eve')
elif D==23:
  print('Christmas Eve Eve')
else:
  print('Christmas Eve Eve Eve')
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int,input().split())

sum_dict = 0
#全ての経路の距離の和を求める。
for i in range(N):
    for j in range(i+1,N):
        sum_dict += (x[i] - x[j])**2 - (y[i] - y[j])**2
nkai = 0
#N!の値を求める
for i in range(1,N+1):
    nkai *= i
#平均を求める
ave = sum_dict / nkai
print(ave)

### FIXED CODE ###

import math
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int,input().split())
nkai = 1
#N!の値を求める
for i in range(1,N+1):
    nkai *= i
sum_dict = 0

#同じ辺が登場する回数N!*(N-1)/(len(branch))
#全ての返間の距離 全ての辺の数はNC2(len(branch))

branch = list()
for i in range(N):
    for j in range(i+1,N):
        a = (x[i] - x[j])**2 + (y[i]-y[j])**2
        a = math.sqrt(a)
        branch.append(a)
#普遍性なし?
count = (nkai*(N-1))/(len(branch))
for i in range(len(branch)):
    sum_dict += branch[i]*(count)


#平均を求める
ave = sum_dict / nkai
print(ave)
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a = sorted(a, reverse=True)
b = sorted(b, reverse=True)
c = sorted(c, reverse=True)

q = [(a[0]+b[0]+c[0], 0, 0, 0)]
for i in range(min(x*y*z, k)):
  m = q.pop(q.index(max(q, key=lambda x: x[0])))
  print(m[0])
  next_a = (a[m[1]+1]+b[m[2]]+c[m[3]], m[1]+1, m[2], m[3])
  next_b = (a[m[1]]+b[m[2]+1]+c[m[3]], m[1], m[2]+1, m[3])
  next_c = (a[m[1]]+b[m[2]]+c[m[3]+1], m[1], m[2], m[3]+1)
  if next_a not in q:
    q.append(next_a)
  if next_b not in q:
    q.append(next_b)
  if next_c not in q:
    q.append(next_c)
      

### FIXED CODE ###

x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a = sorted(a, reverse=True)
b = sorted(b, reverse=True)
c = sorted(c, reverse=True)

q = [(a[0]+b[0]+c[0], 0, 0, 0)]
t = []
next_a = (0,0,0,0)
next_b = (0,0,0,0)
next_c = (0,0,0,0)
for i in range(min(x*y*z, k)):
  m = q.pop(q.index(max(q, key=lambda x: x[0])))
  print(m[0])
  if m[1] < x-1:
    next_a = (a[m[1]+1]+b[m[2]]+c[m[3]], m[1]+1, m[2], m[3])
  if m[2] < y-1:
    next_b = (a[m[1]]+b[m[2]+1]+c[m[3]], m[1], m[2]+1, m[3])
  if m[3] < z-1:
    next_c = (a[m[1]]+b[m[2]]+c[m[3]+1], m[1], m[2], m[3]+1)
  if next_a not in t:
    q.append(next_a)
    t.append(next_a)
  if next_b not in t:
    q.append(next_b)
    t.append(next_b)
  if next_c not in t:
    q.append(next_c)
    t.append(next_c)