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

N,D,A=map(int,input().split())
XH=[]
for _ in range(N):
  x,h=map(int,input().split())
  XH.append([x,h])
XH=sorted(XH, key=lambda x:x[0])
X=[XH[i][0] for i in range(N)]
H=[XH[i][1] for i in range(N)]

from bisect import bisect_right
import numpy as np
H=np.array(H)
ans=0
js=[bisect_right(X, 2*D+X[i]) for i in range(N)]
for i in range(N):
  if H[i]<=0:
    continue
  else:
    j=js[i]
    att=H[i]//A
    if H[i]%A!=0:
      att+=1
    H[i:j]-=att*A
    ans+=att
#print(H)
print(ans)

### FIXED CODE ###

N,D,A=map(int,input().split())
XH=[]
for _ in range(N):
  x,h=map(int,input().split())
  XH.append([x,h])
XH=sorted(XH, key=lambda x:x[0])
X=[XH[i][0] for i in range(N)]
H=[XH[i][1] for i in range(N)]
from math import ceil
from bisect import bisect_right
imos=[0]*(N+1)
hit=0
ans=0
for i in range(N):
  hit+=imos[i]
  restH=H[i]-hit*A
  if restH>0:
    ans+=ceil(restH/A)
    hit+=ceil(restH/A)
    ind=bisect_right(X,X[i]+2*D)
    imos[ind]-=ceil(restH/A)
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
ini = lambda: int(input())
inl = lambda: list(map(int, input().split()))
ins = lambda: input().strip()

N, K = inl()
A = inl()

import itertools

ps = []
for c in itertools.combinations(A, 2):
	ps.append(c[0] * c[1])
ps.sort()
print(ps[K-1])


### FIXED CODE ###

import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

def comb(n, k):
	p, q = 1, 1
	for i in range(1, k+1):
		p = p * (n-i+1)
		q = q * i
	return p // q

def binsearch(l, r, f):
	while r - l > 1:
		c = (r + l) // 2
		if f(c):
			r = c
		else:
			l = c
	return r

N, K = rl()
A = rl()

pos = 0
neg = 0
zero = 0
Ap = []
An = []
for a in A:
	if a > 0:
		pos += 1
		Ap.append(a)
	elif a < 0:
		neg += 1
		An.append(a)
	else:
		zero += 1
Ap.sort()
An.sort()
n_pos = comb(pos, 2) + comb(neg, 2)
n_neg = pos * neg
n_zero = zero*(N-zero) + comb(zero, 2)

def num_gt(A, x):
	j = len(A) - 1
	cnt = 0
	for i in range(len(A)):
		while i < j and A[i] * A[j] > x:
			j -= 1
		if i >= j:
			break
		cnt += max(j - i, 0)
	return cnt

def num_gt2(A, B, x):
	j = len(B) - 1
	cnt = 0
	for i in reversed(range(len(A))):
		while j >= 0 and A[i] * B[j] > x:
			j -= 1
		if j < 0:
			break
		cnt += max(j+1, 0)
	return cnt

def check_plus(x):
	cnt = n_neg + n_zero
	cnt += num_gt(Ap, x)
	cnt += num_gt(list(reversed(An)), x)
	return cnt >= K

def check_minus(x):
	cnt = num_gt2(Ap, An, x)
	return cnt >= K

ans = 0
if K <= n_neg:
	l = An[0] * Ap[-1] - 1
	r = 0
	ans = binsearch(l, r, check_minus)
elif K <= n_neg + n_zero:
	ans = 0
else:
	l = 0
	r = 1
	if len(Ap) >= 2:
		r = max(r, Ap[-1] * Ap[-2]) + 1
	if len(An) >= 2:
		r = max(r, An[0] * An[1]) + 1
	ans = binsearch(l, r, check_plus)
print(ans)
### BUGGY CODE ###

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

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for bit in range(2**n):
    vsum = 0
    csum = 0
    for i in range(n):
        if (bit & (1 << i)):
            vsum += v[i]
            csum += c[i]
    ans = max(vsum - csum, ans)

print(ans)


