Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03195 (python)

Fixed submission:
N = int(input())
a = 0
for i in range(N):
    a += int(input())%2
 
if a > 0:
    print("first")
else:
    print("second")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
flag=True
for i in a:
    if a%2==1:
        flag=False

if a.count(1)==len(a):
    print("first")
elif flag:
else:
    print("second")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
    a[i]=int(input())
if a.count(1)==len(a):
    print("first")
else:
    print("second")
Problem p03324 (python)

Fixed submission:
d,n=map(int,input().split())
if n==100:
    print(pow(100,d)*101)
else:    
    print(pow(100,d)*n)

Buggy submission (verdict: Runtime Error):
d,n=map(int,input().split())
if n=100:
    print(pow(100,d)*101)
else:    
    print(pow(100,d)*n)

Buggy submission (verdict: Runtime Error):
d,n=map(int,input().split())
if n=100:
    print(100**d*101)
else:    
    print(100**d*n)
Problem p03407 (python)

Fixed submission:
a,b,c =map(int,input().split())
if a+b>=c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c =map(input().split())
if a+b>=c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c =map(int,input().split())
if a+b>=c
    print("YES")
else:
    print("NO")
Problem p03485 (python)

Fixed submission:
import math
a,b=map(int,input().split())
print(math.ceil((a+b)/2))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
count = {}
ans = 0
for i in a:
    count[i] += 1
for i,c in count.items():
    if i > c:
        ans += c
    elif i < c:
        ans += c - i
print(ans)

Buggy submission (verdict: Runtime Error):

import math
a=int(input())
b=int(input())
print(math.ceil((a+b)/2)
Problem p03487 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
count = {}
ans = 0
for i in a:
    if i not in count:
        count[i] = 1
    else:
        count[i] += 1
for i,c in count.items():
    if i > c:
        ans += c
    elif i < c:
        ans += c - i
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
count = {}
ans = 0
for i in a:
    count[i] += 1
for i,c in count.items():
    if i > c:
        ans += c
    elif i < c:
        ans += c - i
print(ans)
Problem p03573 (python)

Fixed submission:
a=list(map(int,input().split()))
a.sort()
if a[1]==a[0]:
    print(a[2])
else:
    print(a[0])

Buggy submission (verdict: Runtime Error):
a=map(int,input().split())
a.sort()
if a[1]==a[0]:
    print(a[2])
else:
    print(a[0])
Problem p03598 (python)

Fixed submission:
n=int(input())
k=int(input())
x=list(map(int,input().split()))
ans=0
for i in range(len(x)):
    ans+=min(abs(x[i]-k),abs(x[i]))*2
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
k=int(input())
x=list(map(int,input().split()))
ans=0
for i in x:
    ans+=min(abs(x-k),abs(x))*2
print(ans)
Problem p03643 (python)

Fixed submission:
n=input()
print("ABC"+n)

Buggy submission (verdict: Runtime Error):
n=int(input())
print("ABC"+n)
Problem p03657 (python)

Fixed submission:
a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")a,b=int(input())
if a%3==0 or b%3==0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
a,b=int(input())
if a%3==0 or b%3==0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")
Problem p03693 (python)

Fixed submission:
a,b,c=map(str,input().split())
n=int(a+b+c)
if n%4==0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(str,input().split())
m=int(a+b+c)
if n%4==0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(str,input().split())
print(n)
if n%4==0:
    print("YES")
else:
    print("NO")
Problem p03777 (python)

Fixed submission:
a,b=map(str,input().split())
if (a=="H" and b=="H") or (a=="D" and b=="D"):
    print("H")
else:
    print("D")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a=="H" and b=="H") and (a=="H" and b=="H"):
    print("H")
else:
    print("D")
Problem p03826 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
print(max(a*b,c*d))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a*b>=c*d:
    input(a*b)
else:
    input(c*d)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a*b>c*d:
    input(a*b)
else:
    input(c*d)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a*b>c*d:
    input(a*b)
else:
    input(c*d)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a*b>c*d:
    input(a*b)
else:
    input(c*d)
Problem p03845 (python)

Fixed submission:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p1=[]
x1=[]
for i in range(m):
    p,x=map(int,input().split())
    p1.append(p)
    x1.append(x)
