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 :( .

Solution (Python):

"""
Created on Sat Apr  6 21:22:08 2019

@author: Tabe
"""

pos = list()
for i in range(5):
    pos.append(int(input()))

k = int(input())
hh = False

for index, val in  enumerate(pos):
    if hh == True:
        break;
    
    if index == 4:
        print("Yay!")
        break
    
    for i in  range(5):
        if abs(pos[index] - pos[i]) <= k:
            pass
        else:
            print(":(")
            hh = True
            break

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

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

Solution (Python):
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!')

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
list = [a, b, c, d, e, k]

b_1 = (b - a  <= k)
c_1 = (c - a <= k)
d_1 = (d - a <=k)
e_1 = (e - a <= k)

list_1 = [b_1, c_1, d_1, e_1]

count = 0
kotae = []
for i in range(len(list_1)):
    if list_1[i] == False:
        count = count + 1
if count > 0:
   kotae.append(0)

list_2 = []
for i in range(2, 5):
    list_2.append( list[i] - b <= k)
 

unko = 0
for i in range(len(list_2)):
    if list_2[i] == False:
        unko = unko + 1
if unko > 0:
    kotae.append(0)

list_3 = []
for i in range(3, 5):
    list_3.append( list[i] - c <= k)
    
count = 0
for i in range(len(list_3)):
    if list_3[i] == False:
        count = count + 1
if count > 0:
    kotae.append(0)

v = (e - d <= k)
if v == 0:
   kotae.append(0)

if (0 in kotae) == 1:
    print (':(')
else:
    print('Yay!')

Solution (Python):


import itertools

def main():
    anthenas = []
    for _ in range(5):
        anthenas.append(int(input()))
    k = int(input())

    for v in  itertools.combinations(anthenas, 2):
        d = abs(v[1] - v[0])
        if d > k:
            msg = ':('
            break
        msg = 'Yay!'
    
    print(msg)

if __name__ == '__main__':
    main()

Solution (Python):
raw = raw_input()
a = int(raw)
raw = raw_input()                                  
b = int(raw)
raw = raw_input()                                  
c = int(raw)
raw = raw_input()                                  
d = int(raw)
raw = raw_input()                                  
e = int(raw)
raw = raw_input()                                  
k = int(raw)
                                                                                                       
if e - a > k:
    print ':('
else:                                                                                                  
    print 'Yay!'

Solution (Python):
x = [int(input()) for i in range(6)]
if x[4] - x[0] <= x[-1]: print("Yay!")
else: print(":(")

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

if b - a > k:
    print(":(")
elif c - a > k:
    print(":(")
elif d - a > k:
    print(":(")
elif e - a > k:
    print(":(")
elif c - b > k:
    print(":(")
elif d - b > k:
    print(":(")
elif e - b > k:
    print(":(")
elif d - c > k:
    print(":(")
elif e - c > k:
    print(":(")
elif e - d > k:
    print(":(")
else:
    print("Yay!")

Solution (Python):
import numpy as np
n=6
a=[int(input()) for i in range(n)]
dero=np.zeros((25,2))
for i in range(5):
  for j in range (5):
    dero[i*5+j][0]=a[j]-a[i]
    dero[i*5+j][1]=a[5]
frag=0
for i in range(25):
  if dero[i][0]>dero[i][1]:
    frag=1
if frag==0:
  print("Yay!")
else:
    print(":(")

Solution (Python):
def main(a):
  for i in range(4):
    for j in range(i+1, 5):
      if a[j] - a[i] > k:
        print(":(")
        return 
  else :
    print("Yay!")
    return

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

Solution (Python):




a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

if b-a>k or c-a>k or d-a>k or e-a>k or c-b>k or d-b>k or e-b>k or d-c>k or e-c>k or e-d>k:
    print(":(")
else:
    print("Yay!")

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

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

Solution (Python):
m_list = list()
for k in range(5):
    m = int(input())
    m_list.append(m)
num = int(input())

x_list = list()
count = 0
for i in range(0, len(m_list)-1):
    for j in range(i+1, len(m_list)):
        x_list.append(m_list[j] - m_list[i])

for a in range(len(x_list)):
    if x_list[a] > num:
        count += 1

if count >= 1:
    print(":(")
else:
    print("Yay!")

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

Solution (Python):
a = []

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

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
ls=[a,b,c,d,e]
for i in range(len(ls)):
    for j in range(len(ls)-i):
        if ls[i] - ls[j] > k:
            print(':(')
            break
    else:
        continue
    break
else:
    print('Yay!')

Solution (Python):



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



flg = False

for i in range(5):
    
    
    for j in range(i + 1, 5):
        
        an = a[j] - a[i]
        
        if an <= a[5]:
            flg = False
        else:
            flg = True
            break
    
    if flg:
        break
    
if flg:
    print(":(")
else:
    print("Yay!")

Solution (Python):


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())


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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
long=0

