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 math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    a = [i_input() for _ in range(5)]
    k = i_input()

    if a[-1] - a[0] > k:
        print(":(")
        exit()
    print("Yay!")







if __name__=="__main__":
    main()

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

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

lists.sort()
maximum = lists[-1]
minimum = lists[0]

if k < maximum - minimum:
    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())
if max(e-a,e-b,e-c,e-d) <= k:
    print('Yay!')
else:
    print(':(')

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

flg = False

for i, x in enumerate(a):
  for j, y in enumerate(a):
    if i == j:
      continue
      
    flg = flg or abs(y-x) > k
    
print(':(' if flg else "Yay!")

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

Solution (Python):
ans = 0
position = []
for i in range(5):
    x = int(input())
    position.append(x)
k = int(input())
distance_list = []
for i in range(5):
    for j in range(5):
        if i != j:
            distance = abs(position[i] - position[j]) 
            distance_list.append(distance)

y = max(distance_list)
if y <= 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())
    if abs(a-b)>k or abs(a-c)>k or abs(a-d)>k or abs(a-e)>k or abs(b-c)>k or abs(b-d)>k or abs(b-e)>k or abs(c-d)>k or abs(c-e)>k or abs(d-e)>k:
        print(":(")
    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())
print("Yay!" if abs(a-e) <= k else ":(")

Solution (Python):
a = []
for i in range(5):
    a.append(int(input()))
k = int(input())
isOK = True
for i in range(5):
    for j in range(i+1,5):
        if abs(a[i]-a[j])>k:
            isOK = False
            break
if isOK:
    print('Yay!')
else:
    print(':(')

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

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

k = int(input())

for ii in range(5):
    for jj in range(ii, 5):
        if int(abcde[jj]) - int(abcde[ii]) > k:
            print(':(')
            exit()

print('Yay!')

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

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

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

Solution (Python):
a = int(input())
for i in range(3):
	input()
e = int(input())
print('Yay!' if e - a <= int(input()) else ':(')

Solution (Python):
import sys
inp = lambda: sys.stdin.readline()
mi = lambda: map(int, inp().split())
li = lambda: list(map(int, inp().split()))
mf = lambda: map(float,inp().split())
lf = lambda: list(map(float,inp().split()))

A = int(inp())
B = int(inp())
C = int(inp())
D = int(inp())
E = int(inp())
K = int(inp())
print("Yay!" if E - A <= K else ":(")

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

Solution (Python):
a=[int(input()) for _ in range(5)]
k=int(input())
a.sort()
if a[-1]-a[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())

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

Solution (Python):
from itertools import combinations
s=[int(input())for _ in[0]*6]
k=s.pop()
r="Yay!"
for i,j in combinations(s,2):
	if j-i>k:
		r=":(";break
print(r)

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

Solution (Python):
a=[]
for i in range(6):
    temp=int(input())
    a.append(temp)
for i in range(4):
    for j in range(1,5):
        if a[j]-a[i]>a[5]:
            print(':(')
            exit()
print('Yay!')

Solution (Python):
num_list = []
count_cant_go = 0

for i in range(5):
    num_list.append(int(input()))

num_list.append(int(input()))

if max(num_list) - min(num_list) <= num_list[-1]:
    print('Yay!')
else:
    print(':(')

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

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

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

for j in range(4):
    for h in range(j+1,5):
        if k < abs(A[j] - A[h]):
            print(":(")
            exit()
print("Yay!")

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

Solution (Python):
a=[int(input()) for i 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()
print("Yay!")

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

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

Solution (Python):
v = [int(input()) for _ in range(6)]
a = v[0]
e = v[-2]
k = v[-1]
    
print(':(' if e - a > k else 'Yay!')

Solution (Python):




import numpy as np




def solve(a, b, c, d, e, k):
    arr = np.array([a, b, c, d, e])
    
    arr, arr2 = [a.flatten() for a in np.meshgrid(arr, arr)]
    
    arr = np.c_[arr, arr2]
    
    arr = np.array(list(map(lambda x: abs(x[0] - x[1]), arr)))
    
    print(':(' if arr.max() > k else 'Yay!')


if __name__ == '__main__':
    a, b, c, d, e, k = [int(input()) for _ in range(6)]
    
    solve(a, b, c, d, e, k)

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

Solution (Python):
l = [int(input()) for _ in range(5)]
k = int(input())
for i in range(5):
    for j in range(i+1,5):
        if l[j]-l[i] > 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())

l = []
l.append(a)
l.append(b)
l.append(c)
l.append(d)
l.append(e)
ans = 0
for i in range(5):
    for j in range(i+1,5):
        if l[j] - l[i] > k :
            ans += 1

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

Solution (Python):
def Input():
    return mapt(int, input().split(" "))


def calc(i, h):
    return all(h[i] >= h[j] for j in range(i))


def main():
    data = [int(input()) for _ in range(5)]
    k = int(input())
    print("Yay!" if k >= data[-1] - data[0] else ":(")


main()

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

