Problem:


﻿Score: 100 points

Problem Statement

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

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

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

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

Constraints

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

a < b < c < d < e

Input

Input is given from Standard Input in the following format:

a
b
c
d
e
k

Output

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

Sample Input 1

1
2
4
8
9
15

Sample Output 1

Yay!

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

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

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

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

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

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

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

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

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

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

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

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

Sample Input 2

15
18
26
35
36
18

Sample Output 2

:(

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



Sample input:
1
2
4
8
9
15


Sample output:
Yay!

Submission status: Accepted

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

for i in range(5):
    for j in range(i+1,5):
        ans.append((a[i]-a[j])**2)
if max(ans) <= k**2:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

a = []
for _ in range(5):
    a.append(ni())
k = ni()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
l=[int(input()) for x in range(5)]
k=int(input())
ans='Yay!'
for l1 in l:
  for l2 in l:
    if abs(l1-l2) > k:
      ans=':('
      
print(ans)

Submission status: Accepted

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

ok = True
for i in range(4):
    left = antennas[i]
    for a in antennas[i+1:]:
        if a - left > k:
            ok = False
            break
    if not ok:
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
Antennas = []
for i in range(5):
    Antennas.append(int(input()))
    
K = int(input())

combi = list(itertools.combinations(Antennas, 2))

flag = True
for c in combi:
    if abs(c[0]-c[1]) > K:
        flag = False

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

Submission status: Accepted

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

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

def chk(x, y):
    return(abs(x - y))


result = 'Yay!'
for i in x:
    for j in y:
        if i != j:
            if chk(i, j) > k:
                result = ':('

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
I = list(map(int, open(0).read().split()))
print("Yay!" if I[4] - I[0] <= I[5] else ":(")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a=INT()
    b=INT()
    c=INT()
    d=INT()
    e=INT()
    f=INT()
    if e-a<=f:
        print('Yay!')
    else:
        print(':(')
if __name__ == '__main__':
    do()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if arr[4]-arr[0]>arr[5]:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

Solution code:
s=list(int(input()) for _ in range(6))

k=s[5]
if max(s[:6])-min(s[:6]) >k:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(6)]
count = 0
for i in range(5):
    for j in range(i+1, 5):
        if abs(a[i] - a[j]) > a[5]:
            count += 1
            break
        else:
            continue
    break

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

Submission status: Accepted

Solution code:
l=[]
t=1
l.append(int(input()))
l.append(int(input()))
l.append(int(input()))
l.append(int(input()))
l.append(int(input()))
k=int(input())
for i in range(4):
    for j in range(i+1,5):
        if abs(l[i]-l[j])>k:
            t=0
            print(':(')
            break
    break
if t:
    print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
lst=[]
for i in range(5):
  lst.append(int(input()))
k=int(input())
l=list(itertools.combinations(lst,2))
flg=True
for i in l:
  if (i[1]-i[0]) > k:
    flg = False
print("Yay!" if flg else ":(")

Submission status: Accepted

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

ans = 0
for i in [a, b, c, d, e]:
    for j in [a, b, c, d, e]:
        if abs(i-j) > k:
            ans += 1
print("Yay!" if ans == 0 else ":(")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b,c,d,e,k=map(int,open(0))
print((":(","Yay!")[e-a<=k])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = []
S.append(int(input()))
S.append(int(input()))
S.append(int(input()))
S.append(int(input()))
S.append(int(input()))
ch = int(input())
for i in range(len(S)):
	for j in range(i,len(S)):
		if(S[j]-S[i]>ch):
			print(":(")
			exit()
print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

*A, K = [int(sys.stdin.buffer.readline()) for _ in range(6)]
ok = A[-1] - A[0] <= K
if ok:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

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



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

Submission status: Accepted

Solution code:
N = 5
A = [0] * N
for i in range(N):
  A[i] = int(input())
k = int(input())

ans = 0

for i in range(N):
  for j in range(i+1, N):
    if abs(A[i] - A[j]) > k:
      ans += 1

if ans > 0:
  print(':(')
else:
  print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
arr = [int(input()) for _ in range(6)]
arr, k = sorted(arr[:-1]), arr[-1]
print('Yay!' if arr[-1]-arr[0] <= k else ':(')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def examA():
    X = [I() for _ in range(5)]
    k = I()
    X.sort()
    ans = "Yay!"
    if X[-1]-X[0]>k:
        ans = ":("
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    *antenna, k = map(int, open(0).read().split())
    
    if k < antenna[4] - antenna[0]:
        print(':(')
    else:
        print('Yay!')


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
List=[int(input()) for i in range(5)]
k=int(input())
for i in range(5):
    for j in range(5):
        if(abs(List[i]-List[j])>k):
            print(":(")
            exit(0) 

