Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())

for i in range(-200000, 200000):
    if (i+3)**5 - (i+2)**5 == X:
        # print(i, (i+3)**5 , (i+2)**5)
        print((i+3), (i+2))
        break
    elif (i+3)**5 + (i+2)**5 == X:
        # print(i, (i+3)**5 , (i+2)**5)
        print((i+3), -(i+2))
        break
    elif -(i+3)**5 - (i+2)**5 == X:
        # print(i, (i+3)**5 , (i+2)**5)
        print(-(i+3), (i+2))
        break
    elif -(i+3)**5 + (i+2)**5 == X:
        # print(i, (i+3)**5 , (i+2)**5)
        print(-(i+3), -(i+2))
        break

Fixed submission:
X = int(input())

for a in range(-200, 200):
    for b in range(-200, 200):
        if a**5-b**5 == X:
            print(a, b)
            break
    else:
        continue
    break
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

S = input()
N = len(S)

s = [0 for _ in range(N)]

num = ""
for i in range(N-1, -1, -1):
    num = S[i] + num
    s[i] += int(num)%2019

ans = 0
# print(Counter(a))
for key, val in Counter(s).items():
    if key == 0:
        ans += val
    if val >= 2:
        ans += val*(val-1)//2
print(ans)

Fixed submission:
S = input()
N = len(S)

num = [0] * 2019
num[0] = 1
now, ans = 0, 0
_10 = 1
for i in range(N-1, -1, -1):
    now = (now + int(S[i]) * _10) % 2019
    _10 *= 10
    _10 %= 2019
    ans += num[now]
    num[now] += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

S = input()
N = len(S)

s = [0 for _ in range(N)]

num = ""
for i in range(N-1, -1, -1):
    num = S[i] + num
    s[i] += int(num)%2019

ans = 0
# print(Counter(a))
for key, val in Counter(s).items():
    if key == 0:
        ans += val
    if val >= 2:
        ans += combinations_count(val, 2)

print(ans)

Fixed submission:
S = input()
N = len(S)

num = [0] * 2019
num[0] = 1
now, ans = 0, 0
_10 = 1
for i in range(N-1, -1, -1):
    now = (now + int(S[i]) * _10) % 2019
    _10 *= 10
    _10 %= 2019
    ans += num[now]
    num[now] += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# K, N = map(int, input().split())
# a = list(map(int, input().split()))

# N = int(input())

def gcd(a, b):
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    return gcd(r, b)

K = int(input())

ans = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        n = gcd(a, b)
        for c in range(1, K+1):
            ans += gcd(n, c)

print(ans)

Fixed submission:
# K, N = map(int, input().split())
# a = list(map(int, input().split()))

# N = int(input())

def gcd(a, b):
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    return gcd(r, b)

K = int(input())

ans = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        n = gcd(a, b)
        for c in range(1, K+1):
            ans += gcd(n, c)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

def gcd(a, b):
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    return gcd(r, b)

K = int(input())

ans = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            ans += gcd(gcd(a, b), c)

print(ans)

Fixed submission:
# K, N = map(int, input().split())
# a = list(map(int, input().split()))

# N = int(input())

def gcd(a, b):
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    return gcd(r, b)

K = int(input())

ans = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        n = gcd(a, b)
        for c in range(1, K+1):
            ans += gcd(n, c)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

def f(a, b, c):
    if abs(a-b) == abs(a-c) or abs(a-b) == abs(b-c) or abs(b-c) == abs(a-c):
        return 0
    else:
        return 1

cnt = 0
R, B, G = [], [], []
for i in range(N):
    if S[i] == "R":
        R.append(i)
    elif S[i] == "B":
        B.append(i)
    else:
        G.append(i)

for r in R:
    for b in B:
        for g in G:
            if f(r, b, g):
                cnt += 1
# print(R, G, B)
print(cnt)


Fixed submission:
N = int(input())
S = input()

ans = S.count("R")*S.count("B")*S.count("G")
for i in range(N):
    for d in range(N):
        j = i+d
        k = j+d
        if k < N:
            if S[i] != S[j] and S[k] != S[j] and S[k] != S[i]:
                ans -= 1
