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

# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）

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, K = LI()
    Aarray = LI()

    start = 1
    for i in range(K):
        start *= Aarray[i]

    for i in range(K, N):
        a = i-K
        now = start*Aarray[i]/Aarray[a]
        if now > start:
            print("Yes")
        else:
            print("No")
        start = now


if __name__ == '__main__':
    main()


### FIXED CODE ###

# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）

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, K = LI()
    Aarray = LI()

    # start = 1
    # for i in range(K):
    #     start *= Aarray[i]

    # for i in range(K, N):
    #     now = start/Aarray[i-K]*Aarray[i]
    #     if now > start:
    #         print("Yes")
    #     else:
    #         print("No")
    #     start = now

    for i in range(K, N):
        now = Aarray[i-K]
        now2 = Aarray[i]
        if now2 > now:
            print("Yes")
        else:
            print("No")


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

import fractions
from functools import reduce


def gcd(*numbers):
    return reduce(fractions.gcd, numbers)


def solve():

    K = int(input())

    rangeK = range(1, K+1)
    ans = 0

    for a in rangeK:
        for b in rangeK:
            for c in rangeK:
                ans += gcd(a, b, c)

    print(ans)


if __name__ == "__main__":
    solve()


### FIXED CODE ###

from math import gcd


def solve():

    K = int(input())

    rangeK = range(1, K+1)
    ans = 0

    for a in rangeK:
        for b in rangeK:
            for c in rangeK:
                ans += gcd(gcd(a, b), c)

    print(ans)


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

from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
lcm = A[0]
for i in range(1,N):
    lcm = (lcm*A[i])//gcd(lcm,A[i])
MOD = 10**9+7
ans = 0
for a in A:
    b = lcm//a
    ans += b
    ans %= MOD
print(ans)

### FIXED CODE ###

from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
lcm = a[0]
for i in range(1,n):
  lcm = lcm*a[i] // gcd(lcm,a[i])
mod=pow(10,9)+7
lcm%=mod
ans=0
for x in a:
  ans+=pow(x,mod-2,mod)
  ans%=mod
print(ans*lcm%mod)
### BUGGY CODE ###

import queue
n, m = map(int, input().split(' '))
c = [[] for i in range(n)]
r = [0] * n
q = queue.Queue()
for i in range(m):
    a, b = map(int, input().split(' '))
    c[a - 1].append(b - 1)
    c[b - 1].append(a - 1)
q.put([0] + c[0])
while(q.qsize() > 0):
    g = q.get()
    ix = g.pop(0)
    for i in g:
        r[i] = ix + 1 if r[i] == 0 else r[i]
        if len(c[i]) > 0:
            t = [i] + [j for j in c[i] if r[j] == 0]
            if len(t) > 1:
                q.put(t)
jg = 'Yes' if r.pop(0) > 0 else 'No'
print(jg)
for i in r:
    print(i)

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split(' '))
c = [[] for i in range(n)]
r = [0] * n
q = deque()
for i in range(m):
    a, b = map(int, input().split(' '))
    c[a - 1].append(b - 1)
    c[b - 1].append(a - 1)
q.append(0)
while len(q) > 0:
    ix = q.popleft()
    for i in c[ix]:
        if r[i] == 0:
            r[i] = ix + 1
            q.append(i)

jg = 'Yes' if r.pop(0) > 0 else 'No'
print(jg)
for i in r:
    print(i)
### BUGGY CODE ###

S = input()

n = len(S)
memo = set()
ans = 0
for i in range(n):
    for j in range(i, n):
        v = int(S[i:j + 1])
        if v in memo or v  % 2019 == 0:
            ans += 1
            memo.add(v)
            
print(ans)


### FIXED CODE ###


S = list(map(int, list(input())))

mod = 2019
ctr = [0] * mod
t = 0
for i, v in enumerate(reversed(S)):
    t = (t + int(v) * pow(10, i, mod)) % mod
    ctr[t] += 1

