Harryxun/stf_run huggingface dataset:
n=int(input())
a=list(map(int,input().split()))
b=[1]*(2*10**6)
c=0
for i in range(n):
    j=a[i]
    while j<19*10**5:
        b[j+a[i]]=0
        j+=a[i]
a.sort()
if a==[a[0]]*n:
    c-=1
for i in range(n-1):
    if a[i]==a[i+1]:
        c-=1
        f=1
        if f==0:
            c-=1
    else:
        f=0
for i in range(n):
    c+=b[a[i]]
print(c)

### FIXED CODE ###

n,x=int(input()),10**6+100
a,b,c=list(map(int,input().split())),[0]*(2*x),0
for i in a:
    b[i]+=1
for i in range(x):
    c+=1 if b[i]==1 else 0
    if b[i]==0:
        continue
    for j in range(1,x):
        if i*j>=x:
            break
        b[i*j]=0
print(c)
n,m=map(int,input().split())
a=[True]*n
for i in range(m):
    a[int(input())]=False

mod=10**9+7
dp=[0]*(n+1)
dp[0]=1
if a[1]:
    dp[1]=1
else:
    dp[1]=0
for nn in range(2,n):
    if a[nn]:
        dp[nn]=(dp[nn-1]+dp[nn-2])%mod
    else:
        dp[nn]=0
if n>=2:
    dp[n]=(dp[n-1]+dp[n-2])%mod

print(dp[n])


### FIXED CODE ###

n,m=map(int,input().split())
a=set()
for i in range(m):
    ai=int(input())
    a.add(ai)


mod=10**9+7

t=[0]*(n+1)
t[0]=1

if 1 in a:
    t[1]=0
else:
    t[1]=1

for i in range(2,n+1):
    if i in a:
        t[i]=0
    else:
        t[i]=(t[i-1]+t[i-2])%mod

print(t[n])
#052

#1.値を正しく取得
x1=int(input())
y1=int(input())
x2=int(input())
y2=int(input())

#2.正しく処理

menseki1 = x1 * y1
menseki2 = x2 * y2

if menseki1 >=menseki2  :
  print(menseki1)
  
else :
  print(menseki2)

### FIXED CODE ###

# 052

# 1.値を正しく取得
a,b,c,d=(int(x) for x in input().split())

# 2.正しく処理

menseki1 = a * b
menseki2 = c * d

if menseki1 > menseki2:
    print(menseki1)

elif menseki1 < menseki2:
    print(menseki2)

else :
    print(menseki1)
a,b=map(str,input.split())
print("<" if a<b else ">" if a>b else "=")

### FIXED CODE ###

a,b=map(str,input().split())
print("<" if a<b else ">" if a>b else "=")
n, k = map(int, input().split())
a = list(map(int, input().split()))
stand_bit = [set() for i in range(35)]
acc = [0 for i in range(n+1)]
acc[0] = 0
for i in range(1, n+1):
    acc[i] += a[i-1] + acc[i-1]
set_ans = set()
for i in range(n):
    for j in range(i, n):
        set_ans.add(acc[j+1] - acc[i])
        s = "{:b}".format(acc[j+1] - acc[i])
        s = s.zfill(35)
        for num, bit in enumerate(s):
            if bit == "1":
                stand_bit[num].add(acc[j+1] - acc[i])
for i in range(64):
    if len(set_ans & stand_bit[i]) >= k:
        set_ans &= stand_bit[i]
ans_list = list(set_ans)
ans = ans_list[0]
for i in ans_list:
    ans &= i
print(ans)



### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
stand_bit = [set() for i in range(42)]
acc = [0 for i in range(n+1)]
for i in range(1, n+1):
    acc[i] += a[i-1] + acc[i-1]
set_ans = set()
for i in range(n):
    for j in range(i, n):
        tmp = acc[j+1] - acc[i]
        set_ans.add(tmp)
        s = tmp
        index = 41
        while s:
            if s & 1:
                stand_bit[index].add(tmp)
            s = s >> 1
            index -= 1
for i in range(42):
    if len(set_ans & stand_bit[i]) >= k:
        set_ans &= stand_bit[i]
ans_list = list(set_ans)
ans = ans_list[0]
for i in ans_list:
    ans &= i
print(ans)
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

######################################################

N,A=ilint()
C=counter()
C.add(-1,3)
ans=1
for a in A:
    C.add(a,1)
    ans*=C[a-1]-C[a]+1
    ans%=MOD
