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:
# coding:utf-8
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!')

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:
    ans = ":("
else: ans = "Yay!"

print(ans)

Submission status: Accepted

Solution code:
li = []

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

b = int(input())

last = 0
flg = 0
for i in li:
    for j in li:
        if abs(i - j) > b:
            flg = 1

        last = i

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

def solve(a, k):
    count = 0
    for i in range(5):
        for j in range(5):
            if i == j:
                continue
            elif abs(a[i]-a[j]) > k:
                return ":("
    return "Yay!"


if __name__ == '__main__':
    antena = [int(input()) for i in range(5)]
    k = int(input())
    print(solve(antena, k))

Submission status: Accepted

Solution code:
from sys import stdin
import sys
data = [int(stdin.readline().rstrip()) for _ in range(5)]
k = int(stdin.readline().rstrip())
result=[]
for i in range(5):
    for j in range(i+1,5):
        result.append(data[j]-data[i])
for i in result:
    if i > k:
        print(':(')
        sys.exit()
print('Yay!')

Submission status: Accepted

Solution code:
b=True
a=[int(input()) for i in range(5)]
k=int(input())
for j in range(5):
  for l in range(5):
    if a[j]-a[l] > k:
      b=False
if b:
  print("Yay!")
else:
  print(":(")

Submission status: Accepted

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

k = int(input())

ans = "Yay!"

for i in li:
    for j in li:
        if abs(i - j) > k:
            ans = ":("
            print(ans)
            quit()

print(ans)

Submission status: Accepted

Solution code:
import sys, copy

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

l = [a,b,c,d,e]
for n, i in enumerate(l):
    ll = copy.copy(l)
    del ll[n]
    for j in range(4):
        if not abs(i - ll[j]) <= k:
            print(':(')
            sys.exit()
print('Yay!')

Submission status: Accepted

Solution code:
num_list=[int(input()) for i in range(5)]
k = int(input())
min_num, max_num = min(num_list),max(num_list)
print([":(","Yay!"][max_num - min_num <= k])

Submission status: Accepted

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

k = int(input())

flag = 0
if num_list[4] - num_list[0] > k:
    flag = 1

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

Submission status: Accepted

Solution code:
from itertools import combinations

data = [int(input()) for _ in range(6)]

flg = True

for a, b in combinations(data[:-1], 2):
  if b - a > data[-1]:
    flg = False

if flg:
  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())
coo=[a,b,c,d,e]
flag=0
for i in range(len(coo)):
  for j in range(i+1,len(coo)):
    if abs(coo[i]-coo[j])>k:
      flag=1
      break
    if flag==1:
      break
if flag==1:  
  print(":(")
else:
  print("Yay!")

Submission status: Accepted

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

def antena():
    for i in range(len(A) - 1):
        for j in range(len(A) - i - 1):
            if A [i+j+1] - A[i] > k:
                return ':('
    return 'Yay!'

print(antena())

Submission status: Accepted

Solution code:
#[a,b,c,d,e,k] = map(int,list(input().split()))
l = []
for i in range(6):
    l.append(int(input()))

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

Submission status: Accepted

Solution code:
inList = []
for i in range(5):
    inList.append(int(input()))
k = int(input())
kList = []
for i in range(5):
    for j in range(1, 5):
        kyori = int(abs(inList[i] - inList[j]))
        kList.append(kyori)
ansFlg = True
for i in kList:
    if k < i:
        ansFlg = False
if ansFlg:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

Solution code:
import sys
A = list()
for i in xrange(5):
    A.append(int(raw_input()))

k = int(raw_input())

flag = False
for i in xrange(4):
    for j in range(i+1, 5, 1):
        if A[j] - A[i] > k:
            flag = True

if flag: 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())

ant=[a,b,c,d,e]
for i in range(5):
    for j in range(5):
        if abs(ant[i]-ant[j]) > k:
            print(":(")
            quit()
print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
posi_list=[]
posi_list.append(int(input()))
posi_list.append(int(input()))
posi_list.append(int(input()))
posi_list.append(int(input()))
posi_list.append(int(input()))

k=int(input())
dis_list=0
for posi in posi_list:
    for other_posi in posi_list:
        if abs(other_posi-posi)>k:
            dis_list=1
            break
if dis_list==1:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

Solution code:
def ii2ss(n):
    ss = []
    for i in range(n):
        ss.append(input())
    return ss

def sp2nn(sp, sep=' '):
    return [int(s) for s in sp.split(sep)]

def ss2nn(ss):
    return [int(s) for s in list(ss)]

