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

n=int(input())
S=input()
R=[]
G=[]
B=[]
for i in range(n):
    if S[i]=='R':
        R.append(i+1)
    elif S[i]=='G':
        G.append(i+1)
    else:
        B.append(i+1)
r=len(R)
g=len(G)
b=len(B)

c=0
for i in G:
    for j in B:
        min_n=min(i,j)
        max_n=max(i,j)
        d=abs(i-j)
        if max_n+d in R:
            c+=1
        if (i+j)%2==0 and (i+j)//2 in R:
            c+=1
        if min_n-d in R:
            c+=1

print(r*g*b-c)

### FIXED CODE ###

n=int(input())
S=input()
R=[]
G=[]
B=[]
for i in range(n):
	if S[i]=='R':
		R.append(i)
	elif S[i]=='G':
		G.append(i)
	else:
		B.append(i)
r=len(R)
g=len(G)
b=len(B)

c=0
for i in range(n):
	for j in range(i+1,n):
		k=2*j-i
		if k<n:
			if len(set([S[i],S[j],S[k]]))==3:
				c+=1

print(r*g*b-c)
### BUGGY CODE ###

import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

def main():
    N = INT()
    A = LIST()
    x = [0] * N
    xsum = sum(A)
    for i in range(N):
        if i % 2 == 0:
            x[i] = xsum - (sum(A[i+1::2]) + sum(A[:i:2]))*2
        else:
            x[i] = xsum - (sum(A[i+1::2]) + sum(A[1:i:2]))*2
    print(*x)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

def main():
    N = INT()
    A = LIST()
    x = [0] * N
    sumx = sum(A)
    x[0] = sumx - sum(A[1::2]) * 2
    for i in range(1, N):
        x[i] = A[i - 1] * 2 - x[i - 1]
    print(*x)

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

import math

def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p


X,Y=map(int,input().split())

if (2*Y-X)%3!=0 and (2*X-Y)%3!=0:
  print(0)
else:
  P=(2*X-Y)//3
  Q=(2*Y-X)//3
  ans=comb((P+Q),P,(10**9+7))
  print(ans)

### FIXED CODE ###

def framod(x,p=10**9+7):
  a=1
  for i in range(1,x+1):
    a = (a*i)%p
  return a
#############################################
X,Y=map(int,input().split())
p=10**9+7

if (X+Y)%3!=0:
  print(0)
else:
  a = (2*X-Y)//3
  b = (2*Y-X)//3
  t = a+b
  if a<0 or b<0:
    print(0)
  else:
    S=framod(t)
    T=pow(framod(a),p-2,p)
    U=pow(framod(b),p-2,p)
    print(((S*T)%p)*U%p)
### BUGGY CODE ###

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

lis = []
for i in range(N):
    a, b = map(int, input().split())
    lis = lis + [a]*b
lis.sort()

print(lis[K-1])

### FIXED CODE ###

N, K = map(int, input().split())
from itertools import accumulate
from bisect import bisect_left

lis = []
lis = [tuple(map(int, input().split())) for i in range(N)]
lis.sort()
Bs = [y for x, y in lis]
cB = list(accumulate(Bs))

print(lis[bisect_left(cB, K)][0])
### BUGGY CODE ###

a = int(input())
b =list(input().split())


c = 0

for i in range(a):
  for j in range(i,a):
    if (int(b[i]) - int(b[j]))>1:
      c+=1
      break
  if c!=0: break

if c==0: print("Yes")
else: print("No")

### FIXED CODE ###

a = int(input())
b =list(map(int,input().split()))

c = 0

for i in range(a):
  if i>0:
    if (b[i] - b[i-1])<-1:
      c+=2
    if (b[i] - b[i-1])==-1:
      c+=1
    if (b[i] - b[i-1])>0:
      c=0
  if c>=2: break
if c<=1: print("Yes")
else: print("No")
### BUGGY CODE ###

import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n,m = LI()
    route = [[] for _ in range(n+1)]
    for _ in range(m):
        a,b = LI()
        route[a].append(b)
        route[b].append(a)
    queue = collections.deque([1])
    explored = set()
    cnt = 1
    level = 0

    while len(queue)!=0 and not (level==2 and cnt==0):
        if cnt==0:
            level+=1
            cnt+=len(queue)
        ex = queue.popleft()
        explored.add(ex)
        for i in route[ex]:
            if i not in queue and i not in explored:
                queue.append(i)
        cnt -= 1
    
    ans = n in explored
    print("POSSIBLE" if ans else "IMPOSSIBLE")
        

