Problem:


﻿Score: 100 points

Problem Statement

In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.

Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.

Determine if there exists a pair of antennas that cannot communicate directly.

Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.  

Constraints

a, b, c, d, e and k are integers between 0 and 123 (inclusive).

a < b < c < d < e

Input

Input is given from Standard Input in the following format:

a
b
c
d
e
k

Output

Print :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.

Sample Input 1

1
2
4
8
9
15

Sample Output 1

Yay!

In this case, there is no pair of antennas that cannot communicate directly, because:

the distance between A and B is 2 - 1 = 1

the distance between A and C is 4 - 1 = 3

the distance between A and D is 8 - 1 = 7

the distance between A and E is 9 - 1 = 8

the distance between B and C is 4 - 2 = 2

the distance between B and D is 8 - 2 = 6

the distance between B and E is 9 - 2 = 7

the distance between C and D is 8 - 4 = 4

the distance between C and E is 9 - 4 = 5

the distance between D and E is 9 - 8 = 1

and none of them is greater than 15. Thus, the correct output is Yay!.

Sample Input 2

15
18
26
35
36
18

Sample Output 2

:(

In this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.
Thus, the correct output is :(.



Sample input:
1
2
4
8
9
15


Sample output:
Yay!

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input().split())


for i in range(5):
    if b-a > k or c-b > k or d-c > k or e-d > k:
        flag = True
    else:
        flag = False


if flag == True:
    print("Yay!")
else:
    print(":(")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input().split())

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

for i in list:
    if b-a and c-b and d-c and e-d <= k:
        flag = True
    else:
        flag = False


if flag == True:
    print("Yay!")
else:
    print(":(")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input().split())

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

for i in list:
    if b-a and c-b and d-c and e-d <= k:
        print('Yay!')
    else:
        print(':(')

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input().split())


if (e - a) <= k:
    print("Yay!")
else:
    print(":(")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input().split())

#一番遠い座標の距離とｋを比較する
if (e - a) <= k:
    print(":(")
else:
    print("Yay!")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input().split())


if k <= (e - a):
    print(":(")
else:
    print("Yay!")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input().split())


if k <= (e -a):
    print("Yay!")
else:
    print(":(")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input().split())


if k <= (a - e):
    print("Yay!")
else:
    print(":(")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input().split())

#一番遠い座標の距離とｋを比較する
if k <= (a - e):
    print("通信可能")
else:
    print("通信不可")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input().split())

#一番遠い座標の距離とｋを比較する
if k < (a - e):
    print("通信可能")
else:
    print("通信不可")

Submission status: Runtime Error

Solution code:
l = [int(input()) for _ in range(5)]
max_distance = input()
l[-1] - l[0] = distance
if max_distance > distance:
  print("Yay!")
else:
  print(":(")

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

if k >= max(a - e):
    print('Yay!')
else:
    print(':(')

Submission status: Runtime Error

Solution code:
a, b, c, d, e, k = map(int, input().split())

if k >= (a - e):
    print('Yay!')
else:
    print(':(')

Submission status: Runtime Error

Solution code:
X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
AB = {}
for a in A:
  for b in B:
    AB[a+b] = AB.get(a+b,0)+1
kab = list(AB.keys())
kab.sort()
ABC = {}
for y in kab[-K:]:
  for c in C:
    ABC[y+c] = ABC.get(y+c,0)+1
kabc = list(ABC.keys())
kabc.sort()
sk = 0
for ki in kabc[-1:-K-1:-1]:
  p = min(ABC[ki],K-sk)
  sk += p
  for j in range(p):
    print(ki)
  if sk>=K:
    break

Submission status: Runtime Error

Solution code:
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
f=min(a,b,c,d,e)
g=max(a,b,c,d,e)
h=g-f
if h <= k:
  print('Yay')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
import sys
 
antennas = [int(input()) for _ in range(5)]
k = int(input())
 
for p in range(5):
  for q in range(p+1,5):
    if antennas[q] - antennas[p] > k:
      print ':('
      sys.exit()