towers=[a,b,c,d,e]
for n in towers:
    for m in towers:
        if m-n > k:
            long=1
            
if long==1:
    print(":(")
else:
    print("Yay!")

Solution (Python):
a = []
for _ in range(5):
    a.append(int(input()))

k = int(input())

if a[-1] - a[0] > k:
    print(':(')
else:
    print('Yay!')

Solution (Python):
num = []
for _ in range(6):
    num.append(int(input()))

f = 0
for i in range(5):
    if(num[i]-num[0]>num[5]):
        f = 1
for i in range(2,5):
    if(num[i]-num[1]>num[5]):
        f = 1

for i in range(3,5):
    if(num[i]-num[1]>num[5]):
        f = 1

for i in range(4,5):
    if(num[i]-num[1]>num[5]):
        f = 1

if(f == 0):
    print("Yay!")
else:
    print(":(")
"""
num[1]-num[0]
num[2]-num[0]
num[3]-num[0]
num[4]-num[0]

num[2]-num[1]
num[3]-num[1]
num[4]-num[1]

num[3]-num[2]
num[4]-num[2]

num[4]-num[3]
"""

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
q = int(input())
 
f=e-d
g=e-c
h=e-b
i=e-a
j=d-c
k=d-b
l=d-a
m=c-b
n=c-a
o=b-a

 
 
if f<=q and g<=q and h<=q and i<=q and j<=q and k<=q and l<=q and m<=q and n<=q and o<=q:
  print("Yay!")
 
else:
  print(":(")

Solution (Python):
import sys

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

flag = 0

if((b-a)>k or (c-a)>k or (d-a)>k or (e-a)>k or (c-b)>k or (d-b)>k or (e-b)>k or (d-c)>k or (e-c)>k or (e-d)>k):
  print(":(")
else:
  print("Yay!")

Solution (Python):
anten=[]
for i in range(5):
    anten.append(int(input()))
k=int(input())

flag=False
for i in range(5):
    for j in range(5-i-1):
        p=anten[i]
        q=anten[i+j+1]
        if q-p>k:
            flag=True
if flag:
    print(":(")
else:
    print("Yay!")

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

Solution (Python):
import sys
import itertools

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

for a, b in itertools.combinations(antennas, 2):
  if b - a > k:
    print(':(')
    sys.exit(0)
print('Yay!')

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

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

Solution (Python):
import sys
nyan = []

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

for j in range(5):
  for i in range(5):
    if (nyan[4-j] - nyan[i]) > nyan[5]:
      print(":(")
      sys.exit()
print("Yay!")

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

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

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

x = min(a, b, c, d, e)
y = max(a, b, c, d, e)
if (y - x) <= k:
    print('Yay!')
else:
    print(':(')

Solution (Python):
a = []
for i in range(6):
  a.append(int(input()))
  
f = 0
for i in range(5):
  for j in range(5):
    if j > i:
      if a[j] - a[i] > a[5]:
        f = 1

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

Solution (Python):
a=[int(input()) for _ in range(6)]
if a[4] - a[0] <= a[5]:
    print("Yay!")
else:
    print(":(")

Solution (Python):
an = []
for i in range(5):
    an.append(int(input()))
k=int(input())+1
if(an[4]-an[0]<k):
    print("Yay!")
else:
    print(":(")

Solution (Python):
import sys

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

coord = [a, b, c, d, e]
flag = False
for i in range(len(coord)):
    for j in range(len(coord)):
        dis = abs(coord[i] - coord[j])
        if dis > k :
            flag = True
if flag == True :
    print(":(")
else :
    print("Yay!")

Solution (Python):
a = list(range(5))
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())
k = int(input())
c = 0
for i in range(4):
    for j in range(1+i, 5):
        if(abs(a[i]-a[j])>k):
            c+=1
if(c>0):
    print(":(")
else:
    print("Yay!")

