Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))
m=0
zf=0
for i in range(n):
    if l[i]==0:
        zf=1
if zf==0:
    l.append(0)
    l.sort()
else:
    k-=1
if k==0:
    print(0)
    exit()
n=len(l)
pl=[]
nl=[]
for i in range(n):
    if l[i]==0:
        m=i
    elif l[i]>0:
        pl.append(l[i])
    else:
        nl.append(-l[i])
        
ans=1e10
for i in range(min(k-1,len(pl))):
    a=len(nl)-k+i+1
    if a>=0 and a<len(nl):
        ans=min(ans,2*pl[i]+nl[len(nl)-k-i+1])
for i in range(min(k-1,len(nl))):
    a=len(nl)-i-1
    b=k-i-2
    if b>=0 and b<len(pl):
        ans=min(ans,2*nl[a]+pl[k-i-2])
if k<=len(pl):
    ans=min(ans,pl[k-1])
if k<=len(nl):
    ans=min(ans,nl[len(nl)-k])
print(ans)




Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
m=0
zf=0
for i in range(n):
    if l[i]==0:
        zf=1
if zf==0:
    l.append(0)
    l.sort()
else:
    k-=1
if k==0:
    print(0)
    exit()
n=len(l)
pl=[]
nl=[]
for i in range(n):
    if l[i]==0:
        m=i
    elif l[i]>0:
        pl.append(l[i])
    else:
        nl.append(-l[i])
        
ans=1e10
for i in range(min(k-1,len(pl))):
    a=len(nl)-k+i+1
    if a>=0 and a<len(nl):
        ans=min(ans,2*pl[i]+nl[len(nl)-k+i+1])
for i in range(min(k-1,len(nl))):
    a=len(nl)-i-1
    b=k-i-2
    if b>=0 and b<len(pl):
        ans=min(ans,2*nl[a]+pl[k-i-2])
if k<=len(pl):
    ans=min(ans,pl[k-1])
if k<=len(nl):
    ans=min(ans,nl[len(nl)-k])
print(ans)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))
m=0
zf=0
for i in range(n):
    if l[i]==0:
        zf=1
if zf==0:
    l.append(0)
    l.sort()
else:
    k-=1
    
n=len(l)
pl=[]
nl=[]
for i in range(n):
    if l[i]==0:
        m=i
    elif l[i]>0:
        pl.append(l[i])
    else:
        nl.append(-l[i])
        
ans=1e10
for i in range(min(k,len(pl))):
    a=len(nl)-k-i+1
    if a>=0 and a<len(nl):
        ans=min(ans,2*pl[i]+nl[len(nl)-k-i+1])
for i in range(min(k,len(nl))):
    a=len(nl)-i-1
    b=k-i-2
    if b>=0 and b<len(pl):
        ans=min(ans,2*nl[a]+pl[k-i-2])
if k<=len(pl):
    ans=min(ans,pl[k-1])
if k<=len(nl):
    ans=min(ans,nl[len(nl)-k])
print(ans)




Fixed submission:
n,k=map(int,input().split())
l=list(map(int,input().split()))
m=0
zf=0
for i in range(n):
    if l[i]==0:
        zf=1
if zf==0:
    l.append(0)
    l.sort()
else:
    k-=1
if k==0:
    print(0)
    exit()
n=len(l)
pl=[]
nl=[]
for i in range(n):
    if l[i]==0:
        m=i
    elif l[i]>0:
        pl.append(l[i])
    else:
        nl.append(-l[i])
        
ans=1e10
for i in range(min(k-1,len(pl))):
    a=len(nl)-k+i+1
    if a>=0 and a<len(nl):
        ans=min(ans,2*pl[i]+nl[len(nl)-k+i+1])
for i in range(min(k-1,len(nl))):
    a=len(nl)-i-1
    b=k-i-2
    if b>=0 and b<len(pl):
        ans=min(ans,2*nl[a]+pl[k-i-2])
if k<=len(pl):
    ans=min(ans,pl[k-1])
if k<=len(nl):
    ans=min(ans,nl[len(nl)-k])
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m,q=map(int,input().split())
g=[[0 for i in range(n+2)] for j in range(n+2)]
for i in range(m):
    a,b=map(int,input().split())
    #a-=1
    #b-=1
    g[a][a]+=1
    g[a][b+1]-=1
    g[b+1][a]-=1
    g[b+1][b+1]+=1
for i in range(n):
    for j in range(n+1):
        g[i+1+1][1+j]+=g[1+i][1+j]
for i in range(n+1):
    for j in range(n):
        g[1+i][1+j+1]+=g[1+i][j+1]
        
