Harryxun/stf_run huggingface dataset:
import math
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

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

if (2*xy[1]-xy[0]) % 3 == 0 and (2*xy[0]-xy[1]) % 3 == 0:
    a = (2*xy[1]-xy[0]) // 3
    b = (2*xy[0]-xy[1]) // 3
    print(cmb(a+b, a))
else:
    print(0)

### FIXED CODE ###

import math
from operator import mul
from functools import reduce

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
xy = list(map(int, input().split()))

if (2*xy[1]-xy[0]) % 3 == 0 and (2*xy[0]-xy[1]) % 3 == 0 and 2*xy[1]-xy[0] > -1 and 2*xy[0]-xy[1] > -1:
    a = (2*xy[1]-xy[0]) // 3
    b = (2*xy[0]-xy[1]) // 3
    print(cmb(a+b, a)%(10**9 + 7))
else:
    print(0)
from collections import deque
import math
mod = 10**9+7
N,K = map(int,input().split())

def facto(x):
    r = 0
    for i in range(1,x+1):
        r *= i
        r %= mod
    return r

def Perm(n,r):#aPb
    return facto(n) // facto(n - r)

K_2perm =[1,K-2]
pres = K-2
#K_2perm[i] = K-2Pi
for i in range(2,K-1):
    pres = (pres*(K-1-i))%mod
    K_2perm.append(pres)
child = [[] for i in range(N)]
for hoge in range(N-1):
    a,b = [int(i)-1 for i in input().split()]
    child[a].append(b)
    child[b].append(a)
went = [False] * N
queue = deque()
queue.append(0)
went[0] = True

ans = Perm(K,len(child[0])+1)%mod
while queue:
    cur = queue.pop()
    if cur!=0:
        ans *= K_2perm[len(child[cur])-1]
        ans %= mod
    for togo in child[cur]:
        if not went[togo]:
            went[togo] = True
            queue.append(togo)
print(ans)



### FIXED CODE ###

from collections import deque
import math
import sys
mod = 10**9+7
N,K = map(int,input().split())

#k
Kperm =[1,K]
pre = K
for i in range(2,K+1):
    pre = (pre*(K+1-i))%mod
    Kperm.append(pre)


#K-2Pxの計算のメモ化
K_2perm =[1,K-2]
pres = K-2
for i in range(2,K-1):
    pres = (pres*(K-1-i))%mod
    K_2perm.append(pres)

child = [[] for i in range(N)]
for hoge in range(N-1):
    a,b = [int(i)-1 for i in input().split()]#点を0-indexedになおす
    child[a].append(b)
    child[b].append(a)

if len(child[0])>=K:
    print(0);sys.exit()
ans = Kperm[len(child[0])+1]
#DFSしながら塗る
went = [False] * N
queue = deque()
queue.append(0)
went[0] = True
while queue:
    cur = queue.pop()
    if cur!=0 and len(child[cur])>=K:
        print(0)
        sys.exit()
    if cur!=0:
        ans *= K_2perm[len(child[cur])-1]
        ans %= mod
    for togo in child[cur]:
        if not went[togo]:
            went[togo] = True
            queue.append(togo)
print(ans)
a,b=map(int,input().sprit())
max=int(a+b)
if max<a*b:
  max=int(a*b)
else if max<a-b:
  max=int(a-b)
print(max)

### FIXED CODE ###

a,b=map(int,input().split())
print(max(a*b,a-b,a+b))
ans=0
for i in range(1,10):
  for j in range(1,10):
    if int(input())==i*j:
      ans=1
print('Yes' if ans else 'No')

### FIXED CODE ###

n=int(input())
ans=0
for i in range(1,10):
  for j in range(1,10):
    if n==i*j:
      ans=1
print('Yes' if ans else 'No')
a, b = map(int, raw_input().split())
print("%d %d" % (a*b, (a+b)*2))

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b, 2*(a+b))
#! -*- coding: utf-8-unix -*-
import sys

