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

import numpy as np
N = int(input())
A = [int(i) for i in input().split()]
total = sum(A)
X = np.zeros(N)
for i in range(total+1):
    X[0] = i
    for j in range(1,N):
        X[j] = 2*A[j-1] - X[j-1]
    if sum(X)==total:
        break

for i in range(N):
    print("{}".format(int(X[i])),end=" ") 

### FIXED CODE ###

import numpy as np
N = int(input())
A = [int(i) for i in input().split()]
total = sum(A)
X = np.zeros(N)
X[0] = total 

n =int((N-1)/2 )
for i in range(1,n+1):
    X[0] = X[0] - 2*A[2*i-1]
for j in range(1,N):
    X[j] = 2*A[j-1] - X[j-1]
for i in range(N):
    print("{}".format(int(X[i])),end=" ")
### BUGGY CODE ###

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

A_set = list(set(A))
Ad = {a_set:A.count(a_set) for a_set in A_set}

score_sum = sum([x*(x-1)/2 for x in list(Ad.values())])
output = [str(int(score_sum - (Ad[a] - 1)))for a in A]
print('\n'.join(output))


### FIXED CODE ###

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

# A_set = list(set(A))
# Ad = {a_set:A.count(a_set) for a_set in A_set}
Ad = {}
for i in A:
  if not i in Ad:
    Ad[i]=0
  Ad[i] += 1

score_sum = sum([x*(x-1)/2 for x in list(Ad.values())])

for a in A:
    print(int(score_sum - (Ad[a] - 1)))
### BUGGY CODE ###

import sys
import math

MOD=10**9+7

N,T=map(int,input().split())
l=[list(map(int,input().split())) for i in range(N)] 
l.sort(reverse=True)

dp1=[[-10**10 for i in range(T)] for i in range(N)]
dp2=[[0 for i in range(T)] for i in range(N)]

[a,b]=l[0]
dp1[0][0],dp2[0][0]=0,b
if a<T: dp1[0][a]=b

for i in range(1,N):
    [a,b]=l[i]
    m=min(a,T)
    for j in range(m):
        dp1[i][j]=dp1[i-1][j]
        dp2[i][j]=max(b,dp2[i-1][j])
    for j in range(m,T):
        p,q=dp1[i-1][j],dp1[i-1][j-a]+b
        if p<q:
            dp1[i][j]=q
            dp2[i][j]=dp2[i-1][j-a]
        elif p>q:
            dp1[i][j]=p
            dp2[i][j]=max(dp2[i-1][j],b)
        else:
            dp1[i][j]=p
            dp2[i][j]=max(dp2[i-1][j-a],dp2[i-1][j],b)

print(max( dp1[N-1][j]+dp2[N-1][j] for j in range(T) ) )

### FIXED CODE ###

ans=0
n,t=map(int,input().split())
food=[]
for i in range(n):
    f=list(map(int,input().split()))
    food.append(f)
food=sorted(food)
dp=[0,0]+[-1]*(t-1)

for a,b in food:
    tmp=[dp[i] for i in range(t)]
    for i in range(t):
        if dp[i]==-1: continue
        j=i+a
        if j<t: tmp[j]=max(tmp[j],dp[i]+b)
        else: ans=max(ans,dp[i]+b)
    
    dp=[tmp[i] for i in range(t)]
print(max(ans,max(dp)))
### BUGGY CODE ###

S=input()
Q=int(input())
Query=[list(input().split()) for i in range(Q)]

for i in Query:
    if int(i[0]) == 1:
        S = S[::-1]
    elif int(i[0]) == 2:
        if int(i[1]) == 1:
            S = i[2] + S
        elif int(i[1]) == 2:
            S = S + i[2]


print(S)

### FIXED CODE ###

S=input()
Q=int(input())
Query=[input().split() for i in range(Q)]
bf=''
af=''
Flag=True

for i in range(Q):
    if Query[i][0] == '1':
        Flag = not Flag
    else:
        if Query[i][1] == '1':
            if Flag:
                bf = bf + Query[i][2]
            else:
                af = af + Query[i][2]
        else:
            if Flag:
                af = af + Query[i][2]
            else:
                bf = bf + Query[i][2]

ans = bf[::-1] + S + af

if not Flag:
    ans = ans[::-1]

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

#coding:utf-8                                                                                         
import random

