Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s, t = [input() for _ in range(2)]

for i in range(len(s)):
    if s[i] == t[i]:
        pass
    else:
        s_diff = s[i]
        t_diff = t[i]
        s = s.translate(str.maketrans({s_diff: t_diff, t_diff: s_diff}))

if s == t:
    print("Yes")
else:
    print("No")


Fixed submission:
s = list(input())
t = list(input())
x = list(set(s))
y = list(set(t))
a = []
b = []

for i in range(len(set(s))):
    a.append(s.count(x[i]))
    
for j in range(len(set(t))):
    b.append(t.count(y[j]))
    
a.sort()
b.sort()

if a == b:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


N, X = map(int, input().split())
toshi = list(map(int, input().split()))
toshi.sort()
if N == 1:
    print(toshi[0] - X)
    exit()

diff = [abs(X - toshi[0])]

for i in range(N - 1):
    diff.append(abs(toshi[i+1] - toshi[i]))

print(gcd_list(diff))


Fixed submission:
import fractions
from functools import reduce

n, x = map(int, input().split())
xl = list(map(int, input().split()))
xl.append(x)
xl.sort()
xldiv = []
for i in range(n):
    xldiv.append(xl[i + 1] - xl[i])

print(reduce(fractions.gcd, xldiv))

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)


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

if N == 1:
    print(toshi[0] - X)
    exit()

diff = []
diff.append(X - toshi[0])

for i in range(N-1):
    diff.append(abs(toshi[i+1] - toshi[i]))

print(gcd_list(diff))


Fixed submission:
import fractions
from functools import reduce

n, x = map(int, input().split())
xl = list(map(int, input().split()))
xl.append(x)
xl.sort()
xldiv = []
for i in range(n):
    xldiv.append(xl[i + 1] - xl[i])

print(reduce(fractions.gcd, xldiv))

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)


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

if N == 1:
    print(toshi[0] - X)
    exit()

diff = []

for i in range(N - 1):
    diff.append(abs(toshi[i+1] - toshi[i]))

print(gcd_list(diff))


Fixed submission:
import fractions
from functools import reduce

n, x = map(int, input().split())
xl = list(map(int, input().split()))
xl.append(x)
xl.sort()
xldiv = []
for i in range(n):
    xldiv.append(xl[i + 1] - xl[i])

print(reduce(fractions.gcd, xldiv))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n, k = map(int, input().split())
cnt = 0
for i in itertools.combinations_with_replacement(range(1, n + 1), 3):
    if (i[0] + i[1]) % k == 0 and (i[1] + i[2]) % k == 0 and (i[2] + i[0]) % k == 0:
        cnt += len(list(set((itertools.permutations(i)))))
print(cnt)

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

