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):
import itertools

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

for v in itertools.combinations(a, 2):
  if v[1] - v[0] > k:
    flag = False

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

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

K = int(input())

for i in range(5):
    for j in range(i, 5):
        if lis[j]-lis[i] > K:
            print(":(")
            exit()

print("Yay!")

Solution (Python):
stdin=open(0).read().split('\n')
k = int(stdin[5])
flag=True
for i in range(1,5):
    for j in range(i-1):
        if int(stdin[i])-int(stdin[j])>k:flag=False
print('Yay!' if flag else ':(')

Solution (Python):
a,*_,e,k=(int(input())for _ in[0]*6);print('Y:a(y !'[e-a>k::2])

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

Solution (Python):


import numpy as np
a = [0] * 5
for i in range(5):
    a[i] = int(input())
k = int(input())
a = np.array(a)
print(":(" if np.sum(abs(np.subtract.outer(a, a)) > k) > 0 else "Yay!")

Solution (Python):
array = []
for _ in range(6):
  array.append(int(input()))
if max(array) - min(array) > array[5]:
  print(':(')
else:
  print('Yay!')

Solution (Python):
l = [] 
for i in range(5):
  l.append(int(input()))
k = int(input())
l.sort()
if l[4] - l[0] <= k:
  print('Yay!')
else:
  print(':(')

Solution (Python):
import sys
a =[0] * 5
for i in range(5):
    a[i] = int(input())
k =int(input())
for i in range(4):
    for j in range(i+1,5):
        if a[j] -a[i] > k:
            print(':(')
            sys.exit()
print('Yay!')

Solution (Python):
anntena = [0]*5
for i in range(5):
    anntena[i] = int(input())
k = int(input())
flag = True
for i in range(4):
    for j in range(i, 5):
        if abs(anntena[i]-anntena[j]) > k:
            flag = False
            break
    else:
        continue
    break
if flag:
    print("Yay!")
else:
    print(":(")

Solution (Python):


_list = [None]*5
for i in range(5):
    _list[i] = int(input())
k = int(input())

for i in _list:
    for j in _list:
        if i != j:
            if abs(i-j) > k:
                print(":(")
                exit()
print("Yay!")

Solution (Python):
Z = [int(input()) for _ in range(5)]
k = int(input())

ans = 'Yay!'
for i in range(4):
    for j in range(i, 5):
        if Z[j] - Z[i] > k:
            ans = ':('
            break
    else:
        continue
    break
print(ans)

Solution (Python):
l = [int(input()) for _ in range(6)]
f = True
if abs(l[0] - l[1]) > l[5] or abs(l[0] - l[2]) > l[5] or abs(l[0] - l[3]) > l[5] or abs(l[0] - l[4]) > l[5]:
    f = False
elif abs(l[1] - l[2]) > l[5] or abs(l[1] - l[3]) > l[5] or abs(l[1] - l[4]) > l[5]:
    f = False
elif abs(l[2] - l[3]) > l[5] or abs(l[2] - l[4]) > l[5]:
    f = False
elif abs(l[3] - l[4]) > l[5]:
    f = False
print('Yay!' if f else ':(')

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

if   ant[1] - ant[0] > k: print(":(")
elif ant[2] - ant[0] > k: print(":(")
elif ant[3] - ant[0] > k: print(":(")
elif ant[4] - ant[0] > k: print(":(")
elif ant[2] - ant[1] > k: print(":(")
elif ant[3] - ant[1] > k: print(":(")
elif ant[4] - ant[1] > k: print(":(")
elif ant[3] - ant[2] > k: print(":(")
elif ant[4] - ant[2] > k: print(":(")
elif ant[4] - ant[3] > 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())

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

Solution (Python):
p = [int(input()) for _ in range(5)]
k = int(input())

for i in range(5):
    for j in range(i,5):
        if(abs(p[i] - p[j]) > k):
            print(":(")
            exit()
print('Yay!')

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

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

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

Solution (Python):
l=list(int(input()) for _ in range(5))
print("Yay!" if max(l)-min(l)<=int(input()) else ":(")

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

flag=0
for i in range(4):
    for j in range(i+1, 5):
        d=a[j]-a[i]
        if d > k:
            flag=1

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

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

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

Solution (Python):
coords = [int(input()) for _ in range(5)]
coords.sort()
k = int(input())
if coords[-1] - coords[0] > k:
    print(':(')
else:
    print('Yay!')

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

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

Solution (Python):
a,b,c,d,e,k=[int(input()) for i in range(6)]
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())
ab = b-a
ac = c-a
ad = d-a
ae = e-a
bc = c-b
bd = d-b
be = e-b
cd = d-c
ce = e-c
de = e-d
if ab <= k and ac <= k and ad <= k and ae <= k and bc <= k and bd <= k and be <= k and cd <= k and ce <= k and de <= k:
    print("Yay!")