print 'Yay!'

Submission status: Runtime Error

Solution code:
import sys

antennas = [int(input()) for _ in range(5)]
k = int(input())

for p in range(5):
  for q in range(p+1,5):
    if antennas[q] - antennas[p] > k:
      print ':('
      sys.exit()

print 'Yay!'

Submission status: Runtime Error

Solution code:
if e - a > k:
  print(":(")
else:
  print("Yay!")

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a>k or d=a>k or c-a>k or b-a>k:
    print(":(")
else:
    print("Yay!")

Submission status: Runtime Error

Solution code:
a = []
for _ in range(5):
  a.append(int(input()))
b =[]
c = []
for i in range(5):
  b[i] = a[i]
for i in range(5):
  while b[i] > 10:
  	b[i] = b[i] - 10
  if min(b[i]) == 10:
  	print(sum(a))
  else:
  	for i in range(5):
    	if b[i] == 10:
          c[i] = a[i]
        if b[i] != 10:
          c[i] = a[i] +10 -b[i]
        d = sum(c)
        mini = min(b)
        ans = d - 10 + mini
        print(ans)

Submission status: Runtime Error

Solution code:
a = []
for _ in range(5):
  a.append(int(input()))
b =[]
c = []
for i in range(5):
  b[i] = a[i]
for i in range(5):
  while b[i] > 10:
  	b[i] = b[i] - 10
  if min(b[i]) == 10:
    return sum(a)
  else:
    for i in range(5):
    	if b[i] == 10:
          c[i] = a[i]
        else:
          c[i] = a[i] +10 -b[i]
        d = sum(c)
        mini = min(b)
        ans = d - 10 + mini
        return ans

Submission status: Runtime Error

Solution code:
a = []
for i in range(0,4):
  a.append(input())
k =int(input())
if k <= (a[4] - a[0]):
  print("Yay!")
else:
  print(":(")

Submission status: Runtime Error

Solution code:
a = []
for i in range(0,4):
  a.append(input())
k =int(input())
if k <= (a[4] - a[0]):
  print(Yay!)
