Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

m=-1;I=input;N,M,K=map(int,I().split());W=2000000;s=[0]*W;t=[0]*W;L=max(N,M)-1;R=range;p=lambda x:print(*reversed(x),sep='')
for i,c in zip(R(N-1,m,m),I()):s[i]=int(c)
for i,c in zip(R(M-1,m,m),I()):t[i]=int(c)
for i in R(L,m,m):
 j=i;z=K
 while s[j]and t[j]and z:
  s[j]=t[j]=0;s[j+1]+=1;t[j+1]+=1;j+=1;z-=1;x=y=j
  while s[x]==2:s[x]=0;s[x+1]+=1;x+=1
  while t[y]==2:t[y]=0;t[y+1]+=1;y+=1
  j=max(x,y)
 L=max(L,j)
s=s[:L+1];t=t[:L+1]
while s[m]==0:s.pop()
while t[m]==0:t.pop()
p(s);p(t)

### FIXED CODE ###

def main():
    N, M, K = map(int, input().split())

    MAX_N = 2000000

    s = [0] * MAX_N
    t = [0] * MAX_N
    for i, c in zip(range(N - 1, -1, -1), input()):
        s[i] = int(c)
    for i, c in zip(range(M - 1, -1, -1), input()):
        t[i] = int(c)

    len_max = max(N, M) - 1
    st = []
    for i in range(len_max, -1, -1):
        m = []
        if s[i] and t[i]:
            s[i] = t[i] = 0
            xs = xt = 1
            z = K - 1
            j = i + 1

            while xs or xt:
                if not s[j] and not t[j]:
                    if xs and not xt:
                        s[j] = 1
                        st.append(j)
                        len_max = max(len_max, j)
                        break
                    elif not xs and xt:
                        t[j] = 1
                        st.append(j)
                        len_max = max(len_max, j)
                        break

                if not st or st[-1] - j > z:
                    s[j + z] = t[j + z] = 1
                    len_max = max(len_max, j + z)
                    break

                p = st.pop()
                z -= p - j
                j = p

                if s[j] == xs and t[j] == xt:
                    s[j] = t[j] = 0
                    j += 1
                    continue

                if xs and xt:
                    xs = s[j]
                    xt = t[j]
                    s[j] ^= 1
                    t[j] ^= 1
                    m.append(j)
                    j += 1
                    continue

                if s[j] != xs and t[j] != xt:
                    if not z:
                        s[j] = t[j] = 1
                        break
                    else:
                        s[j] = t[j] = 0
                        j += 1
                        z -= 1
                        xs = xt = 1
                        continue

            st += reversed(m)

        elif s[i] or t[i]:
            st.append(i)

    s = s[:len_max + 1]
    t = t[:len_max + 1]

    while not s[-1]:
        s.pop()
    while not t[-1]:
        t.pop()

    print(*reversed(s), sep='')
    print(*reversed(t), sep='')


main()
### BUGGY CODE ###

N = int(input())
S = input()
first_black = 0
count = 0
for i in range (N):
    if first_black == 0 and S[i]=='#':
        first_black = 1
    if first_black == 1 and S[i]== '.':
        count +=1
        
first_white = 0
white_count = 0
for i in range (N):
    if first_white == 0 and S[N-i-1]=='.':
        first_white = 1
    if first_white == 1 and S[N-i-1]== '#':
        white_count +=1

white_black = 10**6
for i in range (N):
    temp = S[:i].count('#') + S[i:].count('.')
    if temp<= white_black:
        white_black = temp
        
print(min(count,white_count,white_black))

### FIXED CODE ###

N = int(input())
S = input()
first_black = 0
count = 0
for i in range (N):
    if first_black == 0 and S[i]=='#':
        first_black = 1
    if first_black == 1 and S[i]== '.':
        count +=1
        
first_white = 0
white_count = 0
for i in range (N):
    if first_white == 0 and S[N-i-1]=='.':
        first_white = 1
    if first_white == 1 and S[N-i-1]== '#':
        white_count +=1

white_black = 10**6

black_count_left = 0
white_count_right = S.count('.')
ans = black_count_left + white_count_right

for i in range (N):
    if S[i] == '#':
        black_count_left+=1
    elif S[i] == '.':
        white_count_right-=1
    if ans >= black_count_left+white_count_right:
        ans = black_count_left+white_count_right
        
print(min(count,white_count, ans))
### BUGGY CODE ###

