TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: N people are arranged in a row from left to right.  You are given a string S of length N consisting of `0` and `1`, and a positive integer K.  The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`.  You will give the following direction at most K times (possibly zero):  **Direction** : Choose integers l and r satisfying 1 \leq l \leq r \leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.  Find the maximum possible number of **consecutive** people standing on hands after at most K directions.

Submission attempts (in order):
N, K = map(int, input().split())
S = input()

l = []
now = 1 
cnt = 0


for i in range(N):
    if int(S[i]) == now:
        cnt += 1
    else:
        l.append(cnt)
        cnt = 1
        now = 1 - now 
if cnt != 0:
    l.append(cnt)
if len(l) % 2 == 0: 
    l.append(0)
print(l)

ans = 0
width = 2 * K + 1



lsum = [0 for _ in range(len(l) + 1)] 
for i in range(len(l)): 
    lsum[i + 1] = lsum[i] + l[i]
print(lsum)

for i in range(0, len(l), 2): 
    left = i
    right = min(i + width, len(l))
    tmp = lsum[right] - lsum[left] # [left, right)
    ans = max(ans, tmp)



"""
# 愚直に足し算を繰り返すとTLE

for i in range(0, len(l), 2): 
    tmp = 0
    left = i
    right = min(i + width, len(l))
    for j in range(left, right): # leftからright-1まで
        tmp += l[j]
    ans = max(ans, tmp)
"""

print(ans)


N, K = map(int, input().split())
S = input()

l = []
now = 1 
cnt = 0


for i in range(N):
    if int(S[i]) == now:
        cnt += 1
    else:
        l.append(cnt)
        cnt = 1
        now = 1 - now 
if cnt != 0:
    l.append(cnt)
if len(l) % 2 == 0: 
    l.append(0)
print(l)

ans = 0
width = 2 * K + 1

for i in range(0, len(l), 2):
    tmp = 0
    left = i
    right = min(i + width, len(l))
    for j in range(left, right): 
        tmp += l[j]
    ans = max(ans, tmp)

print(ans)


N, K = map(int, input().split())
S = input()

l = []
now = 1 
cnt = 0


for i in range(N):
    if int(S[i]) == now:
        cnt += 1
    else:
        l.append(cnt)
        cnt = 1
        now = 1 - now 
if cnt != 0:
    l.append(cnt)
if len(l) % 2 == 0: 
    l.append(0)
#print(l)

ans = 0
width = 2 * K + 1



lsum = [0 for _ in range(len(l) + 1)] 
for i in range(len(l)): 
    lsum[i + 1] = lsum[i] + l[i]
#print(lsum)

for i in range(0, len(l), 2): 
    left = i
    right = min(i + width, len(l))
    tmp = lsum[right] - lsum[left] # [left, right)
    ans = max(ans, tmp)



"""
# 愚直に足し算を繰り返すとTLE

for i in range(0, len(l), 2): 
    tmp = 0
    left = i
    right = min(i + width, len(l))
    for j in range(left, right): # leftからright-1まで
        tmp += l[j]
    ans = max(ans, tmp)
"""

print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: N people are arranged in a row from left to right.  You are given a string S of length N consisting of `0` and `1`, and a positive integer K.  The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`.  You will give the following direction at most K times (possibly zero):  **Direction** : Choose integers l and r satisfying 1 \leq l \leq r \leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.  Find the maximum possible number of **consecutive** people standing on hands after at most K directions.

Submission attempts (in order):
n,k=map(int,input().split())
s=input()
List=[]
i=1
j=1
while i<n:
  if s[i-1]==s[i]:
    j+=1
    i+=1
  else:
    List.append(j)
    i+=1
    j=1
List.append(j)
if s[0]=="0":
  List.insert(0,0)
ans=max(List)
rg=2*k+1

#  m=sum(List[i:i+rg])
#  ans=max(ans,m)
print(ans)

n,k=map(int,input().split())
s=input()
A=[]
cur=s[0]
for i in range(1,n):
  if s[i]!=cur:
    A.append(i)
    cur=s[i]
A.append(n)
start,end=s[0],s[-1]
nn=len(A)
ans=0
if start=="0" and nn<=2*k:
  ans=n
elif start=="1" and nn<=2*k+1:
  ans=n