Solution (Python):
import sys

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

flag = 1
while(len(antennas) != 1):
    for i in range(len(antennas)-1):
        i += 1
        if antennas[i] - antennas[0] <= k:
            continue
        else:
            flag *= 0
            print(":(")
            sys.exit()
    antennas = antennas[1:]

if flag == 1:
    print('Yay!')

Solution (Python):
m_list=list(map(int, [input() for i in range(6)]))
flag=0

for i in range(5):
        for j in range(5):
                if abs(m_list[i]-m_list[j])>m_list[5]:
                        flag=1
        
        
if flag==1:
        print(":(")  
else:
        print("Yay!")

Solution (Python):
a = [int(input()) for i in range(5)]
k = int(input())

if(a[4]-a[0] > k):
    print(":(")
else:
    print("Yay!")

Solution (Python):
L = [int(input()) for i in range(len("abcde"))]
k = int(input())

for i in range(4):
    for j in range(i+1, 5):
        if abs(L[i] - L[j]) > k:
            print(":(")
            break
    else:
        continue
    break
else:
    print("Yay!")

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

Solution (Python):
import numpy as np

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())


if np.abs(a-b) <=k and np.abs(a-c) <= k and np.abs(a-d) <= k  and np.abs(a-e) <=k and np.abs(b-c)<=k and np.abs(b-d)<=k and np.abs(b-e)<=k and np.abs(c-d)<=k and np.abs(c-e)<=k and np.abs(d-e)<=k:
    print("Yay!")
else:
    print(":(")

Solution (Python):
a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
d = int(raw_input())
e = int(raw_input())
k = int(raw_input())

def an (a,b,c,d,e,k) :
  for i in {b,c,d,e} :
    if i-a>k :
      return ":("
  for i in {c,d,e} :
    if i-b>k :
      return ":("
  for i in {d,e} :
    if i-c>k :
      return":("
  for i in {e} :
    if i-d>k :
      return ":("
  return "Yay!"


ans = an(a,b,c,d,e,k)
print ans

Solution (Python):


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!")

Solution (Python):
a = int(input())
for i in range(3):
    _ = input()
e= int(input())
k = int(input())

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
num = [a,b,c,d,e]
count = 0
flg = True
for i in range(5):
    for j in range(i,5):
        if num[j] - num[i] > k:
            print(":(")
            flg = False
            break
    if not flg:
        break
else:
    print("Yay!")

Solution (Python):
import sys

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

for i in range(5):
    for j in range(i + 1, 5):
        distance = spots[j] - spots[i]
        if (distance > k):
            print(":(")
            sys.exit()

print("Yay!")

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

Solution (Python):


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

b = int(input())

c = 0
count = 0


for i in a:
    for j in a:
        c = j - i

        if c > b:
            count += 1

if count >= 1:
    print(':(')
else:
    print('Yay!')

Solution (Python):
import sys
antenna_points = []
for i in range(5):
    antenna_points.append(int(input()))

k = int(input())

for i in range(5):
    for j in range(5):
        if antenna_points[j] - antenna_points[i] > k:
            print(":(")
            sys.exit()
print("Yay!")

Solution (Python):
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!')

Solution (Python):
num = []

for k in range(5):
  num.append(int(input()))

k = int(input())

bool = True

for i in range(4,0,-1):
  for j in range(i):
    if (num[i] - num[j]) > k:
      bool = False
    else:
      continue
    break
    
if bool:
  print("Yay!")
else:
  print(":(")

Solution (Python):
d=[]
for i in range(5):
    a=int(input())
    d.append(a)
k=int(input())
print("Yay!" if k>=d[-1]-d[0] else ":(")

Solution (Python):
temp = []

a = int(input())
temp.append(a)
b = int(input())
temp.append(b)
c = int(input())
temp.append(c)
d = int(input())
temp.append(d)
e = int(input())
temp.append(e)
k = int(input())
ans = 'Yay!'
for i in range(len(temp)):
    if i==len(temp):
        break
    for j in range(len(temp)):
        if j==len(temp):
            break       
        if i==j:
            continue
        if i>j:
            if temp[i]-temp[j]>k:
                ans = ':('
                break
        else:
            if temp[j]-temp[i]>k:
                ans = ':('
                break

print(ans)

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