else:
    print(":(")

Solution (Python):
def five_antennas(li, k):

    return "Yay!" if max(li)-min(li) <= k else ":("
def main():
    li = [int(input())for i in range(5)]
    k = int(input())
    print(five_antennas(li, k))

if __name__ == '__main__':
    main()

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

for v in itertools.combinations([a, b, c, d, e], 2):
    if (v[1]-v[0]) > k:
        print(':(')
        exit()

print('Yay!')

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

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

maxdist = max(a, b, c, d, e)
mindist = min(a, b, c, d, e)

if maxdist - mindist <= k:
    print('Yay!')
else:
    print(':(')

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

Solution (Python):
A = [int(input())for _ in range(5)]
k = int(input())
for a in A:
    for b in A[1:]:
        if abs(a - b) > k:
            print(":(")
            exit()
print("Yay!")

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

frag = True
if max(a_list) - min(a_list) > k:
  frag = False
    
if frag == True:
  print("Yay!")
else:
  print(":(")

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

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

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

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

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

Solution (Python):
x=[int(input()) for i in range(5)]
k=int(input())
if x[-1]-x[0]<=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 abs(e-a)<=k:
  print('Yay!')
else:
  print(':(')

Solution (Python):
arr = [int(input()) for _ in range(5)]
k = int(input())

can = True
for i in range(5):
  for j in range(i+1,5):
    if abs(arr[i] - arr[j]) > k:
      can = False
      break
  if not can:break
    
if can:print('Yay!')
else:print(':(')

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

Solution (Python):

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

for i in range(5):
  for j in range(i+1,5):
    if abs(a[i] - a[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 e-a<=k:
    print('Yay!')
else:
    print(':(')

Solution (Python):


ma = 0
mi = 124

for _ in range(5):
    a = int(input())
    ma = max(a, ma)
    mi = min(a, mi)

k = int(input())

if ma-mi<=k:
    print('Yay!')
else:
    print(':(')

Solution (Python):
a=[int(input()) for i in range(6)]
for i in range(5):
    for j in range(i+1,5):
        if a[j]-a[i]>a[5]:
            print(":(")
            exit()
print("Yay!")

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

k=int(input())

if k<lis[4]-lis[0]:
  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('Yay!')
else:
  print(':(')

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
x = [a, b, c, d, e]
k = int(input())
count = 0
for i in range(0, 5):
  for j in range(0, 5):
    if int(x[i]) > int(x[j]):
      q = int(x[i]) - int(x[j])
      if q > k:
        count = 1
    elif int(x[i]) < int(x[j]):
      p = int(x[j]) - int(x[i])
      if p > k:
        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())
m = 0
m = max(m, b-a)
m = max(m, c-a)
m = max(m, d-a)
m = max(m, e-a)
m = max(m, c-b)
m = max(m, d-b)
m = max(m, e-b)
m = max(m, d-c)
m = max(m, e-c)
m = max(m, e-d)
if m > 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())
for v in itertools.combinations([a,b,c,d,e], 2):
    if v[1]-v[0] > k:
        print(':(')
        exit()

print('Yay!')

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
l=[a,b,c,d,e]
if max(l)-min(l)>k:
    print(':(')
else:
    print('Yay!')

Solution (Python):


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

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]
list.sort(reverse=True)

if list[0]-list[4]<=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())

points = [a, b, c, d, e]
result = []
for point1 in points:
    for point2 in points:
        kyori = point2 - point1
        if kyori > k:
            result.append(True)
        else:
            result.append(False)
if True in result:
    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('Yay!')
else:
    print(':(')

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

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

Solution (Python):
a = [int(input()) for _ in range(6)]
la = len(a)
cnt= 0
for i in range(la-1):
    for j in range(i+1,la):
        if a[j]-a[i]<=a[5]:
            cnt+=1
        else:
            print(':(')
            break
    else:
        continue
    break
else:
    print('Yay!')

Solution (Python):
def resolve():
    l=[int(input()) for i in range(5)]
    k=int(input())
    ans='Yay!'
    for i in range(5):
        for j in range(5):
            if abs(l[i]-l[j])>k:
                ans=':('
    print(ans)
resolve()

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

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

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

Solution (Python):
def main():
    p = [int(input()) for i in range(5)]
    k = int(input())
    com_flag = True
    for i in range(5-1):
        for j in range(i+1, 5):
            if p[j] - p[i] > k:
                com_flag = False
    if com_flag:
        print("Yay!")
    else:
        print(":(")
if __name__ == "__main__":
    main()

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

k = int(input())
per = True
for i in range(len(ant)):
    for j in range(i, len(ant)):
        if abs(ant[i] - ant[j]) > k:
            per = False
            break

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

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

