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

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

for i in range(n):
    if len([ a for a in l[i::] if  l[i] -1 > a]) > 0:
        print('No')
        sys.exit()
print('Yes')


### FIXED CODE ###

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

max = l[0]
for i in range(n):
    if max - 1 > l[i]:
        print('No')
        sys.exit()
    elif l[i] > max:
        max = l[i]
print('Yes')
### BUGGY CODE ###

from sys import stdin

def multiple(A,st,ed):
    res = 1
    for i in range(st,ed):
        res = res * A[i]

    return res

def main():
    n, k = [int(x) for x in stdin.readline().rstrip().split()]
    A = [int(x) for x in stdin.readline().rstrip().split()]

    H = [0] * (n-k)
    pre = multiple(A,0,k)
    H[0] = pre

    st = -1
    for i in range(k+1,n+1):
        st += 1
        cur = pre * A[i-1] / A[st]
        if cur > pre:
            print("Yes")
        else:
            print("No")
        pre = cur

if __name__ == "__main__":
    main()

### FIXED CODE ###

from sys import stdin

def multiple(A,st,ed):
    res = 1
    for i in range(st,ed):
        res = res * A[i]

    return res

def main():
    n, k = [int(x) for x in stdin.readline().rstrip().split()]
    A = [int(x) for x in stdin.readline().rstrip().split()]

    st = -1
    for i in range(k+1,n+1):
        st += 1
        if A[i-1] > A[st]:
            print("Yes")
        else:
            print("No")

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

s = list(input())
n = len(s)
mod_list = [0] * 2019

for i in range(n):
    num = int(''.join(s[n - i - 1:n])) % 2019
    mod_list[num] += 1

ans = mod_list[0]
for cnt in range(1, 2019):
    ans += mod_list[cnt] * (mod_list[cnt] - 1) // 2

print(ans)


### FIXED CODE ###

s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力
### BUGGY CODE ###

from collections import deque

H, W = map(int, input().split())
grid = '#' * (W+2)
for _ in range(H):
    grid += '#' + input() + '#'
grid += '#' * (W+2)
move = [1, -1, W+2, -W-2]

def bfs(start):
  lst = [10**9] *((H+2)*(W+2))
  lst[start] = 0
  q = deque([start])
  while q:
    x = q.popleft()
    dx = lst[x]
    for d in move:
      y = x + d
      if grid[y] == '#':
        continue
      dy = dx + 1
      if dy > lst[y]:
        continue
      lst[y] = dy
      q.append(y)
  ans = max(x for x in lst if x < 10**9)
  return ans
  
cnt = 0
for i in range((H+2)*(W+2)):
  if grid[i] != '#':
    cnt =  max(cnt,bfs(i))
print(cnt)

### FIXED CODE ###

from collections import deque
import sys

H, W = map(int, input().split())
grid = '#' * (W+2)
for _ in range(H):
    grid += '#' + input() + '#'
grid += '#' * (W+2)
move = [1, -1, W+2, -W-2]

def bfs(start):
  lst = [10**9] *((H+2)*(W+2))
  lst[start] = 0
  q = deque([start])
  while q:
    x = q.popleft()
    dx = lst[x]
    for d in move:
      y = x + d
      if grid[y] == '#':
        continue
      dy = dx + 1
      if dy >= lst[y]:
        continue
      lst[y] = dy
      q.append(y)
  return max(x for x in lst if x < 10**9)
  
  
print(max(bfs(i) for i in range((H+2)*(W+2)) if grid[i] != '#'))
### BUGGY CODE ###

def solve(a,b):
    ans = 0
    for i in range(a, b+1):
        ans = ans ^ i
    print(ans)

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


### FIXED CODE ###

def solve(a,b):
    l = []
    count = (b - a + 1)
    r = 0
    if (a % 2 != 0):
        l.append(a)
        r += 1
    if (b % 2 == 0):
        l.append(b)
        r += 1
    if ((count - r) / 2) % 2 != 0:
        l.append(1)

    ans = 0
    for n in l:
        ans = ans ^ n
    print(ans)

a,b = map(int, input().split())
solve(a,b)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    print(a.count(i+1))

### FIXED CODE ###

import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
l = [str(0) for i in range(n)]
key = list(c.keys())
for i in range(len(list(c.keys()))):
    l[key[i]-1] = str(c[key[i]])
