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

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

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:
import sys

antena = [0]*5

for i in range(5):
    antena[i] = int(input())
    
K = int(input())


for i in range(5):
    for j in range(i+1,5):
        if abs(antena[j]-antena[i]) > K:
            print(":(")
            sys.exit(0)

print("Yay!")

Submission status: Accepted

Solution code:
import sys


def solve(lines):
    lines = [int(x) for x in lines]

    a = lines[0]
    e = lines[4]
    k = lines[5]

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


if __name__ == '__main__':
    lines = sys.stdin.read()
    lines = lines.strip().split('\n')
    solve(lines)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from itertools import product
from collections import defaultdict
def inpl(): return list(map(int, input().split()))

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

for l, r in product(X[:5], repeat=2):
    if abs(l-r) > k:
        print(":(")
        break
else:
    print("Yay!")

Submission status: Accepted

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

print(':(' if x[::-1][0] - x[0] > 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!')
elif k < (e-a):
  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:
c = []
for i in range(5):
    c.append(int(input()))

k= int(input())

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

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 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:
lst = [int(input()) for _ in range(5)]
k = int(input())
for x in lst:
    for y in lst:
        if k < y - x:
            print(':(')
            exit(0)
print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

lis = []
for i in range(6):
    lis.append(I())
k = lis[5]
if lis[4] - lis[0] > k:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

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

fl = True
for i in li:
  for j in li:
    if abs(i-j) > k:
      fl = False
print('Yay!' if fl == True else ':(')

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    antenas = []

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

    k = int(input())

    antenas.sort()

    for a in antenas[1:]:
        if a - antenas[0] > k:
            print(':(')
            return

    print('Yay!')


main()

Submission status: Accepted

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

flag = False
for antena1 in reversed(antenas):
    for antena2 in antenas:
        if antena1 - antena2 > k:
            flag = True
if flag:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

Solution code:
from itertools import combinations

lst = [int(input()) for _ in range(6)]
lst_ = lst[0:5]
k = lst[5]
# print(lst_, k)

comb = list(combinations(lst_, 2))
# print(comb)

ans = "Yay!"
for c in comb:
    tmp = abs(c[0] - c[1])
    # print(tmp, k)
    if tmp > k:
        ans = ":("

print(ans)

Submission status: Accepted

Solution code:
import sys


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

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

flag = 0
for i in range(5):
    for j in range(4):
        if abs(atoe[i] - atoe[j+1]) <= k:
            continue
        else:
            flag = 1

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

Submission status: Accepted

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

max_distance = e-a

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

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 = [int(input()) for _ in range(5)]
k = int(input())
count = 0
for i in a:
    for j in a:
        if abs(i - j) <= k:
            continue
        else :
            print(":(")
            exit()
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())
A=[0,0,0,0,0,0,0,0,0,0]
B=0
A[0]=a-b
A[1]=a-c
A[2]=a-d
A[3]=a-e
A[4]=b-c
A[5]=b-d
A[6]=b-e
A[7]=c-d
A[8]=c-e
A[9]=d-e
for i in range(10):
  if A[i]<=k and A[i]>=(k*(-1)):
    B=B+1
if B==10:
  print("Yay!")
else:
  print(":(")

Submission status: Accepted

Solution code:
n = 5
list=[int(input()) for i in range(n)]
p = int(input())
max = 0
a = 0
for i in range(n):
  for j in range(n):
    a = abs(list[i] - list[j])
    if a > max:
      max = a
      
if max <= p:
  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:
abcde = []
for i in range(5):
    abcde.append(int(input()))
k = int(input())
abcde.sort()
if k < abcde[4] - abcde[0]:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

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

def a():
    A = int(raw_input())
    B = int(raw_input())
    C = int(raw_input())
    D = int(raw_input())
    E = int(raw_input())
    K = int(raw_input())

    flag = True

    if B-A > K:
        flag = False
    elif C-A>K:
        flag = False
    elif D-A>K:
        flag = False
    elif E-A > K:
        flag = False
    elif C-B > K:
        flag =False
    elif D-B > K:
        flag = False
    elif E-B > K:
        flag =False
    elif D-C > K:
        flag = False
    elif E-C > K:
        flag = False
    elif E-D > K:
        flag = False


    if flag == True:
        print "Yay!"
    else:
        print ":("


