Problem:


﻿Score: 100 points

Problem Statement

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

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

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

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

Constraints

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

a < b < c < d < e

Input

Input is given from Standard Input in the following format:

a
b
c
d
e
k

Output

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

Sample Input 1

1
2
4
8
9
15

Sample Output 1

Yay!

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

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

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

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

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

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

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

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

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

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

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

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

Sample Input 2

15
18
26
35
36
18

Sample Output 2

:(

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



Sample input:
1
2
4
8
9
15


Sample output:
Yay!

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
l = []

for i in range(5):
    b = int(input())
    l.append(b)

k = int(input())

a = []
for i in range(4):
    for j in range(i+1,5):
        ans = l[j]-l[i]
        a.append(ans)

b = 0

for i in range(10):
    if a[i]>k:
        b = 1
        break

if b == 1:
    print(':(')
elif b == 0:
    print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def finder(antena,k):
    A = antena[0]
    notAs = antena[1:]
    for notA in notAs:
        if (notA-A)>k:
            return print(':(')
        
        elif len(notAs)==2:
            return print('Yay!')
    return finder(notAs,k)

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

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

finder(antena,k)

Submission status: Accepted

Solution code:
# coding: utf-8

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

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  6 20:38:26 2019

@author: Yamazaki Kenichi
"""

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=sorted([int(input()) for _ in range(5)])
print("Yay!" if a[4]-a[0]<=int(input()) else ":(")

Submission status: Accepted

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

k = int(input())
dis = 0

for i in range(4):
    for j in range(i+1, 5):
        dis = antena[j] - antena[i]
        if dis > k:
            print(":(")
            exit()
        dis = 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())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if abs(max(lst) - min(lst)) > int(input()):
    print(":(")
    quit()

print("Yay!")

Submission status: Accepted

Solution code:
t = [int(input()) for i in range(5)]
k=int(input())
n_1=0
n_2=0
for i in reversed(range(5)):
    for j in range(0,i):
        if k<(t[i] - t[j]):
            n_1=n_1+1
if n_1>0:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

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

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

for i in range(5):
    a.append(int(input()))
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 = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a > k :
  print(":(")
elif e-a <= k:
  print("Yay!")
elif e-b > k:
  print(":(")
elif e-b <= k:
  print("Yay!")
elif e-c > k:
  print(":(")
elif e-c <= k:
  print("Yay!")
elif e-d > k:
  print(":(")
elif e-d <= k:
  print("Yay!")

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = [int(input()) for _ in range(6)]
for i, l in enumerate(A[0:4]):
  for l2 in A[i+1:5]:
    if not (l2-l <= A[5]):
      print(':(')
      quit()
print('Yay!')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 17:52:43 2019

@author: nakamuratakayuki
"""

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

Submission status: Accepted

Solution code:
from sys import stdin

data = []
for i in range(5):
    data.append(int(stdin.readline().rstrip()))

k = int(stdin.readline().rstrip())

cnt = 1

for i in range(len(data)):
    for j in range(cnt,5):
        if abs(data[i] - data[j]) > k:
            print(":(")
            exit()
    cnt += 1


print("Yay!")

Submission status: Accepted

Solution code:
nums = []
flg = True
for _ in range(5):
    nums.append(int(input()))
k = int(input())
nums = nums[::-1]
for i in range(5):
    for j in range(i,5):
        if k < nums[i]-nums[j]:
            flg = False
if flg:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
lis = []
for i in range(5):
  lis.append(int(input()))
k = int(input())
t = 0
lis_b = lis[1:]
lis_c = lis[2:]
lis_d = lis[3:]
lis_e = lis[4:]
for item in lis_b:
  if abs(item - lis[0]) > k:
    print(":(")
    exit()
for item in lis_c:
  if abs(item - lis[1]) > k:
    print(":(")
    exit()
for item in lis_d:
  if abs(item - lis[2]) > k:
    print(":(")
    exit()
for item in lis_e:
  if abs(item - lis[3]) > k:
    print(":(")
    exit()
  
print("Yay!")

Submission status: Accepted

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

min_num = min(num)
max_num = max(num)
if max_num - min_num > num[5]:
	print(":(")
else:
	print("Yay!")

Submission status: Accepted

Solution code:
a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
k = int(input())
for i in range(len(a)):
	for j in range(i+1 , len(a) - i):
		if(a[j] - a[i] > k):
			print(':(')
			exit()
		else:
			continue
	if(i == 4):
		print('Yay!')

Submission status: Accepted

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

ans = "Yay!"
for i in range(5):
    for j in range(5):
        if abs(A[i] - A[j]) > k:
            ans = ":("
print(ans)

Submission status: Accepted

Solution code:
hoge = [int(input()) for i in range(6)]
k = hoge[-1]


ans = []
for i in range(5):
    for t in range(i+1,5):
        ans.append(abs(hoge[i]-hoge[t]))

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

Submission status: Accepted

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


list = [a,b,c,d,e]
flag = 0


for first_num in list:
    for second_num in list:
        if (int(first_num) - int(second_num)) > abs(int(k)):
          flag = 1

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

Submission status: Accepted

Solution code:
antenas = [int(raw_input()) for i in range(5)]
dist = int(raw_input())
antenas.sort()
antenas2 = antenas

dists = [antenas2[j]-antenas[i] for i in range(5) for j in range(5)]

n = sum(i > dist for i in dists)
if n == 0:
    print "Yay!"
else:
    print ":("

Submission status: Accepted

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

Submission status: Accepted

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

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:
a=list()
for i in range(5):
  a.append(int(input()))
k=int(input())
flag=True
for i in range(4):
  for j in range(i,5):
    if a[i]-a[j]>k or a[j]-a[i]>k:
      flag=False
if flag==True:
  print("Yay!")
else:
  print(":(")

Submission status: Accepted

Solution code:
xs = []
for x in range(5):
   xs.append(int(input()))
k = int(input())
if max(xs) - min(xs) > 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 = [a,b,c,d,e]
ans = 'Yay!'
for i in range(len(l)):
    for x in range(i+1,len(l)):
        if abs(l[i] - l[x]) > abs(k):
            ans = ':('
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

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

result = 'Yay!'

for each in itertools.combinations(a[0:len(a)-1], 2):
    if abs(each[0] - each[1]) > a[-1]:
        result = ':('

print(result)

Submission status: Accepted

Solution code:
a = []
for i in range(6):
    a.append(int(input()))
f = 1
amax = max(a)
amin = min(a)
for i in range(5):
    if abs(amax - a[i]) <= a[-1] and abs(amin - a[i]) <= a[-1]:
        continue
    else:
        f = 0
if f:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
list = []
list.append(input())
list.append(input())
list.append(input())
list.append(input())
list.append(input())

k = input()

ju = "Yay!"

for i in range(5):
    for j in range(5):
        if i == j:
            pass
        else:
            dis = abs(int(list[i]) - int(list[j]))
            if dis > int(k):
                ju = ":("

print(ju)

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

# 出力
max_distance = e - a
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())

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

