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

#!/usr/bin/env python3
 
import sys
from collections import defaultdict
# ---- ここまで -----------------------
 
input = sys.stdin.readline
 
S = input().rstrip()
T = input().rstrip()
lenS = len(S)
lenT = len(T)
F1 = [False]*26
F2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(lenS):
    F1[alpha.index(S[i])] = True
for i in range(lenT):
    F2[alpha.index(T[i])] = True
for i in range(26):
    if not F1[i] and F2[i]:
        print(-1)
        sys.exit()
 
ind = S.index(T[0])
ans = ind+1
for i in range(1,lenT):
    S = S[ind+1:] + S[:ind+1]
    ind = S.index(T[i])
    ans += ind+1
 
print(ans)

### FIXED CODE ###

import bisect
s = input().rstrip()
t = input().rstrip()

a_ord = ord("a")
ch_place = [[] for _ in range(26)]
for i, ch in enumerate(s):
    ch_place[ord(ch) - a_ord].append(i)

# print(ch_place)

count = 0
idx = -1 
for ch in t:
    ch_num = ord(ch) - a_ord
    if len(ch_place[ch_num]) == 0:
        print(-1)
        exit()
    place = bisect.bisect_right(ch_place[ch_num], idx)
    # print(ch_place[ch_num], idx, place)
    if place == len(ch_place[ch_num]):
        idx = ch_place[ch_num][0]
        count += 1
    else:
        idx = ch_place[ch_num][place]

# print(count, idx)
print(count * len(s) + idx + 1)
### BUGGY CODE ###

import itertools

N, K, C = list(map(int, input().split()))
S = list(input())

S_OK = [i for i, x in enumerate(S) if x == 'o']
SF, SL = S_OK.copy(), S_OK.copy()
F = []
L = []

for j in range(K):
    F.append(SF[0])
    SF = [i for i in SF if SF[0] + C < i]
    L.insert(0, SL[-1])
    SL = [i for i in SL if SL[-1] - C > i]

[print(i + 1) for i in F if i in L]

### FIXED CODE ###

# import time

N, K, C = list(map(int, input().split()))
S = list(input())

F = []
L = []

# t1 = time.time()
# for i in range(N):
#     if S[i] == 'o':
#         if len(F) == 0:
#             F.append(i)
#         elif F[-1] + C < i:
#             F.append(i)
#     if len(F) >= K:
#         break
# print(F)
# t2 = time.time()
i = 0
while len(F) <= K and i < N:
    if S[i] == 'o':
        if len(F) == 0:
            F.append(i)
        elif F[-1] + C < i:
            F.append(i)
    i += 1
# print(F)
# t3 = time.time()

# print(t2 - t1, t3 - t2)

i = N - 1
while len(L) <= K and i >= 0:
    if S[i] == 'o':
        if len(L) == 0:
            L.append(i)
        elif L[-1] - C > i:
            L.append(i)
    i -= 1

if len(F) == K and len(L) == K:
    ans = [i + 1 for i in set(F) & set(L)]
    if len(ans) != 0:
        ans.sort()
        [print(i) for i in ans]
### BUGGY CODE ###

N,K = map(int,input().split(" "))
h = sorted([ int(input()) for _ in range(N) ])
ans = float('inf')
for i in range(N-K+1):
    lst = h[i:i+K]
    ans = min(lst[-1]-lst[0],ans)
print(ans)

### FIXED CODE ###

N,K = map(int,input().split(" "))
h = sorted([ int(input()) for _ in range(N) ])
print(min([ h[i+K-1]-h[i] for i in range(N-K+1) ]))
### BUGGY CODE ###

import numpy as np

N, M = map(int, input().split())
H = list(map(int, input().split()))
H.insert(0, 0)

A = np.zeros(M, dtype=int)
B = np.zeros(M, dtype=int)

for i in range(M):
    A[i], B[i] = map(int, input().split())
#print(A, B)

ans = 0
for j in range(1, N+1):
    ind = np.concatenate([[0], A[B==j], B[A==j]])
#    print(j, ind)
    if H[j] > max(list(map(lambda x: H[x], ind))):
        ans += 1
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
H = list(map(int, input().split()))
MaxHeight = [0]*n
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    MaxHeight[a] = max(MaxHeight[a], H[b])
    MaxHeight[b] = max(MaxHeight[b], H[a])