def main():
    a()
	
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:
N = 5

A = [int(input()) for i in range(N)]
k = int(input())

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

Submission status: Accepted

Solution code:
from sys import stdin
import math
# import numpy as np
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = [int(x) for x in stdin.readline().rstrip().split()]
x = []
for i in range(6):
  x.append(int(stdin.readline().rstrip().split()[0]))
  
kyori = x[4] - x[0]
k = x[5]
if k >= kyori:
  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())
list1 = [a, b, c, d, e]
for i in range(0, 5):
    for j in range(0, 5):
        if abs(list1[i] - list1[j]) > k:
            print("{}".format(":("))
            sys.exit()

print("{}".format("Yay!"))

Submission status: Accepted

Solution code:
#a,b,c = map(int,inpput().split(" "))
#n = int(input())
#print(a,b,c)
t=[]
for i in range(5):
    t.append(int(input()))
n = int(input())
flag = True
for i in range(5):
    for j in range(5-i-1):
        if abs(t[i]-t[j+i+1]) >n:
            flag =False
            break
if not flag:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

Solution code:
antenna=[]
for _ in [0]*5:
    antenna.append(int(input()))
k=int(input())
if antenna[4]- antenna[0]<=k:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

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

Submission status: Accepted

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

def solve():
    city = []
    city.append(int(input()))
    city.append(int(input()))
    city.append(int(input()))
    city.append(int(input()))
    city.append(int(input()))
    k = int(input())

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

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

aerials = [a,b,c,d,e]
maxA = max(aerials)
minA = min(aerials)

print(":(" if k < maxA-minA else "Yay!")

Submission status: Accepted

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

for a in A:
  c = k + a
  for a in A:
    if c < a:
      print(':(')
      exit()
print('Yay!')

Submission status: Accepted

Solution code:
def read():
    antennas = [0] * 5
    for i in range(5):
        antennas[i] = int(input().strip())
    k = int(input().strip())
    return antennas, k


def solve(antennas, k):
    for i in range(0, 5):
        for j in range(0, i):
            if antennas[i] - antennas[j] > k:
                return ':('
    return 'Yay!'


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))

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:
def answer():
    l = []
    for _ in range(5):
        l.append(int(input()))

    k = int(input())

    for i in range(5):
        for j in range(5):
            if abs(l[j] - l[i]) > k:
                return ':('
    return 'Yay!'



def main():
    print(answer())


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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
a=[None]*5
for i in range(5):
    a[i] = 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:
D=[]
for i in range(5):
  D.append(int(input()))

k=int(input())

output='Yay!'

for i in range(5):
  for l in range(i+1,5):
    if abs(D[i]-D[l]) > k:
      output=':('

print(output)

Submission status: Accepted

Solution code:
a = []
while True:
    try:
        a.append(int(input()))
    except:
        break
# print(a[len(a)-2] - a[0], a[-1])
if a[len(a)-2] - a[0]> a[-1]:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

def f():
    for i in a:
        for j in a:
            if i - j > k:
                return False
    return True

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

Submission status: Accepted

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

Submission status: Accepted

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

flag = 0
i = 0
while i < 5:
    j = 1
    while i + j < 5:
        if n[i + j] - n[i] > k:
            print(':(')
            flag = 1
            break
        else:
            j += 1
    if flag == 1:
        break
    if i + j == 5:
        i += 1
if i == 5:
    print('Yay!')

Submission status: Accepted

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

for a in range(5):
    for b in range(5):
        dist = max(dist, antennas[a]-antennas[b])

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

Submission status: Accepted

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

  counter = False
  antena = [a,b,c,d,e]
  for i in range(len(antena)-1):
    p = antena[i]
    for j in range(i, len(antena)):
      q = antena[j]
      if (q-p) > k:
        counter = True
    
  if counter:
    print(':(')
    
  else:
    print('Yay!')
    

