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

ans = 'Yay!'
for i in range(len(distances) - 1):
    for j in range(i + 1, len(distances)):
        if k < abs(distances[i] - distances[j]):
            ans = ':('
            
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from itertools import combinations
import sys


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    print(":(" if any(
        abs(x1 - x2) > k
        for x1, x2 in combinations([a, b, c, d, e], 2)
    ) else "Yay!")


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

l = inputILs(6)

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

Submission status: Accepted

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

flag = True

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

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def main():
    A = []
    for i in range(5):
        A.append(int(input()))
    m = int(input())
    ans = 'Yay!'
    for i in range(len(A)):
        for j in range(len(A)):
            if abs(A[i] - A[j]) > m:
                ans = ':('
    print(ans)
    
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())

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

Submission status: Accepted

Solution code:
abcde = [int(input()) for _ in range(5)]
k = int(input())
ans = 0
for i in range(4):
    for j in range(i+1,5):
        if abcde[j] - abcde[i] > k:
            ans += 1
if ans == 0:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')
# ----------------------------------------------------------- #

A = IR(5)
k = I()
for x, y in combinations(A, 2):
    if abs(x-y) > 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:
from itertools import combinations

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

distances = [abs(p1 - p2) for p1, p2 in combinations(positions, 2)]
result = all([d <= k for d in distances])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    tmp = input()
    a.append(int(tmp))
k = int(input())
ans = True
for i in range(len(a)):
    for j in range(i, len(a)):
        if(a[j] - a[i] > k):
            ans = False
if ans:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
d = [int(input()) for i in range(5)]
k = int(input())
ans = 'Yay!'
for i in d:
    for j in d:
        if abs(i-j)>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())

from itertools import permutations, combinations,combinations_with_replacement,product
ls = [a,b,c,d,e]
comb = list(combinations(ls,2))

flag=0
for i in range(10):
    sa = abs(comb[i][1] - comb[i][0])
    if sa > k:
        flag=1

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

Submission status: Accepted

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

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

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
from itertools import combinations

input = sys.stdin.readline


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

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

    print(ans)


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())
mi = min(a, b, c, d, e)
ma = max(a, b, c, d, e)
if ma - mi > k:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def ABC_123_A():

    a = [0 for i in range(6)]

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

    for i in range(5):
        for j in range(4):
            if i+j+1 <= 4:
                if abs(a[i] - a[i+j+1]) > a[5]:
                    count=1
                else:
                    count+=0
            else:
                count+=0
    if count == 1:
        print(':(')
    else:
        print('Yay!')

if __name__ == '__main__':

    ABC_123_A()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
k = int(input())
ans = "Yay!"
for ai in a:
  for aj in a:
    if ai-aj > 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())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

if __name__ == "__main__":
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    k = int(input())
    l_an = [a, b, c, d, e]
    ret = "Yay!"
    for i in list(itertools.combinations(l_an, 2)):
        if i[1] - i[0] > k:
            ret = ":("
            break
    print(ret)

Submission status: Accepted

Solution code:
import math
a=[int(input()) for i in range(5)]
b=int(input())
count=0
for i in a:
  for j in a:
    if math.fabs(i-j)>b:
      count+=1
    else:
      continue
if count!=0:
  print(':(')
else:
  print('Yay!')

Submission status: Accepted

Solution code:
import itertools
import math

antena = []
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))
k = int(input())
for v in itertools.combinations(antena, 2):
    if v[1] - v[0] > k:
        print(":(")
        quit()
print('Yay!')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# N = int(input())
# S = input()
d = []
for _ in range(5):
    d.append(int(input()))
if max(d) - min(d) <= int(input()):
    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())
for x,y in itertools.permutations([a,b,c,d,e],2):
    if x-y > 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())
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())
x = max(a)
y = min(a)
if x-y > k:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

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

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

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

Submission status: Accepted

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

K = int(input())

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

print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC123A

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if   ant[1] - ant[0] > k: print(":(")
elif ant[2] - ant[0] > k: print(":(")
elif ant[3] - ant[0] > k: print(":(")
elif ant[4] - ant[0] > k: print(":(")
elif ant[2] - ant[1] > k: print(":(")
elif ant[3] - ant[1] > k: print(":(")
elif ant[4] - ant[1] > k: print(":(")
elif ant[3] - ant[2] > k: print(":(")
elif ant[4] - ant[2] > k: print(":(")
elif ant[4] - ant[3] > k: print(":(")
else: print("Yay!")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
temp_list = [int(input()) for _ in range(6)]
print(":(" if temp_list[4] - temp_list[0] > temp_list[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())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def five_antennas(li, k):

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

if __name__ == '__main__':
    main()

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

for v in itertools.combinations([a, b, c, d, e], 2):
    if (v[1]-v[0]) > 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())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
# A - Five Antennas

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 - Five Antennas

ma = 0
mi = 124

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

k = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

k=int(input())

if k<lis[4]-lis[0]:
  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:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
x = [a, b, c, d, e]
k = int(input())
count = 0
for i in range(0, 5):
  for j in range(0, 5):
    if int(x[i]) > int(x[j]):
      q = int(x[i]) - int(x[j])
      if q > k:
        count = 1
    elif int(x[i]) < int(x[j]):
      p = int(x[j]) - int(x[i])
      if p > k:
        count = 1
if count == 1:
  print(':(')
else:
  print('Yay!')

Submission status: Accepted

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

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

print('Yay!')

Submission status: Accepted

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

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]
if max(l)-min(l)>k:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

Solution code:
#copy

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 main():
    p = [int(input()) for i in range(5)]
    k = int(input())
    com_flag = True
    for i in range(5-1):
        for j in range(i+1, 5):
            if p[j] - p[i] > k:
                com_flag = False
    if com_flag:
        print("Yay!")
    else:
        print(":(")
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

j = aaa[4] - aaa[0]

if j > aaa[5]:
  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())
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 (e-a)>k:
  print(':(')
else:
  print('Yay!')

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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