print('\n'.join(l))
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
ans=0
for i in range(n):
    for j in range(n):
        if i==j:
            continue
        if a[i]%a[j]==0:
            ans+=1
            break
print(n-ans)

### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())))
MA = (max(a) + 1)
ans = [0] * MA

for i in range(n):
    for j in range(a[i],MA,a[i]):
        ans[j] += 1
print(sum(ans[i]==1 for i in a))
### BUGGY CODE ###

import itertools

N = int(input())
count = 0
S = []
for i in range(N):
    S.append([s for s in input()])
for v in itertools.combinations(S, 2):
    v[0].sort()
    v[1].sort()
    if v[0] == v[1]:
        count += 1
if count == 1:
    print(1)
else:
    print(count)

### FIXED CODE ###

import itertools
from math import factorial
from scipy.misc import comb

N = int(input())
s = {}
for _ in range(N):
    b = list(input())
    b.sort()
    c = ''.join(b)
    if not c in s:
        s[c] = 1
    else:
        s[c] += 1

a = [comb(v, 2, exact=True) for v in s.values()]
print(sum(a))
### BUGGY CODE ###

import numpy as np
s=input()
t=input()
ns,nt=len(s),len(t)
dp=np.zeros((ns+1,nt+1),np.int64)
# dp=[[0]*(ns+1) for _ in range(nt+1)]
# dp[i+1][j+1]:sのi文字目まで、tのj文字目まで考えた時の最長
for i in range(ns):
      for j in range(nt):
            if s[i]==t[j]:
                  dp[i+1][j+1]=dp[i][j]+1
            dp[i+1][j+1]=max(dp[i+1][j+1],dp[i+1][j],dp[i][j+1])
lg=dp[-1][-1]
ans=[]
#print(dp)
i,j=ns,nt
while i>0 and j>0:
      if dp[i][j]==dp[i][j-1]:
            j-=1
      elif dp[i][j]==dp[i-1][j]:
            i-=1
      else:
            i-=1
            j-=1
            ans.append(s[i])
s=''
for _ in range(lg):
      s+=ans.pop()
print(s)
      

### FIXED CODE ###

import numpy as np
s=np.array(list(input()))
t=np.array(list(input()))
is_eq=np.array(s[:,None]==t[None,])
# is_eq[i][j]:sのi文字目とtのj文字目が等しいかどうか
# print(is_eq)
ns=len(s)
nt=len(t)
dp=np.zeros((ns+1,nt+1),np.int64)

# dp[i+1][j+1]:sのi文字目までとtのj文字目までで最長の部分列
# dp[0][j]=0,dp[i][0]=0,dp[n+1][w+1]の値がsとtで最長の部分列の長さ
for i in range(ns): #sのi文字目までの文字列で調査
    dp[i+1][1:]=np.maximum(dp[i][:-1]+is_eq[i],dp[i][1:])#左上からの更新、真上からの更新
    dp[i+1]=np.maximum.accumulate(dp[i+1])#左からの更新
i=ns
j=nt
ans=['']
while i>0 and j>0:
      if dp[i][j]==dp[i-1][j]:
            i-=1
      elif dp[i][j]==dp[i][j-1]:
            j-=1
      else:
            ans.append(s[i-1])
            i-=1
            j-=1
a=''
for _ in range(len(ans)):
      a+=ans.pop()
print(a)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys


def solve(R: int, G: int, B: int, N: int):
    cnt= 0
    for r in range(0, N+1, R):
        for g in range(0, N + 1 - r, G):
            if N - r - g < 0:
                break
            b = (N - r - g) / B
            if b % 1 == 0 and b >= 0:
                cnt += 1
            else:
                continue
    print(cnt)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    R = int(next(tokens))  # type: int
    G = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(R, G, B, N)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(R: int, G: int, B: int, N: int):
    cnt= 0
    for r in range(0, N + 1, R):
        upper = N + 1 - r
        for g in range(0, upper, G):
            temp = upper-1-g
            if temp < 0:
                break
            b = temp / B
            if b % 1 == 0 and b >= 0:
                cnt += 1
            else:
                continue
    print(cnt)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    R = int(next(tokens))  # type: int
    G = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(R, G, B, N)

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

from collections import deque