#r=[[0 for i in range(n+2)] for j in range(n+2)]
for i in range(n+1):
    for j in range(n+2):
        g[i+1][j]+=g[i][j]
for i in range(n+2):
    for j in range(n+1):
        g[i][j+1]+=g[i][j]
for i in range(q):
    a,b=map(int,input().split())
    b+=1
    print(r[b][b]+r[a][a]-2*r[a][b])


Fixed submission:
n,m,q=map(int,input().split())
g=[[0 for i in range(n+1)] for j in range(n+1)]
for i in range(m):
    a,b=map(int,input().split())
    #a-=1
    #b-=1
    g[a][b]+=1
    
for i in range(n):
    for j in range(n+1):
        g[i+1][j]+=g[i][j]
for i in range(n+1):
    for j in range(n):
        g[i][j+1]+=g[i][j]
for i in range(q):
    a,b=map(int,input().split())
    a-=1
    print(g[b][b]+g[a][a]-g[a][b]-g[b][a])
#print(g)

Buggy python submission (verdict: Time Limit Exceeded):
n,m,q=map(int,input().split())
g=[[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    g[a][b]+=1
r=[[0 for i in range(n+1)] for j in range(n)]
for i in range(n):
    for j in range(1,n+1):
        r[i][j]=r[i][j-1]+g[i][j-1]
for i in range(q):
    a,b=map(int,input().split())
    a-=1
    b-=1
    ans=0
    for i in range(a,b+1):
        ans+=r[i][b+1]-r[i][a]
    print(ans)


Fixed submission:
n,m,q=map(int,input().split())
g=[[0 for i in range(n+1)] for j in range(n+1)]
for i in range(m):
    a,b=map(int,input().split())
    #a-=1
    #b-=1
    g[a][b]+=1
    
for i in range(n):
    for j in range(n+1):
        g[i+1][j]+=g[i][j]
for i in range(n+1):
    for j in range(n):
        g[i][j+1]+=g[i][j]
for i in range(q):
    a,b=map(int,input().split())
    a-=1
    print(g[b][b]+g[a][a]-g[a][b]-g[b][a])
#print(g)

Buggy python submission (verdict: Time Limit Exceeded):
n,m,q=map(int,input().split())
g=[[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    g[a][b]+=1
r=[[0 for i in range(n+1)] for j in range(n)]
for i in range(n):
    for j in range(1,n+1):
        r[i][j]=r[i][j-1]+g[i][j-1]
for i in range(q):
    a,b=map(int,input().split())
    a-=1
    b-=1
    ans=0
    for i in range(a,b+1):
        ans+=r[i][b+1]-r[i][a]
    print(ans)

Fixed submission:
n,m,q=map(int,input().split())
g=[[0 for i in range(n+1)] for j in range(n+1)]
for i in range(m):
    a,b=map(int,input().split())
    #a-=1
    #b-=1
    g[a][b]+=1
    
for i in range(n):
    for j in range(n+1):
        g[i+1][j]+=g[i][j]
for i in range(n+1):
    for j in range(n):
        g[i][j+1]+=g[i][j]
for i in range(q):
    a,b=map(int,input().split())
    a-=1
    print(g[b][b]+g[a][a]-g[a][b]-g[b][a])
#print(g)
Buggy python submission (verdict: Runtime Error):
d,g=map(int,input().split())
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
op=[[0],[1]]
for i in range(d-1):
    tmp=[]
    for j in op:
        tmp.append(j+[0])
        tmp.append(j+[1])
    op=tmp
ans=10**10
for i in op:
    z=0
    k=[]
    c=0
    for j in range(d):
        if i[j]==1:
            z+=l[j][0]*100*(j+1)+l[j][1]
            c+=l[j][0]
        else:
            k.append(j)
    if z>=g:
        ans=min(ans,c)
    else:
        if len(k)>0:
            m=max(k)
            p=g-z
            cn=-(-p//((m+1)*100))
            if cn<l[m][0]:
                ans=min(ans,c+cn)
print(ans)

Fixed submission:
d,g=map(int,input().split())
l=[]
for i in range(d):
    l.append(list(map(int,input().split())))
op=[[0],[1]]
for i in range(d-1):
    tmp=[]
    for j in op:
        tmp.append(j+[0])
        tmp.append(j+[1])
    op=tmp
ans=10**10
for i in op:
    z=0
    k=[]
    c=0
    for j in range(d):
        if i[j]==1:
            z+=l[j][0]*100*(j+1)+l[j][1]
            c+=l[j][0]
        else:
            k.append(j)
    if z>=g:
        ans=min(ans,c)
    else:
        if len(k)>0:
            m=max(k)
            p=g-z
            cn=-(-p//((m+1)*100))
            if cn<l[m][0]:
                ans=min(ans,c+cn)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(str(n))
sn=0
for i range(len(s)):
    sn+=int(s[i])
if sn%n==0:
    print('Yes')
else:
    print('No')
            

Fixed submission:
n=int(input())
s=list(str(n))
sn=0
for i in range(len(s)):
    sn+=int(s[i])
if n%sn==0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
a=y-x
b=a*(a-1)/2
print(round(b-x))


Fixed submission:
n=int(input())
if n<=999:
    print('ABC')
else:
    print('ABD')
Buggy python submission (verdict: Runtime Error):
n=int(input())
if a%2==0:
    a=n//2+1
else:
    a=n//2+2
def wa(k):
    kai=0
    while k>0:
        kai+=round(k%10)
        k=round((k-round(k%10))/10)
    return kai
ans=10000000000
for i in range(1,a+1):
    b=i
    c=n-i
    if ans>(wa(b)+wa(c)):
        ans=wa(b)+wa(c)
print(ans)

Fixed submission:
n=int(input())
if n%2==0:
    a=n//2+1
else:
    a=n//2+2
def wa(k):
    kai=0
    while k>0:
        kai+=round(k%10)
        k=round((k-round(k%10))/10)
    return kai
ans=10000000000
for i in range(1,a+1):
    b=i
    c=n-i
    if ans>(wa(b)+wa(c)):
        ans=wa(b)+wa(c)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        if bi<=n:
            ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)*p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
            ans%=mod
print(ans)

Fixed submission:
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        if bi<=n:
            ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)*p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
            ans%=mod
print(ans)

Buggy python submission (verdict: Runtime Error):
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)*p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
        ans%=mod
print(ans)

Fixed submission:
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        if bi<=n:
            ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)*p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
            ans%=mod
print(ans)

Buggy python submission (verdict: Runtime Error):
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)*p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
        ans%=mod
print(ans)

Fixed submission:
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        if bi<=n:
            ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)*p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
            ans%=mod