Solution (Python):
list = [int(input()) for i in range(5)]
k = int(input())
n = 1
def calc(list):
  for i in range(0,4):
    for j in range(1,5):
      if list[j]-list[i] >k:
        return ':('
      else:
        continue
  return 'Yay!'
 
print(calc(list))

Solution (Python):
y = [int(input()) for _ in range(5)]
k = int(input())
if y[4] - y[0] > k:
	print(":(")
	exit(0)
for i in range(4):
	if y[i + 1] - y[i] > k:
		print(":(")
		exit(0)
print("Yay!")

Solution (Python):
import sys
 
arr=[int(input()) for i in range(5)]
k=int(input())
 
for i in range(len(arr)):
    for j in range(len(arr)-i-1):
        if abs(arr[i] - arr[i+j+1]) > k:
            print(":(")
            sys.exit()
 
print("Yay!")

Solution (Python):
args = {}
l = ["a", "b", "c", "d", "e", "k"]
for i in range(len(l)):
    args[l[i]] = int(input())
for i in range(len(l) - 1):
    j = 5-i
    for m in range(len(l) - 2):
        n = j - (m+1)
        if n <= 0:
            continue
        if args[l[j-1]] - args[l[n-1]] > args["k"]:
            print(':(')
            exit()
print("Yay!")

Solution (Python):


coord = []
for i in range(5):
    coord.append(int(input()))

k = int(input())


if coord[4] - coord[0] > k:
    print(':(')
else:
    print('Yay!')

Solution (Python):
from collections import Counter
from functools import reduce
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  
def LF(): return [float(x) for x in sys.stdin.readline().split()]  
def LS(): return sys.stdin.readline().split()  
def MI(): return map(int, sys.stdin.readline().split())  
def II(): return int(sys.stdin.readline())  
def IS(): return input()  
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))





    
    

a = II()
b = II()
c = II()
d = II()
e = II()
k = II()
list = sorted([a,b,c,d,e])[::-1]
for i in range(len(list)):
    for j in range(i+1,len(list)):
        if list[i] - list[j] > k:
            print(':(')
            exit()
print('Yay!')

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

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

Solution (Python):
import math
import sys

antenas = []
for i in range(5):
    antenas.append(int(input()))
k = int(input())

for f in antenas:
    for d in antenas:
        if abs(f-d) > k:
            print(":(")
            sys.exit(0)

print("Yay!")

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



if b-a > k:
    print(':(')
elif c -b > k:
    print(':(')
elif d -c > k:
    print(':(')
elif e -d > k:
    print(':(')
elif c -a > k:
    print(':(')
elif d -a > k:
    print(':(')
elif d -b > k:
    print(':(')
elif e -a > k:
    print(':(')
elif e -b > k:
    print(':(')
elif e -c > k:
    print(':(')   
else:
    print('Yay!')

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

lst = [a,b,c,d,e]
lst.sort()

M=max(lst)
m=min(lst)
if M-m<=k:
  print("Yay!")
else:
  print(":(")

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

s = [b-a, c-a,d-a,e-a,b-c,b-d,b-e,d-c,d-e,e-d]
ans = "Yay!"
for ss in s:
  if ss > k:
    ans = ":("
print(ans)

Solution (Python):
all_list = [int(input()) for _ in range(5)]
k = int(input())
count = 0
for i in range(5):
    for j in range(i+1,5):
        result = abs(all_list[i] - all_list[j])
        if k < result:
            count += 1
if count == 0:
    print('Yay!')
else:
    print(':(')

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
s=[a,b,c,d,e]
f=e-a
if(f<=k):
    print('Yay!')
else:
    print(':(')

Solution (Python):
import sys


def main():
    inp = [int(line)  for line in sys.stdin.readlines()]
    k = inp.pop(len(inp) - 1)
    
    

    if max(inp) - min(inp) > k:
        print(":(")
    else:
        print("Yay!")

if __name__ == '__main__':
    sys.exit(main())

Solution (Python):
a=[int(input()) for i in range(6)]
if a[4]-a[0]>a[5]:
	print(':(')
else:
	print('Yay!')

Solution (Python):
error_flag = 0;                                                     
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if b-a>k:error_flag=1
if c-a>k:error_flag=1
if d-a>k:    error_flag=1
if e-a>k:error_flag=1
if c-b>k:error_flag=1
if d-b>k:error_flag=1
if e-b>k:error_flag=1
if d-c>k:error_flag=1
if e-c>k:error_flag=1
if e-d>k:error_flag=1