print(ans)

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

cnt = 0
R, B, G = [], [], []
for i in range(N):
    if S[i] == "R":
        R.append(i)
    elif S[i] == "B":
        B.append(i)
    else:
        G.append(i)

for r in R:
    for b in B:
        for g in G:
            l = sorted([r, b, g])
            if l[2]-l[1] != l[1]-l[0]:
                cnt += 1
# print(R, G, B)
print(cnt)


Fixed submission:
N = int(input())
S = input()

ans = S.count("R")*S.count("B")*S.count("G")
for i in range(N):
    for d in range(N):
        j = i+d
        k = j+d
        if k < N:
            if S[i] != S[j] and S[k] != S[j] and S[k] != S[i]:
                ans -= 1
print(ans)

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

cnt = 0
l = ["R", "G", "B"]
for i in range(len(S)-2):
    for j in range(i, len(S)):
        if S[i] != S[j]:
            for k in range(j, len(S)):
                s = [S[i], S[j], S[k]]
                if set(s) == set(l):
                    if j-i != k-j:
                        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
S = input()

ans = S.count("R")*S.count("B")*S.count("G")
for i in range(N):
    for d in range(N):
        j = i+d
        k = j+d
        if k < N:
            if S[i] != S[j] and S[k] != S[j] and S[k] != S[i]:
                ans -= 1
print(ans)

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

cnt = 0
l = ["R", "G", "B"]
for i in range(len(S)-2):
    for j in range(i, len(S)):
        for k in range(j, len(S)):
            s = [S[i], S[j], S[k]]
            if set(s) == set(l):
                if j-i != k-j:
                    cnt += 1
print(cnt)

Fixed submission:
N = int(input())
S = input()

ans = S.count("R")*S.count("B")*S.count("G")
for i in range(N):
    for d in range(N):
        j = i+d
        k = j+d
        if k < N:
            if S[i] != S[j] and S[k] != S[j] and S[k] != S[i]:
                ans -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, X, Y = map(int, input().split())

l = [0 for _ in range(N)]
line = []

for i in range(1, N+1):
    for j in range(1, N+1):
        if i < j:
            l[min(abs(i-j), abs(X-i)+1+abs(Y-j), abs(X-j)+1+abs(Y-i))] += 1

for k in range(1, N):
    print(l[k])


Fixed submission:
N, X, Y = map(int, input().split())

l = [0 for _ in range(N)]
line = []

for i in range(1, N+1):
    for j in range(1, N+1):
        if i < j:
            l[min(abs(i-j), abs(X-i)+1+abs(Y-j), abs(X-j)+1+abs(Y-i))] += 1

for k in range(1, N):
    print(l[k])
Buggy python submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())), reverse=True)

ans = sorted(P[:X] + Q[:Y])

for i in range(C):
    if R[i] > ans[i]:
        ans[i] = R[i]

print(sum(ans))

Fixed submission:
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())), reverse=True)

ans = sorted(P[:X] + Q[:Y])

for i in range(min(C, X+Y)):
    if R[i] > ans[i]:
        ans[i] = R[i]

print(sum(ans))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
a = list(map(int, input().split()))

a_cnt = Counter(a)

a_comb = {}
for key, val in a_cnt.items():
    if val >= 2:
        a_comb[key] = combinations_count(val, 2)
    else:
        a_comb[key] = 0


for num in a:
    dic = a_comb.copy()
    if dic[num] <= 1:
        dic[num] = 0
    else: 
        dic[num] = combinations_count(a_cnt[num]-1, 2)
    print(int(sum(dic.values())))

Fixed submission:
from collections import Counter
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
a = list(map(int, input().split()))

a_cnt = Counter(a)

a_comb = {}
for key, val in a_cnt.items():
    if val >= 2:
        a_comb[key] = combinations_count(val, 2)
    else:
        a_comb[key] = 0

sum_v = sum(a_comb.values())

for num in a:
    print(sum_v-a_cnt[num]+1)
