Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
H,W,M=map(int,input().split())
countH=[0]*(H+1)
countW=[0]*(W+1)
S=[[0]*(W+1)for _ in range(H+1)]
hw=[[0,0]for _ in range(M)]
i=0
for _ in range(M):
    h,w=map(int,input().split())
    countH[h]+=1
    countW[w]+=1
    hw[i]=[h,w]
    S[h][w]=1

hw.sort()
mh=max(countH)
mw=max(countW)
ans=mh+mw-1

c_mh=[]
i=0
while i<=H:
    if countH[i]==mh:
        c_mh.append(i)
    i+=1

c_mw=[]
i=0
while i<=W:
    if countW[i]==mw:
        c_mw.append(i)
    i+=1

ok=0
for h in c_mh:
    for w in c_mw:
        if S[h][w]==0:
            ans+=1
            ok=1
        if ok:
            break
    if ok:
        break

print(ans)

Fixed submission:
H,W,M=map(int,input().split())
countH=[0]*(H+1)
countW=[0]*(W+1)
S={}
i=0
for _ in range(M):
    h,w=map(int,input().split())
    countH[h]+=1
    countW[w]+=1
    S[str(h)+','+str(w)]=1

mh=max(countH)
mw=max(countW)
ans=mh+mw-1

c_mh=[]
i=0
while i<=H:
    if countH[i]==mh:
        c_mh.append(i)
    i+=1

c_mw=[]
i=0
while i<=W:
    if countW[i]==mw:
        c_mw.append(i)
    i+=1

ok=0
ok1=0
ok2=0
for h in c_mh:
    for w in c_mw:
        S.setdefault(str(h)+','+str(w))
        if S[str(h)+','+str(w)]==1:
            continue
        else:
            ans+=1
            ok=1
        if ok:
            break
    if ok:
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
N,M,K=map(int,input().split())
*A,=map(int,input().split())
*B,=map(int,input().split())

count=0
ans=0

i=0
j=0
while i<N or j<M:
    if i==N:
        count+=B[j]
        j+=1
        ans+=1
    elif j==N:
        count+=A[i]
        i+=1
        ans+=1
    elif A[i]<=B[j]:
        count+=A[i]
        i+=1
        ans+=1
    else:
        count+=B[j]
        j+=1
        ans+=1

    if count>K:
        ans-=1
        break

print(ans)

Fixed submission:
from bisect import*

N,M,K=map(int,input().split())
*A,=map(int,input().split())
*B,=map(int,input().split())

sa=[0]+[0]*N
i=0
while i<N:
    sa[i+1]=sa[i]+A[i]
    i+=1

sb=[0]+[0]*M
j=0
while j<M:
    sb[j+1]=sb[j]+B[j]
    j+=1

i=bisect_right(sa,K)-1
ans=0
while 0<=i:
    j=bisect_right(sb,K-sa[i])-1
    ans=max(ans,i+j)
    i-=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
count1=[c for c in range(N+1)]
count2=[2*c for c in range(N+1)]
count2[1]=1

i=2
while i<=N//2+1:
    j=2
    while i*j<=N:
        count2[i*j]+=count1[i*j]
        j+=1
    i+=1

print(sum(count2))

Fixed submission:
N=int(input())
ans=sum(2*i for i in range(N+1))

j=2
while j<=N:
    k=2
    while j*k<=N:
        ans+=j*k
        k+=1
    j+=1

print(ans-1)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
count1=[c for c in range(N+1)]
count2=[c for c in range(N+1)]

i=2
while i<=N:
    j=1
    while i*j<=N:
        count2[i*j]+=count1[i*j]
        j+=1
    i+=1

print(sum(count2))

Fixed submission:
N=int(input())
ans=sum(2*i for i in range(N+1))

j=2
while j<=N:
    k=2
    while j*k<=N:
        ans+=j*k
        k+=1
    j+=1

print(ans-1)
Buggy python submission (verdict: Runtime Error):
N=int(input())
*A,=map(int,input().split())

A.sort()
ans=N
i=0
while i<len(A):
    if i==0 and A[i]==A[i+1]:
        ans-=1
        i+=1
        continue
    for a in A[:i]:
        if A[i]%a==0:
            ans-=1
            break
        if a>A[i]//2+1:
            break
    i+=1

print(ans)

Fixed submission:
N=int(input())
*A,=map(int,input().split())