else:
  print(:()

Submission status: Runtime Error

Solution code:
a = []
for i in range(0,4):
  a.append(input())
k =int(input())
if k <= (a[4] - a[0]):
  print('Yay!')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
a = []
for i in range(0,4):
  a = a.append(input())
k =int(input())
if k <= (a[4] - a[0]):
  print('Yay!')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
ls = []
for i in range(5):
    ls.append(int(input()))
ansls=[]
k = input()
for i in range(4):
    m = ls[i+1]-ls[i]
    ansls.append(m)

if max(ansls)>k:
    print(':(')
else:
    print('Yay!')

Submission status: Runtime Error

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
ls = []
for i in range(4):
    ls.append(int(input()))
ansls=[]
k = input()
for i in range(4):
    m = ls[i+1]-ls[0]
    ansls.append(m)

if max(ansls)>k:
    print(':(')
else:
    print('Yay!')

Submission status: Runtime Error

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
ls = []
for i in range(4):
    ls.append(int(input()))
ansls=[]
k = input(k)
for i in range(4):
    m = ls[i+1]-ls[0]
    ansls.append(m)

if max(ansls)>k:
    print(':(')
else:
    print('Yay!')

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
K = int(input())
 
arr = [e, d, c, b, a]
leng_arr = []
for i in range(len(arr)):
  for j in range(4-i):
    leng = arr[i]-arr[j+1]
    leng_arr.append(leng)
    
if all([i =< k for i in leng_arr]):
  print('Yay')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

arr = [e, d, c, b, a]
leng_arr = []
for i in range(len(arr)):
  for j in range(4-i):
    leng = arr[i]-arr[j+1]
    leng_arr.append(leng)
    
if all([i =< k for i in leng_arr]):
  print('Yay')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
arr = [e, d, c, b, a]
leng_arr = []
for i in range(len(arr)):
  for j in range(4-i):
    leng = arr[i]-arr[j+1]
    leng_arr.append(leng)
    
if all([i =< k for i in leng_arr]):
  print('Yay')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
hantei = 0

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

for i in x:
 for j in x:
    if i - j > k:
        hantei.append(1)


if hantei == 0:
    print("Yay!")
else:
    print(":(")

Submission status: Runtime Error

Solution code:
x,y,z,K = map(int,input().split())
abc = [sorted(list(map(int,input().split())), reverse=True) for i in range(3)]

ans=[]
ab=[]

for i in range(x):
    for j in range(y):
        if (i+1)*(j+1) <= K:
            ab.append(abc[0][i]+abc[1][j])

ab.sort(reverse=True)

for i in range(min([len(ab),K])):
    for j in range(z):
        if (i+1)*(j+1) <= K:
            ans.append(ab[i]+abc[2][j])
    
ans.sort(reverse=True)

for i in range(K):
    print(ans[i])

Submission status: Runtime Error

Solution code:
nums = []

for i in range(5):
  nums.append(input())

k = input()

for i in range(5):
  for j in range(5-i)[1:]:
    if nums[j] - nums[i] > k:
      print ":("
      return

print "Yay!"
return

Submission status: Runtime Error

Solution code:
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
if e-a>k:
    print(":(")
else:
    print("Yay!")

Submission status: Runtime Error

Solution code:
a = []
for i in range(5):
	a.append(int(input().split()))
k = int(input().split())

for i in range(4):
  if a[i+1] - a[i] > k :
    print(": (")
    exit()

print("Yay!")

Submission status: Runtime Error

Solution code:
data = [int(input()) for i in range(5)]
K = input()
print(":(" if data[4]-data[0]>K else "Yay!" )

Submission status: Runtime Error

Solution code:
data = [input() in range(5)]
K = input()
print(":(" if data[4]-data[0]>K else "Yay!" )

Submission status: Runtime Error

Solution code:
import math
xyzk = list(map(int,input().split()))
abc = [list(map(int,input().split())) for a in range(3)]
ab=[]
for a in abc[0]:
    for b in abc[1]:
        ab.append(a+b)
ab.sort()
ab.reverse()
abc[2].sort()
abc[2].reverse()
abc2=[]
for c in range(abc[2]):
    for a in range(min([xyzk[3]/(c+1),len(ab)])):
        abc2.append(abc[2][b]+ab[a])
abc2.sort()
abc2.reverse()
for a in range(xyzk[3]):
    print(abc2[a])

Submission status: Runtime Error

Solution code:
X = [list(map(int, input().split())) for i in range(5)]
k = int(input())
print('Yay!') if max(X) - min(X) >= k else print(':(')

Submission status: Runtime Error

Solution code:
a, b, c, d, e, k = map(int,input().split())
if e - a > k:
  	print(':(')
else:
  	print('Yay!')

Submission status: Runtime Error

Solution code:
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()
if e - a > k:
  	print(':(')
else:
  	print('Yay!')

Submission status: Runtime Error

Solution code:
a = input()



e = input()
k = input()
if e - a > k:
  	print(':(')
else:
  	print('Yay!')

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input().split())
if e-a<=k and e-b<=k and e-c<=k and e-d<=k:
 print(':(')
else:
 print('Yay!')

Submission status: Runtime Error

Solution code:
xargs | awk '{if($5-$1<$6){print "Yay!"}else{":("}}'

Submission status: Runtime Error

Solution code:
a = [int(input()) for i in range(6)]

# アンテナと距離に分ける
i = [a[0], a[1], a[2], a[3], a[4]]
k = a[5]

flag = False
itr = 0
while True:
  x = itr
  while True:
    x++
    if 
      break
    else if(i[itr] - i[x]) > k:
      flag = True
  itr++
  if itr == 5
    break
    
if flag
  print(":(")
else
  print("Yay!")

Submission status: Runtime Error

Solution code:
nums=[]
for i in range(6):
  nums.append(int(input()))
s = "Yay!"
for i in nums:
  if abs(i - nums[i:-1]) > nums[-1]:
    s = ":("