Submission status: Accepted

Solution code:
from sys import stdin

lst = []
maxv = 0
for i in range(5):
    p = int(stdin.readline().rstrip())
    lst.append(p)
for i in range(4):
    a = lst[i]
    for j in range(5):
        b = lst[j]
        tmp = abs(a-b)
        if tmp > maxv:
            maxv = tmp

k = int(stdin.readline().rstrip())
if maxv <= k:
    ans = "Yay!"
else:
    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())
A =[a,b,c,d,e]
A.sort(reverse=True)
K = []
for i in range(len(A)-1):
  for j in range(i+1,len(A)):
    K.append(A[i]-A[j])
Max = 0
for n in range(len(K)):
  Max = max(Max,K[n])
if (Max <= k):
  print("Yay!")
else:
  print(":(")

Submission status: Accepted

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

for n in range(4):
    for x in range(n+1,5):
        if (a[x]-a[n])>k:
            print(":(")
            exit()

print("Yay!")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
for i in range(6):
    inp = input()
    if i == 0: minn = int(inp)
    elif i == 4: maxn = int(inp)
    elif i == 5: k = int(inp)
    
if maxn - minn <= k:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

Solution code:
# coding: utf-8

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

k = int(input())

if antena[4] - antena[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 -*-
import sys
import os
import itertools
from math import *

pos = []
for i in range(5):
  pos.append(int(input()))
  
dist = int(input())

for i in list(itertools.product(range(5), range(5))):
  if abs(pos[i[0]] - pos[i[1]]) > dist:
    print(':(')
    exit()

print('Yay!')

Submission status: Accepted

Solution code:
import sys

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

k = int(input())

for i in range(0, len(abc_list)):
    for j in range(0, len(abc_list)):
        if i == j:
            continue
        if abs(abc_list[i] - abc_list[j]) > 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())