if error_flag == 0:
    print('Yay!')
else:
    print(':(')

Solution (Python):
A = [int(input()) for _ in range(5)]
k = int(input())
for i in range(4):
  if (max(A) - min(A) > k):
    print(':(')
    exit()

print('Yay!')

Solution (Python):
hoge = [int(input()) for _ in range(6)]

i=0
j=0
flag=0

for i in range(len(hoge)-2):
    for j in range(len(hoge)-1):
        if hoge[j]-hoge[i] > hoge[-1]:
            flag = 1



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

Solution (Python):
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!')

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

ba = b - a
ca = c - a
da = d - a
ea = e - a
cb = c - b
db = d - b
eb = e - b
dc = d - c
ec = e - c
ed = e - d

if ba > k or ca > k or da > k or ea > k or cb > k or db > k or eb > k or dc > k or ec > k or ed > k:
    print(':(')
else:
    print('Yay!')

Solution (Python):
import itertools

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

A = [a, b, c, d, e]
ans = 'Yay!'
for i, j in itertools.combinations(A, 2):
    if abs(i - j) > k:
        ans = ':('
        
print(ans)

Solution (Python):
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!")

Solution (Python):
s = [0] *5
for i in range(5):
    s[i] = int(input())

k = int(input())

b = True
for i in range(4):
    for j in range(4-i):
        
        if s[i+j+1]-s[i] > k:
            b = False
            break

if b:
    print("Yay!")
else:
    print(":(")

Solution (Python):
def main ():
    antennas= []
    max     = 0
    for i in range(6):
        if i < 5:
            antennas.append(int(input()))
        else:
            max = int(input())
    print (distance_comparison(max,antennas))

def distance_comparison(max,antennas):
    memo = []
    for i in range(len(antennas)):
        compnum = i+1
        for j in range(len(antennas[compnum:])):
            append_data = abs(antennas[i] - antennas[compnum])
            if append_data <= max:
                memo.append(append_data)
            else:
                return ":("
            compnum+=1
    return "Yay!"


main()

Solution (Python):
from sys import stdin

antennas = [int(stdin.readline().rstrip()) for _ in range(5)]
k = int(stdin.readline().rstrip())
farest = antennas[4]

print(':(' if any(farest - antenna > k for antenna in antennas) else 'Yay!')

Solution (Python):
import numpy as np

points = np.array([int(input()) for _ in range(5)])
thr = int(input())
diff = (points[4] - points[0])
if diff <= thr:
    print('Yay!')
else:
    print(':(')

Solution (Python):


antennas = []
antennas.append(int(input()))
antennas.append(int(input()))
antennas.append(int(input()))
antennas.append(int(input()))
antennas.append(int(input()))
k = int(input())

antennas = sorted(antennas)
if antennas[4] - antennas[0] > k:
    print(':(')
else:
    print('Yay!')

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

antenas = [a, b, c, d, e, k]
ans_str = 'Yay!'
for i in range(len(antenas)-1):
    ans = 0
    for j in range(len(antenas)-i-1):
        ans = antenas[i]-antenas[i+j+1]
        if ans < -1:
            ans *= -1
        if ans > k:
            ans_str = ':('
            break
    if ans > k:
        ans_str = ':('
        break

            
    

print(ans_str)

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

min = min([a,b,c,d,e], key=int)
max = max([a,b,c,d,e], key=int)

if (max - min) > k:
    print(":(")
else:
    print("Yay!")

Solution (Python):
l=[int(input()) for i in range(5)]
flag=False
k=int(input())
for i in range(len(l)):
    for j in range(i+1,len(l)):
        if(l[j]-l[i]<=k):
            flag=True
        else:
            flag=False
            break
    if(not flag):
        break
if(not flag):
    print(":(")
else:
    print('Yay!')

Solution (Python):

antena = []
for i in range(5):
    antena.append(int(input()))
k = int(input())
ans = False

for i in range(5):
    for j in range(5):
        if antena[i] - antena[j] > k:
            ans = True
            break

if ans == True:
    print(':(')
else:
    print('Yay!')

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
arr = [a,b,c,d,e]
bool = True

for i in range(len(arr)):
  for j in range(len(arr)):
    if i != j and abs(arr[i] - arr[j]) > k:
      bool = False
      break;
      
if bool:
  print("Yay!")
else:
  print(":(")

