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 sys


atoe = []
for i in range(5):
    atoe.append(int(sys.stdin.readline()))

k = int(sys.stdin.readline())

flag = 0
for i in range(5):
    for j in range(4):
        if abs(atoe[i] - atoe[j+1]) <= k:
            continue
        else:
            flag = 1

if flag > 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())
k = int(input())

max_distance = e-a

if max_distance <= k:
  print("Yay!")
else:
  print(":(")

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

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

Solution (Python):
a = [int(input()) for _ in range(5)]
k = int(input())
count = 0
for i in a:
    for j in a:
        if abs(i - j) <= k:
            continue
        else :
            print(":(")
            exit()
else:
    print("Yay!")

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
A=[0,0,0,0,0,0,0,0,0,0]
B=0
A[0]=a-b
A[1]=a-c
A[2]=a-d
A[3]=a-e
A[4]=b-c
A[5]=b-d
A[6]=b-e
A[7]=c-d
A[8]=c-e
A[9]=d-e
for i in range(10):
  if A[i]<=k and A[i]>=(k*(-1)):
    B=B+1
if B==10:
  print("Yay!")
else:
  print(":(")

Solution (Python):
n = 5
list=[int(input()) for i in range(n)]
p = int(input())
max = 0
a = 0
for i in range(n):
  for j in range(n):
    a = abs(list[i] - list[j])
    if a > max:
      max = a
      
if max <= p:
  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(a - e) > k:
    print(":(")
else:
    print("Yay!")

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

Solution (Python):


def a():
    A = int(raw_input())
    B = int(raw_input())
    C = int(raw_input())
    D = int(raw_input())
    E = int(raw_input())
    K = int(raw_input())

    flag = True

    if B-A > K:
        flag = False
    elif C-A>K:
        flag = False
    elif D-A>K:
        flag = False
    elif E-A > K:
        flag = False
    elif C-B > K:
        flag =False
    elif D-B > K:
        flag = False
    elif E-B > K:
        flag =False
    elif D-C > K:
        flag = False
    elif E-C > K:
        flag = False
    elif E-D > K:
        flag = False


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


def main():
    a()
	
if __name__ == '__main__':
    main()

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):
N = 5

A = [int(input()) for i in range(N)]
k = int(input())

ans = "Yay!"
for i in range(N):
    for j in range(i, N):
        if (A[j] - A[i] > k):
            ans = ":("
print(ans)

Solution (Python):
from sys import stdin
import math





x = []
for i in range(6):
  x.append(int(stdin.readline().rstrip().split()[0]))
  
kyori = x[4] - x[0]
k = x[5]
if k >= kyori:
  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())
list1 = [a, b, c, d, e]
for i in range(0, 5):
    for j in range(0, 5):
        if abs(list1[i] - list1[j]) > k:
            print("{}".format(":("))
            sys.exit()

print("{}".format("Yay!"))

Solution (Python):



t=[]
for i in range(5):
    t.append(int(input()))
n = int(input())
flag = True
for i in range(5):
    for j in range(5-i-1):
        if abs(t[i]-t[j+i+1]) >n:
            flag =False
            break
if not flag:
    print(":(")
else:
    print("Yay!")

Solution (Python):
antenna=[]
for _ in [0]*5:
    antenna.append(int(input()))
k=int(input())
if antenna[4]- antenna[0]<=k:
    print("Yay!")
else:
    print(":(")

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

Solution (Python):


def solve():
    city = []
    city.append(int(input()))
    city.append(int(input()))
    city.append(int(input()))
    city.append(int(input()))
    city.append(int(input()))
    k = int(input())

    for i in range(0, len(city)):
        for j in range(i+1, len(city)):
            if abs(city[i]-city[j]) > k:
                print(":(")
                exit()
    
    print("Yay!")

if __name__ == "__main__":
    solve()

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

aerials = [a,b,c,d,e]
maxA = max(aerials)
minA = min(aerials)

print(":(" if k < maxA-minA else "Yay!")

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

for a in A:
  c = k + a
  for a in A:
    if c < a:
      print(':(')
      exit()