def main(ss):
    nn0 = ss2nn(ss)
    nn = nn0[0:5]
    k = nn0[5]
    for i in range(5):
        for j in range(i+1, 5):
            if abs(nn[j] - nn[i]) > k:
                return ':('
    return 'Yay!'
ss = ii2ss(6)
print(main(ss))

Submission status: Accepted

Solution code:
A=[]
for i in range(6):
  A.append(int(input()))
X=A[4]-A[0]
if X<=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())

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

Submission status: Accepted

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

k = int(input())

ans = "Yay!"

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

print(ans)

Submission status: Accepted

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

import itertools

ans = True
for x, y in list(itertools.combinations(antennas,2)):
    dist = abs(x - y)
    if dist > k:
        ans = False
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = int(input())
_ = input()
_ = input()
_ = input()
E = int(input())
k = int(input())

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

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

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

Submission status: Accepted

Solution code:
antena=[]
for i in range(0, 5):
    antena.append(int(input()))
k = int(input())
flag = 0
for i in range(0, 4):
    for j in range(i+1, 5):
        if antena[j]-antena[i]>k:
            flag = 1
if flag==0:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
a = [0, 0, 0, 0, 0]
for i in range(5):
    a[i] = (int)(input())
k = (int)(input())
isExist = "Yay!"

for d in [d+1 for d in range(4)]:
    for i in range(4):
        if i + d < 5 and (a[i+d] - a[i] > k):
            isExist = ":("

print(isExist)

Submission status: Accepted

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

if e-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 abs(a - e) > k:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

Solution code:
"""
python3 main.py < input.txt
"""
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

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

k = int(input())

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

res = 0
for i,j in itertools.combinations(x, 2):
  if abs(j - i) > k:
    res = 1
    print(':(')
    break

if res == 0:
	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 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!")

Submission status: Accepted

Solution code:
a_e = [int(input()) for i in range(5)]
k = int(input())
new_a_e = a_e.copy()
res = False
for i in range(len(a_e)):
    for j in range(len(new_a_e)):
        if i == j:
            del new_a_e[j]
        else:
            dis = abs(a_e[i]-a_e[j])
            if dis>k:
                print(':(')
                res = True
                break
    if res==True:
        break
if res==False:
    print('Yay!')

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(5):
  for j in range(i+1,5):
    tmp = lst[j] - lst[i]
    #print(tmp)
    if tmp > k:
      break
  if tmp > k:
    print(":(")
    break
else:
  print("Yay!")

Submission status: Accepted

Solution code:
a = [int(input())for i in range(5)]
b = int(input())
A =  max(a)
B = min(a)

C = A-B
if C > b:
  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 k < e-a:
	print(":(")
else:
	print("Yay!")

Submission status: Accepted

Solution code:
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())
exi = 0
for i in range(0,5):
    for j in range(i+1,5):
        if ((A[j]-A[i]) <= k):
            exi += 1
if (exi == 10):
    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 and d - a <= k and b - e <= k and d - b <= k and e - c <= k and d - c <= k:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
import itertools

ans = False
l = [int(input()) for i in range(5)]
limit = int(input())
c = list(itertools.combinations(l,2))
for i in c:
    if i[1] - i[0] > limit:
        ans = True
print("Yay!") if not ans 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())

lists=[]
lists.append(A)

lists.append(B)
lists.append(C)
lists.append(D)
lists.append(E)
import itertools 
T=list(itertools.combinations(lists,2))
ans =0
for i in T:
    if abs(i[0]-i[1]) > ans:
        ans = abs(i[0]-i[1])
if ans > K:
    print(':(')

else:
    print('Yay!')

Submission status: Accepted

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

c = 0
for i, a in enumerate(A[:-1]):
	for j, b in enumerate(A[i+1:]):
		c += 1 if K < b - a else 0
print([":(", "Yay!"][not(0<c)])

Submission status: Accepted

Solution code:
import sys
 
 
a = int(sys.stdin.readline().strip())
b = int(sys.stdin.readline().strip())
c = int(sys.stdin.readline().strip())
d = int(sys.stdin.readline().strip())
e = int(sys.stdin.readline().strip())
k = int(sys.stdin.readline().strip())



l = [a,b,c,d,e]
l.sort(reverse=True)


#flag = 1
#while(flag == 1):
if(l[0]-l[-1] > k):
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

Solution code:
antenas = [int(input()) for i in range(5)]
k = int(input())
for i in range(5):
    for j in range(5-i):
        if antenas[j] - antenas[i] > k:
            print(':(')
            break
    else:
        continue  
    break
else:
    print('Yay!')

Submission status: Accepted

Solution code:
tower = []
for i in range(6):
    point = int(input())
    tower.append(point)

if tower[4] - tower[0] > tower[5]:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