Solution (Python):
i = [int(input()) for i in range(6)]
temp = 0
if i[4] - i[3] > i[5]:
  temp += 1
if i[4] - i[2] > i[5]:
  temp += 1
if i[4] - i[1] > i[5]:
  temp += 1
if i[4] - i[0] > i[5]:
  temp += 1
if i[3] - i[2] > i[5]:
  temp += 1
if i[3] - i[1] > i[5]:
  temp += 1
if i[3] - i[0] > i[5]:
  temp += 1
if i[2] - i[1] > i[5]:
  temp += 1
if i[2] - i[0] > i[5]:
  temp += 1  
if i[1] - i[0] > i[5]:
  temp += 1  
if temp != 0:
  print(':(')
else:
  print('Yay!')

Solution (Python):
input_list = [int(input()) for _ in range(6)]

poles = input_list[:-1]
k = input_list[-1]

if poles[-1] - poles[0] > k:
  print(':(')
else:
  print('Yay!')

Solution (Python):

listA = []
while True:
    try:
        listA.append(int(raw_input()))
    except:
        break;

a = listA[0]
b = listA[1]
c = listA[2]
d = listA[3]
e = listA[4]
k = listA[5]

if (b-a <= k) and (c-a <= k) and (d-a <= k) and (e-a <= k) \
   and (c-b <= k) and (d-b <= k) and (e-b <= k) \
   and (e-c <= k) and (d-c <= k) \
   and (e-d <= k):
    print 'Yay!'
else:
    print ':('

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

Solution (Python):
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!')

Solution (Python):


import re

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

count = 0
for i in range(5):
    for j in range(i+1,5):
        if(a[j] - a[i] > a[5]):
            count += 1
        else:
            pass
if(count == 0):
    print("Yay!")
else:
    print(":(")

Solution (Python):

li2 = []
cnt = 1
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a,b,c,d,e]
k = int(input())
for y in li:
    li2.append(y-a)
    li2.append(y-b)
    li2.append(y-c)
    li2.append(y-d)
    li2.append(y-e)


for x in li2:
    if x < 0:
        x = -x
    if x > k:
        cnt = 1
        break
        
    else:
         cnt = 0
if cnt == 0:
    print("Yay!")
else:
    print(":(")

Solution (Python):
li =[int(input()) for i in range(6)]
isexist=False

for i in range(5):
    j=5
    while j>i:
        if (li[j]-li[i])>li[5]:
            isexist=True
        j-=1

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

Solution (Python):
abcde = list()
ans = "Yay!"
flag = True
for i in range(6):
    abcde.append(int(input()))

for i in range(5):
    for j in range(5):
        if abs(abcde[i] - abcde[j]) > abcde[5]:
            ans = ":("
            flag = False
            break
    if flag != True: break
print(ans)

Solution (Python):
import itertools

if __name__ == '__main__':
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    k = int(input())

    position = [a, b, c, d, e]
    test_cases = list(itertools.combinations(position, 2))

    is_all_communication_possible = True

    for e in test_cases:
        position1 = e[0]
        position2 = e[1]

        if position2 - position1 > k:
            is_all_communication_possible = False

    if is_all_communication_possible:
        print("Yay!")
    else:
        print(":(")

Solution (Python):
A=[]
for i in range(6):
    a=int(input())
    A.append(a)    

for i in range(4):
    if A[4]-A[0]>A[5]:
        print(":(")
        exit()


print("Yay!")

Solution (Python):
ant = []
for i in range(5):
    ant.append(int(input()))

k = int(input())

if ant[4] - ant[0] > k:
    print(":(")
else:
    print("Yay!")

Solution (Python):
l = []
for i in range(5):
  l.append(int(input()))
  
k = int(input())

flag = False

for p in l:
  for q in l:
    if abs(p-q) > k:
      flag = True

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

Solution (Python):
import sys
nums = [int(input()) for _ in range(5)]
k = int(input())
for i in nums:
  for j in nums:
    if abs(i-j) > k:
      print(":(")
      sys.exit()
print("Yay!")

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

v = []
for i in range(6):
    v.append(I())
k = v.pop()

if v[-1] - v[0] <= k:
    print('Yay!')
else:
    print(':(')

Solution (Python):

y = "Yay!"
n = ":("
a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
d = int(input().strip())
e = int(input().strip())
k = int(input().strip())

if abs(a - e) > k:
        ans = n
else:
        ans = y
print(ans)