main()

Submission status: Accepted

Solution code:
M = -1
m = 124
for _ in range(5):
  i = int(input())
  if M < i:
    M = i
  if m > i:
    m = i
k = int(input())

if M - m <= k:
  print('Yay!')
else:
  print(':(')

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
k = int(input())
max_dist = 0
max_dist = max(max_dist,l[4]-l[3])
max_dist = max(max_dist,l[4]-l[2])
max_dist = max(max_dist,l[4]-l[1])
max_dist = max(max_dist,l[4]-l[0])
max_dist = max(max_dist,l[3]-l[2])
max_dist = max(max_dist,l[3]-l[1])
max_dist = max(max_dist,l[3]-l[0])
max_dist = max(max_dist,l[2]-l[1])
max_dist = max(max_dist,l[2]-l[0])
max_dist = max(max_dist,l[1]-l[0])
if max_dist > k:
    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())
dis = e - a

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

p_list = [a, b, c, d, e]
neg_pair = False

for i in range(5):
  for j in range(5):
    dist = abs(p_list[i] - p_list[j])
    if dist > k:
      neg_pair = True
      break
if neg_pair:
  print(":(")
else:
  print("Yay!")

Submission status: Accepted

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

N_s=sorted(N)

if N_s[4]-N_s[0] >K:
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

Solution code:
input_lines = input().split()
a = int(input_lines[0])
input_lines = input().split()
b = int(input_lines[0])
input_lines = input().split()
c = int(input_lines[0])
input_lines = input().split()
d = int(input_lines[0])
input_lines = input().split()
e = int(input_lines[0])
input_lines = input().split()
k = int(input_lines[0])
if e - a <= k:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
from sys import stdin
data = [None] * 5
for itr in range(0,5):
    data[itr] = int(stdin.readline().rstrip())
k = int(stdin.readline().rstrip())

if (max(data) - min(data)) <= 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())
List = [a,b,c,d,e]
k = int(input())
flag = 0
for i in range(5):
    for j in range(5):
        if i == k:
            tmp = 0
        elif abs(List[i]-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 e - a > k:
    print(":(")
    exit()

print("Yay!")

Submission status: Accepted

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

Submission status: Accepted

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

def solve(x,k):
    for i in range(5):
        for j in range(5):
            if abs(x[i]-x[j]) > k:
                return ":(" 
                
    return "Yay!"
print(solve(x,k))

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

ab = b - a
ac = c - a
ad = d - a
ae = e - a
bc = c - b
bd = d - b
be = e - b
cd = d - c
ce = e - c
de = e - d

if ab <= k and ac <= k and ad <= k and ae <= k and bc <= k and bd <= k and be <= k and cd <= k and ce <= k and de <= k:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

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

from itertools import combinations as comb
loc_comb = list(comb(loc, 2))

check = True

for i in range(len(loc_comb)):
    dis = abs(loc_comb[i][0] - loc_comb[i][1])
    if dis > k:
        check = False
        break

if check:
    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())
tmp=[a-b,a-c,a-d,a-e,b-c,b-d,b-e,c-d,c-e,d-e]
tmp=list(map(abs,tmp))
a=True
for i in tmp:
    if i>k:
        a=False
        break
if a:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
n = 5
l = []
for i in range(n):
    l.append(int(input()))
k = int(input())
f = True
for i in range(n - 1):
    for j in range(i, n):
        if l[j] - l[i] > k:
            f = False
if f:
    print('Yay!')
else:
    print(':(')

Submission status: Accepted

Solution code:
def solve(antennas, k):
    for i in range(len(antennas)):
        for j in range(i + 1, len(antennas)):
            if antennas[j] - antennas[i] > k:
                return False
    return True

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

if solve(antennas, k):
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
import sys
antn = []
for i in range(5):
  antn.append(int(input()))