print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
list = [a, b, c, d, e]
result = []
for i in range(len(list)):
    for j in range(len(list)):
        result.append(list[i]-list[j])
if max(result) >  k:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

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

flag = True
for i in range(4):
    for j in range(i + 1, 5):
        if a[j] - a[i] > a[5]:
            flag = False
if flag == True:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(4):
  for _ in range(1,5):
    if abs(x[i] - x[_]) > k:
      print(":(")
      exit()
print("Yay!")

Submission status: Accepted

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

ans = "Yay!"
for i in range(4):
    for j in range(i+1, 5):
        if A[j] - A[i] > k:
            ans = ":("

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = "Yay!"
for i in range(5):
    for j in range(i+1, 5):
        if antennas[j] - antennas[i] > k:
            ans = ":("

print(ans)

Submission status: Accepted

Solution code:
a = int( input() )
b = int( input() )
c = int( input() )
d = int( input() )
e = int( input() )
k = int( input() )
print( [ ":(", "Yay!" ][ max( a, b, c, d, e ) - min( a, b, c, d, e ) <= k ] )

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

x = list([a,b,c,d,e])
y = sorted(x)

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

else:
    print(':(')

Submission status: Accepted

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

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

else:
    print(':(')

Submission status: Accepted

Solution code:
import itertools
l = list()
for i in range(5):
    l.append(int(input()))
it = list(itertools.combinations(l, 2))
k = int(input())
for i in it:
    if abs(i[0] - i[1]) <= k:
        continue
    else:
        print(":(")
        quit()
print("Yay!")

Submission status: Accepted

Solution code:
*Antennas, k = map(int, open(0).read().split())
if Antennas[4] - Antennas[0] > k :
	print(":(")
else :
	print("Yay!")

Submission status: Accepted

Solution code:
import itertools

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

lst_sub=[]
lst_C = list(itertools.combinations(lst,2))
for j in range(len(lst_C)):
    sub = abs(int(lst_C[j][0])-int(lst_C[j][1]))
    lst_sub.append(sub)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
lst = [int(input()) for i in range(5)]
k = int(input())

flg = True
for i, v1 in enumerate(lst):
  for j, v2 in enumerate(lst):
    if abs(v1 - v2) > k:
      flg = False
      break
  if not flg:
    break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A= int(input())
for i in range(3):
  B = input()
E= int(input())
K= int(input())
if E-A<=K:
  print("Yay!")
else:
  print(":(")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

else:
    print ":("

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
input()
input()
input()
e = int(input())
k = int(input())
print("Yay!" if a + k >= e else ":(")

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(6)]
for i in range(0,5):
    for j in range(0,5):
        if abs(a[i]-a[j]) > a[5]:
            print(":(")
            exit()
else:
    print("Yay!")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

l = [b,c,d,e]

ans = 'Yay!'

for i in range(len(l)):
    if ((l[i]- a) > n):
        ans = ':('
        break

print(ans)

Submission status: Accepted

Solution code:
n = 5
A = [None] * n

for i in range(n):
    A[i] = int(input())

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

b = A[0]
for i in range(n):
    for ii in range(n)[i::]:
        if A[ii] - A[i] > k:
            print(':(')
            exit()
print('Yay!')

Submission status: Accepted

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

count = 0
for i in range(4):
    for j in range(i+1, 5):
        if abs(antennas[i] - antennas[j]) > k:
            print(":(")
            exit()
print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: utf-8

list = [0,0,0,0,0]

for i in range(5):
  list[i] = int(input())
  
flag = True

kyori = 0

k = int(input())

for i in range(4):
    for j in range(i + 1,5):
        if list[i] > list[j]:
            kyori = list[i] - list[j]
        else:
            kyori = list[j] - list[i]
            
        if kyori > k:
            flag = False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import combinations

*ant, k = [int(input()) for i in range(6)]
for c in combinations(ant, 2):
  x, y = c
  if (y - x) > k:
    print(":(")
    break;
else:
  print("Yay!")

Submission status: Accepted

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

if (E-A)<=k:
  print("Yay!")
else:
  print(":(")

Submission status: Accepted

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

t = max(l)-min(l)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = []
flag = 0

for _ in range(5):
    S.append(int(input()))

k = int(input())

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

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

Submission status: Accepted