s = n // k
ans = s ** 3
if k % 2 == 0:
    s_ = (n + (k // 2)) // k
    ans += s_ ** 3
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().spkit())
print((a - 1) * (b - 1))

Fixed submission:
a, b = map(int, input().split())
print((a - 1) * (b - 1))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
acs = [0] * (n + 1)

for i in range(1, n + 1):
    acs[i] = (acs[i - 1] + a[i - 1]) % m
cnt = 0
for l in range(n):
    for r in range(l, n):
        if acs[r] == acs[l - 1]:
            cnt += 1
print(cnt)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
table = {0: 0}
buf = 0
cnt = 0
for i in range(n):
    buf = (buf + a[i]) % m
    if buf in table:
        cnt += table[buf]
        table[buf] += 1
    else:
        table[buf] = 1
print(cnt + table[0])

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
acs = [0] * (n + 1)

for i in range(1, n + 1):
    acs[i] = (acs[i - 1] + a[i - 1])
cnt = 0
for l in range(n):
    for r in range(l, n):
        if (acs[r] - acs[l - 1]) % m == 0:
            cnt += 1
print(cnt)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
table = {0: 0}
buf = 0
cnt = 0
for i in range(n):
    buf = (buf + a[i]) % m
    if buf in table:
        cnt += table[buf]
        table[buf] += 1
    else:
        table[buf] = 1
print(cnt + table[0])

Buggy python submission (verdict: Runtime Error):
import numpy
n, m = map(int, input().split())
a = numpy.array([0] + list(map(int, input().split())), dtype=numpy.float64)

acs = numpy.cumsum(a)
cnt = 0

for l in range(n):
    for r in range(l, n):
        if (acs[r] - acs[l - 1]) % m == 0:
            cnt += 1
print(cnt)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
table = {0: 0}
buf = 0
cnt = 0
for i in range(n):
    buf = (buf + a[i]) % m
    if buf in table:
        cnt += table[buf]
        table[buf] += 1
    else:
        table[buf] = 1
print(cnt + table[0])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy
n, m = map(int, input().split())
a = numpy.array([0] + list(map(int, input().split())), dtype=numpy.float64)

acs = numpy.cumsum(a)
cnt = 0

for l in range(n):
    for r in range(l, n):
        if (acs[r] - acs[l - 1]) % m == 0:
            cnt += 1
print(cnt)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
table = {0: 0}
buf = 0
cnt = 0
for i in range(n):
    buf = (buf + a[i]) % m
    if buf in table:
        cnt += table[buf]
        table[buf] += 1
    else:
        table[buf] = 1
print(cnt + table[0])
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans =0
for i in range(1,n+1)
	for j in range(i,n+1,i) :ans+=j
print(ans)


Fixed submission:
n=int(input())
ans =0
for i in range(1,n+1):
	for j in range(i,n+1,i) :ans+=j
print(ans)

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

Fixed submission:
n=int(input())
ans =0
for i in range(1,n+1):
	for j in range(i,n+1,i) :ans+=j
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 1
for i in range(N):
    ans *= i+1

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

print(ans)

Fixed submission:
N = int(input())
ans = 1
for i in range(N):
    ans *= i+1
    ans = ans%(10**9+7)

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

for i in A:
    if i%2 == 0:
        A.remove(i)

ans = len(A)

if ans%2 == 0:
    print("YES")
else:
    print("NO")

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

ans = len([a for a in A if a % 2 == 1])

if ans%2 == 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np

n = map(int, raw_input().split(" "))
a = map(int, raw_input().split(" "))
maxi = a[np.argmax(a)]
mini = a[np.argmin(a)]
print(2*n[0])
if maxi < 0:
    a.reverse()
    cnt = len(a) - 1
    for i in a:
        print(str(cnt + 1) + " " + str(np.argmin(a) + 1))
        a[cnt] += a[np.argmin(a)];
        print(str(cnt + 1) + " " + str(np.argmin(a) + 1))
        a[cnt] += a[np.argmin(a)];
        cnt -= 1;
else:
    cnt = 0
    for i in a:
        print(str(cnt + 1) + " " + str(np.argmax(a) + 1))
        a[cnt] += a[np.argmax(a)];
        print(str(cnt + 1) + " " + str(np.argmax(a) + 1))
        a[cnt] += a[np.argmax(a)];
        cnt += 1


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np

n = int(input())
a = list(map(int , input().split()))
print(2*n)
if a[np.argmax(a)] <= -a[np.argmin(a)]:
    cnt = len(a) - 1
    for i in range(0, len(a)):
        print(str(np.argmin(a) + 1) + " " + str(cnt + 1))
        a[cnt] += a[np.argmin(a)]
        print(str(np.argmin(a) + 1) + " " + str(cnt + 1))
        a[cnt] += a[np.argmin(a)]
        cnt -= 1;
else:
    cnt = 0
    for i in range(0, len(a)):
        print(str(np.argmax(a) + 1) + " " + str(cnt + 1))
        a[cnt] += a[np.argmax(a)]
        print(str(np.argmax(a) + 1) + " " + str(cnt + 1))
        a[cnt] += a[np.argmax(a)]
        cnt += 1
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
def pow(a, b):
    if b == 1:return a
    if b%2 == 0: return pow(a*a, int(b/2))
    return a*pow(a*a, int(b/2))
 
def binaryOne(n, multi):
    l, r = 0, n
    mid = (l + r)/2    
    while r - l > 1:
        if pow(mid, multi) >= n:
            r = mid
        else:
            l = mid
        mid = (r + l)/2
    return r;
 
 
def binaryTwo(n, maxi, multi):
    l, r = 0, multi
    mid = (l + r)/2
    while r - l > 1:
        if pow(maxi, (multi - mid))*pow(maxi - 1, mid) >= n:
            l = mid
        else:
            r = mid
        mid = (r + l)/2;
    return l
 
n, a = map(int,raw_input().split(" "))
ans = 1e18
for i in xrange(0, 40):
    maxi = binaryOne(n, i + 1);
    subt = binaryTwo(n, maxi, i + 1)
    ans = min(ans, a*i + maxi*(i + 1) - subt)
    
print ans

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
def pow(a, b):
    if b == 1:return a
    if b%2 == 0: return pow(a*a, int(b/2))
    return a*pow(a*a, int(b/2))
 
def binaryOne(n, multi):
    l, r = 0, n
    mid = (l + r)/2    
    while r - l > 1:
        if pow(mid, multi) >= n:
            r = mid
        else:
            l = mid
        mid = (r + l)/2
    return r;
 
 
def binaryTwo(n, maxi, multi):
    l, r = 0, multi
    mid = (l + r)/2
    while r - l > 1:
        if pow(maxi, (multi - mid))*pow(maxi - 1, mid) >= n:
            l = mid
        else:
            r = mid
        mid = (r + l)/2;
    return l
 
n, a = map(int,raw_input().split(" "))
ans = 1e18
for i in xrange(0, 40):
    maxi = binaryOne(n, i + 1);
    subt = binaryTwo(n, maxi, i + 1)
    ans = min(ans, a*i + maxi*(i + 1) - subt)
    
print ans
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))