Solution (Python):
aaa = [int(input()) for i in range(6)]
 
ans = "Yay!"

j = aaa[4] - aaa[0]

if j > aaa[5]:
  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('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):


def main():
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    k = int(input())
    ok = True
    if (e - a > k):
        ok = False
    print("Yay!" if ok else ":(")

if __name__ == "__main__":
    main()

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

for i in range(4):
  for j in range(i,5):
    if city[j] - city[i] > city[5]:
      print(':(')
      exit()
print('Yay!')

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

flag = 0
for i in range(5):
    if flag:
        break
    for j in range(5):
        if abs(A[i] - A[j]) > k:
            print(':(')
            flag = 1
            break
        else:
            continue
else:
    print('Yay!')

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

l = [INT() for _ in range(5)]
k = INT()

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

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

    a = [int(input()) for _ in range(5)]
    k = int(input())
    if a[-1]-a[0] > k:
        print(':(')
    else:
        print('Yay!')

if __name__ == '__main__':
    main()

Solution (Python):
import itertools

l = list()
for a in range(0, 5):
    l.append(int(input()))

k = int(input())

com = list(itertools.combinations(l, 2))

for a in range(0, len(com)):
    com[a] = list(com[a])
    com[a] = abs(com[a][0] - com[a][1])

ans = 'Yay!'

for a in com:
    if a > k:
        ans = ':('
        break

print(ans)

Solution (Python):
l=[]
for i in range(6):
    l.append(int(input()))
m = sorted(l[0:5])
if m[4]-m[0]<=l[5]:
    print("Yay!")
else:
    print(":(")

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

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):
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):
data = [int(input()) for i in range(5)]
k = int(input())
flag = True
for i in range(len(data)-1):
    for j in range(i, len(data)):
        if data[j]-data[i] > k:
            flag = False

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

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

if (max(l)-min(l)) > 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 e-a>k:
  print(":(")
elif e-a<=k:
  print("Yay!")

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    a = IR(5)
    k = II()
    if max(a) - min(a) > k:
        print(":(")
    else:
        print("Yay!")
    return


def B():
    a = IR(5)
    b = a[0]
    ans = 0
    for a_ in a:
        if a_ % 10 != 0:
            if b % 10> a_ % 10:
                b = a_
    flg = 0
    for a_ in a:
        if a_ != b or flg:
            ans += math.ceil(a_ / 10) * 10
        else:
            ans += b
            flg = 1
    print(ans)
            
    
    return


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    A()

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 = list(int(input()) for _  in range(5))
k = int(input())
ans='Yay!'
for i in a:
  for j in range(len(a)):
    if a[j] - i >k:
      ans = ':('
print(ans)

Solution (Python):
a = [int(input()) for _ in range(6)]
for i in range(4):
    for j in range(i+1, 5):
        if abs(a[i]-a[j]) > a[5]:
            print(":(")
            exit()
print("Yay!")

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

for i in range(len(a)-1):
    for j in range(i+1, len(a)):
        if a[j] - a[i] > 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 max(a,b,c,d,e) - min(a,b,c,d,e) > 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 e - a > k:
    print(":(")
else:
    print("Yay!")

Solution (Python):
l = []
for i in range(5):
    x = int(input())
    l.append(x)
s = int(input())
if l[-1]-l[0]<=s:
    print("Yay!")
else:print(":(")

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

max_distance = e - a
can_communicate = max_distance <= k

answer = ':(' if not can_communicate else 'Yay!'
print(answer)

Solution (Python):
for i in range(5):
    if i == 0:
        a = int(input())
    elif i == 4:
        e = int(input())
    else:
        tmp = int(input())
k = int(input())
if e-a <= 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())

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

for i in range(4):
	for j in range(i+1,5):
		if l[j] - l[i] > k:
			print(':(')
			sys.exit()
print('Yay!')

Solution (Python):
A = [int(input()) for _ in range(5)]
k = int(input())
if max(A) - min(A) <= k:
    print('Yay!')
else:
    print(':(')

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

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

Solution (Python):

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A = [ir() for _ in range(5)]
K = ir()
length = A[-1] - A[0]
bl = length <= K
print('Yay!' if bl else ':(')

Solution (Python):

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A = [0] * 5
for i in range(5):
    A[i] = ir()

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

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):
D = []
for i in range (5):
  D.append(int(input()))
D.reverse()
k = int(input())