Solution code:
dist = [0]*5
for i in range(5):
    dist[i] = int(input())
k = int(input())

for i in range(5):
    for j in range(i):
        if abs(dist[j]-dist[i]) > k:
            print(":(")
            exit()

print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = []

for i in range(4+1):
    l.append(int(input()))

k = int(input())

ans = "Yay!"

for elm1 in l:
    for elm2 in l:
        if elm2 - elm1 > k:
            ans = ":("

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
arr = []
  
for i in range(5):
    x = int(input())
    arr.insert(i, x)

k = int(input())
flag = 0
for i in range(5):
    for j in range(5):
        if abs(arr[i]-arr[j]) > k:
            flag = 1
            break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

l = []

l.append(abs(a - b))
l.append(abs(a - c))
l.append(abs(a - d))
l.append(abs(a - e))
l.append(abs(b - c))
l.append(abs(b - d))
l.append(abs(b - e))
l.append(abs(c - d))
l.append(abs(c - e))

for x in l:
    if x > k:
        print(':(')
        exit()

print('Yay!')

Submission status: Accepted

Solution code:
from itertools import combinations

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

for p, q in combinations([a, b, c, d, e], 2):
    if q - p > k:
        print(":(")
        break
else:
    print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
L = [int(input()) for _ in range(6)]
c=0
for i in range(4):
    for j in range(i,5):
        if abs(L[i]-L[j])>L[5]:
            c += 1
if c==0:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

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

k=l[5]
flag=True
import math
for i in range(5):
  for j in range(5):
    if abs(l[i]-l[j])>k:
      flag=False
if flag:
  print("Yay!")
else:
  print(":(")

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k=int(input())
V=[a,b,c,d,e]
V.sort()
if V[4]-V[0]<=k:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
def p_a():
    x = [int(input()) for _ in range(5)]
    k = int(input())
    print("Yay!" if x[4] - x[0] <= k else ":(")
p_a()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
usrInput = []
flag = False
for n in range(6):
    usrInput.append(int(input()))

for l in range(5):
    for m in range(5):
        if abs(int(usrInput[l]) - int(usrInput[m])) > usrInput[5]:
            flag = True

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

Submission status: Accepted

Solution code:
A = [0] * 5

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

flag = 0
for i, a in enumerate(A):
    for j, a2 in enumerate(A[i+1:]):
        if abs(a2 - a) > K:
            flag = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

if (max(i[0:5])-min(i[0:5])) <= i[5]:
  print('Yay!')
else:
  print(":(")

Submission status: Accepted

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

k = i.pop(5)
if (max(i)-min(i)) <= k:
  print('Yay!')
else:
  print(":(")

Submission status: Accepted

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

k = i.pop()
if (max(i)-min(i)) <= k:
  print('Yay!')
else:
  print(":(")

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def print_ans(ar, k):
    """Test Case
    >>> print_ans([1, 2, 4, 8, 9], 15)
    Yay!
    >>> print_ans([15,18,26,35,36],18)
    :(
    """
    flg = False
    for i in range(4):
        for j in range(i+1,5):
            if ar[j] -ar[i] > k:
                flg = True
                break
        if flg:
            break
    if flg:
        print(":(")
    else:
        print("Yay!")


if __name__ == '__main__':
    ar = [ int(input().rstrip()) for _ in range(5)]
    k = int(input().rstrip())
    print_ans(ar, k)

Submission status: Accepted

Solution code:
array = [0, 0, 0, 0, 0, 0]

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

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

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
dis =[]
dis.append(a)
dis.append(b)
dis.append(c)
dis.append(d)
dis.append(e)

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

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
S=[a,b,c,d,e]
ans="Yay!"
for i in S:
    for j in S:
        if abs(i-j)<=k:
            pass
        else:
            ans=":("
            break
print(ans)

Submission status: Accepted

Solution code:
abcde =[ int(input()) for _ in range(5)] 
K = int(input())
flag = False
for i in range(5):
    for s in range(1,5-i):
        if abcde[s] - abcde[i] > K:
            flag = True
if flag:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

Solution code:
num = [int(input()) for _ in range(5)]
k = int(input())

for i in range(5):
  for j in range(i+1, 5):
    if abs(num[i]-num[j]) > k:
      print(':(')
      exit(0)

print('Yay!')

Submission status: Accepted

Solution code:
import sys

def main():
    *antennas, k = map(int, sys.stdin.read().split())
    if antennas[-1] - antennas[0] > k:
            print(':(')
            sys.exit()
    print('Yay!')

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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