import sys
check=dict()
N,a,b,c,d=0,0,0,0,0
#ttfは235、chaはabc
def dfs_sub(n,ttf,cha):
    global check,d
    if 0 in check:
        check[0]=min(check[n]+n*d,check[0])
    else:
        check[0]=check[n]+n*d
    if (ttf-n%ttf)>=(n%ttf):
        if n//ttf==0:
            if n//ttf in check:
                if check[n//ttf]>check[n]+(n%ttf)*d:
                    check[n//ttf]=check[n]+(n%ttf)*d
            else:
                check[n//ttf]=check[n]+(n%ttf)*d
        else:
            if n//ttf in check:
                if check[n//ttf]>check[n]+(n%ttf)*d+cha:
                    check[n//ttf]=check[n]+(n%ttf)*d+cha
                    dfs(n//ttf)
            else:
                check[n//ttf]=check[n]+(n%ttf)*d+cha
                dfs(n//ttf)
    if (ttf-n%ttf)<=(n%ttf):
        if 1+n//ttf in check:
            if check[1+n//ttf]>check[n]+(ttf-n%ttf)*d+cha:
                check[1+n//ttf]=check[n]+(ttf-n%ttf)*d+cha
                dfs(1+n//ttf)
        else:
            check[1+n//ttf]=check[n]+(ttf-n%ttf)*d+cha
            dfs(1+n//ttf)


def dfs(n):
    global check,a,b,c,d
    dfs_sub(n,2,a)
    dfs_sub(n,3,b)
    dfs_sub(n,5,c)

t=int(input())
ans=[0]*t
for i in range(t):
    N,a,b,c,d=map(int,input().split())
    check={N:0}
    dfs(N)
    ans[i]=check[0]
for i in range(t):
    print(ans[i])

### FIXED CODE ###

import sys
check=dict()
N,a,b,c,d=0,0,0,0,0
#ttfは235、chaはabc
def dfs_sub(n,ttf,cha):
    global check,d
    if 0 in check:
        check[0]=min(check[n]+n*d,check[0])
    else:
        check[0]=check[n]+n*d
    if n//ttf==0:
        if n//ttf in check:
            if check[n//ttf]>check[n]+(n%ttf)*d:
                check[n//ttf]=check[n]+(n%ttf)*d
        else:
            check[n//ttf]=check[n]+(n%ttf)*d
    else:
        if n//ttf in check:
            if check[n//ttf]>check[n]+(n%ttf)*d+cha:
                check[n//ttf]=check[n]+(n%ttf)*d+cha
                dfs(n//ttf)
        else:
            check[n//ttf]=check[n]+(n%ttf)*d+cha
            dfs(n//ttf)
    if 1+n//ttf in check:
        if check[1+n//ttf]>check[n]+(ttf-n%ttf)*d+cha:
            check[1+n//ttf]=check[n]+(ttf-n%ttf)*d+cha
            dfs(1+n//ttf)
    else:
        check[1+n//ttf]=check[n]+(ttf-n%ttf)*d+cha
        dfs(1+n//ttf)


def dfs(n):
    global check,a,b,c,d
    dfs_sub(n,2,a)
    dfs_sub(n,3,b)
    dfs_sub(n,5,c)

t=int(input())
ans=[0]*t
for i in range(t):
    N,a,b,c,d=map(int,input().split())
    check={N:0}
    dfs(N)
    ans[i]=check[0]
for i in range(t):
    print(ans[i])
### BUGGY CODE ###

N,M = map(int, input().split())
A = [0]*M
B = [0]*M
for i in range(M):
    A[i], B[i] = map(int, input().split())
    
parent = [0]*(N+1)
parent[0] = -1
parent[1] = -1

nextroom = [1]
for i in range(N):
    for i in range(M):
        if A[i]==nextroom[0] and parent[B[i]]==0:
            nextroom.append(B[i])
            parent[B[i]] = A[i]
        if B[i]==nextroom[0] and parent[A[i]]==0:
            nextroom.append(A[i])
            parent[A[i]] = B[i]
    nextroom.pop(0)
    
if parent.count(0)==0:
    print('Yes')
    for i in range(2,len(parent)):
        print(parent[i])
else:
    print('No')

### FIXED CODE ###

from collections import deque

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

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

G = {i:[] for i in range(N+1)}
for a,b in AB:
    G[a].append(b)
    G[b].append(a)
    
parent = [0]*(N+1)
parent[0]==-1
parent[1]==-1
q = deque()
q.append(1)
while len(q)>0:
    room = q.popleft()
    child = G[room]
    
    for i in child:
        if parent[i] == 0:
            parent[i] = room
            q.append(i)
    
    
if min(parent[2:])==0:
    print('No')
else:
    print('Yes')
    for i in parent[2:]:
        print(i)
### BUGGY CODE ###

n, m = map(int,input().split())
arr = [0]*n
for i in range(m):
    l, r = map(int, input().split())
    for j in range(l-1,r):
        arr[j]+=1
print (arr.count(m))


### FIXED CODE ###

n, m = map(int,input().split())
arr = [1, n]
check = True
for i in range(m):
    l, r = map(int, input().split())
    if l <= arr[0] and r>= arr[1]:
        continue
    elif l > arr[1] or r < arr[0]:
        check = False
    if arr[0] <= l and l <= arr[1]:
        arr[0] = l
    if arr[1] >= r and r >= arr[0]:
        arr[1] = r
if check:
    print (arr[1] - arr[0] + 1)
else:
    print (0)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
x,y,z,k = map(int, input().split())

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

v = []
for i in range(x):
    for j in range(y):
        v.append(a[i]+b[j])

v = sorted(v, reverse=True)
c = sorted(c, reverse=True)

vv = []
l = len(v)
#if k < l: l=k
if z > k: z=k
for i in range(l):
    for j in range(z):
        vv.append(v[i]+c[j])
vv = sorted(vv, reverse=True)
for ii in vv[0:k]:
    print(ii)





### FIXED CODE ###

# -*- coding: utf-8 -*-
x,y,z,k = map(int, input().split())

a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)


d = [e1+e2 for e1 in a for e2 in b]
d.sort(reverse=True)
d = d[:k]

e = [e1+e2 for e1 in d for e2 in c]
e.sort(reverse=True)


for i in range(k):
    print(e[i])
### BUGGY CODE ###

class Pqueue:
    heap = []
    tail = -1

    def insert(self, k):
        self.heap.append(k)
        self.tail += 1
        self.bubble(self.tail)

    def bubble(self, i):
        if not i: return
        heap = self.heap
        pi = (i - 1) // 2
        if heap[i] > heap[pi]:
            heap[i], heap[pi] = heap[pi], heap[i]
            self.bubble(pi)

    def extract(self):
        heap = self.heap
        self.tail -= 1
        if self.tail < 0:
            return heap.pop()
        else:
            ret = heap[0]
            heap[0] = heap.pop()
            self.anchor(0)
            return ret

    def anchor(self, i):
        li, ri = i * 2 + 1, i * 2 + 2
        if li <= self.tail:
            heap = self.heap
            largest = li
            if ri <= self.tail and heap[ri] > heap[li]:
                largest = ri
            if heap[largest] > heap[i]:
                heap[i], heap[largest] = heap[largest], heap[i]
                self.anchor(largest)


pq = Pqueue()

while True:
    l = input()
    o = l[:2]
    if o == 'in':
        pq.insert(int(l.split()[1]))
    elif o == 'ex':
        print(pq.extract())
    else:
        break

### FIXED CODE ###

from heapq import heappush, heappop

heap = []

while True:
    l = input()
    if l.startswith('i'):
        heappush(heap, -int(l.split()[1]))
    elif l[1] == 'x':
        print(-heappop(heap))
    else:
        break
### BUGGY CODE ###

#       )                         .MMdMMM;                    .M#(,dM]                        .:
#       )                        .M@d@d#Mb                    dMGMM(MN                        .:
#       )                        dM1MCdbMM_                  .M@MSN;dM-                       .:
#       )                       .M#(#?d#(Mb.. ...............JMIMIMLdM]                       .:
#       )                      ..M#?NHM# ?MMMMMMMMMH"""""""HMM@(Nad#(Mb                       .:
#       )                  .(MMMMH=..-(Jg[   `               daggmp  MNm,                     .:
#       )                ..MMY`     !qN;                       (J     ?MMN,                   .:
#       )               (MMD`       .MM@                      .MM{      .WMN,                 .:
#       )              dM@`         dMM%                      .MM}        (MMm                .:
#       )             .M#`          dMN!                      .MM}        ~(MMr               .:
#       )            .MM:           dM#                       .MM}        ..JM#               .:
#       )      ``    .M@            dMF                       .MM}        .~(M#   `  .        .:
#       )      ?MMMMMMMNgJ,         .7`                        T"!       .JJjMNgNNMMMB^       .:
#       )            dMr ?Mm,                                            7YYMM#!`             .:
#       )            dMb   ?`                  .,   ` ..                 ~.(MM%               .:
#       )         ..JgMMNNN)                  .Mn.(Mm-JM{               dHHMMNag.,            .:
#       )         ("!  ?MN,..,                (NM@"`~OMM}             ..~-(M@` _?"M[          .:
#       )               ,MMM#_                .M#    .M#`           .~.~JMMMNg-..             .:
#       )           ..gMB"?TMMNJ..              `     _`         .~~.(JdM#^  _"TMMNgJ-,       .:
#       )        .gMB=`      _7WMMNaJ...                 ....__-(JJgMMMM^          ?T"^       .:
#       )           ............  ?TWMMMMNNNNgggggggggggggNNMMMMMMBY7`...                     .:
#       )           WMMMMMMMMMMMMMNgJ,   (dMMMM#"TYYYYYYMMMMMMMNgMMMMMMMMMMMNNgJ-,            .:
#       )            -?TMNmuuuuUWMMMMMMNNMM@g@MMmJ--_(JMMg@g@@gMMMMMMWUXXXUWMMMMMMNe.         .:

import sys
input = sys.stdin.readline

def f(x,y):
    if x in dic:
        dic[x] = min(dic[x],y)
        return
    dic[x] = y

dic = {}
dic[0] = 0
n,k = map(int,input().split())
h = tuple(map(int,input().split()))

for i in range(1,n):
    for j in range(1,min(k,i)+1):
        f(i,dic[i-j]+abs(h[i]-h[i-j]))

print(dic[n-1])


### FIXED CODE ###

import sys
input = sys.stdin.readline
n,k = map(int,input().split())
h = tuple(map(int,input().split()))

dp = [0] + [float("inf")]*(n-1)
for i in range(1,n):
    for j in range(max(0,i-k),i):
        dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[-1])
### BUGGY CODE ###

N, M = list(map(int, input().split()))
S = input()
T = input()

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd (a, b)

ans = lcm(N, M)

i = 0
res = [0 for i in range(ans)]

for i in range(N):
    tmp_s = int(ans/N) * i
    res[tmp_s] = S[i]

for j in range(M):
    tmp_t = int(ans/M) * j
    if res[tmp_t] != 0:
        if T[j] != res[tmp_t]:
            ans = -1

print(ans)

### FIXED CODE ###

import fractions


def lcm(x, y):
    return int((x * y) // fractions.gcd(x, y))

n, m = [int(i) for i in input().split()]
s = input()
t = input()

span = fractions.gcd(n, m)
for i in range(span):
    if s[int(n/span)*i] != t[int(m/span)*i]:
        print("-1")
        exit()
print(lcm(n, m))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

import heapq
N,M = (int(x) for x in input().split())
jobs = []
taken = [0] * M
jappend = jobs.append
for i in range(N):
    A,B = (int(x) for x in input().split())
    if A <= M:
        jappend((B*(-1),A))
heapq.heapify(jobs)
while jobs:
    temp = heapq.heappop(jobs)
    for i in range(M-temp[1]+1):
        if taken[M-temp[1]-i] == 0:
            taken[M-temp[1]-i] = temp[0]
            break
print(sum(taken)*(-1))

### FIXED CODE ###

import sys
input = sys.stdin.readline

import heapq
N,M = (int(x) for x in input().split())
jobs = [[] for i in range(M)]
count = 0
h = []
for i in range(N):
    A,B = (int(x) for x in input().split())
    if A <= M:
        jobs[A-1].append(B*(-1))
heapq.heapify(h)
for i in range(M):
    if jobs[i]:
        for job in jobs[i]:
            heapq.heappush(h,job)
    if h:
        count -= heapq.heappop(h)
print(count)
### BUGGY CODE ###

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 CODE ###

n = int(input())
ans = 0
for i in range(1,n+1):
    ans += n//i*(i+n//i*i)//2

print(ans)
### BUGGY CODE ###

import numpy as np
from itertools import product

H,W,K=map(int,input().split(' '))
arr = np.vstack([[int(i) for i in input()] for j in range(H)])
ans = H+W-2
for p in product([0,1],repeat=H-1):
    sp=np.zeros((sum(p)+1,W),int)
    row=0
    sp[0]+=arr[0]
    for j in range(H-1):
        if p[j]:
            row+=1
        sp[row]+=arr[j+1]
    if np.max(sp)>K:
        continue
    sum_arr = np.zeros(len(sp),int)
    cut_cnt = sum(p)
    for c in range(W):
        sum_arr += sp[:,c]
        if max(sum_arr)>K:
            cut_cnt+=1
            sum_arr=sp[:,c]
    ans = min(cut_cnt,ans)
print(ans)

### FIXED CODE ###

import numpy as np
from itertools import product

H,W,K=map(int,input().split(' '))
arr = np.vstack([[int(i) for i in input()] for j in range(H)])
ans = H+W-2
for p in product([0,1],repeat=H-1):
    if sum(p)>ans:
        continue
    sp=np.zeros((sum(p)+1,W),int)
    row=0
    sp[0]+=arr[0]
    for j in range(H-1):
        if p[j]:
            row+=1
        sp[row]+=arr[j+1]
    if np.max(sp)>K:
        continue
    sum_arr = np.zeros(len(sp),int)
    cut_cnt = sum(p)
    for c in range(W):
        sum_arr += sp[:,c]
        if max(sum_arr)>K:
            cut_cnt+=1
            sum_arr=sp[:,c]
            if cut_cnt > ans:
                break
    ans = min(cut_cnt,ans)
print(ans)
### BUGGY CODE ###

n = int(input())
h = [int(i) for i in input().split()] # input:"1 2 3 4 5"
ans = 0
for i in range(n-1):
  for j in range(i,n-1):
    delta = h[j]-h[i]
    if h[j+1]+1<h[i]:
        ans = 1
        break
    elif h[j+1]+1==h[i]:
        h[i]-=1
        break
if ans == 1:
  print('No')
elif sorted(h)==h:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n = int(input())
h = [int(i) for i in input().split()] # input:"1 2 3 4 5"

#2019/08/08とき直し
#次のマスの高さを１高くすることができるようにする
ans = 'Yes'
for i in range(n-1):
  if h[i]>h[i+1]+1:
    ans = 'No'
    break
  elif h[i]==h[i+1]+1:
    h[i+1]+=1
print(ans)
### BUGGY CODE ###

sx,sy,gx,gy=map(int,input().split())
n=int(input())
g = [[] for i in range(n+2)]
data=[(sx,sy,0)]
for i in range(n):
    data.append(tuple(map(int,input().split())))
data.append((gx,gy,0))
for i in range(n+2):
    for j in range(i+1,n+2):
        tmp=max(0,((data[i][0]-data[j][0])**2+(data[i][1]-data[j][1])**2)**0.5-data[i][2]-data[j][2])
        g[i].append((tmp,j))
        g[j].append((tmp,i))

def dijkstra(g,st,ed):
    from heapq import heappush, heappop, heapify
    dist=[2828427127 for i in range(len(g))]
    dist[st]=0
    que=[]
    heappush(que,(0,st))
    while que:
        c,v=heappop(que)
        for i in range(len(g[v])):
            if g[v][i][0]+c<dist[g[v][i][1]]:
                dist[g[v][i][1]]=g[v][i][0]+c
                heappush(que,(g[v][i][0]+c,g[v][i][1]))
    return dist[ed]

print(dijkstra(g,0,n+1))

### FIXED CODE ###

from heapq import heappush, heappop
sx,sy,gx,gy=map(int,input().split())
n=int(input())
g = [[] for i in range(n+2)]
data=[(sx+sy*1j,0)]
for i in range(n):
    a,b,c=map(int,input().split())
    data.append((a+b*1j,c))
data.append((gx+gy*1j,0))

for i in range(n+2):
    for j in range(i+1,n+2):
        tmp=abs(data[i][0]-data[j][0])-data[i][1]-data[j][1]
        g[i].append((tmp,j))
        g[j].append((tmp,i))

dist=[2828427127 for i in range(n+2)]
visited=[False for i in range(n+2)]
dist[0]=0
que=[]
heappush(que,(0,0))

while que:
    c,v=heappop(que)
    if visited[v]:
        continue
    visited[v]=True
    for x in g[v]:
        if visited[x[1]]:
            continue
        tmp=x[0]+c if not x[0]<0 else c
        if tmp<dist[x[1]]:
            dist[x[1]]=tmp
            heappush(que,(tmp,x[1]))
print(dist[n+1])
### BUGGY CODE ###

# n = int(sys.stdin.readline())
# a, b = map(int, sys.stdin.readline().split())
# c = list(map(int, sys.stdin.readline().split()))
# s = [list(map(int,list(sys.stdin.readline()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a = 100
# b = 0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋め, 小数点出力桁指定時のときの出力
# 000100-0.987654

import math
import sys
import itertools
import queue

mod = 1000000007

if __name__ == "__main__":
    N, M = map(int, sys.stdin.readline().split())

    broken = [int(sys.stdin.readline()) for _ in range(M)]
    dp = [0 for _ in range(N + 2)]
    dp[N] = 1
    for i in range(0, N)[::-1]:
        if i not in broken:
            dp[i] = dp[i + 1] + dp[i + 2]
    print(dp[0] % mod)

### FIXED CODE ###

# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy
import itertools

mod  = 1000000007

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

broken = [0 for _ in range(N + 2)]

for i in range(M):
    n = int(input())
    broken[n] = True

dp = [0 for _ in range(N + 2)]
dp[N] = 1
for i in range(0, N)[::-1]:
    if broken[i]:
        dp[i] = 0
        continue
    dp[i] = (dp[i + 1] + dp[i + 2]) % mod

print(dp[0])
### BUGGY CODE ###

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

a = []

for i in range(M):
    a.append(int(input()))

    # 隣接してる場合は、0出力で終了
    if a[i] == a[i - 1] + 1:
        print(0)
        exit(0)

dp = [0] * (N + 1)

dp[0] = 1

if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, N + 1):
    if i in a:
        continue
    else:
        dp[i] = dp[i - 1] + dp[i - 2]
        dp[i] %= 1000000007

print(dp[-1])




### FIXED CODE ###

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

# a = [int(input()) for _ in range(M)]
a = set([int(input()) for _ in range(M)])

dp = [0] * (N + 1)
dp[0] = 1

if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, N + 1):
    if i in a:
        continue
    else:
        dp[i] = dp[i - 1] + dp[i - 2]
        dp[i] %= 1000000007

print(dp[-1])
### BUGGY CODE ###

import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

common=lcm_list(A)
ans=0
for i in range(N):
    ans+=common//A[i]
print(ans%a)

### FIXED CODE ###

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

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

common=lcm(A)
ans=0
for i in range(N):
    ans+=common//A[i]
print(ans%a)
### BUGGY CODE ###

N =int(input())
for l in range(1,N+1):
  ans = 0
  for i in range(1,101):
    for j in range(1,101):
      for k in range(1,101):
        f = i*i+j*j+k*k+i*j+j*k+k*i
        if f == l:
          ans += 1
  print(ans)


### FIXED CODE ###

N = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      if v<10050:
        ans[v]+=1
for l in range(N):
  print(ans[l+1])
### BUGGY CODE ###

import sys
def S(): return sys.stdin.readline().rstrip()

def Main():
    s = S()
    n = len(s)
    times = 10**100
    ans = [0]*n
    for i in range(n):
        current = i
        char = s[i]
        if char=='R':
            vec = 1
        else:
            vec = -1

        for rep in range(times):
            if s[current+vec] != char:  break
            current += vec
            
        nx = (times-rep)%2
        ans[current+vec*nx] += 1
    print(*ans)
    return

if __name__=='__main__':
    Main()

### FIXED CODE ###

import sys
def S(): return sys.stdin.readline().rstrip()

def Main():
    s = S()
    n = len(s)
    times = 10**100
    ans = [0]*n
    i = 0
    while i<n:
        if s[i]=='L':
            i += 1
            continue
        save = [i]
        while s[i+1]!='L':
            i += 1
            save.append(i)
        flg = save.pop()
        ans[flg] += 1
        for j in range(len(save)):
            tmp = save.pop()
            ans[flg+abs(flg-tmp)%2] += 1
        i += 1
    
    i = n-1
    while 0<=i:
        if s[i]=='R':
            i -= 1
            continue
        save = [i]
        while s[i-1]!='R':
            i -= 1
            save.append(i)
        flg = save.pop()
        ans[flg] += 1
        for j in range(len(save)):
            tmp = save.pop()
            ans[flg-abs(flg-tmp)%2] += 1
        i -= 1
    print(*ans)
    return

if __name__=='__main__':
    Main()