Solution code:
lst = [int(input()) for i in range(5)]
k = int(input())
for i in range(5):
    for j in range(5):
        dif = lst[i] - lst[j]
        if abs(dif) > 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-d>k or e-c>k or d-c>k or e-b>k or d-b>k or c-b>k or e-a>k or d-a>k or c-a>k or b-a>k:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

Solution code:
import itertools

antenas = list(map(int, [input() for _ in range(5)]))
k = int(input())
c_list = list(itertools.combinations(antenas, 2))

for combi in c_list:
    length = abs(combi[0] - combi[1])
    if length > k:
        print(':(')
        exit()
print('Yay!')

Submission status: Accepted

Solution code:
import itertools
l = [int(input()) for i in range(5)]
k = int(input())
for i in itertools.combinations(l, 2):
  if i[1] - i[0] > k:
    print(':(')
    exit()
print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
min = int(input())
max = min
for i in range(4):
    x = int(input())
    min = x if x < min else min
    max = x if x > max else max
k = int(input())
print('Yay!' if max-min <= 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())
lis = [a, b, c, d, e]
for i in lis:
    for j in lis:
        dif = abs(i - j)
        if dif > k:
            print(":(")
            break
    else:
        continue
    break
else:
    print("Yay!")

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

lis = [int(input()) for _ in range(6)]

ret = True

for i in range(6):
    for j in (range(i+1, 6)):
        if (abs(lis[i] - lis[j]) > lis[5]):
            ret = False
            break


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

Submission status: Accepted

Solution code:
import itertools

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

count = 0
for p, q in itertools.combinations([a, b, c, d, e], 2):
    if abs(p - q) > k:
        print(':(')
        break
    else:
        continue
else:
    print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

k = int(input())
f = True

for i in range(0, 5):
    for j in range(i + 1, 5):
        if f and a[j] - a[i] > k:
            f = False
            print(":(")

if f:
    print("Yay!")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!


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

ans = 0

for i in range(5):
    for j in range(5)[i+1:]:
        if n[j]-n[i]>k:
            ans+=1
            
if ans == 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())                                                        
                                                                        
ok = "Yay!"                                                             
ng = ":("                                                               
                                                                        
dots = [a, b, c, d, e]                                                  
                                                                        
for i, p in enumerate(dots):                                            
    for q in dots[i:]:                                                  
        d = q-p                                                         
        if d <= k:                                                      
            None                                                        
        else:                                                           
            print(ng)                                                   
            exit()                                                      
                                                                        
print(ok)

Submission status: Accepted

Solution code:
import sys

def parse(inp):
    anntena = [int(next(inp).split()[0]) for _ in range(5)]
    k=int(next(inp).split()[0])
    return anntena,k
  
def main(inp):
    anntena,k=inp
    
    for i in range(4):
        for j in range(i+1,5):
            if(abs(anntena[i]-anntena[j])>k):
                return """:("""
    return """Yay!"""
  
print(main(parse(sys.stdin)))

Submission status: Accepted

Solution code:
L = [int(input()) for i in range(5)]
k = int(input())
c = 0
for i in range(5):
    for j in range(5):
        if i != j and abs(L[i]-L[j]) > k:
            c = 1
if c == 1:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3


def solv(a, b, c, d, e, k):
    ants = [a, b, c, d, e]
    for i in range(1, len(ants)):
        for j in range(i):
            if abs(ants[i] - ants[j]) > k:
                return ':('
    return 'Yay!'


if __name__ == '__main__':

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

    ans = solv(a, b, c, d, e, k)

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

ants = [a, b, c, d, e]
txt = 'Yay!'

for i in range(len(ants)):
    for j in range(len(ants)):
        if i != j and abs(ants[i] - ants[j]) > k:
            txt = ':('

print(txt)

Submission status: Accepted

Solution code:
west = 123
east = 0
for i in range(5):
    x = int(input())
    west = min(x,west)
    east = max(x,east)


if east - west <= int(input()):
    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())

BCDE = [b,c,d,e]
CDE = [c,d,e]
DE = [c,d]

l = 0

Yay = True

for later_point in BCDE:
    l = later_point - a
    if l > k:
        Yay = False

for later_point in CDE:
    l = later_point -b
    if l > k:
        Yay = False

for later_point in DE:
    l = later_point - c
    if l > k:
        Yay = False

if e - d > k :
    Yay = False

if Yay :
    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())
l =[a,b,c,d,e]
count = 0
for i in range(5) :
    for j in range(i + 1) :
        if abs(l[i] - l[j]) > k :
            count = 1

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

Submission status: Accepted

