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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import itertools

l = list()
for a in range(0, 5):
    l.append(int(input()))

k = int(input())

com = list(itertools.combinations(l, 2))

for a in range(0, len(com)):
    com[a] = list(com[a])
    com[a] = abs(com[a][0] - com[a][1])

ans = 'Yay!'

for a in com:
    if a > k:
        ans = ':('
        break

print(ans)

Submission status: Accepted

Solution code:
l=[]
for i in range(6):
    l.append(int(input()))
m = sorted(l[0:5])
if m[4]-m[0]<=l[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 abs(a - e) > 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:
data = [int(input()) for i in range(5)]
k = int(input())
flag = True
for i in range(len(data)-1):
    for j in range(i, len(data)):
        if data[j]-data[i] > k:
            flag = False

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

Submission status: Accepted

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

if (max(l)-min(l)) > 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(":(")
elif e-a<=k:
  print("Yay!")

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = IR(5)
    k = II()
    if max(a) - min(a) > k:
        print(":(")
    else:
        print("Yay!")
    return

#B
def B():
    a = IR(5)
    b = a[0]
    ans = 0
    for a_ in a:
        if a_ % 10 != 0:
            if b % 10> a_ % 10:
                b = a_
    flg = 0
    for a_ in a:
        if a_ != b or flg:
            ans += math.ceil(a_ / 10) * 10
        else:
            ans += b
            flg = 1
    print(ans)
            
    
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(a)-1):
    for j in range(i+1, len(a)):
        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 max(a,b,c,d,e) - min(a,b,c,d,e) > k:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

Solution code:
# A
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 = []
for i in range(5):
    x = int(input())
    l.append(x)
s = int(input())
if l[-1]-l[0]<=s:
    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_distance = e - a
can_communicate = max_distance <= k