if __name__=='__main__':
  # lines = [x.strip() for x in sys.stdin.readlines() if x != '' and x != '\n']
  # n = int(lines[0])
  n = int(raw_input())
  for i in xrange(n):
    # x1, y1, x2, y2, x3, y3, x4, y4 = map(float, lines[i+1].split(' '))
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().strip().split(' '))
    if x1 == x2:
      if x3 == x4:
        print 'YES'
      else:
        print 'NO'
    if y1 == y2:
      if y3 == y4:
        print 'YES'
      else:
        print 'NO'
    a1 = (y2 - y1) / (x2 - x1)
    b1 = y1 - a1 * x1
    a2 = (y4 - y3) / (x4 - x3)
    b2 = y3 - a2 * x3
    if (a1 == a2) and (b1 != b2):
      print 'YES'
    else:
      print 'NO'

### FIXED CODE ###

#! -*- coding: utf-8-unix -*-
import math

if __name__=='__main__':
  # lines = [x.strip() for x in sys.stdin.readlines() if x != '' and x != '\n']
  # n = int(lines[0])
  n = int(raw_input())
  for i in xrange(n):
    # x1, y1, x2, y2, x3, y3, x4, y4 = map(float, lines[i+1].split(' '))
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().strip().split(' '))
    # if x1 == x2 or x3 == x4:
    #   if x1 == x2 and x3 == x4:
    #     print 'YES'
    #   else:
    #     print 'NO'
    #   continue
    # elif y1 == y2 or y3 == y4:
    #   if y1 == y2 and y3 == y4:
    #     print 'YES'
    #   else:
    #     print 'NO'
    #   continue
    # else:
      # if (y2 - y1) * (x4 - x3) == (y4 - y3) * (x2 - x1):
    if math.fabs((y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1)) < 1e-10:
      print 'YES'
    else:
      print 'NO'
      # a1 = (y2 - y1) / (x2 - x1)
      # b1 = y1 - a1 * x1
      # a2 = (y4 - y3) / (x4 - x3)
      # b2 = y3 - a2 * x3
      # if (a1 == a2):# and (b1 != b2):
      #   print 'YES'
      # else:
      #   print 'NO'
    # except:
    #   break
Input = input()

Result = 3*Input**2

print(Result)

### FIXED CODE ###

Input =  int(input())

if 1<=Input<=100:
  Result = 3*Input**2

print(Result)
H,N=map(int, input().split())
import math