Buggy python submission (verdict: Runtime Error):
import sympy

a, b, c = map(int, input().split())
if  sympy.sqrt(a)+sympy.sqrt(b) < sympy.sqrt(c):
    print("Yes")
else:
    print("No"


# a, b, c = map(int, input().split())


Fixed submission:
a, b, c = map(int, input().split())

if 4*a*b < (c-a-b)**2 and (c-a-b) > 0:
    print("Yes")
else:
    print("No")

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

a, b, c = map(int, input().split())
if  sympy.sqrt(a)+sympy.sqrt(b) < sympy.sqrt(c):
    print("Yes")
else:
    print("No")

Fixed submission:
a, b, c = map(int, input().split())

if 4*a*b < (c-a-b)**2 and (c-a-b) > 0:
    print("Yes")
else:
    print("No")

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

a, b, c = map(int, input().split())
if  sympy.sqrt(a)+sympy.sqrt(b) < sympy.sqrt(c):
    print("Yes")
else:
    print("No")

Fixed submission:
a, b, c = map(int, input().split())

if 4*a*b < (c-a-b)**2 and (c-a-b) > 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))

a = [list(map(int, input().split())) for _ in range(m)]

ans = [0 for _ in range(n)]
check = [False for _ in range(n)]

flag = 0

for i, j in a:
    if check[i-1] == 0 or ans[i-1] == j:
        ans[i-1] = j
        check[i-1] = True
    else:
        flag = 1
       
if check[0] == False ans m != 0:
    ans[0] = 1

c = ""
for k in ans:
    c+=str(k)

if flag == 1 or len(str(int(c))) != n:
    print(-1)
else:
    print(c)

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

a = [list(map(int, input().split())) for _ in range(m)]

ans = [0 for _ in range(n)]
check = [False for _ in range(n)]

flag = 0

for i, j in a:
    if check[i-1] == 0 or ans[i-1] == j:
        ans[i-1] = j
        check[i-1] = True
    else:
        flag = 1
       
if check[0] == False and ans[0] == 0 and m != 0:
    ans[0] = 1
elif m == 0 and n != 1:
    ans[3-n] = 1

c = ""
for k in ans:
    c += str(k)

if flag == 1 or len(str(int(c))) != n:
    print(-1)
else:
    print(c)
Buggy python submission (verdict: Time Limit Exceeded):
H, N = map(int, input().split())
magic = [list(map(int, input().split())) for _ in range(N)]

dp = [10**9 for _ in range(H+10**4+1)]
dp[0] = 0

for a, b in magic:
    for j in range(H+1):
        if dp[j+a] > dp[j] + b:
            dp[j+a] = dp[j] + b

print(min(dp[H:]))

Fixed submission:


H, N = map(int, input().split())
magic = [list(map(int, input().split())) for _ in range(N)]

dp = [10**9 for _ in range(H+10**4+1)]
dp[0] = 0

for a, b in magic:
    for j in range(H+1):
        if dp[j+a] > dp[j] + b:
            dp[j+a] = dp[j] + b

print(min(dp[H:]))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7

ans = 0

for i in range(60):
    cnt = 0
    for a in A:
        cnt += a>>i&1
    ans += cnt*(N-cnt)*2**i
    ans %= mod
    # print(ans)
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7

ans = 0

for i in range(60):
    cnt = 0
    for a in A:
        cnt += a>>i&1
    ans += cnt*(N-cnt)*2**i
    ans %= mod
    # print(ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
X = int(input())
num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X+1)]
dp[0] = 1
f = 1

for i in range(X+1):
    for j in num:
        if i-j >= 0:
            if dp[i-j]:
                dp[i] = 1

for i in num:
    if not dp[X-i]:
        f = 0

print(f)

Fixed submission:
X = int(input())
num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X+1)]
dp[0] = 1
f = 1

for i in range(X+1):
    for j in num:
        if i-j >= 0:
            if dp[i-j]:
                dp[i] = 1

print(dp[X])