for i in range(m):
    print(sum(t)-t[p1[i]-1]+x1[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p1=[]
x1=[]
for i in range(m):
    p,x=map(int,input().split())
    p1.append(p)
    x1.append(x)
for i in range(m):
    print(p1[i])
    print(x1[i])
    print(sum(t)-t[p1[i]]+x1[p1[i]])

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p1=[]
x1=[]
for i in range(m):
    p,x=map(int,input().split())
    p1.append(p)
    x1.append(x)
for i in range(m):
    print(sum(t)-t[p1[i]-1]+x1[p1[i]-1])
Problem p03852 (python)

Fixed submission:
c=input()
if c=="a" or c=="i" or c=="u" or c=="e" or c=="o":
    print("vowel")
else:
    print("consonant")

Buggy submission (verdict: Runtime Error):
c=input()
if c="a" or c="i" or c="u" or c="e" or c="o":
    print("vowel")
else:
    print("consonant")
Problem p03997 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
print((a+b)*c//2)

Buggy submission (verdict: Runtime Error):
a=int(input)
b=int(input)
c=int(input)
print(a*b*c//2)

Buggy submission (verdict: Runtime Error):
a=int(input)
b=int(input)
c=int(input)
print(a*b*h//2)

Buggy submission (verdict: Runtime Error):
a=int(input)
b=int(input)
c=int(input)
print(a*b*h///2)
Problem p03080 (python)

Fixed submission:
N = int(input())
s = input()

red = 0
blue = 0
for _ in s:
  if _ == "B":
    blue += 1
  else:
    red += 1

if red > blue:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
s = int(input())

red = 0
blue = 0
for _ in s:
  if _ == "B":
    blue += 1
  else:
    red += 1

if red > blue:
  print("Yes")
else:
  print("No")
Problem p03126 (python)

Fixed submission:
n, m = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(n)]
s = None
for d in data:
    if s is None:
        s = set(d[1:])
    else:
        s = s & set(d[1:])
print(len(s))

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
data = [list(map(int,input().split())) for _ in range(m)]

s = None
for d in data:
  if s is None:
    s = set(d[1:])
  else:
    s = s & set(d[1:])
print(len(s))
Problem p03136 (python)

Fixed submission:
from sys import stdin
 
n = int(stdin.readline().rstrip())
data = list(map(int, stdin.readline().rstrip().split()))
 
def is_s(hens):
  m = max(hens)
  hens.remove(m)
  if m < sum(hens):
  	return "Yes"
  else:
    return "No"
 
print(is_s(data))

Buggy submission (verdict: Runtime Error):
from sys import stdin
 
n = int(stdin.readline().rstrip())
data = map(int, stdin.readline().rstrip().split())
 
def is_s(hens):
  m = max(hens)
  hens.remove(m)
  if m < sum(hens):
  	return True
  else:
    return False
 
print(is_s(data))

Buggy submission (verdict: Runtime Error):
from sys import stdin

n = int(stdin.readline().rstrip())
data = map(int, stdin.readline().rstrip().split())

def is_s(hens):
  m = max(hens)
  hens.remove(m)
  if m < sum(hens):
  	return True
  else:
    return False

pritn(is_s(data))
Problem p03086 (python)

Fixed submission:
S = input()
S = S+"0"
max = 0
j = -1
for i in range(0, len(S)):
    if not(S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T"):
        if max<i-j-1:
            max = i-j-1
        j = i
print("{}".format(max))

Buggy submission (verdict: Runtime Error):
S = input()
list = []
j = -1
for i in range(0, len(S)):
    if not(S[i]=="A" or S[i]=="C" or S[i]=="G" or S[i]=="T"):
        list.append(i-j-1)
        j = i
print("{}".format(max(list)))
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if a*b%2==0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
N = int(input())
t0 = 0
x0 = 0
y0 = 0
for i in range(0, N):
    t1, x1, y1 = map(int, input().split())
    indicator = (t1-t0)-abs(x1-x0)-abs(y1-y0)
    if indicator<0 or indicator%2==1:
        print("No")
        break
    elif i==N-1:
        print("Yes")
        break
    t0 = t1
    x0 = x1
    y0 = y1
Problem p03105 (python)

Fixed submission:
A, B, C = (int(i) for i in input().split())  

if (B//A) > C:
    ANS = C
else:
    ANS = B//A

print(ANS)

Buggy submission (verdict: Runtime Error):
INPUT = list(map(int, input().split))
A = INPUT[0]
B = INPUT[1]
C = INPUT[2]

if (B//A) > C:
    ANS = C
else:
    ANS = B//A

print(ANS)

Buggy submission (verdict: Runtime Error):
INPUT = list(int, input().split)
A = INPUT[0]
B = INPUT[1]
C = INPUT[2]

if (B//A) > C:
    ANS = C
else:
    ANS = B//A

print(ANS)
Problem p03280 (python)

Fixed submission:
A, B = map(int, input().split())
print(A*B - A - B + 1)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

# A, B = map(int, input().split())
print(A*B - A - B + 1)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())

for i in range(K):
    if (int(S[i]) == 1):
        ans = int(S[i])
        continue
    if (int(S[i]) >= 2):
        ans = int(S[i])
    break

print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

for i in range(len(S)):
    if (int(S[i]) == 1):
        continue
    if (int(S[i]) >= 2):
        ans = int(S[i])
    break

print(ans)
Problem p03076 (python)

Fixed submission:
a = input()                                                             
b = input()                                                             
c = input()                                                             
d = input()                                                             
e = input()                                                             
                                                                        
orders = [a, b, c, d, e]                                                
orders = sorted(orders, key=lambda x:int(x[-1]))                        
                                                                        
a = []                                                                  
b = []                                                                  
for order in orders:                                                    
    if order[-1] == "0":                                                
        a.append(int(order))                                            
    else:                                                               
        b.append(order)                                                 
                                                                        
if len(a) == 5:                                                         
    o = sum(a)                                                          
else:                                                                   
    o = sum(a) + int(b[0]) + sum([10 - int(_b[-1])+int(_b) for _b in b[1:]])
print(o)

Buggy submission (verdict: Runtime Error):
a = int(input())                                                        
b = int(input())                                                        
c = int(input())                                                        
d = int(input())                                                        
e = int(input())                                                        
                                                                        
orders = [a, b, c, d, e]                                                
orders = list(map(str, orders))                                         
orders = sorted(orders, key=lambda x:int(x[-1]))                        
                                                                        
a = []                                                                  
b = []                                                                  
for order in orders:                                                    
    if order[-1] == "0":                                                
        a.append(int(order))                                            
    else:                                                               
        b.append(order)                                                 
                                                                        
o = sum(a) + int(b[0]) + sum([10-int(_b[-1])+int(_b) for _b in b[1:]])  
print(o)
Problem p03206 (python)

Fixed submission:
def main():
    day = int(input())
    if day == 22:
        print('Christmas Eve Eve Eve')
    elif day == 23:
        print('Christmas Eve Eve')
    elif day == 24:
        print('Christmas Eve')
    elif day == 25:
        print('Christmas')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, K = map(int, input().split())
    h = [int(input()) for count in range(N)]
    h.sort()
    min_value = min(h[i + K - 1] - h[i] for i in range(N - K + 1))
    print(min_value)


if __name__ == '__main__':
    main()
Problem p03125 (python)

Fixed submission:
a, b = map(int, input().split(' '))
if b % a == 0:
  print (a + b)
else:
  print (b - a)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if b % a == 0:
  print (a + b)
else:
  print (b - a)
Problem p03200 (python)

Fixed submission:
state = input().rstrip()
ans = 0
cnt = 0
for i, s in enumerate(state):
    if s == 'B':
        cnt += 1
    else:
        ans += cnt
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input().rstrip())
A = [int(s) for s in input().rstrip().split()]
A.sort()

squared = [2]
tmp = 2
while tmp < 2 * 10**9:
    tmp *= 2
    squared.append(tmp)

pairs = []
for i in range(N):
    for j in range(i+1, N):
        if A[i] + A[j] in squared:
            pairs.append([A[i], A[j]])

adopt = [format(i, 'b').rjust(len(pairs), '0') for i in range(2**len(pairs))]
max_pair = 0

for i in range(len(adopt)):
    num = []
    for j in range(len(pairs)):
        if adopt[i][j] == '1':
            num.append(pairs[j][0])
            num.append(pairs[j][1])
    if len(num) == len(set(num)) and len(num) > max_pair:
        max_pair = len(num)

print(max_pair // 2)
Problem p03361 (python)

Fixed submission:
H, W = map(int, input().rstrip().split())
s =[list(input().rstrip()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if s[i][j] =='#':
            flag = 0
            if i-1 >= 0 and s[i-1][j] == '#':
                flag = 1
            if j-1 >= 0 and s[i][j-1] == '#':
                flag = 1
            if j+1 < W and s[i][j+1] == '#':
                flag = 1
            if i+1 < H and s[i+1][j] == '#':
                flag = 1
            if flag == 0:
                print('No')
                exit()
                
print('Yes')

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().rstrip().split())
s =[list(input().rstrip()) for _ in range(W)]

judge = True
for i in range(H):
    for j in range(W):
        if s[i][j] =='#':
            flag = 0
            if i-1 >= 0 and s[i-1][j] == '#':
                flag = 1
            if j-1 >= 0 and s[i][j-1] == '#':
                flag = 1
            if j+1 < W and s[i][j+1] == '#':
                flag = 1
            if i+1 < H and s[i+1][j] == '#':
                flag = 1
            if flag == 0:
                judge == False
                
if judge:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().rstrip().split())
s =[list(input().rstrip()) for _ in range(W)]
colors = [['.' for _ in range(W)] for _ in range(H)] 
search = [[-1, 0], [0, -1], [0, 1], [1, 0]]

judge = True
for i in range(H):
    for j in range(W):
        if s[i][j] =='#':
            flag = 0
            for k in range(len(search)):
                x = i + search[k][0]
                y = j + search[k][1]
                if 0 <= x < H and 0 <= y < W and s[x][y] == '#':
                    colors[i][j] = colors[x][y] = '#'
                    flag = 1
                    if flag == 0:
                        judge = False
                        
if s != colors:
    judge = False

if judge:
    print('Yes')
else:
    print('No')
Problem p03574 (python)

Fixed submission:
H, W = [int(s) for s in input().rstrip().split()]
S = [list(input().rstrip()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        bomb = 0
        for x in range(i-1, i+2):
            for y in range(j-1, j+2):
                if 0 <= x < H and 0 <= y < W and S[x][y] == '#':
                    bomb += 1
        S[i][j] = str(bomb)

for s in S:
    print(''.join(s))

Buggy submission (verdict: Runtime Error):
H, W = [int(s) for s in input().rstrip().split()]
sqare = [list('.' * (W+2)) for _ in range(H+2)]
for i in range(1, H+1):
    S = list(input().rstrip())
    sqare[i][1:H+1] = S

bomb = [[0 for _ in range(W+2)] for _ in range(H+2)]

for i in range(1, H+1):
    for j in range(1, W+1):
        if sqare[i][j] != '#':
            sqare[i][j] = 0
            for x in range(i-1, i+2):
                for y in range(j-1, j+2):                
                    if not(x == i and y == j) and sqare[x][y] == '#':
                        sqare[i][j] += 1

for i in range(1, H+1):
    for j in range(1, W+1):
        print(sqare[i][j], end='')
    print('')

Buggy submission (verdict: Runtime Error):
H, W = [int(s) for s in input().rstrip().split()]
sqare = [list('.' * (W+2)) for _ in range(H+2)]
for i in range(1, H+1):
    S = list(input().rstrip())
    sqare[i][1:H+1] = S

bomb = [[0 for _ in range(W+2)] for _ in range(H+2)]

for i in range(1, H+1):
    for j in range(1, W+1):
        for x in range(i-1, i+2):
            for y in range(j-1, j+2):
                if not(x == i and y == j) and sqare[x][y] == '#':
                    bomb[i][j] += 1

for i in range(1, H+1):
    for j in range(1, W+1):
        if sqare[i][j] == '.':
            print(bomb[i][j], end='')
        else:
            print(sqare[i][j], end='')                        
    print('')

Buggy submission (verdict: Runtime Error):
H, W = [int(s) for s in input().rstrip().split()]
sqare = [list('.' * (W+2)) for _ in range(H+2)]
for i in range(1, H+1):
    S = list(input().rstrip())
    sqare[i][1:H+1] = S

bomb = [[0 for _ in range(W+2)] for _ in range(H+2)]    
for i in range(1, H+1):
    for j in range(1, W+1):
        for x in range(i-1, i+2):
            for y in range(j-1, j+2):
                if not(x == i and y == j) and sqare[x][y] == '#':
                    bomb[i][j] += 1

for i in range(1, H+1):
    for j in range(1, W+1):
        if sqare[i][j] == '.':
            print(bomb[i][j], end='')
        else:
            print(sqare[i][j], end='')                        
    print('')
Problem p03963 (python)

Fixed submission:
N, K = list(map(int, input().rstrip().split()))
ans = K * (K-1)**(N-1)
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = list(map(int, input().rstrip()))
ans = K * (K-1)**(N-1)
print(ans)
Problem p03103 (python)

Fixed submission:
N,M = map(int,input().split())
A = [0] * N
B = [0] * N
C = [[0,0] for i in range(N)]
check = 0
money = 0
a = 0
k = 0

for i in range(N):

    A[i],B[i] = map(int,input().split())
    C[i] = [A[i],B[i]]

C.sort()

while a == 0:

    if check + C[k][1] < M:

        check += C[k][1]
        money += C[k][0]*C[k][1]
        k += 1

        
    else:

        money += C[k][0] * (M-check)
        a += 1

print(money)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = [0] * N
B = [0] * N
C = [[0,0] for i in range(N)]
check = 0
money = 0
a = 0
k = 0

for i in range(N):

    A[i],B[i] = map(int,input().split())
    C[i] = [A[i],B[i]]

C.sort()

while a == 0:

    if check + C[k][1] <= M:

        check += C[k][1]
        money += C[k][0]*C[k][1]
        k += 1

    else:

        money += C[k][0] * (M-check)
        a += 1

print(money)
Problem p03076 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

v = [a,b,c,d,e]

import math

times = [ math.ceil(a/10)*10,
          math.ceil(b/10)*10,
          math.ceil(c/10)*10,
          math.ceil(d/10)*10,
          math.ceil(e/10)*10 ]

digit1 = [a - a//10*10,
          b - b//10*10,
          c - c//10*10,
          d - d//10*10,
          e - e//10*10]

m = digit1[0]
tt = 0
idx = 0

for i in range(5):
    tt += times[i]
    if 0 < digit1[i] and digit1[i] < m:
        m = digit1[i]
        idx = i

print('{}'.format(tt - times[idx] + v[idx]))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

v = [a,b,c,d,e]

import math

times = [ math.ceil(a/10)*10,
          math.ceil(b/10)*10,
          math.ceil(c/10)*10,
          math.ceil(d/10)*10,
          math.ceil(e/10)*10 ]

digit1 = [a - a//10*10,
          b - b//10*10,
          c - c//10*10,
          d - d//10*10,
          e - e//10*10]

m = 10
tt = 0
idx = 99

for i in range(5):
    tt += times[i]
    if 0 < digit1[i] and digit1[i] < m:
        m = digit1[i]
        idx = i

print('{}'.format(tt - times[idx] + v[idx]))
Problem p03076 (python)

Fixed submission:
import math


nums = list(map(int, [input() for _ in range(5)]))
s = sum(math.ceil(num / 10) * 10 for num in nums)
m = min([int(str(num)[-1]) for num in nums if num % 10 != 0], default=0)
if m != 0:
  s -= (10-m)
print(s)

Buggy submission (verdict: Runtime Error):
import math


nums = list(map(int, [input() for _ in range(5)]))
s = sum(math.ceil(num / 10) * 10 for num in nums)
m = min(int(str(num)[-1]) for num in nums if num % 10 != 0)
if m != 0:
  s -= (10-m)
print(s)
Problem p03078 (python)

Fixed submission:
# -*- coding: utf-8 -*-

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)

ABC = []

for x in range(X):
    for y in range(Y):
        if (x + 1) * (y + 1) > K:
            break
        for z in range(Z):
            if (x + 1) * (y + 1) * (z + 1) > K:
                break
            ABC.append(A[x] + B[y] + C[z])

ABC = sorted(ABC, reverse=True)

ABC = ABC[:K]
ABC = [str(abc) for abc in ABC]

print("\n".join(ABC))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

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)

ABC = []

for x in X:
    for y in Y:
        if (x + 1) * (y + 1) > K:
            break
        for z in Z:
            if (x + 1) * (y + 1) + (z + 1) > K:
                break
            ABC.append(A[x] + B[y] + C[z])

ABC = sorted(ABC, reverse=True)

ABC = ABC[:K]
ABC = [str(abc) for abc in ABC]

print("\n".join(ABC))