Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,d,a=map(int,input().split())
s=sorted([list(map(int,input().split()))+[1]for i in range(n)])
c=0
for i in range(n):
    if s[i][2]:
        s[i][2]=0
        t=((s[i][1]-1)//a+1)
        c+=t
        for j in range(i+1,n):
            if s[j][0]<=s[i][0]+2*d:
                s[j][1]-=t*a
                if s[j][1]<=0:
                    s[j][2]=1
print(c)

Fixed submission:
from bisect import bisect_left as bl
n,d,a=map(int,input().split())
s=sorted([list(map(int,input().split()))for i in range(n)])
c=0
p=[0]
q=[0]
for i in range(n):
    g=bl(q,s[i][0])
    s[i][1]-=a*(p[-1]-p[g-1])
    if s[i][1]>0:
        t=((s[i][1]-1)//a+1)
        c+=t
        p.append(p[-1]+t)
        q.append(s[i][0]+2*d)
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product as p
n=int(input())
s=[[]for i in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    s[a].append([b,i])
    s[b].append([a,i])
m=int(input())
l=[]
for i in range(m):
    u,v=map(int,input().split())
    a=[[]for i in range(n+1)]
    a[u]=[]
    q=[u]
    while q:
        t=q.pop(0)
        d=0
        for i,j in s[t]:
            if a[i]==[]:
                a[i]=a[t]+[j]
                q.append(i)
                if i==v:
                    d=1
                    break
        if d==1:
            break
    l.append(a[v])
for i in range(m):l[i]=set(l[i])
s=[0]*(m+1)
for i in p([0,1],repeat=m):
    d=set([])
    if sum(i)!=0:
        for j in range(m):
            if i[j]:
                d|=l[j]
        s[sum(i)]+=pow(2,n-1-len(d))
l=0
for i in range(1,m+1):
    l+=((-1)**(i-1))*s[i]
print(pow(2,n-1)-l)

Fixed submission:
from itertools import product as p
n=int(input())
s=[[]for i in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    s[a].append([b,i])
    s[b].append([a,i])
m=int(input())
l=[]
for i in range(m):
    u,v=map(int,input().split())
    a=[[]for i in range(n+1)]
    a[u]=[]
    q=[u]
    while q:
        t=q.pop(0)
        d=0
        for i,j in s[t]:
            if a[i]==[]:
                a[i]=a[t]+[j]
                q.append(i)
                if i==v:
                    d=1
                    break
        if d==1:
            break
    l.append(a[v])
for i in range(m):l[i]=set(l[i])
s=[0]*(m+1)
for i in p([0,1],repeat=m):
    d=set([])
    if sum(i)!=0:
        for j in range(m):
            if i[j]:
                d|=l[j]
        s[sum(i)]+=pow(2,n-1-len(d))
l=0
for i in range(1,m+1):
    l+=((-1)**(i-1))*s[i]
print(pow(2,n-1)-l)
Buggy python submission (verdict: Runtime Error):
n=int(input())
d=sorted([list(map(int,input().split()))for i in range(n)],key=lambdax:x[0]+x[1])
c=-float("INF")
an=0
for i,j in d:
    if i-j>=c:
        an+=1
        c=i+j
print(an)

Fixed submission:
n=int(input())
d=sorted([list(map(int,input().split()))for i in range(n)],key=lambda x:x[0]+x[1])
c=-float("INF")
an=0
for i,j in d:
    if i-j>=c:
        an+=1
        c=i+j
print(an)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[0]*n
t=[0]*n
for i in range(m):
    a,b=map(str,input().split())
    a,
    a=int(a)-1
    if not s[a]:
        if b=="WA":
            t[a]+=1
        else:
            s[a]=1
print(sum(s),sum(t[i] for i in range(n)if s[a]))

Fixed submission:
n,m=map(int,input().split())
s=[0]*n
t=[0]*n
for i in range(m):
    a,b=map(str,input().split())
    a,
    a=int(a)-1
    if not s[a]:
        if b=="WA":
            t[a]+=1
        else:
            s[a]=1
print(sum(s),sum(t[i] for i in range(n)if s[i]))
Buggy python submission (verdict: Runtime Error):
from math import gcd
n,m=map(int,input().split())
a=[i//2 for i in set(list(map(int,input().split())))]
l=1
for i in a:
    l=l*i//gcd(i,l)
print((m//l+1)//2)

Fixed submission:
from fractions import gcd
n,m=map(int,input().split())
a=[i//2 for i in set(list(map(int,input().split())))]
b=[]
for i in a:
    c=i
    p=0
    while c%2==0:
        c//=2
        p+=1
    b.append(p)
l=1
if len(set(b))==1:
    for i in a:
        l=l*i//gcd(i,l)
        if m<l:
            print(0)
            break
    else:
        print((m//l+1)//2)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left as bl
from itertools import accumulate as ac
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
s=[0]+list(ac(a[::-1]))
l,r=2*a[-1]*(n**2)+1,0
while l-r>1:
    t=(l+r)//2
    p=0
    for i in range(n):
        x=bl(a,t-a[i])
        p+=n-x
    if p<m:
        l=t
    else:
        r=t
c,d=0,0
w=0
for i in range(n):
    g=bl(a,r-a[i])
    x=n-g
    c+=s[x]+x*a[i]
    w+=x
print(c-r*max(0,(w-m)))

Fixed submission:
from bisect import bisect_left as bl
from itertools import accumulate as ac
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
s=[0]+list(ac(a[::-1]))
l,r=2*a[-1]*(n**2)+1,0
while l-r>1:
    t=(l+r)//2
    p=0
    for i in range(n-1,-1,-1):
        if a[i]+a[-1]>=t:
            x=bl(a,t-a[i])
            p+=n-x
        else:
            break
    if p<m:
        l=t
    else:
        r=t
c,d=0,0
w=0
for i in range(n-1,-1,-1):
    if a[i]+a[-1]>=r:
        g=bl(a,r-a[i])
        x=n-g
        c+=s[x]+x*a[i]
        w+=x
    else:
        break
print(c-r*max(0,(w-m)))
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_right as br
n,m,v,p=map(int,input().split())
a=sorted(list(map(int,input().split())))
l,r=n,-1
while l-r>1:
    t=(l+r)//2
    s=a[t]+m
    w=a[:]
    k=m*(v-1)
    for i in range(n):
        if i!=t:
            if i<t:
                c=min(k,m)
                k-=c
                w[i]+=c
            else:
                if w[i]>=s:
                    break
                else:
                    c=min(k,s-w[i])
                    k-=c
                    w[i]+=c
        if k==0:
            break
    if k>0:
        for j in range(n-1,-1,-1):
            if j!=t:
                g=min(k,m-w[j]+a[j])
                w[j]+=g
                k-=g
            if k==0:
                break
    w.pop(t)
    w=sorted(w)
    if n-br(w,s)<=p:
        l=t
    else:
        r=t
print(n-l)

Fixed submission:
from bisect import bisect_right as br
n,m,v,p=map(int,input().split())
a=sorted(list(map(int,input().split())))
l,r=n,-1
while l-r>1:
    t=(l+r)//2
    s=a[t]+m
    w=a[:]
    k=m*(v-1)
    for i in range(n):
        if i!=t:
            if i<t:
                c=min(k,m)
                k-=c
                w[i]+=c
            else:
                if w[i]>=s:
                    break
                else:
                    c=min(k,s-w[i])
                    k-=c
                    w[i]+=c
        if k==0:
            break
    if k>0:
        for j in range(n-1,-1,-1):
            if j!=t:
                g=min(k,m-w[j]+a[j])
                w[j]+=g
                k-=g
            if k==0:
                break
    w.pop(t)
    w=sorted(w)
    if n-br(w,s)<=p:
        l=t
    else:
        r=t
print(n-l)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
s=[0]*60
m=10**9+7
for i in a:
    t=bin(i)[2:][::-1]
    for i in range(len(t)):
        if t[i]=="1":
            s[i]+=1
c=0
for i in range(60):
    c=(c+s[i]*(n-s[i])*pow(2,i,m))%m
print(c)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
s=[0]*60
m=10**9+7
for i in a:
    t=bin(i)[2:][::-1]
    for i in range(len(t)):
        if t[i]=="1":
            s[i]+=1
c=0
for i in range(60):
    c=(c+s[i]*(n-s[i])*pow(2,i,m))%m
print(c)
Buggy python submission (verdict: Runtime Error):
x=int(input())
if x%100/(x//100)>5:
    print(0)
else:
    print(1)

Fixed submission:
x=int(input())
if x>=100:
    if x%100/(x//100)<=5:
        print(1)  
    else:
        print(0)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
c=0
d=float("INF")
for i in range(n):
    c+=a[i]
    d=min(d,abs(sum(a)-2*c))
print(d)


Fixed submission:
from itertools import accumulate as ac
n=int(input())
a=list(ac(list(map(int,input().split()))))
d=float("INF")
for i in range(n):
    d=min(d,abs(a[-1]-2*a[i]))
print(d)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
c=0
d=float("INF")
for i in range(n):
    c+=a[i]
    d=min(d,abs(sum(a)-2*c))
print(d)

Fixed submission:
from itertools import accumulate as ac
n=int(input())
a=list(ac(list(map(int,input().split()))))
d=float("INF")
for i in range(n):
    d=min(d,abs(a[-1]-2*a[i]))
print(d)
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
m=10**9+7
if (2*x-y)%3==0 and (2*y-x)%3==0 and 2*x=>y and 2*y=>x:
    a,b=(2*x-y)//3,(2*y-x)//3
    c=min(a,b)
    p=1
    for i in range(c):
        p=(p*(a+b-i)*pow(i+1,m-2,m))%m
    print(p)
else:
    print(0)

Fixed submission:
x,y=map(int,input().split())
m=10**9+7
if (2*x-y)%3==0 and (2*y-x)%3==0 and 2*x>=y and 2*y>=x:
    a,b=(2*x-y)//3,(2*y-x)//3
    c=min(a,b)
    p=1
    for i in range(c):
        p=(p*(a+b-i)*pow(i+1,m-2,m))%m
    print(p)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,t=map(int,input().split())
s=[list(map(int,input().split()))for i in range(n)]
a,b=np.zeros((n+1,t+1)),np.zeros((n+1,t+1))
for i in range(n):
    a[i+1]=a[i]
    a[i+1][s[i][0]:]=np.maximum(a[i+1][s[i][0]:],a[i][:t+1-s[i][0]]+s[i][1])
    b[n-i-1]=b[n-i]
    b[n-i-1][s[n-i-1][0]:]=np.maximum(b[n-i-1][s[n-i-1][0]:],b[n-i][:t-s[n-i-1][0]+1]+s[n-i-1][1])
p=0
print(a,b)
for i in range(n):
    for j in range(t):
        p=max(p,a[i][j]+b[i+1][t-1-j]+s[i][1])
print(int(p))

Fixed submission:
import numpy as np
n,t=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
b=np.zeros((n+1,t))
c=np.zeros((n+1,t))
for i in range(n):
    b[i+1]=b[i]
    b[i+1][a[i][0]:]=np.maximum(b[i+1][a[i][0]:],b[i][:-a[i][0]]+a[i][1])
    c[-i-2]=c[-i-1]
    c[-i-2][a[-i-1][0]:]=np.maximum(c[-i-2][a[-i-1][0]:],c[-i-1][:-a[-i-1][0]]+a[-i-1][1])
q=0
for i in range(n):
    q=max(q,max(b[i]+c[i+1][::-1])+a[i][1])
print(int(q))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,t=map(int,input().split())
s=[list(map(int,input().split()))for i in range(n)]
a,b=np.zeros((n+1,t+1)),np.zeros((n+1,t+1))
for i in range(n):
    a[i+1]=a[i]
    a[i+1][s[i][1]:]=np.maximum(a[i+1][s[i][1]:],a[i][:t+1-s[i][1]]+s[i][0])
    b[n-i-1]=b[n-i]
    b[n-i-1][s[n-i-1][1]:]=np.maximum(b[n-i-1][s[n-i-1][1]:],b[n-i][:t-s[n-i-1][1]+1]+s[n-i-1][0])
p=0
for i in range(n):
    for j in range(t+1):
        p=max(p,a[i][j]+b[i+1][t-j]+s[i][0])
print(int(p))

Fixed submission:
import numpy as np
n,t=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
b=np.zeros((n+1,t))
c=np.zeros((n+1,t))
for i in range(n):
    b[i+1]=b[i]
    b[i+1][a[i][0]:]=np.maximum(b[i+1][a[i][0]:],b[i][:-a[i][0]]+a[i][1])
    c[-i-2]=c[-i-1]
    c[-i-2][a[-i-1][0]:]=np.maximum(c[-i-2][a[-i-1][0]:],c[-i-1][:-a[-i-1][0]]+a[-i-1][1])
q=0
for i in range(n):
    q=max(q,max(b[i]+c[i+1][::-1])+a[i][1])
print(int(q))
Buggy python submission (verdict: Runtime Error):
print("YNeos"[1-int(bin(2375063778094260874239)[-int(input())])::2])

Fixed submission:
n=int(input())
for i in range(1,10):
    if 1<=n//i<10 and (n//i)*i==n:
        print("Yes")
        break
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left as bl
from bisect import bisect_right as br
n=int(input())
s=sorted(list(map(int,input().split())))
q=0
d=[[""]*(1001)for i in range(1001)]
for i in range(n):
    for j in range(i+1,n):
        x,y=max(s[i],s[j]),min(s[i],s[j])
        if d[x][y]=="":
            c=br(s,x+y-1)-bl(s,x-y+1)-1
            if x-y<y:
                c-=1
            c=max(c,0)
            d[x][y]=c
        q+=c
print(q//3)

Fixed submission:
from bisect import bisect_left as bl
from bisect import bisect_right as br
n=int(input())
s=sorted(list(map(int,input().split())))
q=0
d=[[""]*(1001)for i in range(1001)]
for i in range(n):
    for j in range(i+1,n):
        x,y=max(s[i],s[j]),min(s[i],s[j])
        if d[x][y]=="":
            c=br(s,x+y-1)-bl(s,x-y+1)-1
            if x-y<y:
                c-=1
            c=max(c,0)
            d[x][y]=c
        q+=d[x][y]
print(q//3)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
t=[]
for i in range(m):
    a,b=map(int,input().split())
    c=list(map(int,input().split()))
    d=0
    for i in c:
        d+=2**(i-1)
    t.append([a,d])
e=[float("INF")]*(2**n)
e[0]=0
for i,j in t:
    for h in range(2**n):
        e[h|j]=min(i+e[h],e[h|j])
print(e[-1] if e[-1]!=float("INF") else -1)


Fixed submission:
n,m=map(int,input().split())
t=[]
for i in range(m):
    a,b=map(int,input().split())
    c=list(map(int,input().split()))
    d=0
    for i in c:
        d+=2**(i-1)
    t.append([a,d])
e=[float("INF")]*(2**n)
e[0]=0
for i,j in t:
    for h in range(2**n):
        e[h|j]=min(i+e[h],e[h|j])
print(e[-1] if e[-1]!=float("INF") else -1)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
h,w,a,b=map(int,input().split())
if a*w!=b*h:
    if h==1 and b==0:
        print("1"*a+"0"*(w-a))
    elif w==1 and a==0:
        for i in range(h):
            if i<b:
                print(1)
            else:
                print(0)
    else:
        print("No")
else:
    t=gcd(a,b)
    s="1"*(a)+"0"*(h-a)
    for i in range(w):
        print(s)
        if (i+1)%(b//t)==0:
            s=s[-(a//t):]+s[:-(a//t)]

Fixed submission:
h,w,a,b=map(int,input().split())
for i in range(h):
    if i<b:
        print("0"*a+"1"*(w-a))
    else:
        print("1"*a+"0"*(w-a))

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
h,w,a,b=map(int,input().split())
if a*w!=b*h:
    if h==1 and b==0:
        print("1"*a+"0"*(w-a))
    elif w==1 and a==0:
        for i in range(h):
            if i<b:
                print(1)
            else:
                print(0)
    else:
        print("No")
else:
    t=gcd(a,b)
    s="1"*(a)+"0"*(h-a)
    print(t)
    for i in range(w):
        print(s)
        if (i+1)%(b//t)==0:
            s=s[-(a//t):]+s[:-(a//t)]

Fixed submission:
h,w,a,b=map(int,input().split())
for i in range(h):
    if i<b:
        print("0"*a+"1"*(w-a))
    else:
        print("1"*a+"0"*(w-a))

Buggy python submission (verdict: Runtime Error):
h,w,a,b=map(int,input().split())
if a*w!=b*h:
    if h==1 and b==0:
        print("1"*b+"0"*(w-b))
    elif w==1 and a==0:
        for i in range(h):
            if i<b:
                print(1)
            else:
                print(0)
    else:
        print("No")
else:
    s="1"*a+"0"*(h-a)
    for i in range(w):
        print(s)
        if i%b==0:
            s="0"*a+s
            s=s[:-a]

Fixed submission:
h,w,a,b=map(int,input().split())
for i in range(h):
    if i<b:
        print("0"*a+"1"*(w-a))
    else:
        print("1"*a+"0"*(w-a))
Buggy python submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
s=[0]*n
for i in range(q):
    s[int(input())]+=1
p=sum(s)
for i in range(n):
    if k>p-s[i]:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q=map(int,input().split())
s=[0]*n
for i in range(q):
    s[int(input())-1]+=1
p=sum(s)
for i in range(n):
    if k>p-s[i]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from heapq import *
n,m=map(int,input().split())
a=list(map(int,input().split()))
q=[]
for i in a:
    heappush(q,[-i,i,0])
for i in range(m):
    s,t,u=heappop(q)
    u+=1
    heappush(q,[-(t//(2**u)),t,u])
print(sum(-q[i][0]for i in range(n)))

Fixed submission:
from heapq import *
n,m=map(int,input().split())
a=list(map(int,input().split()))
q=[]
for i in a:
    heappush(q,-i)
for i in range(m):
    s=heappop(q)
    heappush(q,-(-s//2))
print(sum(int(-q[i])for i in range(n)))
Buggy python submission (verdict: Runtime Error):
s=input()[::-1]
p=[1]+[0]*12
q=1
t=[[(i*k)%13 for i in range(10)]for k in range(13)]
for i in s:
    if i!="?":
        i=int(i)
        g=t[q][i]
        p=p[-g:]+p[:-g]
    else:
        d=[0]*13
        for j in t[q]:
            r=p[-j:]+p[:-j]
            d=[(r[i]+d[i])%(10**9+7)for i in range(13)]
        p=d
    q=(q*10)%13
print(p[5]%(10**9+7))

Fixed submission:
a,b=map(int,input().split());p=abs(a-b);print(abs(max(a,b)-p//2) if p%2==0 else "IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()[::-1]
if s[0]=="?":
    p=[1]*10+[0]*3
else:
    p=[0]*13
    p[int(s[0])]=1
q=10
for i in s[1:]:
    if i!="?":
        i=int(i)
        s=q*i%13
        p=p[-s:]+p[:-s]
    else:
        d=[0]*13
        for j in range(10):
            s=q*j%13
            r=p[-s:]+p[:-s]
            d=[(r[i]+d[i])%(10**9+7)for i in range(13)]
        p=d
    q=(q*10)%13
print(p[5]%(10**9+7))

Fixed submission:
s=input()[::-1]
p=[1]+[0]*12
q=1
t=[[(i*k)%13 for i in range(10)]for k in range(13)]
for i in s:
    if i!="?":
        i=int(i)
        g=t[q][i]
        p=p[-g:]+p[:-g]
    else:
        d=[0]*13
        for j in t[q]:
            r=p[-j:]+p[:-j]
            d=[(r[i]+d[i])%(10**9+7)for i in range(13)]
        p=d
    q=(q*10)%13
print(p[5]%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
s=input()[::-1]
if s[0]=="?":
    p=[1]*10+[0]*3
else:
    p=[0]*13
    p[int(s[0])]=1
q=10
for i in s[1:]:
    if i!="?":
        i=int(i)
        s=q*i%13
        p=p[-s:]+p[:-s]
    else:
        d=[0]*13
        for j in range(10):
            s=q*j%13
            r=p[-s:]+p[:-s]
            d=[r[i]+d[i]for i in range(13)]
        p=[i%(10**9+7) for i in d]
    q=(q*10)%13
print(p[5]%(10**9+7))

Fixed submission:
s=input()[::-1]
p=[1]+[0]*12
q=1
t=[[(i*k)%13 for i in range(10)]for k in range(13)]
for i in s:
    if i!="?":
        i=int(i)
        g=t[q][i]
        p=p[-g:]+p[:-g]
    else:
        d=[0]*13
        for j in t[q]:
            r=p[-j:]+p[:-j]
            d=[(r[i]+d[i])%(10**9+7)for i in range(13)]
        p=d
    q=(q*10)%13
print(p[5]%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
s=input()[::-1]
if s[0]=="?":
    p=[1]*10+[0]*3
else:
    p=[0]*13
    p[int(s[0])]=1
q=10
for i in s[1:]:
    if i!="?":
        i=int(i)
        s=q*i%13
        p=p[-s:]+p[:-s]
    else:
        d=[0]*13
        for j in range(10):
            s=q*j%13
            r=p[-s:]+p[:-s]
            d=[r[i]+d[i]for i in range(13)]
        p=d
    q=(q*10)%13
print(p[5]%(10**9+7))

Fixed submission:
s=input()[::-1]
p=[1]+[0]*12
q=1
t=[[(i*k)%13 for i in range(10)]for k in range(13)]
for i in s:
    if i!="?":
        i=int(i)
        g=t[q][i]
        p=p[-g:]+p[:-g]
    else:
        d=[0]*13
        for j in t[q]:
            r=p[-j:]+p[:-j]
            d=[(r[i]+d[i])%(10**9+7)for i in range(13)]
        p=d
    q=(q*10)%13
print(p[5]%(10**9+7))
Buggy python submission (verdict: Runtime Error):
p=int(input()),s=10**9
print(0,0,s,1,s-p%s,p//s)

Fixed submission:
p=int(input());s=10**9
print(0,0,1,s,0--p//s,-p%s)
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f=[],[],[],[],[],[]
INF=10**9
for i in range(int(input())):
    s,t,u=map(str,input().split())
    if u=="R":
        a.append(int(s))
        e.append(int(t))
    elif u=="L":
        c.append(int(s))
        e.append(int(t))
    elif u=="U":
        d.append(int(t))
        b.append(int(s))
    else:
        f.append(int(t))
        b.append(int(s))
l=10**8+1
r=0
a1,a2=max(a+[-INF]),min(a+[INF])
b1,b2=max(b+[-INF]),min(b+[INF])
c1,c2=max(c+[-INF]),min(c+[INF])
d1,d2=max(d+[-INF]),min(d+[INF])
e1,e2=max(e+[-INF]),min(e+[INF])
f1,f2=max(f+[-INF]),min(f+[INF])
p,q=10,1
while l-r>10**-8:
    x2=(l*2+r)/3
    x1=(l+r*2)/3
    s1,s2=max(a1+x2,b1,c1-x2),min(a2+x2,b2,c2-x2)
    t1,t2=max(d1+x2,e1,f1-x2),min(d2+x2,e2,f2-x2)
    u1,u2=max(a1+x1,b1,c1-x1),min(a2+x1,b2,c2-x1)
    v1,v2=max(d1+x1,e1,f1-x1),min(d2+x1,e2,f2-x1)
    p,q=(s1-s2)*(t1-t2),(u1-u2)*(v1-v2)
    if (s1-s2)*(t1-t2)<=(u1-u2)*(v1-v2):
        r=x1
    else:
        l=x2
print(p)


Fixed submission:
x,a=map(int,input().split());print(0 if x<a else 10)

Buggy python submission (verdict: Runtime Error):
import numpy as np
a=[[[],[],[]],[[],[],[]]]
for i in range(int(input())):
    s,t,u=map(str,input().split())
    if u=="R":
        a[0][0].append(int(s))
        a[1][1].append(int(t))
    elif u=="L":
        a[0][2].append(int(s))
        a[1][1].append(int(t))
    elif u=="U":
        a[1][0].append(int(t))
        a[0][1].append(int(s))
    else:
        a[1][2].append(int(t))
        a[0][1].append(int(s))
for i in range(3):
    a[0][i]=[min(a[0][i]+[INF]),max(a[0][i]+[-INF])]
    a[1][i]=[min(a[1][i]+[INF]),max(a[1][i]+[-INF])]
l=10**8+1
r=0
while l-r>5*(10**-6:
    x2=(l*2+r)/3
    x1=(l+r*2)/3
    h=max(a[0][0][1]+x2,a[0][1]+x2,a[0][
    i=
    j=
    k=
    s=
    t=
    u=
    v=
    print(s,t,u,v)
    if (max(s)-min(s))*(max(t)-min(t))<=(max(u)-min(u))*(max(v)-min(v)):
        r=x1
    else:
        l=x2
print((max(s)-min(s))*(max(t)-min(t)))

Fixed submission:
x,a=map(int,input().split());print(0 if x<a else 10)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a,b,c=map(int,input().split())
d,e,f=list(map(int,input().split()))
s=[0]*(n+1)
for i in range(a,n+1):
    s[i]=max(s[i],s[i-a]+d-a)
for i in range(b,n+1):
    s[i]=max(s[i],s[i-b]+e-b)
for i in range(c,n+1):
    s[i]=max(s[i],s[i-c]+f-c)
n+=s[-1]
s=[0]*(n+1)
for i in range(d,n+1):
    s[i]=max(s[i],s[i-d]+a-d)
for i in range(e,n+1):
    s[i]=max(s[i],s[i-e]+b-e)
for i in range(f,n+1):
    s[i]=max(s[i],s[i-f]+c-f)
print(s[-1]+n)

Fixed submission:
n=int(input())
a,b,c=map(int,input().split())
d,e,f=list(map(int,input().split()))
s=[0]*(n+1)
for i in range(a,n+1):
    s[i]=max(s[i],s[i-a]+d-a)
for i in range(b,n+1):
    s[i]=max(s[i],s[i-b]+e-b)
for i in range(c,n+1):
    s[i]=max(s[i],s[i-c]+f-c)
n+=s[-1]
s=[0]*(n+1)
for i in range(d,n+1):
    s[i]=max(s[i],s[i-d]+a-d)
for i in range(e,n+1):
    s[i]=max(s[i],s[i-e]+b-e)
for i in range(f,n+1):
    s[i]=max(s[i],s[i-f]+c-f)
print(s[-1]+n)

Buggy python submission (verdict: Runtime Error):
n=int(input())
ga,sa,ba=map(int,input().split())
gb,sb,bb=map(int,input().split())
def f(a,b,c,d,e,f,n):
    s=[[a,d-a],[b,e-b],[c,f-c]]
    s=[i for i in s if i[1]>0]
    dp=[0]*(n+1)
    if len(s)==0:
        return n
    if len(s)==1:
        return d*(n//a)+n%a
    else:
        for p,q in s:
            for j in range(a,n+1):
                dp[j]=max(dp[j],dp[j-p]+q)
        return dp[n]
print(f(gb,sb,bb,ga,sa,ba,f(ga,sa,ba,gb,sb,bb,n)))

Fixed submission:
n=int(input())
a,b,c=map(int,input().split())
d,e,f=list(map(int,input().split()))
s=[0]*(n+1)
for i in range(a,n+1):
    s[i]=max(s[i],s[i-a]+d-a)
for i in range(b,n+1):
    s[i]=max(s[i],s[i-b]+e-b)
for i in range(c,n+1):
    s[i]=max(s[i],s[i-c]+f-c)
n+=s[-1]
s=[0]*(n+1)
for i in range(d,n+1):
    s[i]=max(s[i],s[i-d]+a-d)
for i in range(e,n+1):
    s[i]=max(s[i],s[i-e]+b-e)
for i in range(f,n+1):
    s[i]=max(s[i],s[i-f]+c-f)
print(s[-1]+n)

Buggy python submission (verdict: Runtime Error):
n=int(input())
ga,sa,ba=map(int,input().split())
gb,sb,bb=map(int,input().split())
def f(a,b,c,d,e,f,n):
    s=[[a,d-a],[b,e-b],[c,f-c]]
    s=[i for i in s if i[1]>0]
    dp=[0]*(n+1)
    if len(s)==0:
        return n
    if len(s)==1:
        return d*n//a+n%a
    else:
        for p,q in s:
            for j in range(a,n+1):
                dp[j]=max(dp[j],dp[j-p]+q)
        return dp[n]
print(f(gb,sb,bb,ga,sa,ba,f(ga,sa,ba,gb,sb,bb,n)))

Fixed submission:
n=int(input())
a,b,c=map(int,input().split())
d,e,f=list(map(int,input().split()))
s=[0]*(n+1)
for i in range(a,n+1):
    s[i]=max(s[i],s[i-a]+d-a)
for i in range(b,n+1):
    s[i]=max(s[i],s[i-b]+e-b)
for i in range(c,n+1):
    s[i]=max(s[i],s[i-c]+f-c)
n+=s[-1]
s=[0]*(n+1)
for i in range(d,n+1):
    s[i]=max(s[i],s[i-d]+a-d)
for i in range(e,n+1):
    s[i]=max(s[i],s[i-e]+b-e)
for i in range(f,n+1):
    s[i]=max(s[i],s[i-f]+c-f)
print(s[-1]+n)