### FIXED CODE ###

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

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for bit in range(2**n):
    vsum = 0
    csum = 0
    for i in range(n):
        if (bit & (1 << i)):
            vsum += v[i]
            csum += c[i]
    ans = max(vsum - csum, ans)

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

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

    dp = [float('inf') for i in range(n)]
    dp[0] = 0
    for i in range(0, n):
        for j in range(1, k + 1):
            if i + j == len(heights):
                break
            dp[i + j] = min(dp[i + j], dp[i] + abs(heights[i] - heights[i + j]))

    print(dp[n - 1])


if __name__ == '__main__':
    main()


### FIXED CODE ###

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

    dp = [float('inf') for i in range(n)]
    dp[0] = 0
    for i in range(1, n):
        dp[i] = min(dp[j] + abs(heights[i] - heights[j]) for j in range(max(i - k, 0), i))
        # for j in range(1, k + 1):
        #     if i - j < 0:
        #         break
        #     dp[i] = min(dp[i], dp[i - j] + abs(heights[i] - heights[i - j]))

    print(dp[n - 1])


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

n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[10**9+5]*n
dp[0]=0
dp[1]=abs(h[0]-h[1])
for i in range(2,n):
    for j in range(max(0,i-k),i):
        dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[-1])

### FIXED CODE ###

n,k=map(int,input().split()) #足場は0番目からn-1番目までのn個
h=list(map(int,input().split())) #h[i]はi番目の足場の高さ
DP=[10**9+1]*n
DP[0]=0 #0番目の足場に到達するのに必要なコストは0
DP[1]=abs(h[1]-h[0]) 

#j番目からi番目まで飛ぶ場合の追加コストはabs(h[i]-h[j])、ただしi-1<=j<=i-k

for i in range(2,n):
    for j in range(max(0,i-k),i):
        DP[i]=min(DP[i],DP[j]+abs(h[i]-h[j]))
print(DP[-1])
### BUGGY CODE ###

from collections import deque