def is_prime(q,k=10):
    #計算するまでもなく判定できるものははじく                                                         
    if q < 2: return False # 2未満に素数はない                                                        
    if q == 2 or q == 3 or q == 5: return True # 2,3,5は素数                                          
    if q % 2 == 0 or q % 3 == 0 or q % 5 == 0: return False # 2,3,5の倍数は合成数                     

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める                                                  
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1

    #判定をk回繰り返す                                                                                
    for i in xrange(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック                                                                
        while t != q-1 and y != 1 and y != q-1:
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True


Q = int(raw_input())
LR = []
for i in range(Q):
    l, r = map(int, raw_input().split())
    LR.append((l, r))

for l, r in LR:
    count = 0
    for j in range(l, r+1, 2):
        if is_prime(j):
            if is_prime((j+1)/2):
                count += 1
    print count

### FIXED CODE ###

import math


def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
    return data

primes = set(get_sieve_of_eratosthenes(10**5))
A = []
for i in range(1, 10**5+1):
  if i % 2 == 1:
    if i in primes and (i+1) // 2 in primes:
      A.append(1)
    else:
      A.append(0)
  else:
    A.append(0)

for i in range(1, len(A)):
  A[i] += A[i-1]

q = int(input())
for _ in range(q):
  l, r = map(int, input().split())
  if l == 1:
    l = 2
  ans = A[r-1] - A[l-2]
  print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def main():
    n = int(input())
    a = list(map(int,input().split()))

    mod = 10 ** 9 + 7

    a_bin = [format(i, 'b') for i in a]

    m = len(max(a_bin, key = len))

    ans = 0

    for i in range(n):
        a_bin[i] = '0' * (m - len(a_bin[i])) + a_bin[i]

    for i in range(1, m+1):
        count = [0, 0]
        for j in a_bin:
            count[int(j[-i])] += 1
        ans += count[0] * count[1] * 2 ** (i-1)

    print(ans % mod)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import numpy as np
input = sys.stdin.readline

def main():
    n = int(input())
    a = list(map(int,input().split()))

    mod = 10 ** 9 + 7

    a_bin = [format(i, 'b') for i in a]

    m = len(max(a_bin, key = len))

    ans = 0

    for i in range(n):
        a_bin[i] = '0' * (m - len(a_bin[i])) + a_bin[i]

    for i in range(1, m+1):
        count = [0, 0]
        for j in a_bin:
            count[int(j[-i])] += 1
        ans += count[0] * count[1] * 2 ** (i-1)

    print(ans % mod)

def main2():
    n = int(input())
    a = list(map(int,input().split()))

    a = np.array(a)
    ans = 0
    mod = 10**9 + 7

    for i in range(60):
        count = np.count_nonzero(a & 1)
        ans += count * (n - count) * 2 ** i
        a >>= 1

    print(ans % mod)

if __name__ == '__main__':
    main2()
### BUGGY CODE ###

n = int(input())
s = input()
p = [set() for _ in range(100)]
sp = [set() for _ in range(n)]
k = int(s[-1])
sp[-1].add(k)
ful = False
for j in range(n-2,1,-1):
    if ful:
        sp[j] = {0,1,2,3,4,5,6,7,8,9}
    tmp = set(sp[j+1])
    if len(tmp) == 10:
        ful = True
    tmp.add(int(s[j]))
    sp[j] = tmp
co = 0
for x in range(n-2):
    if co == 100:
        break
    for y in range(x,n-1):
        if x < y:
            tstr = str(s[x])+str(s[y])
            b2 = int(tstr)
            if len(p[b2]) > 0:
                pass
            else:
                p[b2] |= sp[y+1]
                co += 1
            if co == 100:
                break
g =0
for c in p:
    g += len(c)
print(g)

### FIXED CODE ###

n = int(input())
s = input()
p = [set() for _ in range(100)]
sp = [set() for _ in range(n)]
k = int(s[-1])
sp[-1].add(k)
ful = False
for j in range(n-2,1,-1):
    if ful:
        sp[j] = {0,1,2,3,4,5,6,7,8,9}
    tmp = set(sp[j+1])
    if len(tmp) == 10:
        ful = True
    tmp.add(int(s[j]))
    sp[j] = tmp

s10 = [[99999 for _ in range(2)] for _ in range(10)]
for i,d in enumerate(s):
    c = int(d)
    if s10[c][0] == 99999:
        s10[c][0] = i
    elif s10[c][1] == 99999:
        s10[c][1] = i
g = 0
for i in range(10):
    for j in range(10):
        ans = 0
        nexid = min(s10[i])
        if nexid != 99999:
            for r in range(nexid+1,n-1):
                if int(s[r]) == j:
                    ans = len(sp[r+1])
                    break
            g += ans
print(g)
### BUGGY CODE ###

# Sum Difference
N, X, D = map(int, input().split())
if D < 0:
    X, D = -X, -D
# D>=0 として一般性を失わない
if D == 0:
    Sets = set()
    for i in range(N+1):
        Sets.add(i*X)
    print(len(Sets))
    exit()

# D>0
ans = 0
Sets = set()

#TLE O(N**3)
for j in range(N+1):
    for k in range((j-1)*j//2, (2*N-1-j)*j//2+1):
        Sets.add(X*j+D*k)
print(len(Sets))

### FIXED CODE ###

# Sum Difference
from collections import defaultdict
N, X, D = map(int, input().split())
if D < 0:
    X, D = -X, -D

if D == 0:
    Sets = set()
    for i in range(N+1):
        Sets.add(i*X)
    print(len(Sets))
    exit()

# D>0
ans = 0
Mode = defaultdict(list)
for i in range(N+1):
    L = (i*X+D*i*(i-1)//2-i*X % D)//D
    R = (i*X+D*i*(2*N-1-i)//2-i*X % D)//D
    Mode[i*X % D].append((L, 1))
    Mode[i*X % D].append((R+1, -1))
Data = []
for key in Mode.keys():
    Mode[key].sort()
    cnt = 1
    sums = Mode[key][0][0]
    for num, which in Mode[key][1:]:
        Data.append((sums, num, cnt))
        cnt += which
        sums = num
ans = 0
for l, r, v in Data:
    if v > 0:
        ans += r-l
print(ans)
### BUGGY CODE ###

A, B, C = map(int, input().split())
ans = 0
c = C
for i in range(C) :
    if c > 0 and B > 0 :
        ans += 2
        c -= 1
        B -= 1
    elif c > 0 and A > 0 :
        ans += 1
        c -= 1
        A -= 1
if c > 0 :
    ans += 1
print(ans + B)


### FIXED CODE ###

A, B, C = map(int, input().split())
ans = 0
if B >= C :
    print(B + C)
    exit()
ans = 2 * B
C -= B
if A >= C :
    print(ans + C)
    exit()
print(ans + A + 1)
### BUGGY CODE ###

import collections
N = int(input())

dic = {}
for i in range(N):
  S = input()
  if S in dic:
    dic[S] += 1
  else:
    dic[S] = 1

maxval = max(dic.values())

keys = [k for k, v in dic.items() if  v == max(dic.values())]
[print(sorted(keys)[i]) for i in range(len(keys))]

### FIXED CODE ###

import collections
N = int(input())
S = [input() for _ in range(N)]

if len(S) == len(set(S)):
  ans = S
else:
  ans = []
  c = collections.Counter(S)
  c_common = c.most_common()
  max_vote = c_common[0][1]
  for k in range(len(set(S))):
    if c_common[k][1]== max_vote:
      ans.append(c_common[k][0])
    else:
      break
[print(a) for a in sorted(ans)]
### BUGGY CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))

from itertools import product
aa = list(product(a, repeat=2))
print(sum(sorted(list(map(lambda x: x[0] + x[1], aa)), reverse=True)[:m]))

### FIXED CODE ###

import sys
from itertools import accumulate
from bisect import bisect_left

n, m, *a = map(int, sys.stdin.read().split())
a.sort()


def f(x):
    # 幸福度がx未満となる組み合わせの個数を数える
    cnt = 0
    for ai in a:
        cnt += bisect_left(a, x-ai)
    # 幸福度がx以上の組み合わせの個数がm未満かどうか
    return n * n - cnt < m


left = a[0] * 2
right = a[-1] * 2
while right - left > 1:
    mid = (right + left) // 2
    if f(mid):
        right = mid
    else:
        left = mid
ans = 0
cumsum = [0] + list(accumulate(a))
j = 0
for ai in a:
    i = bisect_left(a, left-ai)
    j += n - i
    ans += ai * (n - i) + cumsum[-1] - cumsum[i]
ans += (m - j) * left
print(ans)
### BUGGY CODE ###

import numpy as np
def main():
    n,ma,mb = map(int, input().split())
    a,b,c = [],[],[]
    for i in range(n):
        ia,ib,ic = map(int, input().split())
        a.append(ia)
        b.append(ib)
        c.append(ic)
    sa = sum(a)
    sb = sum(b)
    INF = 10**5
    dp = np.full((n+1,sa+1,sb+1), INF, dtype=int)
    dp[0][0][0] = 0

    for i in range(n):
        for ca in range(sa):
            for cb in range(sb):
                if dp[i][ca][cb] == INF:
                    continue
                dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb])
                dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]], dp[i][ca][cb] + c[i])



    res = INF
    for ca in range(1, sa):
        for cb in range(1, sb):
            if ca*mb==cb*ma:
                res = min(res, dp[n][ca][cb])

    if res == INF:
        res = -1
    print(res)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n,ma,mb = map(int, input().split())
    a,b,c = [],[],[]
    for i in range(n):
        ia,ib,ic = map(int, input().split())
        a.append(ia)
        b.append(ib)
        c.append(ic)
    sa = sum(a)
    sb = sum(b)
    INF = 10**5
    dp = [[ [INF] * (sb+1) for i in range(sa+1)] for i in range(n+1)]
    dp[0][0][0] = 0

    for i in range(n):
        for ca in range(sa):
            for cb in range(sb):
                if dp[i][ca][cb] == INF:
                    continue
                dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb])
                dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]], dp[i][ca][cb] + c[i])



    res = INF
    for ca in range(1, sa):
        for cb in range(1, sb):
            if ca*mb==cb*ma:
                res = min(res, dp[n][ca][cb])

    if res == INF:
        res = -1
    print(res)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n, k = map(int, input().split())