h, w = map(int, input().split())
p = [list(input()) for i in range(h)]

# メモ配列
INF = 10**7
# memo = [[INF]*w for i in range(h)]

# 探索用ベクトル
vx = (0, -1, 0, 1)
vy = (-1, 0, 1, 0)

# 幅探索用キューの準備
# 白マスをカウント
q = deque()
bcnt = 0
for i, vi in enumerate(p):
    for j, vj in enumerate(vi):
        if vj == '#':
            q.appendleft((j, i))
            bcnt+=1
            
qans = deque()
            
def bfs(q):
    for i in range(INF):
        # キューが空なら終了
        if len(q) == 0:
            return qans

        # キューから一つ取り出す
        x, y = map(int, q.pop())
#         print('xy', x, y)

        # 4方向のいずれかに白があれば、黒にする
        for j in range(4):
            nx, ny = x+vx[j], y+vy[j]

            # エリア外 or 黒色なら探索しない
            if nx < 0 or w <= nx or ny < 0 or h <= ny or p[ny][nx] == '#':
                continue

            p[ny][nx] = '#'
            qans.appendleft((nx, ny))

def printmap(a):
    for i in a:
        print(i)
        
# print(q)
# printmap(p)
for i in range(INF):
    qans = deque()
    q = bfs(q)
#     print(q)
#     printmap(p)
    # キューが空なら終了
    if len(q) == 0:
        ans = i
        break
    
print(ans)
# print(q)

### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
p = [list(input()) for i in range(h)]

# メモ配列
INF = 10**7
# memo = [[INF]*w for i in range(h)]

# 探索用ベクトル
vx = (0, -1, 0, 1)
vy = (-1, 0, 1, 0)

# 幅探索用キューの準備
# 白マスをカウント
q = deque()
bcnt = 0
for i, vi in enumerate(p):
    for j, vj in enumerate(vi):
        if vj == '#':
            q.appendleft((j, i))
            bcnt+=1
            
qans = deque()
            
def bfs(q):
    for i in range(INF):
        # キューが空なら終了
        if len(q) == 0:
            return qans

        # キューから一つ取り出す
        x, y = map(int, q.pop())
#         print('xy', x, y)

        # 4方向のいずれかに白があれば、黒にする
        for j in range(4):
            nx, ny = x+vx[j], y+vy[j]

            # エリア外 or 黒色なら探索しない
            if nx < 0 or w <= nx or ny < 0 or h <= ny or p[ny][nx] == '#':
                continue

            p[ny][nx] = '#'
            qans.appendleft((nx, ny))

def printmap(a):
    for i in a:
        print(i)
        
# print(q)
# printmap(p)
for i in range(INF):
    qans = deque()
    q = bfs(q)
#     print(q)
#     printmap(p)
    # キューが空なら終了
    if len(q) == 0:
        ans = i
        break
    
print(ans)
# print(q)
### BUGGY CODE ###

import math

# for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
p = 1
if 0 in a:
    print(0)
else:
    for i in range(len(a)):
        p = p * a[i]

    if p > math.pow(10, 18):
        print(-1)
    else:
        print(p)

### FIXED CODE ###

import math

# for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
p = 1
r=0
m=math.pow(10,18)
if 0 in a:
    print(0)
else:
    for i in range(n):

        p = p * a[i]
        if p>m:
            r+=1
            break

    if r>0:
        print(-1)
    else:
        print(p)
### BUGGY CODE ###

times = int(input())
nums = list(map(int, input().split()))

re = 10**100000000
for i in range(times):
    sum_left = sum(nums[:i+1])
    sum_right = sum(nums[i+1:])
    re = min(re, abs(sum_left - sum_right))
print(re)

### FIXED CODE ###

times = int(input())
nums = list(map(int, input().split()))

re = 10**100000
for i in range(times):
    sum_left = sum(nums[:i+1])
    sum_right = sum(nums[i+1:])
    re = min(re, abs(sum_left - sum_right))
print(re)
### BUGGY CODE ###

