Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())

X=list(map(int,input().split()))
V=[]
for i in range(n-k):
    Y=X[i+k-1]-X[i]   
    if X[i+k-1]<0:
        V.append(Y-X[i+k-1])
    elif X[i+k-1]>=0 and X[i]<0:
        V.append(Y+min(abs(X[i]),abs(X[i+k-1])))
    else:
        V.append(Y+X[i])
if X==[0]:
    print(0)
else:
    print(min(V))

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

X=list(map(int,input().split()))
V=[]
for i in range(n-k+1):
    Y=X[i+k-1]-X[i]   
    V.append(Y+min(abs(X[i]),abs(X[i+k-1])))

print(min(V))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())

X=list(map(int,input().split()))
V=[]
for i in range(n-k):
    Y=X[i+k-1]-X[i]   
    if X[i+k-1]<0:
        V.append(Y-X[i+k-1])
    elif X[i+k-1]>=0 and X[i]<0:
        V.append(Y+min(abs(X[i]),abs(X[i+k-1])))
    else:
        V.append(Y+X[i])
print(min(V))

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

X=list(map(int,input().split()))
V=[]
for i in range(n-k+1):
    Y=X[i+k-1]-X[i]   
    V.append(Y+min(abs(X[i]),abs(X[i+k-1])))

print(min(V))
Buggy python submission (verdict: Runtime Error):
n=int(input())

X=list(map(int,input()))

print(sum(X)-n)

Fixed submission:
n=int(input())

X=list(map(int,input().split()))

print(sum(X)-n)
Buggy python submission (verdict: Runtime Error):
n=int(input())

A=list(map(int,input()))



print(max(A)-min(A))

Fixed submission:
n=int(input())

A=list(map(int,input().split()))



print(max(A)-min(A))
Buggy python submission (verdict: Runtime Error):
n=int(input())

X=list(map(int,input().split()))
Y=[]
for i in range(n):
    Y.append(X[i]-(i+1))
Y.sort()
res_1=0
res_2=0
if n%2==1:
    m=Y[int((n-1)/2)]
    for j in range(n):
        res_1+=abs(Y[j]-m)
else:
    m=Y[int(n/2)-1]
    n=Y[int(n/2)]
    for j in range(n):
        res_1+=abs(Y[j]-m)
        res_2+=abs(Y[j]-n)
    res_1=min(res_1,res_2)
        
    

print(res_1)

Fixed submission:
n=int(input())

X=list(map(int,input().split()))
Y=[]
for i in range(n):
    Y.append(X[i]-(i+1))
Y.sort()
res_1=0

if n%2==1:
    m=Y[int((n-1)/2)]
    for j in range(n):
        res_1+=abs(Y[j]-m)
else:
    m=(Y[int(n/2)-1]+Y[int(n/2)])//2
    for j in range(n):
        res_1+=abs(Y[j]-m)
        

        