print(ans)

Buggy python submission (verdict: Runtime Error):
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)
        ans%=mod
        ans+=p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
        ans%=mod
print(ans)

Fixed submission:
n,a,b,k=map(int,input().split())
mod=998244353
ans=0
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((i+1)*p[i])%mod
for ai in range(n+1):
    if k-a*ai>=0 and (k-a*ai)%b==0:
        bi=(k-a*ai)//b
        if bi<=n:
            ans+=p[n]*pow(p[ai],mod-2,mod)*pow(p[n-ai],mod-2,mod)*p[n]*pow(p[bi],mod-2,mod)*pow(p[n-bi],mod-2,mod)
            ans%=mod
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
e=0
ans=0
x=0
g=0
for s in range(n):
    while x==g and e<n:
        x^=l[e]
        g+=l[e]
        e+=1
    if e==n and x==g:
        ans+=e-s
    else:
        ans+=e-s
        x^=l[e]
        g-=l[e]
        x^=l[s]
        g-=l[s]
print(ans)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
e=0
ans=0
x=0
g=0
for s in range(n):
    while x==g and e<n:
        x^=l[e]
        g+=l[e]
        e+=1
    if e==n and x==g:
        ans+=e-s
    else:
        ans+=e-s-1
        x^=l[s]
        g-=l[s]
print(ans)
Buggy python submission (verdict: Runtime Error):
s=list(input())
k=int(input())
z=[]
for i in range(1,k+1):
    for j in range(len(s)):
        if j+i<len(s):
            z.append(s[j:j+i])
z.sort()
print(z[k-1])

Fixed submission:
s=list(input())
k=int(input())
z=[]
for i in range(1,k+1):
    for j in range(len(s)):
        if j+i<=len(s):
            z.append(s[j:j+i])
a=[]
for i in z:
    a.append(''.join(i))