ans = ctr[0]
for v in ctr:
    ans += v * (v - 1) // 2
print(ans)
### BUGGY CODE ###

n,m,q=map(int,input().split())
import math
a=[]
for i in range(1,q+1):
    a.append(math.floor(n*i/m)-n*math.floor(i/m))
print(max(a))

### FIXED CODE ###

A, B, N = map(int, input().split())
from math  import floor

def f(A, B, N):
    return floor(A*N/B)-A*floor(N/B)


print(f(A, B, min(B-1, N)))
### BUGGY CODE ###

N = int(input())

ans = 1
for i in range(N):
    ans *= i+1

print(ans % (10**9+7))


### FIXED CODE ###

import math

N = int(input())
print(math.factorial(N) % (10**9+7))
### BUGGY CODE ###

s=input()
l=len(s)
mod=10**9+7
dp=[[0 for j in range(13)] for i in range(l+1)]
dp[0][0]=1 #初期値の設定
for i in range(l):
  if s[i]=='?': #?のときは各値(0～9)について更新する
    for j in range(10):
      for k in range(13):
        dp[i+1][(k*10+j)%13]+=dp[i][k]%mod
  else:
    for k in range(13): #整数のときはその値について更新する
      dp[i+1][(k*10+int(s[i]))%13]+=dp[i][k]%mod
print(dp[-1][5]%mod) #最後まで更新を行ったときのあまりが5となる数の個数が答え

### FIXED CODE ###

def main():
  s=input()
  l=len(s)
  mod = 10**9+7
  dp=[[0]*13 for _ in range(l+1)]
  dp[0][0]=1 #初期値設定
  for i in range(l):
    if s[i]!="?":
      for k in range(13):
        dp[i+1][(k*10+int(s[i]))%13]+=dp[i][k]%mod
    else:
      for j in range(10):
        for k in range(13):
          dp[i+1][(k*10+j)%13]+=dp[i][k]%mod

  print(dp[-1][5]%mod)

if __name__ == "__main__":
    main()
### 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

n,k=MI()
lis=LI()
lis.sort(reverse=True)
ex=[0 for i in range(lis[-1])]
for i in range(1,n):
    if ex[lis[i]%lis[-1]]==0:
        ex[lis[i]%lis[-1]]+=1
    if ex[lis[-1]-lis[i]%lis[-1]-1]==0:
        ex[lis[-1]-lis[i]%lis[-1]-1]+=1
#print(ex)
for i in range(n):
    if lis[i]<k:
        break
    elif lis[i]==k:
        print("POSSIBLE")
        sys.exit()
    elif ex[(lis[i]-k)%lis[-1]]==1:
        print("POSSIBLE")
        sys.exit()
print("IMPOSSIBLE")
    
    
    






        
        
    
    
        
    
    


### FIXED CODE ###

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

n,k=MI()
lis=LI()
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
lis.sort()
x=lis[0]
for i in range(n-1):
    x=gcd(x,lis[i+1])
if lis[-1]-k>=0 and (lis[-1]-k)%x==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
### BUGGY CODE ###

import numpy as np

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

res=[]

res.append((sum(np.arange(1,p[0]+1)))/p[0])

for i in range(1,N):
    res.append(res[i-1]+(np.sum(np.arange(1,p[i]+1)))/p[i])
ans=res[K-1]

for i in range(1,N-K+1):
    ans=max(ans,res[i+K-1]-res[i-1])
print(ans)

### FIXED CODE ###

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

res=[]

res.append((sum(range(1,p[0]+1)))/p[0])

for i in range(1,N):
    res.append(res[i-1]+1+0.5*(p[i]-1))
ans=res[K-1]

for i in range(1,N-K+1):
    ans=max(ans,res[i+K-1]-res[i-1])
print(ans)
### BUGGY CODE ###

# coding:utf-8

INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