import collections

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

    a_dict = collections.Counter(a)
    a_dict = {key: key*value for key, value in a_dict.items()}
    for _ in range(q):
        b, c = map(int, input().split())
        if b in a_dict:
            if c in a_dict:
                a_dict[c] += (a_dict.pop(b)//b) * c
            else:
                a_dict[c] = (a_dict.pop(b)//b) * c
        print(sum(a_dict.values()))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import collections

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

    a_dict = collections.Counter(a)
    a_dict = {key: key*value for key, value in a_dict.items()}
    answer = sum(a_dict.values())
    for _ in range(q):
        b, c = map(int, input().split())
        diff = 0
        if b in a_dict:
            b_sum = a_dict.pop(b)
            c_add = b_sum//b * c
            diff = c_add - b_sum
            if c in a_dict:
                a_dict[c] += c_add
            else:
                a_dict[c] = c_add
        answer += diff
        print(answer)


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

import sys
a,b,n = map(int,input().split())
d = 0
for i in range(1,n+1):
    c = int(a*i/b)-a*int(i/b)
    if c > d:
        d = c
print(d)

### FIXED CODE ###

a,b,n = map(int,input().split())
if n>= b-1:
    print(int(a*(b-1)/b)-a*int((b-1)/b))
else:
    print(int(a*n/b)-a*int(n/b))
### BUGGY CODE ###

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]

ab.sort()
ans = 0
while m != 0:
    tab = ab.pop(0)
    ans += min(tab[1], m)* tab[0]
    m = max(0, m - tab[1])
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]

ab.sort()
ans = 0
for tab in ab:
    if m < 0:
        break
    ans += min(tab[1], m)* tab[0]
    m -= tab[1]
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

s = input()
t = input()
q = int(input())
abcd = [tuple(map(int,input().split())) for i in range(q)]

def to_one(word):
    if len(word)==0:
        return 0

    if len(word)==1:
        return word

    if word[:2] == 'AB' or word[:2] == 'BA':
        return to_one(word[2:])

    if word[:3] == 'AAA':
        return to_one(word[3:])

    if word[:3] == 'BBB':
        return to_one(word[3:])

    if word[:2] == 'AA':
        return to_one('B'+word[2:])
    if word[:2] == 'BB':
        return to_one('A'+word[2:])


for a,b,c,d in abcd:

    s_i = s[a-1:b]
    t_i = t[c-1:d]

    if to_one(s_i) == to_one(t_i):
        print('YES')
    else:
        print('NO')


### FIXED CODE ###

from itertools import accumulate

s = input()
t = input()
q = int(input())
abcd = [tuple(map(int,input().split())) for i in range(q)]

s_number = [2 if ab == 'B' else 1 for ab in s]
t_number = [2 if ab == 'B' else 1 for ab in t]

s_sum = [0] + s_number
s_sum = list(accumulate(s_sum))

t_sum = [0] + t_number
t_sum = list(accumulate(t_sum))

for a,b,c,d in abcd:

    s_i = s_sum[b]-s_sum[a-1]
    t_i = t_sum[d]-t_sum[c-1]

    if s_i%3 == t_i%3:
        print('YES')
    else:
        print('NO')
### BUGGY CODE ###

h,w = map(int,input().split())
b = [[i == "#" for i in list(input())]+[True] for _ in range(h)]+[[True]*(w+1)]
check = []
for i in range(h):
  for j in range(w):
    if b[i][j]:
      check.append((i,j))
ans = 0
while check:
  new = []
  k = 0
  for i,j in check:
    if not b[i-1][j]:
      new.append((i-1,j))
      b[i-1][j] = True
      k = 1
    if not b[i+1][j]:
      new.append((i+1,j))
      b[i+1][j] = True
      k = 1
    if not b[i][j-1]:
      new.append((i,j-1))
      b[i][j-1] = True
      k = 1
    if not b[i][j+1]:
      new.append((i,j+1))
      b[i][j+1] = True
      k = 1
  check = new
  if k:
    ans += 1
print(ans)

### FIXED CODE ###

h,w = map(int,input().split())
b = [[i == "#" for i in list(input())]+[True] for _ in range(h)]+[[True]*(w+1)]
check = []
for i in range(h):
  for j in range(w):
    if b[i][j]:
      check.append((i,j))
ans = 0
while check:
  new = []
  k = 0
  for i,j in check:
    if not b[i-1][j]:
      new.append((i-1,j))
      b[i-1][j] = True
      k = 1
    if not b[i+1][j]:
      new.append((i+1,j))
      b[i+1][j] = True
      k = 1
    if not b[i][j-1]:
      new.append((i,j-1))
      b[i][j-1] = True
      k = 1
    if not b[i][j+1]:
      new.append((i,j+1))
      b[i][j+1] = True
      k = 1
  check = new
  if k:
    ans += 1