Solution code:
x=[int(input()) for i in range(5)]
k=int(input())
max=max(x)
min=min(x)
if max-min<=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 k>=e-a :
  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())

li = [a, b, c, d, e]
distance = max(li) - min(li)

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

Submission status: Accepted

Solution code:
import sys


def main():
    h = [int(input()) for count in range(6)]
    k = h[5]
    for i in range(len(h) - 1):
        for j in range(len(h) - 1):
            if abs(h[i] - h[j]) > k:
                print(":(")
                sys.exit()
    print("Yay!")


if __name__ == '__main__':
    main()

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]
flag = True

for i in range(0, 4):
    for j in range(i+1, 5):
        if abs(array[i] - array[j] )> k:
            flag = False
            break
            
if flag:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

Solution code:
n = [int(input()) for i in range(5)]
n.sort()
k=int(input())
if n[4] - n[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 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:
dis = [int(input()) for i in range(5)]
k = int(input())

diss = [abs(a-b) for a in dis for b in dis]
if max(diss) > k:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

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

ans = "Yay!"

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

print(ans)

Submission status: Accepted

Solution code:
import sys

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

ae = [a, b, c, d, e]
for i in range(len(ae)-1):
    for j in range(i+1):
        if ae[i+1] - ae[j] > k:
            print(':(')
            sys.exit()

print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

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

def check(n1, n2):
    return abs(inputs[n1] - inputs[n2]) <= inputs[5]

if check(0, 1) and check(0, 2) and check(0, 3) and check(0, 4) and check(1, 2) and check(1, 3) and check(1, 4) and check(2, 3) and check(2, 4) and check(3, 4):
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
a=[]
for i in range(5):
    a.append(int(input()))
k = int(input())
d=[]
for i in range(5):
    for j in range(5):
        if a[i] - a[j] > k:
            print(":(")
            break
    else:
        continue
    break
else:
    print("Yay!")

Submission status: Accepted

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

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

print(':(' if flag==1 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())

in_list = [a,b,c,d,e]
flag = True
for i in in_list:
	for j in in_list:
		if i - j > k:
			flag = False
if flag:
	print('Yay!')
else:
	print(':(')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

length_list = [int(input()) for _ in range(5)]
k = int(input())
a = length_list[0]
flag = True
for i in range(len(length_list)-1, 0, -1):
    if length_list[i] - a > k:
        print(':(')
        flag = False
        break
if flag:
    print('Yay!')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3.4
# -*- coding: utf-8 -*-

# abc123_a

# input
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
# output
ans = e-a <= k
ans = 'Yay!' if ans else ':('
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())

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

else:
    print(':(')

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
ant=[a,b,c,d,e]
def antenna(ant,k):
  for i in range(4):
    for ii in range(1,5):
      if ant[ii]-ant[i]>k:
        return ":("
  else:
    return "Yay!"
print(antenna(ant,k))

Submission status: Accepted

Solution code:
C = []

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

k = int(input())

result = "Yay!"
for i in range(5):
	for j in range(i+1,5):
#		print(C[j] - C[i])
		if C[j] - C[i] > k:
			result = ":("

print(result)

Submission status: Accepted

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

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

def ite(zahyo):
    for z in zahyo:
        for z_ in zahyo:
            if z==z_ or z > z_ :
                continue
            else:
                if z_ - z > k:
                    print(":(")
                    return None
    print("Yay!")
    return None
ite(zahyo)

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
k = int(input())
ans = False
for i in a:
    for j in a:
        if abs(i - j) > k:
            ans = True
print (':(' if ans else 'Yay!')

Submission status: Accepted

Solution code:
import sys
a = []
for i in range(5):
    a.append(int(input()))
k = int(input())
for i in range(5):
    for j in range(5):
        if a[i] - a[j] > k:
            print(':(')
            sys.exit()
print('Yay!')

Submission status: Accepted

Solution code:
import numpy as np

num = [] #5このアンテナ

for i in range(5): #入力
    a = input()
    num.append(int(a))

k=int(input())

num.sort()

ran=num[4]-num[0]

if ran > 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:
a_k = [int(input()) for _ in range(6)]

if a_k[4] - a_k[0] > a_k[5]:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

Solution code:
a = []
b = "Yay!"
for i in range(6):
    a.append(int(input()))
for i in range(5):
    for j in range(5):
        if a[5-i] - a[j] > a[5]:
            b = ":("
print(b)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
ans='Yay!'
data=[]
for i in range(5):
    data.append(int(input()))

K=int(input())
for i in range(5):
    for j in  range(i,5):
        if abs(data[i]-data[j])>K:
            ans=':('
            break

print(ans)

Submission status: Accepted

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