ans = 0
for h, mh in zip(H, MaxHeight):
    ans = ans + 1 if h > mh else ans
print(ans)
### BUGGY CODE ###

N=int(input())
V=list(map(int, input().split()))
C=list(map(int, input().split()))
a=[]
for i in range(1<<N):
    tmp=0
    for j in range(N):
        if ((i >> j) & 1) == 1:
          tmp+=V[j]-C[j]
    a.append(tmp)
print(max(a))

### FIXED CODE ###

N=int(input())
V=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for i in range(N):
    if V[i]-C[i]>0:
        a+=V[i]-C[i]
print(a)
### BUGGY CODE ###

import heapq
import collections
 
N,X,Y = (int(i) for i in input().split())
 
graph = collections.defaultdict(list)
# X->Yの経路を追加
graph[X].append((1,Y))
graph[Y].append((1,X))
# grpah[node_num] = [(cost,next_node_num)]
for i in range(1,N):
  graph[i].append((1,i+1))
  graph[i+1].append((1,i))
 
# ans[i] = 最短経路がiである個数
ans = [0] * (N-1)
# Node 1 ~ N Nodeまでをループ
for i in range(1,N+1):
  # priority_queue : (cost, node_num)
  priority_queue = [(0,i)]
  # 探索したnode
  checked_node = {}
 
  while priority_queue:
    (cost, node_num) = heapq.heappop(priority_queue)
    if node_num in checked_node:
      continue
    else:
      checked_node[node_num] = cost
      for next_cost,next_node_num in graph[node_num]:
        if next_node_num not in checked_node:
          heapq.heappush(priority_queue, (cost + next_cost, next_node_num))
  values = checked_node.values()
  c = collections.Counter(values)
  for k, v in c.items():
      if k != 0:
          ans[k - 1] += v
 