print('Yay!')

Solution (Python):
def read():
    antennas = [0] * 5
    for i in range(5):
        antennas[i] = int(input().strip())
    k = int(input().strip())
    return antennas, k


def solve(antennas, k):
    for i in range(0, 5):
        for j in range(0, i):
            if antennas[i] - antennas[j] > k:
                return ':('
    return 'Yay!'


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))

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("Yay!")
else:
  print(":(")

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

    k = int(input())

    for i in range(5):
        for j in range(5):
            if abs(l[j] - l[i]) > k:
                return ':('
    return 'Yay!'



def main():
    print(answer())


if __name__ == '__main__':
    main()

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

Solution (Python):
import sys
input = sys.stdin.readline
a=[None]*5
for i in range(5):
    a[i] = int(input())
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(":(")
else:
    print("Yay!")

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

k=int(input())

output='Yay!'

for i in range(5):
  for l in range(i+1,5):
    if abs(D[i]-D[l]) > k:
      output=':('

print(output)

Solution (Python):
a = []
while True:
    try:
        a.append(int(input()))
    except:
        break

if a[len(a)-2] - a[0]> a[-1]:
    print(":(")
else:
    print("Yay!")

Solution (Python):
data = [int(input()) for _ in range(6)]
flag = True
for i in range(5):
    for j in range(i+1,5):
        length = abs(data[i] -data[j])
        if length > data[5]:
            flag = False
            break 
if flag:
  print("Yay!")
else:
  print(":(")

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

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

Solution (Python):



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

def f():
    for i in a:
        for j in a:
            if i - j > k:
                return False
    return True

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

Solution (Python):
a, b, c, d, e, k = map(int, open(0).read().split())
print(":(" if e-a > k else "Yay!")

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

flag = 0
i = 0
while i < 5:
    j = 1
    while i + j < 5:
        if n[i + j] - n[i] > k:
            print(':(')
            flag = 1
            break
        else:
            j += 1
    if flag == 1:
        break
    if i + j == 5:
        i += 1
if i == 5:
    print('Yay!')

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

for a in range(5):
    for b in range(5):
        dist = max(dist, antennas[a]-antennas[b])

if dist <= k:
    print("Yay!")
else:
    print(":(")

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

  counter = False
  antena = [a,b,c,d,e]
  for i in range(len(antena)-1):
    p = antena[i]
    for j in range(i, len(antena)):
      q = antena[j]
      if (q-p) > k:
        counter = True
    
  if counter:
    print(':(')
    
  else:
    print('Yay!')
    

main()

Solution (Python):
M = -1
m = 124
for _ in range(5):
  i = int(input())
  if M < i:
    M = i
  if m > i:
    m = i
k = int(input())

if M - m <= k:
  print('Yay!')
else:
  print(':(')

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

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

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

Solution (Python):
l = [int(input()) for _ in range(5)]
k = int(input())
max_dist = 0
max_dist = max(max_dist,l[4]-l[3])
max_dist = max(max_dist,l[4]-l[2])
max_dist = max(max_dist,l[4]-l[1])
max_dist = max(max_dist,l[4]-l[0])
max_dist = max(max_dist,l[3]-l[2])
max_dist = max(max_dist,l[3]-l[1])
max_dist = max(max_dist,l[3]-l[0])
max_dist = max(max_dist,l[2]-l[1])
max_dist = max(max_dist,l[2]-l[0])
max_dist = max(max_dist,l[1]-l[0])
if max_dist > k:
    ans = ':('
else:
    ans = 'Yay!'
print(ans)

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

if dis > 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())

p_list = [a, b, c, d, e]
neg_pair = False

for i in range(5):
  for j in range(5):
    dist = abs(p_list[i] - p_list[j])
    if dist > k:
      neg_pair = True
      break
if neg_pair:
  print(":(")
else:
  print("Yay!")

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

N_s=sorted(N)

if N_s[4]-N_s[0] >K:
    print(":(")
else:
    print("Yay!")