# aのp乗を求めるアルゴリズム
# MOD版
def pow_mod(a, p):
    if p == 0: return 1
    if p < 0: return 0

    if p % 2 == 0:
        half_p = p // 2
        half = pow_mod(a, half_p)
        return half * half % MOD
    else:
        return a * pow_mod(a, p - 1) % MOD


S = input()

# dp = [[0 for _ in range(4)] for _ in range(len(S) + 1)]
# dp = [len(S)][3] = 1
# for i in range(3):
#     dp[len(S)][i] = 0

A = [-INF for _ in range(len(S))]
C = A[:]
Q = A[:]

A[0] = 1 if S[0] == 'A' else 0
C[0] = 1 if S[0] == 'C' else 0
Q[0] = 1 if S[0] == '?' else 0

for i in range(1, len(S)):
    A[i] = A[i - 1] + 1 if S[i] == 'A' else A[i - 1]
    C[i] = C[i - 1] + 1 if S[i] == 'C' else C[i - 1]
    Q[i] = Q[i - 1] + 1 if S[i] == '?' else Q[i - 1]

# print(A)
# print(C)
# print(Q)
ans = 0
for i in range(1, len(S) - 1):
    if S[i] == 'A' or S[i] == 'C':
        continue

    # A, B, Cの個数
    ans += A[i - 1] * (C[-1] - C[i]) * pow_mod(3, Q[i - 1] + Q[-1] - Q[i])
    # ?, B, Cの個数
    ans += Q[i - 1] * (C[-1] - C[i]) * pow_mod(3, Q[i - 1] - 1 + Q[-1] - Q[i])
    # A, B, ?の個数
    ans += A[i - 1] * (Q[-1] - Q[i]) * pow_mod(3, Q[i - 1] + Q[-1] - Q[i] - 1)
    # ?, B, ?の個数
    ans += Q[i - 1] * (Q[-1] - Q[i]) * pow_mod(3, Q[i - 1] + Q[-1] - Q[i] - 2)

    ans %= MOD

print(ans)


### FIXED CODE ###

# coding:utf-8

INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


# aのp乗を求めるアルゴリズム
# MOD版
def pow_mod(a, p):
    if p == 0: return 1
    if p < 0: return 0

    if p % 2 == 0:
        half_p = p // 2
        half = pow_mod(a, half_p)
        return half * half % MOD
    else:
        return a * pow_mod(a, p - 1) % MOD


S = input()

# dp = [[0 for _ in range(4)] for _ in range(len(S) + 1)]
# dp = [len(S)][3] = 1
# for i in range(3):
#     dp[len(S)][i] = 0

A = [-INF for _ in range(len(S))]
C = A[:]
Q = A[:]

A[0] = 1 if S[0] == 'A' else 0
C[0] = 1 if S[0] == 'C' else 0
Q[0] = 1 if S[0] == '?' else 0

for i in range(1, len(S)):
    A[i] = A[i - 1] + 1 if S[i] == 'A' else A[i - 1]
    C[i] = C[i - 1] + 1 if S[i] == 'C' else C[i - 1]
    Q[i] = Q[i - 1] + 1 if S[i] == '?' else Q[i - 1]

pow_three = [1]
for i in range(Q[-1]):
    tmp = pow_three[-1] * 3
    tmp %= MOD
    pow_three.append(tmp)

ans = 0
for i in range(1, len(S) - 1):
    if S[i] == 'A' or S[i] == 'C':
        continue

    # A, B, Cの個数
    tmp = Q[i - 1] + Q[-1] - Q[i]
    if tmp < 0: tmp = 0
    ans += A[i - 1] * (C[-1] - C[i]) * pow_three[tmp]
    # ?, B, Cの個数
    tmp = Q[i - 1] - 1 + Q[-1] - Q[i]
    if tmp < 0: tmp = 0
    ans += Q[i - 1] * (C[-1] - C[i]) * pow_three[tmp]
    # A, B, ?の個数
    tmp = Q[i - 1] + Q[-1] - Q[i] - 1
    if tmp < 0: tmp = 0
    ans += A[i - 1] * (Q[-1] - Q[i]) * pow_three[tmp]
    # ?, B, ?の個数
    tmp = Q[i - 1] + Q[-1] - Q[i] - 2
    if tmp < 0: tmp = 0
    ans += Q[i - 1] * (Q[-1] - Q[i]) * pow_three[tmp]

    ans %= MOD

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

