Problem:


﻿Score: 100 points

Problem Statement

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

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

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

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

Constraints

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

a < b < c < d < e

Input

Input is given from Standard Input in the following format:

a
b
c
d
e
k

Output

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

Sample Input 1

1
2
4
8
9
15

Sample Output 1

Yay!

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

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

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

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

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

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

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

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

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

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

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

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

Sample Input 2

15
18
26
35
36
18

Sample Output 2

:(

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



Sample input:
1
2
4
8
9
15


Sample output:
Yay!

Submission status: Wrong Answer

Solution code:
N,A,B,C,D,E=[int(input()) for i in range(6)]
a,b,c,d,e,f,T=[N,0,0,0,0,0,0]


def ship(station,destination,capacity):
    if station>=capacity:
        s=capacity
    else:
        s=station
    destination=destination+s
    station=station-s
    return station,destination

while True:
    if f==N:
        print(T)
        break
    if e!=0:
      e,f=ship(e,f,E)
    if d!=0:
      d,e=ship(d,e,D)
    if c!=0:
      c,d=ship(c,d,C)
    if b!=0:
      b,c=ship(b,c,B)
    if a!=0:
      a,b=ship(a,b,A)
    print("{}{}{}{}{}{}".format(a,b,c,d,e,f))
    T=T+1

Submission status: Wrong Answer

Solution code:

list = [int(input()) for i in range(5)]
kList = []
for j in range(0,10):
    for i in list:
         if (i+j) % 10 == 0:
            if i % 10 != 0:
                kList.append(i+j) 
            else:
                kList.append(i)

nList = [i for i in kList[0:len(kList)-1]]
print(sum(nList) + kList[-1])

Submission status: Wrong Answer

Solution code:
B = [int(input()) for _ in range(5)]
A = [10-int(str(B[i])[-1]) for i in range(5) if str(B[i])[-1] != "0"]
if len(A) != 0:
	A.remove(max(A))
print(sum(B)+sum(A))

Submission status: Wrong Answer

Solution code:
B = [int(input()) for _ in range(5)]
A = [10-int(str(B[i])[-1]) for i in range(5) if str(B[i])[-1] != "0"]
A.remove(max(A))
print(sum(B)+sum(A))

Submission status: Wrong Answer

Solution code:

n = int(input())
lists = [int(input()) for i in range(5)]

print(int(-~n/min(lists) + 4))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

i0 = int(i[0])

i1 = int(i[1])

i2 = int(i[2])

i3 = int(i[3])

i4 = int(i[4])

i5 = int(i[5])



if  i4 - i0 >> i5:
    print(":(")

else:
    print("Yay!")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

i0 = int(i[0])

i1 = int(i[1])

i2 = int(i[2])

i3 = int(i[3])

i4 = int(i[4])

i5 = int(i[5])



if  i4 - i0 >= i5:
    print(":(")

else:
    print("Yay!")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

b = []
c = []
for j in range(5):
    if a[j] % 10 == 0:
        c.append(10)
        b.append(a[j]-10)
    else:
        #10で割った余りを引く
        num = a[j] % 10
        c.append(num)
        b.append(a[j] - c[j])

b_sum = sum(b)
c_min = min(c)
if c_min ==10:
    c_sum = 4 * 10
else:
    c_sum = c_min + 4*10

print(b_sum + c_sum)

Submission status: Wrong Answer

Solution code:
import numpy as np
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10

S = []
sum = 0
if A != 0:
  S.append(A)
if B != 0:
  S.append(B)
if C != 0:
  S.append(C)
if D != 0:
  S.append(D)
if E != 0:
  S.append(E)
if len(S) == 0:
  sum = a + b + c + d + e
else:
  sum = (a //10 + b //10 + c //10 + d //10 + e //10)*10 + 10*(len(S) - 1) +min(S)
print(sum)

Submission status: Wrong Answer

Solution code:
# B
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
a = (10 - A) % 10
b = (10 - B) % 10
c = (10 - C) % 10
d = (10 - D) % 10
e = (10 - E) % 10
 
print(A+B+C+D+E+a+b+c+d+e-max([a,b,c,d,e]))

Submission status: Wrong Answer

Solution code:
a,*b=eval('int(input()),'*6);print(~-a//min(b)+5)

Submission status: Wrong Answer

Solution code:
inputs=input()
print(input)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

m=min(a,b,c,d,e)
print((n//m)+5)

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
  list = [int(input()) for i in range(6)]
  for i in range(5):
    for j in range(i):
      if i == j:
        continue
      if abs(list[i]-list[j]) < list[5]:
        print(":(")
        sys.exit()
  print("Yay!")

Submission status: Wrong Answer

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
a = 10 -(A % 10)
b = 10 -(B % 10)
c = 10 -(C % 10)
d = 10 -(D % 10)
e = 10 -(E % 10)
 
print(A+B+C+D+E+a+b+c+d+e-max([a,b,c,d,e]))

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
  list = [int(input()) for i in range(6)]
  for i in range(5):
    for j in range(i):
      if i == j:
        continue
      else:
        if abs(i-j) < list[5]:
          print(":(")
  print("Yay!")

Submission status: Wrong Answer

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
a = (10 - A) % 10
b = (10 - B) % 10
c = (10 - C) % 10
d = (10 - D) % 10
e = (10 - E) % 10
 
print(A+B+C+D+E+a+b+c+d+e-max([a,b,c,d,e]))

Submission status: Wrong Answer

Solution code:
A=[int(input())for _ in[0]*6]
print('Yay!'if A[-2]-A[0]<A[-1]else':(')

Submission status: Wrong Answer

Solution code:
import itertools

flag = 0
antena = [int(input()) for i in range(5)]
k = int(input())

if antena[-1] - antena [0] < k:
    flag = 1

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

Submission status: Wrong Answer

Solution code:
import itertools

flag = 0
antena = [int(input()) for i in range(5)]
k = int(input())

if antena[-1] - antena [0] > k:
    flag = 1

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

Submission status: Wrong Answer

Solution code:
*Pos, K = [int(input()) for _ in range(6)]
for p in range(4):
  if Pos[p + 1] - Pos[p] > K:
    print('Yay!')
    exit()
print(':(')

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
s = [input() for i in range(5)]
s = [int(i) for i in s]
s_min = min(s)
time = math.ceil(N/s_min) + 4
print(time)

Submission status: Wrong Answer

Solution code:
import numpy as np

A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

order_time = [A,B,C,D,E]
elapsed_time=0
extra = []
for i in order_time:
    ex = i%10
    extra.append(ex)
seiri = np.vstack((order_time,extra))
sort = np.sort(seiri)[:,::-1]
sort1 = sort[0]
sort2 =sort[1]
time = []
for i in range(0,len(sort2)-1):
    ort = sort2[i]
    otime = sort1[i]+(10-ort)
    elapsed_time += otime
elapsed_time+=sort1[-1]
print(elapsed_time)

Submission status: Wrong Answer

Solution code:
a=[int(input())for _ in[0]*6];print((~-a[0]//min(a[1:]))+5)

Submission status: Wrong Answer

Solution code:
import itertools

flag = 0
antena = [int(input()) for i in range(5)]
k = int(input())

for i,j in itertools.combinations(antena,2):
    if abs(i-j) > k:
        flag = 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=[int(input())for i in[0]*6];import math;print(math.ceil(a[0]/min(a[1:]))+4)

Submission status: Wrong Answer

Solution code:
a=[int(input())for i in[0]*6];import math;print(math.ceil(a[0]/min(a[1:])))

Submission status: Wrong Answer

Solution code:
n=[]
for _ in range(6):n+=[int(input())]
print(":("if n[4]-n[0]>n[5] else"Yey!")

Submission status: Wrong Answer

Solution code:
a = []

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

if a[0] <= a[1]:
    sum_minute = 1
else:
    sum_minute = -(-a[0] // a[1])

b = []
for i in range(5):
    b.append(a[i+1])

min_in = b.index(min(b)) + 1
min_in = min(min_in , 2)


for i in range(2,min_in):
    if a[i - 1] <= a[i]:
        m = 1
    else:
        m = -(-(a[0] - (sum_minute - i + 1) * a[i]) // a[i])
    sum_minute += m

for i in range(min_in, 6):
    sum_minute += 1

print(sum_minute)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for i in range(4):
	for j in range(i):
		if A[i]-A[j]>k:
			print(""":(""")
			exit()
print("Yay!")

Submission status: Wrong Answer

Solution code:
array = [int(input()) for i in range(5)]
array_sub = [i % 10 for i in array]
new_lst = [i for i in array_sub if i != 0]
minimum = min(new_lst)
sum = 0
for i in array:
  if (i % 10 == 0):
    sum += i
  else:
    if (i % 10 == minimum):
      sum += i
    else:
      sum += (i + (10 - (i % 10)))
print(sum)

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
e = int(e)
k = int(k)
if 0 <= a and b and c and d and e and k <=123 :
    if a < b < c < d < e:
        ta = e - d
        ti = e - c
        tu = e - b
        te = e - a
        to = d - c
        na = d - b
        ni = d - a
        nu = c - b
        ne = c - a
        no = b - a
    if ta and ti and tu and te and to and na and ni and nu and ne and no <= k:
        print("Yay!")
    else:
        print(":(")

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
e = int(e)
k = int(k)
if 0 <= a and b and c and d and e and k <=123 :
    if a < b < c < d < e:
        ta = e - d
        ti = e - c
        tu = e - b
        te = e - a
        to = d - c
        na = d - b
        ni = d - a
        nu = c - b
        ne = c - a
        no = b - a
        ta = int(ta)
        ti = int(ti)
        tu = int(tu)
        te = int(te)
        to = int(to)
        na = int(na)
        ni = int(ni)
        nu = int(nu)
        ne = int(ne)
        no = int(no)
    if not ta <=k and ti <= k and tu <= k and te <= k and to <= k and na <= k and ni <= k and nu <= k and ne <= k and no <= k:
        print(":(")
    else:
        print("Yay!")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
count = 0
if n <= a:
    count = 1 + count
else:
    while True:
        count = 1 + count
        no = n % a
        if n == no:
            break
if n <= b:
    count = 1 + count
else:
    while True:
        count = 1 + count
        no = n % b
        if n == no:
            break
if n <= c:
    count = 1 + count
else:
    while True:
        count = 1 + count
        no = n % c
        if n == no:
            break
if n <= d:
    count = 1 + count
else:
    while True:
        count = 1 + count
        no = n % d
        if n == no:
            break
if n <= e:
    count = 1 + count
else:
    while True:
        count = 1 + count
        no = n % e
        if n == no:
            break
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = []
for i in range(5):
  li.append(n//int(input()))
li.sort()
print(li[4]+5)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
saisyo=n+a+b+c+d+e
f=1
g=1
h=1
i=1
j=1
if saisyo>a:
    f=-(-n//a)
    saisyo=a
if saisyo>b:
    g=-(-a//b)
    saisyo=b
if saisyo>c:
    h=-(-b//c)
    saisyo=c
if saisyo>d:
    i=-(-c//d)
    saisyo=d
if saisyo>e:
    saisyo=e
    j=-(-d//e)

goke=f+g+h+i+j

print(goke)

Submission status: Wrong Answer

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

count = 0

for i in temp:
    for j in temp:
        #print(i, j)
        if abs(i -j ) <= k:
            #print("Yay!")
            count+=1
        else:
            #print(":(")
            pass
if count == len(temp):
    print("Yay!")
else:
    print(":(")

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
array=[a,b,c,d,e]
flag=True

for i in range(5):
  for j in range(5):
    if array[i]-array[j] >= k:
      flag=False
      print(":(")
      break
  if not flag:
    break
      
if flag:
  print("Yay!")

Submission status: Wrong Answer

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

list = [e-d, e-c, e-b, e-a, d-c, d-b, d-a, c-b, c-a, b-a]
x = 0

for i in range(9):
    if x > list[i]:
        pass
    else:
        x = list[i]
        
if x < k:        
    print("Yay!")
else:
    print(":(")

Submission status: Wrong Answer

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

f=0
g=[a%10,b%10,c%10,d%10,e%10]
saisyo=10

f+=math.ceil(a/10)*10
f+=math.ceil(b/10)*10
f+=math.ceil(c/10)*10
f+=math.ceil(d/10)*10
f+=math.ceil(e/10)*10

for i in g:
    if 0<i<saisyo:
        saisyo=i
        

print(f-10+saisyo)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal, ROUND_UP
tmp = []
toshi = []
for i in range(0,6):
    if i == 0:
        toshi.append(int(input()))
    else:
        toshi.append(0)
        tmp.append(int(input()))
count = 0
turn = 1
while toshi[0]!=0 or toshi[1]!=0 or toshi[2]!=0 or toshi[3]!=0 or toshi[4]!=0:
    if (turn < 6):
        lp = turn
    else:
        lp = 5 
    for i in reversed(range(lp)):
        if toshi[i] > tmp[i]:
            toshi[i] = toshi[i] - tmp[i]
            toshi[i+1] += tmp[i]
        elif toshi[i] != 0:
            toshi[i+1] += toshi[i]
            toshi[i] = toshi[i] - toshi[i]
    count+=1
    turn += 1
print(count)

Submission status: Wrong Answer

Solution code:
import sys

###args = [input() for i in range(6)
args = [1,2,4,8,9,15]

loops1 = 4
loops2 = 5
arg1 = 0
arg2 = 1

for i in range(arg1,loops1):
	for j in range(arg2,loops2):
		if (args[j] - args[i]) > args[5]:
			print(":(")
			sys.exit()
print("Yay!")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for i in range(5):
    inp = int(input())
    a.append(inp)
mini = min(a)
mini_list = [i for i in range(len(a)) if a[i]==mini]
mini_no = len(mini_list)

if n < mini:
    print(5)
elif mini_no==1 or mini_no==5:
    time = int(n/mini) +1
    print(time+4)
else:
    time = int(n/mini) + (mini_no-1)
    print(time+(5-mini_no))

Submission status: Wrong Answer

Solution code:

import sys

###args = [input() for i in range(6)
args = [1,2,4,8,9,15]

loops1 = 4
loops2 = 5
arg1 = 0
arg2 = 1

for i in range(arg1,loops1):
	for j in range(arg2,loops2):
		if (args[arg2] - args[arg1]) > args[5]:
			print(":(")
			sys.exit()
print("Yay!")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
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())

ct = 5
MIN = S[0]
f = 0

if N <= S[0] :
    f = 0
else :
    ct = ct + (N // S[0])
    f = 1

for i in range(4):
    if f == 0 and N <= S[i+1] :
        continue
    elif S[i+1] >= MIN:
        f = 1
        continue
    else:
        ct = ct + (MIN // S[i+1])
        MIN = S[i+1]
        f = 1
        
print(ct)

Submission status: Wrong Answer

Solution code:
n = int(input())
L = [int(input()) for i in range(5)]
ans = n //min(L) + 5   
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

if min(n,a,b,c,d,e)==n:
  print(5)
  
elif min(n,a,b,c,d,e)==a:
  t=0
  t+=(n//a)+1
  t+=4
  print(t)
  
elif min(n,a,b,c,d,e)==b:
  t=0
  t+=1
  t+=(n//b)+1
  t+=3
  print(t)
  
elif min(n,a,b,c,d,e)==d:
  t=0
  t+=3
  t+=(n//d)+1
  t+=1
  print(t)  
  
elif min(n,a,b,c,d,e)==e:
  t=0
  t+=4
  t+=(n//e)+1
  print(t)

Submission status: Wrong Answer

Solution code:
15
18
26
35
36
18

Submission status: Wrong Answer

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

list = [e-d, d-c, c-b, b-a]
x = 0

for i in range(3):
    if x > list[i]:
        pass
    else:
        x = list[i]
        
if x < k:        
    print("Yay!")
else:
    print(":(")

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if (b-a)<k 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!")
elif (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 or k==0 or k==1 or k==2 or k==3:
    print(":(")
else:
    print(":(")

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if (b-a)<k 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!")
elif (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 or k==0 or k==1 or k==2 or k==3:
    print(":(")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
 
max_diff = max([a, b, c, d, e]) - min([a, b, c, d, e])
ans = "Yay!"
if(max_diff > k):
    ans = ":("

Submission status: Wrong Answer

Solution code:
import math
a = []
k = 0
for i in range(5):
    tmp = int(input())
    a.append([tmp,(tmp-1)%10])
a.sort(reverse=True, key=lambda x:x[1])
for i in range(4):
    k += (math.ceil(a[i][0]/10))*10
k += a[4][0]
print(k)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if k==0 or k==1 or k==2 or k==3:
    print(":(")
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!")
elif (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(":(")

Submission status: Wrong Answer

Solution code:
li = [int(input()) for i in range(6)]  

flg = False  # 通信できないアンテナが存在しない場合
for i in range(4):
    for j in range(4):
        cc = 0
        cc = li[j+1] - li[i]
        if cc > li[5]:  # 通信できないものが存在するなら
            print(cc)
            flg = True
            break
            
            
if flg:
    print(":(")  # 通信不可あり
else:
    print("Yay!")  # 通信不可なし

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if k == 0:
    print(":(")
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!")
elif (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(":(")

Submission status: Wrong Answer

Solution code:
max_num = 0
num1 = int(input())
for i in range(4):
    num2 = int(input())
    tmp = num2 - num1
    if tmp > max_num:
        max_num = tmp
    num1 = num2
k = int(input())
if k < max_num:
    print(':(')
else :
    print('Yay!')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

###args = [input() for i in range(6)
args = [1,2,4,8,9,15]

loops1 = 4
loops2 = 5
arg1 = 0
arg2 = 1

for arg1 in range(loops1):
	for arg2 in range(loops2):
		if (args[arg2] - args[arg1]) > args[5]:
			print(":(")
			sys.exit()

print("Yay!")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if k == 0:
    print("Yay!")
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!")
elif (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(":(")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

###args = [input() for i in range(6)
args = [1,2,4,8,9,15]

loops = 5
arg1 = 1
arg2 = 2

for arg1 in range(loops):
	for arg2 in range(loops):
		if (args[arg2] - args[arg1]) > args[5]:
			print(":(")
			sys.exit()

print("Yay!")

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if (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!")
elif (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(":(")

Submission status: Wrong Answer

Solution code:
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
if a >= 100:
    a1 = a % 10
else:
    a2 = a - 100
    a1 = a2 % 10
if b >= 100:
    b1 = b % 10
else:
    b2 = b - 100
    b1 = b2 % 10
if c >= 100:
    c1 = c % 10
else:
    c2 = c - 100
    c1 = c2 % 10
if d >= 100:
    d1 = d % 10
else:
    d2 = d - 100
    d1 = d2 % 10
if e >= 100:
    e1 = e % 10
else:
    e2 = e - 100
    e1 = e2 % 10
if a1 == 0:
    a1 = 9
if b1 == 0:
    b1 = 9
if c1 == 0:
    c1 = 9
if d1 == 0:
    a1 = 9
if e1 == 0:
    e1 = 9
lis = [a1,b1,c1,d1,e1]
if a1 == min(lis) :
    answer = math.ceil(b / 10) * 10 + math.ceil(c/ 10) * 10 + math.ceil(e/ 10)* 10+ math.ceil(d/ 10) * 10 + a
if b1 == min(lis):
    answer = math.ceil(a/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(d/ 10)* 10 + b
if c1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(a/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(d/ 10)* 10 + c
if d1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(a/ 10)* 10 + d
if e1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(a/ 10)* 10 + e
print(answer)

Submission status: Wrong Answer

Solution code:
li = []
for l in range(6):
    li.append(input())

t = 0
s = li.pop()
for i in li:
    for k in li:
        if int(k) - int(i) >= int(s):
            t = 1
        elif int(i) - int(k) >= int(s):
            t = 1

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

Submission status: Wrong Answer

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

l = [a, b, c, d, e]
d = list()

for i, x in enumerate(l[:-1]):
    l2 = l[i+1:]
    for y in l2:
        d.append(y-x)


print(d)

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

Submission status: Wrong Answer

Solution code:
array=[int(input()) for i in range(6)]
a=0
for i in range(5,1):
    if array[i]-array[0] > array[6]: 
        print(':(')
        exit()
print('Yay!')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
 
x = min(a, b, c, d, e)
if x != 1:
    print(5 + n // x)
else:
    print(4 + n)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
x=[a,b,c,d,e]

l10=[int(i) for i in x if i % 10==0]
res=[]
for n in x:
    if n not in l10:
        res.append(n)

if not len(l10)==5:
    min_d=9
    for i in res:
        if int(str(i)[-1])<min_d:
            min_d=int(str(i)[-1])
            min_num=i
    
    re2=[]
    for m in res:
        if m != min_num:
            re2.append(m)
    
    s=0
    for si in re2:
        if len(str(si))==2:
            s+=int(str(si)[0])*10+10
        elif len(str(si))==1:
            s+=10
        else:
            s+=int(str(si)[:-1])*10+10 
    print(sum(l10)+min_num+s)
else:
    print(sum(l10))

Submission status: Wrong Answer

Solution code:
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
h=c-b
i=d-b
j=e-b
k=f-b
l=d-c
m=e-c
n=f-c
o=e-d
p=f-d
q=f-e
r=int(input())
s=":("
if r<=h:
  print(s)
elif r<=i:
  print(s)
elif r<=j:
  print(s)
elif r<=k:
  print(s)
elif r<=l:
  print(s)
elif r<=m:
  print(s)
elif r<=n:
  print(s)
elif r<=o:
  print(s)
elif r<=p:
  print(s)
elif r<=q:
  print(s)
else:
  print("Yay!")

Submission status: Wrong Answer

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if (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: Wrong Answer

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

l = [e, d, c, b, a]
d = list()

for i, x in enumerate(l[:-1]):
    for y in l[i+1:]:
        d.append(x-y)


print(d)

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

Submission status: Wrong Answer

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

list = [e-d, d-c, c-b, b-a]

for i in range(3):
    if list[i] > k:
        print(":(")
        break
    else:   
        print("Yay!")
        break

Submission status: Wrong Answer

Solution code:

t = [int(input()) for i in range(5)]
min=9
length=len(t)
for i in range(length):
    if min%10>t[i]%10 and t[i]%10!=0:
        min=t[i]

try:
    t.remove(min)
    t.append(min)
    t.remove(123)
except:
    ans=0
    for _ in range(length-1):
        if t[_]%10!=0:
            ans+=t[_]+10-t[_]%10
        else:
            ans+=t[_]
    print(ans+t[length-1])

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve():
    a = makeInt(input())
    b = makeInt(input())
    c = makeInt(input())
    d = makeInt(input())
    e = makeInt(input())
    l = [0, a, b, c, d, e]
    m = 9
    m_i = 1
    for i in range(len(l)):
        if m > l[i] % 10 and l[i] % 10 > 0:
            m = l[i] % 10
            m_i = i
    if m != 0:
        temp = l[-1]
        l[-1] = l[m_i]
        l[m_i] = temp

    #ls = sorted(l)
    #print(ls)
    lst = 0
    alst = 0
    i = 1
    # 10ずつ足されるのがベスト
    at = 0
    while(i < 6):
        if at >= l[i-1]:
            #print(at, ls[i-1])
            if i != 5:
                #print(at)
                alst += at
                #print(ls[i])
            else:
                #print(at)
                alst += at
                alst += l[i]
                return alst
            at = 0
            i += 1
            #print(alst)
        else:
            at += 10


def main():
    answer = solve()
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in temp:
    for j in temp:
        #print(i, j)
        if abs(i -j ) <= k:
            print("Yay!")
        else:
            print(":(")

Submission status: Wrong Answer

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

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 bc <= k and bd <= k and be <= k and cd <= k and ce <= k and de <= k:
    print("Yay!")
else:
    print(":(")