A = [0] + list(map(int, input().split()))
def f(i):
  if i == 1:
    return A
  L = [-1]*(n+1)
  if i & 1:
    F = f(i-1)
    for j in range(n+1):
      L[j] = A[F[j]]
  else:
    F = f(i//2)
    for j in range(n+1):
      L[j] = F[F[j]]
  return L
F = f(k)
ans = F[1]
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
A = list(map(int, input().split()))
D = [1]
seen = [0]*n
seen[0] = 1
now = 0
while True:
    now = A[now] - 1
    D.append(now+1)
    if seen[now]:
        break
    seen[now] = 1
f = D.index(D[-1])
if k < f:
    print(D[k])
else:
    cycle = len(D) - f - 1
    k -= f
    print(D[f + k%(cycle)])
### BUGGY CODE ###

from operator import add, mul, sub,truediv, floordiv
from functools import reduce

import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int,input().split()))
ans = reduce(mul, A)

if ans > 10**18:
    ans = -1

print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit()
ans = 1

for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        print(-1)
        exit()

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

from itertools import combinations
N = int(input())
L = list(map(int,input().split()))
ans = 0
for cmb in combinations(L,3):
  max_val = max(cmb)
  if 2*max_val < sum(cmb): ans += 1
print(ans)

### FIXED CODE ###