k = int(input())

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

Submission status: Accepted

Solution code:
num_a = 5
antennas = [int(input()) for _ in range(num_a)]
k = int(input())
exist = False
for q in range(num_a - 1, 0, -1):
    for p in range(q - 1, -1, -1):
        if antennas[q] - antennas[p] > k:
            exist = True
            break

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy
import scipy

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

ends = False

for i in range(4):
    for j in range(i,5):
        if (p[j] - p[i] > k):
            print(':(')
            ends = True
            break

    if ends:
        break

if not ends:
    print('Yay!')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

n = int(input())
for j in range(5):
             for k in range(5):
                 if -n <= a[j]-a[k] <= n:
                     pass
                 else:
                     b = ":("
                     break
if b == ":(":
             print(b)
else:
             print("Yay!")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
lst = [a, b, c, d, e]
flag = 0
for i in range(0, 4):
    for j in range(1, 5 - i):
        if lst[i + j] - lst[i] > k:
            print(':(')
            flag = 1
            break
    if flag == 1:
        break
    if i == 3:
        print('Yay!')

Submission status: Accepted

Solution code:
import numpy as np

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

n=np.sort(n)
if n[4]-n[0] <= l:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

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

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
        lines.append(input())
        lines.append(input())
        lines.append(input())
        lines.append(input())
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]


    a_e = [int(e) for e in lines[:5]]
    k = int(lines[5])

    return (a_e, k)


def solve(a_e, k):

    result = False
    for i in range(5):
        for j in range(i+1, 5):
            if a_e[j] - a_e[i] > k:
                result = True
                break

        if result:
            break
    if result:
        res = ':('
    else:
        res = 'Yay!'           

    return res 


def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

Submission status: Accepted

Solution code:
#file a.py
lis = [int(input()) for x in range(5)]
k = int(input())

for _ in range(1,5):
    for x in range(5-_):
        ans_flag = lis[x] - lis[_]

        if abs(ans_flag) > k:
            flag = 0
        else:
            flag = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in s:
    for j in s:
        if (i-j)**2 > k**2:
            print(":(")
            count+=1
            break
    if count == 1:
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(5):
    for j in range(i, 5):
        if(pos[j] - pos[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())
ant = [a,b,c,d,e]
trig=0
for m in range(5):
  for i in range(5):
    if -k <= (ant[m]-ant[i]) and (ant[m]-ant[i]) <=k:
      pass
    else: 
      trig = 1
      break

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

Submission status: Accepted

Solution code:
antennas = [int(input()) for _ in range(5)]
k = int(input())
if max(antennas) - min(antennas) > 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 b-a<=k and c-a<=k and d-a<=k and e-a<=k and c-b<=k and d-b<=k and e-b<=k and d-c<=k and e-c<=k and e-d<=k:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

Solution code:
List=[int(input()) for i in range(5)]
k = int(input())
judge = False
for i in range(len(List)):
    for j in range(len(List)):
        if k < abs(List[i]-List[j]):
            print(":(")
            judge = True
            break
    if  judge:
        break
if judge != True:
    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())

intlist = []

intlist.append(a)
intlist.append(b)
intlist.append(c)
intlist.append(d)
intlist.append(e)


flag = 0

for i in range(len(intlist)):
	for j in range(i, len(intlist)):

		if i != j:
			if intlist[j] - intlist[i] > k:
				flag = 1
				break


	if flag == 1:
			break

if flag == 1:
	print(":(")

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

Submission status: Accepted