for i in range(len(D) - 1):
  for j in range(i + 1, len(D)):
    if D[i] - D[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 e-a > k or b-a > k:
  print(":(")
else:
  print("Yay!")

Solution (Python):

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

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

Solution (Python):
a=int(input())
for i in range(3):
  z=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 (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):
p = [int(input()) for i in range(5)]
k = int(input())
if p[4]-p[0]<=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 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, b, c, d, e, k = [int(input()) for i in range(6)]
print('Yay!') if e - a <= k else print(':(')

Solution (Python):

l = []
for _ in range(5):
    l.append(int(input()))
k = int(input())
for i in range(5):
    for j in range(i, 5):
        if l[j] - l[i] > k:
            print(":(")
            exit()
print("Yay!")

Solution (Python):
west=124
east=-1
for _ in range(5):
    x=int(input())
    west=min(x,west)
    east=max(x,east)
k=int(input())
if east-west>k:
    print(":(")
else:
    print("Yay!")

Solution (Python):
icase=0
if icase==0:
    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())

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


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

Solution (Python):
x = []
count = 0
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
k = int(input())
for i in range(len(x)):
     for j in range(i, len(x)):
          if abs(x[i] - x[j]) <= k:
               count += 0
          else:
               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())

v=e-a

if v <=k:
  print('Yay!')
else:
  print(':(')

Solution (Python):
numbers = []
for _ in range(6):
    numbers.append(int(input()))
predicted_value = "Yay!"
k_distance = numbers[-1]
antenas = numbers[:-1]
antenas.sort()
if antenas[-1] - antenas[0] > k_distance:
    predicted_value = ":("
print(predicted_value)

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

Solution (Python):
import sys
import itertools
l = [int(x) for x in sys.stdin.readlines()]
k = l[-1]
del l[-1]
pairs = list(itertools.combinations(l, 2))
flag = 0
for pair in pairs:
    if not max(pair) - min(pair) <= k:
        print(":(")
        flag += 1
        break
if not flag:
    print("Yay!")

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

ans= True
for i in range(len(lista)-1):
	for j in range(len(lista)-1):
		if (lista[i]-lista[j] > lista[-1]):
			ans = False	
if(ans):
	print("Yay!")
else:
	print(":(")

Solution (Python):
import math
lista = []
for x in range(0,5):
    lista.append(int(input()))
distanciaMaxima = int(input())
passou = 0
for x in range(len(lista)):
    for y in range(x,len(lista)):
        if abs(lista[x] - lista[y]) > distanciaMaxima:
            passou = 1
if passou == 0:
    print("Yay!")
elif passou == 1:
    print(":(")

Solution (Python):
t=4
v = []
while t>=0:
    v.append(int(input()))
    t = t-1

k = int(input())
n = 4
l = False
while n>=0:
    for i in range(n-1):   
        soma = v[n] - v[i]
        if soma > k:
            print(":(") 
            l = True
            break
    if l:
        n = -2
    else: 
        n = n-1
if n == -1:  
    print("Yay!")

Solution (Python):
def funcao(lista, reverse, k):
    for i in lista:
        for j in reverse:
            if abs(i-j) > k:
                return ":("
    return "Yay!"


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

lista.sort()
reverse = []
reverse = lista.copy()
reverse.reverse()

print(funcao(lista, reverse, k))

Solution (Python):
dist=[]
for x in range(0,5):
    dist.append(int(input()))
k=int(input())
sub=[]
for var1 in dist:
    for var2 in dist:
        if var1!=var2:
            sub.append(var2-var1)
max=max(sub)

if max<=k:
    print('Yay!')
else:
    print(':(')

Solution (Python):
a, b, c, d, e, k = int(input()), int(input()), int(input()), int(input()), int(input()), int(input())
distancies = {
    "a_b": b - a,
    "a_c": c - a,
    "a_d": d - a,
    "a_e": e - a,
    "b_c": c - b,
    "b_d": d - b,
    "b_e": e - b,
    "c_d": d - c,
    "c_e": e - c,
    "d_e": e - d
}
print("Yay!") if all(v <= k for v in distancies.values()) else print(":(")

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
sub=[]
sub.append(b-a)
sub.append(c-a)
sub.append(d-a)
sub.append(e-a)
sub.append(c-b)
sub.append(d-b)
sub.append(e-b)
sub.append(d-c)
sub.append(e-c)
sub.append(e-d)
max=max(sub)
if max<=k:
    print('Yay!')
else:
    print(':(')

Solution (Python):
v = []
e = ''
for i in range(6):
    v.append(int(input()))

for i in range(len(v)) :
    for j in range(i+1, len(v)):
        if(abs(v[i] - v[j]) > v[-1]):
            e = ':('

if e != '':
    print(e)
else:
    print('Yay!')

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

if(inp[-1]-inp[0]<=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())

antenas=[a,b,c,d,e]
teste = 1

for i in range(len(antenas)):
    for j in range(len(antenas)):
        if antenas[j]-antenas[i] > k:
            teste = 0
            break
if teste:
    print("Yay!")
else:
    print(":(")

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

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

ok = False
for i in xs:
    for j in xs:
        if max(i, j) - min(i, j) > k:
            ok = True

print(':(') if ok else 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 ":(")