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

import sys

N = int(sys.stdin.readline())
L = tuple([int(x) for x in sys.stdin.readline().split()])

def tri_able(x, y, z):
    if x+y > z and y+z > x and z+x > y:
        return True
    else:
        return False

answer = 0

for i in range(len(L)-2):
    for j in range(i+1, len(L)-1):
        for k in range(j+1,len(L)):
            answer += int(tri_able(L[i], L[j], L[k]))
print(answer)


### FIXED CODE ###

import sys
import bisect

N = int(sys.stdin.readline())
L = [int(x) for x in sys.stdin.readline().split()]
L.sort()

answer = 0

for i in range(len(L)-2):
    for j in range(i+1, len(L)-1):
        answer += bisect.bisect_left(L, L[i]+L[j])-j-1

print(answer)
### BUGGY CODE ###

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

ans = 0
for c in range(1, N):
    a = 0
    se = set(list(range(N)))
    for i in range(1, (N-1)//c):
        if i*c not in se or N-1-i*c not in se or i*c == N-1-i*c:
            break
        se.remove(i*c)
        se.remove(N-1-i*c)
        a += S[i*c] + S[N-1-i*c]
        ans = max(ans, a)
print(ans)

### FIXED CODE ###

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

ans = 0
for c in range(1, N):
    a = 0
    if (N-1) % c:
        for i in range(1, (N-1)//c):
            a += S[i*c] + S[N-1-i*c]
            ans = max(ans, a)
    else:
        se = set(list(range(N)))
        for i in range(1, (N-1)//c):
            if i*c not in se or N-1-i*c not in se or i*c == N-1-i*c:
                break
            se.remove(i*c)
            se.remove(N-1-i*c)
            a += S[i*c] + S[N-1-i*c]
            ans = max(ans, a)
print(ans)
### BUGGY CODE ###

K = int(input())
N = 7 % K
i = 1
modl = [N]
ret = -1
while True:
  if N == 0:
    ret = i
    break
  N = ((N * 10) % K + 7 )% K
  if N in modl:
    break
  modl.append(N)
  i += 1
print(ret)

### FIXED CODE ###

K = int(input())
i = 1
ret = -1
if K % 5 != 0 and K % 2 != 0:
  N = 10
  if K % 7 == 0:
    L = K * 9 // 7
  else:
    L = K * 9
  while True:
    if N % L == 1:
      ret = i
      break
    N = (N * 10 )% L
    i += 1
print(ret)
### BUGGY CODE ###

def light(s,i,j):
    res=1
    k=0
    while i-k-1>=0 and not s[i-k-1][j]:
        k+=1
    res+=k
    k=0
    while i+k+1<=H-1 and not s[i+k+1][j]:
        k+=1
    res+=k
    k=0
    while j-k-1>=0 and not s[i][j-k-1]:
        k+=1
    res+=k
    k=0
    while j+k+1<=W-1 and not s[i][j+k+1]:
        k+=1
    res+=k
    return res

H,W=map(int,input().split())
s=[]
for i in range(H):
    si=[]
    Si=input()
    for j in range(W):
        si.append(Si[j]=='#')
    s.append(si)

ans=0
for i in range(H):
    for j in range(W):
        if not s[i][j]:
            ans=max(ans,light(s,i,j))

print(ans)

### FIXED CODE ###

H,W=map(int,input().split())
s=[]
for i in range(H):
    si=[]
    Si=input()
    for j in range(W):
        si.append(Si[j]=='.')
    s.append(si)

# 左に照らした場合 行ごとに見てゆく
L=[[0 for j in range(W)] for i in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and s[i][j]:
            L[i][j]=1
        elif s[i][j]:
            L[i][j]=L[i][j-1]+1

# 右に照らした場合 行ごとに見てゆく
R=[[0 for j in range(W)] for i in range(H)]
for i in range(H):
    for j in reversed(range(W)):
        if j==W-1 and s[i][j]:
            R[i][j]=1
        elif s[i][j]:
            R[i][j]=R[i][j+1]+1

# 上に照らした場合 列ごとに見てゆく
U=[[0 for j in range(W)] for i in range(H)]
for j in range(W):
    for i in range(H):
        if i==0 and s[i][j]:
            U[i][j]=1
        elif s[i][j]:
            U[i][j]=U[i-1][j]+1

# 下に照らした場合 列ごとに見てゆく
D=[[0 for j in range(W)] for i in range(H)]
for j in range(W):
    for i in reversed(range(H)):
        if i==H-1 and s[i][j]:
            D[i][j]=1
        elif s[i][j]:
            D[i][j]=D[i+1][j]+1

ans=0
for i in range(H):
    for j in range(W):
        ans=max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

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

from itertools import combinations
N=int(input())
l1=list(map(int,input().split()))
l2=tuple(combinations(l1,2))
l3=[sum(i) for i in l2 if sum(i)<=max(l1)]
ans=len(tuple(combinations(l1,3)))
for i in l3:
  for j in l1:
    if i<=j:
      ans-=1
print(ans)

### FIXED CODE ###

import bisect
N=int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(1,N-1):
  for j in range(i+1,N):
    m=bisect.bisect_right(l,l[j]-l[i])
    if i>m:
      ans+=i-m
print(ans)
### BUGGY CODE ###

H,W,D=map(int,input().split())
A=[]
for i in range(H):
    a=list(map(int,input().split()))
    A.append(a)
Q=int(input())
L=[]
R=[]

lst=[[]for _ in range(H*W+1)]
for i in range(H):
    for j in range(W):
        lst[A[i][j]].append(i)
        lst[A[i][j]].append(j)
#print(lst)
#print(lst[1][1])
d=[]
for i in range(D):

    if i==0:
        tmp=D
        cnt=[0]*(H*W+1)
        sx=lst[tmp][0]
        sy=lst[tmp][1]
        cnt[tmp]=0
    else:
        tmp=i
        cnt=[0]*(H*W+1)
        #print(tmp)
        sx=lst[tmp][0]
        sy=lst[tmp][1]
        cnt[i]=0
    while(1):
        sx=lst[tmp][0]
        sy=lst[tmp][1]
        tmp=tmp+D
        #print(tmp)
        #この段階？
        #1週目で超える場合
        if tmp>(H*W):
            break
        x=lst[tmp][0]
        y=lst[tmp][1]
        val=abs(sx-x)+abs(sy-y)
        cnt[tmp]=cnt[tmp-D]+val
        if (tmp+D)>(H*W):
            break
    d.append(cnt)
ans=[]
#print(cnt)
#print(d)
for i in range(Q):
    l,r=map(int,input().split())
    ll=l%D
    count=d[ll]
    #print(count)
    vall=count[l]
    valr=count[r]
    val=valr-vall
    #print(val)
    ans.append(val)

for i in range(Q):
    print(ans[i])


### FIXED CODE ###

H,W,D=map(int,input().split())
A=[]
for i in range(H):
    a=list(map(int,input().split()))
    A.append(a)
Q=int(input())
L=[]
R=[]

lst=[[]for _ in range(H*W)]
for i in range(H):
    for j in range(W):
        lst[A[i][j]-1].append(i)
        lst[A[i][j]-1].append(j)
#print(lst)
#print(lst[1][1])
d=[]
for i in range(D):
    cnt=[0]
    for j in range(i+D,H*W,D):
        cnt.append(cnt[-1]+abs(lst[j][0]-lst[j-D][0])+abs(lst[j][1]-lst[j-D][1]))
    d.append(cnt)
ans=[]
#print(cnt)
#print(d)
for i in range(Q):
    l,r=map(int,input().split())
    ll=(l-1)%D
    count=d[ll]
    r-=1
    l-=1
    #print(count)
    vall=count[l//D]
    #print(l//D)
    #print(r//D)
    valr=count[r//D]
    val=valr-vall
    #print(val)
    ans.append(val)

for i in range(Q):
    print(ans[i])
### BUGGY CODE ###

def initialize(N):
    i=1
    while i<N:
        i*=2
    return [0]*(2*i-1),i

def update(i,x):
    i+=d-1
    bit=ord(x)-97
    SEG[i]=0 | (1<<bit)
    while i>0:
        i=(i-1)//2
        SEG[i]=SEG[i*2+1]|SEG[i*2+2]
        
def find(a,b,k,l,r):
    if r<=a or b<=l:
        return 0
    if a<=l and r<=b:
        return SEG[k]
    else:
        c1=find(a,b,2*k+1,l,(l+r)//2)
        c2=find(a,b,2*k+2,(l+r)//2,r)
        return c1|c2
        
N=int(input())
S=input()
Q=int(input())

SEG,d=initialize(N)
for i in range(N):
    update(i,S[i])

for i in range(Q):
    com,s,t=map(str,input().split())
    if(com=='1'):
        update(int(s)-1,t)
    else:
        cnt=0
        bit=find(int(s)-1,int(t),0,0,d)
        while(bit>0):
            if(bit&1):
                cnt+=1
            bit//=2
        print(cnt)

### FIXED CODE ###

def initialize(N):
    i=1
    while i<N:
        i*=2
    return [0]*(2*i-1),i

def update(i,x):
    i+=d-1
    bit=ord(x)-97
    SEG[i]=0 | (1<<bit)
    while i>0:
        i=(i-1)//2
        SEG[i]=SEG[i*2+1]|SEG[i*2+2]
        
def find(a,b,k,l,r):
    if r<=a or b<=l:
        return 0
    if a<=l and r<=b:
        return SEG[k]
    else:
        c1=find(a,b,2*k+1,l,(l+r)//2)
        c2=find(a,b,2*k+2,(l+r)//2,r)
        return c1|c2
        
N=int(input())
S=input()
Q=int(input())

SEG,d=initialize(N)
for i in range(N):
    update(i,S[i])

for i in range(Q):
    com,s,t=map(str,input().split())
    if(com=='1'):
        update(int(s)-1,t)
    else:
        cnt=0
        bit=find(int(s)-1,int(t),0,0,d)
        while(bit>0):
            if(bit&1):
                cnt+=1
            bit//=2
        print(cnt)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = 0
AA = [i for i in A if A.count(i)>=2]

AAA =sorted(set(AA))

#長方形を調べる
if len(AAA) >= 2:
    ans = AAA[-1]*AAA[-2]

#正方形を調べる
for i in AAA:
    if AA.count(i) >=4:
        ans =max(ans, i**2)
        
print(ans)

### FIXED CODE ###

import collections
N = int(input())
A = collections.Counter(list(map(int, input().split())))
seihou = []
tyouhou = []
ans = 0

for i in A.keys():
    if A[i] >= 2:
        tyouhou.append(i)
    if A[i] >= 4:
        seihou.append(i)

if len(seihou) >= 1:
    ans = max(seihou)**2

if len(tyouhou) >= 2:
    c = max(tyouhou)
    tyouhou.remove(c)
    ans = max(ans, c*max(tyouhou))
print(ans)
### BUGGY CODE ###

# 整数の入力
import numpy as np
import sys
x=200000
sys.setrecursionlimit(x)

N = int(input())
S = input()


def check_condition(S):
    N = len(S)
    ind = np.where(S=="R")[0]
    if len(ind) == 0 or len(ind) == N:
        return True
    
    if np.max(ind) == len(ind) - 1:
        return True
    
    return False

def action(S):
    W_index = np.where(S=="W")[0][0]
    R_index = np.where(S=="R")[0][-1]
    S[W_index] = "R"
    S[R_index] = "W"
    return S

def alter(S, M):
    if check_condition(S):
        return M
    
    S = action(S)
    
    return alter(S, M+1)

S = np.array(list(S))
print(alter(S,0))

### FIXED CODE ###

# 整数の入力
import numpy as np

N = int(input())
S = input()


def check_condition(S):
    N = len(S)
    ind = np.where(S=="R")[0]
    if len(ind) == 0 or len(ind) == N:
        return True
    
    if np.max(ind) == len(ind) - 1:
        return True
    
    return False

def alter(S):
    if check_condition(S):
        return 0
    ind = np.where(S=="R")[0]
    num_r = len(ind)
    num_offset = np.sum(ind > num_r - 1)
    return num_offset

S = np.array(list(S))
print(alter(S))
### BUGGY CODE ###

from itertools import combinations


def check(l):
    for i in range(3):
        a = l[i % 3]
        b = l[(i + 1) % 3]
        c = l[(i + 2) % 3]
        if a >= b + c:
            return False
    return True


n = int(input())
l = list(map(int , input().split()))
cnt = 0
for v in combinations(l, 3):
    if check(v):
        cnt += 1
print(cnt)

### FIXED CODE ###

from bisect import bisect_left


n = int(input())
l = list(map(int, input().split()))
l.sort()
cnt = 0
for i in range(n-2):
    a = l[i]
    for j in range(i+1, n-1):
        b = l[j]
        cnt += bisect_left(l, a+b) - j - 1
        # bisec_left(l, x)でlの中にxを挿入できる点を探す
print(cnt)
### BUGGY CODE ###

import sys
from collections import deque
input = sys.stdin.readline
h, w = [int(x) for x in input().strip().split()]
g = [[x for x in list(input().strip())] for _ in range(h)]

ans = -1
q = []
for i in range(h):
    for j in range(w):
        if g[i][j] == '#':
            q.append((i, j))
vec = [(0, 1), (1, 0), (0, -1), (-1, 0)]
while q:
    q_ = deque(q)
    q = deque([])
    ans += 1
    while q_:
        i, j = q_.pop()
        for x, y in vec:
            ti, tj = i+x, j+y
            if 0 <= ti < h and 0 <= tj < w:
                if g[ti][tj] == '.':
                    g[ti][tj] = '#'
                    q.append((ti, tj))
print(ans)

### FIXED CODE ###

import sys
from collections import deque
input = sys.stdin.readline
h, w = [int(x) for x in input().strip().split()]
g = [[x for x in list(input().strip())] for _ in range(h)]

ans = -1
q = []
for i in range(h):
    for j in range(w):
        if g[i][j] == '#':
            q.append((i, j))
vec = [(0, 1), (1, 0), (0, -1), (-1, 0)]
while q:
    q_ = deque(q)
    q = deque([])
    ans += 1
    while q_:
        i, j = q_.pop()
        for x, y in vec:
            ti, tj = i+x, j+y
            if 0 <= ti < h and 0 <= tj < w:
                if g[ti][tj] == '.':
                    g[ti][tj] = '#'
                    q.append((ti, tj))
print(ans)
### BUGGY CODE ###

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

AB.sort(key=lambda x: x[1], reverse=True)

s = [0] * (M + 1)
s[0] = 1
ret = 0
for a, b in AB :
    while a <= M :
        if s[a] == 0 :
            s[a] = 1
            ret += b
            break
        a += 1
print(ret)

### FIXED CODE ###

from heapq import heappush, heappop

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

for _ in range(N) :
    a, b = map(int, input().split())
    if a <= M :
        AB[M-a].append(b)
    
q = []
for a in range(M+1) :
    for b in AB[a] :
        heappush(q, b)
        if len(q) > a + 1 :
            heappop(q)
            
print(sum(q))
### BUGGY CODE ###

inf = 10**16
N = int(input())
A = list(map(int, input().split()))
dp0=[[-inf]*(2+N//2) for _ in range(N+1)]
dp1=[[-inf]*(2+N//2) for _ in range(N+1)]
dp0[0][0] = 0

for i, x in enumerate(A):
    j = i//2
    for n in (j, j + 1):
        dp0[i+1][n] = max(dp0[i][n], dp1[i][n])
        dp1[i+1][n] = dp0[i][n - 1] + x
    #print(dp0)
    #print(dp1)

print(max(dp0[N][N//2], dp1[N][N//2]))


### FIXED CODE ###

from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
dp=[defaultdict(lambda:-float('inf'))for _ in range(n)]
for i in range(n):dp[i][0]=0
for i,a in enumerate(a):
    for j in range(n//2-(n-i)//2,i//2+2):
        dp[i][j]=max(dp[i-2][j],dp[i-2][j-1]+a,dp[i-1][j])
print(dp[-1][n//2])
### BUGGY CODE ###

N = int(input())
P = tuple(map(float, input().split()))

dp = [[0 for _ in range(N + 1)] for __ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
    for j in range(N):
        dp[i + 1][j + 1] += dp[i][j] * P[i]
        dp[i + 1][j] += dp[i][j] * (1 - P[i])
print(sum(dp[N][(N + 1) // 2:]))


### FIXED CODE ###

N = int(input())
P = tuple(map(float, input().split()))

dp = [[0 for _ in range(N + 1)] for __ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
    for j in range(N):
        dp[i + 1][j + 1] += dp[i][j] * P[i]
        dp[i + 1][j] += dp[i][j] * (1 - P[i])
print(sum(dp[N][(N + 1) // 2:]))
### BUGGY CODE ###

n = int(input())
x = input()
num = 0
count = 0
for i in range(n):
    if x[-(i+1)] == "1":
        num += 2**i
        count += 1

mod = [[0, 0] for _ in range(n)]
for i in range(n):
    mod[i][0] = 2**i%(count-1) if count!=1 else 0
    mod[i][1] = 2**i%(count+1)
mod1 = num%(count-1) if count!=1 else 0
mod2 = num%(count+1)

table = [0]*(2*10**5+10)
for i in range(2*10**5+10):
    _num = i
    while True:
        _count = 0
        for c in bin(_num):
            if c == "1":
                _count += 1
        if _num == 0:
            break
        _num %= _count
        table[i] += 1

ans = [0]*n
for i in range(n):
    if x[-(i+1)] == "1":
        _num = num-2**i
        if _num == 0:
            continue
        _num = (mod1-mod[i][0])%(count-1)
    else:
        _num = num+2**i
        _num = (mod2+mod[i][1])%(count+1)
    ans[i] = 1+table[_num]
for i in range(n):
    print(ans[-(i+1)])

### FIXED CODE ###

n = int(input())
x = input()
num = 0
count = 0
for i in range(n):
    if x[-(i+1)] == "1":
        num += 2**i
        count += 1

mod = [[0, 0] for _ in range(n)]
mod[0][0] = 1%(count-1) if count!=1 else 0
mod[0][1] = 1%(count+1)
for i in range(1, n):
    if mod[i-1][0] != 0:
        mod[i][0] = (mod[i-1][0]*2)%(count-1)
    if mod[i-1][1] != 0:
        mod[i][1] = (mod[i-1][1]*2)%(count+1)
mod1 = num%(count-1) if count!=1 else 0
mod2 = num%(count+1)

table = [0]*(2*10**5+10)
for i in range(2*10**5+10):
    _num = i
    while True:
        _count = 0
        for c in bin(_num):
            if c == "1":
                _count += 1
        if _num == 0:
            break
        _num %= _count
        table[i] += 1

ans = [0]*n
for i in range(n):
    if x[-(i+1)] == "1":
        _num = num-2**i
        if _num == 0:
            continue
        _num = (mod1-mod[i][0])%(count-1)
    else:
        _num = num+2**i
        _num = (mod2+mod[i][1])%(count+1)
    ans[i] = 1+table[_num]
for i in range(n):
    print(ans[-(i+1)])
### BUGGY CODE ###

from collections import deque


def get_arounds(point, grid, max_x, max_y):
    x = point[0]
    y = point[1]
    arounds = [(x, y-1), (x+1, y), (x, y+1), (x-1, y)]
    return list(filter(lambda a: a[0] >= 0 and a[0] < max_x and
                                 a[1] >= 0 and a[1] < max_y and
                                 grid[a[0]][a[1]], arounds))


H, W = tuple(map(int, input().split()))

grid = []
for i in range(0, H):
    grid.append(list(map(lambda x: True if x == '.' else False, list(input()))))

black = []
for i in range(0, H):
    for j in range(0, W):
        if not grid[i][j]:
            black.append((i, j))

s_path = []
queue = deque([[(0, 0)]])
while not len(queue) == 0:
    path = queue.popleft()
    here = path[-1]
    if here == (H - 1, W - 1):
        s_path = path
        break;
    grid[here[0]][here[1]] = False
    arounds = get_arounds(here, grid, H, W)
    if len(arounds) == 0:
        continue;
    queue.extend(list(map(lambda a: path + [a], arounds)))
else:
    s_path = []

if len(s_path) == 0:
    print('-1')
else:
    print(H * W - len(s_path) - len(black))


### FIXED CODE ###

from collections import deque


def get_arounds(point, grid, max_x, max_y):
    x = point[0]
    y = point[1]
    arounds = [(x + dx, y + dy) for dx, dy in ((0, -1), (1, 0), (0, 1), (-1, 0))]
    return list(filter(lambda a: 0 <= a[0] < max_x and
                                 0 <= a[1] < max_y and
                                 grid[a[0]][a[1]], arounds))


H, W = tuple(map(int, input().split()))

grid = []
for i in range(0, H):
    grid.append(list(map(lambda x: True if x == '.' else False, list(input()))))

black = sum(map(lambda l: l.count(False), grid))

grid[0][0] = False
p_grid = {(0, 0): 0}
queue = deque([(0, 0)])
while not len(queue) == 0:
    here = queue.popleft()
    if here == (H - 1, W - 1):
        break;
    arounds = get_arounds(here, grid, H, W)
    for a in arounds:
        grid[a[0]][a[1]] = False
        p_grid[a] = p_grid[here] + 1
    if not arounds:
        continue
    queue.extend(arounds)

if (H-1, W-1) in p_grid:
    print(H * W - (p_grid[H-1, W-1] + 1) - black)
else:
    print(-1)
### BUGGY CODE ###

S = input()
S = list(S)
cnt  = 0

while True:
    i = 0
    _cnt = 0
    while i<len(S)-1:
        if S[i] == 'B' and S[i+1] == 'W':
            S[i] = 'W'
            S[i+1] = 'B'
            _cnt += 1
            i += 2
        else:
            i += 1
    cnt += _cnt
    if _cnt == 0:
        break

print(cnt)


### FIXED CODE ###

S = input()
cnt  = 0
nb = 0
for i in range(len(S)):
    if S[i] == 'B':
        nb += 1
    else:
        cnt += nb
print(cnt)
### BUGGY CODE ###

import fractions

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

N = int(input())
Ps = list(map(int,input().split(" ")))
MOD = 10 ** 9 + 7
g = 1
for p in Ps:
    g = lcm(g,p)
ans = 0
for p in Ps:
    ans += g//p
    ans %= MOD
print(ans)

### FIXED CODE ###

from fractions import gcd

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

N = int(input())
Ps = list(map(int,input().split(" ")))
MOD = 10 ** 9 + 7
g = 1
for p in Ps:
    g = lcm(g,p)
ans = 0

print(sum([g // p for p in Ps]) % (10 ** 9 + 7))
### BUGGY CODE ###

# import sys 
# try:
# 	sys.stdin = open('input.txt', 'r') 
# 	sys.stdout = open('output.txt', 'w')
# except:
# 	pass
n = int(input())
s = input()
red = []
blue = []
green = []
for i in range(n):
	if s[i] == 'R':
		red.append(i)
	elif s[i] == "G":
		green.append(i)
	else:
		blue.append(i)
temp = [(len(red),'R'), (len(blue),'B'), (len(green),'G')]
temp.sort()

if temp[0][1] == 'R':
	first = list(red)
elif temp[0][1] == 'G':
	first = list(green)
else:
	first = list(blue)

if temp[1][1] == 'R':
	second = list(red)
elif temp[1][1] == 'G':
	second = list(green)
else:
	second = list(blue)

if temp[2][1] == 'R':
	third = list(red)
elif temp[2][1] == 'G':
	third = list(green)
else:
	third = list(blue)

final = []
for i in first:
	for j in second:
		gg = max(i,j)
		ss = min(i,j)
		diff = gg-ss
		check = []
		if (gg+ss)%2==0:
			check.append((gg+ss)//2)
		if gg+diff < n:
			check.append(gg+diff)
		if ss-diff >= 0:
			check.append(ss-diff)
		final.append(check)
# print(final)
# print(first,second,third)
ans = 0
ll = len(third)
for item in final:
	sub = 0
	for i in item:
		if i in third:
			sub += 1
	ans += ll - sub
print(ans)

### FIXED CODE ###

import sys 
try:
	sys.stdin = open('input.txt', 'r') 
	sys.stdout = open('output.txt', 'w')
except:
	pass
n = int(input())
s = input()
red = []
blue = []
green = []
for i in range(n):
	if s[i] == 'R':
		red.append(i)
	elif s[i] == "G":
		green.append(i)
	else:
		blue.append(i)
temp = [(len(red),'R'), (len(blue),'B'), (len(green),'G')]
temp.sort()

if temp[0][1] == 'R':
	first = list(red)
elif temp[0][1] == 'G':
	first = list(green)
else:
	first = list(blue)

if temp[1][1] == 'R':
	second = list(red)
elif temp[1][1] == 'G':
	second = list(green)
else:
	second = list(blue)

if temp[2][1] == 'R':
	third = list(red)
elif temp[2][1] == 'G':
	third = list(green)
else:
	third = list(blue)

final = []
for i in first:
	for j in second:
		gg = max(i,j)
		ss = min(i,j)
		diff = gg-ss
		check = []
		if (gg+ss)%2==0:
			check.append((gg+ss)//2)
		if gg+diff < n:
			check.append(gg+diff)
		if ss-diff >= 0:
			check.append(ss-diff)
		final.append(check)
# print(final)
# print(first,second,third)
ll = len(third)
d_third = {i:1 for i in third}
		
ans = 0

for item in final:
	sub = 0
	for i in item:
		if i in d_third:
			sub += 1
	ans += ll - sub
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
A_ = [0] * (N+1)
for a in A:
    A_[a] += 1
A_ = sorted(A_)
c = 0
for i in range(N+1):
    A_[i] = c = A_[i] + c
A_.reverse()

Ans = [float("inf")] * (N+1)
for i in range(N):
    for j, a in enumerate(A_):
        d = a//(i+1)
        if Ans[i+j] > d:
            Ans[i+j] = d
        if d==0:
            break
del Ans[-1]
print("\n".join(map(str, Ans)))


### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int, input().split()))
    C = [0] * (N+1)
    Cnt_A = [0] * (N+1)
    for a in A:
        Cnt_A[a] += 1
        cnt = Cnt_A[a]
        C[cnt] += 1
    cum_C = []
    cu = 0
    for c in C:
        cu += c
        cum_C.append(cu)
    Ans = []
    for k in range(1, N+1):
        # K = k のとき、 n 組以上作れる <=> 使えるカードが nk 枚以上
        # n 組以上作れる <=> 同じカードは n 枚以下
        # 同じカードは n 枚以下で全体として nk 枚以上用意できるか？
        ok, ng = 0, N//k+1
        while ok + 1 < ng:
            n = ok+ng>>1
            if cum_C[n] >= n*k:
                ok = n
            else:
                ng = n
        Ans.append(ok)
    print("\n".join(map(str, Ans)))

main()
### BUGGY CODE ###

from decimal import Decimal

n, d, x = map(Decimal, input().split())
print((d + (2 * n - 1) * x / 2) * sum((n - i) / (i + 1) for i in range(int(n))))


### FIXED CODE ###

def solve(n, d, x):
    ans = 0
    while n:
        ans += d + (2 * n - 1) * x / 2
        d = ((n + 1) * d + 5 * x / 2) / n
        x *= (n + 2) / n
        n -= 1
    return ans


print('{:.10f}'.format(solve(*map(float, input().split()))))
### BUGGY CODE ###

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

def lcm(a, b):
    g = gcd(a, b)
    g_a = a // g
    g_b = b // g
    return g_a * g_b * g

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



b = []
for i in range(n):
    b.append(a[i]//2)

num = 1
for i in range(n):
    num = lcm(num, b[i])

for i in range(n):
    if (num // b[i]) % 2 == 0:
        print(0)
        exit()

if num > m:
    print(0)
    exit()

p = m // num
if p % 2 == 0:
    print(p//2)
else:
    print((p+1)//2)

### FIXED CODE ###

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

def lcm(a, b):
    g = gcd(a, b)
    g_a = a // g
    g_b = b // g
    return g_a * g_b * g

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



b = []
for i in range(n):
    b.append(a[i]//2)

num = 1
for i in range(n):
    num = lcm(num, b[i])
    if num > m:
        print(0)
        exit()

for i in range(n):
    if (num // b[i]) % 2 == 0:
        print(0)
        exit()


p = m // num
if p % 2 == 0:
    print(p//2)
else:
    print((p+1)//2)