Buggy python submission (verdict: Runtime Error):
X = int(input())
'''
numの順番によっては買うことが出来ない金額が発生するためNG
num = [105, 104, 103, 102, 101, 100]

f = 0
for i in range(2**6):
    XX = X
    for j in range(6):
        if (i>>j)&1:
            XX %= num[j]
            if XX == 0:
                f = 1
print(f)
'''

num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X)]
dp[0] = 1
f = 1

for i in range(X):
    for j in num:
        if i-j >= 0:
            if dp[i-j]:
                dp[i] = 1

for i in num:
    if not dp[X-i]:
        f = 0

print(f)

Fixed submission:
X = int(input())
num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X+1)]
dp[0] = 1
f = 1

for i in range(X+1):
    for j in num:
        if i-j >= 0:
            if dp[i-j]:
                dp[i] = 1

print(dp[X])

Buggy python submission (verdict: Runtime Error):
X = int(input())
'''
numの順番によっては買うことが出来ない金額が発生するためNG
num = [105, 104, 103, 102, 101, 100]

f = 0
for i in range(2**6):
    XX = X
    for j in range(6):
        if (i>>j)&1:
            XX %= num[j]
            if XX == 0:
                f = 1
print(f)
'''

num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X)]
dp[0] = 1
f = 1

for i in range(X):
    for j in num:
        if i-j >= 0
            if dp[i-j]:
                dp[i] = 1

for i in num:
    if not dp[X-i]:
        f = 0

print(f)

Fixed submission:
X = int(input())
num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X+1)]
dp[0] = 1
f = 1

for i in range(X+1):
    for j in num:
        if i-j >= 0:
            if dp[i-j]:
                dp[i] = 1

print(dp[X])

Buggy python submission (verdict: Runtime Error):
X = int(input())
'''
numの順番によっては買うことが出来ない金額が発生するためNG
num = [105, 104, 103, 102, 101, 100]

f = 0
for i in range(2**6):
    XX = X
    for j in range(6):
        if (i>>j)&1:
            XX %= num[j]
            if XX == 0:
                f = 1
print(f)
'''

num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X)]
dp[0] = 1
f = 1

for i in range(X):
    for j in num:
        if i-j >= 0 and dp[i-j]:
            dp[i] = 1

for i in num:
    if not dp[X-i]:
        f = 0

print(f)

Fixed submission:
X = int(input())
num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X+1)]
dp[0] = 1
f = 1

for i in range(X+1):
    for j in num:
        if i-j >= 0:
            if dp[i-j]:
                dp[i] = 1

