Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

mod=998244353

N,S=nm()
A=nl()


dp=[[0]*3001  for _ in range(3001)]#i i番目 j和がj
dp[0][A[0]]=1
dp[0][0]=2
for i in range(1,N):
    for j in range(0,3001):
        if(0<=(j-A[i])):
            dp[i][j]=dp[i-1][j-A[i]]+2*dp[i-1][j]
        else:
            dp[i][j]=2*dp[i-1][j]
        dp[i][j]%=mod

ans=dp[N-1][S]
print(ans%mod)

Fixed submission:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

mod=998244353

N,S=nm()
A=nl()


dp=[[0]*3001  for _ in range(3001)]#i i番目 j和がj
dp[0][A[0]]=1
dp[0][0]=2
for i in range(1,N):
    for j in range(0,3001):
        if(0<=(j-A[i])):
            dp[i][j]=dp[i-1][j-A[i]]+2*dp[i-1][j]
        else:
            dp[i][j]=2*dp[i-1][j]
        dp[i][j]%=mod

ans=dp[N-1][S]
print(ans%mod)
Buggy python submission (verdict: Runtime Error):
import sys
import  math
from heapq import *
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

mod=10**9+7
zero=0
counter0=defaultdict(int)
counter1=defaultdict(int)
N=int(input())
for i in range(N):
    x,y=nm()
    if(x==0 and y==0):
        zero+=1
        continue
    g=fractions.gcd(x,y)
    x/=g
    y/=g
    if(y<0):
        x=-x
        y=-y
    if(y==0 and x<0):
        x=-x
        y=-y
    rot90=False
    if(x<0):
        rot90=True
    if(rot90):
        tmp = x
        x=y
        y=-tmp
    if(rot90):
        counter0[(x,y)]+=1
    else:
        counter1[(x,y)]+=1
        counter0[(x,y)]+=0

ans=1
for key,cnt0 in counter0.items():
    cnt1=counter1[key]
    now=1
    now+=2**cnt0-1
    now+=2**cnt1-1
    now%=mod
    ans*=now
    ans%=mod
        
ans+=zero
ans-=1

print(ans%mod)






Fixed submission:
import sys
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


N=int(input())
if(N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9):
    print('hon')

if(N%10==0 or N%10==1 or N%10==6 or N%10==8 ): 
    print('pon')

if(N%10==3): 
    print('bon')
Buggy python submission (verdict: Runtime Error):
            
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

N,K=nm()
A=nl()

D=60
MAX_N=20005
to=[[0]*MAX_N for i in range(D)]

to[0][1:N+1]=A

for i in range(D-1):
    for j in range(1,N+1):
        to[i+1][j]=to[i][to[i][j]]

v=1
for i in range(D-1,-1,-1):
    l = 1<<i
    if(l<=K):
        v=to[i][v]
        K-=l

print(v)



Fixed submission:
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

S=list(ns())
T=list(ns())
T2=T[0:len(T)-1]
print('Yes' if S==T2 else 'No')

Buggy python submission (verdict: Runtime Error):
    import sys
    stdin=sys.stdin
     
    ns = lambda:stdin.readline().rstrip()
    ni = lambda:int(stdin.readline().rstrip())
    nm = lambda:map(int,stdin.readline().split())
    nl = lambda:list(map(int,stdin.readline().split()))
     
    N,K=nm()
    A=nl()
     
    city_l=[]
    city_l.append(1)
    city_c=[0]*(N+1)
    city_c[1]+=1
    n_city=A[0]
    flag=True
    r_start=-1
    r_end=-1
    while(flag):
        city_c[n_city]+=1
        city_l.append(n_city)
        if(city_c[n_city]>1):
            r_start=city_l.index(n_city)+1
            r_end=len(city_l)-1
            flag=False
        n_city=A[n_city-1]
     
    if(K<r_end):
        print(city_l[K-1])
     
     
    else:
        K2=K-r_end
        K2=K2%(r_end-r_start+1)
        if(K2==0):
           print(A[city_l[r_end-1]-1])
        else:
           print(A[city_l[r_start+K2-2]-1])
     

Fixed submission:
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