Solution code:
import itertools
A=[int(input()) for _ in range(5)]
K=int(input())
AL=list(itertools.combinations(A, 2))
flg=False
for t in AL:
  if t[1] - t[0] > K:
    flg=True
print(":(" if flg else "Yay!")

Submission status: Accepted

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

cons = [int(a), int(b), int(c), int(d), int(e)]

flag = 0
for i in range(len(cons)):
    # print(cons[i])
    # print(cons[-1])
    j = 1
    while(True):
        diff = cons[-j] - cons[i]
        if diff > k:
            print(':(')
            flag = 1
            break
        if diff == 0:
            break
        j += 1
    if flag == 1:
        break
else:
    if flag == 0:
        print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def start_process(length, num):

    print(ans)

def main():
    a = [int(input()) for i in range(5)]
    # b = int(input())
    # c = int(input())
    # d = int(input())
    # e = int(input())
    k = int(input())
    flg = 0
    for i in range(5):
        for j in range(i + 1, 5):
            if a[j] - a[i] > k:
                flg = 1
                break

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

def kari():
    a = list(map(int, input().split()))
    a, b = map(int, input().split())

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

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

a_e=nums[0:5]
k=nums[5]

comb=list(itertools.combinations(a_e, 2))

cnt=0
for c in comb:
  if abs(c[0]-c[1])>k:
    cnt+=1
    
if cnt!=0:
  print(":(")
else:
  print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

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

flg = 0

if e-a > k:
    flg = -1
elif d-a > k:
    flg = -1
elif c-a > k:
    flg = -1
elif b-a > k:
    flg = -1

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

Submission status: Accepted

Solution code:
antennas = []

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

k = int(input())

available = True

for send in range(5):
  if not available:
    break
  for receive in range(5):
    if antennas[receive] - antennas[send] > k:
      available = False
      break

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

Submission status: Accepted

Solution code:
num = []

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

k = int(input())
ans = True

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

output = "Yay!"
for a in antennas:
    for b in antennas:
        if abs(a-b) > distance:
            output = ":("
print(output)

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in l:
    for j in l:
        if abs(i-j) > k:
            print(':(')
            exit()

print('Yay!')

Submission status: Accepted

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


from sys import stdin


############################################


# read data for n sequences.
input=[]
for _ in range(6):
    input.append(int(stdin.readline().split()[0]))
k=input[5]

ant = input[0:5]

x=0
for a in ant[:4]:
    for b in ant[1:]:
        if b-a <= k:
            continue
        else:
            x=1
            break

if x==0:
    print("Yay!")
else:
    print(":(")
#data = [int(stdin.readline().rstrip()) for _ in range(n)]

Submission status: Accepted

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

flag = True

for i in range(5):
  for j in range(i):
    if abs(ps[i] - ps[j]) > k:
      flag = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
an = "Yay!"

ae = e-a

if ae > k:
    an = ":("

print(an)

Submission status: Accepted

Solution code:
import numpy as np

i = 0
nums = []

while i < 5:
  nums.append(int(input()))
  i += 1
  
k = int(input())

if max(nums) - min(nums) <= k:
  print("Yay!")
else:
  print(":(")

Submission status: Accepted

Solution code:
# coding: utf-8

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

K = int(input())
ans = 'Yay!'

if K < (S[4] - S[0]):
    ans = ':('

print(ans)

Submission status: Accepted

Solution code:

a=[]
for i in range(6):
    a.append(int(input()))
f=True
for i in range(3):
    for j in range(6-i):
        if a[5]<abs(a[i]-a[j]):
            f=False
if f:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

Solution code:
atn = [int(input()) for i in range(5)]
k = int(input())
b = 1
for i in range(4):
    for j in range(4 - i):
        if abs(atn[i] - atn[i + j + 1]) > k:
            b = 0

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

Submission status: Accepted

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

a_b=abs(a-b)
a_c=abs(a-c)
a_d=abs(a-d)
a_e=abs(a-e)

b_c=abs(b-c)
b_d=abs(b-d)
b_e=abs(b-e)

c_d=abs(c-d)
c_e=abs(c-e)

d_e=abs(d-e)
if a_e > k:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

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

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