print(dp[X])
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(max(0, A-B*2)

Fixed submission:
A, B = map(int, input().split())
print(max(0, A-B*2))
Buggy python submission (verdict: Runtime Error):
S = list(input())
K = int(input())
ans = 0

if len(S) == 1:
    ans = K//2
elif len(set(s)) == 1:
    ans = int(len(S)*K/2)
else:
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            ans += 1
            S[i+1] = "#"

    ans *= K

    if S[0] == S[-1]:
        ans += K-1
    # print(S)
print(ans)

Fixed submission:
S = list(input())
K = int(input())

S1 = list(S)
cnt1 = 0
for i in range(1, len(S1)):
    if S1[i] == S1[i - 1]:
        S1[i] = '*'
        cnt1 += 1

S2 = list(S) * 2
cnt2 = 0
for i in range(1, len(S2)):
    if S2[i] == S2[i - 1]:
        S2[i] = '*'
        cnt2 += 1
        
S3 = list(S) * 3
cnt3 = 0
for i in range(1, len(S3)):
    if S3[i] == S3[i - 1]:
        S3[i] = '*'
        cnt3 += 1

# print("#", S1, S2, S3)
# print("#", cnt1, cnt2, cnt3)
ans = cnt1 + (cnt2 - cnt1) * (K // 2) + (cnt3 - cnt2) * ((K - 1) // 2)
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd

N, M = map(int, input().split())

n = gcd(N, M)
# print(n)

if n == 1:
    print(1)
else:
    ans = 1

    
    for i in range(2, int(gcd(N, M)**0.5)+1):
        flag = 0
        # print("i", i)
        # print("n", n)
        if n%i == 0:
            while n%i == 0:
                n //= i
                # print(n)
            flag = 1
        # print("n", n)
        ans += flag

    print(ans if n == 1 else ans+1)

Fixed submission:
from fractions import gcd

N, M = map(int, input().split())

n = gcd(N, M)
# print(n)

if n == 1:
    print(1)
else:
    ans = 1

    
    for i in range(2, int(gcd(N, M)**0.5)+1):
        flag = 0
        # print("i", i)
        # print("n", n)
        if n%i == 0:
            while n%i == 0:
                n //= i
                # print(n)
            flag = 1
        # print("n", n)
        ans += flag

    print(ans if n == 1 else ans+1)

Buggy python submission (verdict: Runtime Error):
from collections import gcd

N, M = map(int, input().split())

n = gcd(N, M)
# print(n)
ans = 1

for i in range(2, int(n**(1/2))+2):
    flag = 0
    # print("i", i)
    while True:
        if n%i == 0:
            n //= i
            # print(n)
            flag = 1
        else:
            break
    ans += flag

print(ans)

Fixed submission:
from fractions import gcd

N, M = map(int, input().split())

n = gcd(N, M)
# print(n)

if n == 1:
    print(1)
else:
    ans = 1

    
    for i in range(2, int(gcd(N, M)**0.5)+1):
        flag = 0
        # print("i", i)
        # print("n", n)
        if n%i == 0:
            while n%i == 0:
                n //= i
                # print(n)
            flag = 1
        # print("n", n)
        ans += flag

    print(ans if n == 1 else ans+1)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
S = input()

#グループの
cnt = 1

for i in range(N-1):
    if S[i] != S[i+1]:
        cnt += 1


print(N - max(1, cnt - 2*k))


Fixed submission:
N, K = map(int,input().split())
S = input()

#グループの個数
cnt = 1

for i in range(N-1):
    if S[i] != S[i+1]:
        cnt += 1

print(N - max(1, cnt - 2*K))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [sorted(input()) for i in range(n)]

ans = 0
for i in range(n):
    for j in range(n):
        if i!=j:
            if a[i] == a[j]:
                ans +=1
print(ans//2)

Fixed submission:
import itertools
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input())
a = [sorted(input()) for i in range(n)]
l = []
for i in a:
    l.append("".join(i))

ans = 0
dic = {}

for i in range(n):
    if l[i] in dic:
        dic[l[i]] +=1
    else:
        dic[l[i]] =1

for i in dic.values():
    if i>=2:
        ans += combinations_count(i, 2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def work(l):
    l.sort(key=lambda x:x[1],reverse=True)
    salary = l.pop(0)
    return salary[1]

n,m = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]

queue = []
ans = 0
i = 0
while i < m:
    i += 1
    for j in range(len(a)):
        if a[j][0] == i:
            queue.append(a[j])
    if len(queue)>0:
        ans += work(queue)
print(ans)

Fixed submission:
import heapq

N, M = list(map(int, input().split()))
jobs = [[] for _ in range(M)]

for i in range(N):
    d, r = list(map(int, input().split()))
    if d-1 < M:
        jobs[d-1].append(-r)

#解法
rewards = 0
heap = []
for i in range(M):
    for reward in jobs[i]:
        heapq.heappush(heap, reward)
    if len(heap) >0:
        reword = heapq.heappop(heap)
        rewards += -reword

print(rewards)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, p = map(int, input().split())
edge = []

for _ in range(m):
    a, b, c = map(int, input().split())
    edge.append([a-1, b-1, -c])

d = [float("inf") for _ in range(n)]
d[0] = 0

check = [0 for _ in range(n)]

for i in range(n):
    for now, next, weight in edge:
        if d[next] > min(d[now] + weight + p, d[next]):
            d[next] = min(d[now] + weight + p, d[next])
            # n+1回目で更新された場合はループしているのでチェックを入れる
            if i == n-1:
                check[next] = 1
        if i == n-1:
            if check[now]:
                check[next] = 1
        # print(d)

# print(check)
if check[-1]:
    print("-1")
else:
    print(max(-d[-1], 0))

Fixed submission:
n, m, p = map(int, input().split())
edge = []

for _ in range(m):
    a, b, c = map(int, input().split())
    edge.append([a-1, b-1, -c])

d = [float("inf") for _ in range(n)]
d[0] = 0

# check = [0 for _ in range(n)]

for i in range(n*2):
    for now, next, weight in edge:
        if d[next] > d[now] + weight + p:
            d[next] = d[now] + weight + p
            # n+1回目で更新された場合はループしているのでチェックを入れる
            if i > n-1:
                d[next] = -float("inf")
                # check[next] = 1
        if i == n-1:
            prev = d[-1]
            # if check[now]:
            #     check[next] = 1
        # print(d)

# print(check)
# if check[-1]:
if prev != d[-1]:
    print("-1")
else:
    print(max(-prev, 0))
    # print(prev)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ans = [0 for i in range(len(s))]
RL_ind = []

for i in range(len(s)-2):
    if s[i:i+2] == "RL":
        RL_ind.append(i)
if s[-2:] == "RL":
    RL_ind.append(len(s)-2)

for i in range(len(s)):
    if s[i] == "R":
        ans_R = [j for j in RL_ind if j >= i]
        if (min(ans_R)-i)%2 == 0:
            ans[min(ans_R)] += 1
        else:
            ans[min(ans_R)+1] += 1
    else:
        ans_L = [j for j in RL_ind if j < i]
        if (max(ans_L)-i)%2 == 0:
            ans[max(ans_L)] += 1
        else:
            ans[max(ans_L)+1] += 1

print(*ans)

Fixed submission:
S = list(input())

ans = [0 for _ in range(len(S))]

s_flag = 0
cnt = 0
for i, s in enumerate(S):
    if s == "R":
        s_flag = 1
        cnt += 1
    else:
        if s_flag and s == "L":
            ans[i] += cnt//2 
            ans[i-1] += cnt//2 + cnt%2
            cnt = 0
            s_flag = 0
# print(ans)

S.reverse()
ans.reverse()
# print(S)
# print(ans)

l_flag = 0
cnt = 0
for i, s in enumerate(S):
    if s == "L":
        l_flag = 1
        cnt += 1
    else:
        if l_flag and s == "R":
            ans[i] += cnt//2 
            ans[i-1] += cnt//2 + cnt%2
            cnt = 0
            l_flag = 0
    # print(ans)
ans.reverse()
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ans = [0 for i in range(len(s))]
RL_ind = []

for i in range(len(s)-2):
    if s[i:i+2] == "RL":
        RL_ind.append(i)
if s[-2:] == "RL":
    RL_ind.append(len(s)-2)

for i in range(len(s)):
    if s[i] == "R":
        ans_R = [j for j in RL_ind if j >= i]
        if (min(ans_R)-i)%2 == 0:
            ans[min(ans_R)] += 1
        else:
            ans[min(ans_R)+1] += 1
    else:
        ans_L = [j for j in RL_ind if j < i]
        if (max(ans_L)-i)%2 == 0:
            ans[max(ans_L)] += 1
        else:
            ans[max(ans_L)+1] += 1

print(*ans)

Fixed submission:
S = list(input())

ans = [0 for _ in range(len(S))]

s_flag = 0
cnt = 0
for i, s in enumerate(S):
    if s == "R":
        s_flag = 1
        cnt += 1
    else:
        if s_flag and s == "L":
            ans[i] += cnt//2 
            ans[i-1] += cnt//2 + cnt%2
            cnt = 0
            s_flag = 0
# print(ans)

S.reverse()
ans.reverse()
# print(S)
# print(ans)

l_flag = 0
cnt = 0
for i, s in enumerate(S):
    if s == "L":
        l_flag = 1
        cnt += 1
    else:
        if l_flag and s == "R":
            ans[i] += cnt//2 
            ans[i-1] += cnt//2 + cnt%2
            cnt = 0
            l_flag = 0
    # print(ans)
ans.reverse()
print(*ans)