Solution (Python):
input_lines = input().split()
a = int(input_lines[0])
input_lines = input().split()
b = int(input_lines[0])
input_lines = input().split()
c = int(input_lines[0])
input_lines = input().split()
d = int(input_lines[0])
input_lines = input().split()
e = int(input_lines[0])
input_lines = input().split()
k = int(input_lines[0])
if e - a <= k:
    print("Yay!")
else:
    print(":(")

Solution (Python):
from sys import stdin
data = [None] * 5
for itr in range(0,5):
    data[itr] = int(stdin.readline().rstrip())
k = int(stdin.readline().rstrip())

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

Solution (Python):
import sys
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
List = [a,b,c,d,e]
k = int(input())
flag = 0
for i in range(5):
    for j in range(5):
        if i == k:
            tmp = 0
        elif abs(List[i]-List[j])>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(":(")
    exit()

print("Yay!")

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

k = int(input())

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

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

def solve(x,k):
    for i in range(5):
        for j in range(5):
            if abs(x[i]-x[j]) > k:
                return ":(" 
                
    return "Yay!"
print(solve(x,k))

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())

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

from itertools import combinations as comb
loc_comb = list(comb(loc, 2))

check = True

for i in range(len(loc_comb)):
    dis = abs(loc_comb[i][0] - loc_comb[i][1])
    if dis > k:
        check = False
        break

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
tmp=[a-b,a-c,a-d,a-e,b-c,b-d,b-e,c-d,c-e,d-e]
tmp=list(map(abs,tmp))
a=True
for i in tmp:
    if i>k:
        a=False
        break
if a:
    print("Yay!")
else:
    print(":(")

Solution (Python):
n = 5
l = []
for i in range(n):
    l.append(int(input()))
k = int(input())
f = True
for i in range(n - 1):
    for j in range(i, n):
        if l[j] - l[i] > k:
            f = False
if f:
    print('Yay!')
else:
    print(':(')

Solution (Python):
def solve(antennas, k):
    for i in range(len(antennas)):
        for j in range(i + 1, len(antennas)):
            if antennas[j] - antennas[i] > k:
                return False
    return True

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

if solve(antennas, 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("Yay!")
else:
    print(":(")

Solution (Python):
import sys
antn = []
for i in range(5):
  antn.append(int(input()))
k = int(input())
if (antn[4] - antn[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 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())
ls = []
ls.append(abs(a-b))
ls.append(abs(a-c))
ls.append(abs(a-d))
ls.append(abs(a-e))
ls.append(abs(b-c))
ls.append(abs(b-e))
ls.append(abs(b-d))
ls.append(abs(c-d))
ls.append(abs(c-e))
ls.append(abs(d-e))

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

Solution (Python):


















import math
import copy
from collections import defaultdict, Counter

from itertools import product

from itertools import permutations

from itertools import combinations
from bisect import bisect_left, bisect_right


def i_inpl(): return int(input())
def s_inpl(): return map(int,input().split())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

a=i_inpl()
b=i_inpl()
c=i_inpl()
d=i_inpl()
e=i_inpl()
k=i_inpl()

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

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

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

Solution (Python):


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

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

Solution (Python):
A = []
for i in range(5):
    A.append(int(input()))
k = int(input())
flag = 0
for i in range(5):
    for j in range(i+1 ,5):
        if abs(A[i]- A[j]) > k:
            flag = 1

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

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

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

Solution (Python):
li = []

for i in range(5):
    tmp = int(input())
    li.append(tmp)

k = int(input())

flag = True
for i in range(4):
    for j in range(i,5):
        if abs(li[i] - li[j]) > k:
            flag = False
            break
    if flag is False:
        break
    
if flag is True:
    print("Yay!")
else:
    print(":(")

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

for i in range(5):
  for j in range(i + 1,5):
    if k < a[j] - a[i]:
      exist += 1
      break
  if exist > 0:
    break
if exist > 0:
  print(':(')
else:
  print('Yay!')

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

Solution (Python):
import itertools

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

flag = 0

for i,j in itertools.combinations(number[0:5],2):
    if abs(i-j) > number[5]:
        flag = 1
        break

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

Solution (Python):
import sys
A=[int(input()) for _ in range(6)]
k=A[-1]
num=len(A)-1
for i in range(num):
    for b in range(i,num):
        if abs(A[i]-A[b])>k:
            print(":(")
            sys.exit()
print("Yay!")

Solution (Python):
def main():
    a = []
    flag = False
    for i in range(5):
        a.append(int(input()))
    k = int(input())
    for i in a:
        for j in a:
            if i - j > k:
                print(':(')
                flag = True
                break
        if flag:
            break
    else:
        print('Yay!')


if __name__ == '__main__':
    main()

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

judge = 0
if abs(a-e) > k:
    print(':(')
else:
    print("Yay!")

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())

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

for i in l:
    for j in l:
        kyori.append(abs(i-j))
if max(kyori) <= 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())
ans = 0
import itertools

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