import bisect 
N = int(input())
L = sorted(list(map(int,input().split())))
ans = 0
for i in range(N-2):
  for j in range(i+1,N-1):
    idx = bisect.bisect(L,L[i]+L[j]-1)
    ans += idx-j-1
print(ans)
### BUGGY CODE ###

from collections import deque

N = int(input())
graph = [[] for _ in range(N+1)] #木構造を入れておく
long = [0] * (N+1) #Kから任意のノードまでの距離

for i in range(N-1):
  x, y, z = map(int, input().split())
  graph[x].append([y, z])
  graph[y].append([x, z])
  
Q, K = map(int, input().split())
x = list()
y = list()
  
for i in range(1,N+1): #Kから任意のノードまでの距離を求める
  q = deque([K])
  while q:
    t = q.popleft()
    for i in range(len(graph[t])):
      next_t = graph[t][i][0]
      if(long[next_t] > 0):
        continue
        
      else:
        q.append(next_t)
        long[next_t] = long[t] + graph[t][i][1]
        

for i in range(Q):
  x_i, y_i = map(int, input().split())
  ans = long[x_i] + long[y_i]
  print(ans)


### FIXED CODE ###

import heapq
def dijkstra_heap(s):
    d = [float("inf")]*n
    used = [True] * n
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d
n = int(input())
edge = [[] for i in range(n)]
for i in range(n-1):
    x,y,z = map(int,input().split())
    edge[x-1].append([z,y-1])
    edge[y-1].append([z,x-1])
