Harryxun/stf_run huggingface dataset:
import math
l, r, p1, p2 = list(map(int, input().split()))
lcm = int(p1*p2 / math.gcd(p1, p2))
ans = (r-l+1) - (math.floor(r/p1)-math.ceil(l/p1)+1) - (math.floor(r/p2)-math.ceil(l/p2)+1) + math.floor(r/lcm)-math.ceil(l/lcm)+1
print(ans)


### FIXED CODE ###

import math
import fractions
l, r, p1, p2 = list(map(int, input().split()))
lcm = p1*p2 // fractions.gcd(p1, p2)
ans = (r-l+1) - (r//p1-(l-1)//p1) - (r//p2-(l-1)//p2) + (r//lcm)-(l-1)//lcm
print(ans)
n = int(input())
ans = n
l9 = [9**i for i in range(6,0,-1)]
l6 = [6**i for i in range(7,-1,-1)]
for i in range(n//9+1):
  x9 = i*9
  x61= n-x9
  csum = 0
  for x in l9:
    csum += x9//x
    x9 %= x
  for x in x61:
    csum += x61//x
    x61 %= x
  if ans > csum:
    ans = csum
print(ans)    

### FIXED CODE ###

n = int(input())
ans = n
l9 = [9**i for i in range(6,0,-1)]
l6 = [6**i for i in range(7,-1,-1)]
for i in range(n//9+1):
  x9 = i*9
  x61= n-x9
  csum = 0
  for x in l9:
    csum += x9//x
    x9 %= x
  for x in l6:
    csum += x61//x
    x61 %= x
  if ans > csum:
    ans = csum
print(ans)
from collections import deque
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
if 0:
    import random
    N=2*10**5
    A=[random.randrange(1,N+1) for i in range(N)]
    B=[random.randrange(1,N+1) for i in range(N)]
    A.sort()
    B.sort()
a=[0 for i in range(N+1)]
b=[0 for i in range(N+1)]
for i in range(N):
    a[A[i]]+=1
    b[B[i]]+=1
if max([a[i]+b[i] for i in range(1,N+1)])>N:
    print("No")
    exit()
print("Yes")
ans0=[0 for i in range(N)]
ans1=[0 for i in range(N)]
flag0=1
flag1=1
q=deque([])
for i in range(N):
    q.append(B[i])
for i in range(N):
    if q[0]==q[-1] and q[0]==A[i]:
        flag0=0    
        break
    if q[-1]==A[i]:
        ans0[i]=q.popleft()
    else:
        ans0[i]=q.pop()
q=deque([])
for i in range(N):
    q.append(B[i])
for i in range(N):
    if q[0]==q[-1] and q[0]==A[i]:
        flag1=0    
        break
    if q[0]==A[i]:
        ans1[i]=q.pop()
    else:
        ans1[i]=q.popleft()
if flag0:
    print(*ans0)
elif flag1:
    print(*ans1)
else:
    print([0][2])
exit()
if min([abs(A[i]-ans[i]) for i in range(N)])==0:
    print("NG")


### FIXED CODE ###

import random
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
a=[0 for i in range(N+1)]
b=[0 for i in range(N+1)]
for i in range(N):
    a[A[i]]+=1
    b[B[i]]+=1
if max([a[i]+b[i] for i in range(1,N+1)])<=N:
    print("Yes")
else:
    print("No")
    exit()
B=B[::-1]
point=0
for i in range(N):
    if A[i]==B[i]:
        point+=1
while(point>0):
    x=random.randrange(N)
    y=random.randrange(N)
    if x==y:
        continue
    before=0
    after=0
    if A[x]==B[x]:
        before+=1
    if A[y]==B[y]:
        before+=1
    if A[x]==B[y]:
        after+=1
    if A[y]==B[x]:
        after+=1
    if before>after:
        B[x],B[y]=B[y],B[x]
        point=point+after-before
print(*B)
import sys
 
a = []
for l in sys.stdin:
    if l == '\n' or l == '\r' or l == '\r\n':
        break
    else :
        a.append(l)
 
target = a[int(a[0])]
num = 0

sortedA = []

for i in a:
    sortedA.append(''.join(sorted(a[i])))
sortedA.pop(0)

for i in range(1, len(a) - 1):
    for j in range(i + 1, len(a)):
        flag = False
        if sortedA[i]==sortedA[j]:
            flag = True
        else:
            flag = False
        if flag:
            num = num + 1
print(num)

### FIXED CODE ###

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

a = i[0]
b = i[1]

plus = a + b
minus = a - b
add = a * b

list = [plus, minus, add]

flag = True
for l in list :
    if flag :
        box = l
        flag = False
    else :
        if l >= box :
            box = l
print(box)
import numpy as np
n,k=map(int,input().split())
h=np.array(map(int,input().split()))
c=[0]*n
for i in range(1,n):
  hn=h[i]
  c[i]=np.min(np.array([abs(h[i]-h[i-j])+c[i-j] for j in range(1,k+1) if i-j>=0]))
print(c[n-1])

### FIXED CODE ###

n, k = map(int, input().split())
hs = list(map(int, input().split()))
dp=[0]*n
dp[0]=0
for i, hi in enumerate(hs):
    if i == 0:
        continue
    s = max(0, i-k)
    dp[i] = min([ml + abs(hl - hi) for ml, hl in zip(dp[s:i], hs[s:i])])
print(dp[-1])
# B - Median Pyramid Easy
N,x = map(int,input().split())
if x==1 or x==2*N-1:
    print('No')
elif N==2:
    print('Yes')
    for x in num:
        print(x)
else:
    print('Yes')
    if x==2:
        num = num[4:]
        que = [3,2,1,4]
    else:
        num = list(range(1,2*N))
        que = []
        for _ in range(3):
            que.append(num.pop(x-2))
        que.append(num.pop(x-3))
    for i in range(2*N-1):
        if N-1<=i<=N+2:
            print(que.pop(0))
        else:
            print(num.pop(0))

### FIXED CODE ###

# B - Median Pyramid Easy
from collections import deque
N,x = map(int,input().split())
if x==1 or x==2*N-1:
    print('No')
elif N==2:
    print('Yes')
    for x in range(1,4):
        print(x)
else:
    print('Yes')
    if x==2:
        num = deque(list(range(5,2*N)))
        que = deque([3,2,1,4])
    else:
        num = deque(list(range(1,x-2))+list(range(x+2,2*N)))
        que = deque([x-1,x,x+1,x-2])
    for i in range(2*N-1):
        if N-2<=i<=N+1:
            print(que.popleft())
        else:
            print(num.popleft())
N = int(input()) #1行目を取得する
a = list(map(int,input().split()))
 
num = 0
exist_odd = True
while exist_odd:
  num += 1
  for i in range(N):      
    if a[i] % 2 == 0:
      a[i] /= 2
    else:
      exist_odd = False
else:
  print(num - 1)

### FIXED CODE ###

s = input()
a = [int(c) for c in s]
b = 0
for i in a:
  if i == 1:
    b += 1
 
print(b)
# AtCoder Regular Contest 080
# C - 4-adjacent

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

oddcount=0
mod40=0
other=0

for a in alist:
    if a%2==1:
        oddcount+=1
    elif a%4==0:
        mod40+=1
    else:
        other+=1

if N==1:
    if mod40==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
if N==2 or N==3:
    if mod40>0 or other==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
# ↑ここまではあってそう。

if N%2==1:
    if (N-((other//2)*2))//2 <= mod40:
        print("Yes")
        exit()
    else:
        print("No")
        exit()

else:
    print(np.array())

### FIXED CODE ###

# AtCoder Regular Contest 080
# C - 4-adjacent

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

oddcount=0
mod40=0
other=0

for a in alist:
    if a%2==1:
        oddcount+=1
    elif a%4==0:
        mod40+=1
    else:
        other+=1

if N==1:
    if mod40==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
if N==2 or N==3:
    if mod40>0 or other==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
# ↑ここまではあってそう。

if N%2==1:  # N>3 ,Nが奇数の時
    if (N-((other//2)*2))//2 <= mod40:
        print("Yes")
        exit()
    else:
        print("No")
        exit()

else:   # N>3 ,Nが偶数の時
    if other%2==1:  #かつ、要素が偶数である数が奇数の時  
        if (N-((other//2)*2))//2 <= mod40:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        if (N-((other//2)*2))//2 <= mod40:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
import itertools
 
N=int(input())
L=list(map(int,input().split()))
 
if len(L)<3:
    Lis=[]
    print(0)
elif Lis[0][0]==Lis[0][1] or Lis[0][0]==Lis[0][2] or Lis[0][1]==Lis[0][2]:
    Lis=[]
    print(0)
else:
    Lis=list(itertools.combinations(L,3))

numb=len(Lis)
count=0
 
for i in range(numb):
    if len(L)<3:
        break
 
    if Lis[i][0]==Lis[i][1] or Lis[i][0]==Lis[i][2] or Lis[i][1]==Lis[i][2]:
        pass
    else:
        bpc=Lis[i][1]+Lis[i][2]
        bmc=abs(Lis[i][1]-Lis[i][2])
        if bmc<Lis[i][0] and Lis[i][0]<bpc:
            count+=1
 
print(count)

### FIXED CODE ###

import itertools
 
N=int(input())
L=list(map(int,input().split()))

count=0

if len(L)<3:
    Lis=[]
else:
    Lis=list(itertools.combinations(L,3))
 
numb=len(Lis)

for i in range(numb):
    if len(L)<3:
        break
 
    if Lis[i][0]==Lis[i][1] or Lis[i][0]==Lis[i][2] or Lis[i][1]==Lis[i][2]:
        pass
    else:
        bpc=Lis[i][1]+Lis[i][2]
        bmc=abs(Lis[i][1]-Lis[i][2])
        if bmc<Lis[i][0] and Lis[i][0]<bpc:
            #if Lis[i][0]<bpc:
            count+=1
 
print(count)
N=int(input())
A=list(map(int,input().split()))

for i in range(N-1,0,-1) :
    if A[i-1]>A[i] :
        if A[i]<A[i+1] :
            continue
        A.pop(i)

if len(A)==1 :
    print(1000)
    exit()

n=len(A)
money=1000
kabu=0


for i in range(n-1) : 
    if i==n-2 :
        if A[i-1]<=A[i] :
            continue
        elif A[i-1]>A[i] :
            kabu+=money//A[i]
            money-=A[i]*(money//A[i])

    if A[i]<A[i+1] and money>=A[i] : #株を買う
        kabu+=money//A[i]
        money-=A[i]*(money//A[i])

    elif A[i]>A[i+1] and kabu>0 :    #株を売る
        if A[i+1]>=A[i+2] :          #下がり続けていれば何もしない
            continue
        elif A[i+1]<A[i+2] :
            money+=kabu*A[i]
            kabu=0

else :
    money+=kabu*A[n-1]
    print(money)
    

### FIXED CODE ###

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

money=1000
stock=0

for i in range(N-1) :
    if A[i]<A[i+1] :
        stock=money//A[i]
        money-=stock*A[i]
        money+=stock*A[i+1]

    else :
        continue

print(money)
import math

a = (int)input()
print(2*math.pi*a)

### FIXED CODE ###

import math

a = int(input())
print(2*a*math.pi)
S = input()

S = list(map(int, S.split()))

A = S[0]
B = S[1]

f = (A+B) / 2

if f.is_integer():
    print(int(f))
else:
    print(IMPOSSIBLE)


### FIXED CODE ###

S = input()

S = list(map(int, S.split()))

A = S[0]
B = S[1]

f = (A+B) / 2

if f.is_integer():
    print(int(f))
else:
    print("IMPOSSIBLE")
import numpy as np

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

a = np.array(list(map(int, input().split())))
lcm = np.lcm.reduce(a)

half_lcm = lcm / 2
ans = 0
flg = False
while True:
    if not sum((half_lcm * 2) % a):
        flg = True
        break

    half_lcm += lcm
    if half_lcm > m:
        break

if flg:
    ans = (m - half_lcm) // lcm + 1

print(int(ans))

### FIXED CODE ###

import functools
import sys

n, m = map(int, input().split())
a = list(map(lambda x: x // 2, map(int, input().split())))

# A[0]を素因数分解して2で割り切れる回数を数える
div = 0

a_0 = a[0]
while a_0 % 2 == 0:
    a_0 /= 2
    div += 1

# print("count = " + str(div))#

# Aのすべての整数がA[0]と同じ回数2で割り切れるか調べる
for i in range(1, len(a)):
    div2 = 0
    tmp_a = a[i]
    while tmp_a % 2 == 0:
        tmp_a /= 2
        div2 += 1
    # print("A[" + str(i) + "] count = " + str(div2))#
    if div2 != div:
        print("0")
        sys.exit()


def gcd(x, y):
    if x == 0:
        return y

    return gcd(y % x, x)


def least_common_multiple(iter):
    '''
    最小公倍数を返す
    '''
    lcm = lambda x, y: x * y // gcd(x, y)
    return functools.reduce(lcm, iter)


lc = least_common_multiple(a)
ans = 0
a = 1

ans = m // lc
if ans == 0:
    print(0)
    sys.exit()
if ans % 2 == 0:
    print(ans // 2)
else:
    print(ans // 2 + 1)
import math
a,b=map(int,input().split())
c=[list(map(int,input().split())) for i in range(a-1)]
d=[[]for i in range(a)]
for i in range(a-1):
  ca=c[i][0]
  cb=c[i][1]
  d[ca-1].append(cb-1)
  d[cb-1].append(ca-1)
g=[0 for i in range(a)]
def s(i,d,g):
  g[i]=1
  global e
  global bb
  f=1
  h=len(d[i])
  if i==0:
    for j in range(h):
      f=f*(b-1-j)
  else:
    if h>0:
      for j in range(h-1):
        f=f*(b-2-j)
  e=(e*f)%1000000007
  for j in range(h):
    if g[d[i][j]]==0:
      s(d[i][j],d,g)
  return

e=b
s(0,d,g)
print(e%1000000007)
  

### FIXED CODE ###

from collections import deque
a,b=map(int,input().split())
c=[list(map(int,input().split())) for i in range(a-1)]
d=[[]for i in range(a)]
for i in range(a-1):
  ca=c[i][0]
  cb=c[i][1]
  d[ca-1].append(cb-1)
  d[cb-1].append(ca-1)
g=[0 for i in range(a)]
q=deque()
q.append(0)
e=b
while len(q):
  i=q.pop()
  h=len(d[i])
  g[i]=1
  if i==0:
      f=b-1
  else:
    f=b-2
  g[i]=1
  for j in range(h):
    if g[d[i][j]]==0:
      q.append(d[i][j])
      e=(e*f)%1000000007
      f-=1


print(e%1000000007)
A, B, C, D = map(int, input().split())

Thit = A
Tatk = B
Ahit = C
Aatk = D
win = False

while Thit <= 0 or Ahit <= 0:
    Ahit = Ahit - Tatk
    if Ahit <= 0:
        win = True
        break
    Thit = Thit - Aatk
    if Thit <= 0:
        break

if win:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import math
#数値ひとつ
#I = int(input())
#数値欲しいとき
N, M = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
#受け取る数が未定かつリストにしたいとき
#list = list(map(int, input().split()))

if N>M:
    print('safe')
else:
    print('unsafe')
mod = 998244353
n = int(input())
d = list(map(int,input().split()))
if d[0]!=0 or d[1:].count(0)!=0:
  print(0)
  exit()
l = [0 for i in range(n-1)]
for i in d:
  l[i] += 1
cou = 1
for i in l:
  if i!=0:
    cou *= (i%mod)
print(cou%mod)

### FIXED CODE ###

mod = 998244353
n = int(input())
d = list(map(int,input().split()))
if d[0]!=0 or d[1:].count(0)!=0:
  print(0)
  exit()
l = [0 for i in range(n)]
for i in d:
  l[i] += 1
cou = 1
if 0 in l:
  a = l.index(0)
  if sum(l[a:])!=0:
    print(0)
    exit()
for i in range(n-2):
  if l[i+1]!=0:
    a = l[i]
    b = l[i+1]
    cou *= (a**b)%mod
print(cou%mod)
import numpy as np

N = int(input())
A = np.array([int(a) for a in input().split()])
ans = sum(A)
lst = np.zeros(10**5)
for a in A:
    lst[a] += 1
   
for q in range(int(input())):
    B,C = map(int,input().split())
    ans += (C - B) * lst[B]
    print(int(ans))
    lst[C] += lst[B]
    lst[B] = 0


### FIXED CODE ###

import numpy as np

N = int(input())
A = np.array([int(a) for a in input().split()])
ans = sum(A)
lst = np.zeros(10**5+1)
for a in A:
    lst[a] += 1
   
for q in range(int(input())):
    B,C = map(int,input().split())
    ans += (C - B) * lst[B]
    print(int(ans))
    lst[C] += lst[B]
    lst[B] = 0
N, M = map(int, input().split())
s = [list(map(int, input().spllit()))[1:] for i in range(M)]
p = list(map(int, input().split()))
total = 0
j = 0
for i in range(2 ** N):
  now = format(i, '010b')
  for k in range(M):
    tmp = 0
    for l in s[k]:
      tmp += int(now[-l])
    if tmp % 2 == p[k]:
      j += 1
  if j == M:
    total += 1
  j = 0
print(total)


### FIXED CODE ###

n, m = map(int, input().split())
switch = []
for i in range(m):
    switch.append(list(map(int, input().split())))
p = list(map(int, input().split()))

ans = 0
for i in range(2**n):
    i = format(i, "0{}b".format(n))
    flag = 1
    for j in range(m):
        count = 0
        for k in range(switch[j][0]):
            if i[switch[j][k+1]-1] == "1":
                count += 1
        if count % 2 == p[j]:
            continue
        else:
            flag = 0
            break
    if flag == 1:
        ans += 1
print(ans)
N,K = list(map(int,input().split()))
sys.setrecursionlimit(10**10) 
A = input()
A = list(A)
A = list(map(int,A))
def serch_right(x,K,t):
    global count0,count1
    if x<0 or len(A)<=x:
        return count1
    if A[x]==0:
        if t == 0:
            t=0
            count1 +=1
        elif t==1 :
            if count0==K:
                return count1
            t=0
            count1 +=1
            count0 +=1
            
    else:
        t=1
        count1+=1
    count1 = serch_right(x+1,K,t)
    return count1
def serch_left(x,A):
    global count2
    if x<0 or len(A)<=x or A[x]==0:
        return count2
    if A[x]==1:
        count2 +=1
    count2 = serch_left(x-1,A)     
    return count2
count =0
count0 =0
count1 =0
for i in range(len(A)):
    if A[i]==0 and (A[i-1]!=0 or i == 0):
        count2 = 0
        count1 =0
        count0 =0
        t = 1
        count1 = serch_right(i,K,t)
        count2 = serch_left(i-1,A)
        count1 = count1 + count2
        count = max(count1,count)
print(max(count,1))

### FIXED CODE ###

N,K = list(map(int,input().split()))
A = input()
A = list(A)
A = list(map(int,A))
l = [0]
s = []

for i in range(N-1):
    if A[i] != A[i+1]:
        l.append(i+1)
        s.append(l[len(l)-1]-l[len(l)-2])
l.append(N)
s.append(l[len(l)-1]-l[len(l)-2])
a = 0
right = 0
left = 0
g = 0
su = 0
if A[0] == 0:
    for i in range(len(s)):
        su +=s[right]
        if right%2==0:
            g += 1
        right +=1
        if g<=K:
            a = max(a,su)
        else:
            while g>K:
              su -= s[left]
              if left%2==0:
                  g -=1
              left +=1
        a = max(a,su)
else:
    for i in range(len(s)):
        su +=s[right]
        if right%2==1:
            g += 1
        right +=1
        if g<=K:
            a = max(a,su)
        else:
            while g>K:
              su -= s[left]
              if left%2==1:
                  g -=1
              left +=1
        a = max(a,su)

print(a)
k, x = map(int, input().split())

n = k * 500

if n = > x:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

k, x = map(int, input().split())

n = k * 500

if n >= x:
  print('Yes')
else:
  print('No')
A = input()
B = input()
C = input()
D = input()

volume1 = A * B
volume2 = C * D

if volume1 > volume2:
    print(volume1)
else:
    print(volume2)

### FIXED CODE ###

A, B, C, D = map(int,input().split())

volume1 = A * B
volume2 = C * D

if volume1 > volume2:
    print(volume1)
else:
    print(volume2)
n,m=map(int,input().split())
S=[]
for m in range(m):
  s=list(map(int,input().split()))
  S.sppend(s[1:])
p=list(map(int,input().split()))

ans=0
for i in range(1<<n):
  for k in range(m):
    sw=0
    for j in range(n):
      if (i>>j)&1==0 and j+1 in S[k]:
        sw+=1
    if se%2!=p[k]:
      break
  else:
    ans+=1
print(ans)



### FIXED CODE ###

N,M=map(int,input().split())
s=[list(map(int,input().split()))[1:] for m in range(M)]
p=list(map(int,input().split()))
count=0
for i in range(1<<N):
    for m in range(M):
        switch=0
        for j in range(N):
            if (i>>j)&1 and j+1 in s[m]:
                switch+=1
        if switch%2!=p[m]:
            break
    else:
        count+=1
print(count)
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

MOD = (1 << 61) - 1
mod_pow = [1] * (10**5 * 5 + 10)
base = 1009

for i in range(10**5 * 5 + 9):
    mod_pow[i+1] = mod_pow[i] * base % MOD

class RollingHash():
    def __init__(self, s):
        self.length = len(s)
        self.base = 1009
        self.mod = (1 << 61) - 1
        self.hash = [0] * (self.length + 2)

        for i in range(self.length):
            self.hash[i+1] = (self.hash[i] + ord(s[i])) * self.base % self.mod

    def get(self, l, r):
        t = self.hash[r] - self.hash[l] * mod_pow[r-l] % self.mod
        return t % self.mod

ss = []
n = int(input())
for _ in range(n):
    ss.append(input().rstrip())
ss.sort(key=lambda x: len(x), reverse=True)

words = dict()
ans = 0
orda = ord("a")
for s in ss:
    word_len = len(s)
    s_rev = s[::-1]
    RH = RollingHash(s_rev)
    rh = RH.get(0, word_len-1)
    if rh in words:
        ans += words[rh][ord(s_rev[-1]) - orda]
    initial = set()
    for i, ch in enumerate(s):
        initial.add(ord(ch) - orda)
        for key in initial:
            rh = RH.get(0, word_len-i-1)
            if rh in words:
                words[rh][key] += 1
            else:
                words[rh] = [0] * 26
                words[rh][key] += 1
print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
import sys
input = sys.stdin.readline
from collections import defaultdict

def empty_list():
    return [0] * 26

class RollingHash():
    def __init__(self, s):
        length = len(s)
        base = 1009
        # self.mod = (1 << 61) - 1
        self.mod = 67280421310721
        self.hash = [0] * (length + 2)
        self.pow = [1] * (length + 2)

        for i in range(length):
            self.hash[i+1] = (self.hash[i] + s[i]) * base % self.mod
            self.pow[i+1] = self.pow[i] * base % self.mod
        self.pow[length+1] = self.pow[length] * base % self.mod 

    def get(self, l, r):
        t = self.hash[r] - self.hash[l] * self.pow[r-l] % self.mod
        return t % self.mod

ss = []
n = int(input())
for _ in range(n):
    ss.append([ord(item) for item in input().rstrip()])
ss.sort(key=lambda x: len(x), reverse=True)

orda = ord("a")
words = defaultdict(empty_list)
ans = 0
for s in ss:
    word_len = len(s)
    s_rev = s[::-1]
    RH = RollingHash(s_rev)
    rh = RH.get(0, word_len-1)
    ans += words[rh][s_rev[-1] - orda]
    initial = [0] * 26 
    for i, ch in enumerate(s):
        initial[ch - orda] = 1
        for j, is_initial in enumerate(initial):
            if is_initial:
                rh = RH.get(0, word_len-i-1)
                words[rh][j] += 1
print(ans)
N, M, C = map(int, input().split())
B=list(map(int, input().split))


### FIXED CODE ###

N,M,C=map(int,input().split())
B=list(map(int,input().split()))
count=0
for i in range(N):
    A=list(map(int,input().split()))
    p=C
    for j in range(M):p+=A[j]*B[j]
    if p>0:count+=1
print(count)
l=["".join(i) for i in itertools.permutations("abc")]
if input() in l:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import itertools
l=["".join(i) for i in itertools.permutations("abc")]
if input() in l:
  print("Yes")
else:
  print("No")
from collections import defaultdict

root = 10000
MOD = 2 ** 61 - 1
def rolling_hash(s):
    hs = [0] * (len(s) + 1)
    for i in range(len(s)):
        hs[i + 1] = hs[i] * root + ord(s[i]) % MOD
    return hs

#"""
N = int(input())
S_list = [input() for _ in range(N)]
"""
def to_alpha(n):
    ret = ''
    while n > 0:
        n -= 1
        ret += chr(n % 26 + ord('a'))
        n //= 26
    return ret

N = 10 ** 5
S_list = [to_alpha(i) for i in range(2, 2 * N + 2, 2)]
#"""


S_list.sort(key=len)

ans = 0
wanted = {chr(i): set() for i in range(ord('a'), ord('z') + 1)}
for S in S_list:
    alpha_set = set()
    hash_of_S = rolling_hash(S)
    for i in range(len(S)):
        alpha_set.add(S[i])
        suffix_hash = (hash_of_S[len(S)] - hash_of_S[i+1] * pow(root, (len(S) - i - 1), MOD)) % MOD
        for alpha in alpha_set:
            if suffix_hash in wanted[alpha]:
                ans += 1

    suffix_of_S = (hash_of_S[len(S)] - hash_of_S[1] * pow(root, (len(S) - 1), MOD)) % MOD
    wanted[S[0]].add(suffix_of_S)

print(ans)


### FIXED CODE ###

N = int(input())

two_fives = []
mapping = [[0] * 19 for _ in range(19)]
ans = 0
for _ in range(N):
    s = input()
    if '.' in s:
        m, x = s.split('.')
        A = int(m) * 10 ** 9 + int(x.ljust(9, '0'))
    else:
        A = int(s) * 10 ** 9

    for two in range(19):
        if A % 2 == 0:
            A //= 2
        else:
            break
    for five in range(19):
        if A % 5 == 0:
            A //= 5
        else:
            break
        
    two_fives.append((two, five))
    mapping[18 - two][18 - five] += 1
    if two >= 9 and five >= 9:
        ans -= 1 # excluding ai * ai

for i in range(18):
    for j in range(19):
        mapping[i+1][j] += mapping[i][j]

for i in range(19):
    for j in range(18):
        mapping[i][j+1] += mapping[i][j]


for two, five in two_fives:
    ans += mapping[two][five]

#print(ans)
ans //= 2
print(ans)
N = int(input())
a = list(map(int,(input().split())))
list_a = [0]*2*100000
for i in a:
  list_a[i] += 1
for i in range(1,N+1):
  print(list_a[i])

### FIXED CODE ###

N = int(input())
a = list(map(int,(input().split())))
list_a = [0]*2*100001
for i in a:
  list_a[i] += 1
for i in range(1,N+1):
  print(list_a[i])
N = int(input())
A = tuple(map(int,input().split()))
R = 0
L = tuple()
for i in range(N):
    if i == 0:
        L = (True,) * N
    else:
        L = (L[j] and A[j]^A[i+j] == A[j]+A[i+j] and L[j+1] for j in range(N-i)) + (False,) * i 
    R += sum(L)
    if sum(L) == 0:
        break
print(R)

### FIXED CODE ###

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

result = 0
Right = 0
tmp = 0
for left in range(N):
    for right in range(Right,N):
        if not (tmp & A[right]):
            tmp += A[right]
            Right = right + 1
        else:
            break
    tmp -= A[left]
    result += Right - left
print(result)