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:

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

Submission status: Accepted

Solution code:
def five_antennas(a,n):
    kyori = a[n-1]
    for i in range(n-1):
        for j in range(n-1):
            if i != j:
                distance = abs(a[i] - a[j])
                if kyori < distance:
                    return ":("
    return "Yay!"

if __name__ == '__main__':
    a = []
    for i in range(6):
        a.append(int(raw_input()))

    print five_antennas(a,6)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
grid = [0] * 6

result = 'Yay!'

for i in range(len(grid)):
  grid[i] = int( input() )

  
for i in range(len(grid)-2):
  for j in range(i+1,len(grid)-1):
    #print( "{:d}, {:d},".format(grid[i], grid[j]))
    if grid[j] - grid[i] > grid[len(grid)-1]:
      result = ':('
      break

print( result )
#print( grid )

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from fractions import gcd

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

k = int(input())

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

print("Yay!")

Submission status: Accepted

Solution code:
antenna = [int(input()) for i in range(5)]
k = int(input())
judge = ''
i,j = 1,1
for i in range(5):
  for j in range(i+1,5):
    if abs(antenna[i]-antenna[j]) > k:
      judge = ':('
      break

if judge==':(':
  print(':(')
else:
  print('Yay!')

Submission status: Accepted

Solution code:
a=int(input())
input();input();input();
e=int(input())
k=int(input())
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())

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:
a = [int(input()) for x 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 or d - a > k or c - a > k or b - a > k:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

Solution code:
a = []

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

k = int(input())

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

Submission status: Accepted

Solution code:
startD = int(input())
for i in range(3):
  input()
endD = int(input())

if endD-startD > int(input()):
  print(":(")
else:
  print("Yay!")

Submission status: Accepted

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

res='Yay!'

for i in range(4):
	for j in range(i+1,5):
		if x[j]-x[i]>x[5]:
			res=':('
			break

print(res)

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
k = int(input())
if a[4]-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:
import numpy as np

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

flag=True
for i in range(5):
  temp_posi_list = posi_list.copy()
  posi = temp_posi_list[i]
  del temp_posi_list[i]
  temp_posi_list = np.array(temp_posi_list)
  max_dist = max(np.abs(temp_posi_list - posi))
  if max_dist > k:
    flag=False
    break
if flag:
  print("Yay!")
else:
  print(":(")

Submission status: Accepted

Solution code:
*a,k=map(int,open(0));print(("Yay!",":(")[a[4]-a[0]>k])

Submission status: Accepted

Solution code:
*a,k=map(int,open(0));print("Y:a(y !"[a[4]-a[0]>k::2])

Submission status: Accepted

Solution code:
*a,k=map(int,open(0));print("Y:a(y !"[max(a)-min(a)>k::2])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = [input() for i in range(6)]
X = list(map(int, A))
a = X[0]
e = X[4]
k = X[5]
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:
import sys

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

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

"""
0 1234
1 234
2 34
3 4
"""

Submission status: Accepted

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

k = int(input())

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

Submission status: Accepted

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

x = list[:5]
k = list[5]
err = False

for i, x1 in enumerate(x):
    for j, x2 in enumerate(x[i+1:]):
        if abs(x1-x2)>k:
            err = True

if err:
    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())
l = [a,b,c,d,e]
if (max(l) - min(l)) > k:
  print(':(')
else:
  print('Yay!')

Submission status: Accepted

Solution code:

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

ok = True
for x in xs:
    for y in xs:
        if abs(x-y) > k:
            ok = False

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

Submission status: Accepted

Solution code:
a=int(input())
input()
input()
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())
ans = True
if b - a > k:
    ans = False
if c - a > k:
    ans = False
if d - a > k:
    ans = False
if e - a > k:
    ans = False
if c - b > k:
    ans = False
if d - b > k:
    ans = False
if e - b > k:
    ans = False
if d - c > k:
    ans = False
if e - c > k:
    ans = False
if e - d > k:
    ans = False
if ans:
    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:
# -*- coding: utf-8 -*-
import sys


def get_num():
    return int(input())


def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


def get_numbers():
    return map(int, input().split())