ans = 1
for a in A:
    ans *= a

print(ans if ans <= 10 ** 18 else - 1)


Fixed submission:
n = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit()
ans = 1
for a in A:
    ans *= a
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input()[:-1])
if n in [2,4,5,7,9]:
  print('hon')
elif n in [0,1,6,8]:
  print('pon')
else:
  print('bon')

Fixed submission:
n=int(input()[-1])
if n in [2,4,5,7,9]:
  print('hon')
elif n in [0,1,6,8]:
  print('pon')
else:
  print('bon')
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = [[-1] * (N + 1) for i in range(100)]
A[0] = [0] + list(map(int, input().split()))


# nowから2**i先まで移動したとこ
def double(now, i):
    global A
    if A[i][now] != -1:
        return A[i][now]
    # nowから2**(i-1)移動して、そこからさらに2**(i-1)移動する
    A[i][now] = double(double(now, i - 1), i - 1)
    return A[i][now]


# nowからk移動した場所を求める
def rec(now, k):
    if k == 0:
        return now
    # if k == 1:
    #     return A[now]

    log2k = len(bin(k)) - 3
    return rec(double(now, log2k), k - 2 ** log2k)

print(rec(1, K))


Fixed submission:
n, k = map(int, input().split())
A = [0] + list(map(int, input().split()))

if A[1] == 1:
    print(1)
    exit()

# 訪問順
B = [1]

# 訪問済み
C = [False] * (n + 1)
C[1] = True


while True:
    B.append(A[B[-1]])
    if C[B[-1]]:
        break
    C[B[-1]] = True

# print(B)

s = B.index(B[-1])

# print(B)
# print(len(B))

if k < s:
    print(B[k])
    exit()


B = B[B.index(B[-1]):-1]
print(B[(k - s) % len(B)])
Buggy python submission (verdict: Runtime Error):
 n, m, q = map(int, input().split())
 T = []
 for i in range(q):
     a, b, c, d = map(int, input().split())
     T.append((a-1, b-1, c, d))
 
 L = []
 def f(l):
     if len(l) == n+1:
         L.append(l[1:])
         return
     for i in range(l[-1], m + 1):
         f(l + [i])
	f([1])
 
 print(max(sum(d for a, b, c, d in T if l[b] - l[a] == c)) for l in L)