from collections import Counter

N = int(input())
a = list(map(int, input().split()))
cnts = Counter(a)

for ai in a:
    ans = 0
    for key,value in cnts.items():
        if key == ai:
            value -= 1
        ans +=  value*(value-1)//2
    print(ans)


### FIXED CODE ###

from collections import Counter

N = int(input())
a = list(map(int, input().split()))
cnts = Counter(a)

_sum = 0
for key,value in cnts.items():
    _sum +=  value*(value-1)//2

for ai in a:
    ans = _sum
    c = cnts[ai]
    ans -= c*(c-1)//2
    ans += (c-1)*(c-2)//2
    print(ans)
### BUGGY CODE ###

s = input()
count = 0
s = s.replace('BC','X')
for i in range(len(s)):
    if s[i] == 'X':
        for j in range(i,-1,-1):
            if s[j] == 'B' or s[j] == 'C':
                break
            if s[j] == 'A':
                count += 1
print(count)

### FIXED CODE ###

s = input()
count = 0
s = s.replace('BC','X')
s = s.replace('B','Z').replace('C','Z')
s = s.split('Z')
for i in s:
    ac = 0
    for j in range(len(i)):
        if i[j] == 'A':
            ac += 1
        if i[j] == 'X':
            count += ac
print(count)
### BUGGY CODE ###

int_n = int(input())
ar_int = list()
for i in range(int_n):
    ar_int.append(int(input()))

target = 2
counter = 0

while counter < int_n:
    if target in ar_int:
        target = ar_int.index(target) + 1
        counter += 1
        if target == 1:
            print(counter)
            exit(0)
print(-1)


### FIXED CODE ###

int_n = int(input())
ar_int = list()
for i in range(int_n):
    ar_int.append(int(input()))

target = 1
counter = 0

while counter < int_n:
    target = ar_int[target - 1]
    counter += 1
    if target == 2: # button 2
        print(counter)
        exit(0)
print(-1)
### BUGGY CODE ###

n,p = map(int,input().split())
if n == 1:
    print(p)
    exit()
i =1
ans =1
while i**n <= p:
    if p%(i**n)==0:
        ans *= i
        p =p//(i**n)
        i =1
    i += 1
print(ans)


### FIXED CODE ###

n,p = map(int,input().split())
if n == 1:
    print(p)
    exit()
if n >=40:
    print(1)
    exit()
i =2
ans =1
while i**n <= p:
    if p%(i**n)==0:
        ans *= i
        p =p//(i**n)

    else:
        i += 1
print(ans)
### BUGGY CODE ###

def topo_sort(g):
    from collections import deque
    V = len(g)
    deg = [0]*V
    for src in range(V):
        for dst in g[src]:
            deg[dst] += 1
    ans = list(v for v in range(V) if deg[v]==0)
    deq = deque(ans)
    used = [0]*V

    while deq:
        v = deq.popleft()
        for t in g[v]:
            deg[t] -= 1
            if deg[t]==0:
                deq.append(t)
                ans.append(t)
    return ans

def resolve():
    N, M = list(map(int, input().split()))
    LRD = [list(map(int, input().split())) for _ in range(M)]
    adj_list = [[] for _ in range(N)]
    adj_matrix = [[None for _ in range(N)] for __ in range(N)]
    for lrd in LRD:
        l, r, d = lrd
        adj_list[l-1].append(r-1)
        adj_matrix[l-1][r-1] = d
    
    #top_order = topological_sort(adj_list)
    top_order = topo_sort(adj_list)
    
    if len(top_order) != len(adj_list):
        print("No")
        return
    
    acc = 0
    start = top_order[0]
    now = top_order[0]
    for i in range(1, len(top_order)):
        nxt = top_order[i]
        if adj_matrix[now][nxt] is not None:
            if adj_matrix[start][nxt] is not None and acc+adj_matrix[now][nxt] != adj_matrix[start][nxt]:
                print("No")
                return
            acc += adj_matrix[now][nxt]
        now = nxt
        
    print("Yes")