print(ans)
### BUGGY CODE ###

#coding:utf-8
import numpy as np
def argsort_p1(ls):
    return [sorted(ls).index(t)+1 for t in ls]
N,M = list(map(int,input().split()))
P = []
Y = []
for m in range(M):
    p,y = list(map(int,input().split()))
    P.append(p)
    Y.append(y)
ls = [ [] for _ in range(max(P))]
ls_idx = [ [] for _ in range(max(P))]
for p,y in zip(P,Y):
    ls[p-1].append(y)
    ls_idx[p-1].append(len(ls_idx[p-1]))
ls_dict = []
new_dict = {}
for i,line in enumerate(ls):
    arg_line = argsort_p1(line)
    for arg in arg_line:
        new_dict[str(i+1)+"/"+str(sorted(line)[arg-1])]=str(i+1).zfill(6)+str(arg).zfill(6)
for p,y in zip(P,Y):
    print (new_dict[str(p)+"/"+str(y)])


### FIXED CODE ###

N, M = map(int,input().split())
ls = []
for m in range(M):
    p, y = map(int,input().split())
    ls.append([p,y])
sorted_ls = sorted(ls,key=lambda x:x[1])
counter = [0 for i in range(N+1)]
d = {}
for p,y in sorted_ls:
    counter[p]+=1
    num = counter[p]
    d[y] = num
for p,y in ls:
    #print (p,d[y])
    print (str(p).zfill(6)+str(d[y]).zfill(6))
### BUGGY CODE ###

import math,itertools,fractions,heapq,bisect,sys,copy,collections

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()
  field=[S() for _ in range(h)]

  ans=0

  for i in range(h):
    for j in range(w):
      for k in range(h):
        for l in range(w):
          q=collections.deque()
          if field[i][j]=='#' or field[k][l]=='#':
            continue
          q.append((k,l,0))
          visited=[[-1]*w for _ in range(h)]
          while len(q)>0:
            y,x,c=q.popleft()
            visited[y][x]=c
            if y==i and x==j:
              ans=max(ans,c)
              # print(ans,i,j,k,l)
              break

            for dy,dx in dd:
              ny=y+dy
              nx=x+dx
              if 0<=ny and 0<=nx and ny<h and nx<w:
                if field[ny][nx]=='#':
                  continue
                if visited[ny][nx]!=-1:
                  continue
                q.append((ny,nx,c+1))

  return ans


# main()
print(main())


### FIXED CODE ###

import sys,collections

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()
  field=[S() for _ in range(h)]

  ans=0
  visited=[[-1 for __ in range(w)] for _ in range(h)]
  q=collections.deque()
  for i in range(h):
    for j in range(w):
      if field[i][j]=='#':
        continue
      q.append((i,j))
      for _i in range(h):
        for _j in range(w):
          visited[_i][_j]=-1
      visited[i][j]=0
      _ans=0
      while q:
        y,x=q.popleft()

        for dy,dx in ((-1,0),(0,1),(1,0),(0,-1)):
          ny=y+dy
          nx=x+dx
          if not 0<=ny<h:
            continue
          if not 0<=nx<w:
            continue
          if field[ny][nx]=='#':
            continue
          if visited[ny][nx]!=-1:
            continue
          _ans=visited[y][x]+1
          visited[ny][nx]=_ans
          q.append((ny,nx))
      ans=max(ans,_ans)
  return ans

# main()
print(main())
### BUGGY CODE ###

n = int(input())
l = []
for i in range(1, n + 1):
    if n % i == 0:
        j = n // i
        l.append(i + j)

print(min(l) - 2)

### FIXED CODE ###

n = int(input())
l = []
for i in range(1, int(n ** 0.5 + 1)):
    if n % i == 0:
        j = n // i
        l.append(i + j)

print(min(l) - 2)
### BUGGY CODE ###

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

l = list(l)
for i in range(n):
	l[i] = int(l[i])