antennas = get_nums(5)
k = get_num()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
cnt = 0
*ant_locs, k = [int(input()) for _ in range(6)]
for idx_i, loc_i in enumerate(ant_locs):
    for idx_j, loc_j in enumerate(ant_locs):
        if idx_j >= idx_i:
            break
        if abs(loc_i - loc_j) > k:
            cnt += 1
            
print("Yay!" if cnt == 0 else ":(")

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_arr = []
a_arr.append(int(input()))
a_arr.append(int(input()))
a_arr.append(int(input()))
a_arr.append(int(input()))
a_arr.append(int(input()))
k = int(input())

d = a_arr[4]-a_arr[0]

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

Submission status: Accepted

Solution code:
d = list(int(input()) for i in range(5))
k = int(input())
ans = 'Yay!'
for i in range(4):
    for j in range(4-i):
        if d[4-j] - d[i] > k:
            ans = ':('

print(ans)

Submission status: Accepted

Solution code:
N = [int(input()) for i in range(6)] 
count = 0
for i in range(5):
  for j in range(5):
    if abs(N[i]-N[j]) > N[5]:
      count += 1

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

Submission status: Accepted

Solution code:
place = [int(input()) for _ in range(5)]
k = int(input())
bomb = 0
for p in range(len(place) - 1):
  for p_dash in range(p, len(place)):
    if place[p_dash] - place[p] > k:
      bomb += 1
      break
if bomb == 0:
  print('Yay!')
else:
  print(':(')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=[int(input()) for _ in range(5)]
k=int(input())
ans=0
for i in range(len(n)):
  for j in range(len(n)):
    if abs(n[i]-n[j]) > k:
      ans+=1

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

Submission status: Accepted

Solution code:

A = [0, 0, 0, 0, 0]
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
k = int(input())

flg = 0

for i in range(0, 4, 1):
    if flg == 1:
        break

    for j in range(i+1, 5, 1):
        if k < (A[j] - A[i]):
            flg = 1
            print(":(")
            break

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

Submission status: Accepted

Solution code:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

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

mod = 1000000007

if __name__ == "__main__":
    a= int(sys.stdin.readline())
    b= int(sys.stdin.readline())
    c= int(sys.stdin.readline())
    d= int(sys.stdin.readline())
    e= int(sys.stdin.readline())
    k= int(sys.stdin.readline())

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

Submission status: Accepted

Solution code:
li = list(int(input()) for i in range(5))
#print(li)
k = int(input())

li1 = [(x - y) for x in li for y in li if x>y]
#print(li1)
if all(li1[i]<=k for i in range(len(li1))):
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
antennas = []

for _ in range(5):
    antenna = int(input())
    antennas.append(antenna)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

k = int(input())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a=[]
ans="Yay!"
for _ in range(6):
  a.append(int(input()))
for i in range(5):
  for j in range(i+1,5):
    if abs(a[i]-a[j])>a[5]:
      ans=":("
      break
print(ans)

Submission status: Accepted

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

# input
l = list()
for _ in range(5):
    l.append(int(input()))
k = int(input())

# solve
ans = True
for i in range(len(l)):
    for j in range(len(l) - i):
        if l[j] - l[i] > k:
            ans = False

# output
print('Yay!' if ans 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(":(")
    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()
if d - a > k:
    print(":(")
    exit()
if c - a > k:
    print(":(")
    exit()
if b - a > k:
    print(":(")
    exit()

print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

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

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

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() for i in range(3)]
e = int(input())
print('Yay!' if e - a <= int(input()) else ':(')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input = open(0).read
a, b, c, d, e, k = map(int, input().split())
print("Yay!" if max(a, b, c, d, e) - min(a, b, c, d, e) <= k else ":(")

Submission status: Accepted

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

if tmp[4]-tmp[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(":(")
else:
	print("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())
"""
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(":(s")
"""
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())
l = [
    b - a, c - a, d - a, e - a, c - b, d - b, e - b, d - c, e - c, e - d
]

for i in l:
    if i > 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())
num = [a,b,c,d,e]
flag = 0
for i in range(4):
    for j in range(i+1,5):
        if num[j] - num[i] > k:
            flag = 1
            break
    if flag == 1:
        break
if flag == 1:
    print(":(")
else:
    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:
lst = []
for i in range(0, 5):
	lst.append(int(input()))
