Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
c = 0
A_ = [0]
for i in range(0,N):
  A_.append(A_[i]+A[i])
A_.sort()
A_set = list(set(A_))
ans = 0
for i in A_set:
  n = A_.count(i)
  ans += n*(n-1)//2
print(ans)



Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
c = 0
A_ = [0]
for i in range(0,N):
  A_.append(A_[i]+A[i])
ans = 0
A_set = (Counter(A_))
print(sum(v*(v-1)//2 for v in A_set.values()))
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
a = sorted(map(int,input().split()))
b = sorted(map(int,input().split()))
c = sorted(map(int,input().split()))
ans = 0
for i in b:
  a_ind = bisect.bisect_left(a,i)
  c_ind = bisect.bisect_right(c,i)
  ans += len(a[:a_ind])*len(c[c_ind:])
print(ans)

Fixed submission:
import bisect
n = int(input())
a = sorted(map(int,input().split()))
b = sorted(map(int,input().split()))
c = sorted(map(int,input().split()))
ans = 0
for i in b:
  a_ind = bisect.bisect_left(a,i)
  c_ind = bisect.bisect_right(c,i)
  ans += a_ind*(n-c_ind)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
print("Possible" if (A+B)%3 == 0 else "Impossible")

Fixed submission:
a,b = map(int,input().split())
print("Possible" if a*b*(a+b)%3==0 else "Impossible")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = []
if n%2==0:
  for i in range(n):
    if i%2==0:
      ans.append(a[i])
    else:
      ans.insert(0,a[i])
    #print(*ans)
else:
  for i in range(n):
    if i%2==0:
      ans.insert(0,a[i])
    else:
      ans.append(a[i])
    #print(*ans)
print(*ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = []
if n%2==0:
  front = a[::2]
  back = a[1::2][::-1]
else:
  front = a[1::2]
  back = a[::2][::-1]
ans = back+front
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in a:
  ans.append(i)
  ans = ans[::-1]
print(*ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = []
if n%2==0:
  front = a[::2]
  back = a[1::2][::-1]
else:
  front = a[1::2]
  back = a[::2][::-1]
ans = back+front
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in range(n):
  if i%2==0:
    ans.append(a[i])
  else:
    ans.insert(0,a[i])
if n%2!=0:
  ans = ans[::-1]
print(*ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = []
if n%2==0:
  front = a[::2]
  back = a[1::2][::-1]
else:
  front = a[1::2]
  back = a[::2][::-1]
ans = back+front
print(*ans)
Buggy python submission (verdict: Runtime Error):
print(sum(map(int,input().split())) if sum(map(int,input().split()))<10 else "error")

Fixed submission:
A,B = map(int,input().split())
print(A+B if A+B<10 else "error")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
suma=sum(a)
l=suma/(4*m)
a.sort(reverse=True)
if a[m]>=l:
    print('Yes')
else:
    print('No')

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
suma=sum(a)
l=suma/(4*m)
a.sort(reverse=True)
if a[m-1]>=l:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
suma=sum(a)
l=suma/(4*m)
a.sort(reverse=True)
if a[m-1]>=l:
    print('Yes')
else:
    print('No')


Fixed submission:
n,k=map(int,input().split())
print(min(n%k,k-n%k))
Buggy python submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=[]
a=list(map(int,input().split()))
dis=[]
dis.append(a[0]+(k-a[n-1]))
for i in range(n-1):
    dis.append(a[i+1]-a[i])
print(k-min(dis))

Fixed submission:
s=[]
s=list((input()))
if s[2]==s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
s=[]
s=list(srt(input().split()))
if s[2]==s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')


Fixed submission:
s=[]
s=list((input()))
if s[2]==s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n,x,y=map(int,input().split())
ans=[0]*n
for i in range(1,n):
    for j in range(i+1,n+1):
        a=min(j-i,abs(j-y)+1+abs(x-i),abs(y-i)+1+abs(x-j))
        ans[a]+=1
for i in range(ans):
    print(ans[i])

Fixed submission:
n,x,y=map(int,input().split())
ans=[0]*(n-1)
for i in range(1,n):
    for j in range(i+1,n+1):
        a=min(j-i,abs(j-y)+1+abs(x-i),abs(y-i)+1+abs(x-j))-1
        ans[a]+=1
for i in range(len(ans)):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=p.sort()
q=q.sort()
r=r.sort()
p=p[:x+1]
q=q[:y+1]
pqr=[]
pqr=p+q+r
pqr=pqr.sort()
print(sum(pqr[:x+y]))

Fixed submission:
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
p=p[:x]
q=q[:y]
p[len(p):len(p)]=q
p[len(p):len(p)]=r
p.sort(reverse=True)
print(sum(p[:x+y]))
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
if h==1 and w==1:
  print(1)
else:
  if (h*w)%2==1:
    print(int(int(h*w//2)+1))
  else:
    print(int(h*w/2))

Fixed submission:
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[int(input())-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
p=list(map(float,input().split()))
maxexp=float(0)


def expected(n):
    return (1+n)/2

p=list(map(expected,p))
for i in range(N-K+1):
    sigmap=0
    for j in range(K):
        sigmap+=p[i+j]
    maxexp=max(sigmap,maxexp)
print(maxexp)


Fixed submission:
N,K=map(int,input().split())
p=list(map(float,input().split()))
maxexp=float(0)


def expected(n):
    return (1+n)/2


p=list(map(expected,p))

for i in range(K):
    maxexp+=p[i]
now=maxexp
for i in range(N-K):
    now=now+p[i+K]-p[i]
    maxexp=max(now,maxexp)
print(maxexp)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
p=list(map(float,input().split()))
maxexp=float(0)


def expected(n):
    return (1+n)/2

p=list(map(expected,p))
for i in range(N-K+1):
    maxexp=max(p[i]+p[i+1]+p[i+2],maxexp)
print(maxexp)

Fixed submission:
N,K=map(int,input().split())
p=list(map(float,input().split()))
maxexp=float(0)


def expected(n):
    return (1+n)/2


p=list(map(expected,p))

for i in range(K):
    maxexp+=p[i]
now=maxexp
for i in range(N-K):
    now=now+p[i+K]-p[i]
    maxexp=max(now,maxexp)
print(maxexp)
Buggy python submission (verdict: Runtime Error):
n=int(input())
math inport ceil
a=[]
for i in range(5):
  a.append(int(input()))
print(ceil(n/min(a))+4)


Fixed submission:
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(':(')
Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=[]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
for i in range(min(x,k)):
  for j in range(min(y,k)):
    for l in range(min(z,k)):
      if i*j*l>k:
        break
      else:
        ans.append(a[i]+b[j]+c[l])
ans.sort(reverse=True)
for i in range(k):
  print(ans[i])


Fixed submission:
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=[]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
for i in range(min(x,k)):
  for j in range(min(y,k)):
    if i*j>k:
      break
    for l in range(min(z,k)):
      if i*j*l>k:
        break
      else:
        ans.append(a[i]+b[j]+c[l])
ans.sort(reverse=True)
for i in range(k):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=[]
a.sort()
b.sort()
c.sort()
for i in range(min(x,k)):
  for j in range(min(y,k)):
    if i*j>k:
      break
    for l in range(min(z,k)):
      if i*j*l>k:
        break
      else:
        ans.append(a[i],b[j],c[l])
ans.sort()
for i in range(k):
  print(ans[i])

Fixed submission:
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=[]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
for i in range(min(x,k)):
  for j in range(min(y,k)):
    if i*j>k:
      break
    for l in range(min(z,k)):
      if i*j*l>k:
        break
      else:
        ans.append(a[i]+b[j]+c[l])
ans.sort(reverse=True)
for i in range(k):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
s=str(input())
a=s.count('0')
print(min(ss,len(s)-ss)*2)


Fixed submission:
s = str(input())
figure1 = s.count('0')
figure2 = s.count('1')
print(min(figure1, figure2)*2)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[]
for _ in range(n):
    l.append(int(input()))
l.sort()
a=0
for i in range(n-k+1):
    if i==0:
        a=l[i+k-1]-l[i]
    else:
        a=min(a,abs(l[i+k-1]-l[i]))
print(a)

Fixed submission:
a=int(input())
if a==22:
    print('Christmas Eve Eve Eve')
elif a==23:
    print("Christmas Eve Eve")
elif a==24:
    print("Christmas Eve")
else:
    print("Christmas")
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[]
for _ in range(n):
    l.append(int(input()))
l.sort()
a=0
for i in range(n-k+1):
    if i==0:
        a=l[i+k-1]-l[i]
    else:
        a=min(a,abs(l[i+k-1]-l[i]))
print(a)

Fixed submission:
n=int(input())
l=[]
for _ in range(n):
    l.append(int(input()))
print(sum(l)-int(max(l)/2))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[]
for _ in range(n):
    l.append(int(input()))
l.sort()
a=0
for i in range(n-k+1):
    if i==0:
        a=l[i+k-1]-l[i]
    else:
        a=min(a,abs(l[i+k-1]-l[i]))
print(a)
n,k=map(int,input().split())
l=[]
for _ in range(n):
    l.append(int(input()))
l.sort()
a=0
for i in range(n-k+1):
    if i==0:
        a=l[i+k-1]-l[i]
    else:
        a=min(a,abs(l[i+k-1]-l[i]))
print(a)

Fixed submission:
n=int(input())
l=[]
for _ in range(n):
    l.append(int(input()))
print(sum(l)-int(max(l)/2))

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[]
for _ in range(n):
    l.append(int(iｂnput()))
print(sum(l)-int(max(l)/2))


Fixed submission:
n=int(input())
l=[]
for _ in range(n):
    l.append(int(input()))
print(sum(l)-int(max(l)/2))
Buggy python submission (verdict: Runtime Error):
n=int(inpit())
if n==1:
  print('Hello World')
else:
  a=int(input())
  b=int(input())
  print(a+b)

Fixed submission:
n=int(input())
if n==1:
  print('Hello World')
else:
  a=int(input())
  b=int(input())
  print(a+b)
Buggy python submission (verdict: Runtime Error):
N,x=map(int,input().split())
a=[]
ans=0
a=list(map(int,input().split()))
a.sorted
for i in a:
    if i>=x:
        x-=i
        ans+=1
    else:
        break
print(ans)

Fixed submission:
N,x=map(int,input().split())
a=[]
ans=0
a=list(map(int,input().split()))
a.sort()
for i in range(N):
    if i==N-1 and a[i]!=x:
        break
    elif a[i]<=x:
        x-=a[i]
        ans+=1
    else:
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
n,i=map(int、input().split())
print(n-i+1)


Fixed submission:
n,i=map(int,input().split())
print(n-i+1)
Buggy python submission (verdict: Runtime Error):
a=map(int,input().split())
a.sort()
print(min((abs(a[0]-a[1])+abs(a[1]-a[2])),(abs(a[2]-a[1])+abs(a[1]-a[0]))))

Fixed submission:
a=list(map(int,input().split()))
a.sort()
print(min((abs(a[0]-a[1])+abs(a[1]-a[2])),(abs(a[2]-a[1])+abs(a[1]-a[0]))))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
a=map(int,input().split())
ans=0
flag=0
changeflag=[]
changeflag.append(0)
for i in range(n-1):
    if a[i]==a[i+1]:
        if i==0:
            changeflag.append(1)
            ans+=1
        elif changeflag[i-1]==1:
            changeflag.append(0)
        else:
            ans+=1
            changeflag.append(1)
    else:
        changeflag.append(0)
print(ans)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
changeflag=[]
for i in range(n-1):
    if a[i]==a[i+1]:
        if i==0 or changeflag[i-1]==0:
            changeflag.append(1)
        else:
            changeflag.append(0)
    else:
        changeflag.append(0)
print(changeflag.count(1))
Buggy python submission (verdict: Runtime Error):
a=int(input())
n=list(str(a))
N=map(int,n)
an=0
lena=len(n)
for i in range(lena):
    an += N[i]
if a % an ==0:
    print('Yes')
else:
    print('No')


Fixed submission:
n=str(input())
a=0
for i in n:
    a += int(i)
if int(n)%a==0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a,b=int(input())
if a>6 or b>6:
    print(':(')
else:
    print('Yay!')


Fixed submission:
a,b=map(int,input().split())
if a>8 or b>8:
    print(':(')
else:
    print('Yay!')
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if b = 100:
     print((100**a) * (b+1))
else:
    print((100**a) * (b))


Fixed submission:
a,b = map(int,input().split())
if b == 100:
     print((100**a) * (b+1))
else:
    print((100**a) * (b))
Buggy python submission (verdict: Runtime Error):
a=int(input())
s=0
while True:
    if 10**s < a:
        s +=1
    else:
        break
a1=a-10**s
alist=list(str(a1))
aintlist=map(int,alist)
aa=sum(aintlist)
print(s+aa)

Fixed submission:
import math

n = int(input())
sum = 0
length = int(math.log10(n) + 1)

for i in range(length):
	sum += n % 10
	n = int(n / 10)

if sum == 1:
	print(10)
else:
	print(sum)
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if(abs(a-c)<=d):
      print(“Yes”)
elif(abs(a-b)<=d and abs(b-c)<=d):
      print(“Yes”)
else:
      print(“No”)

Fixed submission:
a,b,c,d = map(int,input().split())
if(abs(a-c) <= d):
    print("Yes")
elif(abs(a-b)<=d and abs(b-c)<=d):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
x=int(input())
a=1
while true:
     if(a**2>x):
           print(a-1)
           break
     else:
           a+=1

Fixed submission:
X=int(input())
a=[]
for i in range(0,32):
  for j in range(2,11):
    if i**j<=X:
      a.append(i**j)
    else:
      pass
print(max(a))
Buggy python submission (verdict: Runtime Error):
a=str(input())
b=str(input())
c=str(input())
slice=a[:1]
slice=b[1:2]
slice=c[2:3]
s=a[:1]+b[1:2]+c[2:3]
print(“s”)

Fixed submission:
a=list(str(input()))
b=list(str(input()))
c=list(str(input()))
print(str(a[0]+b[1]+c[2]))

Buggy python submission (verdict: Runtime Error):
a=str(input())
b=str(input())
c=str(input())
print(“a[:1]+b[1:2]+c[2:3]”)

Fixed submission:
a=list(str(input()))
b=list(str(input()))
c=list(str(input()))
print(str(a[0]+b[1]+c[2]))

Buggy python submission (verdict: Runtime Error):
a=str(input())
b=str(input())
c=str(input())
print(a[:1]b[1:2]c[2:3])

Fixed submission:
a=list(str(input()))
b=list(str(input()))
c=list(str(input()))
print(str(a[0]+b[1]+c[2]))

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
print(“a[:1]b[1:2]c[2:3]”)

Fixed submission:
a=list(str(input()))
b=list(str(input()))
c=list(str(input()))
print(str(a[0]+b[1]+c[2]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
if("Y" in s):
      print("Four")
else:
      print("Three")

Fixed submission:
N=int(input())
print(int(N/3))
Buggy python submission (verdict: Runtime Error):
a=int,input()
b=int,input()
if(a%500 < b):
  print("Yes")
else:
  print("No")
    

Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=input()
A=input()
N!=0
B=N%500
if(int(B) <= int(A)):
    print("Yes")
else:
    print("No")


Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=input()
A=input()
N!=0
B=N%500
if(B < A):
    print("Yes")
else:
    print("No")

Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=input()
A=input()
B=N%500
C=int(B)
D=int(A)
if(C < A):
    print("Yes")
else:
    print("No")


Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=input()
A=input()
B=N%500
if(int(B)<int(A)):
    print("Yes")
else:
    print("No")


Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=int,input()
A=int,input()
B=N%500
if(B<A):
    print("Yes")
else:
    print("No")


Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=input()
A=input()
B=N%500
if(B<A):
    print("Yes")
else:
    print("No")

Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=input()
A=input()
B=N%500
if(int(B)-int(A))==0):
    print("Yes")
else:
    print("No")

Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
=input()
A=input()
B=N%500
if(int(B-A)==0):
    print("Yes")
else:
    print("No")


Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=input()
A=input()
B=N%500
if(B-A==0):
    print("Yes")
else:
    print("No")


Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=input()
A=input()
B=N%500

if(int(B)-int(A)==0):
    print("Yes")
else:
    print("No")


Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=input()
A=input()
B=N%500
if(B-A==0):
    print("Yes")
else:
    print("No")


Fixed submission:
N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
c = []
for _ in range(3):
    c.append(list(input().split()))
if c[0][0]+c[1][1]+c[2][2]] == c[0][0]+c[1][2]+c[2][1] and c[0][0]+c[1][2]+c[2][1] == c[0][1]+c[1][0]+c[2][2]:
    if c[0][1]+c[1][0]+c[2][2] == c[0][1]+c[1][2]+c[2][0] and c[0][1]+c[1][2]+c[2][0] == c[0][2]+c[1][0]+c[2][1]:
         if c[0][2]+c[1][0]+c[2][1] == c[0][2]+c[1][1]+c[2][0]:
             print("Yes")
else:
    print("No")


Fixed submission:
c = []
for _ in range(3):
    c.append(list(map(int, input().split())))
A, B, C, D, E, F, G, H, I = c[0][0], c[0][1], c[0][2], c[1][0], c[1][1], c[1][2], c[2][0], c[2][1], c[2][2]

if max(A+E+I, A+F+H, B+D+I, B+F+G, C+D+H, C+E+G) == min(A+E+I, A+F+H, B+D+I, B+F+G, C+D+H, C+E+G):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n,y=map(int,input().split())
a=0
for i in range(n+1):
    for j in range(n-i+1):
        k=n-(i+j)
        if 10000*i + 5000*j + 1000*k == y:
            a+=1
        else:
            pass
        if a == 1:
            print(i,j,k)
            break
        else:
            pass
    if a >= 1:
        break
if a ==0:
    print(-1, -1, -1)
else:
    pass
n,y=map(int,input().split())
a=0
for i in range(n+1):
    for j in range(n-i+1):
        k=n-(i+j)
        if 10000*i + 5000*j + 1000*k == y:
            a+=1
        else:
            pass
        if a == 1:
            print(i,j,k)
            break
        else:
            pass
    if a >= 1:
        break
if a ==0:
    print(-1, -1, -1)
else:
    pass



Fixed submission:
n,y=map(int,input().split())
a=0
for i in range(n+1):
    for j in range(n-i+1):
        k=n-(i+j)
        if 10000*i + 5000*j + 1000*k == y:
            a+=1
        else:
            pass
        if a == 1:
            print(i,j,k)
            break
        else:
            pass
    if a >= 1:
        break
if a ==0:
    print(-1, -1, -1)
else:
    pass
Buggy python submission (verdict: Runtime Error):
from math import ceil
n=int(input())
ans4=0
ans2=0
ans0=0
a=list(map(int,input().split()))
for i in range(n):
  if a[i]%4==0:
    ans4+=1
  elif a[i]%2==0:
    ans2+=1
  else:
    ans0+=1
if ans2>0:
  if ans0<=ans4:
    print('Yes')
  else:
    print('No')
else:
  if ceil((ans0+ans4)/2)>=:ans0
    print('Yes')
  else:
    print('No')


Fixed submission:
from math import ceil
n=int(input())
ans4=0
ans2=0
ans0=0
a=list(map(int,input().split()))
for i in range(n):
  if a[i]%4==0:
    ans4+=1
  elif a[i]%2==0:
    ans2+=1
  else:
    ans0+=1
if ans2>0:
  if ans0<=ans4:
    print('Yes')
  else:
    print('No')
else:
  if ceil((ans0+ans4)/2)>=ans0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n=int(input())
ans4=0
ans2=0
a=input().split()
for i in range(n):
  if a[i]%4==0:
    ans4+=1
  elif a[i]%2==0:
    ans2+=1
  else:
    pass
if (n-ans2)//2+1<=ans4:
  print('Yes')
else:
  print('No')

Fixed submission:
from math import ceil
n=int(input())
ans4=0
ans2=0
ans0=0
a=list(map(int,input().split()))
for i in range(n):
  if a[i]%4==0:
    ans4+=1
  elif a[i]%2==0:
    ans2+=1
  else:
    ans0+=1
if ans2>0:
  if ans0<=ans4:
    print('Yes')
  else:
    print('No')
else:
  if ceil((ans0+ans4)/2)>=ans0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
height, wide = map(int, input().split())
n = int(input())
anstr = ''
a = list(map(int, input().split()))
for i in range(n):
    for j in range(a[i]):
        anstr += str(i)
for k in range(n/wide):
    if k % 2 == 0:
        print(anstr[k:k+wide])
    else:
        print(anstr[k:k+wide:-1])


Fixed submission:
height, wide = map(int, input().split())
n = int(input())
anslist = []

a = list(map(int, input().split()))
for i, j in enumerate(a):
    for l in range(j):
        anslist.append(i+1)
for k in range(height):
    t = anslist[k*wide:(k+1)*wide]
    if k % 2 == 1:
        t.reverse()
    print(' '.join(map(str, t)))
Buggy python submission (verdict: Runtime Error):
K, S = list(map(int, input().split()))

a = 0
for i in range(K + 1):
    r = S - i
    if i <= S and r <= K * 2:
        t = (r + 1) - max(0, r - K) * 2
        a += t

print(a)


Fixed submission:
print(input().replace(',',' '))
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
ans = 0
for i in range(0,K+1):
    for j in range(0,K+1):
        for k in range(0,K+1):
            if(i+j+k==S):
                ans += 1
            else:
                pass
print(ans)


Fixed submission:
K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
    n = S - i
    if i <= S and n <= K * 2:
        a = (n + 1) - max(0, n - K) * 2
        ans += a
print(ans)