A.sort()
count=[0]*(A[-1]+1)
i=0
while i<N:
    j=A[i]
    if 2<=count[j]:
        i+=1
        continue
    k=1
    while j*k<=A[-1]:
        count[j*k]+=1
        k+=1
    i+=1

print(sum(count[a]==1 for a in A))

Buggy python submission (verdict: Runtime Error):
N=int(input())
*A,=map(int,input().split())

A.sort()
ans=N
i=0
while i<len(A):
    if i==0 and A[i]==A[i+1]:
        ans-=1
        i+=1
        continue
    for a in A[:i]:
        if A[i]%a==0:
            ans-=1
            A=A[:i]+A[i+1:]
            i-=1
            break
    i+=1

print(ans)

Fixed submission:
N=int(input())
*A,=map(int,input().split())

A.sort()
count=[0]*(A[-1]+1)
i=0
while i<N:
    j=A[i]
    if 2<=count[j]:
        i+=1
        continue
    k=1
    while j*k<=A[-1]:
        count[j*k]+=1
        k+=1
    i+=1

print(sum(count[a]==1 for a in A))

Buggy python submission (verdict: Runtime Error):
N=int(input())
*A,=map(int,input().split())

A.sort()
ans=N
i=0
while i<N:
    if i==0 and A[i]==A[i+1]:
        ans-=1
        i+=1
        continue
    if A[i]==A[i-1]:
        ans-=1
        i+=1
        continue
    for a in A[:i]:
        if A[i]%a==0:
            ans-=1
            break
        if i>10**4 and a>int(A[i]**0.5)+1:
            break
    i+=1

print(ans)

Fixed submission:
N=int(input())
*A,=map(int,input().split())

A.sort()
count=[0]*(A[-1]+1)
i=0
while i<N:
    j=A[i]
    if 2<=count[j]:
        i+=1
        continue
    k=1
    while j*k<=A[-1]:
        count[j*k]+=1
        k+=1
    i+=1

print(sum(count[a]==1 for a in A))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
*A,=map(int,input().split())

A.sort()
ans=N
i=0
while i<N:
    if i<N-1 and A[i]==A[i+1]:
        ans-=1
        i+=1
        continue
    for a in A[:i]:
        if A[i]%a==0:
            ans-=1
            break
    i+=1

print(ans)

Fixed submission:
N=int(input())
*A,=map(int,input().split())

A.sort()
count=[0]*(A[-1]+1)
i=0
while i<N:
    j=A[i]
    if 2<=count[j]:
        i+=1
        continue
    k=1
    while j*k<=A[-1]:
        count[j*k]+=1
        k+=1
    i+=1

print(sum(count[a]==1 for a in A))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
nn=N
import math
sq=round(math.sqrt(N))+1

i=2
ans=0
count1=0
count2=1
while sq>=i:
    if nn%i==0:
        nn//=i
        count1+=1
        if count1==count2:
            ans+=1
            count2+=1
            count1=0
            sq=N//i
    else:
        i+=1
        count1=0
        count2=1

if ans==0 and N>=2:
    ans+=1

print(ans)

Fixed submission:
N=int(input())
nn=N
import math
sq=round(math.sqrt(N))+1

i=2
ans=0
count1=0
count2=1
while sq>=i:
    if nn%i==0:
        nn//=i
        count1+=1
        if count1==count2:
            ans+=1
            count2+=1
            count1=0
    else:
        i+=1
        count1=0
        count2=1

if nn>sq:
    ans+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
nn=N
import math
sq=round(math.sqrt(N))+1

i=2
ans=0
count1=0
count2=1
while sq>=i:
    if nn%i==0:
        nn//=i
        count1+=1
        if count1==count2:
            ans+=1
            count2+=1
            count1=0
            sq=N//i
    else:
        i+=1
        count1=0
        count2=1

if ans==0 and N>=2:
    ans+=1

print(ans)

Fixed submission:
N=int(input())
nn=N
import math
sq=round(math.sqrt(N))+1

i=2
ans=0
count1=0
count2=1
while sq>=i:
    if nn%i==0:
        nn//=i
        count1+=1
        if count1==count2:
            ans+=1
            count2+=1
            count1=0
    else:
        i+=1
        count1=0
        count2=1

if nn>sq:
    ans+=1

print(ans)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
AB=[list(map(int,input().split()))for _ in range(M)]

count=[0]*(N+1)