answer = ':(' if not can_communicate else 'Yay!'
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = [int(input()) for _ 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(0)
print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A = [ir() for _ in range(5)]
K = ir()
length = A[-1] - A[0]
bl = length <= K
print('Yay!' if bl else ':(')

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A = [0] * 5
for i in range(5):
    A[i] = ir()

K = ir()
bl = A[-1] - A[0] <= K
print('Yay!' if bl 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:
D = []
for i in range (5):
  D.append(int(input()))
D.reverse()
k = int(input())

for i in range(len(D) - 1):
  for j in range(i + 1, len(D)):
    if D[i] - D[j] > k:
      # print("Di" + str(D[i]))
      # print("Dj" + str(D[j]))
      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 or b-a > k:
  print(":(")
else:
  print("Yay!")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a=int(input())
for i in range(3):
  z=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 (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:
p = [int(input()) for i in range(5)]
k = int(input())
if p[4]-p[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 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:
#!/usr/bin/env python3
a, b, c, d, e, k = [int(input()) for i in range(6)]
print('Yay!') if e - a <= k else print(':(')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
l = []
for _ in range(5):
    l.append(int(input()))
k = int(input())
for i in range(5):
    for j in range(i, 5):
        if l[j] - l[i] > k:
            print(":(")
            exit()
print("Yay!")

Submission status: Accepted

Solution code:
west=124
east=-1
for _ in range(5):
    x=int(input())
    west=min(x,west)
    east=max(x,east)
k=int(input())
if east-west>k:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

Solution code:
icase=0
if icase==0:
    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())

x = [a, b, c, d, e]
#print(min(x))
#print(max(x))
if (max(x) - min(x)) <= k:
    print("Yay!")
else :
    print(":(")

Submission status: Accepted

Solution code:
x = []
count = 0
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
k = int(input())
for i in range(len(x)):
     for j in range(i, len(x)):
          if abs(x[i] - x[j]) <= k:
               count += 0
          else:
               count += 1
if count == 0:
     print('Yay!')
else:
     print(':(')

Submission status: Accepted

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

v=e-a

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

Submission status: Accepted

Solution code:
numbers = []
for _ in range(6):
    numbers.append(int(input()))
predicted_value = "Yay!"
k_distance = numbers[-1]
antenas = numbers[:-1]
antenas.sort()
if antenas[-1] - antenas[0] > k_distance:
    predicted_value = ":("
print(predicted_value)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
l = [int(x) for x in sys.stdin.readlines()]
k = l[-1]
del l[-1]
pairs = list(itertools.combinations(l, 2))
flag = 0
for pair in pairs:
    if not max(pair) - min(pair) <= k:
        print(":(")
        flag += 1
        break
if not flag:
    print("Yay!")

Submission status: Accepted

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

ans= True
for i in range(len(lista)-1):
	for j in range(len(lista)-1):
		if (lista[i]-lista[j] > lista[-1]):
			ans = False	
if(ans):
	print("Yay!")
else:
	print(":(")

Submission status: Accepted

Solution code:
import math
lista = []
for x in range(0,5):
    lista.append(int(input()))
distanciaMaxima = int(input())
passou = 0
for x in range(len(lista)):
    for y in range(x,len(lista)):
        if abs(lista[x] - lista[y]) > distanciaMaxima:
            passou = 1
if passou == 0:
    print("Yay!")
elif passou == 1:
    print(":(")

Submission status: Accepted

Solution code:
t=4
v = []
while t>=0:
    v.append(int(input()))
    t = t-1

k = int(input())
n = 4
l = False
while n>=0:
    for i in range(n-1):   
        soma = v[n] - v[i]
        if soma > k:
            print(":(") 
            l = True
            break
    if l:
        n = -2
    else: 
        n = n-1
if n == -1:  
    print("Yay!")

Submission status: Accepted

Solution code:
def funcao(lista, reverse, k):
    for i in lista:
        for j in reverse:
            if abs(i-j) > k:
                return ":("
    return "Yay!"


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

lista.sort()
reverse = []
reverse = lista.copy()
reverse.reverse()

print(funcao(lista, reverse, k))

Submission status: Accepted

Solution code:
dist=[]
for x in range(0,5):
    dist.append(int(input()))
k=int(input())
sub=[]
for var1 in dist:
    for var2 in dist:
        if var1!=var2:
            sub.append(var2-var1)
max=max(sub)

if max<=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())
distancies = {
    "a_b": b - a,
    "a_c": c - a,
    "a_d": d - a,
    "a_e": e - a,
    "b_c": c - b,
    "b_d": d - b,
    "b_e": e - b,
    "c_d": d - c,
    "c_e": e - c,
    "d_e": e - d
}
print("Yay!") if all(v <= k for v in distancies.values()) 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())
sub=[]
sub.append(b-a)
sub.append(c-a)
sub.append(d-a)
sub.append(e-a)
sub.append(c-b)
sub.append(d-b)
sub.append(e-b)
sub.append(d-c)
sub.append(e-c)
sub.append(e-d)
max=max(sub)
if max<=k:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

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

for i in range(len(v)) :
    for j in range(i+1, len(v)):
        if(abs(v[i] - v[j]) > v[-1]):
            e = ':('

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

Submission status: Accepted

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

if(inp[-1]-inp[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())

antenas=[a,b,c,d,e]
teste = 1

for i in range(len(antenas)):
    for j in range(len(antenas)):
        if antenas[j]-antenas[i] > k:
            teste = 0
            break
if teste:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

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

Submission status: Accepted

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

ok = False
for i in xs:
    for j in xs:
        if max(i, j) - min(i, j) > k:
            ok = True

print(':(') if ok 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:
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 math
import collections
import sys

input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

num=[]
for i in range(5):
    num.append(I())
k=I()
if num[-1]-num[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:
city = [int(input()) for _ in range(5)]
k = int(input())
count = 0
for i in range(4):
  for j in range(i+1,5):
    if city[j]-city[i]>k:
      print(':(')
      exit()
print('Yay!')

Submission status: Accepted

Solution code:
aru = False
antenas = []
for i in range(5):
  k=int(input())
  antenas.append(k)
k=int(input())
for i in range(5):
  for t in range(i,5):
    if abs(antenas[i]-antenas[t])>k:
      aru = True
if aru:
  print(':(')
else:
  print("Yay!")

Submission status: Accepted

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

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

Submission status: Accepted

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

max_dist = int(input())

coords = {}

for i in range(len(antennas)):
  coords[i] = antennas[i]
flag = 1
for i in range(5):
  for j in range(i + 1, 5):
    if abs(coords[i] - coords[j]) > max_dist:
      print(':(')
      flag = 0
      break
  if flag == 0:
    break
if flag == 1:
  print('Yay!')

Submission status: Accepted

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

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

Submission status: Accepted

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

a.sort()
if a[4] - a[0] > k:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
A = [int(input()) for _ in range(5)]
K = int(input())

print("Yay!" if max(A)-min(A) <= K else ":(")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

line=[]

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

k = int(input())

out = "Yay!"

for i in range(5):
    for j in range(4-i):
        tmp = line[i] - line[j+1]

        if abs(tmp) > k:
            out = ":("

    if out == ":(":
        break

print(out)

Submission status: Accepted

Solution code:
a,b,c,d,e,f=[int(input()) for i in range(6)]
print("Yay!" if abs(a-e)<=f else ":(")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
for _ in range(3):
    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())
f = int(input())
 
 
if (e - a <= f):
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(5):
    for j in range(5):
        if n[i]-n[j] > k:
            print(':(')
            exit()

print("Yay!")

Submission status: Accepted

Solution code:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"

rows = [int(input()) for _ in range(6)]
k = rows.pop()

ans = "Yay!"
for i,v in enumerate(rows):
    for j in range(i+1,5):
        if rows[j] - v > k:
            ans = ":("
            break

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
A=b-a
B=c-a
C=d-a
D=e-a
F=c-b
G=d-b
H=d-c
I=e-b
J=e-c
K=e-d
if k>=A and k>=B and k>=A and k>=C and k>=D and k>=F and k>=G and k>=H and k>=I and k>=J and k>=K:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
line2 = []
for i in range(5):
    line = int(input())
    line2.append(line)
long = int(input())
if line2[4] - line2[0] <= long:
    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())

antena=[a,b,c,d,e]
antena.sort()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import sys
readline = sys.stdin.readline
read = sys.stdin.read

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

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

Submission status: Accepted

Solution code:
*l, k = map(int, open(0).read().split())
from itertools import permutations as pr
print(":(" if any(abs(i) > k for i in map(lambda x: x[0]-x[1], list(pr(l)))) else "Yay!")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = [0]*5
N = [int(input()) for x in range(5)]
k = int(input())
for i in range(4):
  for j in range(i,5):
    if k < N[j]-N[i]:
      print(':(')
      exit()
print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a = I()
b = I()
c = I()
d = I()
e = I()
k = I()
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 i in range(3):
    bcd=int(input())
e = int(input())
k=int(input())
if (e-a)>k:
    print(':(')
else:
    print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
antannas = [int(input()) for _ in range(5)]
k = int(input())
count = 0
for i in range(5):
    for j in range(i+1, 5):
        if antannas[j] - antannas[i] <= k:
            count += 1
if count == 10:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

List = sorted(List)

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

Submission status: Accepted

Solution code:
# ABC 123: A – Five Antennasa
a, b, c, d, e, k = [int(input()) for _ in range(6)]
print('Yay!' if e - a <= k else ':(')

Submission status: Accepted

Solution code:
# ABC 123: A – Five Antennas
a = [int(input()) for _ in range(5)]
k = int(input())

isExist = False

for i in range(5):
    for j in range(i, 5):
        if abs(a[i] - a[j]) > k:
            isExist = True

print('Yay!' if not isExist else ':(')

Submission status: Accepted

Solution code:
def main():
    l = [int(input()) for i in range(5)]
    k = int(input())
    if(l[-1]- l[0]> k):
        print(":(")
    else:
        print("Yay!")
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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