Harryxun/stf_run huggingface dataset:
n = int(input())
a = list(map(int,input().split()))

import math 
  
# A function to print all prime factors of  
# a given number n 
def primeFactors(n): 
    p = set()
    while n % 2 == 0: 
        p.add(2) 
        n = int(n / 2)
    for i in range(3,int(math.sqrt(n))+1,2): 
        while n % i== 0: 
            p.add(int(i)) 
            n = int(n / i)
    if n > 2: 
        p.add(n)
    return p 

def largestPrimeFactor(n): 
    p = set()
    while n % 2 == 0: 
        p.add(2) 
        n = n / 2
    for i in range(3,int(math.sqrt(n))+1,2): 
        while n % i== 0: 
            p.add(i) 
            n = int(n / i)
    if n > 2: 
        p.add(n)
    return max(p) 

a = sorted(a)
max_v = max(a)
ans = 0
if len(set(a))==1:
    print(0)
    exit()
product = 1
ans = set()
for i in range(len(a)):
    next = primeFactors(a[i])
    if len(ans.intersection(next)) == 0:
        ans.add(max(next))

print(len(ans))

### FIXED CODE ###

from collections import defaultdict
import math
n = int(input())
a = list(map(int,input().split()))
max_a = 10**6 +1 
a = sorted(a)
dic = defaultdict(lambda: False)

count = 0 
for i in range(n):
    ai = a[i]
    if dic[ai] == True:
        count+=1
    else:
        for j in range(1,math.ceil(max_a/ai)):
            dic[j*ai] = True
        if (i+1) < n and a[i]==a[i+1]:
            count+=1
print(n-count)
n=int(input())
x=list(map(int,input().split()))
x=x.sort()
x=x.reverse()
cnt=0
a=0
b=0
for i in x:
  if cnt%2==0:
    a+=i
    cnt+=1
  else:
    b+=i
    cnt+=1
print(a-b)

### FIXED CODE ###

n=int(input())
x=list(map(int,input().split()))
x.sort()
x=x[::-1]
cnt=0
a=0
b=0
for i in x:
  if cnt%2==0:
    a+=i
    cnt+=1
  else:
    b+=i
    cnt+=1
print(a-b)
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10**9+7

ps = []
ns = []
zs = []
for i in range(n):
  if a[i] > 0:
    ps.append(a[i])
  elif a[i] < 0:
    ns.append(a[i])
  else:
    zs.append(a[i])
  
if k == 1:
  print(max(a))
elif len(ps) + len(ns) < k:
  print(0)
elif len(ps) == 0:
  ans = 1
  if k % 2 == 0:
    ns = sorted(ns)
    for i in range(k):
      ans = ans * ns[i] % mod
  elif len(zs) > 0:
    print(0)
  else:
    ns = sorted(ns, reverse=True)
    for i in range(k):
      ans = ans * ns[i] % mod
  print(ans)