Fixed submission:
A,B,H,M=map(int,input().split())
import math

X=H*30+30*(M/60)
Y=M*6

ans=A*A+B*B-2*A*B*math.cos(math.radians(X-Y))
print(ans**0.5)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
*A,=map(int,input().split())

point=[0]*N
count_X=0
count_Y=0
i=0
while 3 not in point:
    if 2 not in point:
        count_X+=1
    point[i]+=1
    i=A[i]-1
    if 2 in point:
        count_Y+=1
count_Y-=1

if K>=count_X:
    Z=count_X+(K-count_X)%count_Y
else:
    Z=K

i=0
ans=1
while i<Z:
    ans=A[ans-1]
    i+=1

print(ans)
    

Fixed submission:
N,K=map(int,input().split())
*A,=map(int,input().split())

point=[0]*N
count_X=0
count_Y=0
i=0
while point[i]!=3:
    if point[i]<2:
        count_X+=1
    point[i]+=1
    i=A[i]-1
    if point[i]>1:
        count_Y+=1
count_Y-=1

if K>=count_X:
    Z=count_X+(K-count_X)%count_Y
else:
    Z=K

i=0
ans=1
while i<Z:
    ans=A[ans-1]
    i+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
*A,=map(int,input().split())

point=[0]*N
count_X=0
count_Y=0
i=0
while all(j<3 for j in point):
    if all(j<2 for j in point):
        count_X+=1
    point[i]+=1
    i=A[i]-1
    if any(k>1 for k in point):
        count_Y+=1
count_Y-=1

if K>=count_X:
    Z=count_X+(K-count_X)%count_Y
else:
    Z=K

i=0
ans=1
while i<Z:
    ans=A[ans-1]
    i+=1

print(ans)
    

Fixed submission:
N,K=map(int,input().split())
*A,=map(int,input().split())

point=[0]*N
count_X=0
count_Y=0
i=0
while point[i]!=3:
    if point[i]<2:
        count_X+=1
    point[i]+=1
    i=A[i]-1
    if point[i]>1:
        count_Y+=1
count_Y-=1

if K>=count_X:
    Z=count_X+(K-count_X)%count_Y
else:
    Z=K

i=0
ans=1
while i<Z:
    ans=A[ans-1]
    i+=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
*A,=map(int,input().split())

J=[0]
j=0
while j<N:
    if j-A[j]>0:
        J.append(j-A[j])
    j+=1

ans=0
i=0
while i<N:
    ans+=J.count(i+A[i])
    i+=1

print(ans)

Fixed submission:
N=int(input())
*A,=map(int,input().split())

J=[0]*N
j=0
while j<N:
    J[j]=j-A[j]
    j+=1

import collections
C = collections.Counter(J)

ans=0
i=0
while i<N:
    ans+=C[i+A[i]]
    i+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
*A,=map(int,input().split())

J=[0]*N
j=0
while j<N:
    J[j]=j-A[j]
    j+=1

ans=0
i=0
while i<N:
    ans+=J.count(i+A[i])
    i+=1

print(ans)

Fixed submission:
N=int(input())
*A,=map(int,input().split())

J=[0]*N
j=0
while j<N:
    J[j]=j-A[j]
    j+=1

import collections
C = collections.Counter(J)

ans=0
i=0
while i<N:
    ans+=C[i+A[i]]
    i+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
*A,=map(int,input().split())

ans=0
i=0
while i<N:
    j=i+1+A[i]
    while j<N:
        if j-i==A[j]+A[i]:
            ans+=1
        j+=1
    i+=1

print(ans)

Fixed submission:
N=int(input())
*A,=map(int,input().split())

J=[0]*N
j=0
while j<N:
    J[j]=j-A[j]
    j+=1

import collections
C = collections.Counter(J)

ans=0
i=0
while i<N:
    ans+=C[i+A[i]]
    i+=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
L=len(S)
ans=0

i=0
while i<=L-1:
    j=i+3
    while j<=L-1:
        ans+=1*(int(S[i:j+1])%2019==0)
        j+=1
    i+=1

print(ans)

Fixed submission:
S=input()
R_S=S[::-1]
ans=0
count=[1]+[0]*2018
remainder=0

i=0
while i<len(S):
    remainder+=int(R_S[i])*pow(10,i,2019)
    remainder=remainder%2019
    ans+=count[remainder]
    count[remainder]+=1
    i+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
L=len(S)
ans=0