for a in ans:
  print(a//2)

### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import Counter

def update_distance(d, num, N):
    minn = num
    maxx = num
    # 要素数の小さい方に向けて
    while True:
        if minn > 0:
            minn -= 1
        else:
            break
        if d[minn] > d[minn+1] + 1:
            d[minn] = d[minn+1] + 1
        else:
            break
    # 要素数の大きいほうに向けて
    while True:
        if maxx < (N - 1):
            maxx += 1
        else:
            break
        if d[maxx] > d[maxx-1] + 1:
            d[maxx] = d[maxx-1] + 1
        else:
            break

(N, X, Y) = (int(i) for i in input().split())
X = X-1
Y = Y-1

# まずは経路情報をd[N][N]の二次元配列に格納
# (i, j)がつながっていれば1, つながってなければ2*10^3

d = []
for i in range(N):
    dd = []
    for j in range(N):
        dd.append(abs(i - j))
    d.append(dd)

# XとYがつながることで最短経路を修正していく
for i in range(N):
    dd = d[i]
    dd[X] = min(dd[X], dd[Y] + 1)
    dd[Y] = min(dd[Y], dd[X] + 1)
    update_distance(dd, X, N)
    update_distance(dd, Y, N)

# dの全リストを連結してあとは0~N-1までカウントする
d_list = []
for i in range(N - 1):
    d_list += d[i][i+1:]

#print(d_list)
c = Counter(d_list)

for i in range(1, N):
    if i in c:
        print(c[i])
    else:
        print(0)
### BUGGY CODE ###

N = int(input())
S = [[c for c in input()] for i in range(N)]
for i in range(len(S)):
    S[i].sort()
    S[i] = str(S[i])
wa = 0
for i in range(len(S)):
    for j in range(i+1,len(S)):
        if S[i] == S[j]:
            wa +=1
print(wa)

### FIXED CODE ###

N = int(input())
S = [[c for c in input()] for i in range(N)]
dic={}
for i in range(len(S)):
    S[i].sort()
    S[i] = str(S[i])
    if S[i] in dic:
        dic[S[i]] +=1
    else:
        dic[S[i]] = 1

comb=0
for i in dic.keys():
    if dic[i] !=0:
        comb = comb + dic[i]*(dic[i]-1)/2
print(int(comb))
### BUGGY CODE ###

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors


N = int(input())
A = map(int, raw_input().split())
C = [0 for j in range(N)]
ANS = []

for j in range(N, 0, -1):
    m = A[j-1]
    am = C[j-1] % 2
    if m != am:
        ANS.append(j)
        div = make_divisors(j)
        for k in div:
            if k != j:
                C[k-1] += 1

print(len(ANS))
str_ANS = [str(j) for j in ANS]
print(" ".join(str_ANS))


### FIXED CODE ###

N = int(input())
A = map(int, raw_input().split())
ANS = set()

for j in range(N, 0, -1):
    s = 0
    for k in range(j+j, N+1, j):
        if k in ANS:
            s += 1

    am = s % 2
    if A[j-1] != am:
        ANS.add(j)

print(len(ANS))
str_ANS = [str(j) for j in ANS]
print(" ".join(str_ANS))
### BUGGY CODE ###

n = int(input())
H = list(map(int, input().split()))

ans = 0
for i in range(n):
    pos_h = H[i]
    count = 0
    for j in range(i + 1, n):
        if H[j] <= pos_h:
            count += 1
            pos_h = H[j]
        else:
            break
    ans = max(ans, count)

print(ans)

### FIXED CODE ###

n = int(input())
H = list(map(int, input().split()))

ans = 0
i = 0
while i < n:
    pos_h = H[i]
    count = 0
    j = i + 1
    while j < n and H[j] <= pos_h:
        count += 1
        pos_h = H[j]
        j += 1

    ans = max(ans, count)
    i = j

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

from operator import itemgetter

def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    BC = []
    for i in range(M):
        bc = list(map(int, input().split()))
        BC.append(bc)

    BC.sort(key=itemgetter(1), reverse=True)
    B = []
    for b, c in BC:
        B = B + [c] * b
        if len(B) > N:
            break

    A.sort(reverse=True)
    
    i = 0
    j = 0
    r = [None] * N
    while i + j < N:
        if i == N:
            r[i+j] = B[j]
            j += 1
        elif j == len(B):
            r[i+j] = A[i]
            i += 1
        elif A[i] > B[j]:
            r[i+j] = A[i]
            i += 1
        else:
            r[i+j] = B[j]
            j += 1

    # print(r)
    ans = sum(r)
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

from operator import itemgetter

def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    BC = []
    for i in range(M):
        bc = list(map(int, input().split()))
        BC.append(bc)

    BC.sort(key=itemgetter(1), reverse=True)
    # B = []
    # for b, c in BC:
    #     B = B + [c] * b
    #     if len(B) > N:
    #         break

    A.sort(reverse=True)
    
    i = 0
    j = 0
    r = []

    cnt = 0
    while len(r) != N:
        # print(i, j)
        if j > M - 1:
            r.append(A[i])
            i += 1
            continue

        b, c = BC[j]
        if A[i] >= c:
            r.append(A[i])
            i += 1
        else:
            r.append(c)
            cnt += 1
            if cnt == b:
                j += 1
                cnt = 0

    # print(r)
    ans = sum(r)
    print(ans)


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

N,K = map(int,input().split())
A = list(map(int,input().split()))
L = 0
R = max(A)
while int(R)-int(L) > 0:
    X = (L+R)/2
    m = 0
    for i in range(N):
        c = A[i]/X
        if c == int(c):
            m += int(c) - 1
        else:
            m += int(c)
    if m <= K:
        R = X
    else:
        L = X
print(int(R)+1)


### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
L = 0
R = max(A)
while R-L > 0.001:
    X = (L+R)/2
    m = 0
    for i in range(N):
        c = A[i]/X
        if c == int(c):
            m += int(c) - 1
        else:
            m += int(c)
    if m <= K:
        R = X
    else:
        L = X
if int(R) - int(L) == 0:
    print(int(R)+1)
else:
    print(int(R))
### BUGGY CODE ###

N = int(input())
A = [int(i) for i in input().split()]
ans = 0
for j,a in enumerate(A):
  flag = True
  for i in range(len(A)):
    if i==j:
      pass
    elif a % A[i] == 0:
      flag = False
  if flag:
    ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
max_a = max(a)
cnt_d = [0] * (max_a + 1)
for ai in a:
    for multi in range(ai, max_a + 1, ai):
        cnt_d[multi] += 1
print(sum(cnt_d[ai] == 1 for ai in a))
### BUGGY CODE ###

import math
import sys
from collections import defaultdict
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
    
n, k = invr()
#A = invr()

A = [i for i in range(n + 1)]

res = 0
for cLen in range(k, n + 2):
	small = sum(A[:cLen])
	large = sum(A[-cLen:])
	res += large - small + 1

print res

### FIXED CODE ###

import math
import sys
from collections import defaultdict
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
    
n, k = invr()
#A = invr()

A = [i for i in range(n + 1)]

res = 0
small = sum(A[:k])
large = sum(A[-k:])
for cLen in range(k, n + 2):
	# print small, large
	res = (res +  large - small + 1 ) % (10 ** 9 + 7)
	if cLen != n + 1:
		small += A[cLen]
		large += A[-cLen - 1]

print res
### BUGGY CODE ###

input();a=list(map(int,input().split()))
print(sum([a.count(i) if (i-a.count(i))>(a.count(i)-i) else abs(i-a.count(i)) for i in set(a)]))

### FIXED CODE ###

from collections import Counter
input();a=Counter(list(map(int,input().split())))
print(sum([v if k>v else v-k for k,v in a.items()]))
### BUGGY CODE ###

n = int(input())
s = list(input())
r_pos = []
g_pos = []
b_pos = []

for i in range(n):
    st = s[i]
    if st == "R":
        r_pos.append(i)

    if st == "G":
        g_pos.append(i)

    if st == "B":
        b_pos.append(i)

colors = [r_pos, g_pos, b_pos]
if len(colors[0]) > len(colors[1]):
    colors[0], colors[1] = colors[1], colors[0]
if len(colors[0]) > len(colors[2]):
    colors[0], colors[2] = colors[2], colors[0]
if len(colors[1]) > len(colors[2]):
    colors[1], colors[2] = colors[2], colors[1]

x_num, y_num, z_num = len(colors[0]), len(colors[1]), len(colors[2])

ans = x_num * y_num * z_num
for a in colors[0]:
    for b in colors[1]:
        x, y = min(a, b), max(a, b)

        dif = y - x
        left_pos = x - dif
        right_pos = y + dif
        mid_pos = 4000
        if dif % 2 == 0:
            mid_pos = x + dif // 2

        left = 0
        right = 0
        mid = 0
        if left_pos in colors[2]:
            left = 1
        if right_pos in colors[2]:
            right = 1
        if mid_pos in colors[2]:
            mid = 1

        ans -= left + right + mid

print(ans)


### FIXED CODE ###

n = int(input())
s = list(input())
r_pos = []
g_pos = []
b_pos = []

for i in range(n):
    st = s[i]
    if st == "R":
        r_pos.append(i)

    if st == "G":
        g_pos.append(i)

    if st == "B":
        b_pos.append(i)

colors = [r_pos, g_pos, b_pos]
if len(colors[0]) > len(colors[1]):
    colors[0], colors[1] = colors[1], colors[0]
if len(colors[0]) > len(colors[2]):
    colors[0], colors[2] = colors[2], colors[0]
if len(colors[1]) > len(colors[2]):
    colors[1], colors[2] = colors[2], colors[1]

x_num, y_num, z_num = len(colors[0]), len(colors[1]), len(colors[2])

ans = x_num * y_num * z_num
c = set(colors[2])
for a in colors[0]:
    for b in colors[1]:
        x, y = min(a, b), max(a, b)

        dif = y - x
        left_pos = x - dif
        right_pos = y + dif
        mid_pos = 4000
        if dif % 2 == 0:
            mid_pos = x + dif // 2

        left = 0
        right = 0
        mid = 0
        if left_pos in c:
            left = 1
        if right_pos in c:
            right = 1
        if mid_pos in c:
            mid = 1

        ans -= left + right + mid

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

from collections import Counter



def main()->None:
    # a_iに１を足すか、１引くか、何もしないかの操作を行って、ある整数個数最大化をする
    # x を決めるとgreedyに決まる。
    # 最後の一つのサンプルがTLEになる。jit の使い方もよくわからん
    N = int(input())
    a = list(map(int, input().split()))
    a_dict = Counter(a)
    keys = a_dict.keys()
    max_count = 0
    for key in keys:
        tmp_count = a_dict[key]
        for i in keys:
            if key - 1 == i or key + 1 == i:
                tmp_count += a_dict[i]
        if tmp_count > max_count:
            max_count = tmp_count
    print(max_count)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys


def main()->None:
    N = int(sys.stdin.readline())
    a = list(map(int, sys.stdin.readline().split()))
    max_a = max(a)
    # print(max_a)
    l = [0 for _ in range(max_a+2)] # 配列の初期化、固定長、位置が配列の数字で要素がカウント
    for i in a:
        l[i] += 1
    res = 0
    for i in range(0, max_a+1):
        tmp = l[i-1]+l[i]+l[i+1]
        res = max(res, tmp)
    print(res)


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

from sys import stdin
input = stdin.readline

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

ans = "IMPOSSIBLE"

ls = [[] for m in range(M)]
for m in range(M):
    a,b = map(int,(input().split()))
    ls[m].append((a-1,b-1))
    
    if a-1 == 0 and b-1 == N-1:
        ans = "POSSIBLE"
    if a-1 == 0:
        ls[m].append("P")
    else:
        ls[m].append("I")

for m in range(M):
    if ls[m][1] == "P":
        for i in range(M):
            if ls[m][0][1] == ls[i][0][0] and ls[i][0][1] == N-1:
                ans = "POSSIBLE"

print(ans)

### FIXED CODE ###

from sys import stdin
input = stdin.readline

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

ans = "IMPOSSIBLE"

seta,setb = set(),set()
af,bf = [False]*M,[False]*M

for m in range(M):
    a,b = map(int,(input().split()))
    if a-1 == 0:
        af[m] = True
        seta.add(b-1)
    if b-1 == N-1:
        bf[m] = True
        setb.add(a-1)
    if af[m] and bf[m]:
        ans = "POSSIBLE"
        break
    
for a in seta:
    if ans == "POSSIBLE":
        break
    if a in setb:
        ans = "POSSIBLE"
        break

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

#coding:utf-8
import math
N,Y=map(int,input().split())
a=[float(x) for x in input().split()]
for b in range(Y):
  a.sort(reverse=True)
  a[0]=float(a[0])/2
v=0
for c in range(N):
  v=v+math.floor(a[c])
print(v)

  

### FIXED CODE ###

import heapq

N,M=( int(x) for x in input().split())
A=[int(s)*-1 for s in input().split()]

heapq.heapify(A)

for i in range(M):
    A_max=heapq.heappop(A)*-1
    heapq.heappush(A,(A_max//2)*-1)    
print(sum(A)*-1)
### BUGGY CODE ###

H,W = map(int,input().split())
Gd = [list(input()) for _ in range(H)]
L = [[0]*W for _ in range(H)]
R = [[0]*W for _ in range(H)]
U = [[0]*W for _ in range(H)]
D = [[0]*W for _ in range(H)]

for h in range(H):
  for w in range(W):
    if Gd[h][w]=='#':
      R[h][w]=0
    else:
      if w==0:
        R[h][w]=1
      else:
        R[h][w]=R[h][w-1]+1
    wr=W-w-1
    if Gd[h][wr]=='#':
      L[h][wr]=0
    else:
      if w==0:
        L[h][wr]=1
      else:
        L[h][wr]=L[h][wr+1]+1

for w in range(W):
  for h in range(H):
    if Gd[h][w]=='#':
      D[h][w]=0
    else:
      if h==0:
        D[h][w]=1
      else:
        D[h][w]=D[h-1][w]+1
    hr=H-h-1
    if Gd[hr][w]=='#':
      U[hr][w]=0
    else:
      if h==0:
        U[hr][w]=1
      else:
        U[hr][w]=U[hr+1][w]+1
ret = 0
for w in range(W):
  for h in range(H):
    ret = max(ret, D[h][w]+U[h][w]+R[h][w]+L[h][w]-3)
print(ret)

### FIXED CODE ###

import numpy as np
H,W = map(int,input().split())
HL=list(range(H))
WL=list(range(W))
Gd = np.array([list(input()) for _ in HL])
Gd = np.where(Gd=='.', 1, 0)
L=np.zeros((H,W),dtype=np.int64)
R=np.zeros((H,W),dtype=np.int64)
U=np.zeros((H,W),dtype=np.int64)
D=np.zeros((H,W),dtype=np.int64)

for w in WL:
  R[:,w]=(R[:,w-1]+1)*Gd[:,w]
  L[:,-w-1]=(L[:,-w]+1)*Gd[:,-w-1]
for h in HL:
  D[h,:]=(D[h-1,:]+1)*Gd[h,:]
  U[-h-1,:]=(U[-h,:]+1)*Gd[-h-1,:]
print(np.max(D+U+L+R-3))
### BUGGY CODE ###

import copy
import math

d,g = map(int,input().split())
P = []
C = []
for i in range(d):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)

m = 10**9

def score(point = 0, n = 0, now=0, done=[]):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: 
            m = n
    else:
        donecp = copy.copy(done)
        donecp.append(now)
        for i in range(d):
            if not i in donecp:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, donecp)

for i in range(d):
    done = []
    score(0,0,i,done)
print(m)

### FIXED CODE ###

import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*(P-1) >= g: return 1
    elif point+100*(now+1)*P + C[now] >= g: return 2
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    if m <= n: return
    elif now == -1:
        for i in remain:
            score(point, n, i, remain)
    elif point >= g: m = n
    elif flag(point,P[now],now) == 1:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    elif flag(point,P[now],now) == 2:
        n += P[now]
        if m > n: m = n
    else:
        if m <= n+P[now]: return
        else:
            remain = remain[:]
            remain.remove(now)
            nxtp = point + P[now]*100*(now+1) + C[now]
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)
### BUGGY CODE ###