main()            


### FIXED CODE ###

import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n,m = LI()
    route = [[] for _ in range(n+1)]
    for _ in range(m):
        a,b = LI()
        route[a].append(b)
        route[b].append(a)
    ans = False

    for i in route[n]:
        if 1 in route[i]:
            ans = True
    print("POSSIBLE" if ans else "IMPOSSIBLE")
        

main()
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 20:47:47 2019

@author: Owner
"""


N, M = list(map(int, input().split()))
a = [0]*M
for m in range(M):
    a[m] = int(input())
MOD = 10**9 + 7

def main(): 
    dp = [0]*(N+2)
    dp[0] = 1
    for n in range(1,N+1):
        if n ==1:
            if n in a:
                dp[n] = 0
            else:
                dp[n] += dp[n-1]
        else:                        
            if n in a:
                dp[n] = 0
            else:
                dp[n] += dp[n-2] + dp[n-1]
                
    #print(dp)
    print(dp[N]%MOD)
                
                
                
            
            
                

    
if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 20:47:47 2019

@author: Owner
"""

import bisect

N, M = list(map(int, input().split()))
a = [0]*M
for m in range(M):
    a[m] = int(input())
a = set(a)
MOD = 10**9 + 7

def main(): 
    dp = [0]*(N+2)
    dp[0] = 1
    for n in range(1,N+1):
        if n ==1:
            if n in a:
                dp[n] = 0
            else:
                dp[n] += dp[n-1]
                
        else:                        
            if n in a:
                dp[n] = 0
            else:
                dp[n] += dp[n-2] + dp[n-1]
                
    #print(dp)
    print(dp[N]%MOD)
                
                
                
            
            
                

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

N,Q = map(int,input().split())
S = input()
l = [0]*Q
r = [0]*Q
for q in range(Q):
    l[q],r[q] = map(int,input().split())

for q in range(Q):
    s = S[l[q]-1:r[q]]
    #print(s)
    cnt = 0
    for i in range(len(s)-1):
        if s[i:i+2] == 'AC':
            cnt +=1
            #print('y')
    print(cnt)

### FIXED CODE ###

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

cnt = [0]*(N+1)
for i in range(N):
    if S[i:i+2] == 'AC':
        cnt[i+1] = cnt[i]+1
    else:
        cnt[i+1] = cnt[i]
    
#print(cnt)

for q in range(Q):
    l,r = map(int,input().split())
    print(cnt[r-1]-cnt[l-1])
### BUGGY CODE ###

N = int(input())
clst = list(input())
cnt = 0
while True:
    if 'R' not in clst or 'W' not in clst:
        break
    else:
        rnum = [i for i, c in enumerate(clst) if c == 'R'][-1]
        wnum = clst.index('W')

    if wnum >= rnum:
        break
    else:
        clst[rnum] = 'W'
        clst[wnum] = 'R'
        cnt += 1

print(cnt)

### FIXED CODE ###

N = int(input())
clst = list(input())
cnt = 0
k = -1

if 'R' not in clst or 'W' not in clst:
    pass

else:
    rnum = [i for i, c in enumerate(clst) if c == 'R']
    wnum = [j for j, c in enumerate(clst) if c == 'W'][::-1]

    t = min(len(rnum), len(wnum))

    for i in range(1, t+1):
        if rnum[-i] > wnum[-i]:
            cnt += 1
        else:
            break

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

N,C =[int(x) for x in input().split()]
D = [[int(x) for x in input().split()] for _ in range(C)]
c = [[int(x) for x in input().split()] for _ in range(N)]
c1 = []
c2 = []
c3 = []
for i in range(1,N+1):
  for j in range(1,N+1):
    if (i+j)%3==0:
      c1.append(c[i-1][j-1])
    elif (i+j)%3==1:
      c2.append(c[i-1][j-1])
    elif (i+j)%3==2:
      c3.append(c[i-1][j-1])
su = 0
ans = 1000000
for i in range(C):
  for j in range(i+1,C):
    for k in range(j+1,C):
      for a,b,c in [[i,j,k],[j,i,k],[k,j,i],[i,k,j],[k,i,j],[j,k,i]]:
        su = 0
        for l in range(max(len(c1),len(c2),len(c3))):
          su += (0 if l>=len(c1) else D[c1[l]-1][a])+(0 if l>=len(c2) else D[c2[l]-1][b])+(0 if l>=len(c3) else D[c3[l]-1][c])
        ans = min(ans,su)