i=0
while i<=L-1:
    j=i+3
    while j<=L-1:
        ans+=1*(int(S[i:j+1])%2019==0)
        j+=1
    i+=1

print(ans)

Fixed submission:
S=input()
R_S=S[::-1]
ans=0
count=[1]+[0]*2018
remainder=0

i=0
while i<len(S):
    remainder+=int(R_S[i])*pow(10,i,2019)
    remainder=remainder%2019
    ans+=count[remainder]
    count[remainder]+=1
    i+=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math

N=int(input())


ans=0

i=1
ans=0
while i<=N:
    j=1
    while j<=N:
        k=1
        while k<=N:
            ans+=math.gcd(math.gcd(i,j),k)
            k+=1
        j+=1
    i+=1
print(ans)



Fixed submission:
import math

N=int(input())


ans=0

i=1
ans=0
while i<=N:
    j=1
    while j<=N:
        k=1
        while k<=N:
            ans+=math.gcd(math.gcd(i,j),k)
            k+=1
        j+=1
    i+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(input())

ans=0
i=0
while i<N-2:
    j=i+1
    while j<N-1:
        k=j+1
        while k<N:
            if S[i]==S[j]:
                break
            ans+=1*(S[j]!=S[k])*(S[k]!=S[i])*(j-i!=k-j)
            k+=1
        j+=1
    i+=1

print(ans)



Fixed submission:
N=int(input())
S=list(input())

ans=S.count('R')*S.count('G')*S.count('B')


i=0
while i<N-1:
    j=i+1
    while 2*j-i<N:
        ans-=1*(S[i]!=S[j])*(S[j]!=S[2*j-i])*(S[2*j-i]!=S[i])
        j+=1
    i+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(input())

ans=0
i=0
while i<N-2:
    j=i+1
    while j<N-1:
        k=j+1
        while k<N:
            ans+=1*(S[i]!=S[j])*(S[j]!=S[k])*(S[k]!=S[i])*(j-i!=k-j)
            k+=1
        j+=1
    i+=1

print(ans)



Fixed submission:
N=int(input())
S=list(input())

ans=S.count('R')*S.count('G')*S.count('B')


i=0
while i<N-1:
    j=i+1
    while 2*j-i<N:
        ans-=1*(S[i]!=S[j])*(S[j]!=S[2*j-i])*(S[2*j-i]!=S[i])
        j+=1
    i+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(input())

ans=0
i=0
while i<N-2:
    j=i+1
    while j<N-1:
        k=j+1
        while k<N:
            ans+=1*(S[i]!=S[j])*(S[j]!=S[k])*(S[k]!=S[i])*(j-i!=k-j)
            k+=1
        j+=1
    i+=1

print(ans)



Fixed submission:
N=int(input())
S=list(input())

ans=S.count('R')*S.count('G')*S.count('B')


i=0
while i<N-1:
    j=i+1
    while 2*j-i<N:
        ans-=1*(S[i]!=S[j])*(S[j]!=S[2*j-i])*(S[2*j-i]!=S[i])
        j+=1
    i+=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
H=[0]*(K+1)