elif start=="0":
  ans=A[2*k-1]
  for i in range(1,nn//2-k+1):
    ans=max(ans,A[2*k-1+2*i]-A[2*i-2])
  if end=="0":
    ans=max(ans,A[-1]-A[-2*(k+1)+1])
else:
  ans=A[2*k]
  for i in range(1,(nn-1)//2-k+1):
    ans=max(ans,A[2*k+2*i]-A[2*i-1])
  if end=="0":
    ans=max(ans,A[-1]-A[-2*(k+1)+1])
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: N people are arranged in a row from left to right.  You are given a string S of length N consisting of `0` and `1`, and a positive integer K.  The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`.  You will give the following direction at most K times (possibly zero):  **Direction** : Choose integers l and r satisfying 1 \leq l \leq r \leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.  Find the maximum possible number of **consecutive** people standing on hands after at most K directions.

Submission attempts (in order):
# ABC124 D - Handstand
from math import ceil
n,k=map(int,input().split())
s=input()

l=[]
tmp=''
t_cnt=0
for i,ss in enumerate(s):
    if i==0:
        tmp=ss
        t_cnt+=1
        if len(s)==1:
            l.append(t_cnt)
            break
        continue
    if i==n-1:
        if ss==tmp:
            t_cnt+=1
            l.append(t_cnt)
        else:
            t_cnt=1
            l.append(t_cnt)
        continue
    if ss==tmp:
        t_cnt+=1
    else:
        l.append(t_cnt)
        t_cnt=1
        tmp=ss

# print(l)
l+=[0]
ans=0
if s[0]=='0':
    for i in range(0,ceil(n/2),2):
        if i==0:
            ans=sum(l[:2*k-1])
            continue
        ans=max(ans,ans+l[i+1]-l[i-1])
else:
    for i in range(1,ceil(n/2)+1,2):
        if i==1:
            ans=sum(l[:2*k+1])
            continue
        ans=max(ans,ans+l[i+1]-l[i-1])
    
print(ans)


n,k=map(int,input().split())
s=input()
l=[]
if s[0]=="0":
  l.append(0)

from itertools import groupby,accumulate
gr=groupby(s)

for K,g in gr:
  l.append(len(list(g)))

l_sum=list(accumulate(l))
l_sum=[0]+l_sum

add=2*k+1
ans=0
for i in range(0,len(l)+1,2):
  left=i
  right=min(i+add,len(l))
  tmp=l_sum[right]-l_sum[left]
  ans=max(tmp,ans)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: N people are arranged in a row from left to right.  You are given a string S of length N consisting of `0` and `1`, and a positive integer K.  The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`.  You will give the following direction at most K times (possibly zero):  **Direction** : Choose integers l and r satisfying 1 \leq l \leq r \leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.  Find the maximum possible number of **consecutive** people standing on hands after at most K directions.

Submission attempts (in order):
from itertools import groupby
from numpy import cumsum


N, K = map(int, input().split())
S = input().strip()

if len(set(S)) == 1:
    print(N)
    exit()


G = []
for k, v in groupby(S):
    G.append(len(list(v)))


if S[0] == '0':
    G.insert(0, 0)
if S[-1] == '0':
    G.append(0)

cum = [0]
cum.extend(list(cumsum(G)))
cum.append(0)

ans = 0
gc = len(G)
w = min(gc, 3+(K-1)*2)
for i in range(0, gc, 2):
    ans = max(ans, cum[i+w]-cum[i])
print(ans)


from itertools import groupby
from numpy import cumsum


N, K = map(int, input().split())
S = input().strip()

if len(set(S)) == 1:
    print(N)
    exit()

G = []
for k, v in groupby(S):
    G.append(len(list(v)))
if S[0] == '0':
    G.append(0)
if S[-1] == '0':
    G.append(0)

cum = [0]
cum.extend(list(cumsum(G)))
cum.append(0)

ans = 0
gc = len(G)
w = min(gc, 3+(K-1)*2)
for i in range(0, gc-w+2, 2):
    ans = max(ans, cum[i+w]-cum[i])
print(ans)


from itertools import groupby
from numpy import cumsum


N, K = map(int, input().split())
S = input().strip()

if len(set(S)) == 1:
    print(N)
    exit()


G = []
for k, v in groupby(S):
    G.append(len(list(v)))


if S[0] == '0':
    G.insert(0, 0)
if S[-1] == '0':
    G.append(0)

cum = [0]
cum.extend(list(cumsum(G)))
cum.append(0)

ans = 0
gc = len(G)
w = min(gc, 3+(K-1)*2)
for i in range(0, gc-w+2, 2):
    ans = max(ans, cum[i+w]-cum[i])
print(ans)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: N people are arranged in a row from left to right.  You are given a string S of length N consisting of `0` and `1`, and a positive integer K.  The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`.  You will give the following direction at most K times (possibly zero):  **Direction** : Choose integers l and r satisfying 1 \leq l \leq r \leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.  Find the maximum possible number of **consecutive** people standing on hands after at most K directions.

Submission attempts (in order):
n, k = map(int, input().split())
s = input().rstrip()
ans = 1
i = 0
left = 0
right = 1
while i < n:
    if k > 0:
        pos = s.find('01', i)
        if pos == -1:
            i = n
            right = n - 1
        else:
            pos = s.find('10', pos + 1)
            if pos == -1:
                i = n
                right = n - 1
            else:
                right = pos
                i = pos + 1
        k = k - 1
        print(s[left:right+1])
        ans = max(ans, right - left + 1)
    else:
        pos = s.find('01', left)
        left = pos + 1
        k = k + 1

print(ans)

n, k = map(int, input().split())
s = input().rstrip()
ans = 1
i = 0
left = 0
right = 1
while i < n:
    if k > 0:
        pos = s.find('01', i)
        if pos == -1:
            i = n
            right = n - 1
        else:
            pos = s.find('10', pos + 1)
            if pos == -1:
                i = n
                right = n - 1
            else:
                right = pos
                i = pos + 1
        k = k - 1
        ans = max(ans, right - left + 1)
    else:
        pos = s.find('01', left)
        left = pos + 1
        k = k + 1

print(ans)

Verdicts: Runtime Error

Accepted
Problem: N people are arranged in a row from left to right.  You are given a string S of length N consisting of `0` and `1`, and a positive integer K.  The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`.  You will give the following direction at most K times (possibly zero):  **Direction** : Choose integers l and r satisfying 1 \leq l \leq r \leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.  Find the maximum possible number of **consecutive** people standing on hands after at most K directions.

Submission attempts (in order):
N, K = map(int, input().split())
S = input()
L = [0, 1]
X = ['1', S[0]]
pos = 1
for i in range(1, N):
  if S[i] != S[i-1]:
    L.append(1)
    X.append(S[i])
    pos += 1
  else:
    L[pos] += 1
while pos < 2 * K + 2:
  L.append(0)
  X.append('1')
  pos += 1
for i in range(1, pos+1):
  L[i] += L[i-1]
M = L[2*K-1]
for i in range(1, pos+1-2*K):
  if X[i] == '1':
    M = max(L[2*K+i] - L[i-1], M)
print(M)

N, K = map(int, input().split())
S = input()
L = [0]
X = ['1']
pos = 0
for i in range(N):
  if S[i] != X[pos]:
    L.append(1)
    X.append(S[i])
    pos += 1
  else:
    L[pos] += 1
while pos < 2 * K + 4:
  L.append(0)
  X.append('1')
  pos += 1
L.append(0)
X.append('1')
n = len(L)
for i in range(1, n):
  L[i] += L[i-1]
M = L[2*K]
for i in range(1, n-2*K):
  if X[i] == '1':
    M = max(L[2*K+i] - L[i-1], M)
print(M)

Verdicts: Wrong Answer

Accepted
Problem: N people are arranged in a row from left to right.  You are given a string S of length N consisting of `0` and `1`, and a positive integer K.  The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`.  You will give the following direction at most K times (possibly zero):  **Direction** : Choose integers l and r satisfying 1 \leq l \leq r \leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.  Find the maximum possible number of **consecutive** people standing on hands after at most K directions.

Submission attempts (in order):
from sys import exit
def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2

n,k=map(int,input().split())
s=list(input())
x=groupby(s)
l=len(x)
y=[x[i][1] for i in range(l)]

if

if x[0][0]=="0":
    su=sum(y[:2*k])
    ans=su
    y.pop(0)
    l-=1
else:
    ans=0
su=sum(y[:2*k+1])
ans=max(ans,su)
l_sub=(l-(2*k+1))//2
if l_sub<=0:
    print(ans)
    exit()
for i in range(l_sub):
    su-=y[2*i]
    su-=y[2*i+1]
    su+=y[2*k+1+(2*i)]
    su+=y[2*k+1+(2*i+1)]
    ans=max(su,ans)
if 2*k+1+2*l_sub<l:
    su-=y[2*l_sub]
    su+=y[2*k+1+2*l_sub]
    ans=max(su,ans)
print(ans)


from sys import exit
def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2

n,k=map(int,input().split())
s=list(input())
x=groupby(s)
l=len(x)
y=[x[i][1] for i in range(l)]

if x[0][0]=="0":
    r
    su=sum(y[:2*k])
    ans=su
    y.pop(0)
    l-=1
else:
    ans=0
su=sum(y[:2*k+1])
ans=max(ans,su)
l_sub=(l-(2*k+1))//2
if l_sub<=0:
    print(ans)
    exit()
for i in range(l_sub):
    su-=y[2*i]
    su-=y[2*i+1]
    su+=y[2*k+1+(2*i)]
    su+=y[2*k+1+(2*i+1)]
    ans=max(su,ans)
if 2*k+1+2*l_sub<l:
    su-=y[2*l_sub]
    su+=y[2*k+1+2*l_sub]
    ans=max(su,ans)
print(ans)


from sys import exit
def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2

n,k=map(int,input().split())
s=list(input())
x=groupby(s)
l=len(x)
y=[x[i][1] for i in range(l)]

if x[0][0]=="0":
    su=sum(y[:2*k])
    ans=su
    y.pop(0)
    l-=1
else:
    ans=0
su=sum(y[:2*k+1])
ans=max(ans,su)
l_sub=(l-(2*k+1))//2
if l_sub<=0:
    print(ans)
    exit()
for i in range(l_sub):
    su-=y[2*i]
    su-=y[2*i+1]
    su+=y[2*k+1+(2*i)]
    su+=y[2*k+1+(2*i+1)]
    ans=max(su,ans)

if 2*k+1+2*l_sub<l:
    su-=y[2*l_sub]
    su-=y[2*l_sub+1]
    su+=y[2*k+1+2*l_sub]
    ans=max(su,ans)
print(ans)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: N people are arranged in a row from left to right.  You are given a string S of length N consisting of `0` and `1`, and a positive integer K.  The i-th person from the left is standing on feet if the i-th character of S is `0`, and standing on hands if that character is `1`.  You will give the following direction at most K times (possibly zero):  **Direction** : Choose integers l and r satisfying 1 \leq l \leq r \leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.  Find the maximum possible number of **consecutive** people standing on hands after at most K directions.

Submission attempts (in order):
N, K = map(int, input().split())
S = input()
T = []
count = 1
for n in range(N - 1):
    s0, s1 = S[n], S[n + 1]
    if s0 == s1:
        count += 1
    else:
        T.append(count)
        count = 1
T.append(count)
if S[0] == '0':
    T = [0] + T
if S[-1] == '0':
    T = T + [0]
L = len(T)
if 2 * K + 1 >= L:
    print(N)
    exit()


ans = sum(T[0: 2 * K + 2])
for l in range(2, L - (2 * K + 1), 2):
    cand = ans
    cand -= T[l - 2]
    cand -= T[l - 1]
    cand += T[l + 2 * K - 1]
    cand += T[l + 2 * K]
    if cand > ans:
        ans = cand
print(ans)


N, K = map(int, input().split())
S = input()
T = []
count = 1
for n in range(N - 1):
    s0, s1 = S[n], S[n + 1]
    if s0 == s1:
        count += 1
    else:
        T.append(count)
        count = 1
T.append(count)
if S[0] == '0':
    T = [0] + T
if S[-1] == '0':
    T = T + [0]
L = len(T)
if 2 * K + 1 >= L:
    print(N)
    exit()

now = sum(T[0: 2 * K + 1])
ans = now
for l in range(2, L - (2 * K + 1) + 1, 2):
    now -= T[l - 2]
    now -= T[l - 1]
    now += T[l + 2 * K - 1]
    now += T[l + 2 * K]
    if now > ans:
        ans = now
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

s=[a,b,c,d,e,k]

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

s = [input() for i in range(6)]
if s[5]-s[0] < s[6]:
  print("Yay!")
else:
  print(":(")

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
allist = []
for i in range(6):
    num = int(input())
    if i == 5:
        k = num
    else:
        alllist.append(num)

diflist = []
for i in range(4):
    diflist.append(alllist[i+1]-alllist[i])

for i in diflist:
    if i > k:
        print(":(")
        break
else:
    print("Yay!")

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!")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# https://img.atcoder.jp/abc123/editorial.pdf


from heapq import heappush, nlargest

def solve(X, Y, Z, K, A, B, C):
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)

    Q = []
    for a in A:
        for b in B:
            heappush(Q, a+ b)
    AB = nlargest(K, Q)

    Q2 = []
    for ab in AB:
        for c in C:
            heappush(Q2, ab + c)
    ABC = nlargest(K, Q2)
    print("\n".join(map(str, ABC)))

if __name__ == "__main__":
    X, Y, Z, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    solve(X, Y, Z, K, A, B, C)

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
dists = [a, b, c, d, e]
if max(dists) - min(dists) > k:
    print(":(")
else:
    print("Yay!")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
lst=[]
for i in 5:
	lst.append(int(input()))
k = int(input())
sor = sorted(lst)
if sor[4] - sor[0] > k:
	print(":(")
else:
	print("Yay!")


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


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


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c,d,e,k = map(int,open(0).read().split())
print("yay!" if max(a,b,c,d,e) - min(a,b,c,d,e) <= k else ":(")

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n=[int(input()) for _ in range(6)];print([':(','Yay'][max(n[:5])-min(n[:5])<=n[5]])

n=[int(input()) for _ in range(6)];print([':(','Yay!'][n[4]-n[0]<=n[5]])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)


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)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
x, y, z, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans_list = []
for i in a:
    for j in b:
        ans_list.append(i+j)
ans_list.sort(reverse=True)
ans_list = ans_list[:min(3001, x*y*z+1)]
ans_list_2 = []
for i in ans_list:
    for j in c:
        ans_list_2.append(i+j)
ans_list_2.sort(reverse=True)
for i in range(k):
    print(ans_list_2[i])

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

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A=[int(input()) for i in range(5)]
k=int(input())

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

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

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if max(e-a) > k:
    print(":(")
else:
    print("Yay!")

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!")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = int(input())
b = input()
c = input()
d = input()
e = int(input())
k = input()
x = e-a
if x <= k:
    print("Yay!")
else:
    print(":(")


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


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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = ([map(int, input())for _ in range[5]])
k = int(input())
ans="Yay!"
for i in range(1,4):
	if k < a[i]-a[0]:
		ans=":("
print(ans)


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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
L=[int(input()) for _ in range(5)]
k=int(input())
for i in range(1,5):
  if L[i]-L[i-1]>0:
    print(":(")
    exit()
print("Yay!")

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
li = input("lkdfkgkfg").split()
t = 0
s = int(li.pop(5))
for i in li:
    for k in li:
        if int(k) - int(i) >= s:
            t = 1

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

while True:
    s += 1

#coding:utf-8

li = input("lkdfkgkfg").split()
t = 0
s = int(li.pop(5))
for i in li:
    for k in li:
        if int(k) - int(i) >= s:
            t = 1

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

li = input().split()
t = 0
s = li.pop()
print(li)
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(":(")

#coding:utf-8

li = input().split("")
t = 0
s = int(li.pop(5))
for i in li:
    for k in li:
        if int(k) - int(i) >= s:
            t = 1

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

while True:
    s += 1

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

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

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

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

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

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
minmax = [a, b, c, d, e]
if max(minmax) - min(minmax) <= k :
    print('Yay!')
else:
    print(':(')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a=[]

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

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

a=[]

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

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

a=[]

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

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

a=[]

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

k=int(input())
for i in range(5):
    for j in range(5):
        if(i==j):
            continue
        else:
            if(abs(a[i]-a[j])>k):
                print(':(')
                exit()

print('Yay!')


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

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


i = [a[0], a[1], a[2], a[3], a[4]]
k = a[5]

flag = False
itr = 0
while True:
  x = itr
  while True:
    x++
    if 
      break
    else if(i[itr] - i[x]) > k:
      flag = True
  itr++
  if itr == 5
    break
    
if flag
  print(":(")
else
  print("Yay!")

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


i = [a[0], a[1], a[2], a[3], a[4]]
k = a[5]

flag = False
itr = 0
while True:
  x = itr
  while True:
    x+=1
    if x >= 5:
      break
    elif(i[x] - i[itr]) > k:
      flag = True
  itr+=1
  if itr == 5:
    break
    
if flag:
  print(":(")
else:
  print("Yay!")


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a=int(inout())
b=int(inout())
c=int(inout())
d=int(inout())
e=int(inout())
k=int(inout())

v=b-a
w=c-b
x=d-c
y=e-d

z=max(max(v,w),max(x,y))

if z >k:
  print(':')
else:
  print('Yay!)

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

v=b-a
w=c-b
x=d-c
y=e-d

z=max(max(v,w),max(x,y))

if z >k:
  print(':')
else:
  print('Yay!')


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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
ans = [int(input()) for _ in range(6)]
print(':(' if abs(ans[0]-ans[4]) <= ans[-1] else 'Yay!')

ans = [int(input()) for _ range(6)]
print(':(' if abs(ans[0]-ans[4]) > ans[-1] else 'Yay!')

ans = [int(input()) for _ range(6)]
print(':(' if abs(ans[0]-ans[4]) <= ans[-1] else 'Yay!')

ans = [int(input()) for _ in range(6)]
print(':(' if abs(ans[0]-ans[4]) > ans[-1] else 'Yay!')

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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

    
    #print(ls)
    lst = 0
    alst = 0
    i = 1
    
    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()


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 = [a, b, c, d, e]
    k = makeInt(input())
    flag = False
    for i in range(len(l)):
        for j in range(len(l)-1):
            if abs(l[i] - l[j+1]) > k:
                flag = True
    if flag:
        return ":("
    else:
        return "Yay!"


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


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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(i+1,5):
    if a[j]-a[i]>k :
      print(":(")
      sys.exit()
print("Yay!")

import sys
a=[0]*5
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(i+1,5):
    if a[j]-a[i]>k :
      print(":(")
      sys.exit()
print("Yay!")

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from sys import exit

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

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

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

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

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
v=[int(input()) for_ in range(6)]
print('Yay!' if all([abs(v[i]-v[i+1])<=v[5] for i in range(4)) else ':(')

v=[int(input()) for_ in range(6)]
print('Yay!' if v[4]-v[0]<=v[5] else ':(')


v=[int(input()) for_ in range(6)]
print('Yay!' if all([v[i+1]-v[i]<=v[5] for i in range(4)]) else ':(')


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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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("Yey!")


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('Yey!')


a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
if e - a > k :
    print(':(')
else :
    print('Yey!')


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('Yey!')


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('Yey!')


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('Yey!')


a, b, c, d, e, k= map(int, input().split())
if e - a > k:
    print(':(')
else:
    print('Yey!')


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!")


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = []
for i in (5):
  a += [int(input())]
a.sort()
kekka = ":("
if a[4] - a[0] <= k:
  kekka = "Yay!"
print(kekka)

a = []
for i in (5):
  a += [int(input())]
k = int(input())
a.sort()
kekka = ":("
if a[4] - a[0] <= k:
  kekka = "Yay!"
print(kekka)

a = []
for i in range (5):
  a += [int(input())]
k = int(input())
a.sort()
kekka = ":("
if a[4] - a[0] <= k:
  kekka = "Yay!"
print(kekka)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
if e-a>k:
    print(":(")
else:
    print("Yay!")

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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(0, 4):
    for j in range(i+1, 5):
        print(i, j)
        if abs(array[i] - array[j] )> k:
            flag = False
            break
            
if flag:
    print('Yay!')
else:
    print(':(')

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(4):
    for j in range(i, 5):
        if array[i] - array[j] < k:
            pass
        else:
            flag = False
            
if flag:
    print('Yes')
else:
    print(':(')

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(0, 4):
    for j in range(i+1, 5):
        if abs(array[i] - array[j] )> k:
            flag = False
            break
            
if flag:
    print('Yay!')
else:
    print(':(')

Verdicts: Wrong Answer

Wrong Answer

Accepted