def main():
    n, x, y = map(int, input().split())
    cnt = [0]*n
    q = deque()
    
    for i in range(n):
        q.appendleft([i, 0])
        dist = [None]*n
        dist[i] = 0
        while q:
            j, d = q.pop()
            cnt[d] += 1
            if j > 0 and dist[j-1] is None:
                dist[j-1] = d+1
                q.appendleft([j-1, d+1])
            if j < n-1 and dist[j+1] is None:
                dist[j+1] = d+1
                q.appendleft([j+1, d+1])
            if j == x-1 and dist[y-1] is None:
                dist[y-1] = d+1
                q.appendleft([y-1, d+1])
            elif j == y-1 and dist[x-1] is None:
                dist[x-1] = d+1
                q.appendleft([x-1, d+1])
    for i in range(1, n):
        print(cnt[i]//2)
                

if __name__ == "__main__":
    main()

### FIXED CODE ###

# D問題
from collections import deque
def main():
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1
    inf = 10**5
    ans = [0]*n
    q = deque()
    for i in range(n):
        dist = [inf]*n
        q.appendleft(i)
        dist[i] = 0
        while q:
            v = q.pop()
            d = dist[v]
            if v-1 >= 0 and dist[v-1] == inf:
                q.appendleft(v-1)
                dist[v-1] = d+1
            if v+1 <= n-1 and dist[v+1] == inf:
                q.appendleft(v+1)
                dist[v+1] = d+1
            if v == x and dist[y] == inf:
                q.appendleft(y)
                dist[y] = d + 1
            if v == y and  dist[x] == inf:
                q.appendleft(x)
                dist[x] = d + 1
        for di in dist:
            ans[di] += 1
    for a in ans[1:]:
        print(a//2)

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

n=int(input())
x=0
for i in range(1,n+1):
  for j in range(i,n+1,i):
    x+=j
print(x)

### FIXED CODE ###

n=int(input())
x=0
for i in range(1,n+1):
  for j in range(i,n+1,i):
    x+=j
print(x)
### BUGGY CODE ###

from collections import deque

H, W = map(int, input().split())
Maze = [[1 if a == "#" else 0 for a in input()] for _ in range(H)]

Q = deque()
f = 0
if Maze[0][0]:
    f += 1
Q.append((0, 0, f))
ans = 0
while Q:
    x, y, f = Q.popleft()
    if x == W - 1 and y == H - 1:
        ans = f
        break
    for d in range(2):
        nx = x + (0, 1)[d]
        ny = y + (1, 0)[d]
        if nx >= W or ny >= H:
            continue
        if Maze[y][x] == 0 and Maze[ny][nx] == 1:
            Q.append((nx, ny, f + 1))
        else:
            Q.appendleft((nx, ny, f))


print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
Maze = [[1 if a == "#" else 0 for a in input()] for _ in range(H)]

DP = [[float('inf')] * W for _ in range(H)]

if Maze[0][0] == 1:
    DP[0][0] = 1
else:
    DP[0][0] = 0

for i in range(H):
    for j in range(W):
        if Maze[i][j] == 1:
            if i + 1 < H:
                DP[i+1][j] = DP[i][j]
            if j + 1 < W:
                DP[i][j+1] = min(DP[i][j+1], DP[i][j])
        if Maze[i][j] == 0:
            if i + 1 < H:
                if Maze[i+1][j] != 1:
                    DP[i + 1][j] = DP[i][j]
                else:
                    DP[i + 1][j] = DP[i][j] + 1
            if j + 1 < W:
                if Maze[i][j + 1] != 1:
                    DP[i][j + 1] = min(DP[i][j + 1], DP[i][j])
                else:
                    DP[i][j + 1] = min(DP[i][j + 1], DP[i][j]+1)

print(DP[H-1][W-1])
### BUGGY CODE ###

from collections import deque

def bfs(count,adj):
    check = [0]*N
    st = deque()
    sts = deque()
    push,pop = st.append, st.pop
    pushs,pops = sts.append, sts.pop
    push(0)
    check[0] = 1
    while st:
        n = []
        while st:
            n.append(pop())
        for ni in n:
            for i in adj[ni]:
                #print(ni,i,count)
                if check[i] == 0:
                    count[i] += count[ni]
                    check[i] = 1
                    pushs(i)
        while sts:
            push(pops())
    return count

        
N,Q = map(int, input().split())
A = [() for i in range(N)]

for _ in range(N-1):
    a,b = map(int, input().split())
    A[a-1] += (b-1,)
    A[b-1] += (a-1,)
       
cnt = [0]*N   
for q in range(Q):
   p,x = map(int, input().split())
   cnt[p-1] += x

cnt = bfs(cnt,A)

for n in range(N):
    print(cnt[n], end=" ")

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
        
N,Q = (int(i) for i in input().split())
A = [[] for _ in range(N)]

for _ in range(N-1):
    a,b = (int(i) for i in input().split())
    A[a-1].append(b-1)
    A[b-1].append(a-1)

cnt = [0]*N   
for q in range(Q):
   p,x = (int(i) for i in input().split())
   cnt[p-1] += x

st = deque([(0,-1)])
while st:
    n,par = st.popleft()
    val = cnt[n]   
    for node in A[n]:
        if node == par:
            continue
        else:
            cnt[node] += val
            st.append([node,n])

print(*cnt)
### BUGGY CODE ###

n = int(input())
ans = 0
for i in range(1,n+1):
    seven = 0
    five = 0
    three = 0
    while i > 0:
        if i % 10 == 7:
            seven = 1
        elif i % 10 == 3:
            three = 1
        elif i % 10 == 5:
            five = 1
        else:
            break
        i = i // 10
    if i == 0 and seven == 1 and five == 1 and three == 1:
        ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
ans = 0
def dfs(s):
    global ans
    if int(s) > n:
        return
    seven = 0
    five = 0
    three = 0
    for i in range(len(s)):
        if s[i] == "7":
            seven = 1
        elif s[i] == "5":
            five = 1
        elif s[i] == "3":
            three = 1
    if seven == 1 and five == 1 and three == 1:
        ans += 1

    dfs(s + "7")
    dfs(s + "5")
    dfs(s + "3")
    return
dfs("7")
dfs("5")
dfs("3")
print(ans)
### BUGGY CODE ###

#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
s=SI()
t=SI()
a=len(s)
b=len(t)
dp=[[[0,""] for j in range(a+1)] for i in range(b+1)]
for i in range(1,b+1):
    for j in range(1,a+1):
        if s[j-1]==t[i-1]:
            dp[i][j][0]=dp[i-1][j-1][0]+1
            dp[i][j][1]=dp[i-1][j-1][1]+s[j-1]
        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
print(dp[-1][-1][1])
#print(dp)




            

    
    



### FIXED CODE ###

#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
s=SI()
t=SI()
a=len(s)
b=len(t)
dp=[[0]*(a+1) for i in range(b+1)]
for i in range(1,b+1):
    for j in range(1,a+1):
        if s[j-1]==t[i-1]:
            dp[i][j]=dp[i-1][j-1]+1
        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
ans=[]
i,j=b,a
while i > 0 and j > 0:
    if dp[i][j] == dp[i][j-1]:
        j -= 1
    elif dp[i][j] == dp[i-1][j]:
        i -= 1
    else:
        ans.append(s[j-1])
        i -= 1
        j -= 1
#print(ans)
for x in list(reversed(ans)):
    print(x,end="")
### BUGGY CODE ###

import sys
from fractions import gcd


def eratosthenes_generator():
    yield 2
    n = 3
    h = {}
    while True:
        m = n
        if n in h:
            b = h[n]
            del h[n]
        else:
            b = n
            yield n
        m += b << 1
        while m in h:
            m += b << 1
        h[m] = b
        n += 2


def prime(n):
    ret = []
    for i in eratosthenes_generator():
        if n % i == 0:
            ret.append(i)
            while n % i == 0:
                n = n // i
        if n == 1:
            break
    if n > 1:
        ret.append(n)
    return ret


def solve(n, aaa):
    g = abs(aaa[-1])
    for a in aaa[:-1]:
        if a != 0:
            g = gcd(g, abs(a))
    ans = set(prime(g))

    for p in eratosthenes_generator():
        if p > n + 2:
            break
        if p in ans or aaa[0] % p != 0:
            continue
        q = p - 1
        tmp = [0] * q
        for i, a in enumerate(aaa):
            tmp[i % q] += a
        if all(t % p == 0 for t in tmp):
            ans.add(p)

    ans = sorted(ans)
    return ans


n = int(input())
aaa = list(map(int, sys.stdin))
aaa.reverse()
print('\n'.join(map(str, solve(n, aaa))))


### FIXED CODE ###

import sys
from fractions import gcd


def eratosthenes_generator():
    yield 2
    n = 3
    h = {}
    while True:
        m = n
        if n in h:
            b = h[n]
            del h[n]
        else:
            b = n
            yield n
        m += b << 1
        while m in h:
            m += b << 1
        h[m] = b
        n += 2


def prime(n):
    ret = []
    if n % 2 == 0:
        ret.append(2)
        while n % 2 == 0:
            n >>= 1
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i == 0:
            ret.append(i)
            while n % i == 0:
                n = n // i
        if n == 1:
            break
    if n > 1:
        ret.append(n)
    return ret


def solve(n, aaa):
    g = abs(aaa[-1])
    for a in aaa[:-1]:
        if a != 0:
            g = gcd(g, abs(a))
    ans = set(prime(g))

    for p in eratosthenes_generator():
        if p > n + 2:
            break
        if p in ans or aaa[0] % p != 0:
            continue
        q = p - 1
        tmp = [0] * q
        for i, a in enumerate(aaa):
            tmp[i % q] += a
        if all(t % p == 0 for t in tmp):
            ans.add(p)

    ans = sorted(ans)
    return ans


n = int(input())
aaa = list(map(int, sys.stdin))
aaa.reverse()
print('\n'.join(map(str, solve(n, aaa))))
### BUGGY CODE ###

#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""

# 最大公約数 と 最小公倍数
"""def gcd(a,b):
  if b == 0:
    return a
  return gcd(b, a % b)
def lcm(a,b):
  g = gcd(a,b)
  return (a * b) // g"""

# 二分探索
"""import bisect # 二分探索
print(A,bisect.bisect_left(A,4))
print(C,n - bisect.bisect_right(C,4))
print(sum(bisect.bisect_left(A,b) * (n-bisect.bisect_right(C,b)) for b in B))"""

# 円周率 pi
"""import math
pi_ = math.pi"""

# エラトステネスの篩
"""def Erato(n):
    prime = []
    is_prime = [True] * (n+1)
    p = 0
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,n+1):
      if is_prime[i] == True:
        prime.append(i)
        p += 1
        for j in range(2 * i,n+1,i):
          is_prime[j] = False
    return p"""

def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def main():
  from fractions import gcd
  from functools import reduce
  k = int(input())
  
  ans = 0
  for a in range(1,k+1):
    for b in range(1,k+1):
      for c in range(1,k+1):
        ans += reduce(gcd,(a,b,c))
  print(ans)
if __name__ == '__main__':
  main()

### FIXED CODE ###

def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def gcd(a,b):
  if b == 0:
    return a
  return gcd(b, a % b)
def main():
  k = int(input())
  ans = 0
  for a in range(1,k+1):
    for b in range(1,k+1):
      for c in range(1,k+1):
        ans += gcd(a,gcd(b,c))
  print(ans)
if __name__ == '__main__':
  main()
### BUGGY CODE ###

def dijkstra(s, n,  cost):
    # 始点sから各頂点への最短距離
    # n:頂点数,　w:辺の数, cost[u][v] : 辺uvのコスト(存在しないときはinf)
    d = [float("inf")] * n
    used = [False] * n
    d[s] = 0

    while True:
        v = -1
        # まだ使われてない頂点の中から最小の距離のものを探す
        for i in range(n):
            if (not used[i]) and (v == -1):
                v = i
            elif (not used[i]) and d[i] < d[v]:
                v = i
        if v == -1:
            break
        used[v] = True

        for j in range(n):
            d[j] = min(d[j], d[v] + cost[v][j])
    return d


################################
# n:頂点数　w:辺の数
n,u,v = map(int,input().split())

cnt = [0 for i in range(n)]
cost = [[float(10 ** 10) for i in range(n)] for i in range(n)]
# cost[u][v] : 辺uvのコスト(存在しないときはinf この場合は10**10)
for i in range(n-1):
    x, y = map(int, input().split())
    cost[x-1][y-1] = 1
    cost[y-1][x-1] = 1
    cnt[x-1] += 1
    cnt[y-1] += 1

ans = 0
a = dijkstra(u-1,n,cost)
b = dijkstra(v-1,n,cost)
for i in range(n):
    if a[i] <= b[i]:
        if cnt[i] == 1:
            if b[i]-a[i]-1 > 0:
                ans = max(ans,b[i]-1)
        else:
            ans = max(ans,b[i])
print(ans)

### FIXED CODE ###

n,u,v = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(n-1)]

graph = [[] for _ in range(n+1)]

for a,b in lis:
    graph[a].append(b)
    graph[b].append(a)

def dfs(v):
    dist = [-1] * (n+1)
    stack = [v]
    dist[v] = 0
    while stack:
        v = stack.pop()
        dw = dist[v] + 1
        for w in graph[v]:
            if dist[w] >= 0:
                continue
            dist[w] = dw
            stack.append(w)
    return dist

takahashi = dfs(u)
aoki = dfs(v)

ans = 0

for i in range(1,n+1):
    if takahashi[i] < aoki[i]:
        ans = max(ans,aoki[i]-1)

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

S=input()

i=0
T=""
while i<len(S):

    if i+1<len(S) and S[i]+S[i+1]=="BC":
        T+="D"
        i+=2
    else:
        T+=S[i]
        i+=1
T=list(T)
count=0
m=0
Acount=0
#print(T)
for i in range(len(T)):
    if "A"==T[i]:
        Acount+=1
    elif "D"==T[i]:
        count+=Acount
    else:
        Acount=0



#print(T)
print(count)


### FIXED CODE ###

S=input()

i=0
T=[]
while i<len(S):

    if i+1<len(S) and S[i]+S[i+1]=="BC":
        T.append("D")
        i+=2
    else:
        T.append(S[i])
        i+=1
count=0
m=0
Acount=0
#print(T)
for i in range(len(T)):
    if "A"==T[i]:
        Acount+=1
    elif "D"==T[i]:
        count+=Acount
    else:
        Acount=0



#print(T)
print(count)
### BUGGY CODE ###

n, m = map(int, input().split())
a = [[] for i in range(n)]
for i in range(m):
  s, t = map(int, input().split())
  a[s-1].append(t-1)
min_dp = n
for k in range(m):
  dp = [0]*n
  count = 0
  for i in range(n-2,-1,-1):
    b = 0
    for j in a[i]:
      if count != k or len(a[i]) == 1:
        dp[i] += dp[j] + 1
        b += 1
      count += 1
    dp[i] /= b
  min_dp = min(min_dp,dp[0])
print(min_dp)

### FIXED CODE ###

n, m = map(int, input().split())
a = [[] for i in range(n-1)]
for i in range(m):
  s, t = map(int, input().split())
  a[s-1].append(t-1)
dp = [0]*n
sum_d = [0]*(n-1)
max_d = [0]*(n-1)
b = [0]*n
for i in range(n-2,-1,-1):
  for j in a[i]:
    sum_d[i] += dp[j] + 1
    b[i] += 1
    if max_d[i] < dp[j]+1 and len(a[i]) > 1:
      max_d[i] = dp[j]+1  
  dp[i] = sum_d[i] / b[i]
min_dp = dp[0]
for k in range(n-2):
  if b[k]==1:
    continue
  ddp = [0]*k + [dp[k] - (sum_d[k]-max_d[k])/(b[k]-1)]
  for i in range(k-1,-1,-1):
    ddp[i] = sum([ddp[j] for j in a[i] if j <= k]) / b[i]
  min_dp = min(min_dp,dp[0] - ddp[0])
print(min_dp)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
d={1:0,2:0,3:0}
for a in A:
    d[a]+=1
dp={(0,0,0):0}
from collections import defaultdict
while (d[3],d[2],d[1]) not in dp:
    dp2=defaultdict(float)
    for i,j,k in dp:
        if j>0 and i<d[3]:
            dp2[(i+1,j-1,k)]+=dp[(i,j,k)]*(i+1)/(i+j+k)
        if k>0 and i+j<d[2]+d[3]:
            dp2[(i,j+1,k-1)]+=dp[(i,j,k)]*(j+1)/(i+j+k)
        if i+j+k<N:
            dp2[(i,j,k+1)]+=dp[(i,j,k)]*(k+1)/(i+j+k+1)
    for i,j,k in dp2:
        dp2[(i,j,k)]+=N/(i+j+k)
    dp=dp2
print(dp[(d[3],d[2],d[1])])

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
d={1:0,2:0,3:0}
for a in A:
    d[a]+=1
dp=[[[0]*(N+1) for j in range(d[2]+d[3]+1)] for i in range(d[3]+1)]
for i in range(d[3]+1):
    for j in range(d[2]+d[3]-i+1):
        for k in range(N-i-j+1):
            if i+j+k==0:continue
            dp[i][j][k]=N
            if i>0:
                dp[i][j][k]+=dp[i-1][j+1][k]*i
            if j>0:
                dp[i][j][k]+=dp[i][j-1][k+1]*j
            if k>0:
                dp[i][j][k]+=dp[i][j][k-1]*k
            dp[i][j][k]/=i+j+k
print(dp[d[3]][d[2]][d[1]])
### BUGGY CODE ###

from functools import reduce  # @lru_cache(None)
from operator import mul

n, k = (int(x) for x in input().split())
A = list(int(x) for x in input().split())

point = reduce(mul, A[:k])
for i in range(n-k):
    tmp = point
    point //= A[i]
    point *= A[k+i]
    if tmp >= point:
        print("No")
    else:
        print("Yes")

### FIXED CODE ###

n, k = (int(x) for x in input().split())
A = list(int(x) for x in input().split())

for i in range(n - k):
    if A[i] >= A[k + i]:
        print("No")
    else:
        print("Yes")
### BUGGY CODE ###

N = int(input())
S = list(input())
ans = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        if S[i] != S[j]:
            for k in range(j + 1, N):
                if i - j != j - k:
                    if S[j] != S[k] and S[k] != S[i]:
                        ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
S = list(input())
r, g, b = 0, 0, 0
for s in S:
    if s == 'R':
        r += 1
    elif s == 'G':
        g += 1
    else:
        b += 1
ans = r * g * b
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        k = 2 * j - i
        if k < N:
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -= 1
print(ans)