Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#辞書順で小さい文字から考えていく。まずｓ内を構成する文字で辞書順で小さいものを列挙。
#辞書順降順でその文字から始まる部分文字列を全列挙。その数がｋに達したら打ち切り。
s = input()
k = int(input())
substr = set()
for i in range(len(s)):
    substr.add(s[i])
check = sorted(list(substr))
x = 0
while True:
    for i in range(len(s)):
        if s[i] == check[x] and i < len(s) - 1:
            for j in range(i+1,len(s)+1):
                substr.add(s[i:j])
    if len(substr) >= k:
        break
    x += 1
lis_substr = sorted(list(substr))
print(lis_substr[k-1])

Fixed submission:
s = input()
k = int(input())
x = 0
substr = set()
while x < k:
    x += 1
    for i in range(len(s) - x + 1):
        if s[i:i+x] not in substr:
            substr.add(s[i:i+x])
substr = list(substr)
substr.sort()
print(substr[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
#辞書順で小さい文字から考えていく。まずｓ内を構成する文字で辞書順で小さいものを列挙。
#辞書順降順でその文字から始まる部分文字列を全列挙。その数がｋに達したら打ち切り。
s = input()
k = int(input())
substr = set()
for i in range(len(s)):
    substr.add(s[i])
check = sorted(list(substr))
x = 0
while True:
    for i in range(len(s)):
        if s[i] == check[x] and i < len(s) - 1:
            for j in range(i+1,len(s)+1):
                substr.add(s[i:j])
    if len(substr) >= k:
        break
    x += 1
lis_substr = sorted(list(substr))
print(lis_substr[k-1])

Fixed submission:
s = input()
k = int(input())
x = 0
substr = set()
while x < k:
    x += 1
    for i in range(len(s) - x + 1):
        if s[i:i+x] not in substr:
            substr.add(s[i:i+x])
substr = list(substr)
substr.sort()
print(substr[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
x = 0
substr = set()
while x < len(s):
    x += 1
    for i in range(len(s) - x + 1):
        if s[i:i+x] not in substr:
            substr.add(s[i:i+x])
substr = list(substr)
substr.sort()
print(substr[k-1])

Fixed submission:
s = input()
k = int(input())
x = 0
substr = set()
while x < k:
    x += 1
    for i in range(len(s) - x + 1):
        if s[i:i+x] not in substr:
            substr.add(s[i:i+x])
substr = list(substr)
substr.sort()
print(substr[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
for i in range(a,b+1):
    if i < a + k or i > b - k:
        print(i)

Fixed submission:
a, b, k = map(int, input().split())
ans = set()
for i in range(a,a+k):
    if i <= b:
        ans.add(i)
for i in range(b-k+1,b+1):
    if i >= a:
        ans.add(i)
ans = list(ans)
ans.sort()
for i in range(len(ans)):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(map(int, input().split()))
ans = "Three"
for i in range(n):
    if s[i] == "Y":
        ans = "Four"
        break
print(ans)

Fixed submission:
n = int(input())
s = input()
ans = "Three"
for i in range(n):
    if s[i] == "Y":
        ans = "Four"
        break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
t = 0
c = [0] * (n-1)
s = [0] * (n-1)
f = [0] * (n-1)
for i in range(n-1):
    c[i], s[i], f[i] = map(int, input().split())

for i in range(n-1):
    t = 0
    for j in range(i,n-1):
        start = s[j] #the time you should leave station_i
        while True:
            if t <= start:
                break
            else:
                start += f[j]
        #print(start)
        t = start + c[j] #the time you reach station_i+1
        #print(t)
    print(t)
print(0)

Fixed submission:
n = int(input())
t = 0
c = [0] * (n-1)
s = [0] * (n-1)
f = [0] * (n-1)
for i in range(n-1):
    c[i], s[i], f[i] = map(int, input().split())

for i in range(n-1):
    t = 0
    for j in range(i,n-1):
        if t < s[j]:
            t = s[j]
        elif t % f[j] != 0:
            t = t + f[j] - (t % f[j])
        t += c[j]
            
    print(t)
print(0)
Buggy python submission (verdict: Time Limit Exceeded):
x, y = map(int,input().split())
a = []
a.append(x)
for i in range(x+1,y+1):
    if i % x == 0:
        a.append(i)
        x = i
print(len(a))

Fixed submission:
x, y = map(int,input().split())

a = x
count = 0
while a <= y:
    count += 1
    a = a*2
print(count)
Buggy python submission (verdict: Runtime Error):
a, b, c, d, e, f = map(int, input().split())
max_a = f // (100*a)
max_b = f // (100*b)
max_c = f // c
max_d = f // d
wat = []
sug = []
for i in range(max_a + 1):
    for j in range(max_b + 1):
        w = 100 * a * i + 100 * b * j
        if w <= f and w > 0:
            wat.append(w)
for i in range(max_c + 1):
    for j in range(max_d + 1):
        s = c*i + d*j
        if s < f:
            sug.append(s)
ans = 0
for x in wat:
    for y in sug:
        if x + y <= f and y <= e * x // 100:
            if ans <= 100 * y // (x + y):
                ans =  100 * y // (x + y)
                out = [x+y, y]
print(*out)

Fixed submission:
print(int(input()) ** 2 - int(input()))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
table = {}
for i in range(n):
  if a[i] not in table:
    table[a[i]] = 1
  else:
    table[a[i]] = table[a[i]] + 1
table = sorted(table.items(), key=lambda x: x[1], reverse=True)
x = 0
y = 0
for i in table:
  if table[i] >= 4:
    if x == 0:
      x = i
      y = i
    else:
      y = i
    break
  elif table[i] >= 2:
    if x == 0:
      x = i
    else:
      y = i
      break
print(x*y)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
used = [0] * n
a.sort(reverse=True)
x = 0
y = 0
for i in range(1,n):
    if a[i - 1] == a[i] and used[i-1] == 0 and used[i] == 0:
        if x == 0:
            x = a[i]
            used[i] = 1
            used[i-1] = 1
        elif y == 0:
            y = a[i]
            used[i] = 1
            used[i-1] = 1
            break
print(x*y)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
table = [0] * (10**9 + 1)
for i in range(n):
  table[a[i]] += 1
x = 0
y = 0
for i in range(10**9, 0, -1):
  if table[i] >= 4:
    if x == 0:
      x = i
      y = i
    else:
      y = i
    break
  elif table[i] >= 2:
    if x == 0:
      x = i
    else:
      y = i
      break
print(x*y)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
used = [0] * n
a.sort(reverse=True)
x = 0
y = 0
for i in range(1,n):
    if a[i - 1] == a[i] and used[i-1] == 0 and used[i] == 0:
        if x == 0:
            x = a[i]
            used[i] = 1
            used[i-1] = 1
        elif y == 0:
            y = a[i]
            used[i] = 1
            used[i-1] = 1
            break
print(x*y)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
import numpy as np
g = np.zeros((n+1, n+1))
for _ in range(m):
    a, b = map(int, input().split())
    g[a][b] = 1
    g[b][a] = 1
ans = "IMPOSSIBLE"
for i in range(n+1):
    if g[1][i] == 1:
        if g[i][n] == 1:
            ans = "POSSIBLE"
print(ans)


Fixed submission:
n, m = map(int, input().split())
g = {}
for _ in range(m):
    a, b = map(int, input().split())
    if a not in g:
        g[a] = [b]
    if b not in g:
        g[b] = [a]
    if a in g:
        g[a].append(b)
    if b in g:
        g[b].append(a)
ans = "IMPOSSIBLE"
for i in g[1]:
    if n in g[i]:
        ans = "POSSIBLE"
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
count = 0
i = 0
ans = False
while count < N:
    count += 1
    if a[i] == 2:
        ans = True
        break
    else:
        i = a[i] - 1
if ans == True:
    print(count)
else:
    print("-1")

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
ans = False
used = set()
i = 1
count = 0
while ans == False:
    count += 1
    if a[i-1] == 2:
        ans = True
    elif i-1 in used:
        break
    else:
        used.add(i-1)
        i = a[i-1]
if ans == True:
    print(count)
else:
    print("-1")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
num = []
cnt = [0] * (10**5 + 1)
for _ in range(n):
    a, b = map(int, input().split())
    if a not in num:
        num.append(a)
    cnt[a] += b
num.sort()
ans = 0
for i in num:
    if cnt[i] >= k:
        ans = i
        break
    else:
        k -= cnt[i]
print(ans)

Fixed submission:
n, k = map(int, input().split())
cnt = [0] * (10**5 + 1)
for _ in range(n):
    a, b = map(int, input().split())
    cnt[a] += b
for i in range(10**5 + 1):
    if k <= cnt[i]:
        ans = i
        break
    else:
        k -= cnt[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
lis = []
for _ in range(n):
    a, b = map(int, input().split())
    for _ in range(b):
        lis.append(a)
lis.sort()
print(lis[k-1])
        

Fixed submission:
n, k = map(int, input().split())
cnt = [0] * (10**5 + 1)
for _ in range(n):
    a, b = map(int, input().split())
    cnt[a] += b
for i in range(10**5 + 1):
    if k <= cnt[i]:
        ans = i
        break
    else:
        k -= cnt[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n , m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
#i, j はBの左端
for i in range(n-m+1):
    ans = True
    for j in range(n-m+1):
        for k in range(m):
            if a[i + k][j:j+m] != b[k]:
                ans = False
        if ans == True:
            break
    else:
        continue
    break

if ans == True:
    print("Yes")
else:
    print("No")


Fixed submission:
a, b = map(int, input().split())
if a == 1 and b!= 1:
    print("Alice")
elif b == 1 and a != 1:
    print("Bob")
elif a > b:
    print("Alice")
elif b > a:
    print("Bob")
else:
    print("Draw")
Buggy python submission (verdict: Runtime Error):
n , m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
#i, j はBの左端
for i in range(n-m):
    ans = True
    for j in range(n-m):
        for k in range(m):
            if a[i + k][j:j+m] != b[k]:
                ans = False
        if ans == True:
            break
    else:
        continue
    break

if ans == True:
    print("Yes")
else:
    print("No")


Fixed submission:
n , m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
#i, j はBの左端
for i in range(n-m+1):
    for j in range(n-m+1):
        ans = True
        for k in range(m):
            if a[i + k][j:j+m] != b[k]:
                ans = False
        if ans == True:
            break
    else:
        continue
    break

if ans == True:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
lis = [0 for i in range(m)]
for i in range(m):
    lis[i] = list(map(int,input().split()))
    
seen = []
count = 0
visited = [0 for i in range(m)]
r = 0
def route(x=1):
    for i in range(m):
        if lis[i][0] == x and visited[i] == 0:
            visited[i] = 1
            r += 1
            route(lis[i][1])
            visited[i] = 0
            r -= 1
        elif lis[i][1] == x and visited[i] == 0:
            visited[i] = 1
            r += 1
            route(lis[i][0])
            visited[i] = 0
            r -= 1
        if r == n-1:
            global count
            count += 1
            return
        
            
        
route(1)
print(count)

Fixed submission:
n, m = map(int,input().split())
lis = [0 for i in range(m)]
for i in range(m):
    lis[i] = list(map(int,input().split()))
    
seen = []
count = 0
visited = [0 for i in range(n)]
def route(x=1):
    visited[x-1] = 1
    if [1]*n == visited:
        global count
        count +=1
        return
    for i in range(m):
        if lis[i][0] == x and visited[lis[i][1]-1] == 0:
            route(lis[i][1])
            visited[lis[i][1]-1] = 0
        elif lis[i][1] == x and visited[lis[i][0]-1] == 0:
            route(lis[i][0])
            visited[lis[i][0]-1] = 0
    return
            
        
route(1)
print(count)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
lis = [0 for i in range(m)]
for i in range(m):
    lis[i] = list(map(int,input().split()))
    
seen = []
count = 0
def route(x=1):
    for i in range(m):
        if lis[i][0] == x and visited[i] == 0:
            visited[i] = 1
            route(lis[i][1])
            visited[i] = 0
        elif lis[i][1] == x and visited[i] == 0:
            visited[i] = 1
            route(lis[i][0])
            visited[i] = 0
        r = 0
        for j in visited:
            r += j
        if r == n-1:
            global count
            count += 1
            return
        
            
        
route(1)
print(count)

Fixed submission:
n, m = map(int,input().split())
lis = [0 for i in range(m)]
for i in range(m):
    lis[i] = list(map(int,input().split()))
    
seen = []
count = 0
visited = [0 for i in range(n)]
def route(x=1):
    visited[x-1] = 1
    if [1]*n == visited:
        global count
        count +=1
        return
    for i in range(m):
        if lis[i][0] == x and visited[lis[i][1]-1] == 0:
            route(lis[i][1])
            visited[lis[i][1]-1] = 0
        elif lis[i][1] == x and visited[lis[i][0]-1] == 0:
            route(lis[i][0])
            visited[lis[i][0]-1] = 0
    return
            
        
route(1)
print(count)
Buggy python submission (verdict: Runtime Error):
def solve(N):
    ans = []
    for i in range(1, int(N**0.5)):
        if N % i == 0:
            ans.append(i+N//i-2)
    return min(ans)

N = int(input())
ans = solve(N)
print(ans)

Fixed submission:
def solve(N):
    ans = []
    for i in range(1, int(N**0.5)+1):
        if N % i == 0:
            ans.append(i+N//i-2)
    return min(ans)

N = int(input())
ans = solve(N)
print(ans)

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

ans = N**2
for i in range(1, N):
    if N % i == 0:
        j = N // i
        step = i + j - 2
        if N == i * j and step < ans:
            ans = step
print(ans)

Fixed submission:
def solve(N):
    ans = []
    for i in range(1, int(N**0.5)+1):
        if N % i == 0:
            ans.append(i+N//i-2)
    return min(ans)

N = int(input())
ans = solve(N)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#input
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]

points = [K] * N

for ans in A:
    for i in range(len(points)):
        if ans - 1 == i:
            continue
        points[i] -= 1

for point in points:
    if (point > 0):
        print("Yes")
    else:
        print("No")

Fixed submission:
#input
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]

points = [K-Q] * N

for ans in A:
    points[ans - 1] += 1

for point in points:
    if (point > 0):
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
#input
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]

points = []
for i in range(N):
    points.append(K)

for ans in A:
    for i in range(len(points)):
        if ans - 1 == i:
            continue
        points[i] -= 1

for point in points:
    if (point > 0):
        print("Yes")
    else:
        print("No")

Fixed submission:
#input
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]

points = [K-Q] * N

for ans in A:
    points[ans - 1] += 1

for point in points:
    if (point > 0):
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
#input
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]

points = []
for i in range(N):
    points.append(K)

for ans in A:
    for i in range(len(points)):
        if ans - 1 == i:
            continue
        points[i] -= 1

for point in points:
    if (point > 0):
        print("Yes")
    else:
        print("No")

Fixed submission:
#input
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]

points = [K-Q] * N

for ans in A:
    points[ans - 1] += 1

for point in points:
    if (point > 0):
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
#input
N = int(input())
B = list(map(int, input().split()))

A = [0] * N
for i in range(1, N-1):
    if A[i] > B[i]:
        A[i] = B[i]
    A[i+1] = B[i]

print(sum(A))

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

print(N ** 3)
Buggy python submission (verdict: Time Limit Exceeded):
#input
N = int(input())
S = [''.join(sorted(input())) for i in range(N)]

ana = 0
for i in range(N):
    ana += S.count(S[i])

print(int((ana - N) / 2))

Fixed submission:
import collections

#input
N = int(input())
S = [''.join(sorted(input())) for i in range(N)]

S = collections.Counter(S)

ans = 0
for k, v in S.items():
    ans += v * (v-1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#input
N = int(input())
S = [sorted(input()) for i in range(N)]

ana = 0
for i in range(N):
    ana += S.count(S[i])

print(int((ana - N) / 2))

Fixed submission:
import collections

#input
N = int(input())
S = [''.join(sorted(input())) for i in range(N)]

S = collections.Counter(S)

ans = 0
for k, v in S.items():
    ans += v * (v-1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#input
N = int(input())
S = [sorted(input()) for i in range(N)]

ana = 0
for i in range(N):
    ana += S.count(S[i])

print(int((ana - N) / 2))

Fixed submission:
import collections

#input
N = int(input())
S = [''.join(sorted(input())) for i in range(N)]

S = collections.Counter(S)

ans = 0
for k, v in S.items():
    ans += v * (v-1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#input
N = int(input())
S = [sorted(input()) for i in range(N)]

ana = 0
for s in S:
    ana += S.count(s)

print(int((ana - N) / 2))

Fixed submission:
import collections

#input
N = int(input())
S = [''.join(sorted(input())) for i in range(N)]

S = collections.Counter(S)

ans = 0
for k, v in S.items():
    ans += v * (v-1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#input
N = int(input())
S = [sorted(input()) for i in range(N)]

ana = 0
for s1 in S:
    for s2 in S:
        if s1 == s2:
            ana += 1

print(int((ana - N) / 2))

Fixed submission:
import collections

#input
N = int(input())
S = [''.join(sorted(input())) for i in range(N)]

S = collections.Counter(S)

ans = 0
for k, v in S.items():
    ans += v * (v-1) // 2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import math

def main():
    n = int(input())
    l_s = list(sorted(map(int, input().split(' '))))

    ans = 0

    for c in range(2, n):
        for b in range(1, c):
            idx = bisect.bisect_right(l_s[:b], l_s[c] - l_s[b])
            ans += b - idx
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import bisect
import math

def main():
    n = int(input())
    l_s = list(sorted(map(int, input().split(' '))))

    ans = 0

    for c in range(2, n):
        for b in range(1, c):
            idx = bisect.bisect_right(l_s, l_s[c] - l_s[b])
            idx = min(b, idx)
            ans += b - idx
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import bisect


def main():
    n, m = map(int, input().split(' '))
    a_s = list(sorted(map(int, input().split(' '))))
    
    for _ in range(m):
        value = int(a_s[n-1]/2)
        i = bisect.bisect_left(a_s[:n-1], value)
        a_s[i+1:n] = a_s[i:n-1]
        a_s[i] = value
    print(sum(a_s))


if __name__ == '__main__':
    main()


Fixed submission:
import heapq


def main():
    n, m = map(int, input().split(' '))
    a_s = list(sorted(map(lambda x: -1 * int(x), input().split(' '))))

    heapq.heapify(a_s)
    for _ in range(m):
        e = heapq.heappop(a_s)
        heapq.heappush(a_s, int(e/2))
    print(-1*sum(a_s))
    
    

if __name__ == '__main__':
    main()

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


def main():
    n, m = map(int, input().split(' '))
    a_s = list(sorted(map(int, input().split(' '))))
    
    for _ in range(m):
        value = int(a_s[n-1]/2)
        i = bisect.bisect_left(a_s[:n-1], value)
        a_s = a_s[:i] + [value] + a_s[i:n-1]
    print(sum(a_s))


if __name__ == '__main__':
    main()


Fixed submission:
import heapq


def main():
    n, m = map(int, input().split(' '))
    a_s = list(sorted(map(lambda x: -1 * int(x), input().split(' '))))

    heapq.heapify(a_s)
    for _ in range(m):
        e = heapq.heappop(a_s)
        heapq.heappush(a_s, int(e/2))
    print(-1*sum(a_s))
    
    

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input())

num = 1

taps = 0

while num < B:
  num -= 1
  num += A
  taps += 1

print(taps)

Fixed submission:
A, B = map(int, input().split(' '))

num = 1

taps = 0

while num < B:
  num -= 1
  num += A
  taps += 1

print(taps)
Buggy python submission (verdict: Runtime Error):
N = int(input())
hs = map(int, input().split(' '))

now = 0

result = 0

for i in range(N):
  if hs[i] <= now:
    now += 1
  else:
    result = max(result, now)
  now = hs[i]

print(result)

Fixed submission:
N = int(input())
hs = list(map(int, input().split(' ')))
 
now = 0
 
result = 0
count = 0

for i in range(N):
  if hs[i] <= now:
    count += 1
  else:
    result = max(result, count)
    count = 0
  now = hs[i]
result = max(result, count)
 
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
result = 0

for i in range(1, n):
    result += i
print(result)

Fixed submission:
n = int(input())
print(int((n-1)*(n)//2))
Buggy python submission (verdict: Runtime Error):
K, X = map(int, input().split(' '))
print(' '.join([ for i in range(X - (K + 1), (X + K + 1))]))

Fixed submission:
K, X = map(int, input().split(' '))
print(' '.join([str(i) for i in range(X - (K - 1), (X + K))]))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

N = int(input())

result = 0
store = []
for _ in range(N):
    d = defaultdict(int)
    s = input()
    for c in set(s):
        d[c] += s.count(c)
    result += store.count(d)
    store.append(d)
print(result)


Fixed submission:
from collections import defaultdict
import sys
readline = sys.stdin.readline

N = int(input())

result = 0
d = defaultdict(int)
for _ in range(N):
    s = input()
    s = ''.join(sorted(s))
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
print(sum([int((v)*(v-1) / 2) for k, v in d.items()]))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()
    lst = [0] * len(s)
    for i, c in enumerate(s):
        if c == 'R':
            for j, t in enumerate(s[i+1:]):
                if t == 'L':
                    if (j + 1) % 2 == 0:
                        lst[i+j+1] += 1
                        break
                    else:
                        lst[i+j] += 1
                        break
        else:
            for j, t in enumerate(reversed(s[:i])):
                if t == 'R':
                    if (j + 1) % 2 == 0:
                        lst[i-(j+1)] += 1
                        break
                    else:
                        lst[i-j] += 1
                        break
    print(' '.join(list(map(str, lst))))


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    s = input()
    n = len(s)
    ret = [0] * n
    for i in range(n-1):
        if s[i:i+2] == "RL":
            for j in range(i, -1, -1):
                if s[j] == "R":
                    ret[i + (i-j) % 2] += 1
                else:
                    break
            for j in range(i+1, n):
                if s[j] == "L":
                    ret[i + (j-i) % 2] += 1
                else:
                    break
    
    print(" ".join(map(str, ret)))

if __name__ == '__main__':
    main()