Buggy python submission (verdict: Time Limit Exceeded):
S = input()
s = len(S)
shift = 10**100
K = shift.bit_length()

def db(A:list, k:int):
    dv = [[0]*s for _ in range(k+1)]
    dv[0] = A
    for kk in range(1,k+1):
        for n in range(s):
            dv[kk][n] = dv[kk-1][dv[kk-1][n]]
    return dv[k]

a = [1+n if i == "R" else n-1 for n,i in enumerate(S)]


for i in range(1,K):
    if (shift >> i)&1:
        a = db(a, i)
ans = [0]*s
for j in a:
    ans[j]+=1
print(*ans)

Fixed submission:
LOG = 18

def main():
    S = input()
    N = len(S)
    to = []
    for _ in range(LOG):
        l = [0]*N
        to.append(l)
        
    for i in range(N):
        to[0][i] = i + 1 if S[i] == "R" else i -1
    
    for i in range(1, LOG):
        for j in range(N):
            to[i][j] = to[i-1][to[i-1][j]]
            
    ans = [0]*N
    for j in range(N):
        ans[to[LOG-1][j]] += 1
        
    print(*ans)
    return

main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

S = input()
s = len(S)
shift = 10**100
K = shift.bit_length()

ini_ad = np.array([1 if i == "R" else -1 for i in S])

def db(A:list, k:int):
    dv = np.array([[0]*s for _ in range(k+1)])
    dv[0] = A
    for kk in range(1,k+1):
        for n in range(s):
            dv[kk][n] = dv[kk-1][dv[kk-1][n]]
    return dv[k]

a = list(range(s))+ini_ad
for i in range(1,K):
    if (shift >> i)&1:
        a = db(a, i)
ans = [0]*s
for j in a:
    ans[j]+=1
print(*ans)

Fixed submission:
LOG = 18

def main():
    S = input()
    N = len(S)
    to = []
    for _ in range(LOG):
        l = [0]*N
        to.append(l)
        
    for i in range(N):
        to[0][i] = i + 1 if S[i] == "R" else i -1
    
    for i in range(1, LOG):
        for j in range(N):
            to[i][j] = to[i-1][to[i-1][j]]
            
    ans = [0]*N
    for j in range(N):
        ans[to[LOG-1][j]] += 1
        
    print(*ans)
    return

main()

Buggy python submission (verdict: Runtime Error):
import numpy as np

S = input()
s = len(S)
shift = 10**100
K = shift.bit_length()

ini_ad = np.array([1 if i == "R" else -1 for i in S])

def db(A:list, k:int):
    dv = np.array([[0]*s for _ in range(k+1)])
    dv[0] = A
    for kk in range(1,k+1):
        for n in range(s):
            dv[kk][n] = dv[kk-1][dv[kk-1][n]]
    return dv[k]

a = list(range(s))+ini_ad
for i in range(1,K):
    if (shift >> i)&1:
        a = db(a, i)
ans = [0]*s
for j in a:
    ans[j]+=1
print(*ans)

Fixed submission:
LOG = 18

def main():
    S = input()
    N = len(S)
    to = []
    for _ in range(LOG):
        l = [0]*N
        to.append(l)
        
    for i in range(N):
        to[0][i] = i + 1 if S[i] == "R" else i -1
    
    for i in range(1, LOG):
        for j in range(N):
            to[i][j] = to[i-1][to[i-1][j]]
            
    ans = [0]*N
    for j in range(N):
        ans[to[LOG-1][j]] += 1
        
    print(*ans)
    return

main()

Buggy python submission (verdict: Runtime Error):
import numpy as np

S = input()
s = len(S)
shift = 10**100
K = shift.bit_length()

ini_ad = np.array([1 if i == "R" else -1 for i in S])

def db(A:list, k:int):
    dv = np.array([[0]*s for _ in range(k+1)])
    dv[0] = A
    for kk in range(1,k+1):
        for n in range(s):
            dv[kk][n] = dv[kk-1][dv[kk-1][n]]
    return dv[k]

a = list(range(s))+ini_ad
for i in range(1,K):
    if (shift >> i)&1:
        a = db(ans, i)
ans = [0]*s
for j in a:
    ans[j]+=1
print(*ans)

Fixed submission:
LOG = 18

def main():
    S = input()
    N = len(S)
    to = []
    for _ in range(LOG):
        l = [0]*N
        to.append(l)
        
    for i in range(N):
        to[0][i] = i + 1 if S[i] == "R" else i -1
    
    for i in range(1, LOG):
        for j in range(N):
            to[i][j] = to[i-1][to[i-1][j]]
            
    ans = [0]*N
    for j in range(N):
        ans[to[LOG-1][j]] += 1
        
    print(*ans)
    return

main()

Buggy python submission (verdict: Runtime Error):
import numpy as np

S = input()
s = len(S)
shift = 10**100
K = shift.bit_length()

ini_ad = np.array([1 if i == "R" else -1 for i in S])

def db(A:list, k:int):
    dv = np.array([[0]*s for _ in range(k+1)])
    dv[0] = A
    for kk in range(1,k+1):
        for n in range(s):
            dv[kk][n] = dv[kk-1][dv[kk-1][n]]
    return dv[k]

ans = list(range(s))+ini_ad
for i in range(1,K):
    if (shift >> i)&1:
        ans = db(ans, i)

for j in range(s):
    print(np.count_nonzero(ans ==j))

Fixed submission:
LOG = 18

def main():
    S = input()
    N = len(S)
    to = []
    for _ in range(LOG):
        l = [0]*N
        to.append(l)
        
    for i in range(N):
        to[0][i] = i + 1 if S[i] == "R" else i -1
    
    for i in range(1, LOG):
        for j in range(N):
            to[i][j] = to[i-1][to[i-1][j]]
            
    ans = [0]*N
    for j in range(N):
        ans[to[LOG-1][j]] += 1
        
    print(*ans)
    return

main()