Fixed submission:
n, m, q = map(int, input().split())
A, B, C, D = [], [], [], []
for i in range(q):
    a, b, c, d = map(int, input().split())
    A.append(a - 1)
    B.append(b - 1)
    C.append(c)
    D.append(d)

L = []

def f(l):
    if len(l) == n:
        L.append(l)
        return
    for i in range(l[-1], m + 1):
        f(l + [i])

for i in range(1, m + 1):
    f([i])

ans = 0

for l in L:
    ans = max(ans, sum(d for a, b, c, d in zip(A, B, C, D) if l[b] - l[a] == c))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int, input().split())
A, B, C, D = [], [], [], []
for i in range(q):
    a, b, c, d = map(int, input().split())
    A.append(a - 1)
    B.append(b - 1)
    C.append(c)
    D.append(d)

L = []

def f(l):
    if len(l) == n:
        L.append(l)
        return
    for i in range(l[-1], m + 1):
        f(l + [i])

for i in range(1, m + 1):
    f([1])

ans = 0

for l in L:
    ans = max(ans, sum(d for a, b, c, d in zip(A, B, C, D) if l[b] - l[a] == c))

print(ans)


Fixed submission:
n, m, q = map(int, input().split())
A, B, C, D = [], [], [], []
for i in range(q):
    a, b, c, d = map(int, input().split())
    A.append(a - 1)
    B.append(b - 1)
    C.append(c)
    D.append(d)

L = []

def f(l):
    if len(l) == n:
        L.append(l)
        return
    for i in range(l[-1], m + 1):
        f(l + [i])

for i in range(1, m + 1):
    f([i])

ans = 0

for l in L:
    ans = max(ans, sum(d for a, b, c, d in zip(A, B, C, D) if l[b] - l[a] == c))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
mod = [0]
for d, c in enumerate(S[::-1]):
    mod.append((int(c) * 10**d + mod[-1]) % 2019)