S=list(ns())
T=list(ns())
T2=T[0:len(T)-1]
print('Yes' if S==T2 else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

A,B,C,K=nm()
ans=0
for i in range(K):
    if(A>0):
        A-=1
        ans+=1
    elif(B>0):
        B-=1
    else:
        C-=1
        ans-=1

print(ans)

Fixed submission:
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

A,B,C,K=nm()
ans=0

ans+=min(A,K)
K-=min(A,K)

if(K>0):
    K-=min(B,K)
if(K>0):
    ans-=min(C,K)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
            
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

N,K=nm()
A=nl()

D=60
MAX_N=2000005
to=[[0]*MAX_N for i in range(D)]

to[0][1:N+1]=A

for i in range(D-1):
    for j in range(1,N+1):
        to[i+1][j]=to[i][to[i][j]]

v=1
for i in range(D-1,-1,-1):
    l = 1<<i
    if(l<=K):
        v=to[i][v]
        K-=l

print(v)



Fixed submission:
            
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

N,K=nm()
A=nl()

city_l=[0]
city_l.append(1)
city_c=[0]*(N+1)
city_c[1]+=1
n_city=A[0]
flag=True
r_start=-1
r_end=-1
while(flag):
    city_c[n_city]+=1
    city_l.append(n_city)
    if(city_c[n_city]>1):
        r_start=city_l.index(n_city)
        r_end=len(city_l)-1
        city_l.append(A[n_city-1])
        flag=False
    n_city=A[n_city-1]

if(K<=r_end):
    print(A[city_l[K]-1])


else:
    K2=K-r_end+1
    K2=K2%(r_end-r_start)
    if(K2==0):
       print(city_l[r_end])
    else:
       print(city_l[r_start+K2])
Buggy python submission (verdict: Runtime Error):
import sys
import itertools
import heapq
import numpy as np
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K=nm()
A=[0]*K
for i in range(K):
    d=int(input())
    tmp=nl()
    for j in range(d):
        A[tmp[j]-1]+=1
c=0
for i in range(N):
        if(A[i]==0):
            c+=1

print(c)

Fixed submission:
import sys
import itertools
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K=nm()
A=[0 for i in range(N)]
for i in range(K):
    d=int(input())
    tmp=nl()
    for j in range(d):
        A[tmp[j]-1]+=1
c=0
for i in range(N):
        if(A[i]==0):
            c+=1

print(c)
Buggy python submission (verdict: Runtime Error):
import sys
import  math
import fractions
from collections import defaultdict
from functools import reduce
stdin = sys.stdin
         
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
     
INF=10**18
mod=10**9+7
N=int(input())
A=nl()
ans=0
min_bai=1
for i in range(N):#最大公倍数
    min_bai=min_bai*A[i]//fractions.gcd(min_bai,A[i])

#lcm = reduce(lambda x,y: x//fractions.gcd(x,y)*y, A)
 
for i in range(N):
    ans+=lcm//A[i]

#ans = sum(lcm//x for x in A)
print(ans%mod)
    

Fixed submission:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,M=nm()
print('Yes' if N==M else 'No')

Buggy python submission (verdict: Runtime Error):
import sys
import  math
import fractions
from collections import defaultdict
from functools import reduce
stdin = sys.stdin
         
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
     
INF=10**18
mod=10**9+7
N=int(input())
A=nl()
ans=0
min_bai=1
#for i in range(N):#最大公倍数
#    min_bai=min_bai*A[i]//fractions.gcd(min_bai,A[i])

lcm = reduce(lambda x,y: x//fractions.gcd(x,y)*y, A)
 
#for i in range(N):
#    ans+=lcm//A[i]

ans = sum(lcm//x for x in A)
print(ans%mod)
    

Fixed submission:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,M=nm()
print('Yes' if N==M else 'No')
Buggy python submission (verdict: Runtime Error):
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

S=input()
A=['a','b','c','b','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
if(S=='z'):
    print('a')
else:
    inds=A.index(S)
    print(A[inds+1])


Fixed submission:
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

S=input()
A=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
if(S=='z'):
    print('a')
else:
    inds=A.index(S)
    print(A[inds+1])
Buggy python submission (verdict: Runtime Error):
import sys
stdin=sys.stdin

ns=lambda:stdin.readline().rstrip()
ni=lambda:int(stdin.readline().rstrip())
nm=lambda:map(int,stdin.readline().rstrip())
nl=lambda:list(map(int,stdin,readline().rstrip()))

K,X=nm()
print('Yes' if X<=500*K else 'No')

Fixed submission:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

K,X=nm()
print('Yes' if X<=500*K else 'No')
Buggy python submission (verdict: Runtime Error):
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))



X=int(input())

prime_l=[0]*(2*X)
for  i in range(2,X):
    if(prime_l[i]==0):
        for j in range(1,(2*X)//i):
            prime_l[i*j]+=1
        
while(1):
    X+=1
    if(prime_l[X]==0):
        print(X)
        sys.exit(0)


Fixed submission:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=ns().split()
print(S[1]+S[0])
Buggy python submission (verdict: Runtime Error):
import sys
import collections
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K,Q=nm()
Al=[0]*N
for i in range(Q):
    Al[i]=ni()



for i in range(N):
    #print(Al.count(i+1))
    print('No' if (K-Q+Al.count(i+1)<1) else 'Yes')

Fixed submission:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=list(ns())
S_o=''.join(S[0::2])
S_e=''.join(S[1::2])
print('Yes' if ((not ('L' in S_o)) and (not ('R' in S_e))) else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import collections
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K,Q=nm()
Al=[0]*Q
for i in range(Q):
    Al[i]=int(input())



for i in range(N):
    print('No' if (K-Q+Al.count(i+1)<1) else 'Yes')

Fixed submission:
import sys
import collections
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K,Q=nm()
Al=[0]*Q
ans_l=[K-Q]*N
for i in range(Q):
    #Al[i]=int(input())
    ans_l[int(input())-1]+=1
    


for i in range(N):
    #print(Al.count(i+1))
    #print('No' if (K-Q+Al.count(i+1)<1) else 'Yes')
    print('No' if (ans_l[i]<1) else 'Yes')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import collections
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K,Q=nm()
Al=[0]*Q
for i in range(Q):
    Al[i]=ni()



for i in range(N):
    print('No' if (K-Q+Al.count(i+1)<1) else 'Yes')

Fixed submission:
import sys
import collections
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K,Q=nm()
Al=[0]*Q
ans_l=[K-Q]*N
for i in range(Q):
    #Al[i]=int(input())
    ans_l[int(input())-1]+=1
    


for i in range(N):
    #print(Al.count(i+1))
    #print('No' if (K-Q+Al.count(i+1)<1) else 'Yes')
    print('No' if (ans_l[i]<1) else 'Yes')

Buggy python submission (verdict: Runtime Error):
import sys
import collections
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K,Q=nm()
Al=[0]*N
for i in range(Q):
    Al[i]=ni()



for i in range(N):
    print('No' if (K-Q+Al.count(i+1)<1) else 'Yes')

Fixed submission:
import sys
import collections
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K,Q=nm()
Al=[0]*Q
ans_l=[K-Q]*N
for i in range(Q):
    #Al[i]=int(input())
    ans_l[int(input())-1]+=1
    


for i in range(N):
    #print(Al.count(i+1))
    #print('No' if (K-Q+Al.count(i+1)<1) else 'Yes')
    print('No' if (ans_l[i]<1) else 'Yes')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,M=nl()
A=nl()

for i in range(M):
	A.sort()
	A[-1]=A[-1]//2

print(sum(A))   

Fixed submission:
import sys
import heapq
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,M=nm()
A=nl()
h=[]
for i in A:
    heapq.heappush(h,-1*i)

for i in range(M):
	maxval=heapq.heappop(h)
	heapq.heappush(h,-(-maxval//2))
    
print(-sum(h))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import collections
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,M=nl()
A=nl()

for i in range(M):
    inds=A.index(max(A))
    A[inds]=A[inds]//2

print(sum(A))    

Fixed submission:
import sys
import heapq
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,M=nm()
A=nl()
h=[]
for i in A:
    heapq.heappush(h,-1*i)

for i in range(M):
	maxval=heapq.heappop(h)
	heapq.heappush(h,-(-maxval//2))
    
print(-sum(h))
Buggy python submission (verdict: Runtime Error):
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n=input()
print(n*n*n)

Fixed submission:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n=int(input())
print(n*n*n)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import bisect
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,M=nm()
Bl=[[] for i in range(10**5+5)]

for i in range(N):
    A,B=nm()
    Bl[A].append(B)

now=Bl[0]
ans=0
for i in range(1,M+2):
    if(now!=[]):
        max_val=max(now)
        ans+=max_val
        now.remove(max_val)
    now=now+Bl[i]

print(ans)

Fixed submission:
import sys
import math
import bisect
import heapq
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,M=nm()
Bl=[[] for i in range(10**5+5)]

for i in range(N):
    A,B=nm()
    Bl[A].append(-B)

now=[]
if(Bl[0]!=[]):
    for i in range(len(Bl[0])):
        heapq.heappush(now,Bl[0][i])

ans=0
for i in range(1,M+2):
    if(now!=[]):
        max_val=heapq.heappop(now)
        ans+=max_val
    if(Bl[i]!=[]):
        for j in range(len(Bl[i])):
            heapq.heappush(now,Bl[i][j])

print(-ans)

Buggy python submission (verdict: Runtime Error):
import sys
import math
import bisect
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,M=nm()
Bl=[[] for i in range(10**5)]

for i in range(N):
    A,B=nm()
    Bl[A].append(B)

now=Bl[0]
ans=0
for i in range(1,M+2):
    if(now!=[]):
        max_val=max(now)
        ans+=max_val
        now.remove(max_val)
    now=now+Bl[i]

print(ans)


Fixed submission:
import sys
import math
import bisect
import heapq
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,M=nm()
Bl=[[] for i in range(10**5+5)]

for i in range(N):
    A,B=nm()
    Bl[A].append(-B)

now=[]
if(Bl[0]!=[]):
    for i in range(len(Bl[0])):
        heapq.heappush(now,Bl[0][i])

ans=0
for i in range(1,M+2):
    if(now!=[]):
        max_val=heapq.heappop(now)
        ans+=max_val
    if(Bl[i]!=[]):
        for j in range(len(Bl[i])):
            heapq.heappush(now,Bl[i][j])

print(-ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=list(ns())
M=[0]*len(S)

for i in range(len(S)):
    if(S[i]=='R'):
        k=0
        while(S[i+k]!='L'):
            k+=1
        M[i+k-(k%2)]+=1
                      
    else:
        k=0
        while(S[i-k]!='R'):
            k+=1
        M[i-k+(k%2)]+=1

print(*M)

Fixed submission:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=list(ns())
M=[0]
M2=[-1]
ans=[0]*len(S)


for i in range(len(S)-1):
    if(S[i]=='R' and S[i+1]=='L'):
        M.append(i)
    if(S[i]=='L' and S[i+1]=='R'):
        M2.append(i)

M2.append(len(S)-1)

for i in range(1,len(M)):
    ans[M[i]]=(M[i]-M2[i-1])//2+(M[i]-M2[i-1])%2+(M2[i]-M[i])//2
    ans[M[i]+1]=(M[i]-M2[i-1])//2+(M2[i]-M[i])//2+(M2[i]-M[i])%2
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=list(ns())
M=[0]*len(S)

for i in range(len(S)):
    if(S[i]=='R'):
        k=0
        while(S[i+k]!='L'):
            k+=1
        M[i+k-(k%2)]+=1
                      
    else:
        k=0
        while(S[i-k]!='R'):
            k+=1
        M[i-k+(k%2)]+=1

print(*M)

Fixed submission:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=list(ns())
M=[0]
M2=[-1]
ans=[0]*len(S)


for i in range(len(S)-1):
    if(S[i]=='R' and S[i+1]=='L'):
        M.append(i)
    if(S[i]=='L' and S[i+1]=='R'):
        M2.append(i)

M2.append(len(S)-1)

for i in range(1,len(M)):
    ans[M[i]]=(M[i]-M2[i-1])//2+(M[i]-M2[i-1])%2+(M2[i]-M[i])//2
    ans[M[i]+1]=(M[i]-M2[i-1])//2+(M2[i]-M[i])//2+(M2[i]-M[i])%2
print(*ans)