Buggy python submission (verdict: Time Limit Exceeded):
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

from scipy import sparse

import numpy as np
S = str(input())
N = len(S)
A = np.matrix([[0]*N for _ in range(N)])
for i in range(N):
  if S[i]=='R':
    A[i,i+1] = 1
  else:
    A[i,i-1] = 1

x = sparse.lil_matrix(np.array([1]*N)) * sparse.lil_matrix(np.linalg.matrix_power(A,10**5))
x = x.toarray()
a = []
for i in range(N):
  a.append(x[0,i])
print(*a)

Fixed submission:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

S = str(input())
n = len(S)
ans = [0]*n

left = 0
while left<=n-1:
  R_pos = n-1
  for i in range(left,n):
    if S[i]=='L':
      R_pos = i-1
      L_pos = i
      break
  if R_pos == n-1:
    ans[R_pos] += R_pos-left + 1
    break
  right = n-1
  for j in range(i+1,n):
    if S[j] == 'R':
      right = j-1
      break
  ans[R_pos] += (R_pos-left)//2 + (right-R_pos)//2 + 1
  ans[L_pos] += (L_pos-left)//2 + (right-L_pos)//2 + 1
  if right == n-1:
    break
  left = j

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

from scipy import sparse

import numpy as np
S = str(input())
N = len(S)
A = np.matrix([[0]*N for _ in range(N)])
for i in range(N):
  if S[i]=='R':
    A[i,i+1] = 1
  else:
    A[i,i-1] = 1

x = sparse.lil_matrix(np.array([1]*N)) * sparse.lil_matrix(np.linalg.matrix_power(A,10**100))
x = x.toarray()
a = []
for i in range(N):
  a.append(x[0,i])
print(*a)

Fixed submission:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

S = str(input())
n = len(S)
ans = [0]*n

left = 0
while left<=n-1:
  R_pos = n-1
  for i in range(left,n):
    if S[i]=='L':
      R_pos = i-1
      L_pos = i
      break
  if R_pos == n-1:
    ans[R_pos] += R_pos-left + 1
    break
  right = n-1
  for j in range(i+1,n):
    if S[j] == 'R':
      right = j-1
      break
  ans[R_pos] += (R_pos-left)//2 + (right-R_pos)//2 + 1
  ans[L_pos] += (L_pos-left)//2 + (right-L_pos)//2 + 1
  if right == n-1:
    break
  left = j

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

from scipy import sparse

import numpy as np
S = str(input())
N = len(S)
A = np.matrix([[0]*N for _ in range(N)])
for i in range(N):
  if S[i]=='R':
    A[i,i+1] = 1
  else:
    A[i,i-1] = 1


x = np.array([1]*N) * sparse.lil_matrix(np.linalg.matrix_power(A,10**100))
print(*x)

Fixed submission:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

S = str(input())
n = len(S)
ans = [0]*n

left = 0
while left<=n-1:
  R_pos = n-1
  for i in range(left,n):
    if S[i]=='L':
      R_pos = i-1
      L_pos = i
      break
  if R_pos == n-1:
    ans[R_pos] += R_pos-left + 1
    break
  right = n-1
  for j in range(i+1,n):
    if S[j] == 'R':
      right = j-1
      break
  ans[R_pos] += (R_pos-left)//2 + (right-R_pos)//2 + 1
  ans[L_pos] += (L_pos-left)//2 + (right-L_pos)//2 + 1
  if right == n-1:
    break
  left = j

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

from decimal import Decimal

import numpy as np
S = str(input())
N = len(S)
A = np.matrix([[0]*N for _ in range(N)])
for i in range(N):
  if S[i]=='R':
    A[i,i+1] = 1
  else:
    A[i,i-1] = 1

x = np.array([1]*N) * np.linalg.matrix_power(A,10**5)
a = []
for i in range(N):
  a.append(x[0,i])
print(*a)

Fixed submission:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

S = str(input())
n = len(S)
ans = [0]*n

left = 0
while left<=n-1:
  R_pos = n-1
  for i in range(left,n):
    if S[i]=='L':
      R_pos = i-1
      L_pos = i
      break
  if R_pos == n-1:
    ans[R_pos] += R_pos-left + 1
    break
  right = n-1
  for j in range(i+1,n):
    if S[j] == 'R':
      right = j-1
      break
  ans[R_pos] += (R_pos-left)//2 + (right-R_pos)//2 + 1
  ans[L_pos] += (L_pos-left)//2 + (right-L_pos)//2 + 1
  if right == n-1:
    break
  left = j

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

from decimal import Decimal

import numpy as np
S = str(input())
N = len(S)
A = np.matrix([[0]*N for _ in range(N)])
for i in range(N):
  if S[i]=='R':
    A[i,i+1] = 1
  else:
    A[i,i-1] = 1

x = np.array([1]*N) * np.linalg.matrix_power(A,10**100)
a = []
for i in range(N):
  a.append(x[0,i])
print(*a)

Fixed submission:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

S = str(input())
n = len(S)
ans = [0]*n

left = 0
while left<=n-1:
  R_pos = n-1
  for i in range(left,n):
    if S[i]=='L':
      R_pos = i-1
      L_pos = i
      break
  if R_pos == n-1:
    ans[R_pos] += R_pos-left + 1
    break
  right = n-1
  for j in range(i+1,n):
    if S[j] == 'R':
      right = j-1
      break
  ans[R_pos] += (R_pos-left)//2 + (right-R_pos)//2 + 1
  ans[L_pos] += (L_pos-left)//2 + (right-L_pos)//2 + 1
  if right == n-1:
    break
  left = j

print(*ans)

Buggy python submission (verdict: Runtime Error):
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

from decimal import Decimal

import numpy as np
S = str(input())
N = len(S)
A = np.matrix([[0]*N for _ in range(N)])
for i in range(N):
  if S[i]=='R':
    A[i,i+1] = 1
  else:
    A[i,i-1] = 1

x = np.array([1]*N) * np.linalg.matrix_power(A,10**100)
a = []
for i in range(N):
  a.append(x[0,i])
print(*a)

Fixed submission:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

S = str(input())
n = len(S)
ans = [0]*n

left = 0
while left<=n-1:
  R_pos = n-1
  for i in range(left,n):
    if S[i]=='L':
      R_pos = i-1
      L_pos = i
      break
  if R_pos == n-1:
    ans[R_pos] += R_pos-left + 1
    break
  right = n-1
  for j in range(i+1,n):
    if S[j] == 'R':
      right = j-1
      break
  ans[R_pos] += (R_pos-left)//2 + (right-R_pos)//2 + 1
  ans[L_pos] += (L_pos-left)//2 + (right-L_pos)//2 + 1
  if right == n-1:
    break
  left = j

print(*ans)