Solution (Python):
antenna = [int(input()) for _ in range(5)]
k = int(input())
ans = 'Yay!'

for i in range(5):
    for j in range(5):
        if i < j:
            if antenna[j] - antenna[i] > k:
                ans = ':('
                break
    else:
        continue
    break

print(ans)

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

for i in range(5):
    for j in range(i, 5):
        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 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('Yay!')
else:
    print(':(')

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

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

for e in antennas[:0:-1]:
    if e - antennas[0] > k:
        print(':(')
        break
else:
    print('Yay!')

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,b,c,d,e,k=[int(input()) for i in range(6)]
print("Yay!" if e-a<=k else ":(")

Solution (Python):
A = []
for i in range(5):
  A.append(int(input()))
k = int(input())
if max(A) - min(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("Yay!")
else:
  print(":(")

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

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


if __name__ == "__main__":
    main()

Solution (Python):
a,_,_,_,e,k=[int(input()) for _ in range(6)]
print(["Yay!",":("][e-a>k])

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

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

check = True
for i in range(4):
  for j in range(i+1,5):
    if int(antenna[j]) - int(antenna[i]) > k:
      check = False

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

Solution (Python):
li=[0]*5
ans="Yay!"
for i in range(5):
    li[i]=int(input())
k=int(input())

for j in range(5):
    for l in range(5):
        if j<l:
            if k-(li[l]-li[j])<0:
                ans=":("
print(ans)

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

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

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

Solution (Python):
def f():
    x = [int(input()) for _ in range(5)]
    k = int(input())
    for i in range(5):
        for j in range(5):
            if abs(x[i] - x[j]) > k:
                return":("
    return "Yay!"
print(f())

Solution (Python):
from itertools import combinations
def test():
  num_list = [int(input()) for _ in range(5)]
  k=int(input())
  l=list(combinations(num_list,2))
  for i,j in l:
    if abs(i-j) >k:
      print(":(")
      return
  print("Yay!")
test()

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
x=int(input())
ls=[a,b,c,d,e]
if (e-a)<=x:
  print("Yay!")
else:
  print(":(")

Solution (Python):
a,*x,e,k = [int(input()) for _ 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())
if e - a <= k:
    print('Yay!')
else:
    print(':(')

Solution (Python):
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    A = []
    A.append(int(input()))

    A.append(int(input()))

    A.append(int(input()))

    A.append(int(input()))

    A.append(int(input()))

    k = int(input())


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

if __name__ == "__main__":
    main()

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

Solution (Python):
ls =[]
ans = 'Yay!'
for i in range(5):
    ls.append(int(input()))
k = int(input())
for i in range(5):
    for j in range(5):
        if abs(ls[i]-ls[j]) > k:
            ans = ':('
            break
print(ans)

Solution (Python):
a=[int(input()) for _ in range(5)]
k=int(input())
flag=False
for i in range(5):
	for j in range(i+1,5):
		tmp=abs(a[i]-a[j])
		if tmp > k:
			flag=True
			break
	if flag:
		break
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())
if k >= e-a:
  print("Yay!")
else:
  print(":(")

Solution (Python):
li=[]

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

k=int(input())

li.sort()


if li[-1]-li[0]>k:
    print(":(")
else:
    print("Yay!")

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

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

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

Solution (Python):
a,b,c,d,e,k=int(input()),int(input()),int(input()),int(input()),int(input()),int(input())
l=[a,b,c,d,e]
f=0
for i in range(4):
    for j in range(i+1,5):
        d=abs(l[j]-l[i])
        if(d>k):
            f=1
            break
if(f==0):
    print('Yay!')
else:
    print(':(')

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    a, b, c, d, e, k = map(int, read().split())

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

    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    (*A,) = map(int, read().split())
    k = A[-1]

    for i in range(5):
        for j in range(i + 1, 5):
            if A[j] - A[i] > k:
                print(':(')
                return

    print('Yay!')
    return


if __name__ == '__main__':
    main()

Solution (Python):
a=int(input())
input()
input()
input()
e=int(input())
k=int(input())
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(e-a <= k):
    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 A[j]-A[i] > k:
            print(':(')
            exit(0)
print('Yay!')

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

Solution (Python):
num = [int(input()) for i in range(5)]
k = int(input())
x = 'Yay!'
for h in num:
    for j in num:
        if k < j-h:
            x = ':('
print(x)

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

Solution (Python):

import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    print('Yay!' if e - a <= k else ':(')




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

import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    print('Yay!' if e - a <= k else ':(')




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

import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    print('Yay!' if e - a <= k else ':(')




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

import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    print('Yay!' if e - a <= k else ':(')




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

import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    print('Yay!' if e - a <= k else ':(')




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

import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    print('Yay!' if e - a <= k else ':(')




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

import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    print('Yay!' if e - a <= k else ':(')




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

import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    print('Yay!' if e - a <= k else ':(')




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):
a = [int(input()) for i in range(6)]
if a[4]-a[0]<=a[5]:
  print("Yay!")
else:
  print(":(")

