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

N = int(input())
S = str(input())
P = 0
JI = 0
RGB = 'R'
for i in range(0,N-2):
    for j in range(i+1,N-1):
        if S[i] != S[j]:
            JI = j-i
            if S[i] != 'R' and S[j] != 'R':
                RGB = 'R'
            if S[i] != 'G' and S[j] != 'G':
                RGB = 'G'
            if S[i] != 'B' and S[j] != 'B':
                RGB = 'B'
            for k in range(j+1,N):
                if S[k] == RGB and JI != k-j:
                    P += 1
print(P)

### FIXED CODE ###

N = int(input())
S = str(input())
P = 0
R = S.count('R')
G = S.count('G')
B = S.count('B')
P = R*G*B
for i in range(1,(N//2)+1):
    for j in range(N-2*i):
            if S[j]!=S[j+i] and S[j+i]!=S[j+2*i] and S[j]!=S[j+2*i]:
                P -= 1
print(P)
### BUGGY CODE ###

def main():
    N, M = map(int, input().split(" "))
    A = list(map(int, input().split(" ")))
    for i in range(M):
        A.sort()
        b, c = map(int, input().split(" "))
        for j in range(b):
            if A[j] < c:
                A[j] = c
    print(sum(A))


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    a = sorted(list(map(int, input().split())))
    change = []
    change_n = 0
    for _ in range(m):
        b, c = map(int, input().split())
        change.append((b, c))
        change_n += b
    change.sort(key=lambda x: x[1], reverse=True)
    answer = 0
    added = 0
    index = 0
    for i in range(n):
        if i < change_n:
            if added + change[index][0] == i:
                added = i
                index += 1
            answer += max(a[i], change[index][1])
        else:
            answer += a[i]
    print(answer)


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

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

for i in range(n):
    k = list_num.copy()
    k.pop(i)
    x = []
    count = 0
    for j in range(len(k)):
        if not k[j] in x:
            num = k.count(k[j])
            count += num * (num-1) / 2
            x.append(k[j])
    
    print(int(count))


### FIXED CODE ###

import collections
n=int(input())
arr=list(map(int,input().split()))
cnt=collections.Counter(arr) #各数Akの個数を数える
total=0
for key in cnt.keys():
  total+=cnt[key]*(cnt[key]-1)//2 #各数Akについて、cnt[Ak]個から異なる2個のボールを取り出す場合の数を事前に計算する
for i in range(n): #各iについて上記の方法で答えを求める
  print(total-cnt[arr[i]] + 1)
### BUGGY CODE ###

# import numpy as np

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

result = 1

for i in range(0, n):
    result = result * a[i]

# result = np.prod(a)

if result > pow(10, 18):
    result = -1

print(result)


### FIXED CODE ###

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

for i in a:
    result = result * i

    # result = np.prod(a)

    if (result > pow(10, 18)):
        result = -1
        break

print(result)
### BUGGY CODE ###

# coding: utf-8
# Your code here!

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

for i in range(1,M+1):
    L,R = map(int,input().split())
    curVec = set(range(L,R+1))
    
    if (i==1):
        curSet = curVec
    
    curSet = curSet.intersection(curVec)
    
print(len(curSet))

### FIXED CODE ###

# coding: utf-8
# Your code here!

N,M = map(int,input().split())
L = [0]*M
R = [0]*M
#Li,Ri = map(int,input().split())

for i in range(1,M+1):
    L[i-1],R[i-1] = map(int,input().split())

validID = min(R)-max(L)+1

if (validID>0):
    print(validID)
else:
    print("0")
### BUGGY CODE ###

N = int(input())
l = list(map(int,input().split()))
#print(l,l[:1],l[1:])
ans = []
for i in range(1,N):
  #print(sum(l[:i]),sum(l[i:]))
  #dif = abs(sum(l[:i])-sum(l[i:]))
  dif = abs(sum(l) - 2*sum(l[i:]))
  ans.append(dif)

print(min(ans))

### FIXED CODE ###

N = int(input())
l = list(map(int,input().split()))
ans = 100000000000000
x = 0
S = sum(l)
for i in range(N-1):
  #print("l["+str(i)+"]="+str(l[0]))
  x = x + l[i]
  #print(x,S-x)
  ans = min(ans, abs(x - (S - x)))
  #print(ans)
print(ans)
### BUGGY CODE ###

N,C=map(int,input().split())
List=[[int(i) for i in input().split()] for i in range(N)]
Time=[[0]*(10**5+1)]*C
Set={0}
for i in range(N):
  c=List[i][2]
  s=List[i][0]
  t=List[i][1]
  T_c=list(Time[c-1])
  T_c[s-1:t]=[1]*(t-s+1)
  Time[c-1]=list(T_c)
  Set.add(s-1)
  Set.add(t)
T=0
T_max=0
for t in Set:
  for c in range(C):
    T+=Time[c][t]
  if T_max<T:
    T_max=T
  T=0
print(T_max)



### FIXED CODE ###

N,C=map(int,input().split())
Time=[[0]*(10**5+1) for c in range(C)]
for i in range(N):
  s,t,c=map(int,input().split())  
  Time[c-1][s-1:t] = [1]*(t-s+1)
Times=max(map(sum,zip(*Time)))
print(Times)
### BUGGY CODE ###

import sys
input=sys.stdin.readline
class BinaryIndexedTree():
  def __init__(self,n):self.bit=[0]*n
  def add(self,i,x):
    i+=1
    while i<=len(self.bit):
      self.bit[i-1]+=x
      i+=i&-i
  def sum_1(self,i):
    a=0
    i+=1
    while i:
      a+=self.bit[i-1]
      i-=i&-i
    return a
  def sum(self,i,j):
    a=self.sum_1(j-1)
    if i!=0:a-=self.sum_1(i-1)
    return a
def tentousu(a):
  bit=BinaryIndexedTree(n)
  b=[0]*n
  for i in range(n):
    b[a[i]]=i
  ans=0
  for i in range(n):
    j=b[i]+bit.sum(b[i]+1,n)
    ans+=j-i
    bit.add(b[i],1)
  return ans
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
import itertools
xx=[i for i in range(n)]
for i in range(1,n,2):a[i],b[i]=b[i],a[i]
ans=inf=float('inf')
for i in itertools.combinations(xx,(n+1)//2):
  s=set(i)
  ac=[]
  bc=[]
  for j in range(n):
    if j in s:ac.append((a[j],j))
    else:bc.append((b[j],j))
  ac.sort()
  bc.sort()
  x=[]
  m=[]
  for j in range(n):
    if j%2:
      x.append(bc[j//2][0])
      m.append(bc[j//2][1])
    else:
      x.append(ac[j//2][0])
      m.append(ac[j//2][1])
  f=False
  for j in range(1,n):
    if x[j-1]>x[j]:f=True
  if f:continue
  ans=min(ans,tentousu(m))
if ans==inf:ans=-1
print(ans)

### FIXED CODE ###

class BinaryIndexedTree():
  def __init__(self,n):self.bit=[0]*n
  def add(self,i,x):
    i+=1
    while i<=len(self.bit):
      self.bit[i-1]+=x
      i+=i&-i
  def sum_1(self,i):
    a=0
    i+=1
    while i:
      a+=self.bit[i-1]
      i-=i&-i
    return a
  def sum(self,i,j):
    a=self.sum_1(j-1)
    if i!=0:a-=self.sum_1(i-1)
    return a
def tentousu(a):
  bit=BinaryIndexedTree(n)
  b=[0]*n
  for i in range(n):
    b[a[i]]=i
  ans=0
  for i in range(n):
    j=b[i]+bit.sum(b[i]+1,n)
    ans+=j-i
    bit.add(b[i],1)
  return ans
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
for i in range(1,n,2):a[i],b[i]=b[i],a[i]
ans=inf=float('inf')
for i in range(2**n):
  s=bin(i)[2:].zfill(n)
  if s.count("0")!=n//2:continue
  ac=[]
  bc=[]
  for j in range(n):
    if s[j]=="1":ac.append((a[j],j))
    else:bc.append((b[j],j))
  ac.sort()
  bc.sort()
  x=[]
  for j in range(n):
    if j%2:x.append(bc[j//2])
    else:x.append(ac[j//2])
  f=False
  for j in range(1,n):
    if x[j-1][0]>x[j][0]:f=True
  if f:continue
  m=[]
  for j in range(n):m.append(x[j][1])
  ans=min(ans,tentousu(m))
if ans==inf:ans=-1
print(ans)
### BUGGY CODE ###

H,N = map(int,input().split())
dp = [[[0,float('INF')]for i in range(H+1)] for _ in range(N+1)]
#↑[ダメージ、MP]

for i in range(N+1):
    dp[i][0][1]=0

# dp[i][j] -> iまでの魔法が使えるとき、j以上のダメージを与えるための最小限のMP
for i in range(1,N+1):
    a,b = map(int,input().split())
    for j in range(1,H+1):
        """
        その魔法を使わない場合のdp[i][j]
        dp[i-1][j]とdp[i][j-1]のうち、MPが若いものを使う。
        ただし、dp[i][j-1]に関しては、ダメージ(dp[i][j-1][0])がj未満の場合、使わない
        """
        dp[i][j] = dp[i-1][j][:]
        if dp[i][j-1][0] >= j and dp[i][j-1][1] < dp[i][j][1]:
            dp[i][j] = dp[i][j-1][:]
        
        """
        その魔法を使う場合のdp[i][j]
        j-a<=0の場合、dp[i][j]は
        dp[i][j]と[a,b]のうち、MPが若いものを使う。
        j-a>0の場合は、
        dp[i][j]とdp[i][j-a][1]+b,dp[i-1][j-a][1]+bのうち、MPが若いものを使う。
        """
        if j-a<=0:
            if b < dp[i][j][1]:
                dp[i][j]=[a,b]

        else:
            if dp[i][j-a][1]+b <= dp[i][j][1] and dp[i][j-a][1]+b <= dp[i-1][j-a][1]+b:
                dp[i][j]=[dp[i][j-a][0]+a,dp[i][j-a][1]+b]
            elif dp[i-1][j-a][1]+b <= dp[i][j][1] and dp[i-1][j-a][1]+b <= dp[i][j-a][1]+b:
                dp[i][j]=[dp[i-1][j-a][0]+a,dp[i-1][j-a][1]+b]


print(dp[N][H][1])

### FIXED CODE ###

#モンスターの体力は H
#トキはN種類の魔法が使え、
#i番目の魔法を使うと、モンスターの体力を Ai減らすことができますが、
#トキの魔力を Bi消耗します。

#dp[i] = モンスターの体力を i 減らすため消耗する魔力の最小値
#dp[i+1] = min(dp[i-Ai]+Bi,dp[i])
#dp[0]=0

import numpy as np
 
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab = np.array(ab)
 
a = ab[:, 0]
b = ab[:, 1]
 
dp = np.zeros(100001, dtype=np.int)
for i in range(1, h+1):
    dp[i] = (dp[i-a]+b).min()
print(dp[h])
### BUGGY CODE ###

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

a = list(map(int,input().split()))
bclist = [list(map(int,input().split())) for _ in range(m)]

a.sort()

last = 0

for bc in  bclist:
    for i in range(bc[0]):
        if a[i] < bc[1]:
            a[i] = bc[1]     
    a.sort()


print(sum(a))

### FIXED CODE ###

n,m = map(int, input().split())
a = list(map(int,input().split()))
bclist = [list(map(int,input().split())) for _ in range(m)]

bclist=sorted(bclist, key = lambda x:x[1], reverse=True)

all = []


for i in range(m):
    all.extend([bclist[i][1]]*bclist[i][0])
    if len(all) >n:
        break

all.extend(a)
all.sort(reverse=True)

print(sum(all[:n]))
### BUGGY CODE ###

import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

s = sinput()[::-1]
n = len(s)

a = "dream"[::-1]
b = "dreamer"[::-1]
c = "erase"[::-1]
d = "eraser"[::-1]

ss = ""
for i in range(n+1):
    for j in range(i+1,n+1):
        if s[i:j] in [a,b,c,d]: ss += s[i:j]; s = s[:i] + s[j:]

flag = len(ss) == n
ans = "YES" if flag else "NO"
print(ans)


### FIXED CODE ###

import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

s = sinput()[::-1]

a = "dream"[::-1]
b = "dreamer"[::-1]
c = "erase"[::-1]
d = "eraser"[::-1]

s = "".join(s.split(d))
s = "".join(s.split(c))
s = "".join(s.split(b))
s = "".join(s.split(a))

ans = "YES" if s=="" else "NO"
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Mar 30 22:26:37 2019

@author: Owner
"""

MOD = 1000000007

def inv(x):
    return pow(x, MOD - 2, MOD)

B, W = map(int, input().split())
fct = [1] * (B + W + 1)
for i in range(B + W):
    fct[i + 1] = (fct[i] * (i + 1)) % MOD

def c(n, k):
    return (fct[n] * inv(fct[k]) * inv(fct[n - k])) % MOD

#p[i]: 黒B回白i回の確率
#q[i]: 黒i回白W回の確率
p = [0] * W
p[0] = inv(pow(2, B, MOD))
for i in range(W - 1):
    p[i + 1] = (p[i] + c(B + i, i + 1) * inv(pow(2, B + i, MOD)) * inv(2)) % MOD
q = [0] * B
q[0] = inv(pow(2, W, MOD))
for i in range(B - 1):
    q[i + 1] = (q[i] + c(W + i, i + 1) * inv(pow(2, W + i, MOD)) * inv(2)) % MOD
for i in range(B + W):
    if i < min(B, W):
        print(inv(2))
        continue
    if i >= max(B, W):
        print((q[i - W] + (1 - p[i - B] - q[i - W] + MOD) * inv(2)) % MOD)
        continue
    if B < W:
        print(((1 - p[i - B] + MOD) * inv(2)) % MOD)
    else:
        print((q[i - W] + (1 - q[i - W] + MOD) * inv(2)) % MOD)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Mar 30 22:26:37 2019

@author: Owner
"""

MOD = 1000000007

def inv(x):
    return pow(x, MOD - 2, MOD)

B, W = map(int, input().split())
fct = [1] * (B + W + 1)
for i in range(B + W):
    fct[i + 1] = (fct[i] * (i + 1)) % MOD

def c(n, k):
    return (fct[n] * inv(fct[k]) * inv(fct[n - k])) % MOD

#p[i]: 黒B回白i回の確率
#q[i]: 黒i回白W回の確率
p = [0] * W
p[0] = inv(pow(2, B, MOD))
for i in range(W - 1):
    p[i + 1] = (p[i] + c(B + i, i + 1) * inv(pow(2, B + i, MOD)) * inv(2)) % MOD
q = [0] * B
q[0] = inv(pow(2, W, MOD))
for i in range(B - 1):
    q[i + 1] = (q[i] + c(W + i, i + 1) * inv(pow(2, W + i, MOD)) * inv(2)) % MOD
for i in range(B + W):
    if i < min(B, W):
        print(inv(2))
        continue
    if i >= max(B, W):
        print((q[i - W] + (1 - p[i - B] - q[i - W] + MOD) * inv(2)) % MOD)
        continue
    if B < W:
        print(((1 - p[i - B] + MOD) * inv(2)) % MOD)
    else:
        print((q[i - W] + (1 - q[i - W] + MOD) * inv(2)) % MOD)
### BUGGY 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)

### 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=int(input())
array=list(map(int,input().split()))
ans=1
for i in range(n):
  ans=ans*array[i]
if ans>10**18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

n=int(input())
array=list(map(int,input().split()))
ans=1
if 0 in array:
  ans=0
else:
  for i in range(n):
    if ans>10**18:
      break
    else:
      ans=ans*array[i]
if ans>10**18:
  print(-1)
else:
  print(ans)
### BUGGY CODE ###

import heapq

N, M = map(int, input().split(' '))
A = list(map(int, input().split(' ')))
AA = [[a, 1] for a in A]
while 2 <= len(AA) and AA[0][0] == AA[1][0] :
    _, cnt = AA.pop(0)
    AA[0][1] += cnt

H = []
for aa in AA :
    heapq.heappush(H, aa)


for i in range(M) :
    #print(H)
    B, C = map(int, input().split(' '))
    s = 0
    while len(H) > 0 and B > 0 :
        h = heapq.heappop(H)
        if C <= h[0] :
            heapq.heappush(H, h)
            break
        elif B <= h[1] :
            h[1] -= B
            if h[1] > 0 :
                heapq.heappush(H, h)
            s += B
            break
        else :
            B -= h[1]
            s += h[1]
    if s > 0 :
        heapq.heappush(H, [C, s])
#print(H)
ans = 0
for h in H :
    ans += h[0] * h[1]

print(ans)


### FIXED CODE ###

N, M = map(int, input().split(' '))
A = list(map(int, input().split(' ')))
A = [(1, a) for a in A]

D = [ tuple(map(int, input().split(' '))) for _ in range(M)]

AD = A + D
AD.sort(key = lambda x : -x[1])

ans = 0
cnt = 0
for ad in AD :
    if N < cnt + ad[0] :
        ans += ad[1] * (N - cnt)
        break
    else :
        cnt += ad[0]
        ans += ad[1] * ad[0]

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

from numba import njit
 
N = int(input())
A = [int(a)-1 for a in input().split()]
M = N + 2
X = [max(min(i-1, j-1, M-2-i, M-2-j), -1) for j in range(M) for i in range(M)]
Y = [min(x, 0) + 1 for x in X]

@njit(cache=True)
def calc(N, M, A, X, Y):
    ans = 0
    for a in A:
        aa = (a // N + 1) * M + a % N + 1
        ans += X[aa]
        h = X[aa]
        if h < 0: continue
        Q = [(aa, h)]
        X[aa] -= 1
        Y[aa] = 0
        dd = (-1, 1, M, -M)
        while Q:
            i, h = Q.pop()
            for d in dd:
                j = i + d
                y = Y[j]
                if X[j] >= h + y:
                    X[j] -= 1
                    Q.append((j, h + y))
    return ans

print(calc(N, M, A, X, Y))

### FIXED CODE ###

from collections import deque
N = int(input())
A = [int(a)-1 for a in input().split()]
M = N + 2
X = [max(min(i-1, j-1, M-2-i, M-2-j), -1) for j in range(M) for i in range(M)]
Y = [min(x, 0) + 1 for x in X]

def calc(i0):
    h = X[i0]
    if h < 0: return
    Q = deque([(i0, h)])
    X[i0] -= 1
    Y[i0] = 0
    dd = (-1, 1, M, -M)
    while Q:
        i, h = deque.popleft(Q)
        for d in dd:
            j = i + d
            y = Y[j]
            if X[j] >= h + y:
                X[j] -= 1
                deque.append(Q, (j, h + y))
ans = 0
for a in A:
    aa = (a // N + 1) * M + a % N + 1
    ans += X[aa]
    calc(aa)
print(ans)
### BUGGY CODE ###

s = input()
n = len(s)

skip_num = []

if n < 4:
    print('0')
else:
    cnt = 0
    for j in range(n-3):
        if j in skip_num:
            continue

        i = 0
        skip_add = 0
        while i < n-3-j:
            step = int(s[n-4-i-j:n-j])
            if step % 2019 == 0:
                skip_num.append(j+i+4)
                cnt += 1+skip_add
                skip_add += 1
                i += 3
            i += 1
    print(cnt)

### FIXED CODE ###

import collections
s = input()
n = len(s)
mod_list = [0]

T = 0
for i in range(n):
    T += int(s[-1-i])*pow(10, i, 2019)%2019
    T = T%2019
    mod_list.append(T)

res = collections.Counter(mod_list)
cnt = 0
for d in res.values():
    cnt += int(d*(d-1)/2)
print(cnt)
### BUGGY CODE ###

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

def p(x,y,res):
  if S[y][x]=="#":
    res+=1
  m,n=10001,10001
  if x==W-1 and y==H-1:
    return res
  else:
    if x!=W-1:
      m=p(x+1,y,res)
    if y!=H-1:
      n=p(x,y+1,res)
  return min(m,n)   
  
print(p(0,0,0))

### FIXED CODE ###

H,W = map(int,input().split())
S = [list(input()) for _ in range(H)]
INF=10001
dp = [[INF]*W for _ in range(H)]
dp[0][0] = 0 if S[0][0] == "." else 1
 
for i in range(H):
  for j in range(W):
    m,n=INF,INF
    if i != 0:
      m = dp[i-1][j] + (S[i-1][j] == "." and S[i][j] == "#")
    if j != 0:
      n = dp[i][j-1] + (S[i][j-1] == "." and S[i][j] == "#")
 
    dp[i][j] = min(m, n, dp[i][j])
  
print(dp[H-1][W-1])
### BUGGY CODE ###

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

i=1
count=0

if 1 in a:
    while len(a)>0:
        if i in a:
            del a[:a.index(i)]
            i+=1

        else:
            break
    #print(i)

    print(N-(i-1))
else:
    print(-1)

### FIXED CODE ###

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

base=1
count=0

if 1 in a:
    for i in range(N):
        if a[i]==base:
            count+=1
            base+=1
        else:
            pass

    #print(i)
    print((N-count)%N)
else:
    print(-1)
### BUGGY CODE ###

import math

MOD = 10**9+7


def modinv(x):
    ret = 1
    m = MOD - 2
    '''
    while m:
        if m & 1:
            ret = ret * x % MOD
        x = x * x % MOD
        m >>= 1
    '''
    for i in range(0, 32):
        if m & (1 << i):
            ret *= x
            ret %= MOD
        x *= x
        x %= MOD
    return ret


fact = [1] * 200100
for i in range(1, 200100):
    fact[i] = fact[i-1] * i % MOD


def calc(h, w):
    h -= 1
    w -= 1
    return (fact[h+w]*modinv(fact[h]) % MOD)*modinv(fact[w]) % MOD


h, w, a, b = map(int, input().split())
ans = 0
for i in range(1, h - a + 1):
    ans += calc(i, b) * calc(h + 1 - i, w - b)
    ans %= MOD
    # print(ans)
print(ans)
'''
print(modinv(2))
print(bin(MOD-2))
#print(2**(MOD-2) % MOD)
'''


### FIXED CODE ###

import math

MOD = 10**9+7


def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0


def modinv(a):
    g, x, y = xgcd(a, MOD)
    return x % MOD


fact = [1] * 200100
for i in range(1, 200100):
    fact[i] = fact[i-1] * i % MOD


def calc(h, w):
    h -= 1
    w -= 1
    return (fact[h+w]*modinv(fact[h]) % MOD)*modinv(fact[w]) % MOD


h, w, a, b = map(int, input().split())
if a >= h // 2:
    ans = 0
    for i in range(1, h - a + 1):
        ans += calc(i, b) * calc(h + 1 - i, w - b) % MOD
        if ans >= MOD:
            ans -= MOD
    print(ans)

else:
    ans = calc(h, w)
    for i in range(h-a+1, h + 1):
        ans -= calc(i, b) * calc(h + 1 - i, w - b) % MOD
        if ans < 0:
            ans += MOD
    print(ans)
### BUGGY CODE ###

from fractions import gcd
def main(): #startline-------------------------------------------
    k = int(input())
    ans = 0
    for i in range(1,k+1):
        for j in range(1,k+1):
            for l in range(1,k+1):
                ans += gcd(gcd(i,j),l)

    print(ans)
if __name__ == "__main__":
    main() #endline===============================================

### FIXED CODE ###

from math import gcd
def main(): #startline-------------------------------------------
    k = int(input())
    ans = 0
    for i in range(1,k+1):
        for j in range(1,k+1):
            for l in range(1,k+1):
                ans += gcd(gcd(i,j),l)

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

import sys
n,k=map(int,input().split())
a=list(map(int,input().split()))
sum=[0]*n
sum[0]=a[0]

def input():
    return sys.stdin.readline()[:-1]

def main():
    
    for i in range(1,n):
        sum[i]=sum[i-1]*a[i]
        if i>=k:
            sum[i]/=a[i-k]
    
    # p=[0]*n
    # for i in range(k-1,n):
    #     if i==k-1:
    #         p[i]=sum[i]
    #     else:
    #         p[i]=sum[i]/sum[i-k]


    # for i in range(k,n):
    #     if p[i]>p[i-1]:
    #         print('Yes')
    #     else:
    #         print('No')

    for i in range(k,n):
        if sum[i]>sum[i-1]:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    main()


### FIXED CODE ###

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

for i in range(k,n):
    if a[i]>a[i-k]:
        print('Yes')
    else:
        print('No')