print(res_1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

X=list(map(int,input().split()))
Y=[]
for i in range(n):
    Y.append(X[i]-(i+1))

Z=list(set(Y))
res=10000000000000000
for i in range(len(Z)):
    cnt=0
    for j in  range(n):
        cnt+=abs(Y[j]-Z[i])
    if cnt<res:
        res=cnt
    
print(res)

Fixed submission:
n=int(input())

X=list(map(int,input().split()))
Y=[]
for i in range(n):
    Y.append(X[i]-(i+1))
Y.sort()
res_1=0

if n%2==1:
    m=Y[int((n-1)/2)]
    for j in range(n):
        res_1+=abs(Y[j]-m)
else:
    m=(Y[int(n/2)-1]+Y[int(n/2)])//2
    for j in range(n):
        res_1+=abs(Y[j]-m)
        

        
print(res_1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

X=list(map(int,input().split()))
Y=[]
for i in range(n):
    Y.append(X[i]-(i+1))


res=10000000000000000
for i in range(n):
    cnt=0
    for j in  range(n):
        cnt+=abs(Y[j]-Y[i])
    if cnt<res:
        res=cnt
    
print(res)

Fixed submission:
n=int(input())

X=list(map(int,input().split()))
Y=[]
for i in range(n):
    Y.append(X[i]-(i+1))
Y.sort()
res_1=0

if n%2==1:
    m=Y[int((n-1)/2)]
    for j in range(n):
        res_1+=abs(Y[j]-m)
else:
    m=(Y[int(n/2)-1]+Y[int(n/2)])//2
    for j in range(n):
        res_1+=abs(Y[j]-m)
        

        
print(res_1)

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())

X=[a,b,c]
X.sort()
x=X[2]
y=X[1]
z=X[0]


sabun1=x-y
sabun2=x-z

if sabun1%2==0 and sabun2%2==0:
    res=(sabun1+sabun2)/2
elif sabun1%2==1 and sabun2%2==1:
    res=(sabun1//2+sabun2//2)+1
elif sabun1%2==0 and sabun2%2==1:
    res=(sabun1/2)+(sabun2//2)+2
else:
    res=(sabun1//2)+(sabun2/2)+2

print(int(res))

Fixed submission:
n=int(input())

X=list(map(int,input().split()))
Y=[]
for i in range(n):
    Y.append(X[i]-(i+1))
Y.sort()
res_1=0

if n%2==1:
    m=Y[int((n-1)/2)]
    for j in range(n):
        res_1+=abs(Y[j]-m)
else:
    m=(Y[int(n/2)-1]+Y[int(n/2)])//2
    for j in range(n):
        res_1+=abs(Y[j]-m)
        

        
print(res_1)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

s=' '+input()+' '
ans=n
for i in range(1,n+1):
    s1=s[:i]
    s2=s[i+1:]
    sum_count=s1.count('W')+s2.count('E')
    if ans>=sum_count:
        ans=sum_count
        
print(ans)

Fixed submission:
n=int(input())
s=input()
cnt=s[1:].count('E')
res=cnt
for i in range(len(s)-1):
    if s[i]=='W' and s[i+1]=='W':
        cnt+=1
    if s[i]=='E' and s[i+1]=='E':
        cnt-=1
    
    if res>cnt:
        res=cnt
print(res)
Buggy python submission (verdict: Runtime Error):
s=input()
k=int(input())
X=[]
for i in range(len(s)-4):
    X.append(s[i:i+5])
X.append(s[len(s)-4:len(s)])
X.append(s[len(s)-3:len(s)])
X.append(s[len(s)-2:len(s)])
X.append(s[len(s)-1:len(s)])
    
X.sort()
C=[]
for x in X[:k]:
    for j in range(len(x)):
        C.append(x[:j+1])
        
C=list(set(C))

C.sort()

print(C[k-1])

Fixed submission:
s=input()
k=int(input())
X=[]
for i in range(len(s)):
    for j in range(k):
        X.append(s[i:i+j+1])
X=list(set(X))

X.sort()

print(X[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
 
X=list(map(int,input().split()))
sort_X=sorted(X)
for i in range(n):
    if sort_X.index(X[i])<int(n/2):
        print(sort_X[int(n/2)])
    else:
        print(sort_X[int(n/2)-1])

Fixed submission:
n=int(input())

X=list(map(int,input().split()))
sort_X=sorted(X)
for i in range(n):
    if X[i]<sort_X[int(n/2)]:
        print(sort_X[int(n/2)])
    else:
        print(sort_X[int(n/2)-1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

X=list(map(int,input().split()))
sort_X=sorted(X)
for i in range(n):
    if sort_X.index(X[i])<int(n/2):
        print(sort_X[int(n/2)])
    else:
        print(sort_X[int(n/2)-1])

Fixed submission:
n=int(input())

X=list(map(int,input().split()))
sort_X=sorted(X)
for i in range(n):
    if X[i]<sort_X[int(n/2)]:
        print(sort_X[int(n/2)])
    else:
        print(sort_X[int(n/2)-1])

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

X=list(map(int,input().split()))

for i in range(n):
    S=X[:i]+X[i+1:]
    S.sort()
    print(S[int(n/2)-1])

Fixed submission:
n=int(input())

X=list(map(int,input().split()))
sort_X=sorted(X)
for i in range(n):
    if X[i]<sort_X[int(n/2)]:
        print(sort_X[int(n/2)])
    else:
        print(sort_X[int(n/2)-1])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))

for i in range(n):
    B=[0]+A[:i]+A[i+1:]+[0]
    cnt=0
    for j in range(n):
        cnt+=abs(B[j+1]-B[j])
    print(cnt)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
A=[0]+A+[0]
cnt=0
for i in range(n+1):
    cnt+=abs(A[i+1]-A[i])

for i in range(1,n+1):
    if (A[i-1]-A[i])*(A[i]-A[i+1])>=0:
        print(cnt)
    else:
        print(cnt-abs(A[i-1]-A[i])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1]))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n=int(input())
S=[]
C=['M','A','R','C','H']
for i in range(n):
    x=input()
    if x[0] in C:
        S.append(x)

X=list(itertools.combinations(S,3))
res=len(X)
for i in range(len(X)):
    Y=[X[i][0][0],X[i][1][0],X[i][2][0]]
    if len(set(Y))<3:
        res-=1

print(res)

Fixed submission:
import itertools
n=int(input())
D={'M':0,'A':0,'R':0,'C':0,'H':0}
for i in range(n):
    x=input()
    if x[0]=='M':
        D['M']+=1
    elif x[0]=='A':
        D['A']+=1
    elif x[0]=='R':
        D['R']+=1
    elif x[0]=='C':
        D['C']+=1
    elif x[0]=='H':
        D['H']+=1

X=D.values()
Y=list(itertools.combinations(X,3))
cnt=0
for i in range(10):
    cnt+=Y[i][0]*Y[i][1]*Y[i][2]

print(cnt)
Buggy python submission (verdict: Runtime Error):
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
X=[[0,0] for _ in range(H*W)]
for i in range(H):
    for j in range(W):
        X[A[i][j]][0]=i
        X[A[i][j]][1]=j
M=[0]*(H*W+1)
for d in range(D+1,H*W+1):
        M[d]=abs(X[d][0]-X[d-D][0])+abs(X[d][1]-X[d-D][1])+M[d-D]

for i in range(Q):
    L,R=map(int,input().split())
    print(M[R]-M[L])

Fixed submission:
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
X=[[[0,0] for _ in range((H*W)//D+1)] for _ in range(D)]
for i in range(H):
    for j in range(W):
        X[A[i][j]%D][A[i][j]//D][0]=i
        X[A[i][j]%D][A[i][j]//D][1]=j
M=[[0] for _ in range(D)]
for d in range(D):
    for k in range((H*W)//D):
        M[d].append(abs(X[d][k+1][0]-X[d][k][0])+abs(X[d][k+1][1]-X[d][k][1])+M[d][k])

for i in range(Q):
    L,R=map(int,input().split())
    print(M[L%D][R//D]-M[L%D][L//D])

Buggy python submission (verdict: Time Limit Exceeded):
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
X=[[[0,0] for _ in range((H*W)//D+1)] for _ in range(D)]
for i in range(H):
    for j in range(W):
        X[A[i][j]%D][A[i][j]//D][0]=i
        X[A[i][j]%D][A[i][j]//D][1]=j

for i in range(Q):
    L,R=map(int,input().split())
    ans=0
    for j in range(L//D,R//D):
        ans+=abs(X[L%D][j][0]-X[L%D][j+1][0])+abs(X[L%D][j][1]-X[L%D][j+1][1])
    print(ans)

Fixed submission:
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
X=[[[0,0] for _ in range((H*W)//D+1)] for _ in range(D)]
for i in range(H):
    for j in range(W):
        X[A[i][j]%D][A[i][j]//D][0]=i
        X[A[i][j]%D][A[i][j]//D][1]=j
M=[[0] for _ in range(D)]
for d in range(D):
    for k in range((H*W)//D):
        M[d].append(abs(X[d][k+1][0]-X[d][k][0])+abs(X[d][k+1][1]-X[d][k][1])+M[d][k])

for i in range(Q):
    L,R=map(int,input().split())
    print(M[L%D][R//D]-M[L%D][L//D])

Buggy python submission (verdict: Time Limit Exceeded):
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
X=[[[0,0] for _ in range((H*W)//D+1)] for _ in range(D)]
for i in range(H):
    for j in range(W):
        X[A[i][j]%D][A[i][j]//D][0]=i
        X[A[i][j]%D][A[i][j]//D][1]=j

for i in range(Q):
    L,R=map(int,input().split())
    ans=0
    for j in range(L//D,R//D):
        ans+=abs(X[L%D][j][0]-X[L%D][j+1][0])+abs(X[L%D][j][1]-X[L%D][j+1][1])
    print(ans)

Fixed submission:
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
X=[[[0,0] for _ in range((H*W)//D+1)] for _ in range(D)]
for i in range(H):
    for j in range(W):
        X[A[i][j]%D][A[i][j]//D][0]=i
        X[A[i][j]%D][A[i][j]//D][1]=j
M=[[0] for _ in range(D)]
for d in range(D):
    for k in range((H*W)//D):
        M[d].append(abs(X[d][k+1][0]-X[d][k][0])+abs(X[d][k+1][1]-X[d][k][1])+M[d][k])

for i in range(Q):
    L,R=map(int,input().split())
    print(M[L%D][R//D]-M[L%D][L//D])
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n,m,r=map(int,input().split())
D=[[10**10]*n for _ in range(n)]
for i in range(n):
    D[i][i]=0
R=list(map(int,input().split()))
for i in range(m):
    a,b,c=map(int,input().split())
    D[a-1][b-1]=c
    D[b-1][a-1]=c

for k in range(n):
    for i in range(n):
        for j in range(n):
            D[i][j]=min(D[i][j],D[i][k]+D[k][j])

A=[]
for v in itertools.permutations(R,r):
    ans=0
    for i in range(r-1):
        ans+=D[v[i]-1][v[i+1]-1]
    A.append(ans)
print(min(A))

Fixed submission:
import itertools

n,m,r=map(int,input().split())
D=[[10**10]*n for _ in range(n)]
for i in range(n):
    D[i][i]=0
R=list(map(int,input().split()))
for i in range(m):
    a,b,c=map(int,input().split())
    D[a-1][b-1]=c
    D[b-1][a-1]=c

for k in range(n):
    for i in range(n):
        for j in range(n):
            D[i][j]=min(D[i][j],D[i][k]+D[k][j])

A=[]
for v in itertools.permutations(R,r):
    ans=0
    for i in range(r-1):
        ans+=D[v[i]-1][v[i+1]-1]
    A.append(ans)
print(min(A))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

A=list(map(int,input().split()))

X=list(set(A))

RES=[]

for i in X:
    a=A.count(i-1)
    b=A.count(i)
    c=A.count(i+1)
    RES.append(a+b+c)
    
print(max(RES))


Fixed submission:
import collections
n=int(input())

A=list(map(int,input().split()))

a=collections.Counter(A)

X=sorted(a.items(), key=lambda x:x[0])

K=[]
V=[]

RES=[]
for i in range(len(X)):
    K.append(X[i][0])
    V.append(X[i][1])

if len(X)>=3:
    for j in range(1,len(X)-1):
        res=V[j]
        if K[j]-1==K[j-1]:
            res+=V[j-1]
        if K[j]+1==K[j+1]:
            res+=V[j+1]
        RES.append(res)
elif len(X)==2:
    if K[0]+1==K[1]:
        RES.append(V[0]+V[1])
    else:
        RES.append(max(V))
else:
    RES.append(V[0])        

print(max(RES))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

A=list(map(int,input().split()))

X=list(set(A))

RES=[]

for i in X:
    a=A.count(i-1)
    b=A.count(i)
    c=A.count(i+1)
    RES.append(a+b+c)
    
print(max(RES))

Fixed submission:
import collections
n=int(input())

A=list(map(int,input().split()))

a=collections.Counter(A)

X=sorted(a.items(), key=lambda x:x[0])

K=[]
V=[]

RES=[]
for i in range(len(X)):
    K.append(X[i][0])
    V.append(X[i][1])

if len(X)>=3:
    for j in range(1,len(X)-1):
        res=V[j]
        if K[j]-1==K[j-1]:
            res+=V[j-1]
        if K[j]+1==K[j+1]:
            res+=V[j+1]
        RES.append(res)
elif len(X)==2:
    if K[0]+1==K[1]:
        RES.append(V[0]+V[1])
    else:
        RES.append(max(V))
else:
    RES.append(V[0])        

print(max(RES))

Buggy python submission (verdict: Runtime Error):
import collections
n=int(input())

A=list(map(int,input().split()))

a=collections.Counter(A)

X=sorted(a.items(), key=lambda x:x[0])

K=[]
V=[]

RES=[]
for i in range(len(X)):
    K.append(X[i][0])
    V.append(X[i][1])
    
for j in range(1,len(X)-1):
    res=V[j]
    if K[j]-1==K[j-1]:
        res+=V[j-1]
    if K[j]+1==K[j+1]:
        res+=V[j+1]
    RES.append(res)

print(max(RES))

Fixed submission:
import collections
n=int(input())

A=list(map(int,input().split()))

a=collections.Counter(A)

X=sorted(a.items(), key=lambda x:x[0])

K=[]
V=[]

RES=[]
for i in range(len(X)):
    K.append(X[i][0])
    V.append(X[i][1])

if len(X)>=3:
    for j in range(1,len(X)-1):
        res=V[j]
        if K[j]-1==K[j-1]:
            res+=V[j-1]
        if K[j]+1==K[j+1]:
            res+=V[j+1]
        RES.append(res)
elif len(X)==2:
    if K[0]+1==K[1]:
        RES.append(V[0]+V[1])
    else:
        RES.append(max(V))
else:
    RES.append(V[0])        

print(max(RES))
Buggy python submission (verdict: Runtime Error):
n=int(input())

A=list(map(int,input().split()))
        
A.sort(reverse=True)

X=[]

t=None

for i in A:
    if t==i:
        t=None
        X.append(t)
        if len(X)>1:
            break
    else:
        t=i
        
if len(X)>1:
    print(X[0]*X[1])
else:
    print(0)

Fixed submission:
import collections

n=int(input())

A=list(map(int,input().split()))
        
X=collections.Counter(A)

ans=1
cnt_1=0
cnt_2=0

for k,v in sorted(X.items(),key=lambda x:x[0],reverse=True):
    if v>=2:
        cnt_1+=1
        ans*=k
        if cnt_1==2:
            break
        if v>=4:
            ans*=k
            break
    else:
        cnt_2+=1
        if cnt_2==n or cnt_2==n-2 or cnt_2==n-3:
            ans=0
            break
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())

A=list(map(int,input().split()))
        
A.sort(reverse=True)


X=[]

t=None

for i in A:
    if i==t:
        t=None
        X.append(t)
        if len(X)==2:
            break
    else:
        t=i
        
if len(X)>1:
    print(X[0]*X[1])
else:
    print(0)

Fixed submission:
import collections

n=int(input())

A=list(map(int,input().split()))
        
X=collections.Counter(A)

ans=1
cnt_1=0
cnt_2=0

for k,v in sorted(X.items(),key=lambda x:x[0],reverse=True):
    if v>=2:
        cnt_1+=1
        ans*=k
        if cnt_1==2:
            break
        if v>=4:
            ans*=k
            break
    else:
        cnt_2+=1
        if cnt_2==n or cnt_2==n-2 or cnt_2==n-3:
            ans=0
            break
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())

A=list(map(int,input().split()))
        
A.sort(reverse=True)

X=[]

t=None

for i in A:
    if i==t:
        t=None
        X.append(t)
        if len(X)==2:
            break
    else:
        t=i
        
print(X[0]*X[1] if len(X)>1 else 0)

Fixed submission:
import collections

n=int(input())

A=list(map(int,input().split()))
        
X=collections.Counter(A)

ans=1
cnt_1=0
cnt_2=0

for k,v in sorted(X.items(),key=lambda x:x[0],reverse=True):
    if v>=2:
        cnt_1+=1
        ans*=k
        if cnt_1==2:
            break
        if v>=4:
            ans*=k
            break
    else:
        cnt_2+=1
        if cnt_2==n or cnt_2==n-2 or cnt_2==n-3:
            ans=0
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
if k>A[-1]:
    print('IMPOSSIBLE')
else:
    a=A[0]
    for i in range(n):
        a=gcd(a,A[i])
    if a==1:
        print('POSSIBLE')
    else:
        if k%a==0:
            print('POSSIBLE')
        else:
            print('IMPOSSIBLE')

Fixed submission:
from fractions import gcd
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
if k>A[-1]:
    print('IMPOSSIBLE')
else:
    a=A[0]
    for i in range(n):
        a=gcd(a,A[i])
    if a==1:
        print('POSSIBLE')
    else:
        if k%a==0:
            print('POSSIBLE')
        else:
            print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
import math

n,m=map(int,input().split())

if n==m-1 or n==m+1:
  print((math.factorial(m)*math.factorail(n))%(1e9+7))
elif n==m:
  print((2*(math.factorial(m)**2))%(1e9+7))
else:
  print(0)


Fixed submission:
import math

n,m=map(int,input().split())

if n==m+1 or n==m-1:
    print((math.factorial(m)*math.factorial(n))%(10**9+7))
elif n==m:
    print((2*(math.factorial(m)**2))%(10**9+7))
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
import math

n,m=map(int,input().split())

if n==m-1 or n==m+1:
  print((math.factorial(m)*math.factorail(n))%(1e9+7))
elif n==m:
  print((2*(math.factorail(m)**2))%(1e9+7))
else:
  print(0)

Fixed submission:
import math

n,m=map(int,input().split())

if n==m+1 or n==m-1:
    print((math.factorial(m)*math.factorial(n))%(10**9+7))
elif n==m:
    print((2*(math.factorial(m)**2))%(10**9+7))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
if s[0]==')':
    cnt=1
else:
    cnt=0
for i in range(1,n):
    if s[i]==')' and s[i-1]!='(':
        cnt+=1
    if s[i]==')':
        x=i
print('('*cnt+s+')'*(n-x-1))

Fixed submission:
n=int(input())
s=input()
z=s
while '()' in s:
    s=s.replace('()','')
print('('*s.count(')')+z+')'*s.count('('))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

ans=1

for i in range(1,n+1):
    ans*=i

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

Fixed submission:
n=int(input())

ans=1

for i in range(1,n+1):
    ans=(ans*i)%(10**9+7)

print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
x=1
for i in range(1,n+1):
    x*=i

res=1

for i in range(2,n+1):
    cnt=1
    while x%i==0:
        x=x/i
        cnt+=1
    res*=cnt
    
print(res%(10**9+7))

Fixed submission:
n=int(input())
x=1
for i in range(1,n+1):
    x*=i

res=1

for i in range(2,n+1):
    cnt=1
    while x%i==0:
        x=x//i
        cnt+=1
    res*=cnt
    
print(res%(10**9+7))

Buggy python submission (verdict: Runtime Error):
n=int(input())
x=1
for i in range(1,n+1):
    x*=i

res=1

for i in range(2,n+1):
    cnt=1
    while x%i==0:
        x=x/i
        cnt+=1
    res*=cnt
    
print(res)
    

Fixed submission:
n=int(input())
x=1
for i in range(1,n+1):
    x*=i

res=1

for i in range(2,n+1):
    cnt=1
    while x%i==0:
        x=x//i
        cnt+=1
    res*=cnt
    
print(res%(10**9+7))
Buggy python submission (verdict: Runtime Error):
n=int(input())
T=list(map(int,input()))
m=int(input())
for i in range(m):
    p,k=map(int,input().split())
    T[p-1]=k
    print(sum(T))  

Fixed submission:
n=int(input())
T=list(map(int,input().split()))
m=int(input())
for i in range(m):
    p,k=map(int,input().split())
    tmp=T[p-1]
    T[p-1]=k
    print(sum(T))
    T[p-1]=tmp
Buggy python submission (verdict: Time Limit Exceeded):
x=input()
while 'ST' in x:
    x=x.replace('ST','')
print(len(x))


Fixed submission:
x=input()
l=len(x)
c=0
ans=0
for i in range(l):
    if x[i]=='S':
        c+=1
    else:
        if c>0:
            ans+=1
        c-=1
    if c<0:
        c+=1
print(l-ans*2)
Buggy python submission (verdict: Runtime Error):
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=[]
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
ans=''
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
        ans+='a'
    else:
        ans+=S[i]
ans=ans[:-1]+X[X.index(ans[-1])+k]

print(ans)


Fixed submission:
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=[]
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
ans=''
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
        ans+='a'
    else:
        ans+=S[i]
ans=ans[:-1]+X[X.index(ans[-1])+k%26]

print(ans)

Buggy python submission (verdict: Runtime Error):
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=[]
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
ans=''
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
        ans+='a'
    else:
        ans+=S[i]
ans=ans[:-1]+X[X.index(ans[i])+k]

print(ans)

Fixed submission:
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=[]
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
ans=''
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
        ans+='a'
    else:
        ans+=S[i]
ans=ans[:-1]+X[X.index(ans[-1])+k%26]

print(ans)

Buggy python submission (verdict: Runtime Error):
from _collections import deque
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=deque([])
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
important=0
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
    else:
        important=i
        break
ans2=''
for i in range(important,len(S)-1):
    if N[i]<=k:
        ans2+='a'
        k-=N[i]
    else:
        ans2+=X[X.index(S[i])]

print('a'*important+ans2+X[X.index(S[-1])+k])

Fixed submission:
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=[]
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
ans=''
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
        ans+='a'
    else:
        ans+=S[i]
ans=ans[:-1]+X[X.index(ans[-1])+k%26]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y=map(int,input().split())

cnt=[0 for i in range(n)]

for i in range(1,n+1):
  for j in range(i+1,n+1):
    a=min(abs(x-i),abs(y-i))
    b=min(abs(x-j),abs(y-j))
    l=min(j-i,a+b+1)
    cnt[l] += 1
      
for i in range(1,n):
  print(cnt[i])


Fixed submission:
n,x,y=map(int,input().split())

cnt=[0 for i in range(n)]

for i in range(1,n+1):
  for j in range(i+1,n+1):
    a=min(abs(x-i),abs(y-i))
    b=min(abs(x-j),abs(y-j))
    l=min(j-i,a+b+1)
    cnt[l] += 1
      
for i in range(1,n):
  print(cnt[i])

Buggy python submission (verdict: Runtime Error):
n,x,y=map(int,input().split())

cnt={}
for i in range(1,n+1):
  for j in range(i+1,n+1):
    if i <= x and y <= j:
      cnt[(j-y)-(x-i)+1] += 1
    else:
      cnt[j-i] += 1
      
for i in range(1,n):
  print(cnt[i])

Fixed submission:
n,x,y=map(int,input().split())

cnt=[0 for i in range(n)]

for i in range(1,n+1):
  for j in range(i+1,n+1):
    a=min(abs(x-i),abs(y-i))
    b=min(abs(x-j),abs(y-j))
    l=min(j-i,a+b+1)
    cnt[l] += 1
      
for i in range(1,n):
  print(cnt[i])