Solution (Python):
a = []
for i in range(5):
    a.append(int(input()))
k = int(input())
is_true = True
for i in range(len(a)):
    for j in range(i + 1, len(a)):
        if a[j] - a[i] > k:
            is_true = False
            break
if is_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())
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):
def solve():
    import sys
    read = sys.stdin.read
    *s, k = map(int, read().split())
    flg = True
    for a in s:
        for b in s:
            if abs(a - b) > k:
                flg = False
    print("Yay!" if flg else":(")

solve()

Solution (Python):








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

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

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

flag = True

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

if flag:
    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):
x=[]
for i in range(5):
    x.append(int(input()))
k=int(input())
ans="Yay!"
for j in range(5):
    for s in range(1,5):
        if j>=s:
            break
        if x[s]-x[j]>k:
            ans=":("
print(ans)

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

coordinate_lst.sort()
max_distance = coordinate_lst[-1] - coordinate_lst[0]

if max_distance <= 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_num = a
min_num = a
if b < min_num:
    min_num = b
if b > max_num:
    max_num = b

if c < min_num:
    min_num = c
if c > max_num:
    max_num = c

if d < min_num:
    min_num = d
if d > max_num:
    max_num = d

if e < min_num:
    min_num = e
if e > max_num:
    max_num = e

if max_num - min_num <= k:
    print('Yay!')
else:
    print(':(')

Solution (Python):


def main():
    a = [int(input()) for _ in range(5)]
    k = int(input())
    a_ = sorted(a)
    if abs(a_[0] - a_[4]) <= k:
        print('Yay!')
    else:
        print(':(')


if __name__ == "__main__":
    main()

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

print( ":(" if (max(a)-min(a))>k else "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 = [int(input()) for i in range(5)]
k = int(input())
if l[4] - l[0] > k:
    print(":(")
else:
    print("Yay!")

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

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

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

for i in range(1, 5):
    if a[i] - a[0] > k:
        print(':(')
        exit()
print('Yay!')

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

if __name__ == '__main__':
    main()

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

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

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

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
Q=int(input())
F=A-B
G=A-C
H=A-D
I=A-E
J=B-C
K=B-D
L=B-E
M=C-D
N=C-E
O=D-E

P=max(abs(F),abs(G),abs(H),abs(I),abs(J),abs(K),abs(L),abs(M),abs(N),abs(O))
if P<=Q:
    print("Yay!")
else:
    print(":(")

Solution (Python):
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    abcde = [int(input()) for _ in range(5)]
    k = ni()
    for i in range(5):
        for j in range(i, 5):
            if k < abs(abcde[i] - abcde[j]):
                print(':(')
                return
    print('Yay!')


if __name__ == '__main__':
    main()

Solution (Python):
import itertools

antenna = [int(input()) for _ in range(6)]
distance = antenna.pop()
flag = True
for i in itertools.combinations(antenna, 2):
    if abs(i[0] - i[1]) > distance:
        print(':(')
        flag = False
        break
if flag:
    print('Yay!')

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

for i in range(len(l)):
    for j in range(len(l)):
        if i < j and abs(l[i] - l[j]) <= k:
            cnt += 1
            
if cnt == 10:
    print('Yay!')
else:
    print(':(')

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

if n[4] - n[0] <= k and n[3] - n[0] <= k and n[2] - n[0] <= k and n[1] - n[0] <= k:
    print('Yay!')
else:
    print(':(')

Solution (Python):
a,b,c,d,e,k=[int(input())for _ in range(6)]
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())
print("Yay!" if e-a<=k else ":(")

Solution (Python):
ans = 0
a = [0]*6

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

for i in range(5):
  for j in range(i+1, 5):
    if a[j] - a[i] > a[5]:
      ans = 1

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

Solution (Python):
import sys
a=[0]*5
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(i+1,5):
    if a[j]-a[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('Yay!')
else:
    print(':(')

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

antena.sort()
k = int(input())

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

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

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

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

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

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

Solution (Python):
min_x = 123
max_x = 0

for _ in range(5):
    x = int(input())
    if x <= min_x:
        min_x = x
    if x >= max_x:
        max_x = x

k = int(input())
if k < max_x-min_x:
    print(":(")
else:
    print("Yay!")

Solution (Python):
n=[int(input()) for _ in range(6)];print([':(','Yay!'][n[4]-n[0]<=n[5]])

Solution (Python):
n=[int(input()) for _ in range(6)];print([':(','Yay!'][max(n[:5])-min(n[:5])<=n[5]])

Solution (Python):
antennas = [
    int(input()),
    int(input()),
    int(input()),
    int(input()),
    int(input())
]
k = int(input())

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

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 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):
nums = [int(input()) for _ in range(5)]
k = int(input())

if nums[-1]-nums[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())
if e-a<=k:print("Yay!")
else:print(":(")

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

Solution (Python):
from itertools import combinations

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

for i, j in combinations(coord, 2):
    if j - i > k:
        print(':(')
        break
else:
    print('Yay!')

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

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