if '__main__' == __name__:
    resolve()

### FIXED CODE ###

def resolve():
    N, M = list(map(int, input().split()))
    LRD = [list(map(int, input().split())) for _ in range(M)]
    adj_list = [[] for _ in range(N)]
    for lrd in LRD:
        l, r, d = lrd
        adj_list[l-1].append((l-1, r-1, d))
        adj_list[r-1].append((r-1, l-1, -d))
    
    X = [None]*N
    import collections

    for i in range(N):
        if X[i] is not None:
            continue
        q = collections.deque(adj_list[i])
        X[i] = 0
        while q:
            src, nxt, d = q.pop()
            if X[nxt] is not None:
                if X[nxt] != X[src] + d:
                    print("No")
                    return
            else:
                X[nxt] = X[src] + d
                q.extend(adj_list[nxt])
    print("Yes")

    


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

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

for i in range(k):
    H.append(0)

cost = [float('INF')]*(n+k)
cost[0] = 0

for i in range(n-1):
    for j in range(1, k+1):
        jump = cost[i] + abs(H[i+j]-H[i])
        if jump < cost[i+j]:
            cost[i+j] = jump

print(cost[n-1])

### FIXED CODE ###

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

for i in range(k):
    H.append(0)

cost = [float('INF')]*(n+k)
cost[0] = 0

for i in range(n-1):
    for j in range(1, k+1):
        jump = cost[i] + abs(H[i+j]-H[i])
        if jump < cost[i+j]:
            cost[i+j] = jump

print(cost[n-1])
### BUGGY CODE ###

import heapq
def SME(start,end):
    if end > N : end = N
    count = 0
    for i,x in enumerate(Whole[start:end]):
        heapq.heappush(A,[x,i])
    for j in range(start,end):
        a = heapq.heappop(A)
        if None not in ANS[a[1]:a[1]+L] : continue
        for i in range(L):
            idx = a[1] + i
            try :
                if ANS[idx] : continue
                else :
                    ANS[idx] = a[0]
                    count += 1
            except IndexError : continue
        if count > N * parameter : break
    for i in range(L):
        if ANS[i] : continue
        else : ANS[i] = min(Whole[:i+1])
    i = L
    while i < N :
        if None in ANS[i:i+L] :
            while True:
                if ANS[i] :
                    i += 1
                    continue
                else : 
                    ANS[i] = min(Whole[i+1-L:i+1])
                    i += 1
                    break
        else :
            i += L
    return ANS