print(ans)

### FIXED CODE ###

N,C =[int(x) for x in input().split()]
D = [[int(x) for x in input().split()] for _ in range(C)]
c = [[int(x) for x in input().split()] for _ in range(N)]
c1 = []
c2 = []
c3 = []
for i in range(1,N+1):
  for j in range(1,N+1):
    if (i+j)%3==0:
      c1.append(c[i-1][j-1])
    elif (i+j)%3==1:
      c2.append(c[i-1][j-1])
    elif (i+j)%3==2:
      c3.append(c[i-1][j-1])
su = 0
ans = 100000000000000
import collections as col
c1 = col.Counter(c1)
c2 = col.Counter(c2)
c3 = col.Counter(c3)
#print(c1,c2,c3)
for i in range(C):
  for j in range(i+1,C):
    for k in range(j+1,C):
      for a,b,c in [[i,j,k],[j,i,k],[k,j,i],[i,k,j],[k,i,j],[j,k,i]]:
        su = 0
        for l in range(1,C+1):
          #print(c1[l],c2[l],c3[l])
          su += D[l-1][a]*c1[l]+D[l-1][b]*c2[l]+D[l-1][c]*c3[l]
        ans = min(ans,su)
print(ans)
### BUGGY CODE ###

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

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

def gcd(list1) :
    global dol
    list2 = tuple(list1)
    if list2 in dol.keys() :
        return dol[list2]
    else :
        for m in range(N-2) :
            list1 = [ea(list1[0], list1[1])] + list1[2:]
        else :
            dol[list2] = list1[0]
            return list1[0]

dol = {}
ans = 1
for n in range(N) :
    ans = max(ans, gcd(Alist[:n]+Alist[n+1:]))
print(ans)

### FIXED CODE ###

from functools import lru_cache
n = int(input())
aa = list(map(int, input().split()))

@lru_cache(maxsize=10**9)
def gcd(a, b) :
    if b == 0 : return a
    elif a%b : return gcd(b, a%b)
    else : return b

l = [0]
r = [0]
for i in range(n) :
    l.append(gcd(l[-1], aa[i]))
    r.append(gcd(r[-1], aa[-i-1]))

m = [gcd(l[i],r[-i-2]) for i in range(n)]
print(max(m))
### BUGGY CODE ###

import itertools
n = int(input())
l = list(map(int,input().split()))
ans = 0

p = itertools.combinations(l,3)
for v in p:
    if v[0] < v[1] + v[2] and v[1] < v[0] + v[2] and v[2] < v[0] + v[1]:
        ans += 1

print (ans)


### FIXED CODE ###

import bisect
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n-1,1,-1):
    for j in range(i-1,0,-1):
        x = j - bisect.bisect(l,l[i]-l[j])
        if x>0:
            ans += x

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

N = int(input())
P = [list(map(int, input().split())) for i in range(N)]
MOD = 998244353

P.sort()

def compress(P, d):
    *XS, = {s[d] for s in P}
    XS.sort()
    return {e: i for i, e in enumerate(XS)}
MX = compress(P, 0)
MY = compress(P, 1)

data = [0]*(N+1)
def add(k, x):
    while k <= N:
        data[k] += x
        k += k & -k
def get(k):
    s = 0
    while k:
        s += data[k]
        k -= k & -k
    return s

ans = 0
for i in range(N):
    x, y = P[i]
    x = MX[x]; y = MY[y]
    v1 = get(y+1); v0 = y - v1
    w1 = i - v1; w0 = (N - y - 1) - w1
    add(y+1, 1)
    p1 = pow(2, v1, MOD)-1
    p0 = pow(2, v0, MOD)-1
    q1 = pow(2, w1, MOD)-1
    q0 = pow(2, w0, MOD)-1
    ans += 2 * ((p1+1)*(p0+1) % MOD)*((q1+1)*(q0+1) % MOD) % MOD
    ans -= (1 + p0 + p1 + q0 + q1 + p0 * (p1 + q0) + (p1 + q0) * q1) % MOD
print(ans % MOD)

### FIXED CODE ###