from collections import *
print(sum(v * (v - 1) // 2 for v in Counter(mod).values()))


Fixed submission:
S = input()
mod = [0]
for d, c in enumerate(S[::-1]):
    mod.append((int(c) * pow(10, d, 2019) + mod[-1]) % 2019)
from collections import *
print(sum(v * (v - 1) // 2 for v in Counter(mod).values()))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
mod = [0]
for i in range(len(S)):
    mod.append(int(S[i:]) % 2019)
from collections import *
print(sum(v * (v - 1) // 2 for v in Counter(mod).values()))


Fixed submission:
S = input()
mod = [0]
for d, c in enumerate(S[::-1]):
    mod.append((int(c) * pow(10, d, 2019) + mod[-1]) % 2019)
from collections import *
print(sum(v * (v - 1) // 2 for v in Counter(mod).values()))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
mod = [0]
for i in range(len(S)):
    mod.append(int(S[i:]) % 2019)
from collections import *
print(sum(v * (v - 1) // 2 for v in Counter(mod).values()))


Fixed submission:
S = input()
mod = [0]
for d, c in enumerate(S[::-1]):
    mod.append((int(c) * pow(10, d, 2019) + mod[-1]) % 2019)
from collections import *
print(sum(v * (v - 1) // 2 for v in Counter(mod).values()))
Buggy python submission (verdict: Time Limit Exceeded):
g = [[0 for i in range(250)] for j in range(250)]


k = int(input())
r = range(1, k + 1)

import math
ans = 0

for a in r:
    for b in r:
        for c in r:

            if g[a][b] > 0:
                ab = g[a][b]
            else:
                ab = g[a][b] = math.gcd(a, b)
            if g[ab][c] > 0:
                ab = g[ab][c]
            else:
                ab = g[ab][c] = math.gcd(ab, c)
            ans += ab

print(ans)


Fixed submission:
g = [[0 for i in range(250)] for j in range(250)]


k = int(input())
r = range(1, k + 1)

import math
ans = 0

for a in r:
    for b in r:
        for c in r:

            if g[a][b] > 0:
                ab = g[a][b]
            else:
                ab = g[a][b] = math.gcd(a, b)
            if g[ab][c] > 0:
                ab = g[ab][c]
            else:
                ab = g[ab][c] = math.gcd(ab, c)
            ans += ab

print(ans)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
A*=100
B*=100
for i in range(2000):
  t*=100
  if A==t*8 and B==t*10:
    print(i)
    break
else:
    print(-1)


Fixed submission:
A, B = map(int, input().split())
for i in range(20000):
    if int(i*0.08) == A and int(i * 0.1) == B:
        print(i)
        exit()
print(-1)

Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
A*=100
B+=100
for i in range(2000):
  t*=100
  if A==t*8//100 and B==t//10:
    print(i)
    exit()
print(-1)

Fixed submission:
A, B = map(int, input().split())
for i in range(20000):
    if int(i*0.08) == A and int(i * 0.1) == B:
        print(i)
        exit()
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
def binary_search(v, is_ok):
    """
    ソートしてから使え！！！
    v : list
        ある場所から左が条件を満たさず、右が条件を満たすように並んだ配列
    is_ok(x) : bool
        vの要素xが条件を満たすかどうかを返す関数
    """
    ng = -1             # 条件を満たさないiのうち今わかっている中で最大の値(v[0]が条件を満たすかもしれないので-1から)
    ok = len(v)         # 条件を満たすiのうち今わかっている中で最小の値(v[n-1]が条件を満たさないかもしれないのでnから)
    # okをできるだけ左に移動させてreturnする

    # ...... ng ok ......
    #          | ->
    # こうなるまで
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2

        if is_ok(v[mid]):   # v[mid]はokであることがわかった
            ok = mid        # okを左に移動
        else:               # v[mid]はngであることがわかった
            ng = mid        # ngを右に移動

    return ok



N, D, A = map(int, input().split())
XH = [tuple(map(int, input().split())) for i in range(N)]
XH.sort()
X = [x for x, h in XH]
H = [(h + A - 1) // A for x, h in XH]

yuukou = 0
mou_mukou = [0] * N + [0]
ans = 0

# lを左端としてn個爆弾を使う
def bomb(l, n):
    global ans, yuukou
    ans += n
    yuukou += n
    r = l + 2 * D
    mou_mukou[binary_search(X, lambda x: r < x)] += n

for i in range(N):
    yuukou -= mou_mukou[i]
    H[i] -= yuukou
    if H[i] > 0:
        bomb(X[i], H[i])

print(ans)


Fixed submission:
def binary_search(v, is_ok):
    """
    ソートしてから使え！！！
    v : list
        ある場所から左が条件を満たさず、右が条件を満たすように並んだ配列
    is_ok(x) : bool
        vの要素xが条件を満たすかどうかを返す関数
    """
    ng = -1             # 条件を満たさないiのうち今わかっている中で最大の値(v[0]が条件を満たすかもしれないので-1から)
    ok = len(v)         # 条件を満たすiのうち今わかっている中で最小の値(v[n-1]が条件を満たさないかもしれないのでnから)
    # okをできるだけ左に移動させてreturnする

    # ...... ng ok ......
    #          | ->
    # こうなるまで
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2

        if is_ok(v[mid]):   # v[mid]はokであることがわかった
            ok = mid        # okを左に移動
        else:               # v[mid]はngであることがわかった
            ng = mid        # ngを右に移動

    return ok



N, D, A = map(int, input().split())
XH = [tuple(map(int, input().split())) for i in range(N)]
XH.sort()
X = [x for x, h in XH]
H = [(h + A - 1) // A for x, h in XH]

yuukou = 0
mou_mukou = [0] * N + [0]
ans = 0

# lを左端としてn個爆弾を使う
def bomb(l, n):
    global ans, yuukou
    ans += n
    yuukou += n
    r = l + 2 * D
    mou_mukou[binary_search(X, lambda x: r < x)] += n

for i in range(N):
    yuukou -= mou_mukou[i]
    H[i] -= yuukou
    if H[i] > 0:
        bomb(X[i], H[i])

print(ans)
Buggy python submission (verdict: Runtime Error):
k, x = map(int, input().split())
print('Yes' if 500*k>=x else'No)

Fixed submission:
K, X = map(int, input().split())
print('Yes' if 500 * K >= X else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
if n == 1:
    print(0)
else:
    a=[i for i in range(1,n+1)]
    b=[i for i in range(2,n+1)]+[1]
    print(sum([a[i] % b[i] for i in range(n)]))

Fixed submission:
n = int(input())
m = n - 1
print(m*(m+1)//2)
Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
l = [[]for i in range(26)]

for i, c in enumerate(s * 2):
    l[ord(c) - ord('a')].append(i)


from bisect import *

shukai = 0
now = 0

t = input()
for c in t:
    x = ord(c) - ord('a')
    if len(l[x]) == 0:
        print(-1)
        exit()
    i = bisect(l[x], now)
    now = l[x][i] + 1
    if now >= n:
        now -= n
        shukai += 1


print(shukai * n + now)


Fixed submission:
s = input()
n = len(s)
l = [[]for i in range(26)]

for i, c in enumerate(s * 2):
    l[ord(c) - ord('a')].append(i)


from bisect import *

shukai = 0
now = 0

t = input()
for c in t:
    x = ord(c) - ord('a')
    if len(l[x]) == 0:
        print(-1)
        exit()
    i = bisect_left(l[x], now)
    now = l[x][i] + 1

    if now >= n:
        now -= n
        shukai += 1


print(shukai * n + now)
Buggy python submission (verdict: Time Limit Exceeded):
s = input() + 'R'


t = []
b = 0
for i in range(1, len(s)):
    if s[i - 1] + s[i] == 'LR':
        t.append(s[b:i])
        b = i

ans = []


for ss in t:
    nR = ss.find('L')
    nL = len(ss) - nR

    R = nR // 2 + (nR % 2) + nL // 2
    L = nL // 2 + (nL % 2) + nR // 2
    ans = ans + [0 for _ in range(nR - 1)]+[R] + \
        [L] + [0 for _ in range(nL - 1)]

for i in range(len(ans)):
    if i != 0:
        print(' ', end='')
    print(ans[i],end='')

Fixed submission:
s = input() + 'R'


t = []
b = 0
for i in range(1, len(s)):
    if s[i - 1] + s[i] == 'LR':
        t.append(s[b:i])
        b = i

ans = []


for ss in t:
    nR = ss.find('L')
    nL = len(ss) - nR

    R = nR // 2 + (nR % 2) + nL // 2
    L = nL // 2 + (nL % 2) + nR // 2

    ans += [0 for _ in range(nR - 1)]+[R, L] + [0 for _ in range(nL - 1)]

for i in range(len(ans)):
    if i != 0:
        print(' ', end='')
    print(ans[i],end='')

Buggy python submission (verdict: Time Limit Exceeded):
s = input() + 'R'


t = []
b = 0
for i in range(1, len(s)):
    if s[i - 1] + s[i] == 'LR':
        t.append(s[b:i])
        b = i

ans = []


for ss in t:
    nR = ss.find('L')
    nL = len(ss) - nR

    R = nR // 2 + (nR % 2) + nL // 2
    L = nL // 2 + (nL % 2) + nR // 2
    ans = ans + [0 for _ in range(nR - 1)]+[R] + \
        [L] + [0 for _ in range(nL - 1)]

for i in range(len(ans)):
    if i != 0:
        print(' ', end='')
    print(ans[i])

Fixed submission:
s = input() + 'R'


t = []
b = 0
for i in range(1, len(s)):
    if s[i - 1] + s[i] == 'LR':
        t.append(s[b:i])
        b = i

ans = []


for ss in t:
    nR = ss.find('L')
    nL = len(ss) - nR

    R = nR // 2 + (nR % 2) + nL // 2
    L = nL // 2 + (nL % 2) + nR // 2

    ans += [0 for _ in range(nR - 1)]+[R, L] + [0 for _ in range(nL - 1)]

for i in range(len(ans)):
    if i != 0:
        print(' ', end='')
    print(ans[i],end='')