[N,L] = [int(x) for x in input().split()]
Whole = [int(x) for x in input().split()]
A = []
parameter = 0.9907
ANS = [None]*N
ANS = SME(0, N)
for i in ANS[L-1:-1]:print(i, end=" ")
print(ANS[-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
### BUGGY CODE ###

mod=10**9+7
s=input()
dp=[[0]*13 for _ in range(len(s)+1)]
dp[0][0]=1
r=[i%13 for i in range(130)]

for i in range(len(s)):
  if s[i]=='?':
    for j in range(13):
      for k in range(10):
        dp[i+1][r[j*10+k]]+=dp[i][j]
  else:
    t = int(s[i])
    for j in range(13):
      dp[i+1][r[j*10+t]] += dp[i][j]

  for k in range(13):
    dp[i+1][k] %= mod

print(dp[len(s)][5])

### FIXED CODE ###

mod=10**9+7
s=input()
dp=[[0]*13 for _ in range(len(s)+1)]
dp[0][0]=1
r=[i%13 for i in range(130)]

for i in range(len(s)):
  if s[i]=='?':
    for j in range(13):
      for k in range(10):
        dp[i+1][r[j*10+k]]+=dp[i][j]
  else:
    t = int(s[i])
    for j in range(13):
      dp[i+1][r[j*10+t]] += dp[i][j]

  for k in range(13):
    dp[i+1][k] %= mod

print(dp[len(s)][5])
### BUGGY CODE ###

import resource
import sys
from functools import lru_cache
N, K = map(int, input().split())
A = list(map(int, input().split()))

sys.setrecursionlimit(1000000)

@lru_cache(maxsize=None)
def f(k, p):
  w = set()
  for a in A:
    if k >= a:
      w.add(f(k-a, p ^ 1))
  if len(w) == 0:
    return p ^ 1
  elif None in w:
    return None
  elif p in w:
    return p
  else:
    return 1 ^ p


print('First' if f(K, 0) == 0 else 'Second')


### FIXED CODE ###

import resource
import sys
from functools import lru_cache
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.reverse()
sys.setrecursionlimit(1000000)

@lru_cache(maxsize=None)
def f(k, p):
  for a in A:
    if k >= a:
      if f(k-a, p ^ 1) == p:
        return p
  return p ^ 1

print('First' if f(K, 0) == 0 else 'Second')
### BUGGY CODE ###

import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    S = input()
    R = []
    G = []
    B = []
    for i in range(N):
        if i == 0:
            if S[0] == "R":
                R.append(1)
                B.append(0)
                G.append(0)
            elif S[0] == "B":
                R.append(0)
                B.append(1)
                G.append(0)
            else:
                R.append(0)
                B.append(0)
                G.append(1)
            continue
        if S[i] == "R":
            R.append(R[i - 1] + 1)
            B.append(B[i - 1])
            G.append(G[i - 1])
        elif S[i] == "G":
            R.append(R[i - 1])
            B.append(B[i - 1])
            G.append(G[i - 1] + 1)
        else:
            R.append(R[i - 1])
            B.append(B[i - 1] + 1)
            G.append(G[i - 1])

    answer = 0
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            if (S[i], S[j]) == ("G", "R") or (S[i], S[j]) == ("R", "G"):
                answer += B[-1] - B[j]
                if 2 * j - i < N:
                    if S[2 * j - i] == "B":
                        answer -= 1
            elif (S[i], S[j]) == ("G", "B") or (S[i], S[j]) == ("B", "G"):
                answer += R[-1] - R[j]
                if 2 * j - i < N:
                    if S[2 * j - i] == "R":
                        answer -= 1
            elif (S[i], S[j]) == ("B", "R") or (S[i], S[j]) == ("R", "B"):
                answer += G[-1] - G[j]
                if 2 * j - i < N:
                    if S[2 * j - i] == "G":
                        answer -= 1
    print(answer)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from collections import Counter


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    S = input()
    C = Counter(S)
    R = C.get("R", 0)
    G = C.get("G", 0)
    B = C.get("B", 0)
    ans = R * G * B
    for left in range(N):
        for mid in range(left + 1, N):
            right = mid + mid - left
            if right < N:
                if S[right] != S[mid] and S[mid] != S[left] and S[right] != S[left]:
                    ans -= 1
    print(ans)


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

N,K=map(int,input().split())
P=list(map(int,input().split()))
E=list()
ans=0
for p in P:
    E.append((1+p)/2)
for i in range(N-K+1):
    ans=max(ans,sum(E[i:i+K]))
print(ans)

### FIXED CODE ###

import queue
N,K=map(int,input().split())
P=list(map(int,input().split()))
que=queue.Queue()
que_tmp=queue.Queue()
ans=0
tmp=0
cnt=0
for p in P:
    if cnt<K:
        que_tmp.put(1+p)
        tmp+=1+p
        cnt+=1
    else:
        que.put(1+p)

while not que.empty():
    dis=que_tmp.get()
    plus=que.get()
    que_tmp.put(plus)
    tmp+=plus-dis
    ans=max(ans,tmp)
print(max(ans,tmp)/2)