k = int(input())
if (antn[4] - antn[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())
ls = []
ls.append(abs(a-b))
ls.append(abs(a-c))
ls.append(abs(a-d))
ls.append(abs(a-e))
ls.append(abs(b-c))
ls.append(abs(b-e))
ls.append(abs(b-d))
ls.append(abs(c-d))
ls.append(abs(c-e))
ls.append(abs(d-e))

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

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = s_inpl()   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import math
import copy
from collections import defaultdict, Counter
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def i_inpl(): return int(input())
def s_inpl(): return map(int,input().split())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = []
for i in range(5):
    A.append(int(input()))
k = int(input())
flag = 0
for i in range(5):
    for j in range(i+1 ,5):
        if abs(A[i]- A[j]) > k:
            flag = 1

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
li = []

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

k = int(input())

flag = True
for i in range(4):
    for j in range(i,5):
        if abs(li[i] - li[j]) > k:
            flag = False
            break
    if flag is False:
        break
    
if flag is True:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

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

for i in range(5):
  for j in range(i + 1,5):
    if k < a[j] - a[i]:
      exist += 1
      break
  if exist > 0:
    break
if exist > 0:
  print(':(')
else:
  print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

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

flag = 0

for i,j in itertools.combinations(number[0:5],2):
    if abs(i-j) > number[5]:
        flag = 1
        break

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

Submission status: Accepted

Solution code:
import sys
A=[int(input()) for _ in range(6)]
k=A[-1]
num=len(A)-1
for i in range(num):
    for b in range(i,num):
        if abs(A[i]-A[b])>k:
            print(":(")
            sys.exit()
print("Yay!")

Submission status: Accepted

Solution code:
def main():
    a = []
    flag = False
    for i in range(5):
        a.append(int(input()))
    k = int(input())
    for i in a:
        for j in a:
            if i - j > k:
                print(':(')
                flag = True
                break
        if flag:
            break
    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())

judge = 0
if abs(a-e) > k:
    print(':(')
else:
    print("Yay!")

Submission status: Accepted

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

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

for i in l:
    for j in l:
        kyori.append(abs(i-j))
if max(kyori) <= k:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
ans = 0
import itertools

ax = list(itertools.combinations([a,b,c,d,e],2))

for i in range(10):

    if abs(ax[i][0]-ax[i][1]) > k:

        ans += 1

if ans >= 1:

    print(':(')

else:

    print('Yay!')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
antenna = [int(input()) for i in range(5)]
k = int(input())
if(antenna[4] - antenna[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())
list = []
ans = 0
list.append(a - b)
list.append(a - c)
list.append(a - d)
list.append(a - e)
list.append(b - c)
list.append(b - d)
list.append(b - e)
list.append(c - d)
list.append(c - e)
list.append(d - e)
#print(list)

for i in range(10):
    if abs(list[i]) <= k:
        ans += 1
if ans == 10:
    print("Yay!")
else:
    print(":(")

Submission status: Accepted

Solution code:
def judge(a,b,c,d,e,k):
    if abs(a - b) > k:
        return False
    if abs(a - c) > k:
        return False
    if abs(a - d) > k:
        return False
    if abs(a - e) > k:
        return False
    if abs(b - c) > k:
        return False
    if abs(b - d) > k:
        return False
    if abs(b - e) > k:
        return False
    if abs(c - d) > k:
        return False
    if abs(c - e) > k:
        return False
    if abs(d - e) > k:
        return False
    return True


def main():
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    k = int(input())
    if judge(a,b,c,d,e,k):
        print('Yay!')
    else:
        print(':(')

main()

Submission status: Accepted

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

x=e-a

if x>k:
    print(":(")
else:
    print("Yay!")

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):
    ans = k
    for i,v in enumerate([a,b,c,d,e]):
        for j,x in enumerate([a,b,c,d,e],i+1):
            if(abs(v-x)):
                ans = max(ans,abs(v-x))

    if(ans > k):
        print(':(')
    else:
        print('Yay!')
    return


# Generated by 1.1.3 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:
i = []
for l in range(5):
    i.append(int(input()))
m = int(input())
i.sort()
if (i[-1] - i[0] > m):
    print(":(")
else:
    print("Yay!")

Submission status: Accepted

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