import sys
def solve():
    readline = sys.stdin.readline
    write = sys.stdout.write
    MOD = 998244353

    N = int(readline())
    P = [list(map(int, readline().split())) for i in range(N)]

    P.sort()

    Y = [y for x, y in P]

    def compress(X):
        *XS, = set(X)
        XS.sort()
        return list(map({e: i for i, e in enumerate(XS)}.__getitem__, X))
    Y = compress(Y)

    data = [0]*(N+1)
    def add(k, x):
        while k <= N:
            data[k] += x
            k += k & -k
    def get(k):
        s = 0
        while k:
            s += data[k]
            k -= k & -k
        return s

    def gen(add, get):
        pow2 = [1]*N
        r = 1
        for i in range(1, N):
            pow2[i] = r = r * 2 % MOD

        for i, y in enumerate(Y):
            v1 = get(y+1); v0 = y - v1
            w1 = i - v1; w0 = (N - y - 1) - w1
            add(y+1, 1)
            p1 = pow2[v1]; p0 = pow2[v0]
            q1 = pow2[w1]; q0 = pow2[w0]
            yield (2 * (p1*p0 % MOD)*(q1*q0 % MOD) % MOD) - (1 - p0 - p1 - q0 - q1 + (p0 + q1) * (p1 + q0)) % MOD
    write("%d\n" % (sum(gen(add, get)) % MOD))
solve()
### BUGGY CODE ###

from sys import stdin


class C:
	def __init__(self,A,B,C,D):
		self.A = int(A)
		self.B = int(B)
		self.C = int(C)
		self.D = int(D)
		self.ans_list = list()
	def main(self):
		for i in range(self.A,self.B+1):
			if i % self.C != 0:
				if  i % self.D != 0:
					self.ans_list.append(i)

		print(len(self.ans_list))


Inp = stdin.readline()
Inp = Inp.replace('\n','')
Inp = Inp.split()

do = C(Inp[0],Inp[1],Inp[2],Inp[3])

do.main()


### FIXED CODE ###

import fractions

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


