Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import itertools

N, M, Q = list(map(int,input().split()))
numbers = [i for i in range(1, M+1)]
array = itertools.combinations_wih_replacement(numbers, N)

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

max_score = 0
for A in array:
    score = 0
    for _ in range(Q):
        a, b, c, d = input_data[_]
        a = a - 1
        b = b - 1
        if A[b] - A[a] == c:
            score += d
    if score > max_score:
        max_score = score
    
print(max_score)

Fixed submission:
import itertools

N, M, Q = list(map(int,input().split()))
numbers = [i for i in range(1, M+1)]
array = itertools.combinations_with_replacement(numbers, N)

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

max_score = 0
for A in array:
    score = 0
    for _ in range(Q):
        a, b, c, d = input_data[_]
        a = a - 1
        b = b - 1
        if A[b] - A[a] == c:
            score += d
    if score > max_score:
        max_score = score
    
print(max_score)

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

N, M, Q = list(map(int,input().split()))
numbers = [i for i in range(M)]
array = itertools.combinations(numbers, N)

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

scores = []
for combi in array:
    score = 0
    for _ in range(Q):
        a, b, c, d = combinations[_]
        a = a - 1
        b = b - 1
        if combi[b] - combi[a] == c:
            score += d
    scores.append(score)
    
print(max(scores))

Fixed submission:
import itertools

N, M, Q = list(map(int,input().split()))
numbers = [i for i in range(1, M+1)]
array = itertools.combinations_with_replacement(numbers, N)

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

max_score = 0
for A in array:
    score = 0
    for _ in range(Q):
        a, b, c, d = input_data[_]
        a = a - 1
        b = b - 1
        if A[b] - A[a] == c:
            score += d
    if score > max_score:
        max_score = score
    
print(max_score)
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(p, q):
    while q != 0:
        r = p % q
        p = q
        q = r
    return p

output = 0
K = int(input())
for i in range(1, K+1):
    for j in range(1, K+1):
        r = gcd(i, j)
        for k in range(1, K+1):
            output += gcd(r,k)
print(output)

Fixed submission:
import math
output = 0
K = int(input())
for i in range(1, K+1):
    for j in range(1, K+1):
        r = math.gcd(i, j)
        for k in range(1, K+1):
            output += math.gcd(r,k)
            
print(output)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(p, q):
    while q != 0:
        r = p % q
        p = q
        q = r
    return p

output = 0
K = int(input())
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            r = gcd(i, j)
            output += gcd(r,k)
print(output)


Fixed submission:
import math
output = 0
K = int(input())
for i in range(1, K+1):
    for j in range(1, K+1):
        r = math.gcd(i, j)
        for k in range(1, K+1):
            output += math.gcd(r,k)
            
print(output)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import math
from functools import reduce

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

k = int(input())

a = [i for i in range(1, k+1)]
b = [i for i in range(1, k+1)]
c = [i for i in range(1, k+1)]

product = list(itertools.product(a, b, c))

output = 0
for p in product:
    output += gcd_list(p)
    
print(output)


Fixed submission:
import math
output = 0
K = int(input())
for i in range(1, K+1):
    for j in range(1, K+1):
        r = math.gcd(i, j)
        for k in range(1, K+1):
            output += math.gcd(r,k)
            
print(output)
Buggy python submission (verdict: Time Limit Exceeded):
def replaceInt(N, M):
    N = abs(N-M)
    return N
    
N, M = [int(i) for i in input().split()]

if N == M :
    output = 0
elif N < M :
    if N <= M / 2:
        output = N
    else:
        output = abs(M-N)
else :
    if M == 1:
        output = 0
    else :
        output_candidates = [N]
        while True:
            N = replaceInt(N,M)
            if N in output_candidates:
                break
            output_candidates.append(N)
        output = min(output_candidates)
        
print(output)


Fixed submission:
def replaceInt(N, M):
    N = abs(N-M)
    return N
    
N, M = [int(i) for i in input().split()]

if N == M :
    output = 0
elif N < M :
    if N <= M / 2:
        output = N
    else:
        output = abs(M-N)