s = input()

n = len(s)

res = [0]*n

for i in range(n):
	c = 0
	r = 0
	m = 0
	while True:
		if s[i+m] == 'R':
			r = 1
			m += 1
		else:
			if r:
				res[i+m-c%2] += 1
				break
			r = 0
			m += -1
		c += 1

print(' '.join(map(str, res)))

### FIXED CODE ###

s = input()

n = len(s)

res = [0]*n

swi = 'R'

r = [-1]*n
l = [-1]*n

for i in range(n):
	if s[i] == 'L':
		if l[i-1] == -1:
			l[i] = 0
		else:
			l[i] = l[i-1]+1

for i in reversed(range(n)):
	if s[i] == 'R':
		if r[i+1] == -1:
			r[i] = 0
		else:
			r[i] = r[i+1]+1
			
for i in range(n):
	if s[i] == 'L':
		res[i-l[i]-l[i]%2] += 1
	else:
		res[i+r[i]+r[i]%2] += 1

print(' '.join(map(str, res)))
### BUGGY CODE ###

import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
MOD = 10**9+7

N = int(input())
A = list(map(int,(input().split())))
b = [0]*N
for i in range(N):
    b[i] = format(A[i],"b")
one = [[0]*20 for _ in range(N)]
for i in range(N):
    for j in range(20):
        if j < len(list(b[i])):
            one[i][j] = int(b[i][-(j+1)])

sumone = [[0]*20 for _ in range(N+1)]
for j in range(20):
    for i in range(1,N+1):
        sumone[i][j] = sumone[i-1][j] + one[i-1][j]
sumone.append([2]*20)

def ok(l,r):
    for j in range(20):
        if sumone[r][j] - sumone[l][j] >= 2:
            return False
    else:
        return True

ans = 0
r = 0
for l in range(N+1):
    while r < N+2 and ok(l,r):
        if r != N+1:
            r += 1
    ans += r-l-1

print(ans)

### FIXED CODE ###

import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
MOD = 10**9+7

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

ans = 0
r = 0
sum = 0
xor = 0
for l in range(N):
    while r < N and sum+A[r] == xor^A[r]:
        sum += A[r]
        xor ^= A[r]
        r += 1
    sum -= A[l]
    xor ^= A[l]
    ans += r-l

print(ans)