else:
  ans = 1
  ps = sorted(ps, reverse=True)
  ns = sorted(ns)
  if k % 2 == 0:
    pp = []
    for i in range(0,min(k, len(ps)), 2):
      try:
        pp.append(ps[i] * ps[i+1])
      except:
        pass
  else:
    pp = []
    ans = ps[0]
    for i in range(1,len(ps), 2):
      try:
        pp.append(ps[i] * ps[i+1])
      except:
        pass
  np = []
  for i in range(0, len(ns), 2):
    try:
      np.append(ns[i] * ns[i+1])
    except:
      pass
  pnp = sorted(pp + np, reverse=True)
  if len(pnp) >= k//2:
    for i in range(k//2):
      ans = ans * pnp[i] % mod
    print(ans)
  else:
    print(0)


### FIXED CODE ###

n = int(input())
import math
print(math.ceil(n/1000)*1000 - n)
import sys
from itertools import combinations, permutations, product, combinations_with_replacement, accumulate
from heapq import heapify, heappop, heappush, heappushpop
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from math import sqrt, log, floor, ceil, factorial, cos, sin, pi #, gcd
from fractions import gcd
from operator import mul
from functools import reduce
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def II(): return int(input())
def IF(): return float(input())
def IS(): return input().replace('\n', '')
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    A,B,C = ILI()

    ans = "No"
    # A + 2sqrt(AB) + B < C
    assert C - A -B > 0
    if C - A - B  > 0 and  4 * A * B < (C- A - B) ** 2:
        ans = "Yes"

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from itertools import combinations, permutations, product, combinations_with_replacement, accumulate
from heapq import heapify, heappop, heappush, heappushpop
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from math import sqrt, log, floor, ceil, factorial, cos, sin, pi #, gcd
from fractions import gcd
from operator import mul
from functools import reduce
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def II(): return int(input())
def IF(): return float(input())
def IS(): return input().replace('\n', '')
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    A,B,C = ILI()

    ans = "No"
    # A + 2sqrt(AB) + B < C
    if C - A - B  > 0 and  4 * A * B < (C- A - B) ** 2:
        ans = "Yes"

    print(ans)


if __name__ == '__main__':
    main()
N = int(input())
A = list(map(int,input().split()))

ans = 1
for i in range(N):
  ans *= A[i]
  if ans > 10**18:
    ans = -1
    break
    
print(ans)
    

### FIXED CODE ###

a,b = map(int,input().split())
print(a*b)
N, X = (int(_) for _ in input().split())
L = list(map(int, input().split()))
D = 0
ans = 1
while (D < X or ans < N):
    D += L[ans - 1]
    ans += 1
    print(D, ans)
if D == X:
    print(ans)
else:
    print(ans - 1)

### FIXED CODE ###

N, X = (int(_) for _ in input().split())
L = list(map(int, input().split()))
D = [0 for i in range(N + 1)]
ans = 0
for i in range(N):
    D[i + 1]= D[i] + L[i]
for i in range(N + 1):
    if D[i] <= X:
        ans += 1
print(ans)
a,b= [int(i) for i in input().split()]
if x<a:print(0)
else:print(10)

### FIXED CODE ###

x,a= [int(i) for i in input().split()]
if x<a:print(0)
else:print(10)
import numpy as np
a,b,s=map(float,input().split())
s=np.radians(s)
S=(a*b*np.sin(s))/2
h=b*np.sin(s)
l=a+b+(a**2+b**2-2*a*b*np.cos(s))**0.5
print(S)
print(l)
print(h)

### FIXED CODE ###

import math
a,b,c=map(float,input().split())
c=math.radians(c)
h=b*math.sin(c)
s=a*h/2
d=math.sqrt(a**2+b**2-2*a*b*math.cos(c))
l=a+b+d
print(s,l,h)
NM = [int(i) for i in input().split(" ")]
A = [int(i) for i in input().split(" ")]

N = NM[0]
M = NM[1]

if NM => sum(A):
  print(NM-sum(A))
else:
  print(-1)


### FIXED CODE ###

NM = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

N = NM[0]
M = NM[1]

if N >= sum(A):
  print(N-sum(A))
else:
  print(-1)
N=int(input)
print(sum(list(map(int, input().split())))-N)

### FIXED CODE ###

N=int(input())
print(sum(list(map(int, input().split())))-N)
n , m = map(int , input().split())

k = []
s = []
ans = 0

for _ in range(m):
    a = list(map(int , input().split()))
    k.append(a[0])
    s.append(a[1:])

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

for bit in range(1<<n):
    for i in range(m):
        cnt = 0
        for sw in s[i]:
            if bit & 1<<(sw-1):
                cnt += 1
        if cnt % 2 != p[i]:
            break
    else:
        res += 1

print(res)

### FIXED CODE ###

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

k = []
s = []
ans = 0

for _ in range(m):
    a = list(map(int , input().split()))
    k.append(a[0])
    s.append(a[1:])

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

for bit in range(1<<n):
    for i in range(m):
        cnt = 0
        for sw in s[i]:
            if bit & 1<<(sw-1):
                cnt += 1
        if cnt % 2 != p[i]:
            break
    else:
        ans += 1

print(ans)
n1 = input()
A = map(int, raw_input().split())

n2 = input()
q = map(int, raw_input().split())

list = set()

for i in range(n1):
 for j in range(n2):
  if i != j:
   list.add( A[i] + A[j] )

for i in range(n2):
  if q[i] in list:
   print "yes"
  else:
   print "no"

### FIXED CODE ###

n1 = input()
A = map(int, raw_input().split())

n2 = input()
q = map(int, raw_input().split())

list = set()

def solve(i,m):
 if m == 0:
  return True
 if i >= n1 or m > sum(A):
  return False
 res = solve(i+1,m) or solve(i+1,m-A[i])
 return res

for m in q:
 if solve(0,m):
  print "yes"
 else:
  print "no"
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

count = 0


for c in C:
    for b in B:
        if b >= c:
            continue
        else:
            saidan = filter(lambda x: x<b ,A)
            count+=len(list(saidan))
                
print(count)

### FIXED CODE ###

a = input()
b = input()
c = a[::-1]
d = b[::-1]

if a == d and b == c:
  print('YES')
else:
  print('NO')
s = input()

ans = 0
i = 1
while len(s[i:]) >= 1:
  before = s[i-1]
  tmp = s[i]
  if before != tmp:
    s = s[:i-1] + s[i+1:]
    ans += 2
    i -= 1
  else:
    i += 1

print(ans)

### FIXED CODE ###

s = input()

print(2 * min(s.count("0"), s.count("1")))
n=int(raw_input())
A=map(int, raw_input().split())
q=int(raw_input())
m=map(int, raw_input().split())

def solve(c, m):
  if m == 0:
    return 1
  if c >= n or sum(A)<m:
    return 0
  res = solve(c + 1, m) or solve(c + 1, m - A[c])
  return res

for i range(0,q):
  if solve(0,m[i]):
    print "yes"
  else:
    print "no"

### FIXED CODE ###

n=int(raw_input())
A=map(int, raw_input().split())
q=int(raw_input())
m=map(int, raw_input().split())

def solve(j, m):
  if m == 0:
    return 1
  if j >= n or m > sum(A):
    return 0
  res = solve(j + 1, m) or solve(j + 1, m - A[j])
  return res

for i in range(0,q):
  if solve(0,m[i]):
    print "yes"
  else:
    print "no"
S= input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
elif:
  print('No')

### FIXED CODE ###

S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')
N = int(input())
ans = 'No'
 
for i in range(1, 10):
    if ans == 'Yes':
        break
 
    for j in range(1, 10):
        if N == i * j:
            ans = "Yes"
            break
        else:
            ans = "No"
print(ans)

### FIXED CODE ###

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

if A // 10 == 0 and B // 10 == 0:
  print(A * B)
else:
  print(-1)
# 2 5
#5 10
#9 9
def Yes():
    print('Yes')
    exit()


def No():
    print('No')
    exit()


def parse(s):
    ret = [0, 0]
    for c in s:
        if c == ')':
            if ret[0]:
                ret[0] -= 1
            else:
                ret[1] -= 1
        else:
            ret[0] += 1
    return ret


import numpy as np
N = int(input())
S = [parse(input()) for _ in range(N)]
#a[0]+a[1]が大きい順に並べる
S.sort(key=lambda a: -a[0] - a[1])
#この中でa[1]が耐えられるものを貪欲にかき集める
#集められなくなったら終了


class SegmentTree():
    def __init__(self, array, f, ti):
        """
        Parameters
        ----------
        array : list
            to construct segment tree from
        f : func
            binary operation of the monoid
        ti : 
            identity element of the monoid
        """
        self.f = f
        self.ti = ti
        self.n = n = 2**(len(array).bit_length())
        self.dat = dat = [ti] * n + array + [ti] * (n - len(array))
        for i in range(n - 1, 0, -1):  # build
            dat[i] = f(dat[i << 1], dat[i << 1 | 1])

    def update(self, p, v):  # set value at position p (0-indexed)
        f, n, dat = self.f, self.n, self.dat
        p += n
        dat[p] = v
        while p > 1:
            p >>= 1
            dat[p] = f(dat[p << 1], dat[p << 1 | 1])

    def query(self, l, r):  # result on interval [l, r) (0-indexed)
        f, ti, n, dat = self.f, self.ti, self.n, self.dat
        res = ti
        l += n
        r += n
        while l < r:
            if l & 1:
                res = f(res, dat[l])
                l += 1
            if r & 1:
                r -= 1
                res = f(dat[r], res)
            l >>= 1
            r >>= 1
        return res


def f(x, y):
    return y if y[2] + cnt >= 0 else x


cnt = 0
ti = (10**10, 0, -10**10)
st = SegmentTree([(i, a[0], a[1]) for i, a in enumerate(S)], f=f, ti=ti)
for _ in range(N):
    x = st.query(0, N)
    if x[2] + cnt < 0:
        No()
    cnt += x[1] + x[2]
    st.update(x[0], ti)
if cnt == 0:
    Yes()
else:
    No()


### FIXED CODE ###

def Yes():
    print('Yes')
    exit()


def No():
    print('No')
    exit()


def parse(s):
    ret = [0, 0]
    for c in s:
        if c == ')':
            if ret[0]:
                ret[0] -= 1
            else:
                ret[1] -= 1
        else:
            ret[0] += 1
    return ret


N = int(input())
S = [parse(input()) for _ in range(N)]
S.sort(key=lambda a: -a[0] - a[1])
S1 = sorted([s for s in S if s[0] + s[1] >= 0], key=lambda a: -a[1])
S2 = sorted([s for s in S if s[0] + s[1] < 0], key=lambda a: -a[0])
cnt = 0
for s in S1:
    cnt += s[1]
    if cnt < 0:
        No()
    cnt += s[0]
for s in S2:
    cnt += s[1]
    if cnt < 0:
        No()
    cnt += s[0]
if cnt:
    No()
Yes()
import sys
input = sys.stdin.buffer.readline
from operator import itemgetter
import heapq

def main():
    N,Q = map(int,input().split())
    event = []
    
    for _ in range(N):
        s,t,x = map(int,input().split())
        event.append((s-x,0,x))
        event.append((t-x,1,x))
        
    for i in range(Q):
        a = int(input())
        event.append((a,2,i))
    
    event.sort(key=itemgetter(0))
    ans = [-1]*Q
    use = set()
    stop = []
    heapq.heapify(stop)
    
    for a,b,c in event:
        if b == 0:
            use.add(c)
            heapq.heappush(stop,c)
        elif b == 1:
            use.remove(c)
        else:
            while stop and stop[0] not in use:
                heapq.heappop(stop)
            ans[c] = -1 if len(stop) == 0 else stop[0]
    
    for num in ans:
        print(num)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
from heapq import heappop,heappush

N,Q = map(int,input().split())
task = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
for s,t,x in STX:
  task.append((t-x,0,x))
  task.append((s-x,1,x))

for i in range(Q):
  d = int(input())
  task.append((d,2,i))
answer = [-1]*Q

task.sort()

se = set()
se_hp = []
for a,b,c in task:
  if not b:
    se.remove(c)
  elif b&1:
    se.add(c)
    heappush(se_hp,c)
  else:
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[c] = se_hp[0] if se_hp else -1

print('\n'.join(map(str,answer)))
x = input()

y = x**3

print (int(y))

### FIXED CODE ###

x = int(input())
print(x ** 3)
from collections import defaultdict

class UnionFind():
    def __init__(self):
        self.__table = {}
        self.__size = defaultdict(lambda: 1)

    def __root(self, x):
        if x not in self.__table:
            self.__table[x] = x
        elif x != self.__table[x]:
            self.__table[x] = self.__root(self.__table[x])
        return self.__table[x]

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

    def union(self, x, y):
        x = self.__root(x)
        y = self.__root(y)
        if x != y:
            self.__size[x] += self.__size[y]
            self.__size[y] = self.__size[x]
            self.__table[x] = y

    def size(self, x):
        return self.__size[self.__root(x)]

def solve():
    uf = UnionFind()
    N, M = map(int, input().split())
    bridges = [[int(i) for i in input().split()] for i in range(M)]
    ans = [N * (N - 1) // 2]
    for A, B in reversed(bridges):
        if uf.same(A, B):
            ans.append(ans[-1])
        else:
            ans.append(ans[-1] - uf.size(A) * uf.size(B))
            uf.union(A, B)
    ans.pop()
    return '\n'.join(map(str, reversed(ans)))

print(solve())


### FIXED CODE ###

class UnionFind:
    def __init__(self, size):
        self.parent = [-1 for i in range(size)]#非負なら親ノード，負ならグループの要素数

    def root(self, x): #root(x): xの根ノードを返す．
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.root(self.parent[x]) #xをxの根に直接つなぐ
            return self.parent[x]

    def merge(self, x, y): #merge(x,y): xのいるグループと$y$のいるグループをまとめる
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.parent[x] > self.parent[y]: #xの要素数がyの要素数より「小さい」とき入れ替える
            x,y=y,x
        self.parent[x] += self.parent[y] #xの要素数を更新
        self.parent[y] = x #yをxにつなぐ
        return True

    def issame(self, x, y): #same(x,y): xとyが同じグループにあるならTrue
        return self.root(x) == self.root(y)

    def size(self,x): #size(x): xのいるグループの要素数を返す
        return -self.parent[self.root(x)]

def solve():
    N, M = map(int, input().split())
    bridges = [[int(i) - 1 for i in input().split()] for i in range(M)]
    ans = [N * (N - 1) // 2]

    uf = UnionFind(N)
    for bridge in reversed(bridges):
        A, B = bridge
        if uf.issame(A, B):
            ans.append(ans[-1])
        else:
            ans.append(ans[-1] - uf.size(A) * uf.size(B))
            uf.merge(A, B)
    ans.pop(-1)
    return '\n'.join(map(str, reversed(ans)))

print(solve())
a, b, c = map(int, input().split())
if b−a == c−b:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

a, b, c = map(int, input().split())
if b - a == c - b :
    print("YES")
else:
    print("NO")
s = int(input())
a = [s]
while True:
  if s % 2 == 0:
    s = s // 2
  else:
    s = 3 * s + 1
  if s in a:
    print(s)
    break
  s.append(s)

### FIXED CODE ###

s = int(input())
a = [s]
i = 1
while True:
  if s % 2 == 0:
    s = s // 2
  else:
    s = 3 * s + 1
  if s in a:
    print(len(a) + 1)
    break
  a.append(s)
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, groupby
from math import floor, ceil, sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
from itertools import product
import sys
stdin = sys.stdin
mod = 10**9 + 7


def ns(): return stdin.readline().rstrip()


def ni(): return int(ns())


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


n = ni()
a = na()

a.sort(reverse=True)
l = list()
for key, gr in groupby(a):
    if len(l) == 2:
        break
    num = len(list(gr))
    if num >= 2:
        l.append(key)
    if num >= 4:
        l.apend(key)
print(l[0] * l[1])


### FIXED CODE ###

from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, groupby
from math import floor, ceil, sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
from itertools import product
import sys
stdin = sys.stdin
mod = 10**9 + 7


def ns(): return stdin.readline().rstrip()


def ni(): return int(ns())


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


n = ni()
a = na()

a.sort(reverse=True)
l = list()
for key, gr in groupby(a):
    if len(l) == 2:
        break
    num = len(list(gr))
    if num >= 2:
        l.append(key)
    if num >= 4:
        l.append(key)
print(l[0] * l[1] if len(l) >= 2 else 0)
n, m = map(int, input().split())
x = list(map(int, input().split()))

# print(n, m, x)

# #%%
# n, m =2, 5
# x = [10, 12, 1, 2, 14]


#%%
x.sort()

#%%




#%%

diff_list = []
for i in range(m-1):
    diff = x[i+1] - x[i]
    diff_list.append(diff)


#%%
diff_list.sort()


#%%
print(x[-1] - x[0] - sum(diff_list[-(n-1):])

#%%


#%%


### FIXED CODE ###

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

# print(n, m, x)

# #%%
# n, m =2, 5
# x = [10, 12, 1, 2, 14]


#%%
x.sort()

#%%




#%%

diff_list = []
for i in range(m-1):
    diff = x[i+1] - x[i]
    diff_list.append(diff)


#%%
diff_list.sort()


#%%
if n-1>0:
    print(sum(diff_list[:-(n-1)]))
else:
    print(sum(diff_list))    

#%%


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

del a[min(k,x):]
del b[min(k,y):]
del c[min(k,z):]

ans = []
log = set()

total = (a[0] + b[0] + c[0]) * (-1)
heapq.heappush(ans, (total, 0, 0, 0))
log.add((0, 0, 0))

for i in range(k):
  (total, aa, bb, cc) = heapq.heappop(ans)
  print(total * (-1))
  if (aa+1, bb, cc) not in log:
    if aa+1 <= x:
      total = (a[aa+1] + b[bb] + c[cc]) * (-1)
      heapq.heappush(ans, (total, aa+1, bb, cc))
      log.add((aa+1, bb, cc))
  if (aa, bb+1, cc) not in log:
    if bb+1 <= y:
      total = (a[aa] + b[bb+1] + c[cc]) * (-1)
      heapq.heappush(ans, (total, aa, bb+1, cc))
      log.add((aa, bb+1, cc))
  if (aa, bb, cc+1) not in log:
    if cc+1 <= y:
      total = (a[aa] + b[bb] + c[cc+1]) * (-1)
      heapq.heappush(ans, (total, aa, bb, cc+1))
      log.add((aa, bb, cc+1))

### FIXED CODE ###

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

ans = []
log = set()

total = (a[0] + b[0] + c[0]) * (-1)
heapq.heappush(ans, (total, 0, 0, 0))
log.add((0, 0, 0))

for i in range(k):
  (total, aa, bb, cc) = heapq.heappop(ans)
  print(total * (-1))
  if (aa+1, bb, cc) not in log:
    if aa+1 < x:
      total = (a[aa+1] + b[bb] + c[cc]) * (-1)
      heapq.heappush(ans, (total, aa+1, bb, cc))
      log.add((aa+1, bb, cc))
  if (aa, bb+1, cc) not in log:
    if bb+1 < y:
      total = (a[aa] + b[bb+1] + c[cc]) * (-1)
      heapq.heappush(ans, (total, aa, bb+1, cc))
      log.add((aa, bb+1, cc))
  if (aa, bb, cc+1) not in log:
    if cc+1 < z:
      total = (a[aa] + b[bb] + c[cc+1]) * (-1)
      heapq.heappush(ans, (total, aa, bb, cc+1))
      log.add((aa, bb, cc+1))
n,k = map(int,input().split())
raw = list(map(int,input().split()))
num = 2**(n-1).bit_length()
seg1 = [0]*2*num
seg2 = [n]*2*num

def build(raw):
    for i in range(n):
        seg1[i+num-1] = raw[i]
        seg2[i+num-1] = raw[i]
    for i in range(num-2,-1,-1):
        seg1[i] = max(seg1[2*i+1],seg1[2*i+2])
        seg2[i] = min(seg2[2*i+1],seg2[2*i+2])
    return True

build(raw)
cnt = n-k+1

def query(seg,ele,segf,p,q):
    if q <= p:
        return False
    p += num - 1
    q += num - 2
    res = ele
    while q-p > 1:
        if not p%2:
            res = segf(res,seg[p])
        if q%2:
            res = segf(res,seg[q])
            q -= 1
        p //= 2
        q = (q-1)//2
    if p == q:
        res = segf(res,seg[p])
    else:
        res = segf(res,seg[p],seg[q])
    return res

def check(i):
    #print(i,query(seg1,0,max,i,i+k+1),query(seg2,n+1,min,i,i+k+1))
    return query(seg1,0,max,i,i+k+1) == raw[i+k] and query(seg2,n+1,min,i,i+k+1) == raw[i]

t = [0]*n
f = -1
c = -1
for i in range(n):
    if raw[i] > c:
        f += 1
    else:
        f = 0
    c = raw[i]
    t[i] = f

for i in range(n-k):
    if t[i+k-1] - t[i] == k-1 or check(i):
        #print("y")
        cnt -= 1
print(cnt)

### FIXED CODE ###

h,w,a,b = map(int,input().split())
if b > h//2 or a > w//2:
    print("No")
    exit(0)
for _ in range(h-b):
    print("0"*(w-a) + "1"*a)
for _ in range(b):
    print("1"*(w-a) + "0"*a)