a=list(set(a))
a.sort()
print(a[k-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
r[0]*(n+1)
for i in range(n):
    r[i+1]=r[i]+l[i]
r.sort()
r.append(100000000000)
f=1
ans=0
for i in range(n+1):
    if r[i]==r[i+1]:
        f+=1
    else:
        ans+=f*(f-1)//2
        f=1
print(ans)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
r=[0]*(n+1)
for i in range(n):
    r[i+1]=r[i]+l[i]
r.sort()
r.append(100000000000)
f=1
ans=0
for i in range(n+1):
    if r[i]==r[i+1]:
        f+=1
    else:
        ans+=f*(f-1)//2
        f=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[]
for i in range(n):
    s=list(input())
    l.append(s+s)
ans=0
for i in range(n):
    f=0
    for h in range(n):
        for w in range(n):
            #0,0+i 1,1+i h,h+i
            if l[h][w+i]!=l[w][h+i]:
                f+=1
    if f==0:
        ans+=1
print(ans*n)


Fixed submission:
n=int(input())
l=[]
for i in range(n):
    s=list(input())
    l.append(s+s)
ans=0
for i in range(n):
    f=0
    for h in range(n):
        for w in range(n):
            #0,0+i 1,1+i h,h+i
            if l[h][w+i]!=l[w][h+i]:
                f+=1
    if f==0:
        ans+=1
print(ans*n)
Buggy python submission (verdict: Runtime Error):
a,b,c,x,y = map(int,input().split())
ya=min(a+b,2*c)
s=min(x,y)
if x>y:
    n=x-y
    k=a
else:
    n=y-x
    k=b
print(ya*s+n*min(k,2*c))


Fixed submission:
s=list(input())
ans=700
for i in range(3):
    if s[i]=='o':
        ans+=100
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
ans=0
ma=max(a,b,c)
mi=min(a,b,c)
mj=a+b+c-ma-mi
ans+=(ma-mi)//2
mi+==((ma-mi)//2)*2
ans+=(ma-mj)//2
mj+=((ma-mj)//2)*2
if ma==mi==mj:
    print(ans)
elif ma==mi+1 and ma==mj+1:
    print(ans+1)
else:
    print(ans+2)

Fixed submission:
a,b,c=map(int,input().split())
ans=0
ma=max(a,b,c)
mi=min(a,b,c)
mj=a+b+c-ma-mi
ans+=(ma-mi)//2
mi+=((ma-mi)//2)*2
ans+=(ma-mj)//2
mj+=((ma-mj)//2)*2
if ma==mi==mj:
    print(ans)
elif ma==mi+1 and ma==mj+1:
    print(ans+1)
else:
    print(ans+2)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
    a.append(list(map(int,input().split())))
b=[]
for i in range(n):
    b.sppend(list(map(int,input().split())))
a.sort()
b=sorted(b,key=lambda x: -x[1])
ans=0
vb=[]
for i in range(n):
    for j in range(n):
        if not j in vb:
            if a[i][0]<b[j][0] and a[i][1]<b[j][1]:
                vb.append(j)
                ans+=1
                break
print(ans)

Fixed submission:
n=int(input())
a=[]
for i in range(n):
    a.append(list(map(int,input().split())))
b=[]
for i in range(n):
    b.append(list(map(int,input().split())))
b.sort()
a=sorted(a,key=lambda x: -x[1])
ans=0
vb=[]
for i in range(n):
    for j in range(n):
        if not j in vb:
            if a[i][0]<b[j][0] and a[i][1]<b[j][1]:
                vb.append(j)
                ans+=1
                break
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
b=[]
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(n):
    b.append(list(map(int,input().split())))
c=[[] for i in range(n)]
for bi in range(n):
    for ai in range(n):
        if a[ai][0]<b[bi][0] and a[ai][1]<b[bi][1]:
            c[bi].append(a[ai])
z=[]
cin=0
for i in range(n):
    if len(c[i])>0:
        cin+=1
        z+=c[i]
print(min(cin,len(set(z))))

Fixed submission:
n=int(input())
a=[]
for i in range(n):
    a.append(list(map(int,input().split())))
b=[]
for i in range(n):
    b.append(list(map(int,input().split())))
b.sort()
a=sorted(a,key=lambda x: -x[1])
ans=0
vb=[]
for i in range(n):
    for j in range(n):
        if not j in vb:
            if a[i][0]<b[j][0] and a[i][1]<b[j][1]:
                vb.append(j)
                ans+=1
                break
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    s=list(str(i))
    k=0
    for j in range(5):
        k+=s[j]*(10**j)
    if i==k:
        ans+=1
print(ans)

Fixed submission:
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    s=list(str(i))
    k=0
    for j in range(5):
        k+=int(s[j])*(10**j)
    if i==k:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[]
for i in range(h):
    s.append(list(input()))
a=0
for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            a+=1

visited = [[0]*w for _ in range(h)]

def dfs(s,visit,h,w):
    stack=[[0,0,1]]
    visit[0][0]=1
    while stack:
        sh,sw,c=stack.pop(0)
        if sh==h-1 and sw==w-1:
            return c
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_h, new_w = sh+j, sw+k
            if new_h < 0 or new_h >= h or new_w < 0 or new_w >= w:
                continue
            elif s[new_h][new_w] != "#" and visit[new_h][new_w] == 0:
                visit[new_h][new_w] = 1
                stack.append([new_h,new_w,c+1])
    return -1
  
if dfs(s,visited,h,w)==-1:
    print(-1)
else:
    print(h*w-c-a)
    
        

Fixed submission:
h,w=map(int,input().split())
s=[]
for i in range(h):
    s.append(list(input()))
a=0
for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            a+=1

visited = [[0]*w for _ in range(h)]

def dfs(s,visit,h,w,a):
    stack=[[0,0,1]]
    visit[0][0]=1
    while stack:
        sh,sw,c=stack.pop(0)
        if sh==h-1 and sw==w-1:
            return h*w-a-c
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_h, new_w = sh+j, sw+k
            if new_h < 0 or new_h >= h or new_w < 0 or new_w >= w:
                continue
            elif s[new_h][new_w] != "#" and visit[new_h][new_w] == 0:
                visit[new_h][new_w] = 1
                stack.append([new_h,new_w,c+1])
    return -1
  
print(dfs(s,visited,h,w,a))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
for i in range(10):
    print(i)
    s=input()

Fixed submission:
N = int(input())
print(0)
res = input()
if res == "Vacant":
    exit(0)

print(N-1)
res2 = input()
if res2 == "Vacant":
    exit(0)
seat = [""]*N
seat[0] = res
seat[N-1] = res

first = 0
last = N-1

for i in range(18):
    ret = (first + last) // 2
    if ret == first:
        ret += 1
    print(ret)
    res = input()
    seat[ret] = res
    if res == "Vacant":
        exit(0)
    else:
        if (res == seat[first] and (ret - first) % 2 == 0) or (res != seat[first] and (ret - first) % 2 == 1):
            first = ret
        else:
            last = ret-1
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=ibt(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x==500*i+100*j+50:
                ans+=1
print(ans)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x==500*i+100*j+50*k:
                ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if b<10:
    x=10*a+b
elif b<100:
    x=100*a+b
else:
    x=1000*a+b
for i in range(1000):
    if x==i*i:
        print("Yes")
        return 0
print("No")
return 0

Fixed submission:
a,b = map(int,input().split())
if b<10:
    x=10*a+b
elif b<100:
    x=100*a+b
else:
    x=1000*a+b
c=0
for i in range(1000):
    if x==i*i:
        print("Yes")
        c=1
if c==0:      
    print("No")
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())

def keta(m):
    an=0
    while m>0:
        an+=m%10
        m=m//10
    return an

ans=0
for i in range(1.n+1):
    j=keta(i)
    if j<=b and j>=a:
        ans+=1
print(ans)

Fixed submission:
n,a,b=map(int,input().split())

def keta(m):
    an=0
    while m>0:
        an+=m%10
        m=m//10
    return an

ans=0
for i in range(1,n+1):
    j=keta(i)
    if j<=b and j>=a:
        ans+=i
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=[]
l=list(map(int,input().split()))
if min(l)>=0:
    m=1
if max(l)<0:
    m=-2
if max(l)>0 and min(l)<0:
    if max(l)>=-min(l):
        m=max(l)
    else:
        m=min(l)
    mi=l.index(m)
    for i in range(n):
        if m>0:
            if l[i]<0:
                ans.append([mi+1,i+1])
        else:
            if l[i]>0:
                ans.append([mi+1,i+1])
if m>0:
    for i in range(n-1):
        ans.append([i+1,i+2])
else:
    for i in range(n,1,-1):
        ans.append([i,i-1])
print(len(ans))
for i in ans:
    print(*i)

Fixed submission:
n=int(input())
ans=[]
l=list(map(int,input().split()))
if min(l)>=0:
    m=1
if max(l)<=0:
    m=-2
if max(l)>0 and min(l)<0:
    if max(l)>=-min(l):
        m=max(l)
    else:
        m=min(l)
    mi=l.index(m)
    for i in range(n):
        if m>0:
            if l[i]<0:
                ans.append([mi+1,i+1])
        else:
            if l[i]>0:
                ans.append([mi+1,i+1])
if m>0:
    for i in range(n-1):
        ans.append([i+1,i+2])
else:
    for i in range(n,1,-1):
        ans.append([i,i-1])
print(len(ans))
for i in ans:
    print(*i)
Buggy python submission (verdict: Runtime Error):
k,a,b=map(int,input().split())
z=a-b
if z<=0 and a<k:
    print(-1)
    exit()
print(-(k-a)//z*2+1)

Fixed submission:
k, a, b = map(int, input().split())
if a >= k:
  print(1)
else:
  if a <= b:
    print(-1)
  else:
    r = -(-(k-a) // (a-b))
    print(2*r+1)