print(s)

Submission status: Runtime Error

Solution code:
nums=[]
for i in range(6):
  nums.append(int(input()))
s = "Yay!"
for i in nums:
  if abs(i - nums[i:]):
    s = ":("
print(s)

Submission status: Runtime Error

Solution code:
for i in range(6):
  nums[i] = int(input())
s = "Yay!"
for i in nums:
  if abs(i - nums[i:]):
    s = ":("
print(s)

Submission status: Runtime Error

Solution code:
def lsum(x):
    return A[x[0]] + B[x[1]] + C[x[2]]

def nextlist():
    global lx
    idx = 0
    m = lsum(lx[0])
    for i in range(len(lx)):
        s = lsum(lx[i])
        if m < s:
            m = s
            idx = i
    p = lx.pop(idx)
    wa.append(lsum(p))
    if p[0] > 0:
        if not [p[0]-1, p[1], p[2]] in lx:
            lx.append([p[0]-1, p[1], p[2]])
    if p[1] > 0:
        if not [p[0], p[1]-1, p[2]] in lx:
            lx.append([p[0], p[1]-1, p[2]])
    if p[2] > 0:
        if not [p[0], p[1], p[2]-1] in lx:
            lx.append([p[0], p[1], p[2]-1])

l1 = list(map(int, input().split(" ")))

X,Y,Z,K = l1[0],l1[1],l1[2],l1[3]
A = sorted(list(map(int, input().split(" "))))
B = sorted(list(map(int, input().split(" "))))
C = sorted(list(map(int, input().split(" "))))

wa = []
lx = [[X-1,Y-1,Z-1]]

for i in range(K):
    nextlist()

for l in wa:
    print(l)

Submission status: Runtime Error

Solution code:
a=[]