c_and_d=C*D
#CとDの最小公倍数を求める
lcm = int(C*D//fractions.gcd(C,D))


count_C =0
count_D =0
count_C_and_D =0

count_C = int(B//C)-int((A-1)//C)
count_D = int(B//D)-int((A-1)//D)
count_C_and_D = int(B//lcm)-int((A-1)//lcm)

print(int((B-A+1) -(count_C + count_D - count_C_and_D)))
### BUGGY CODE ###

def main():
    inf = 100 * 40 + 1
    mx = 400

    N, Ma, Mb = map(int, input().split())

    dp = [[[inf] * (400 + 1) for _ in range(400 + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 0
    for i in range(N):
        ai, bi, ci = map(int, input().split())
        for a in range(mx + 1):
            for b in range(mx + 1):
                dp[i + 1][a][b] = dp[i][a][b]
        for a in range(ai, mx + 1):
            for b in range(bi, mx + 1):
                dp[i + 1][a][b] = min(
                    dp[i + 1][a][b],
                    dp[i][a - ai][b - bi] + ci
                )
    k = 1
    ans = inf
    while Ma * k <= mx and Mb * k <= mx:
        ans = min(ans, dp[N][Ma * k][Mb * k])
        k += 1

    if ans == inf:
        print(-1)
    else:
        print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

N, Ma, Mb = map(int, input().split())
e = [tuple(map(int, input().split())) for _ in range(N)]

N_max = 40
a_max = 10
b_max = 10
c_max = 100

inf = N_max * c_max + 1
dp = [[[inf for _ in range(N_max * b_max + 1)] for _ in range(N_max * a_max + 1)] for _ in range(N_max + 1)]
dp[0][0][0] = 0

# print(dp[N])

for i, (aa, bb, cc) in enumerate(e, 1):
    for a in range(a_max * i + 1):
        for b in range(b_max * i + 1):
            dp[i][a][b] = min(dp[i][a][b], dp[i - 1][a][b])
            if a + aa < N_max * a_max + 1 and b + bb < N_max * b_max + 1:
                dp[i][a + aa][b + bb] = min(dp[i][a + aa][b + bb], dp[i - 1][a][b] + cc)

# print(dp[N])

ans = inf
for a in range(N_max * a_max + 1):
    for b in range(N_max * b_max + 1):
        # a:b=Ma:Mb
        # b*Ma=a*Mb
        if b * Ma == a * Mb and a * b > 0:
            ans = min(ans, dp[N][a][b])

print(ans if ans < inf else -1)
### BUGGY CODE ###

N = int(input())
a = []
for i in range(N):
    b = int(input())
    a.append(b)

c = []
for j in range(N):
    c = a.copy()
    c.pop(j)
    print(max(c))

### FIXED CODE ###

N = int(input())
a = []
for i in range(N):
    b = int(input())
    a.append(b)

c = sorted(a)
a1 = c[-1] 
a2 = c[-2]

for j in range(N):
    if a[j]==a1:
        print(a2)
    else:
        print(a1)
### BUGGY CODE ###

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

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

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

l = a[0]
for x in a:
    l = lcm(l, x)

law = 10 ** 9 + 7
ans = 0
for x in a:
    ans += l // x
    ans %= law
print(ans)

### FIXED CODE ###

MAX_PRIME = 10**3
is_prime = [1] * MAX_PRIME
primes = []
is_prime[0] = 0
is_prime[1] = 0
for i in range(MAX_PRIME):
    if is_prime[i]:
        primes.append(i)
        for j in range(2, ((MAX_PRIME-1)//i) + 1):
            is_prime[i*j] = 0

def factorization(n):
    factor = {}
    for p in primes:
        if p ** 2 > n:
            break
        while n % p == 0:
            n //= p
            if p not in factor:
                factor[p] = 1
            else:
                factor[p] += 1
    if n > 1:
        factor[n] = 1
    return factor
def extGCD(a, b):
    if b == 0:
        return a, 1, 0
    g, y, x = extGCD(b, a%b)
    y -= a//b * x
    return g, x, y
def moddiv(a, b):
    _, inv, _ = extGCD(b, law)
    return a * inv % law

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

ans = 0
l = {}
lmod = 1
law = 10 ** 9 + 7
for x in a:
    fx = factorization(x)
    for p, c in fx.items():
        if p not in l:
            ans *= p ** c
            lmod *= p ** c
            ans %= law
            lmod %= law
            l[p] = c
        elif c > l[p]:
            ans *= p ** (c - l[p])
            lmod *= p ** (c - l[p])
            ans %= law
            lmod %= law
            l[p] = c
    b = moddiv(lmod, x)
    ans += b
    ans %= law
print(ans)
### BUGGY CODE ###

H, W = map(int, input().split())
b = ["#"*(W+2)]+["#"+input()+"#" for _ in range(H)]+["#"*(W+2)]

ans = 0

for rh in range(1, H+1):
    for rw in range(1, W+1):
        if b[rh][rw] == "#":
            continue

        x = 0

        i = 1
        while True:
            if b[rh-i][rw] == "#":
                x += i-1
                break
            i += 1
        
        i = 1
        while True:
            if b[rh+i][rw] == "#":
                x += i-1
                break
            i += 1
        
        i = 1
        while True:
            if b[rh][rw-i] == "#":
                x += i-1
                break
            i += 1
        
        i = 1
        while True:
            if b[rh][rw+i] == "#":
                x += i-1
                break
            i += 1
        
        ans = max(x, ans)

print(ans+1)

### FIXED CODE ###

H, W = map(int, input().split())
S = [input() for _ in range(H)]

yoko = [[0]*W for _ in range(H)]
tate = [[0]*W for _ in range(H)]

def f(l):
    print("\n".join("".join(map(str, row)) for row in l))

for h in range(H):
    if S[h][0] == ".":
        yoko[h][0] = 1
    else:
        yoko[h][0] = 0

for h in range(H):
    for w in range(1, W):
        if S[h][w] == ".":
            yoko[h][w] = yoko[h][w-1]+1
        else:
            yoko[h][w] = 0

for h in range(H):
    for w in range(W-2, -1, -1):
        if S[h][w]=="." and S[h][w+1]==".":
            yoko[h][w] = yoko[h][w+1]

for w in range(W):
    if S[0][w] == ".":
        tate[0][w] = 1
    else:
        tate[0][w] = 0

for w in range(W):
    for h in range(1, H):
        if S[h][w] == ".":
            tate[h][w] = tate[h-1][w]+1
        else:
            tate[h][w] = 0

for w in range(W):
    for h in range(H-2, -1, -1):
        if S[h][w]=="." and S[h+1][w]==".":
            tate[h][w] = tate[h+1][w]

ans = 0

for h in range(H):
    for w in range(W):
        ans = max(yoko[h][w]+tate[h][w]-1, ans)

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

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

tmp = 1
for a in range(K):
    tmp *= A[a]

for i in range(K, N):
    c = tmp
    c = c // A[i - K]
    c *= A[i]
    if c > tmp:
        print("Yes")
    else:
        print("No")
    tmp = c


### FIXED CODE ###

import sys
#import numpy as np
N, K = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split()))
# DP = [1] * (2 * 10 ** 6)
# DP[K - 1] = np.prod(A[0:K])

for i in range(K, N):
    if A[i] / A[i - K] > 1:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

n, k = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))

root = [1]*n

for i in range(n)[-2::-1]:
    num = 0
    for j in range(i + 1, n)[:i + 10**2]:
        if abs(l[i] - l[j]) <= k:
            num = max(num, root[j])
    root[i] += num

print(max(root))

### FIXED CODE ###

n, k = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))

root = [1]*n

for i in range(n)[-2::-1]:
    num = 0
    for j in range(i + 1, i + 200):
        if j >= n:
            break
        if abs(l[i] - l[j]) <= k:
            num = max(num, root[j])
    root[i] += num

print(max(root))
### BUGGY CODE ###

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

    dp = [[10**13]*N for i in range(N)]
    s = [0] * (N+1)
    for i in range(N):
        s[i+1] = s[i] + a[i]
        dp[i][i] = 0
    for i in range(N-1, -1, -1):
        for j in range(i+1, N):
            tmp = s[j+1] - s[i]
            for k in range(i, j):
                dp[i][j] = min(dp[i][j], dp[i][k]+dp[k+1][j] + tmp)

    print(dp[0][N-1])


main()


### FIXED CODE ###

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

    dp = [[10**13]*N for i in range(N)]
    s = [0] * (N+1)
    for i in range(N):
        s[i+1] = s[i] + a[i]
        dp[i][i] = 0
    for i in range(N-1, -1, -1):
        for j in range(i+1, N):
            tmp = s[j+1] - s[i]
            for k in range(i, j):
                dp[i][j] = min(dp[i][j], dp[i][k]+dp[k+1][j] + tmp)

    print(dp[0][N-1])


main()
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort()
d=[0]*n
d[0]=1

for i in range(1,n):
    if a[i]>2*sum(a[:i]):
        d[i]=1
    else:
        d[i]=d[i-1]+1
print(d[n-1])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort()
d=[0]*n
d[0]=1
s=[0]*n
s[0]=a[0]

for i in range(1,n):
  s[i]=s[i-1]+a[i]
for i in range(1,n):
    if a[i]>2*s[i-1]:
        d[i]=1
    else:
        d[i]=d[i-1]+1
print(d[n-1])
### BUGGY CODE ###

from copy import copy

N = int(input())

A = [None]*N

for i in range(N):
    A[i] = int(input())

Asorted = sorted(A)
    
for i in range(N):
    Ai = A[i]
    Asortedcopy = copy(Asorted)
    Amax = Asortedcopy.pop()
    if Amax == Ai:
        Amax = Asortedcopy.pop()
    print(Amax)


### FIXED CODE ###

from copy import copy
from collections import deque

N = int(input())

A = [None]*N
Adict = {}
for i in range(N):
    Ai = int(input())
    A[i] = Ai
    Adict[i] = Ai

Asorted = deque(sorted(A))
first = Asorted.pop()
second = Asorted.pop()

for i in range(N):
    Ai = Adict[i]
    Amax = first
    if Amax == Ai:
        Amax = second
    print(Amax)
### BUGGY CODE ###

import math
n = int(input())


#if math.sqrt(n-1).is_integer():

def yakusu(n):
    count=0
    if math.sqrt(n).is_integer():
        for i in range(1,int(math.sqrt(n))+1):
            if n% i == 0:
                count+=1
        return (count*2-1)
    else:
        for i in range(1,int(math.sqrt(n))+1):
            if n%i ==0:
                count+=1
        return count*2        

ans=0
for i in range(1,n):
    ans+=yakusu(i)
print(ans)


### FIXED CODE ###

N = int(input())

ans = 0
for A in range(1, N):
    ans += (N // A)
    if N % A == 0:
        ans -= 1


print(ans)