K = int(input())
lst.sort(reverse = True)
ans = 'Yay!'
for i in range(0, 5):
	for j in range(i+1, 5):
		if lst[i] - lst[j] > K:
			ans = ':('
print(ans)

Submission status: Accepted

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

comb_dis = list(itertools.combinations(dis, 2))
#print(comb_dis)
for i in range(5):
    if abs(comb_dis[i][1] - comb_dis[i][0]) > k:
        print(":(")
        exit()


print("Yay!")

Submission status: Accepted

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

a.sort()
k = a[4]-a[0]
b = int(input())
if k <= b:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(5)]
b = int(input())
for i in range(5):
    for j in range(5):
        if a[j] - a[i] > b:
            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 = [0]*5
for i in range(5):
    a[i] = int(input())
k = int(input())

flag = True
for j in range(5):
    for l in range(j+1, 5):
        if abs(a[j] - a[l]) > 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())

lst = [a, b, c, d, e]
cnt = 0

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

print(":(") if cnt > 0 else print("Yay!")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
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 _ in range(5)]
k = int(input())
print("Yay!" if max(A) - min(A) <= k else ":(")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

    """ convenient functions
    # for i, a in enumerate(iterable)
    # q, mod = divmod(a, b)
    # divmod(x, y) returns the tuple (x//y, x%y)
    # manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc127_f
    """

    import sys
    sys.setrecursionlimit(10**7)
    from itertools import accumulate, combinations, permutations, product # https://docs.python.org/ja/3/library/itertools.html
    # accumulate() returns iterator! to get list: list(accumulate())
    from math import factorial, ceil, floor
    def factorize(n):
        """return the factors of the Arg and count of each factor
        
        Args:
            n (long): number to be resolved into factors
        
        Returns:
            list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
        """
        fct = []  # prime factor
        b, e = 2, 0  # base, exponent
        while b * b <= n:
            while n % b == 0:
                n = n // b
                e = e + 1
            if e > 0:
                fct.append((b, e))
            b, e = b + 1, 0
        if n > 1:
            fct.append((n, 1))
        return fct
    def combinations_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        # TODO: How should I do when n - r is negative?
        if n < 0 or r < 0:
            raise Exception('combinations_count(n, r) not defined when n or r is negative')
        if n - r < r: r = n - r
        if r < 0: return 0
        if r == 0: return 1
        if r == 1: return n
        numerator = [n - r + k + 1 for k in range(r)]
        denominator = [k + 1 for k in range(r)]
        for p in range(2,r+1):
            pivot = denominator[p - 1]
            if pivot > 1:
                offset = (n - r) % p
                for k in range(p-1,r,p):
                    numerator[k - offset] /= pivot
                    denominator[k] /= pivot
        result = 1
        for k in range(r):
            if numerator[k] > 1:
                result *= int(numerator[k])
        return result
    def combinations_with_replacement_count(n, r):
        """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
        
        Args:
            n (long): number
            r (long): number
        
        Raises:
            Exception: not defined when n or r is negative
        
        Returns:
            long: number
        """
        if n < 0 or r < 0:
            raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
        elif n == 0:
            return 1
        else:
            return combinations_count(n + r - 1, r)
    from bisect import bisect_left, bisect_right
    from collections import deque, Counter, defaultdict # https://docs.python.org/ja/3/library/collections.html#collections.deque
    from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest # https://docs.python.org/ja/3/library/heapq.html
    from copy import deepcopy, copy # https://docs.python.org/ja/3/library/copy.html
    from operator import itemgetter
    # ex1: List.sort(key=itemgetter(1))
    # ex2: sorted(tuples, key=itemgetter(1,2))
    from functools import reduce
    def chmin(x, y):
        """change minimum
        if x > y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current minimum value
            y (long): potential minimum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x > y:
            x = y
            return (x, True)
        else:
            return (x, False)
    def chmax(x, y):
        """change maximum
        if x < y, x = y and return (x, True).
        convenient when solving problems of dp[i]
        
        Args:
            x (long): current maximum value
            y (long): potential maximum value
        
        Returns:
            (x, bool): (x, True) when updated, else (x, False)
        """
        if x < y:
            x = y
            return (x, True)
        else:
            return (x, False)

    from fractions import gcd # Deprecated since version 3.5: Use math.gcd() instead.
    def gcds(numbers):
        return reduce(gcd, numbers)
    def lcm(x, y):
        return (x * y) // gcd(x, y)
    def lcms(numbers):
        return reduce(lcm, numbers, 1)

    # first create factorial_list
    # fac_list = mod_factorial_list(n)
    INF = 10 ** 18
    MOD = 10 ** 9 + 7
    modpow = lambda a, n, p = MOD: pow(a, n, p) # Recursive function in python is slow!
    def modinv(a, p = MOD):
        # evaluate reciprocal using Fermat's little theorem:
        # a**(p-1) is identical to 1 (mod p) when a and p is coprime
        return modpow(a, p-2, p)
    def modinv_list(n, p = MOD):
        if n <= 1:
            return [0,1][:n+1]
        else:
            inv_t = [0,1]
            for i in range(2, n+1):
                inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
            return inv_t
    def modfactorial_list(n, p = MOD):
        if n == 0:
            return [1]
        else:
            l = [0] * (n+1)
            tmp = 1
            for i in range(1, n+1):
                tmp = tmp * i % p
                l[i] = tmp
            return l
    def modcomb(n, k, fac_list = [], p = MOD):
        # fac_list = modfactorial_list(100)
        # print(modcomb(100, 5, modfactorial_list(100)))
        from math import factorial
        if n < 0 or k < 0 or n < k: return 0
        if n == 0 or k == 0: return 1
        if len(fac_list) <= n:
            a = factorial(n) % p
            b = factorial(k) % p
            c = factorial(n-k) % p
        else:
            a = fac_list[n]
            b = fac_list[k]
            c = fac_list[n-k]
        return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p
    def modadd(a, b, p = MOD):
        return (a + b) % MOD
    def modsub(a, b, p = MOD):
        return (a - b) % p
    def modmul(a, b, p = MOD):
        return ((a % p) * (b % p)) % p
    def moddiv(a, b, p = MOD):
        return modmul(a, modpow(b, p-2, p))

    """ initialize variables and set inputs
    # initialize variables
        # to initialize list, use [0] * n
        # to initialize two dimentional array, use [[0] * N for _ in range(N)]
    # set inputs
        # open(0).read() is a convenient method:
        # ex) n, m, *x = map(int, open(0).read().split())
        #     min(x[::2]) - max(x[1::2])
        # ex2) *x, = map(int, open(0).read().split())
        #     don't forget to add comma after *x if only one variable is used
    # preprocessing
        # transpose = [x for x in zip(*data)]
        # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [(1, 4, 7), (2, 5, 8), (3, 6, 9)]
        # flat = [flatten for inner in data for flatten in inner]
        # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [1, 2, 3, 4, 5, 6, 7, 8, 9]
    # calculate and output
        # output pattern
        # ex1) print(*l) => when l = [2, 5, 6], printed 2 5 6
    """

    # functions used
    r = lambda: sys.stdin.readline().strip()
    r_int = lambda: int(r())
    R = lambda: list(map(int, r().split()))
    Rfloat = lambda: list(map(float, r().split()))
    Rtuple = lambda: tuple(map(int, r().split()))
    Rmap = lambda: map(int, r().split())

    """ how to treat input
    # single int: int(r())
    # single string: r()
    # single float: float(r())
    # line int: R()
    # line string: r().split()
    # line (str, int, int): [j if i == 0 else int(j) for i, j in enumerate(r().split())]
    # lines int: [R() for _ in range(n)]
    """

    if __name__ != '__main__':
        # for test
        sys.stdin = open('sample.txt')

    # ----------------------------------
    # main
    abcde = [int(r()) for _ in range(5)]
    k = int(r())
    for i in abcde:
        for j in abcde:
            if abs(i-j) > k:
                print(":(")
                exit()
    print("Yay!")
    # end of main
    # ----------------------------------

    """memo: how to use defaultdict of list
    # initialize
    Dic = defaultdict(list)
    # append / extend
    Dic[x].append(y)
    # for
    for k, v in Dic.items():
    """

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
k = int(input())
m = 0
for ai in a:
  for aj in a:    
    if m < abs(ai - aj):
      m = abs(ai - aj)
if m <= 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(":(")