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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys

a = np.zeros(5)
for i in range(5):
    a[i] = int(input())

k = int(input())

r = a.max() - a.min() < k
print("Yay!" if r else ":(")

Submission status: Wrong Answer

Solution code:
# 2019/04/06
# AtCoder Beginner Contest 123 - A

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

# Calc
if a > k or b > k or c > k or d > k or e > k:
    ans = ":("
else:
    ans = "Yay!"

# Output
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

a = ni()
b = ni()
c = ni()
d = ni()
e = ni()
k = ni()

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

Submission status: Wrong Answer

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

k = int(input())
c =0
for i in range(4):
    if a[i+1] - a[i] > k:
        c += 1
    
if c != 0:
    print(':(')
else:
    print('Yay!')

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
aa = [int(input()) for _ in range(6)]
for i in range(4):
    if aa[i+1] - aa[i] > aa[5]:
        print(':(')
        break
else:
    print('Yay!')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
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: Wrong Answer

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

Submission status: Time Limit Exceeded

Solution code:
a_list = []

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

N = int(input())

ctr = 0

flag = 0

while ctr <= 5:
  if a_list[ctr+1] - a_list[ctr] >= N:
    flag += 1

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

Submission status: Time Limit Exceeded

Solution code:
import math
for a in range(10**7):
    print(1)

Submission status: Time Limit Exceeded

Solution code:
import math
for a in range(10**8):
    print(1)

Submission status: Time Limit Exceeded

Solution code:
import math
for a in range(10**12):
    print(1)

Submission status: Accepted

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

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


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

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







if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

if k < maximum - minimum:
    ans = ':('
else:
    ans = 'Yay!'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

flg = False

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

Submission status: Accepted

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

Submission status: Accepted

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

y = max(distance_list)
if y <= k:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

Solution code:
def main():
    # n = int(input())
    # n, m = map(int, input().split())
    # a = list(map(int, input().split()))
    # s = input()
    # h = [int(input()) for _ in rane(n)]
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    k = int(input())
    if abs(a-b)>k or abs(a-c)>k or abs(a-d)>k or abs(a-e)>k or abs(b-c)>k or abs(b-d)>k or abs(b-e)>k or abs(c-d)>k or abs(c-e)>k or abs(d-e)>k:
        print(":(")
    else:
        print("Yay!")


if __name__ == '__main__':
    main()

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 abs(a-e) <= k else ":(")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

k = int(input())

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

print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num_list = []
count_cant_go = 0

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

num_list.append(int(input()))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(5)]
k=int(input())
for i in range(4):
    for j in range(i+1,5):
        if a[j]-a[i]>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("Yay!")
else:
  print(":(")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
import numpy as np
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(a, b, c, d, e, k):
    arr = np.array([a, b, c, d, e])
    # print(arr)
    arr, arr2 = [a.flatten() for a in np.meshgrid(arr, arr)]
    # print(arr)
    arr = np.c_[arr, arr2]
    # print(arr)
    arr = np.array(list(map(lambda x: abs(x[0] - x[1]), arr)))
    # print(arr)
    print(':(' if arr.max() > k else 'Yay!')


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

    # # test
    # from random import randint
    # from func import random_str
    # solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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


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


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


main()

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(":(")
else:
    print("Yay!")

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

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('Yay!')
else:
    print(':(')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


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


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

    A.append(int(input()))

    A.append(int(input()))

    A.append(int(input()))

    A.append(int(input()))

    k = int(input())


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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
li=[]

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

k=int(input())

li.sort()


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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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


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

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

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

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


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

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

    print('Yay!')
    return


if __name__ == '__main__':
    main()

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("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 A[j]-A[i] > k:
            print(':(')
            exit(0)
print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

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

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:
#!/usr/bin/env python3
import sys


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



# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
a = [int(input()) for i in range(6)]
if a[4]-a[0]<=a[5]:
  print("Yay!")
else:
  print(":(")

Submission status: Accepted

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

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:
def solve():
    import sys
    read = sys.stdin.read
    *s, k = map(int, read().split())
    flg = True
    for a in s:
        for b in s:
            if abs(a - b) > k:
                flg = False
    print("Yay!" if flg else":(")

solve()

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

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

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

Submission status: Accepted

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

flag = True

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

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

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

Submission status: Accepted

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

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

if max_distance <= k:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

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

max_num = a
min_num = a
if b < min_num:
    min_num = b
if b > max_num:
    max_num = b

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

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

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

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

Submission status: Accepted

Solution code:


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys


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


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import itertools

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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())
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:
ans = 0
a = [0]*6

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

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

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