for i in range(10):

    if abs(ax[i][0]-ax[i][1]) > k:

        ans += 1

if ans >= 1:

    print(':(')

else:

    print('Yay!')

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

Solution (Python):
antenna = [int(input()) for i in range(5)]
k = int(input())
if(antenna[4] - antenna[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())
list = []
ans = 0
list.append(a - b)
list.append(a - c)
list.append(a - d)
list.append(a - e)
list.append(b - c)
list.append(b - d)
list.append(b - e)
list.append(c - d)
list.append(c - e)
list.append(d - e)


for i in range(10):
    if abs(list[i]) <= k:
        ans += 1
if ans == 10:
    print("Yay!")
else:
    print(":(")

Solution (Python):
def judge(a,b,c,d,e,k):
    if abs(a - b) > k:
        return False
    if abs(a - c) > k:
        return False
    if abs(a - d) > k:
        return False
    if abs(a - e) > k:
        return False
    if abs(b - c) > k:
        return False
    if abs(b - d) > k:
        return False
    if abs(b - e) > k:
        return False
    if abs(c - d) > k:
        return False
    if abs(c - e) > k:
        return False
    if abs(d - e) > k:
        return False
    return True


def main():
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    k = int(input())
    if judge(a,b,c,d,e,k):
        print('Yay!')
    else:
        print(':(')

main()

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

x=e-a

if x>k:
    print(":(")
else:
    print("Yay!")

Solution (Python):

import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    ans = k
    for i,v in enumerate([a,b,c,d,e]):
        for j,x in enumerate([a,b,c,d,e],i+1):
            if(abs(v-x)):
                ans = max(ans,abs(v-x))

    if(ans > k):
        print(':(')
    else:
        print('Yay!')
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  
    b = int(next(tokens))  
    c = int(next(tokens))  
    d = int(next(tokens))  
    e = int(next(tokens))  
    k = int(next(tokens))  
    solve(a, b, c, d, e, k)

if __name__ == '__main__':
    main()

Solution (Python):
i = []
for l in range(5):
    i.append(int(input()))
m = int(input())
i.sort()
if (i[-1] - i[0] > m):
    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=[]
for i in range(6):
    a.append(int(input()))
if a[4]-a[0]>a[5]:
    print(":(")
else:
    print("Yay!")

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

Solution (Python):


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

reach = True

for i in range(5):
    for j in range(5):
        if antenna[i]-antenna[j] > k:
            reach = False

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

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

ab = abs(a - b)
ac = abs(a - c)
ad = abs(a - d)
ae = abs(a - e)
bc = abs(b - c)
bd = abs(b - d)
be = abs(b - e)
cd = abs(c - d)
de = abs(d - e)


if ab > k or ac > k or ad > k or ae > k or bc > k or bd > k or be > k or cd > k or de > 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):


def main():
    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(":(")


if __name__ == "__main__":
    main()

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

for x in L:
	for y in L:
		if k<abs(x-y):
			print ":("
			quit()
else:
	print "Yay!"

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

Solution (Python):
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve():
    a = makeInt(input())
    b = makeInt(input())
    c = makeInt(input())
    d = makeInt(input())
    e = makeInt(input())
    l = [a, b, c, d, e]
    k = makeInt(input())
    flag = False
    for i in range(len(l)):
        for j in range(len(l)-1):
            if abs(l[i] - l[j+1]) > k:
                flag = True
    if flag:
        return ":("
    else:
        return "Yay!"