print(ans)

### FIXED CODE ###

# E - Colorful Hats 2
MOD = 10**9+7
N = int(input())
A = list(map(int,input().split()))
count = [0]*N+[3]
used = [0]*(N+1)
ans = 1
for x in A:
    ans = (ans*(count[x-1]-used[x-1]))%MOD
    count[x] += 1
    used[x-1] += 1
print(ans)
100 10

### FIXED CODE ###

N, K = (int(i) for i in input().split())
if N % K == 0:
  print(0)
else:
  print(1)
ab,bc,ca = map(str,input().split())

print(ab*bc/2)

### FIXED CODE ###

a,b,c = map(int,input().split())

print(int(a*b/2))
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

def search3(w,v,n):
    res = 0
    for n1 in range(n//w[0]+1):
        for n2 in range((n-w[0]*n1)//w[1]+1):
            n3 = (n-w[0]*n1-w[1]*n2)//w[2]
            res = max(res,n+(v[0]-w[0])*n1+(v[1]-w[1])*n2+(v[2]-w[2])*n3)
    return res

def search2(w,v,n):
    res = 0
    for n1 in range(n//w[0]+1):
        n2 = (n-w[0]*n1)//w[1]
        res = max(res,n+(v[0]-w[0])*n1+(v[1]-w[1]*n2))
    return res

AB = [[A[0]-B[0],A[0],B[0]],[A[1]-B[1],A[1],B[1]],[A[2]-B[2],A[2],B[2]]]
AB.sort()
A = [AB[i][1] for i in range(3)]
B = [AB[i][2] for i in range(3)]

if AB[0][0]>0:
    ans = search3(B,A,N)
elif AB[1][0]>0:
    n = N+(B[0]-A[0])*(N//A[0])
    ans = search2(B[1:],A[1:],n)
elif AB[2][0]>0:
    n = search2(A[:2],B[:2],N)
    n = n+(A[2]-B[2])*(n//B[2])
else:
    ans = search3(A,B,N)

print(ans)

### FIXED CODE ###

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

def search3(w,v,n):
    res = 0
    for n1 in range(n//w[0]+1):
        for n2 in range((n-w[0]*n1)//w[1]+1):
            n3 = (n-w[0]*n1-w[1]*n2)//w[2]
            res = max(res,n+(v[0]-w[0])*n1+(v[1]-w[1])*n2+(v[2]-w[2])*n3)
    return res

def search2(w,v,n):
    res = 0
    for n1 in range(n//w[0]+1):
        n2 = (n-w[0]*n1)//w[1]
        res = max(res,n+(v[0]-w[0])*n1+(v[1]-w[1])*n2)
    return res

AB = [[A[0]-B[0],A[0],B[0]],[A[1]-B[1],A[1],B[1]],[A[2]-B[2],A[2],B[2]]]
AB.sort()
A = [AB[i][1] for i in range(3)]
B = [AB[i][2] for i in range(3)]

if AB[0][0]>0:
    ans = search3(B,A,N)
elif AB[1][0]>0:
    n = N+(B[0]-A[0])*(N//A[0])
    ans = search2(B[1:],A[1:],n)
elif AB[2][0]>0:
    n = search2(A[:2],B[:2],N)
    ans = n+(A[2]-B[2])*(n//B[2])
else:
    ans = search3(A,B,N)

print(ans)
print(max(int(input()) - 2*int(input()), 0))

### FIXED CODE ###

a, b = map(int, input().split())
print(max(a - 2*b, 0))
a,b,c,d = map(int,input().split())
if a - b <= d and b - c <= d:
    print"Yes"
else:
    print"No"


### FIXED CODE ###

a = input().split()
if (abs(int(a[0]) - int(a[1])) <= int(a[3]) and abs(int(a[1]) - int(a[2])) <= int(a[3])) or abs(int(a[0]) - int(a[2])) <= int(a[3]):
    print("Yes")
else:
    print("No")
import bisect
s = input()
t = input()
N = len(s)

next_map = sorted(zip(s*2,range(N*2)))
br = bisect.bisect_right
ans = 0
i = 0
for c in t:
    map_idx = br(next_map,(c,i))
    a,j = next_map[map_idx]
    if a != c :
        ans = -2
        break
    ans += j - i
    i = j%N
ans += 1
print(ans)

### FIXED CODE ###

import bisect
s = input()
t = input()
N = len(s)

next_map = sorted(zip(s*2,range(N*2)))
br = bisect.bisect_right
ans = 0
i = -1
for c in t:
    map_idx = br(next_map,(c,i))
    if map_idx == N*2:
        ans = -1
        break
    a,j = next_map[map_idx]
    if a != c :
        ans = -1
        break
    ans += j - i
    i = j%N
print(ans)
while 1:
	x = float(input())
	s=x
	for i in range(9):
		if i % 2 == 0:
			s = s*2
			x+=s
		if i % 2 == 1:
			s = s/3
			x+=s
	print(x)


### FIXED CODE ###

while 1:
	try:
		x = float(input())
	except:
		break
	s=x
	for i in range(9):
		if i % 2 == 0:
			s = s*2
			x+=s
		if i % 2 == 1:
			s = s/3
			x+=s
	print(x)
n = int(input())
lis = list(map(int,input().split()))
ans = 0
for i in range(n):
  if lis[i][0] == lis[i][1]:
    ans += 1
  else:
    ans = 0
  if ans == 3:
    print("Yes")
    exit()
print("No")

### FIXED CODE ###

n = int(input())
lis = [list(map(int,input().split())) for i in range(n)]
ans = 0
for i in range(n):
  if lis[i][0] == lis[i][1]:
    ans += 1
  else:
    ans = 0
  if ans == 3:
    print("Yes")
    exit()
print("No")
x,y = list(map(int, input().split()))
count=0
for i in range(x+1):
    for j in range(x+1):
        k=y-i-j
        if k=<x and 0=<k:
          count+=1
print(count)

### FIXED CODE ###

x,y = list(map(int, input().split()))
count=0
for i in range(x+1):
    for j in range(x+1):
        k=y-i-j
        if k<=x and 0<=k:
          count+=1
print(count)
import sys
from string import ascii_lowercase as aplhabets
from collections import defaultdict

readline=sys.stdin.readline

s=readline().split()
d=defautdict(int)
for x in s:
  d[x]=1
for a in alphabets:
  if d[a]==0:
    print(a)
    sys.exit()
print('None')


### FIXED CODE ###

import sys
from string import ascii_lowercase as alphabets
from collections import defaultdict

readline=sys.stdin.readline

s=readline().strip()
d=defaultdict(int)
for x in s:
  d[x]=1
for a in alphabets:
  if d[a]==0:
    print(a)
    sys.exit()
print('None')
while Ture:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

### FIXED CODE ###

while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')
a,b=map(int,iput().split())
print((a-1)*(b-1))

### FIXED CODE ###

a,b=map(int,input().split())
print((a-1)*(b-1))
N=int(input())
A=list(map(int,input().split()))
A.sort()
B=1
for i in A:
  B=i*B
  if(B>10**18):
    B=-1
    break
print(B)

### FIXED CODE ###

a,b=map(int,input().split())
print(a*b)
def convert(s): 
  
    # initialization of string to "" 
    new = "" 
  
    # traverse in the string  
    for x in s: 
        new += x  
  
    # return string  
    return new 
      
h,w,a,b=map(int,input().split())
k=[]
for i in range(a):
  k.append('0')
for i in range(w-a):
  k.append('1')
k=convert(k)
t=[]
for i in range(a):
  t.append('1')
for i in range(w-a):
  k.append('0')
t=convert(t)
for i in range(b):
  print(k)
for i in range(h-b):
  print(t)

### FIXED CODE ###

def convert(s): 
  
    # initialization of string to "" 
    new = "" 
  
    # traverse in the string  
    for x in s: 
        new += x  
  
    # return string  
    return new 

h,w,a,b=map(int,input().split())
k=[]
for i in range(a):
  k.append('0')
for i in range(w-a):
  k.append('1')
k=convert(k)
t=[]
for i in range(a):
  t.append('1')
for i in range(w-a):
  t.append('0')
t=convert(t)
for i in range(b):
  print(k)
for i in range(h-b):
  print(t)
K,X = map(int,input().split())
if 500*K >= X:
    print(Yes)
else:
    print(No)

### FIXED CODE ###

K,X = map(int,input().split())
if 500*K >= X:
    print('Yes')
else:
    print('No')
A = np.asarray(input().split()).astype(np.int)
 
ans = 0
mod = 10**9 + 7
for i in range(N):
    pA = (A[i] % mod) * (A[i+1:].sum() % mod)
    ans += pA
 
print(int(ans % mod))

### FIXED CODE ###

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


ans = 0
B = [0] * (N + 1)

for i in range(N-1, -1, -1):
    B[i] = (B[i+1] + A[i]) % D

for i in range(0, N-1):
    ans += (A[i] * B[i+1]) % D

print(int(ans % D))
s = [input()]
f = int(s[0])*10 + int(s[1])
l = int(s[2])*10 + int(s[3])

if 1 <= f <= 12 and 1 <= l <= 12:
  print("AMBIGUOUS")
elif 1 <= f <= 12:
  print("MMYY")
elif 1 <= l <= 12:
  print("YYMM")
else:
  print("NA")


### FIXED CODE ###

s = [int(i) for i in input()]
f = s[0]*10 + s[1]
l = s[2]*10 + s[3]

if 1 <= f <= 12 and 1 <= l <= 12:
  print("AMBIGUOUS")
elif 1 <= f <= 12:
  print("MMYY")
elif 1 <= l <= 12:
  print("YYMM")
else:
  print("NA")
from itertools import permutations
n,m=map(int,input().split())
s=[set(map(int,input().split())) for _ in range(n)]

ans=0
x=[i for i in range(2,n+1)]
cand=permutations(x)
for i in cand:
  crnt=1
  for nxt in i:
    if set([crnt,nxt]) in s:
      crnt=nxt
    else:
      break
  else:
    ans+=1
print(ans)

### FIXED CODE ###

from itertools import permutations
n,m=map(int,input().split())
s=[set(map(int,input().split())) for _ in range(m)]

ans=0
x=[i for i in range(2,n+1)]
cand=permutations(x)
for i in cand:
  crnt=1
  for nxt in i:
    if set([crnt,nxt]) in s:
      crnt=nxt
    else:
      break
  else:
    ans+=1
print(ans)
# ABC075 B-Minesweeper
import numpy as np

H, W = map(int, input().split())
s = np.zeros((H+2, W+2))

for i in range(H):
    S = input()
    for j, v in enumerate(S):
        if v == '#':
            s[i+1, j+1] = 1

for i in range(H):
    ans = ''
    for j in range(W):
        if s[i+1, j+1] == 1:
            ans += '#'
        else:
            ans += str(np.sum(s[i:i+3, j:j+3], dtype=np.int))
    print(ans)


### FIXED CODE ###

# ABC075 B-Minesweeper
import numpy as np

H, W = map(int, input().split())
s = np.zeros((H+2, W+2))

for i in range(H):
    S = input()
    for j, v in enumerate(S):
        if v == '#':
            s[i+1, j+1] = 1

for i in range(H):
    ans = ''
    for j in range(W):
        if s[i+1, j+1] == 1:
            ans += '#'
        else:
            ans += str(np.sum(s[i:i+3, j:j+3], dtype=np.int))
    print(ans)
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)



N = int(raw_input())
k = int(raw_input())
#A = map(int, raw_input().split())
ans = gcd(N,k)
print 3*(N - ans)

### FIXED CODE ###

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



N,k = map(int,raw_input().split())
#k = int(raw_input())
#A = map(int, raw_input().split())
ans = gcd(N,k)
print 3*(N - ans)
import bisect
n, k = map(int, input().split())
x = list(map(int, input().split()))
z = bisect.bisect_left(x, 0)
a = sorted(map(abs, x[:z]))
b = x[z:]
ans = float("inf")
if a and b:
    for i in range(min([k, len(a), len(b)])):
        ans = min(ans, min(a[i], b[k - i - 2]) * 2 + max(a[i], b[k - i - 2]))
    print(ans)
elif a:
    print(a[k - 1])
else:
    print(b[k - 1])

### FIXED CODE ###

import bisect
n, k = map(int, input().split())
x = list(map(int, input().split()))
z = bisect.bisect_left(x, 0)
a = sorted(map(abs, x[:z]))
b = x[z:]
ans = float("inf")
if a and b:
    for i in range(min(k, len(a))):
        if k - i - 2 >= len(b):
            continue
        ans = min(ans, min(a[i], b[k - i - 2]) * 2 + max(a[i], b[k - i - 2]))
    print(ans)
elif a:
    print(a[k - 1])
else:
    print(b[k - 1])
N = int(input())
 
ans = 0
for a in range(1, N + 1):
    for b in range(1, N + 1):
        tmp = math.gcd(a, b)
        for c in range(1, N + 1):
            ans += math.gcd(tmp, c)
 
print(ans)

### FIXED CODE ###

import math

N = int(input())
 
ans = 0
for a in range(1, N + 1):
    for b in range(1, N + 1):
        tmp = math.gcd(a, b)
        for c in range(1, N + 1):
            ans += math.gcd(tmp, c)
print(ans)
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif (n % divisor) == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for x in range(number)]

divised = origin

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

### FIXED CODE ###

def is_prime(n):
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True

count = 0

number = int(input())
for i in range(number):
    n = int(input())
    if is_prime(n):
        count = count + 1

print(count)
x, y, z = map(int, input().split())
print(f'{z} {x} {y}')


### FIXED CODE ###

x, y, z = map(int, input().split())
print(z, end=' ')
print(x, end=' ')
print(y)
za = int(input())
import math
print("{:.5f} {:.5f}".format(a ** 2 * math.pi, 2 * a * math.pi))

### FIXED CODE ###

a = float(input())
import math
print("{:.5f} {:.5f}".format(a ** 2 * math.pi, 2 * a * math.pi))
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

N = int(input())
b_arr = list(map(lambda b: int(b), input().split()))
a_arr = list(range(N))

for n in range(N-1, -1, -1):
    if (n == N-1) or (n == N-2):
        a_arr[N-1] = b_arr[N-2]
        a_arr[N-2] = b_arr[N-2]
    elif b_arr[n+1] >= b_arr[n]:
        a_arr[n+1] = b_arr[n]
        a_arr[n] = b_arr[n]
    else:
        a_arr[n] = b_arr[n]

print(sum(a_arr)

### FIXED CODE ###

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

N = int(input())
b_arr = list(map(lambda b: int(b), input().split()))
a_arr = list(range(N))

for n in range(N-1, -1, -1):
    if (n == N-1) or (n == N-2):
        a_arr[N-1] = b_arr[N-2]
        a_arr[N-2] = b_arr[N-2]
    elif b_arr[n+1] >= b_arr[n]:
        a_arr[n+1] = b_arr[n]
        a_arr[n] = b_arr[n]
    else:
        a_arr[n] = b_arr[n]

print(sum(a_arr))
a=input()
print(str(a//3600)+":"+str(a%3600//60)+":"+str(a%60)

### FIXED CODE ###

a=input()
print(str(a//3600)+":"+str(a%3600//60)+":"+str(a%60))
a=int(input())
b=list(map(int,input().split())
c=[i for i in b if i%2==0]
d=len(c)
e=[j for j in c if i%3==0 or i%5==0]
f=len(e)
if d==f:
       print('APPROVED')
else:
       print('DENIED')

### FIXED CODE ###

a=int(input())
b=list(map(int,input().split()))
c=[i for i in b if i%2==0]
d=len(c)
e=[j for j in c if j%3==0 or j%5==0]
f=len(e)
if d==f:
       print('APPROVED')
else:
       print('DENIED')
print input().strip('\n').swapcase()

### FIXED CODE ###

print raw_input().swapcase()
X, Y, Z, K = map(int, input().split())
A = sorted([int(x) for x in input().split()], reverse=True)[:K]
B = sorted([int(x) for x in input().split()], reverse=True)[:K]
C = sorted([int(x) for x in input().split()], reverse=True)[:K]

bi_comb = []
for i in range(min(X, K)):
    for j in range(min(Y, K)):
        if (i+1)*(j+1) > K:
            break
        bi_comb.append(A[i] + B[j])
bi_comb.sort(reverse=True)

tri_comb = []
for k in range(K):
    for l in range(min(Z, K)):
        tri_comb.append(bi_comb[k] + C[l])
tri_comb.sort(reverse=True)

print(*tri_comb[:K], sep="\n")

### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = sorted([int(x) for x in input().split()], reverse=True)
B = sorted([int(x) for x in input().split()], reverse=True)
C = sorted([int(x) for x in input().split()], reverse=True)

bi_comb = []
for i in range(min(X, K)):
    for j in range(min(Y, K)):
        if (i+1)*(j+1) > K:
            break
        bi_comb.append(A[i] + B[j])
bi_comb.sort(reverse=True)

tri_comb = []
for k in range(min(len(bi_comb), K)):
    for l in range(min(Z, K)):
        if (k+1)*(l+1) > K:
            break
        tri_comb.append(bi_comb[k] + C[l])
tri_comb.sort(reverse=True)

print(*tri_comb[:K], sep="\n")
import numpy as np

a1,a2,a3 = map(int,input().split())
a4,a5,a6 = map(int,input().split())
a7,a8,a9 = map(int,input().split())

a = np.array([[a1, a2, a3], [a4, a5, a6], [a7, a8, a9]])

n = int(input())
for i in range(n):
  b = int(input())
  np.where(a == b,0,a)

if np.sum(a[1,:]) == 0:
  print("Yes")
elif  np.sum(a[2,:]) == 0:
  print("Yes")
elif  np.sum(a[3,:]) == 0:
  print("Yes")
elif  np.sum(a[:,1]) == 0:
  print("Yes")
elif  np.sum(a[:,2]) == 0:
  print("Yes")
elif  np.sum(a[:,3]) == 0:
  print("Yes")
elif a[1,1] + a[2,2] + a[3,3] == 0:
  print("Yes")
elif a[3,1] + a[2,2] + a[1,3] == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import numpy as np

a1,a2,a3 = map(int,input().split())
a4,a5,a6 = map(int,input().split())
a7,a8,a9 = map(int,input().split())

a = np.array([[a1, a2, a3], [a4, a5, a6], [a7, a8, a9]])

n = int(input())
for i in range(n):
  b = int(input())
  a = np.where(a == b, 0, a)

if a[0,0] + a[0,1] + a[0,2] == 0:
  print("Yes")
elif a[1,0] + a[1,1] + a[1,2] == 0:
  print("Yes")
elif a[2,0] + a[2,1] + a[2,2] == 0:
  print("Yes")
elif a[0,0] + a[1,0] + a[2,0] == 0:
  print("Yes")
elif a[0,1] + a[1,1] + a[2,1] == 0:
  print("Yes")
elif a[0,2] + a[1,2] + a[2,2] == 0:
  print("Yes")
elif a[0,0] + a[1,1] + a[2,2] == 0:
  print("Yes")
elif a[2,0] + a[1,1] + a[0,2] == 0:
  print("Yes")
else:
  print("No")
import re

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

print(re.sub(f'[^{S[K-1]}]', '*', S))

### FIXED CODE ###

import re

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

print(re.sub("[^" + S[K-1] + "]", '*', S))
n = int(input())
lis = [list(map(int,input().split())) for i in range(n)]
li = []
for nu,nuu,nuuu in lis:
  if nuuu != 0:li.append([nu,nuu,nuuu])
for i in range(101):
  for j in range(101):
    s = set()
    for h in range(len(li)):
      num = abs(li[h][0]-i)+abs(li[h][1]-j)
      if num + li[h][2] < 0:
        s.add(num + li[h][2] + 1)
      s.add(num + li[h][2])
    if len(s) == 1:
      for num in s:
        print(i,j,num)

### FIXED CODE ###

n = int(input())
if n == 1:
  print("Hello World")
  exit()
else:
  a = int(input())
  b = int(input())
  print(a + b)
n = int(input())
    a = []
    count = 0
    for i in range(n):
        a.append(input())
    while True:
        for index, item in enumerate(a):
            if item % 2 == 0:
                a[index] = item / 2
                count += 1
            else:
                break
    print(count)

### FIXED CODE ###

print(input().count("1"))
n=int(input())
l=list(map(int,input().split()))
list=[]
for i in range(n):
  list.append([i+1,list[i]])
list.sort(key=lambda x:x[1])
ans=[]
for aa in list:
  ans.append(aa[0])
print(*ans)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
list=[]
for i in range(n):
  list.append([i+1,l[i]])
list.sort(key=lambda x:x[1])
ans=[]
for aa in list:
  ans.append(aa[0])
print(*ans)
import math

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

if (A1 - B1) * T1 + (A2 - B2) * T2 == 0:
    print("infinity")
else:
    D1, D2 = (A1 - B1) * T1, (A2 - B2) * T2
    if (D1 > 0) == (D1 + D2 > 0):
        print(0)
    else:
        print(1 + 2 * math.floor(abs(D1) / (abs(D1 + D2) - 1)) + (D1 % D2 == 0))


### FIXED CODE ###

import math

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

if (A1 - B1) * T1 + (A2 - B2) * T2 == 0:
    print("infinity")
else:
    D, D1 = (A1 - B1) * T1 + (A2 - B2) * T2, (A1 - B1) * T1
    if (D1 > 0) == (D > 0):
        print(0)
    else:
        if D1 % D == 0:
            print(2 * math.floor(-D1 / D))
        else:
            print(2 * math.floor(-D1 / D) + 1)