for i in range(6):
    a.append(int(input())

a=sort(a)
if(a[4]-a[0]>a[5]):
    print(':(')
else:
    print('Yay!')

Submission status: Runtime Error

Solution code:
a=[]

for i in range(6):
    a.append(int(input())

a=a.sort()
if(a[4]-a[0]>a[5]):
    print(':(')
else:
    print('Yay!')

Submission status: Runtime Error

Solution code:
a=[]

for i in range(6):
  a.append(int(input())

a=a.sort()
if(a[4]-a[0]>a[5]):
    print(':(')
else:
    print('Yay!')

Submission status: Runtime Error

Solution code:
nums = [input() for i in range(6)]

if nums[4] - nums[0] > nums[5]:
  print(':(')
print('Yay!')

Submission status: Runtime Error

Solution code:
nums = [input() for i in range(6)]

if nums[4] - nums[0] > nums[5]:
  print ':('
print 'Yay!'

Submission status: Runtime Error

Solution code:
nums = [input() for i in range(6)]

if nums[4] - nums[0] > nums[5]:
  return ':('
return 'Yay!'

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k=[input() for i in range(6)]
if e-a<=k:
    print("Yay!")
else:
    print(":(")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k=map(int,input().split())
if e-a<=k:
    print("Yay!")
else:
    print(":(")

Submission status: Runtime Error

Solution code:
a = map(int,input())
b = map(int,input())
c = map(int,input())
d = map(int,input())
e = map(int,input())
k = map(int,input())

List = list(a,b,c,d,d,e)
if max(List)-min(List) <= k:
	print("Yay!")
else<
	print(":(")

Submission status: Runtime Error

Solution code:
numbers=[list(map(int,input())) for i in range(6)]
for i in numbers[:5] :
    for j in numbers[:5] :
        if abs(i-j) > numbers[6] :
            print(':(')
        else :
            print('Yay!')

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
K = int(input())
if E-A=>K:
	print(":(")
else:
	print("yay!")

Submission status: Runtime Error

Solution code:
a=input()
for i in range(3):
  input()
e=input()
k=input()
if e-a<=k:
  print("Yay!")
else:
  print(":(")

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
n = 0
if e-a > k or e-b > k or d-a > k or e-c > k or d-b > k or c-a > k or e-d > k or d-c > k or c-b > k or b-a > k:
    n = 1

if n = 1:
    print(":(")
if n = 0:
    print("Yay!")

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
int n = 0
if e-a > k or e-b > k or d-a > k or e-c > k or d-b > k or c-a > k or e-d > k or d-c > k or c-b > k or b-a > k:
    n = 1

if n = 1:
    print(":(")
if n = 0:
    print("Yay!")

Submission status: Runtime Error

Solution code:
import sys
list = [input() for _ in range(6)]
for i in range(5):
  for j in range(i+1, 5):
    if list[j] - list[i] > list[5]:
      print(':(')
      sys.exit()
print('Yay!')

Submission status: Runtime Error

Solution code:
x, y, z, k = map(int, input().split())
l_a = list(map(int, input().split()))
l_b = list(map(int, input().split()))
l_c = list(map(int, input().split()))
print(list(itertools.product(l_a, l_b, l_c)))
l = [sum(i) for i in list(itertools.product(l_a, l_b, l_c))]
print(sorted(l, reverse=True)[:k])

Submission status: Runtime Error

Solution code:
l = [int(input()) for i in range(5)]
l_0 = [a%10 for a in l]
ar = []
for n in l_0:
  if n != 0:
    ar.append(10-n)
  else:
    ar.append(0)
s = l_0.index(max(l_0))
l.pop(s)
l_0.pop(s)
ans = sum(l) + sum(l_0) + l[s]
print(ans)
l = [int(input()) for i in range(5)]
l_0 = [a%10 for a in l]
ar = []
for n in l_0:
  if n != 0:
    ar.append(10-n)
  else:
    ar.append(0)
s = ar.index(max(ar))
ar.pop(s)
ans = sum(l) + sum(ar)
print(ans)

Submission status: Runtime Error

Solution code:
l = [int(input()) for i in range(5)]
l_0 = [a%10 for a in l]
ar = []
for n in l_0:
  if n != 0:
    ar.append(10-n)
  else:
    ar.append(0)
s = l_0.index(max(l_0))
l.pop(s)
l_0.pop(s)
ans = sum(l) + sum(l_0) + l[s]
print(ans)

Submission status: Runtime Error

Solution code:
if e - a =< k:
  print('Yay!')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
read()

Submission status: Runtime Error

Solution code:
anntena = []
for i in range(5):
  anntena.append(int(input())
k = int(input())
                 
if anntena[4] - anntena[0] <= k:
  print('Yey!')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
anntena = []
for i in range(5):
    anntena.append(int(input())
k = int(input())
                 
if anntena[4] - anntena[0] <= k:
    print('Yey!')
else:
    print(':(')

Submission status: Runtime Error

Solution code:
anntena = []
for i in range(5):
	anntena.append(int(input())
k = int(input())
                 
if anntena[4] - anntena[0] <= k:
	print('Yey!')
else:
    print(':(')

Submission status: Runtime Error

Solution code:
antenna = [int(input()) for _ in range(N)]
k = int(input())

print("Yay!" if max(antenna) - min(antenna) <= k else ":(")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = int(input()) for i in range(6)
print("Yay!" if (e - a <= k) else ":(")

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if( e - a > k):
	print(':)')
else:
	print('Yay'")

Submission status: Runtime Error

Solution code:
a, b, c, d, e, k = (int(i) for i in int(input()))
city = (d, c, b, a)
result = 'Yay!'
for i, c in enumerate(city):
    for cC in city.index(i + 1, city.count()):
        if (c - cC) > k:
            result = ':('
            break;
print(result)

Submission status: Runtime Error

Solution code:
import heapq
X,Y,Z,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
B=sorted(list(map(int,input().split())))[::-1]
C=sorted(list(map(int,input().split())))[::-1]

default=A[0]+B[0]+C[0]
A=[A[0]-A[i] for i in range(len(A))]
B=[B[0]-B[i] for i in range(len(B))]
C=[C[0]-C[i] for i in range(len(C))]

print(default)
hp=[]
visited=set()
visited.add((0,0,0))
a,b,c=0,0,0
for _ in range(K-1):
  if (a+1,b,c) not in visited and a+1<len(A):
    heapq.heappush(hp,(A[a+1]+B[b]+C[c],(a+1,b,c)))
    visited.add((a+1,b,c))
  if (a,b+1,c) not in visited and b+1<len(B):
    heapq.heappush(hp,(A[a]+B[b+1]+C[c],(a,b+1,c)))
    visited.add((a,b+1,c))
  if (a,b,c+1) not in visited and c+1<len(C):
    heapq.heappush(hp,(A[a]+B[b]+C[c+1],(a,b,c+1)))
    visited.add((a,b,c+1))
  temp=heapq.heappop(hp)
  print(default-temp[1])
  a,b,c=temp[2]

Submission status: Runtime Error

Solution code:
v = list(map(int, input().split()))
m = v[0]//min(v[1:])
print(4+m)

Submission status: Runtime Error

Solution code:
X,Y,Z,K = (int(num) for num in input().split())
a = [int(num) for num in input().split()]
b = [int(num) for num in input().split()]
c = [int(num) for num in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

l = []
for i in range(X):
    if i+1 > K:
        break
    
    for j in range(Y):
        if (i+1) + (j+1) > K:
            break
        
        for k in range(Z):
            if (i+1) + (j+1) + (k+1) > K:
                break
            
            l.append(a[i]+b[j]+c[k])
            
            
l.sort(reverse=True)
for i in range(K):
    print(l[i])

Submission status: Runtime Error

Solution code:
import sys
a=[int(i) for i in sys.stdin.resd().split('\n')]
k=a[5]
a=a[:5][::-1]
def check(a,k):
  for i in range(len(a[:4])):
    for j in range(i,len(a)):
      if a[i]-a[j]>k:
        return False
  return True
if check(a,k):
  print('Yay!')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = map(int, input())
if(e-a > k):
    print(":(")
else:
    print("Yay!")

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if max(e-a) > k:
    print(":(")
else:
    print("Yay!")

Submission status: Runtime Error

Solution code:
x,y,z,k = [int(num) for num in input().split()]
#入力して降順ソートしてｋ個分にスライス
a_cake,b_cake,c_cake = [sorted([int(num) for num in input().split()],reverse=True)[:k] for _ in range(3)]

#リストの最初の値(max値)との差分をリスト化
diff_list = list()
for cake in [a_cake,b_cake,c_cake]:
        diff_list.extend(list(map(lambda x:cake[0]-x,cake)))

diff_list.sort()
cake_max = a_cake[0]+b_cake[0]+c_cake[0]
for diff in diff_list[:k]:
    print(cake_max-diff)

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if b-a<=k and c-b<=k and d-c<=k and e-d<=K:
  print(":(")
else:
  print("Yay!")

Submission status: Runtime Error

Solution code:
(X,Y,Z,K) = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

delicious_list = []
for a in A[:min((1000,len(A)))]:
    for b in B[:min((1000,len(B)))]:
        for c in C[:min((1000,len(C)))]:
            delicious_list.append(a+b+c)
delicious_list.sort(reverse=True)
for i in range(K):
    print(delicious_list[i])

Submission status: Runtime Error

Solution code:
(X,Y,Z,K) = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

delicious_list = []
for a in A[:min((1100,len(A)))]:
    for b in B[:min((1100,len(B)))]:
        for c in C[:min((1100,len(C)))]:
            delicious_list.append(a+b+c)
delicious_list.sort(reverse=True)
for i in range(K):
    print(delicious_list[i])

Submission status: Runtime Error

Solution code:
(X,Y,Z,K) = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

delicious_list = []
for a in A[:min((1500,len(A)))]:
    for b in B[:min((1500,len(A)))]:
        for c in C[:min((1500,len(A)))]:
            delicious_list.append(a+b+c)
delicious_list.sort(reverse=True)
for i in range(K):
    print(delicious_list[i])

Submission status: Runtime Error

Solution code:
x,y,z,k = [int(num) for num in input().split()]
a_cake,b_cake,c_cake = [sorted([int(num) for num in input().split()],reverse=True) for _ in range(3)]

sum_cake = sorted([a+b+c for a in a_cake for b in b_cake for c in c_cake],reverse=True)[:k]
print(sum_cake)

Submission status: Runtime Error

Solution code:
N = int(input())
a = [int(input()) for i in range(N)]
flag = True

for i in range(1, N):
  if a[N-1] < a[i]:
    flag = False

if flag:
  print('Yay!')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
N = int(input())
a = [int(input()) for i in range(N)]
flag = True

for i in range(N):
  if a[N-1] < a[i]:
    flag = False

if flag:
  print('Yay!')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
N = 5
k = int(input()) #1行目のNを取得する
l = [input() for i in range(N)] #複数行の数値の入力を取得

flg = 'Yay!'
for ind_p in range(N):
  p = l[ind_q]
  for ind_q in range(p, N):
    q = l[ind_q]
    if q - p > k:
      flg = ':('

Submission status: Runtime Error

Solution code:
return ':('

Submission status: Runtime Error

Solution code:
a = [int(input()) for i in range(N)]
flag = True

for i in range(N):
  if a[N-1] < a[i]:
    flag = False

if flag:
  print('Yay!')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
a = [int(input()) for i in range(N)]
flag = True

for i in range(N):
  if a[N-1] < a[i]:
    flag = False

if flag:
  print('Yay')
else:
  print(':(')

Submission status: Runtime Error

Solution code:
x, y, z, k = map(int, input().split())

xlist = sorted(list(map(int,input().split())), reverse=True)[:min(x, k)]
ylist = sorted(list(map(int,input().split())), reverse=True)[:min(y, k)]
zlist = sorted(list(map(int,input().split())), reverse=True)[:min(z, k)]


anslist = [0]
for i in range(min(x, k)):
    for j in range(min(y, k)):
        for l in range(min(z, k)):
            if (i+1)*(j+1)*(l+1) <= k:
                anslist.append(xlist[i] + ylist[j] + zlist[l])
            else:
                break

anslist = sorted(anslist, reverse=True)
for i in range(k):
    print(anslist[i])

Submission status: Runtime Error

Solution code:
a,b,c,k=map(int,input().split())
cake1=sort(list(map(int,input().split()),reverse=True))[:max(a,k)]
cake2=sort(list(map(int,input().split()),reverse=True))[:max(b,k)]
cake3=sort(list(map(int,input().split()),reverse=True))[:max(c,k)]
res=[]
for i in range(min(a,k)):
  for j in range(min(b,k)):
    for l in range(min(c,k)):
      if (a+1)*(b+1)*(c+1)<k:
        res.append(cake1[i]+cake2[j]+cake3[l])
res.sort(reverse=True)
for i in range(k):
  print(res[i])

Submission status: Runtime Error

Solution code:
a=input(int)
b=input(int)
c=input(int)
d=input(int)
e=input(int)
k=input(int)
if (e-a) < k :
  print("Yay!")
else:
  print(":(")

Submission status: Runtime Error

Solution code:
a=input(int)
b=input(int)
c=input(int)
d=input(int)
e=input(int)
k=input(int)
if (a-e) < k :
  print("Yay!")
else:
  print(":(")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k=map(int,input().split())
if (a-e) < k :
  print("Yay!")
else:
  print(":(")

Submission status: Runtime Error

Solution code:
lst = [int(x) for x in input().split()]
lst.sort(reverse=True, key = lambda x : (x - 1) % 10)
s = 0
for i in lst:
    s += i
    if i != lst[4]:
        s += 10 - s % 10

print(s)

Submission status: Runtime Error

Solution code:
# A - Five Antennas

for i in range(6):
    a[i] = int(input())

out_flag = False
    
for i in range(4):
    if a[i+1]-a[i] > a[5]:
        out_flag = True

if out_flag:    
    print(':(')
else:
    print('Yay!')

Submission status: Runtime Error

Solution code:
data=[]
N=0

for i in range(0,X):
  while N<K:
    for j in range(0,Y):
      while N<K:
        for k in range(0,Z):
          while N<K:
            data.append(int(A[i]+B[j]+C[k]))
            N=N+1
    
data.sort()
data.reverse()

for l in range(K):
  print(data[l])

Submission status: Runtime Error

Solution code:
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
sum0 = []

for i in range(x):
	for j in range(y):
		for l in range(z):
			sum0.append(a[i] + b[j] + c[l])


sum0.sort(reverse = True)

for i in range(k):
	print(sum0[i])

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

R=[a,b,c,d,e,k]

for i in 4:
 d=R[i]-R[0]
 e=R[i]-R[1]
 f=R[i]-R[2]
 g=R[i]-R[3]
 if d>k or e>k or f>k or g>K:
  print(":(")
  exit()
print("Yay!")

Submission status: Runtime Error

Solution code:
t = "Yay!"
f = ":("

antennas = [input() for _ in range(5)]
k = input()

if max(antennas) <= k:
  print(t)
else:
  flag = True
  for i in antennas:
    for j in antennas:
      if abs(i-j) >= k:
        flag = False
  if flag: print(t)
  else: print(f)

Submission status: Runtime Error

Solution code:
A = [ int ( input ()) for i in  range ( 5 )
K = int ( input ())

if (A [- 1 ] -A [ 0 ] <= K) :
     print ( "Yay!" )
 else :
     print ( ":(" )

Submission status: Runtime Error

Solution code:
if e-a>k:

  print ':('

else:

  print 'Yay!'

Submission status: Runtime Error

Solution code:
import sys
import itertools

x,y,z,k = map(int,(input().split()))

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

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

comb_a = [a[0]]
comb_b = [b[0]]
comb_c = [c[0]]
next = []
sum = []

comb = list(itertools.product(comb_a,comb_b,comb_c))
num_comb = len(comb)

#while num_comb < k*2 and num_comb < 3000:
while num_comb < 3000:


    next = []
    for i in a,b,c:
        if len(i) >= 2:
            next.append(i[0] - i[1])
        if len(i) == 1:
            next.append(10000000001)
    if min(next) != 10000000001:
        if len(a) >= 2 and min(next) == a[0] - a[1]:
            comb_a.append(a[1])
            a.pop(0)
        elif len(b) >= 2 and min(next) == b[0] - b[1]:
            comb_b.append(b[1])
            b.pop(0)
        elif len(c) >= 2 and min(next) == c[0] - c[1]:
            comb_c.append(c[1])
            c.pop(0)
    else:
        break
    comb = list(itertools.product(comb_a,comb_b,comb_c))
    num_comb = len(comb)
    
for i in comb:
    sum.append(i[0]+i[1]+i[2])
sum.sort(reverse=True)
for i in range(k):
    print(sum[i])

Submission status: Runtime Error

Solution code:
distances = [int(input()) in _ for range(5)]
K = int(input())

if distances[-1] - distances[0] > K:
  print(":(")
else:
  print("Yay!")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k=[int(input()) for _ in range(5)]
if e-a<=k:
    print('Yay!')
else:
    print(':(')

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k=[int(input()) for _ in range(5)]
if e-a>=k:
    print('Yay!')
else:
    print(':(')

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k=map(int,input())
if e-a>=k:
    print('Yay!')
else:
    print(':(')

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = [int(input()) for _ in range(6)]
 
result = "Yey!" if e-a<=k else ":("
println(result)

Submission status: Runtime Error

Solution code:
a = [int(input()) for i in range(5)]
k = input()
if max(a) - min(a) <= k:
  print("Yay!")
else:
  print(":(")

Submission status: Runtime Error

Solution code:
a,b,c,d,e,k = [int(input()) for _ in range(6)]

if e-a > k:
	print(":(")
else
	print("Yey!")