def main():
    answer = solve()
    print(answer)


if __name__ == '__main__':
    main()

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):
ABCDE = []
for _ in range(5):
  ABCDE.append(int(input()))
K = int(input())
if max(ABCDE) - min(ABCDE) > K:
  print(":(")
else:
  print("Yay!")

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

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

k = int(input())

first = ant[0]
for i in reversed(range(1, 5)):
	if ant[i] -  first > k:
		print (":(")
		quit()

print ("Yay!")

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

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

Solution (Python):
def check(pos):
    for a in pos:
        for b in pos:
            if abs(a - b) > k:
                return False
    return True

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

print("Yay!" if check(pos) 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('Yay!')
else:
    print(':(')

Solution (Python):
from sys import stdin
import itertools

data=[]
for i in range(5):
    data.append(int(input()))
k=int(stdin.readline().rstrip())

flag=0
for j in list(itertools.product(data,repeat=2)):
    if abs(j[0]-j[1]) > k:
        flag=1
if flag==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())
data_list = [a,b,c,d,e]
if max(data_list)-min(data_list)<=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())
lis = [int(abs(a-b)),int(abs(a-c)),int(abs(a-d)),int(abs(a-e)),int(abs(b-c)),int(abs(b-d)),int(abs(b-e)),int(abs(c-d)),int(abs(c-e)),int(abs(d-e))]
tes = 0
for item in lis:
    if item > k:
        tes += 1
if tes == 0:
    print('Yay!')
else:
    print(":(")

Solution (Python):
import sys

def is_ok(a,b, k):
    return (a - b) * (a-b) <= k * k

def main():

    points = []

    for line in sys.stdin:
        line = line.rstrip()
        a = int(line)
        points.append(a)


    s = points[5]
    for i in range(5):
        p = points[i]
        for k in range(i+1, 5):
            q = points[k]

            if not is_ok(p, q, s):
                print(':(')
                return 0

    print('Yay!')
    return 0

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

Solution (Python):
antena = []
ans = "Yay!"
for i in range(5):
    antena.append(int(input()))
K = int(input())
for i in antena:
    for j in antena:
        if abs(i - j) > K:
            ans = ":("
print(ans)

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

flg = False
for i in range(5):
    for j in range(5):
        if i == j:
            continue
        if abs(antennas[i]-antennas[j]) > k:
            flg = True
            break
if flg:
    print(':(')
else:
    print('Yay!')

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

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())
dis = []
for i in range(5):
  for j in range(5):
    if i == j:
      continue
    else:
      dis.append(abs(x[i]-x[j]))
for d in dis:
  if d>k:
    print(":(")
    exit(0)

print("Yay!")

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
k=int(input())

pole = [A,B,C,D,E]
sw = 0
for i in range(5):
    if sw == 1:
        break
    for j in range(5):
        if pole[i]-pole[j] > k:
            print(":(")
            sw = 1
            break
if sw == 0:
    print("Yay!")

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

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

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

ans = 'Yay!'

for i in range(5):
  for j in range(i,5):
    if abs(a[i] - a[j]) > k:
      ans = ':('

print(ans)

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

ok = True

for i in range(5):
    for j in range(i+1, 5):
        if antennas[j] - antennas[i] > k:
            ok = False

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

Solution (Python):
l = [int(input()) for _ in range(5)]
from itertools import combinations
p = list(combinations(l, 2))
k = int(input())
print('Yay!' if all([abs(p[i][0] - p[i][1]) <= k for i in range(len(p) - 1)]) else ':(')

Solution (Python):
x = []
for _ in range(5):
	x.append(int(input()))
k = int(input())
flag = False
for i in range(5):
    for j in range(i, 5):
        if abs(x[i] - x[j]) > k:
            flag = True
if flag:
    print(":(")
else:
    print("Yay!")

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

mi = min(a, b, c, d, e)
ma = max(a, b, c, d, e)

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

print(ans)