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

# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
N,K = map(int, input().split())
A = list(map(int, input().split()))
aa =1
DP =[0]*(N-K+1)
for i in A[:K]:
    aa *=i
DP[0] =aa

for i in range(N -K):
    DP[i+1] =DP[i]*A[i+K]//A[i]
    if DP[i+1] >DP[i]:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

#解説を見て
# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
N,K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(N -K):
    if A[i] <A[i+K]:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
l = []
for i in range(N):
    l.append(A.index(i+1)+1)

print(*l)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
l = [0]*N
for i in range(N):
    l[A[i]-1] = i +1

print(*l)
### BUGGY CODE ###

def main():
    S = input()
    lengh_S = len(S)
    while True:
        if "01" in S or "10" in S:
            S = S.replace("01", "").replace("10", "")
        else:
            break
    print(lengh_S - len(S))


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    S = input()
    print(min(S.count("0"), S.count("1")) * 2)


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

import sys
from math import sqrt
 
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
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 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 divisor_set(N: int) -> set:
    s = {1, N}
    for i in range(2, int(sqrt(N))+1):
        if N % i == 0:
            s.add(i)
            s.add(N // i)
    return s
 
N=INT()
A=LIST()
 
A2=[0]*N
B=[]
for i in range(N-1, -1, -1):
    if A[i]!=A2[i]:
        B.append(i+1)
        div=divisor_set(i+1)
        for num in div:
            A2[num-1]=1-A2[num-1]
        
print(len(B))
print(*B)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
 
ans = set()
 
for i in range(N-1,-1,-1):
    a = A[i]
    for j in range(i+1,N+1,i+1):
        if j in ans:
            a += 1
    if a%2:
        ans.add(i+1)
 
print(len(ans))
print(*ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

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

WAs = [0] * n
ACs = []
ac_append = ACs.append
penalty = 0
for i in range(m):
    p, s = input().strip().split(' ')
    p = int(p) - 1
    if p in ACs:
        continue
    if s == 'AC':
        penalty += WAs[p]
        ac_append(p)
    else:
        WAs[p] += 1

print(len(ACs), penalty)


### FIXED CODE ###

import sys
input = sys.stdin.readline

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

WAs = [0] * n
correct = 0
penalty = 0
for i in range(m):
    p, s = input().strip().split(' ')
    p = int(p) - 1
    if WAs[p] == -1:
        continue
    if s == 'AC':
        penalty += WAs[p]
        correct += 1
        WAs[p] = -1
    else:
        WAs[p] += 1

print(correct, penalty)
### BUGGY CODE ###

a, b, k = map(int, input().split())
data = [i for i in range(a, b + 1)]

ans = []
if k > len(data):
    k = len(data)
for i in range(k):
    if data[i] not in ans:
        ans.append(data[i])
for i in range(len(data) - k, len(data)):
    if data[i] not in ans:
        ans.append(data[i])

for i in ans:
    print(i)

### FIXED CODE ###

a, b, k = map(int, input().split())
if k >= -(-(b - a + 1)//2):
    for i in range(a, b + 1):
        print(i)
else:
    for i in range(a, a + k):
        print(i)
    for i in range(b + 1 - k, b + 1):
        print(i)
### BUGGY CODE ###

from itertools import*
N,K,Q,*A=map(int,open(0).read().split())
l=len
s=sorted
a=[]
for Y in A:
	C=s(sum((v[:l(v)-K+1]for v in(s(v)for k,v in groupby(A,lambda a:a>=Y)if k)if l(v)>=K),[]))
	if l(C)>=Q:a+=C[Q-1]-Y,
print(min(a))

### FIXED CODE ###

N, K, Q, *A = map(int, open(0).read().split())

ans = float("inf")
for Y in A:
    C = []
    tmp = []
    for a in A:
        if a >= Y:
            tmp.append(a)
        else:
            if len(tmp) >= K:
                C += sorted(tmp)[:len(tmp) - K + 1]
            tmp = []
    if len(tmp) >= K:
        C += sorted(tmp)[:len(tmp) - K + 1]

    if len(C) >= Q:
        C.sort()
        X = C[Q - 1]
        ans = min(ans, X - Y)

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

def main():
  n=input()
  a=list(map(int,input().split()))
  ap=[i+1 for i in set(a)]
  am=[i-1 for i in set(a)]
  A=set(ap+am+a)
  count=0
  for i in A:
    x=a.count(i)+a.count(i+1)+a.count(i-1)
    count=x if x>count else count
  print(count)
if __name__=='__main__':
  main()

### FIXED CODE ###

def main():
  n=input()
  a=tuple(map(int,input().split()))
  cnt=[0]*(pow(10,5)+2)
  for i in a:
    cnt[i-1]+=1
    cnt[i]+=1
    cnt[i+1]+=1
  print(max(set(cnt)))   
if __name__=='__main__':
  main()
### BUGGY CODE ###

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

l = []
A = 0
B = 0
ans = 1
if M > 0:
    A, B = map(int, input().split())
    l.append({A, B})
for i in range(M-1):
    A, B = map(int, input().split())
    hit = None
    for tup in l:
        if A in tup or B in tup:
            if hit != None:
                hit = hit.union(tup, {A, B})
            else:
                hit = tup | {A, B}
            l.remove(tup)
    if hit != None:
        l.append(hit)
    else:
        l.append({A, B})

if len(l) > 0:
    ans = 1
for item in (l):
    if ans < len(item):
        ans = len(item)
print(ans)


### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


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

ans = 0
for i in range(M):
    A, B = map(int, input().split())
    uf.union(A-1, B-1)

for i in range(uf.group_count()):
    if ans < uf.size(i):
        ans = uf.size(i)
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
INF = float('inf')
p = 2 ** N
dp = [INF] * p
dp[0] = 0

for _ in range(M):
    a, b = map(int, input().split())
    c = sum([1 << (i - 1) for i in map(int, input().split())])
    for i in range(p):
        dp[i | c] = min(dp[i] + a, dp[i | c])

if dp[-1] != INF:
    print(dp[-1])
else:
    print(-1)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
INF = 10 ** 10
p = 2 ** N
dp = [INF] * p
dp[0] = 0

for _ in range(M):
    a, b = map(int, input().split())
    c = sum([2 ** (i - 1) for i in map(int, input().split())])
    for i in range(p):
        dp[i | c] = min(dp[i] + a, dp[i | c])

if dp[-1] != INF:
    print(dp[-1])
else:
    print(-1)
### BUGGY CODE ###

n,k =[int(x) for x in input().split()]

pre_value=n + k
tmp=n
while tmp < pre_value:
    pre_value = tmp
    tmp = abs( tmp - k)
    
print(pre_value)    

### FIXED CODE ###

n,k =[int(x) for x in input().split()]

pre_value = n+1
tmp = n
a = n // k 
tmp = n - a*k 
while tmp < pre_value:
    pre_value = tmp
    tmp = abs( tmp - k)
    
print(pre_value)
### BUGGY CODE ###

K, S = map(int, input().split(" "))
count = 0

for x in range(K + 1):
  for y in range(K + 1):
    for z in range(K + 1):
      ans = x + y + z
      if S == ans:
        count += 1
print(count)

### FIXED CODE ###

K, S = map(int, input().split(" "))
count = 0

for x in range(K + 1):
  for y in range(K + 1):
    if S - x - y >= 0 and S - x - y <= K:
      count += 1
     
print(count)
### BUGGY CODE ###

N = int(input())
s = [sorted(input()) for _ in range(N)]
ans = 0
for i in range(N-1):
  for j in range(i+1, N):
    if s[i] == s[j]: ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
s = {}
for _ in range(N):
  a = "".join(sorted(input()))
  if a not in s:
    s[a] = 0
  else: s[a] += 1

import math
ans = 0
for v in s.values():
  if v < 2: ans += v
  if v > 1: ans += v*(v+1)//2
print(ans)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
Q=int(input())
B=[list(map(int,input().split())) for i in range(Q)]
from bisect import bisect_left,bisect_right
# def 二分探索(リスト, 要素)
def index(lst, e):
    # Step 1. bisect_left して
    i = bisect_left(lst, e)
    
    # Step 2. 変な値を ValueError で弾いて
    if i == len(lst):
        return -1
    if lst[i] != e:
        return -1
    # Step 3. 値を返す。
    return i
def index2(lst, e):
    # Step 1. bisect_left して
    i = bisect_right(lst, e)
    
    # Step 2. 変な値を ValueError で弾いて
    if i == len(lst)+1:
        return -1
    if lst[i-1] != e:
        return -1
    # Step 3. 値を返す。
    return i
def merge_sort(arr):
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    # ここで分割を行う
    left = arr[:mid]
    right = arr[mid:]

    # 再帰的に分割を行う
    left = merge_sort(left)
    right = merge_sort(right)

    # returnが返ってきたら、結合を行い、結合したものを次に渡す
    return merge(left, right)


def merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    # ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
    while l_i < len(left) and r_i < len(right):
        # ここで=をつけることで安定性を保っている
        if left[l_i] <= right[r_i]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    # 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged

A=merge_sort(A)

for i in B:
    j=index(A,i[0])
    if not j==-1:
        k=index2(A,i[0])
        for l in range(j,k):
            A[l]=i[1]
    A=merge_sort(A)
    print(sum(A))


### FIXED CODE ###

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

dp=[0 for i in range(1,10**6)]
for i in A:
    dp[i]+=1
S=sum(A)
for i in B:
    S+=(i[1]-i[0])*dp[i[0]]
    print(S)
    dp[i[1]]+=dp[i[0]]
    dp[i[0]]=0
### BUGGY CODE ###

text_list = input().split()
n = 0
for i in range(int(text_list[3])):
  if i < int(text_list[0]):
    n += 1
  elif i < int(text_list[0]) + int(text_list[1]):
    pass
  elif i < int(text_list[0]) + int(text_list[1]) + int(text_list[2]):
    n -= 1
    
print(n)

### FIXED CODE ###

a, b, c, d = map(int, input().split())
if d <= a:
  print(d)
elif d <= a + b:
  print(a)
else:
  print(a-(d-(a+b)))
### BUGGY CODE ###

from bisect import bisect_left
from collections import deque

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

a.sort()
bc = sorted(bc, key=lambda x:x[1])

l = [0 for _ in range(n+1)]
for i in range(1,n+1):
	l[i] = a[i-1]
for i in range(n):
	l[i+1] += l[i]
#print(a,sum(a))
#print(bc)
#print(l)
ans = l[-1]
num = 0
loop = 0
A = deque(a)
while True:
	if len(bc) == 0:
		break
	tmp = bc.pop()
	b = tmp[0]
	c = tmp[1]
	index = bisect_left(a,c)
	if index == 0:
		break
	if b >= index:
		ans -= l[index+num] - l[num]
		ans += index * c
		num += index
		loop = index
	else:
		ans -= l[b+num] - l[num]
		ans += b * c
		num += b
		loop = b
	for _ in range(loop):
		A.popleft()
	a = list(A)
print(ans)


### FIXED CODE ###

import sys

def main():
    input = sys.stdin.readline

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

    a.sort()
    a = tuple(a)

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

    num = 0
    ans = 0

    for i in range(m):
        b = bc[i][0]
        c = bc[i][1]
        for j in range(num,min(num+b,n)):
            if c > a[j]:
                ans += c
            else:
                ans += a[j]

        num += b
        if num >= n:
            break

    if num < n:
        print(ans + sum(a[num:]))
    else:
        print(ans)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

def main():
    from bisect import bisect_left
    from array import array
    I=10**9+1
    n,*t=open(0)
    n,q=map(int,n.split())
    *d,=map(int,t[n:])
    z=[]
    for t in t[:n]:
        s,t,x=map(int,t.split())
        z.append((x,bisect_left(d,s-x),bisect_left(d,t-x)))
    z.sort(reverse=1)
    N0=2**(q+1).bit_length()
    data=array('I',[I]*2*N0)
    for x,l,r in z:
        L,R=l+N0,r+N0
        while L<R:
            if R&1:
                R-=1
                data[R-1]=x
            if L&1:
                data[L-1]=x
                L+=1
            L>>=1
            R>>=1
    for k in range(q):
        k+=N0-1
        s=I
        while k+1:
            if data[k]<s:s=data[k]
            k=~-k//2
        print(-(s==I)or s)
if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    from bisect import bisect_left
    def update(l,r,v):
        L,R=l+N0,r+N0
        while L<R:
            if R&1:
                R-=1
                data[R-1]=v
            if L&1:
                data[L-1]=v
                L+=1
            L>>=1
            R>>=1
    def query(k):
        k+=N0-1
        s=10**18
        while k+1:
            if data[k]<s:s=data[k]
            k=~-k//2
        return s
    n,*t=open(0)
    n,q=map(int,n.split())
    d=[-10**18]+list(map(int,t[n:]))+[10**18]
    N0=2**(q+1).bit_length()
    data=[10**18]*2*N0
    for x,t,s in sorted(list(map(int,t.split()))[::-1]for t in t[:n])[::-1]:
        l=bisect_left(d,s-x)
        r=bisect_left(d,t-x)
        update(l,r,x)
    for i in range(q):
        a=query(i+1)
        print(-(a==10**18)or a)
if __name__=='__main__':
    main()
### BUGGY CODE ###

# d
I = lambda: map(int, input().split())
n, k = I()
a = []
for _ in range(n):
    t, d = I()
    a += [d, t, 0],
a.sort(key = lambda a: a[0], reverse = True)
b = 0
c = [0]*(n+1)
e = 0
for i in a[:k]:
    b += i[0]
    if c[i[1]] == 0: e += 1
    c[i[1]] += 1
    i[2] = 1
f = b+e**2
for i in range(k, n):
    g = a[i]
    if c[g[1]] > 0: continue
    for j in a[:i][::-1]:
        if j[2] > 0 and c[j[1]] > 1:
            b += g[0]-j[0]
            g[2] = 1
            j[2] = 0
            c[g[1]] += 1
            c[j[1]] -= 1
            e += 1
            f = max(f, b+e**2)
            break
print(f)

### FIXED CODE ###

mi = lambda: map(int, input().split())
n, k = mi()
sushis = [list(mi()) for _ in range(n)]
types = set()
sushis.sort(key = lambda x: x[1], reverse = True)
bp = tp = sp = 0
exts = []
for t, d in sushis[:k]:
    bp += d
    if t in types:
        exts += d,
    else:
        types.add(t)
        tp += 1
sp = bp+tp**2
for t, d in sushis[k:]:
    if not exts: break
    if t not in types:
        types.add(t)
        bp += d-exts.pop()
        tp += 1
        sp = max(sp, bp+tp**2)
print(sp)
### BUGGY CODE ###

N = int(input())
A = list((int(x)%(10**9+7) for x in input().split()))
ans = 0
for i in range(N-1):
  for j in range(i+1,N):
    ans += A[i]*A[j]%(10**9+7) % (10**9+7)
print(ans % (10**9+7))

### FIXED CODE ###

N = int(input())
b = 10**9+7
A = list((int(x) for x in input().split()))
sum = 0
for a in A:
  sum += a
ans = 0
for i in range(N-1):
  sum -= A[i]
  ans += A[i]*sum
print(ans % b)
### BUGGY CODE ###

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


if d_l[0] != 0 or d_l.count(0) != 1:
    ans = 0
else:
    ans = 1

n_tmp = n-1
for i in range(1,n):
    n_tmp2 = d_l.count(i-1)
    n_tmp3 = d_l.count(i)
    ans = ans*(n_tmp2**n_tmp3)
    n_tmp -= n_tmp3
    if n_tmp == 0:
        break

print(ans%998244353)

### FIXED CODE ###

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

count_dict = {}
for i in range(n):
    count_dict[i] = 0
for val in d_l:
    count_dict[val] += 1

if d_l[0] != 0 or count_dict[0] != 1:
    ans = 0
else:
    ans = 1

for i in range(1,n):
    ans = (ans*(count_dict[i-1]**count_dict[i])) %998244353
    if ans == 0:
        break

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

nm=list(map(int,input().split()))
n=nm[0]
m=nm[1]

inp=[]
if m==0:
    inp=[n+1]
    dis=[n+1]
else:
    for inpset in range(m):
        inp.append(int(input()))
    

    dis=[max(inp[0],1)]
    p=0
    for i in inp[:-1]:
        dis.append(inp[p+1]-inp[p]-1)
        p+=1
    dis.append(max(n-inp[-1],1))
    #print (dis)

import math

def kaijo(x):
    ans=(math(100000)%1000000007)
    return ans

def combinations_count(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r)))%1000000007

def counting(x):
    if x==1:
        return 1
    else:
        
        res=0
        for a in range(x-1):
            if x-1-a>=a:
                res+=combinations_count(x-1-a,a)
                # print(x-1-a,a)
                res=res%1000000007
            else:
                break
        return res

if 0 in dis:
    print(0)
else:
    ans=1
    dis.sort()
    for d in dis:
        ans*=counting(d)
        ans=ans%1000000007
    print(ans)



### FIXED CODE ###

nm=list(map(int,input().split()))
n=nm[0]
m=nm[1]

inp=[]
if m==0:
    inp=[n+1]
    dis=[n+1]
else:
    for inpset in range(m):
        inp.append(int(input()))
    

    dis=[max(inp[0],1)]
    p=0
    for i in inp[:-1]:
        dis.append(inp[p+1]-inp[p]-1)
        p+=1
    dis.append(max(n-inp[-1],1))
    #print (dis)

def fib(x):
    a=0
    b=1
    for step in range(x):
        c=a+b
        a=b
        b=c
    return a


def counting(x):
    if x==1:
        return 1
    else:
        
        res=0
        for a in range(x-1):
            if x-1-a>=a:
                res+=combinations_count(x-1-a,a)
                # print(x-1-a,a)
            else:
                break
        res=res%1000000007
        return res

if 0 in dis:
    print(0)
else:
    ans=1
    dis.sort()
    for d in dis:
        ans*=fib(d)%1000000007
        ans=ans%1000000007
    print(ans)
### BUGGY CODE ###

A,B,C,K = map(int,input().split())
rank=0
ans = 0
for i in range(K):
  if i<A:
    ans+=1
  elif A<=i and i<A+B:
    continue
  else:
    ans-=1
print(ans)

### FIXED CODE ###

A,B,C,K = map(int,input().split())
rank=0
ans = 0
if K<=A:
  print(K)
elif A+B>=K and K>A:
  print(A)
else:
  tem=K-A-B
  ans=A-tem
  print(ans)
### BUGGY CODE ###

n = int(input())
a=input().split()
a_int = [int(i) for i in a]

ans=[0]*n

for i in range(n-1):
    s=str(i+1)
    ans[i]=a.count(s)

print(*ans, sep='\n')

### FIXED CODE ###

n = int(input())
a=input().split()

ans=[0]*n

for i in range(n-1):
    ans[int(a[i])-1]+=1
    
print(*ans, sep='\n')
### BUGGY CODE ###

import bisect
n, m, q = map(int, input().split())
edges = []
for i in range(m):
    L, R = map(int, input().split())
    edges.append((L, R, i))

L_sorted = sorted(edges)
L_sorted_bi = [L for L, R, i in L_sorted]
L_cum_set = [set()for _ in range(m+1)]
for i in reversed(range(m)):
    L_cum_set[i] = L_cum_set[i+1] | {L_sorted[i][2]}


R_sorted = sorted(edges, key=lambda x: x[1])
R_sorted_bi = [R for L, R, i in R_sorted]
R_cum_set = [set()for _ in range(m+1)]
for i in range(m):
    R_cum_set[i+1] = R_cum_set[i] | {R_sorted[i][2]}


for _ in range(q):
    p, q = map(int, input().split())
    idx = bisect.bisect_left(L_sorted_bi, p)
    s = L_cum_set[idx]

    idx = bisect.bisect_left(R_sorted_bi, q+1)
    t = R_cum_set[idx]
    print(len(s & t))


### FIXED CODE ###

n, m, q = map(int, input().split())
edges = [[0]*n for _ in range(n)]

for _ in range(m):
    L, R = map(lambda x: int(x)-1, input().split())
    edges[L][R] += 1


S = [[0]*(n+1)for _ in range(n+1)]
for i in range(n):
    for j in range(n):
        S[i][j+1] = S[i][j] + edges[i][j]

for _ in range(q):
    p, q = map(int, input().split())
    lines = S[p-1:q]
    ans = 0
    for row in lines:
        ans += row[q]-row[p-1]
    print(ans)
### BUGGY CODE ###

n=int(input())
l=[int(i) for i in input().split()]
l.sort()


def binarysearch(lista,b):
    left=0
    right=len(lista)
    while left<right:
        mid=(left+right)//2
        if lista[mid]>=b:
            right=mid
        else:
            left=mid+1
            mid+=1
    return mid

ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        ans+=(binarysearch(l,l[i]+l[j])-(j+1))
print(ans)


### FIXED CODE ###

n=int(input())
l=[int(i) for i in input().split()]
l.sort()


def binarysearch(lista,b):
    left=0
    right=len(lista)
    while left<right:
        mid=(left+right)//2
        if lista[mid]>=b:
            right=mid
        else:
            left=mid+1
            mid+=1
    return mid

ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        ans+=(binarysearch(l,l[i]+l[j])-(j+1))
print(ans)
### BUGGY CODE ###

N,Q = map(int, input().split())
S = input()
for i in range(Q):
    l, r = map(int, input().split())
    print(S[l-1:r].count("AC"))


### FIXED CODE ###

N,Q = map(int, input().split())
S = input()
t = [0]*(N+1)
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        t[i+1] = t[i] + 1
        i += 2
    else:
        t[i+1] = t[i]

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

n, k, q = map(int, input().split())
#print(n,k,q)
l = [0] * n
#print(l)
katen = []
for i in range(q):
    katen.append(int(input()))
#print(katen)
for j in katen:
    x = l.pop(j-1)
    l.insert(j-1, x+1) 
#print(l)

for y in range(n):
    if l[y] > q-k:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

n, k, q = map(int, input().split())
#print(n,k,q)
l = [0] * n
#print(l)
katen = []
my_append = katen.append
for i in range(q):
    my_append(int(input()))
#print(katen)

    
for j in katen:
    l[j-1] += 1 

    
#print(l)

for y in range(n):
    if l[y] > q-k:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

N = int(input())
H = [int(x) for x in input().split()]
# print(N,H)
result = "Yes"

for i in range(len(H)-1):
    if (H[i]-1 > min(H[i+1:])):
        result = "No"
        break

print(result)

### FIXED CODE ###

N = int(input())
H = [int(x) for x in input().split()]
# print(N,H)
result = "Yes"
top = 0
for i in range(len(H)):
    if (H[i] < top-1 ):
        result = "No"
        break
    top = max(top, H[i])

print(result)