else :
    if M == 1:
        output = 0
    else :
        N = N % M
        output_candidates = []
        while True:
            N = replaceInt(N,M)
            if N in output_candidates:
                break
            output_candidates.append(N)
        output = min(output_candidates)
        
print(output)

Buggy python submission (verdict: Time Limit Exceeded):
def replaceInt(N, M):
    N = abs(N-M)
    return N
    
N, M = [int(i) for i in input().split()]

if N == M :
    output = 0
elif N < M :
    if N <= M / 2:
        output = N
    else:
        output = abs(M-N)
else :
    if M == 1:
        output = 0
    else :
        output_candidates = [N]
        while True:
            N = replaceInt(N,M)
            if N in output_candidates or N > output_candidates[-1]:
                break
            output_candidates.append(N)
        output = min(output_candidates)
        
print(output)


Fixed submission:
def replaceInt(N, M):
    N = abs(N-M)
    return N
    
N, M = [int(i) for i in input().split()]

if N == M :
    output = 0
elif N < M :
    if N <= M / 2:
        output = N
    else:
        output = abs(M-N)
else :
    if M == 1:
        output = 0
    else :
        N = N % M
        output_candidates = []
        while True:
            N = replaceInt(N,M)
            if N in output_candidates:
                break
            output_candidates.append(N)
        output = min(output_candidates)
        
print(output)
Buggy python submission (verdict: Runtime Error):
X, Y, A, B, C = [int(i) for i in input().split()]
reds = sorted([int(i) for i in input().split()], reverse=True)
greens = sorted([int(i) for i in input().split()], reverse=True)
clears = sorted([int(i) for i in input().split()], reverse=True)

clear_acc = [0]

for i in clears:
    clear_acc.append(rr[-1]+i)
        
reds = reds[:X]
greens = greens[:Y]

all_apples = sorted(reds+greens)

apple_sum = [sum(all_apples)]


for i in all_apples:
    apple_sum.append(apple_sum[-1]-i)
    

output = []

for i in range(min(X+Y, C+1)):
    output.append(apple_sum[i] + clear_acc[i])

print(max(output))

Fixed submission:
X, Y, A, B, C = [int(i) for i in input().split()]
reds = sorted([int(i) for i in input().split()], reverse=True)
greens = sorted([int(i) for i in input().split()], reverse=True)
clears = sorted([int(i) for i in input().split()], reverse=True)

clear_acc = [0]

for i in clears:
    clear_acc.append(clear_acc[-1]+i)
        
reds = reds[:X]
greens = greens[:Y]

all_apples = sorted(reds+greens)

apple_sum = [sum(all_apples)]


for i in all_apples:
    apple_sum.append(apple_sum[-1]-i)
    

output = []

for i in range(min(X+Y, C+1)):
    output.append(apple_sum[i] + clear_acc[i])

print(max(output))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from math import factorial

def combination_count(n, r):
    if n == r :
        return 1
    elif n < r:
        return 0
    else :
        return factorial(n) // (factorial(n-r) * factorial(r))

N = int(input())
balls = [int(i) for i in input().split()]

c = Counter(balls)
combi_counter ={}
for k, v in c.items():
    if k in combi_counter.keys():
        pass
    else :
        combi_counter[v] = combination_count(v, 2)

sum_ball_combinations = 0
for k, v in c.items():
    sum_ball_combinations += combi_counter[v]

for k in balls:
    diff = combination_count(c[k], 2) - combination_count(c[k]-1, 2)
    print(sum_ball_combinations-diff)

Fixed submission:
from collections import Counter

N = int(input())
balls = [int(i) for i in input().split()]

c = Counter(balls)

sum_ball_combinations = 0
for i in c.values():
    sum_ball_combinations += i*(i-1)//2