Q,K = map(int,input().split())
L = dijkstra_heap(K-1)
query = []
for i in range(Q):
  query.append(list(map(int,input().split())))
for i in range(Q):
  print(L[query[i][0]-1]+L[query[i][1]-1])
### BUGGY CODE ###


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


def coprime(a, b):
    return gcd(a, b) == 1


def cf(x1, x2):
    cf = []
    for i in range(1, min(x1, x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf


a, b = map(int, input().split())
c = cf(a, b)
len_c = len(c)

d = [1]
for i in range(1, len(c)):
    coprime_flag = True
    for j in range(0, len(d)):
        if not coprime(c[i], d[j]):
            coprime_flag = False
            break
    if coprime_flag:
        d.append(c[i])
print(len(d))


### FIXED CODE ###

import math


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


def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


a, b = map(int, input().split())
c = gcd(a, b)
d = factorize(c)
print(len(set(d))+1)
### BUGGY CODE ###

import math
#for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
p=1
for i in range(len(a)):
    p=p*a[i]

if p>math.pow(10,18):
    print(-1)
else:
    print(p)


### FIXED CODE ###

import math

# for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
p = 1
r=0
m=math.pow(10,18)
if 0 in a:
    print(0)
else:
    for i in range(n):

        p = p * a[i]
        if p>m:
            r+=1
            break

    if r>0:
        print(-1)
    else:
        print(p)
### BUGGY CODE ###

N = int(input())
S = input()
def f(m):
    res = False
    hs = []
    for i in range(0,N-m+1):
        hs.append(hash(S[i:i+m]))
    for i in range(0,N-m+1):
        if hash(S[i:i+m]) in hs[i+m:]:
            res = True
            break
    return res

l = 0
r = N//2+1
while (r-l)>1:
    mid = (r+l)//2
    if f(mid):
        l = mid
    else:
        r = mid
print(l)

### FIXED CODE ###

N = int(input())
S = input()
dp = [[0]*N for _ in range(N)]
ans = 0
for i in range(N-1,0,-1):
    for j in range(i-1,-1,-1):
        if S[i] == S[j]:
            if i < N-1 and j < i-1:
                dp[i][j] = min(dp[i+1][j+1]+1, i-j)
            else:
                dp[i][j] = 1
        ans = max(ans, dp[i][j])
print(ans)
### BUGGY CODE ###

S = input()
Q = int(input())
is_lookforward = True
for i in range(Q):
    query = input()
    if query[0] == '1':
        is_lookforward = not is_lookforward
    else:
        F = int(query[2])
        C = query[4]
        if (F == 1 and is_lookforward) or (F == 2 and not is_lookforward):
            S = C + S
        else:
            S = S + C

print(S if is_lookforward else S[::-1])


### FIXED CODE ###

from collections import deque
S = input()
L = deque()
L.append(S)
Q = int(input())
is_lookforward = True
for i in range(Q):
    query = input()
    if query[0] == '1':
        is_lookforward = not is_lookforward
    else:
        F = int(query[2])
        C = query[4]
        if (F == 1 and is_lookforward) or (F == 2 and not is_lookforward):
            L.appendleft(C)

        else:
            L.append(C)
ans = ''.join(L)
print(ans if is_lookforward else ans[::-1])
### BUGGY CODE ###

from operator import mul
from functools import reduce

N = int(input())
A=list(map(int,input().split()))
s=1
if min(A) == 0:
  s = 0
elif max(A) > 10**18:
  s = -1
else:
  s = reduce(mul, A)
  if s > 10**18:
    s = -1
print(s)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
if 0 in A:
  print(0)
  exit()
prod = 1
for i in A:
  prod *= i
  if prod > 10**18:
    print(-1)
    exit()
print(prod)
### BUGGY CODE ###

from bisect import bisect_left, bisect_right
 
def main():
    N = int(input())
    L = [int(c) for c in input().split()]
    L = sorted(L)
    num = 0
    for ai in range(N):
        for bi in range(ai+1, N):
            if bi - ai == 1:
                continue
            a = L[ai]
            b = L[bi]
            ci_left = bisect_right(L[ai+1:bi], abs(L[ai] - L[bi]))
            ci_right = bisect_left(L[ai+1:bi], L[ai] + L[bi])
            # print(a, b, ci_left, min(ci_right, bi) - max(ci_left, ai) - 1)
            # num += min(ci_right, bi) - max(ci_left, ai) - 1
            num += ci_right - ci_left
            # print(a, b, ci_right, ci_left, num)
 
    print(num)
 
 
if __name__ == '__main__':
    main()

### FIXED CODE ###

import bisect

def main():
    N = int(input())
    L = [int(i) for i in input().split()]
    L.sort()
    count = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            k = bisect.bisect_left(L, L[i] + L[j])
            k -= 1
            count += k - j
    print(count)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

s=input()
n=len(s)
pool=[0]*n
for i in range(n-1):
    if s[i]=='R' and s[i+1]=='L':
        pool[i]=1
        pool[i+1]=2
final=[0]*n
for i in range(n):
    index=i
    flag=0
    while pool[index]==0:
        if s[index]=='R':
            flag=1-flag
            index+=1
        else:
            flag=1-flag
            index-=1
    if pool[index]==1:
        if flag==0:
            final[index]+=1
        else:
            final[index+1]+=1
    else:
        if flag==0:
            final[index]+=1
        else:
            final[index-1]+=1
for i in final:
    print(i,end=" ")


### FIXED CODE ###

s=input()
n=len(s)
pool=[]
blue=[0]*n
final=[0]*n
for i in range(n-1):
    if s[i]=='R' and s[i+1]=='L':
        pool.append(i)
        pool.append(i+1)
        blue[i]=1
        blue[i+1]=1
        final[i]+=1
        final[i+1]+=1
counter=-1
for i in range(n):
    if blue[i]==1:
        counter+=1
    else:
        if s[i]=='L':
            index=pool[counter]
            if (i-index)%2==0:
                final[index]+=1
            else:
                final[index-1]+=1
        else:
            index=pool[counter+1]
            if (index-i)%2==0:
                final[index]+=1
            else:
                final[index+1]+=1
f=[str(i) for i in final]
print(' '.join(f))
### BUGGY CODE ###

def make_lcs(a,b):
    a_size = len(a)
    b_size = len(b)
    lcs = [[0 for _ in range(a_size+1)] for _ in range(b_size+1)]
    for i in range(1,b_size+1):
        for j in range(1,a_size+1):
            if a[j-1] == b[i-1]:
                match = 1
            else:
                match = 0
            lcs[i][j] = max(lcs[i-1][j-1]+match, lcs[i-1][j], lcs[i][j-1])
    # ここまではlcs()と同じ

    # lcsを使用して復元
    res = ''
    i,j = b_size,a_size
    while((i>0) & (j>0)):
        if lcs[i][j] == lcs[i-1][j]:
            i -= 1
        elif lcs[i][j] == lcs[i][j-1]:
            j -= 1
        else:
            res = b[i-1] + res
            i -= 1
            j -= 1
    return res

def main():
    a = list(input())
    b = list(input())
    print(make_lcs(a,b))

if __name__ == "__main__":
    main()
    

### FIXED CODE ###

def make_lcs(a,b):
    a_size = len(a)
    b_size = len(b)
    lcs = [[0 for _ in range(a_size+1)] for _ in range(b_size+1)]
    for i in range(1,b_size+1):
        for j in range(1,a_size+1):
            if a[j-1] == b[i-1]:
                match = 1
            else:
                match = 0
            lcs[i][j] = max(lcs[i-1][j-1]+match, lcs[i-1][j], lcs[i][j-1])
    # ここまではlcs()と同じ

    # lcsを使用して復元
    res = ''
    i,j = b_size,a_size
    while((i>0) & (j>0)):
        if lcs[i][j] == lcs[i-1][j]:
            i -= 1
        elif lcs[i][j] == lcs[i][j-1]:
            j -= 1
        else:
            res = b[i-1] + res
            i -= 1
            j -= 1
    return res

def main():
    a = list(input())
    b = list(input())
    print(make_lcs(a,b))

if __name__ == "__main__":
    main()