MAX=10**4+1
def solve(r,idx):
  if idx==N:
    return MAX
  if r%A[idx][1]==0:
    return (r//A[idx][1])*A[idx][2]
  else:
    return min((r//A[idx][1]+1)*A[idx][2],(r//A[idx][1])*A[idx][2]+solve(r%A[idx][1],idx+1))

def main():
  A=[]
  B=[]
  for i in range(N):
    a,b=map(int, input().split())
    A.append([a/b,a,b])
  if N==1:
    if H%A[0][1]==0:
    	print((H//A[0][1])*A[0][2])
    else:
    	print((H//A[0][1]+1)*A[0][2])
    return
  A=sorted(A)[::-1]

  if H%A[0][1]==0:
    print((H//A[0][1])*A[0][2])
  else:
    ans=min((H//A[0][1]+1)*A[0][2],(H//A[0][1])*A[0][2]+solve(H%A[0][1],1))
    print(ans)

main()

### FIXED CODE ###

H,N=map(int, input().split())
A=[]
B=[]

dp=[10**10]*(H+1)
dp[0]=0
for n in range(N):
  a,b=map(int, input().split())
  A.append(a)
  B.append(b)
    
for h in range(1,H+1):
  for n in range(N):
    if h-A[n]>=0:
      dp[h]=min(dp[h],dp[h-A[n]]+B[n])
    else:
      dp[h]=min(dp[h],B[n])
print(dp[H])
a, b, x = map(int, input())
if a<=x:
  print('YES')
elif a+b>=x:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

a, b, x = map(int, input().split())
if a==x:
  print('YES')
elif a<x and a+b>=x:
  print('YES')
else:
  print('NO')
While True:
    (H,W) = [int(x) for x in input().split()]
    if H == W == 0:
        break

for hc in range(H):
    for wc in range(W):
        print('#', end= ' ')

    print()

print()

### FIXED CODE ###

while True:
    (H,W) = [int(x) for x in input().split()]
    if H == W == 0:
        break
 
    for hc in range(H):
        print('#'*W)
 
    print()
n = int(input())
k = int(input())
num = 2**n
list = [format(str(i),"b").zfill(n) for i in range(num)]
result = []
for i in list:
    a = 1
    for j in len(i):
        if i[j] == "0":
            a *= 2
        else:
            a += k
    result.apppend(a)
print(max(result))

### FIXED CODE ###

n = int(input())
k = int(input())
a = 1
for i in range(n):
    if 2*a>=a+k:
        a = a+k
    else:
        a = 2*a
print(a)
import sys
import numpy as np

rl = sys.stdin.readline

n, k = map(int, rl().split())

li = list(map(int, rl().split()))

dp = np.full(n, float('inf'))

dp[0] = 0
dp[1] = abs(li[0] - li[1])

if k < n:    
    for i in range(2, k):
        for j in range(i):
            a = dp[j] + abs(li[j] - li[i])
            if dp[i] > a:
                dp[i] = a
    for i in range(k, n):
        for j in range(i-k, i):
            a = dp[j] + abs(li[j] - li[i])
            if dp[i] > a:
                dp[i] = a
else:
    for i in range(n):
        for j in range(i):
            a = dp[j] + abs(li[j] - li[i])
            if dp[i] > a:
                dp[i] = a
        
print(int(dp[-1]))




### FIXED CODE ###

import sys

rl = sys.stdin.readline

n, k = map(int, rl().split())

li = list(map(int, rl().split()))

dp = [1<<60]*n

dp[0] = 0
dp[1] = abs(li[0] - li[1])

if k < n:    
    for i in range(2, k):
        for j in range(i):
            a = dp[j] + abs(li[j] - li[i])
            if dp[i] > a:
                dp[i] = a
    for i in range(k, n):
        for j in range(i-k, i):
            a = dp[j] + abs(li[j] - li[i])
            if dp[i] > a:
                dp[i] = a
else:
    for i in range(n):
        for j in range(i):
            a = dp[j] + abs(li[j] - li[i])
            if dp[i] > a:
                dp[i] = a
        
print(int(dp[-1]))
h,w = map(int,input().split())
s = [[i for i in input()] for j in range(h)]


"""
s_idx = [-1,-1]
g_idx = [-1,-1]

for i in range(h):
    for j in range(w):
        if s[i][j] == 'S':
            s_idx[0] = i
            s_idx[1] = j
        if s[i][j] == 'G':
            g_idx[0] = i
            g_idx[1] = j
"""

tate = [0,0,1,-1]
yoko = [-1,1,0,0]

mat=[[10**18 for i in range(w*h)] for j in range(w*h)]

for i in range(w*h):
    mat[i][i] = 0

for i in range(w*h):
    for j in range(4):
        next_idx = i + w*tate[j] + yoko[j]
        if next_idx < 0 or next_idx >= w*h:
            continue
        if i % w == 0:
            if j == 0:
                continue
        if i % w == w - 1:
            if j == 1:
                continue
        if s[next_idx//w][next_idx%w] == '#':
            mat[i][next_idx] = 10**18
        else:
            mat[i][next_idx] = 1

for i in range(w*h):
    #print(i,i,i,i,i,i,i,i,i)
    for x in range(w*h):
        for y in range(w*h):
            """
            if x == s_idx[0]*w+s_idx[1] and y == g_idx[0]*w+g_idx[1]:
                print(mat[x][y],mat[x][i] , mat[i][y],i)
            """
            mat[x][y] = min(mat[x][y], mat[x][i] + mat[i][y])
    
ans = 10**18
tmp = []

for i in range(w*h):
    for j in range(w*h):
        """
        下記4行がないからWA生やした
        """
        if s[i//w][i%w] == '#':
            continue
        if s[j//w][j%w] == '#':
            continue
        ans = max(ans,mat[i][j])
        #if ans > mat[i][j]:
        #    tmp.append(mat[i][j])
            
print(max(tmp))



### FIXED CODE ###

h,w = map(int,input().split())
s = [[i for i in input()] for j in range(h)]


"""
s_idx = [-1,-1]
g_idx = [-1,-1]

for i in range(h):
    for j in range(w):
        if s[i][j] == 'S':
            s_idx[0] = i
            s_idx[1] = j
        if s[i][j] == 'G':
            g_idx[0] = i
            g_idx[1] = j
"""

tate = [0,0,1,-1]
yoko = [-1,1,0,0]

mat=[[10**18 for i in range(w*h)] for j in range(w*h)]

for i in range(w*h):
    mat[i][i] = 0

for i in range(w*h):
    for j in range(4):
        next_idx = i + w*tate[j] + yoko[j]
        if next_idx < 0 or next_idx >= w*h:
            continue
        if i % w == 0:
            if j == 0:
                continue
        if i % w == w - 1:
            if j == 1:
                continue
        if s[next_idx//w][next_idx%w] == '#':
            mat[i][next_idx] = 10**18
        else:
            mat[i][next_idx] = 1

for i in range(w*h):
    #print(i,i,i,i,i,i,i,i,i)
    for x in range(w*h):
        for y in range(w*h):
            """
            if x == s_idx[0]*w+s_idx[1] and y == g_idx[0]*w+g_idx[1]:
                print(mat[x][y],mat[x][i] , mat[i][y],i)
            """
            mat[x][y] = min(mat[x][y], mat[x][i] + mat[i][y])
    
ans = 10**18
tmp = []

for i in range(w*h):
    for j in range(w*h):
        if s[i//w][i%w] == '#':
            continue
        if s[j//w][j%w] == '#':
            continue
        if ans > mat[i][j]:
            tmp.append(mat[i][j])
            
print(max(tmp))
from math import factorial

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


def combinations_count(n, r):
    ''' 組み合わせ '''
    return factorial(n) // (factorial(n - r) * factorial(r))


n_cmb = combinations_count(n, 2)
m_cmb = combinations_count(m, 2)

print(n_cmb + m_cmb)

### FIXED CODE ###

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

n_cmb = n * (n - 1) / 2
m_cmb = m * (m - 1) / 2
print(int(n_cmb + m_cmb))
a,b = map(int,input().rstrip().split(' '))
if(a>b):print("GREATER")
elif(a<b):print("LESS")
else:print("EQUAL")


### FIXED CODE ###

# a,b = map(int,input().rstrip().split(' '))
a = int(input().rstrip())
b = int(input().rstrip())
if(a>b):print("GREATER")
elif(a<b):print("LESS")
else:print("EQUAL")
i = int(raw_input().split())
if i[0] <= i[2] <= i[1]:
 print("Yes")
else:
 print("No")

### FIXED CODE ###

i = input().split()
if int(i[0]) <= int(i[2]) <= int(i[1]):
 print("Yes")
else:
 print("No")
import numpy as np

def decide_col(colors, edges, node, org, excl_color,max_col):
    if len(edges[node]) > 1:
        i = 1
        for elem in edges[node]:
            next_node = elem[0]
            ind = elem[1]
            if next_node != org:
                while i == excl_color:
                    i = i%max_col + 1
                colors[ind] = i
                decide_col(colors, edges, next_node, node, i,max_col)
                i += 1
    

def det_color(N,edges,start,max_col):
    colors = [0]*(N-1)
    i=1
    for elem in edges[start]:
        node = elem[0]
        ind = elem[1]
        colors[ind] = i
        decide_col(colors, edges, node, start, i, max_col)
        i += 1
    return colors
        

N = int(input())
edges = {}
edge_list = []

for i in range(N):
    edges[i] = []
count = [0]*N

for i in range(N-1):
    A, B = map(int,input().split())
    edge_list.append([A-1,B-1])
    edges[A-1].append([B-1,i])
    edges[B-1].append([A-1,i])
    count[A-1] += 1
    count[B-1] += 1

max_col = max(count)
print(max_col)
start_ind = np.argmax(count)
if type(start_ind)==list:
    start = start_ind[0]
else:
    start = start_ind
colors = det_color(N,edges,start,max_col)

for i in range(N-1):
    print(colors[i])

### FIXED CODE ###

import numpy as np
import sys
sys.setrecursionlimit(200000)

def decide_col(colors, edges, node, org, excl_color,max_col):
    if len(edges[node]) > 1:
        i = 1
        for elem in edges[node]:
            next_node = elem[0]
            ind = elem[1]
            if next_node != org:
                while i == excl_color:
                    i = i%max_col + 1
                colors[ind] = i
                decide_col(colors, edges, next_node, node, i,max_col)
                i += 1
    

def det_color(N,edges,start,max_col):
    colors = [0]*(N-1)
    i=1
    for elem in edges[start]:
        node = elem[0]
        ind = elem[1]
        colors[ind] = i
        decide_col(colors, edges, node, start, i, max_col)
        i += 1
    return colors
        

N = int(input())
edges = {}
edge_list = []

for i in range(N):
    edges[i] = []
count = [0]*N

for i in range(N-1):
    A, B = map(int,input().split())
    edge_list.append([A-1,B-1])
    edges[A-1].append([B-1,i])
    edges[B-1].append([A-1,i])
    count[A-1] += 1
    count[B-1] += 1

max_col = max(count)
print(max_col)
start_ind = np.argmax(count)
if type(start_ind)==list:
    start = start_ind[0]
else:
    start = start_ind
colors = det_color(N,edges,start,max_col)

for i in range(N-1):
    print(colors[i])
AllInput = input("Enter Distance,Time Taken and Speed Separated by Space")
Para = AllInput.split()

if ((float(Para[0])/float(Para[1])) <= float(Para[2]):
    print("Yes")
else:
    print("NO")

### FIXED CODE ###


D,T,S= map(int,input().split())

if (S*T) >= D:
    print("Yes")
else:
    print("No")
import math 
N,D=map(int,input().split())
c = 0
for i in range(N):
  X,Y=map(int,input().split())
  if X <= D and Y<=D
    d = math.sqrt(X**2+Y**2)
    if d <= D:
      c = c+1
print(c) 

### FIXED CODE ###

import math 
N,D=map(int,input().split())
c = 0
for i in range(N):
  X,Y=map(int,input().split())
  if X <= D and Y<=D:
    d = math.sqrt(X**2+Y**2)
    if d <= D:
      c = c+1
print(c)
# ABC126D - Even Relation
def dfs(v: int, p: int) -> None:
    for u, w in T[v]:
        if u != p:
            D[u] = D[v] + w
            dfs(u, v)


def main():
    global T, D
    N, *A = map(int, open(0).read().split())
    T = [[] for _ in range(N + 1)]
    for i in range(0, (N - 1) * 3, 3):
        v, u, w = A[i : i + 3]
        T[v] += [(u, w)]
        T[u] += [(v, w)]
    D = [0] * (N + 1)  # D[i] := distance from vertex 1 (root)
    dfs(1, -1)
    ans = [i % 2 for i in D[1:]]  # same parity of distance -> same group
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC126D - Even Relation
import sys

sys.setrecursionlimit(10 ** 9)


def dfs(v: int, p: int) -> None:
    for u, w in T[v]:
        if u != p:
            D[u] = D[v] + w
            dfs(u, v)


def main():
    global T, D
    N, *A = map(int, open(0).read().split())
    T = [[] for _ in range(N + 1)]
    for i in range(0, (N - 1) * 3, 3):
        v, u, w = A[i : i + 3]
        T[v] += [(u, w)]
        T[u] += [(v, w)]
    D = [0] * (N + 1)  # D[i] := distance from vertex 1 (root)
    dfs(1, -1)
    ans = [i % 2 for i in D[1:]]  # same parity of distance -> same group
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()
N=int(input())
a=[0]*N
b=[0]*N
for i in range(N):
  a[i]=float(input().split())
  b[i]=input().split()
total=0
for j in range(N):
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]
print(total)


### FIXED CODE ###

N=int(input())
a=[]
b=[]
for i in range(N):
  x,y=input().split()
  a.append(float(x))
  b.append(y)
total=0
for j in range(N):
  if b[j]=='JPY':
    total += a[j]
  else:
    total += 380000.0*a[j]
print(total)
A, B, H, M = map(int, input().split())
sitaH = (H*60+M) / 720 * 2 * math.pi
sitaM =  M/60 * 2 * math.pi

posXH = A * math.cos(sitaH)
posYH = A * math.sin(sitaH)
posXM = B * math.cos(sitaM)
posYM = B * math.sin(sitaM)

delX = posXH - posXM
delY = posYH - posYM

d = (delX*delX + delY*delY)**(1/2)
print(d)

### FIXED CODE ###

import math
A, B, H, M = map(int, input().split())
sitaH = (H*60+M) / 720 * 2 * math.pi
sitaM =  M/60 * 2 * math.pi

posXH = A * math.cos(sitaH)
posYH = A * math.sin(sitaH)
posXM = B * math.cos(sitaM)
posYM = B * math.sin(sitaM)

delX = posXH - posXM
delY = posYH - posYM

d = (delX*delX + delY*delY)**(1/2)
print(d)
# cook your dish here
n=int(input())
s=""
for i in range(k):
    s+="ACL"
print(s)

### FIXED CODE ###

# cook your dish here
n=int(input())
s="ACL"*n

print(s)
alphabet = [0]*26
i = 0;
for j in range(97,123):
	alphabet[i] = chr(j)
	i += 1
al_count = [0]*26
while True :
	words = raw_input().lower().split()
	for k in words :
		for l in list(k):
			if l=='a':
				al_count[0] += 1
			elif l=='b':
				al_count[1] += 1
			elif l=='c':
				al_count[2]+=1	
			elif l=='d':
				al_count[3] += 1
			elif l=='e':
				al_count[4]+=1
			elif l=='f':
				al_count[5] += 1
			elif l=='g':
				al_count[6]+=1
			elif l=='h':
				al_count[7] += 1
			elif l=='i':
				al_count[8]+=1
			elif l=='j':
				al_count[9] += 1
			elif l=='k':
				al_count[10]+=1	
			elif l=='l':
				al_count[11] += 1
			elif l=='m':
				al_count[12]+=1	
			elif l=='n':
				al_count[13] += 1
			elif l=='o':
				al_count[14]+=1
			elif l=='p':
				al_count[15] += 1
			elif l=='q':
				al_count[16]+=1
			elif l=='r':
				al_count[17] += 1
			elif l=='s':
				al_count[18]+=1
			elif l=='t':
				al_count[19] += 1
			elif l=='u':
				al_count[20]+=1
			elif l=='v':
				al_count[21]+=1
			elif l=='w':
				al_count[22] += 1
			elif l=='x':
				al_count[23]+=1
			elif l=='y':
				al_count[24] += 1
			elif l=='z':
				al_count[25]+=1
	if words==[]:
		break
for i in range(26):
	print '%c : %d' %(alphabet[i],al_count[i])

### FIXED CODE ###


alphabet = [0]*26
i = 0;
for j in range(97,123):
	alphabet[i] = chr(j)
	i += 1
al_count = [0]*26
while True :
	try :
		words = raw_input().lower().split()
		for k in words :
			for l in list(k):
				if l=='a':
					al_count[0] += 1
				elif l=='b':
					al_count[1] += 1
				elif l=='c':
					al_count[2]+=1	
				elif l=='d':
					al_count[3] += 1
				elif l=='e':
					al_count[4]+=1
				elif l=='f':
					al_count[5] += 1
				elif l=='g':
					al_count[6]+=1
				elif l=='h':
					al_count[7] += 1
				elif l=='i':
					al_count[8]+=1
				elif l=='j':
					al_count[9] += 1
				elif l=='k':
					al_count[10]+=1	
				elif l=='l':
					al_count[11] += 1
				elif l=='m':
					al_count[12]+=1	
				elif l=='n':
					al_count[13] += 1
				elif l=='o':
					al_count[14]+=1
				elif l=='p':
					al_count[15] += 1
				elif l=='q':
					al_count[16]+=1
				elif l=='r':
					al_count[17] += 1
				elif l=='s':
					al_count[18]+=1
				elif l=='t':
					al_count[19] += 1
				elif l=='u':
					al_count[20]+=1
				elif l=='v':
					al_count[21]+=1
				elif l=='w':
					al_count[22] += 1
				elif l=='x':
					al_count[23]+=1
				elif l=='y':
					al_count[24] += 1
				elif l=='z':
					al_count[25]+=1
	except :
		break
for i in range(26):
	print '%c : %d' %(alphabet[i],al_count[i])
ans = 'No'
x ,y = map(int, input().split())
for i in range(x+1):
  if 2 ＊ x + 4 ＊ (x-i) == y:
    ans = 'Yes'
    break
print(ans)

### FIXED CODE ###

ans = 'No'
x, y = map(int, input().split())
for i in range(x+1):
  if (2 * i) + (4 * (x-i)) == y:
    ans = 'Yes'
    break
print(ans)
import math
N = int(input())
A = [int(x) for x in input().split(' ')]
def score(A, b):
    s = 0
    for i, Ai in enumerate(A):
        s = math.abs(Ai - i - b)
    return s
s = math.inf
for b in range(min(A), max(A)):
    si = score(A, b)
    if si < s:
        s = si
print(s)

### FIXED CODE ###

import statistics
N = int(input())
A = [int(x) for x in input().split(' ')]
def score(C, b):
    s = 0
    for i, Ci in enumerate(C):
        s += abs(Ci - b)
    return int(s)

C = [Ai - (i+1) for i, Ai in enumerate(A)]
b = statistics.median(C)
b1 = int(b)
b2 = int(b) + 1
s1 = score(C, b1)
s2 = score(C, b2)
print(min(s1, s2))
import heapq

X, Y, Z, K = map(int, input().split(" "))

A = sorted(map(int, input().split(" ")), reverse=True)
B = sorted(map(int, input().split(" ")), reverse=True)
C = sorted(map(int, input().split(" ")), reverse=True)

anslist = []
flag = {}

heapq.heappush(anslist, (-(A[0]+B[0]+C[0]), "000"))
count = 0


while count < K:
    p = heapq.heappop(anslist)
    while p[1] in flag:
        p = heapq.heappop(anslist)
    print(p[0]*(-1))
    flag[p[1]] = True
    count += 1
    # push
    a, b, c = map(int, p[1])
    for i, j, k in [[1, 0, 0], [0, 1, 0], [0, 0, 1]]:
        if a+i >= X or b+j >= Y or c+k >= Z:
            continue
        tmp = str(a+i)+str(b+j)+str(c+k)
        heapq.heappush(anslist, (-(A[a+i]+B[b+j]+C[c+k]), tmp))


### FIXED CODE ###

import heapq


class Delicious (object):
    def __init__(self, x, y, z):
        self.x = x
        self.y = y
        self.z = z

    def total(self):
        return(A[self.x] + B[self.y] + C[self.z])

    def __lt__(self, other):
        return self.total() > other.total()


X, Y, Z, K = map(int, input().split(" "))
A = sorted(map(int, input().split(" ")), reverse=True)
B = sorted(map(int, input().split(" ")), reverse=True)
C = sorted(map(int, input().split(" ")), reverse=True)

ds = []
heapq.heappush(ds, Delicious(0, 0, 0))

check = {}

for _ in range(K):
    d = heapq.heappop(ds)
    while (d.x, d.y, d.z) in check:
        d = heapq.heappop(ds)
    print(d.total())
    check[d.x, d.y, d.z] = True

    if d.x < X-1:
        heapq.heappush(ds, Delicious(d.x+1, d.y, d.z))
    if d.y < Y-1:
        heapq.heappush(ds, Delicious(d.x, d.y+1, d.z))
    if d.z < Z-1:
        heapq.heappush(ds, Delicious(d.x, d.y, d.z+1))