count = 0
#a<b+c, a>b-c, a>c-b
for a in range(n):
	for b in range(a+1,n):
		for c in range(b+1,n):
			if l[a]<l[b]+l[c] and l[b]<l[c]+l[a] and l[c]<l[a]+l[b]:
				count += 1


print(count)

### FIXED CODE ###

import bisect

n = int(input())
l = list(map(int,input().split()))
l.sort()

ans = 0

#a<b+c, a>b-c, a>c-b
for a in range(n-2):
	for b in range(a+1,n-1):
		index = bisect.bisect_left(l,l[a]+l[b])
		ans += index - (b+1)
print(ans)
### BUGGY CODE ###

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

weight_value = [0] * n
for i in range(n):
  weight_value[i] = [int(_) for _ in input().split()]
  
dp = [[0] * (w+1) for i in range(n+1)]

for i in range(n):
  for w_upper in range(w+1):
    if w_upper - weight_value[i][0] >= 0:
      dp[i+1][w_upper] = max(dp[i][w_upper - weight_value[i][0]] + weight_value[i][1], dp[i][w_upper])
    else:
      dp[i+1][w_upper] = dp[i][w_upper]
print(dp[n][w])
      

### FIXED CODE ###

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

weight_value = [0] * n
for i in range(n):
  weight_value[i] = [int(_) for _ in input().split()]
  
dp = [[0] * (w+1) for i in range(n+1)]

for i in range(n):
  for w_upper in range(w+1):
    if w_upper - weight_value[i][0] >= 0:
      dp[i+1][w_upper] = max(dp[i][w_upper - weight_value[i][0]] + weight_value[i][1], dp[i][w_upper])
    else:
      dp[i+1][w_upper] = dp[i][w_upper]
print(dp[n][w])
### BUGGY CODE ###

import sys
from itertools import accumulate

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

current_arr = A
if K > 41:
    print(*([N]*N))
else:
    for _ in range(K):
        imos = [0] * N
        ruiseki = [0] * (N+1)
        for i, ai in enumerate(current_arr):
            imos[max([0, i-ai])] += 1
            if i+ai+1 < N:
                imos[i+ai+1] -= 1
        for j, im in enumerate(imos):
            ruiseki[j+1] = ruiseki[j] + im
        current_arr = ruiseki[1:]
#print(imos)
#print(ruiseki)
#print(*accumulate(imos))
    print(*current_arr)


### FIXED CODE ###

import sys
from itertools import accumulate

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

current_arr = A
if K > 41:
    print(*([N]*N))
else:
    for _ in range(K):
        imos = [0] * N
        ruiseki = [0] * (N+1)
        for i, ai in enumerate(current_arr):
            imos[max([0, i-ai])] += 1
            if i+ai+1 < N:
                imos[i+ai+1] -= 1
        for j, im in enumerate(imos):
            ruiseki[j+1] = ruiseki[j] + im
        current_arr = ruiseki[1:]
#print(imos)
#print(ruiseki)
#print(*accumulate(imos))
    print(*current_arr)
### BUGGY CODE ###

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

for i in range(n):
    a.append(i)
    a[i] = i+1

for i in range (n-1):
    for j in range(n-1, i ,-1):
        if h[j] < h[j-1]:
            tmp = h[j]
            h[j] = h[j-1]
            h[j-1] = tmp
            tmp = a[j]
            a[j] = a[j-1]
            a[j-1] = tmp
# print(h)
print(' '.join(map(str, a)))

### FIXED CODE ###

n = int(input())
h_kari =list(map(int, input().split()))
h = []

for i in range(n):
    h.append([h_kari[i],i+1])
    
h.sort()    
    
ans = [h[i][1] for i in range(n)]    

print(' '.join(map(str, ans)))
### BUGGY CODE ###

n, k = map(int, input().split()) ###n:モンスターの数，k:必殺技の回数
h=list(map(int,input().split())) ###h:モンスターの体力
if k>0:
    for i in range(k):
        if n<=k:
            h.clear()
        else:
            a=max(h)
            h.remove(a)
print(sum(h))

### FIXED CODE ###

n, k = map(int, input().split()) ###n:モンスターの数，k:必殺技の回数
h=sorted(list(map(int,input().split()))) ###h:モンスターの体力

if n<=k:
    print(0)
elif k==0:
    b=sum(h)
    print(b)
else:
    a=sum(h[:-k])
    print(a)