ans=0
i=K
while i>=1:
    H[i]=(K//i)**N
    j=2
    while j*i<=K:
        H[i]-=H[j*i]
        j+=1
    ans+=H[i]*i
    i-=1

print(ans%(10**9+7))

Fixed submission:
N,K=map(int,input().split())
H=[0]*(K+1)
m=pow(10,9)+7

ans=0
i=K
while i>=1:
    H[i]=pow(K//i,N,m)
    j=2
    while j*i<=K:
        H[i]-=H[j*i]
        j+=1
    ans+=H[i]*i
    i-=1


print(ans%m)
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
A=[0]*K
i=0
j=1
while i<K:
    if j<=9:
        A[i]=j
        i+=1
    else:
        j=str(j)
        l=0
        while l+1<=len(j):
            if l+1==len(j):
                A[i]=int(j)
                i+=1
                j=int(j)
                break
            elif int(j[l+1])-1<=int(j[l])<=int(j[l+1])+1:
                l+=1
            else:
                j=int(j)
                break
    j+=1
print(A[K-1])

Fixed submission:
K=int(input())
A=[1,2,3,4,5,6,7,8,9]+[0]*10*K
i=9
j=0
while i<K:
    if A[j]%10!=0 and A[j]%10!=9:
        A[i]=10*A[j]+A[j]%10-1;i+=1
        A[i]=10*A[j]+A[j]%10;i+=1
        A[i]=10*A[j]+A[j]%10+1;i+=1
    elif A[j]%10==0:
        A[i]=10*A[j]+A[j]%10;i+=1
        A[i]=10*A[j]+A[j]%10+1;i+=1
    else:
        A[i]=10*A[j]+A[j]%10-1;i+=1
        A[i]=10*A[j]+A[j]%10;i+=1
    j+=1
print(A[K-1])

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
A=[0]*K
i=0
j=1
while i<K:
    if j<=9:
        A[i]=j
        i+=1
    else:
        j=str(j)
        l=0
        while l+1<=len(j):
            if l+1==len(j):
                A[i]=int(j)
                i+=1
                j=int(j)
                break
            elif int(j[l+1])-1<=int(j[l])<=int(j[l+1])+1:
                l+=1
            else:
                j=int(j)
                break
    j+=1
print(A[K-1])

Fixed submission:
K=int(input())
A=[1,2,3,4,5,6,7,8,9]+[0]*10*K
i=9
j=0
while i<K:
    if A[j]%10!=0 and A[j]%10!=9:
        A[i]=10*A[j]+A[j]%10-1;i+=1
        A[i]=10*A[j]+A[j]%10;i+=1
        A[i]=10*A[j]+A[j]%10+1;i+=1
    elif A[j]%10==0:
        A[i]=10*A[j]+A[j]%10;i+=1
        A[i]=10*A[j]+A[j]%10+1;i+=1
    else:
        A[i]=10*A[j]+A[j]%10-1;i+=1
        A[i]=10*A[j]+A[j]%10;i+=1
    j+=1
print(A[K-1])
Buggy python submission (verdict: Runtime Error):
B1=K-A[N-1]+A[0]

B=[]
i=0
while i<=N-2:
    B.append(A[i+1]-A[i])
    i=i+1
B=sorted(B)
print(K-max(B1,B[-1]))

Fixed submission:
K,N=map(int,input().split())
A=list(map(int,input().split()))

B1=K-A[N-1]+A[0]

B=[]
i=0
while i<=N-2:
    B.append(A[i+1]-A[i])
    i=i+1
B=sorted(B)
print(K-max(B1,B[-1]))
Buggy python submission (verdict: Time Limit Exceeded):
N,X,Y=map(int,input().split())

Ans=[]

i=1
while i<=N:
    j=i+1
    while j<=N:
        Ans.append(min(j-i,abs(X-i)+1+abs(j-Y)))
        j=j+1
    i=i+1

k=1
while k<=N-1:
    print(Ans.count(k))
    k=k+1

Fixed submission:
N,X,Y=map(int,input().split())

Ans=[0]*N

i=1
d=0
while i<=N:
    j=i+1
    while j<=N:
        d=(min(j-i,abs(X-i)+1+abs(j-Y)))
        Ans[d]+=1
        j+=1
    i+=1

k=1
while k<=N-1:
    print(Ans[k])
    k+=1

Buggy python submission (verdict: Time Limit Exceeded):
N,X,Y=map(int,input().split())

Ans=[]

i=1
while i<=N:
    j=i+1
    while j<=N:
        Ans.append(min(j-i,abs(X-i)+1+abs(j-Y)))
        j=j+1
    i=i+1

k=1
while k<=N-1:
    print(Ans.count(k))
    k=k+1

Fixed submission:
N,X,Y=map(int,input().split())

Ans=[0]*N

i=1
d=0
while i<=N:
    j=i+1
    while j<=N:
        d=(min(j-i,abs(X-i)+1+abs(j-Y)))
        Ans[d]+=1
        j+=1
    i+=1

k=1
while k<=N-1:
    print(Ans[k])
    k+=1

Buggy python submission (verdict: Runtime Error):
N,X,Y=map(int,input().split())

Ans=[]

i=1
while i<=N:
    j=i+1
    while j<=N:
        Ans.append(min(j-i,abs(X-i)+1+abs(j-Y)))
        j=j+1
    i=i+1

k=1
while k<=N-1:
    print(Ans.count(k))
    k=k+1

Fixed submission:
N,X,Y=map(int,input().split())

Ans=[0]*N

i=1
d=0
while i<=N:
    j=i+1
    while j<=N:
        d=(min(j-i,abs(X-i)+1+abs(j-Y)))
        Ans[d]+=1
        j+=1
    i+=1

k=1
while k<=N-1:
    print(Ans[k])
    k+=1

Buggy python submission (verdict: Time Limit Exceeded):
N,X,Y=map(int,input().split())

Ans=[]

i=1
while i<=N:
    j=i+1
    while j<=N:
        Ans.append(min(j-i,abs(X-i)+1+abs(j-Y)))
        j=j+1
    i=i+1

Ans=tuple(Ans)
k=1
while k<=N-1:
    print(Ans.count(k))
    k=k+1

Fixed submission:
N,X,Y=map(int,input().split())

Ans=[0]*N

i=1
d=0
while i<=N:
    j=i+1
    while j<=N:
        d=(min(j-i,abs(X-i)+1+abs(j-Y)))
        Ans[d]+=1
        j+=1
    i+=1

k=1
while k<=N-1:
    print(Ans[k])
    k+=1

Buggy python submission (verdict: Time Limit Exceeded):
N,X,Y=map(int,input().split())

Ans=[]

i=1
while i<=N:
    j=i+1
    while j<=N:
        Ans.append(min(j-i,abs(X-i)+1+abs(j-Y)))
        j=j+1
    i=i+1

k=1
count=0
while k<=N-1:
    A=Ans.count(k)
    print(A)
    k=k+1
    if A==0:
        while k<=N-1:
            print(0)
            k=k+1
        break

Fixed submission:
N,X,Y=map(int,input().split())

Ans=[0]*N

i=1
d=0
while i<=N:
    j=i+1
    while j<=N:
        d=(min(j-i,abs(X-i)+1+abs(j-Y)))
        Ans[d]+=1
        j+=1
    i+=1

k=1
while k<=N-1:
    print(Ans[k])
    k+=1

Buggy python submission (verdict: Time Limit Exceeded):
N,X,Y=map(int,input().split())

Ans=[]

i=1
while i<=N:
    j=i+1
    while j<=N:
        Ans.append(min(j-i,abs(X-i)+1+abs(j-Y)))
        j=j+1
    i=i+1

k=1
while k<=N-1:
    print(Ans.count(k))
    k=k+1

Fixed submission:
N,X,Y=map(int,input().split())

Ans=[0]*N

i=1
d=0
while i<=N:
    j=i+1
    while j<=N:
        d=(min(j-i,abs(X-i)+1+abs(j-Y)))
        Ans[d]+=1
        j+=1
    i+=1

k=1
while k<=N-1:
    print(Ans[k])
    k+=1
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
N=int(input())
count=0
for _ in range(N):
    *Q,=input().split()
    if len(Q)==1:
        count+=1
    else:
        if (count+int(Q[1]))%2:
            S=Q[2]+S
        else:
            S=S+Q[2]
print(S[::-1] if count%2 else S)

Fixed submission:
S=input()
N=int(input())

from collections import*
D=deque(S)
count=0
for _ in range(N):
    *Q,=input().split()
    if len(Q)==1:
        count+=1
    else:
        if (count+int(Q[1]))%2:
            D.appendleft(Q[2])
        else:
            D.append(Q[2])
ans=''.join(D)
print(ans[::-1] if count%2 else ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
N=int(input())
count=0
for _ in range(N):
    *Q,=input().split()
    if len(Q)==1:
        count+=1
    else:
        if (count+int(Q[1]))%2:
            S=Q[2]+S
        else:
            S=S+Q[2]
print(S[::-1] if count%2 else S)

Fixed submission:
S=input()
N=int(input())

from collections import*
D=deque(S)
count=0
for _ in range(N):
    *Q,=input().split()
    if len(Q)==1:
        count+=1
    else:
        if (count+int(Q[1]))%2:
            D.appendleft(Q[2])
        else:
            D.append(Q[2])
ans=''.join(D)
print(ans[::-1] if count%2 else ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
N=int(input())
for _ in range(N):
    *Q,=input().split()
    if len(Q)==1:
        S=S[::-1]
    else:
        if Q[1]=='1':
            S=Q[2]+S
        else:
            S=S+Q[2]
print(S)

Fixed submission:
S=input()
N=int(input())

from collections import*
D=deque(S)
count=0
for _ in range(N):
    *Q,=input().split()
    if len(Q)==1:
        count+=1
    else:
        if (count+int(Q[1]))%2:
            D.appendleft(Q[2])
        else:
            D.append(Q[2])
ans=''.join(D)
print(ans[::-1] if count%2 else ans)
Buggy python submission (verdict: Runtime Error):
print(math.ceil(int(input())/2))

Fixed submission:
import math
print(math.ceil(int(input())/2))

Buggy python submission (verdict: Runtime Error):
print(math.ceil(input()))

Fixed submission:
import math
print(math.ceil(int(input())/2))
Buggy python submission (verdict: Time Limit Exceeded):
N,*S=open(0).read().split()
import collections

C=collections.Counter(S)
keys = [k for k, v in C.items() if v == max(C.values())]
keys.sort()

for i in keys:
    print(i)

Fixed submission:
N,*S=open(0).read().split()
import collections

C=collections.Counter(S)
M=max(C.values())
keys = [k for k, v in C.items() if v == M]
keys.sort()

for i in keys:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
h,n=map(int,input().split())
c=[list(map(int,input().split()))for _ in range(n)]
d=[0]+[10**9]*h
for i in range(h):
    #d[i]=min(d[i-a]+b for a,b in c)
    for a,b in c:
        a=min(a,h-i)
        d[i+a]=min(d[i+a],d[i]+b)
print(d[h])

Fixed submission:
H,N=map(int,input().split())
ab=[list(map(int,input().split()))for _ in range(N)]
ab.sort()

ans=[10**9]*(H+1)
ans[0]=0
i=0
while i<=H:
    for a,b in ab:
        if a+i>H:
            a=H-i
        if ans[i+a]>ans[i]+b:
            ans[i+a]=ans[i]+b
    i+=1

print(ans[H])

Buggy python submission (verdict: Time Limit Exceeded):
H,N=map(int,input().split())
ab=[list(map(int,input().split()))for _ in range(N)]
ab.sort()

ans=[10**9]*(H+1)
ans[0]=0
i=0
while i<=H:
    for a,b in ab:
        if a+i>H:
            a=H-i
        if ans[i+a]>ans[i]+b:
            ans[i+a]=ans[i]+b
    i+=1

print(ans[H])

Fixed submission:
H,N=map(int,input().split())
ab=[list(map(int,input().split()))for _ in range(N)]
ab.sort()

ans=[10**9]*(H+1)
ans[0]=0
i=0
while i<=H:
    for a,b in ab:
        if a+i>H:
            a=H-i
        if ans[i+a]>ans[i]+b:
            ans[i+a]=ans[i]+b
    i+=1

print(ans[H])

Buggy python submission (verdict: Time Limit Exceeded):
H,N=map(int,input().split())
ab=[list(map(int,input().split()))for _ in range(N)]
from heapq import*

count=[0]+[1]*H
ans=[10**9]*(H+1)
ans[0]=0
que=[0]
heapify(que)
while que:
    x=heappop(que)
    for a,b in ab:
        a=min(a,H-x)
        if ans[x+a]>ans[x]+b:
            ans[x+a]=ans[x]+b
            if count[x+a]:
                heappush(que,x+a)
                count[x+a]=0

print(ans[H])

Fixed submission:
H,N=map(int,input().split())
ab=[list(map(int,input().split()))for _ in range(N)]
ab.sort()

ans=[10**9]*(H+1)
ans[0]=0
i=0
while i<=H:
    for a,b in ab:
        if a+i>H:
            a=H-i
        if ans[i+a]>ans[i]+b:
            ans[i+a]=ans[i]+b
    i+=1

print(ans[H])

Buggy python submission (verdict: Time Limit Exceeded):
H,N=map(int,input().split())
ab=[list(map(int,input().split()))for _ in range(N)]
from collections import deque

ans=[10**9]*(H+1)
ans[0]=0
que=deque([0])
while que:
    x=que.popleft()
    for a,b in ab:
        a=min(a,H-x)
        if ans[x+a]>ans[x]+b:
            ans[x+a]=ans[x]+b
            que.append(x+a)

print(ans[H])

Fixed submission:
H,N=map(int,input().split())
ab=[list(map(int,input().split()))for _ in range(N)]
ab.sort()

ans=[10**9]*(H+1)
ans[0]=0
i=0
while i<=H:
    for a,b in ab:
        if a+i>H:
            a=H-i
        if ans[i+a]>ans[i]+b:
            ans[i+a]=ans[i]+b
    i+=1

print(ans[H])