for b in balls:
    k = c[b]
    print(sum_ball_combinations- (k*(k-1)//2)+ (k-1)*(k-2)//2)
Buggy python submission (verdict: Runtime Error):
if W % 2 == 0:
    print((H * W) // 2)
elif H == 1 or W == 1:
    print(1)
else :
    odd_row = (W // 2) + 1
    print('odd_row',odd_row)
    even_row = W // 2
    if H % 2 == 1:
        odd_row_num = (H // 2) + 1
        even_row_num = H // 2
        print((odd_row*odd_row_num) + (even_row*even_row_num))
    else :
        print((odd_row+even_row) * (H // 2))

Fixed submission:
H, W = [int(i) for i in input().split()]

if H == 1 or W == 1:
    print(1)
elif W % 2 == 0:
    print((H * W) // 2)
else :
    odd_row = (W // 2) + 1
    even_row = W // 2
    if H % 2 == 1:
        odd_row_num = (H // 2) + 1
        even_row_num = H // 2
        print((odd_row*odd_row_num) + (even_row*even_row_num))
    else :
        print((odd_row+even_row) * (H // 2))

Buggy python submission (verdict: Runtime Error):
H, W = [int(i) for i in input().split()]

if W % 2 == 0:
    print((H * W) // 2)
else :
    odd_row = (W // 2) + 1 
    even_row = W // 2
    if H % 2 == 1:
        odd_row_num = (H // 2) + 1
        even_row_num = H // 2
        print((odd_row*odd_row_num) + (even_row*even_row_num))
    else :
        print(((odd_row+even_row) * (H // 2))

Fixed submission:
H, W = [int(i) for i in input().split()]

if H == 1 or W == 1:
    print(1)
elif W % 2 == 0:
    print((H * W) // 2)
else :
    odd_row = (W // 2) + 1
    even_row = W // 2
    if H % 2 == 1:
        odd_row_num = (H // 2) + 1
        even_row_num = H // 2
        print((odd_row*odd_row_num) + (even_row*even_row_num))
    else :
        print((odd_row+even_row) * (H // 2))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

S = [l for l in input()]
Q = int(input())
d = deque(S)

for i in range(Q):
    query = input()
    if query[0] == '1':
        d.reverse()
    else :
        t, f, c = query.split()
        if f == '1':
            d.appendleft(c)
        else :
            d.append(c)

print(''.join(d))

Fixed submission:
from collections import deque

S = [l for l in input()]
Q = int(input())
d = deque(S)
direction = 'f'

for i in range(Q):
    query = input()
    if query[0] == '1':
        if direction == 'f':
            direction = 'r'
        else :
            direction = 'f'
    else :
        t, f, c = query.split()
        if f == '1':
            if direction == 'f':
                d.appendleft(c)
            else :
                d.append(c)
        else :
            if direction == 'f':
                d.append(c)
            else :
                d.appendleft(c)

if direction == 'r':
    d.reverse()

print(''.join(d))
Buggy python submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]

guess_dict = {'100':[], '10':[], '1':[]}


flag = True
for i in range(M):
    s, c = [int(i) for i in input().split()]
    if s == 3:
        guess_dict['1'].append(c)
    elif s == 2:
        guess_dict['10'].append(c)
    elif s == 1:
        guess_dict['100'].append(c)
        
for k, v in guess_dict.items():
    if len(set(v)) > 1:
        flag = False
        
if N == 3:
    if len(guess_dict['100']) == 0:
        guess_dict['100'].append(1)
    if len(guess_dict['10']) == 0:
        guess_dict['10'].append(0)
    if len(guess_dict['1']) == 0:
        guess_dict['1'].append(0)
if N == 2:
    if len(guess_dict['100']) == 0 and len(guess_dict['10']) == 0:
        guess_dict['10'].append(0)
        guess_dict['10'].append(1)
    if len(guess_dict['1']) == 0:
        guess_dict['1'].append(0)
if N == 1:
    if len(guess_dict['100']) == 0 and len(guess_dict['10']) == 0:
        guess_dict['10'].append(0)
        guess_dict['10'].append(0)
    if len(guess_dict['1']) == 0:
        guess_dict['1'].append(0)

guess_num = 0
guess_num += guess_dict['100'][0] * 100
guess_num += guess_dict['10'][0] * 10
guess_num += guess_dict['1'][0]


if len(str(guess_num)) != N:
    flag = False

if flag:
    print(guess_num)
else :
    print('-1')

Fixed submission:
N, M = [int(i) for i in input().split()]
conditions = [[int(i) for i in input().split()] for j in range(M)] 
num = -1
for i in range(10**N):
    flag = True
    for j in range(M):
        s = conditions[j][0]
        c = conditions[j][1]
        if len(str(i)) < s:
            flag = False
            break
        else :
            if int(str(i)[s-1]) == c:
                pass
            else:
                flag = False
                break
    if flag:
        if len(str(i)) == N:
            num = i
            break
        else :
            pass

print(num)
Buggy python submission (verdict: Time Limit Exceeded):
def attackCounter(array, cnt):
    if len(array) == sum(array):
        cnt += len(array)
        return cnt
    else :
        cnt += len(array)
        array = [i // 2 for i in array] * 2
        return attackCounter(array, cnt)

H = int(input())
cnt = attackCounter([H], 0)
print(cnt)

Fixed submission:
import math

log = int(math.log2(int(input())))

num = 0
for i in range(log + 1):
    num = num + (2 ** i)

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

numbers = [int(i) for i in input().split()]

cnt = 0
for i, n in enumerate(numbers):
    if min(numbers[:i+1]) == n:
        cnt += 1
    if n == 1:
        break
        
print(cnt)

Fixed submission:
N = int(input())

numbers = [int(i) for i in input().split()]

cnt = 0
min_num = numbers[0]
for i, n in enumerate(numbers):
    if min_num >= n:
        cnt += 1
        min_num = n
    
    if n == 1:
        break
        
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

num = 1
for i in range(N, 0, -2):
    num = num * i
    
number = str(num)

cnt = 0
for i in range(1, len(number)+1):
    if number[-i] == '0':
        cnt += 1
    else :
        break

print(cnt)

Fixed submission:
N = int(input())

# N が奇数の場合は 0 になる
if N % 2 == 1:
    print(0)
else :
    n = N // 10
    cnt = n
    while n >= 5:
        n = n // 5
        cnt += n
    print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())

def recursiveFactorial(n):
    if n < 2:
        return 1
    else :
        return n * recursiveFactorial(n - 2)
    
num = recursiveFactorial(N)

number = str(num)

cnt = 0
for i in range(1, len(number)+1):
    if number[-i] == '0':
        cnt += 1
    else :
        break

print(cnt)

Fixed submission:
N = int(input())

# N が奇数の場合は 0 になる
if N % 2 == 1:
    print(0)
else :
    n = N // 10
    cnt = n
    while n >= 5:
        n = n // 5
        cnt += n
    print(cnt)
Buggy python submission (verdict: Runtime Error):
from itertools import product

N = int(input())
A = [[] for i in range(N)]

for i in range(N):
    ai = int(input())
    for j in range(ai): 
        x, y = map(int, input().split())
        x = x - 1
        A[i].append([x, y])
        
# ここから判定
ans = 0
for pattern in product([0, 1], repeat=N):
    num = pattern.count(1)
    contradictions = False
    for i, testimony in enumerate(A):
        if pattern[i] == 0:
            continue
        for t in testimony:
            x, y = t
            if pattern[x] != Y ^ (1- pattern[i]):
                contradictions  = True
                break
        if contradictions:
            break
    if contradictions:
        continue
    ans = max(ans, num)
print(ans)
    

Fixed submission:
cards = [int(i) for i in input().split()]

if sum(cards) >= 22:
    print('bust')
else :
    print('win')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
numbers = [int(i) for i in input().split()]
numbers = sorted(numbers)
counter = 0

for a in range(len(numbers)-2):
    for b in range(a+1, len(numbers)-1):
        for c in range(b+1, len(numbers)):
            if numbers[c] < numbers[a] + numbers[b]:
                counter += 1

print(counter)

Fixed submission:
import bisect

N = int(input())
numbers = [int(i) for i in input().split()]
numbers = sorted(numbers)
counter = 0

for a in range(N):
    for b in range(a+1, N):
        c = bisect.bisect_left(numbers, numbers[a] + numbers[b])
        if c > b:
            counter += c - b -1
        
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
def triangleChecker(a, b, c):
    if a >= b + c :
        return False
    else:
        if b >= c + a:
            return False
        else :
            if c >= a + b:
                return False
            else :
                return True
            
N = int(input())
numbers = [int(i) for i in input().split()]

counter = 0

for a in range(len(numbers)-2):
    for b in range(a+1, len(numbers)-1):
        for c in range(b+1, len(numbers)):
            if triangleChecker(numbers[a], numbers[b], numbers[c]):
                # print(combi)
                counter += 1

print(counter)

Fixed submission:
import bisect

N = int(input())
numbers = [int(i) for i in input().split()]
numbers = sorted(numbers)
counter = 0

for a in range(N):
    for b in range(a+1, N):
        c = bisect.bisect_left(numbers, numbers[a] + numbers[b])
        if c > b:
            counter += c - b -1
        
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

def triangleChecker(combi):
    a, b, c = combi
    if a >= b + c :
        return False
    else:
        if b >= c + a:
            return False
        else :
            if c >= a + b:
                return False
            else :
                return True

N = int(input())
numbers = [int(i) for i in input().split()]

combinations = list(itertools.combinations(numbers, 3))

counter = 0
for combi in combinations:
    if triangleChecker(combi):
        # print(combi)
        counter += 1
print(counter)

Fixed submission:
import bisect

N = int(input())
numbers = [int(i) for i in input().split()]
numbers = sorted(numbers)
counter = 0

for a in range(N):
    for b in range(a+1, N):
        c = bisect.bisect_left(numbers, numbers[a] + numbers[b])
        if c > b:
            counter += c - b -1
        
print(counter)
Buggy python submission (verdict: Runtime Error):
B = [int(i) for i in input().split()]

# A の初期化
A = [0 for i in range(N)]
for i, v in enumerate(B):
    if i == 0:
        A[i] = B[i]
    else:
        if A[i] >= B[i]:
            A[i] = B[i]
    A[i+1] = B[i]
    
print(sum(A))

Fixed submission:
N = int(input())

B = [int(i) for i in input().split()]

# A の初期化
A = [0 for i in range(N)]

for i in range(len(B)):
    if i == 0:
        A[i] = B[i]
    else:
        if A[i] >= B[i]:
            A[i] = B[i]
            
    A[i+1] = B[i]
    
print(sum(A))
Buggy python submission (verdict: Runtime Error):
N = int(input())

blocks = list(map(int, input().split()))

counters = []

for i in range(N-1):
    counter = 0
    for j in range(i, N-1):
        if blocks[j] >= blocks[j+1]:
            counter += 1
        else :
            break
    counters.append(counter)
        
print(max(counters))

Fixed submission:
N = int(input())

blocks = list(map(int, input().split()))

max_cnt = 0
cnt = 0
i = 1
height = blocks[0]

while i <= N-1:
    if height >= blocks[i]:
        cnt += 1
    else :
        cnt = 0
    if cnt >= max_cnt:
        max_cnt = cnt
    height = blocks[i]
    i += 1

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

numbers = [num for num in range(1, N)]
    
print(sum(numbers))


Fixed submission:

N = int(input())

calc_N =  N-1

if calc_N % 2 == 1:
    O = calc_N // 2
    output = (1+calc_N) * O + O + 1
else :
    O = calc_N // 2
    output = (1+calc_N) * O
    
print(output)

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

modsum = 0
for i in range(N-1):
    modsum += (i + 1) % (i +2)
    
print(modsum)

Fixed submission:

N = int(input())

calc_N =  N-1

if calc_N % 2 == 1:
    O = calc_N // 2
    output = (1+calc_N) * O + O + 1
else :
    O = calc_N // 2
    output = (1+calc_N) * O
    
print(output)

Buggy python submission (verdict: Runtime Error):
modsum = 0
for i in range(N-1):
    # print(i + 1)
    # print(divisor)
    modsum += (i + 1) % (i +2)
    
print(modsum)

Fixed submission:

N = int(input())

calc_N =  N-1

if calc_N % 2 == 1:
    O = calc_N // 2
    output = (1+calc_N) * O + O + 1
else :
    O = calc_N // 2
    output = (1+calc_N) * O
    
print(output)

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

divisor = 2
modsum = 0
for i in range(N-1):
    # print(i + 1)
    # print(divisor)
    modsum += (i + 1) % divisor
    divisor += 1
    
print(modsum)

Fixed submission:

N = int(input())

calc_N =  N-1

if calc_N % 2 == 1:
    O = calc_N // 2
    output = (1+calc_N) * O + O + 1
else :
    O = calc_N // 2
    output = (1+calc_N) * O
    
print(output)
Buggy python submission (verdict: Runtime Error):
S = input()

counter = []
cnt_dict = {'R':0, 'L':0}
for i in range(len(S)):
    l = S[i]
    if l == 'R':
        if cnt_dict['L'] == 0:
            cnt_dict[l] += 1
        else :
            counter.append(cnt_dict)
            cnt_dict = {'R':0, 'L':0}
            cnt_dict[l] += 1
    else :
        cnt_dict[l] += 1
counter.append(cnt_dict)
        
output = []
for c in counter:
    block_R = [0 for _ in range(c['R'])]
    block_L = [0 for _ in range(c['L'])]
    q, r = divmod((c['R'] + c['L']), 2)
    if r == 0:
        block_R[-1] = q
        block_L[0] = q
    else :
        if c['R'] % 2 == 0:
            block_R[-1] = q
            blcok_L[0] = q + r
        else :
            block_R[-1] = q + r
            block_L[0] = q
    
    
    output += block_R
    output += block_L
    
print(' '.join(map(str,output)))


Fixed submission:
S = input()

counter = []
cnt_dict = {'R':0, 'L':0}
for i in range(len(S)):
    l = S[i]
    if l == 'R':
        if cnt_dict['L'] == 0:
            cnt_dict[l] += 1
        else :
            counter.append(cnt_dict)
            cnt_dict = {'R':0, 'L':0}
            cnt_dict[l] += 1
    else :
        cnt_dict[l] += 1
counter.append(cnt_dict)
        
output = []
for c in counter:
    block_R = [0 for _ in range(c['R'])]
    block_L = [0 for _ in range(c['L'])]
    q, r = divmod((c['R'] + c['L']), 2)
    if r == 0:
        block_R[-1] = q
        block_L[0] = q
    else :
        if c['R'] % 2 == 0:
            block_R[-1] = q
            block_L[0] = q + r
        else :
            block_R[-1] = q + r
            block_L[0] = q
    
    
    output += block_R
    output += block_L
    
print(' '.join(map(str,output)))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
pattern = [1 for i in range(len(S))]

log_patterns = []
for i in range(10**100):
    new_pattern = [0 for k in range(len(S))]
    for j, v in enumerate(pattern):
        if S[j] == 'R':
            new_pattern[j+1] += v
        else :
            new_pattern[j-1] += v
    pattern = new_pattern
    if pattern in log_patterns:
        log_patterns.append(pattern)
        break
    log_patterns.append(pattern)
    
if i % 2 == 0:
    print(' '.join(map(str, log_patterns[i-1])))
else :
    print(' '.join(map(str, log_patterns[i])))

Fixed submission:
S = input()

counter = []
cnt_dict = {'R':0, 'L':0}
for i in range(len(S)):
    l = S[i]
    if l == 'R':
        if cnt_dict['L'] == 0:
            cnt_dict[l] += 1
        else :
            counter.append(cnt_dict)
            cnt_dict = {'R':0, 'L':0}
            cnt_dict[l] += 1
    else :
        cnt_dict[l] += 1
counter.append(cnt_dict)
        
output = []
for c in counter:
    block_R = [0 for _ in range(c['R'])]
    block_L = [0 for _ in range(c['L'])]
    q, r = divmod((c['R'] + c['L']), 2)
    if r == 0:
        block_R[-1] = q
        block_L[0] = q
    else :
        if c['R'] % 2 == 0:
            block_R[-1] = q
            block_L[0] = q + r
        else :
            block_R[-1] = q + r
            block_L[0] = q
    
    
    output += block_R
    output += block_L
    
print(' '.join(map(str,output)))