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


H, W, D = map(int, input().split())
masu = [[] for i in range(H)]
for i in range(H):
    masu[i] = tuple([int(i) for i in input().split()])
masu = tuple(masu)
Q = int(input())

exam = [[] for i in range(Q)]
for i in range(Q):
    exam[i] = [int(i) for i in input().split()]

coord_dict = {}
for i in range(H):
    for j in range(W):
        coord_dict.update({masu[i][j] : (i,j)})

for i in range(Q):
    reduce_MP = 0
    num = exam[i][0]
    coord1 = coord_dict[num]
    while num < exam[i][1]:
        coord2 = coord_dict[num + D]
        reduce_MP += abs(coord1[0] - coord2[0]) + abs(coord1[1] - coord2[1])
        num += D
        coord1 = coord2
    print(reduce_MP)



### FIXED CODE ###

H, W, D = list(map(int, input().split()))

Amap = []
for i in range(H):
    Amap.append(list(map(int, input().split())))

xx = [0 for i in range(90002)]
yy = [0 for i in range(90002)]
for y in range(H):
    for x in range(W):
        xx[Amap[y][x]] = x
        yy[Amap[y][x]] = y
Q = int(input())

coord = []
for i in range(Q):
    coord.append(list(map(int, input().split())))

# magic point calculation
mp = [0 for i in range(90002)]

for i in range(D+1, 90002):
    mp[i] = mp[i-D] + abs(xx[i] -xx[i-D]) + abs(yy[i] - yy[i-D])

for i in coord:
    print(mp[i[1]] - mp[i[0]])
### BUGGY CODE ###

S = str(input())
Q = int(input())

topFlg = True

for _ in range(Q):
    query = list(map(str, input().split()))

    if query[0] == "1":
        topFlg = not (topFlg)
    else:
        if query[1] == "1":
            if topFlg:
                S = query[2] + S
            else:
                S += query[2]
        else:
            if topFlg:
                S += query[2]
            else:
                S = query[2] + S

if not topFlg:
    S = S[::-1]

print(S)


### FIXED CODE ###

S = str(input())
Q = int(input())

topFlg = True

leftStr = ""
rightStr = ""

for _ in range(Q):
    query = list(map(str, input().split()))
    if query[0] == "1":
        topFlg = not (topFlg)
    else:
        if query[1] == "1":
            if topFlg:
                leftStr = query[2] + leftStr
            else:
                rightStr += query[2]
        else:
            if topFlg:
                rightStr += query[2]
            else:
                leftStr = query[2] + leftStr

print(leftStr + S +
      rightStr if topFlg else rightStr[::-1] + S[::-1] + leftStr[::-1])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(50000)

n,m=(int(i) for i in input().strip().split(" "))
xs=[]
ys=[]
zs=[]
for i in range(n):
    a,b,c=(int(i) for i in input().strip().split(" "))
    xs.append(a)
    ys.append(b)
    zs.append(c)

def g():
    return "no"
from collections import defaultdict
d=defaultdict(g)
def find(l,m,x,y,z):
    if d[(l,m,x,y,z)]!="no":
        return d[(l,m,x,y,z)]
    if m<=0:
        return abs(x)+abs(y)+abs(z)
    if l<0:
        return abs(x)+abs(y)+abs(z)
    a=find(l-1,m,x,y,z)
    b=find(l-1,m-1,x+xs[l],y+ys[l],z+zs[l])
    d[(l, m, x, y, z)]=max(a,b)
    return d[(l,m,x,y,z)]

print(find(n-1,m,0,0,0))


### FIXED CODE ###

import sys

sys.setrecursionlimit(50000)

n, m = (int(i) for i in input().strip().split(" "))
xs = []
ys = []
zs = []
for i in range(n):
    a, b, c = (int(i) for i in input().strip().split(" "))
    xs.append(a)
    ys.append(b)
    zs.append(c)

k=0

ar=[]
for i in range(n):
    ar.append(xs[i]+ys[i]+zs[i])
ar.sort(reverse=True)
t=sum(ar[:m])
if t>k:
    k=t

ar=[]
for i in range(n):
    ar.append(xs[i]+ys[i]-zs[i])
ar.sort(reverse=True)
t=sum(ar[:m])
if t>k:
    k=t

ar=[]
for i in range(n):
    ar.append(xs[i]-ys[i]+zs[i])
ar.sort(reverse=True)
t=sum(ar[:m])
if t>k:
    k=t

ar=[]
for i in range(n):
    ar.append(-1*xs[i]+ys[i]+zs[i])
ar.sort(reverse=True)
t=sum(ar[:m])
if t>k:
    k=t

ar=[]
for i in range(n):
    ar.append(xs[i]-ys[i]-zs[i])
ar.sort(reverse=True)
t=sum(ar[:m])
if t>k:
    k=t

ar=[]
for i in range(n):
    ar.append(-xs[i]+ys[i]-zs[i])
ar.sort(reverse=True)
t=sum(ar[:m])
if t>k:
    k=t

ar=[]
for i in range(n):
    ar.append(-xs[i]-ys[i]+zs[i])
ar.sort(reverse=True)
t=sum(ar[:m])
if t>k:
    k=t

ar=[]
for i in range(n):
    ar.append(-xs[i]-ys[i]-zs[i])
ar.sort(reverse=True)
t=sum(ar[:m])
if t>k:
    k=t
print(k)
### BUGGY CODE ###

S = list(input())
while len(S) > 0:
    if ''.join(S[-5:]) == 'dream' or ''.join(S[-5:]) == 'erase':
        S = S[:-5]
    elif ''.join(S[-6:]) == 'eraser':
        S = S[:-6]
    elif ''.join(S[-7:]) == 'dreamer':
        S = S[:-7]
    else:
        print('NO')
        quit()
print('YES')

### FIXED CODE ###

S = list(input())
while len(S) > 0:
    if ''.join(S[-5:]) == 'dream' or ''.join(S[-5:]) == 'erase':
        S = S[:-5]
    elif ''.join(S[-6:]) == 'eraser':
        S = S[:-6]
    elif ''.join(S[-7:]) == 'dreamer':
        S = S[:-7]
    else:
        print('NO')
        quit()
print('YES')
### BUGGY 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 members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]    

N, M, K = map(int,input().split())
uf = UnionFind(N)
frend = [set() for _ in range(N)]
block = [set() for _ in range(N)]
ans = []
for i in range(M):
    A, B = map(int,input().split())
    A -= 1
    B -= 1
    uf.union(A, B)
    uf.find(A)
    frend[A].add(B)
    frend[B].add(A)
    
for i in range(K):
    C, D = map(int,input().split())
    C -= 1
    D -= 1
    block[C].add(D)
    block[D].add(C)    

for i in range(N):
    temp = uf.size(i) - 1
    for j in uf.members(i):
        if (j in frend[i]) or (j in block[i]):
            temp -= 1
    ans.append(temp)
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]    

N, M, K = map(int,input().split())
uf = UnionFind(N)
f_b = [set() for _ in range(N)]
ans = []
for i in range(M):
    A, B = map(int,input().split())
    A -= 1
    B -= 1
    uf.union(A, B)
    uf.find(A)
    f_b[A].add(B)
    f_b[B].add(A)
    
for i in range(K):
    C, D = map(int,input().split())
    C -= 1
    D -= 1
    if uf.same(C, D):
        f_b[C].add(D)
        f_b[D].add(C)    

for i in range(N):
    ans.append(uf.size(i) - len(f_b[i]) - 1)
print(*ans)
### BUGGY CODE ###

N, K = [int(i) for i in input().split()]
a = list(map(int, input().split()))
dp = [0]*N


def mincos(dp, a, i, k):
    if i < k:
        mincos = 10000000000
        for j in range(1, i + 1):
            b = dp[i - j] + abs(a[i] - a[i - j])
            if mincos > b:
                mincos = b
        return mincos
    else:
        mincos = 10000000000
        for j in range(1, k + 1):
            b = dp[i - j] + abs(a[i] - a[i - j])
            if mincos > b:
                mincos = b
        return mincos


for i in range(1, N):
    dp[i] = mincos(dp, a, i, K)

print(dp[N-1])

### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = np.array([0] * N)

for i in range(1, N):
    j = max(0, i-K)
    dp[i] = (dp[j:i] + np.abs(h[i] - h[j:i])).min()


print(dp[-1])
### BUGGY CODE ###

def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
p=n1()

from collections import deque
e=deque()
for x in p:
    e.append((1+x)/2)
d=deque()
ans=0
while True:
    d.append(e.pop())
    if len(d)==k:
        ans=max(ans,sum(list(d)))
        d.popleft()
    if len(e)==0:
        break
print(ans)

### FIXED CODE ###

def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
p=n1()

e=[(1+x)/2 for x in p]

ans=sum(e[0:k])
tmp=ans
for i in range(k,n):
    tmp=tmp+e[i]-e[i-k]
    ans=max(tmp,ans)
print(ans)
### BUGGY CODE ###

n = int(input())
A = list(map(int, input().split()))
SUM = sum(A)

for odd in range(0, 10**9+1, 2):
    dp = [0]*n
    dp[0] = odd
    cnt = dp[0]
    for i in range(1, n):
        dp[i] = 2*A[i-1]-dp[i-1]
        cnt += dp[i]
    if cnt == SUM:
        break
print(*dp)


### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
SUM = sum(A)
MIN = min(A)
start = A.index(MIN)

dp = [0]*n
dp[start] = cnt = 0
for i in range(start+1, n):
    dp[i] = 2*A[i-1]-dp[i-1]
    cnt += dp[i]
else:
    for i in range(start):
        dp[i] = 2*A[i-1]-dp[i-1]
        cnt += dp[i]

odd = SUM-cnt
dp = [0]*n
dp[start] = cnt = odd
for i in range(start+1, n):
    dp[i] = 2*A[i-1]-dp[i-1]
    cnt += dp[i]
else:
    for i in range(start):
        dp[i] = 2*A[i-1]-dp[i-1]
        cnt += dp[i]

print(*dp)
### BUGGY CODE ###

#!/usr/bin/python

import sys

def main(argv):
    for line in sys.stdin:
        n = int(line)

        power = 1
        for i in xrange(1, n + 1):
            power *= i

        print power % (10 ** 9 + 7)

if __name__ == "__main__":
    main(sys.argv)

### FIXED CODE ###

#!/usr/bin/python

import math
import sys

def main(argv):
    for line in sys.stdin:
        n = int(line)

        answer = 737935835
        if n < 50000:
            answer = math.factorial(n)
        elif n > 50000:
            for i in xrange(50001, n + 1):
                answer = (answer * i) % (10**9 + 7)
        print answer % (10**9 + 7)

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

# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline


def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

N=int(input())
a=list(map(int,input().split()))
calc=(lcm(a))  # 実行結果: 12

ans=0
for item in a:
    ans+=(calc)//item
    ans%=(10**9+7)

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



### FIXED CODE ###

# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

import functools

def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
def multiple(a, b):
    return a*b // euclid(a, b)
def lcm(nums):
        return functools.reduce(multiple, nums)


N=int(input())
a=list(map(int,input().split()))
calc=(lcm(a))  # 実行結果: 12


ans=0
for index,item in enumerate(a):
    ans+=(calc)//item

print(int((ans)%(10**9+7)))
### BUGGY CODE ###

from functools import lru_cache
n = int(input())
a = list(map(int,input().split()))
left = -10**9
right = 10**9

@lru_cache(maxsize=1000000)
def cal(num):
  tmp = 0
  for i in range(n):
    tmp += abs(a[i]-(num+(i+1)))
  return tmp
 

while abs(right-left)>1:
  mid = (right+left)//2
  
  if cal(mid-1)<cal(mid+1):
    ans = mid
    right = mid
  else:
    left = mid
print(min(cal(left),cal(right)))

### FIXED CODE ###

from functools import lru_cache
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
left = -10**9
right = 10**9

@lru_cache(maxsize=100000)
def cal(num):
  tmp = 0
  for i in range(n):
    tmp += abs(a[i]-(num+(i+1)))
  return tmp
 

while abs(right-left)>1:
  mid = (right+left)//2
  if cal(mid-1)<cal(mid+1):
    right = mid
  else:
    left = mid
print(min(cal(left),cal(right)))
### BUGGY CODE ###

X,Y,A,B,C = (int(i) for i in input().split())

P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

red_counter = 0
green_counter = 0

ans = 0

for i in range(X+Y):
  if red_counter == X:
    P = [-1]
  elif green_counter == Y:
    Q = [-1]

  if len(R) != 0:
    if P[0] >= Q[0] and P[0] >= R[0]:
      ans += P.pop(0)
      red_counter += 1
    elif Q[0] >= P[0] and Q[0] >= R[0]:
      ans += Q.pop(0)
      green_counter +=1
    else:
      ans += R.pop(0)

print(ans)


### FIXED CODE ###

from collections import deque
X,Y,A,B,C = (int(i) for i in input().split())

P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
P_deque = deque(P)
Q_deque = deque(Q)
R_deque = deque(R)

red_counter = 0
green_counter = 0

ans = 0

for i in range(X+Y):
  if red_counter == X:
    P_deque = [-1]
  elif green_counter == Y:
    Q_deque = [-1]

  if len(R_deque) != 0:
    if P_deque[0] >= Q_deque[0] and P_deque[0] >= R_deque[0]:
      ans += P_deque.popleft()
      red_counter += 1
    elif Q_deque[0] >= P_deque[0] and Q_deque[0] >= R_deque[0]:
      ans += Q_deque.popleft()
      green_counter +=1
    else:
      ans += R_deque.popleft()
  else:
    if P_deque[0] >= Q_deque[0]:
      ans += P_deque.popleft()
      red_counter += 1
    elif Q_deque[0] >= P_deque[0]:
      ans += Q_deque.popleft()
      green_counter +=1

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

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, A, B = mapint()
from collections import deque
if A+B-1>N or N>A*B:
    print(-1)
else:
    blocks = [deque() for _ in range(A)]
    cnt = N
    blocks[0] = list(range(B, 0, -1))
    flg = True
    while flg:
        flg = False
        for i in range(A-1, 0, -1):
            blocks[i].append(cnt)
            cnt -= 1
            if cnt==B:
                break
        else:
            flg = True
    ans = [0]*N
    cnt = 0
    for b in blocks:
        for a in b:
            ans[cnt] = a
            cnt += 1
    print(*ans)

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, A, B = mapint()
from collections import deque
if A+B-1>N or N>A*B:
    print(-1)
else:
    blocks = []
    blocks.append(' '.join(map(str, range(B, 0, -1))))
    now = B+1
    rest = N-A+2

    while now:
        if now>=rest:
            break
        if now+B>rest:
            blocks.append(' '.join(map(str, range(rest, now-1, -1))))
            rest += 1
            break
        blocks.append(' '.join(map(str, range(now+B-1, now-1, -1))))
        now = now+B
        rest += 1
    blocks.append(' '.join(map(str, range(rest, N+1))))
    print(' '.join(blocks))
### BUGGY CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
s=input()
mod=10**9+7
ans=1
cnt=[[0]*13 for i in range(len(s))]
if s[0]=="?":
    for i in range(10):  
        cnt[0][i]+=1
else:
    cnt[0][int(s[0])]+=1
# print(cnt)
n=len(s)
for i in range(1,n):
    if s[i]=="?":
        now=-1
    else:
        now=int(s[i])
    if now==-1:
        for j in range(13):
            for k in range(10):
                cnt[i][(j*10+k)%13]+=cnt[i-1][j]
    else:
        for j in range(13):
            cnt[i][(j*10+now)%13]+=cnt[i-1][j]

# print(cnt)
print(cnt[len(s)-1][5]%mod)

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
s=input()
mod=10**9+7
cnt=[[0]*13 for i in range(len(s))]
if s[0]=="?":
    for i in range(10):  
        cnt[0][i]+=1
else:
    cnt[0][int(s[0])]+=1
# print(cnt)
n=len(s)
for i in range(1,n):
    if s[i]=="?":
        now=-1
    else:
        now=int(s[i])
    if now==-1:
        for j in range(13):
            for k in range(10):
                cnt[i][(j*10+k)%13]+=cnt[i-1][j]
                cnt[i][(j*10+k)%13]%=mod
    else:
        for j in range(13):
            cnt[i][(j*10+now)%13]+=cnt[i-1][j]
            cnt[i][(j*10+now)%13]%=mod

# print(cnt)
print(cnt[n-1][5]%mod)
### BUGGY CODE ###

from string import ascii_lowercase

s = input()
k = int(input())

b = ord('a')

ret = ''
for c in s[:-1]:
    if c == 'a':
        ret += 'a'
        continue
    need = 26 - (ord(c) - b)
    if k >= need:
        k -= need
        ret += 'a'
    else:
        ret += c

k %= 26

c = s[-1]
ret += chr((ord(c) - b + k) % 26 + b)

print(ret)


### FIXED CODE ###

s = input()
k = int(input())

num = [26 - i for i in range(26)]
num[0] = 10 ** 9 + 10

a_ = ord('a')

ans = ''
for c in s:
    x = ord(c) - a_
    if num[x] <= k:
        ans += 'a'
        k -= num[x]
    else:
        ans += c
k %= 26
if k > 0:
    c = ans[-1]
    ans = ans[:-1] + chr(a_ + ((ord(c) - a_ + k) % 26))
print(ans)
### BUGGY CODE ###

import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

from collections import deque

N, X, Y = map(int, readline().split())

answer = deque([0 for _ in range(0, N)])
for i in range(1, N+1):
    for j in range(i, N+1):
        distance1 = abs(i - j)
        distance2 = abs(X-i) + abs(Y-j) + 1
        distance3 = abs(X-j) + abs(Y-i) + 1
        min_distance = min(distance1, distance2, distance3)
        answer[min_distance] += 1
answer.popleft()
for a in answer:
    print(a)

### FIXED CODE ###

import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N, X, Y = map(int, readline().split())

answer = [0 for _ in range(0, N)]
for i in range(1, N+1):
    for j in range(i, N+1):
        distance1 = abs(i-j)
        distance2 = abs(X-i) + abs(Y-j) + 1
        distance3 = abs(X-j) + abs(Y-i) + 1
        min_distance = min(distance1, distance2, distance3)
        answer[min_distance] += 1
for i, a in enumerate(answer):
    if i != 0:
        print(a)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,K=map(int,input().split())
    A=list(map(int,input().split()))
    B=[0]*N
    ans=0
    for i in range(N):
        B[i]=A[i]%K
        z=B[i]
        for j in range(min(K-1,i+1)):
            if z==j+1:
                ans+=1
            z+=B[i-(1+j)]
            z%=K
    print(ans)
    

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,K=map(int,input().split())
    A=list(map(int,input().split()))
    B=[0]*(N+1)
    for i in range(N):
        B[i+1]=(A[i]+B[i]-1)%K
    ans=0
    d={}
    for i in range(1,N+1):
        if i-K<0:
            if B[i-1] in d:
                d[B[i-1]]+=1
            else:
                d[B[i-1]]=1
        else:
            if B[i-1] in d:
                d[B[i-1]]+=1
            else:
                d[B[i-1]]=1
            d[B[i-K]]-=1
        if B[i] in d:
            ans+=d[B[i]]
    print(ans)
    

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

n, k = map(int, input().split())
a = list(map(int, input().split()))
val = 1
for i in range(0, k):
    val *= a[i]
    
for i in range(k, n):
    num = val*a[i]/a[i-k]
    if num > val:
        print('Yes')
    else:
        print('No')
    val = num


### 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')
### BUGGY CODE ###

import copy
import numpy as np
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
k=list(Counter(a).keys())
t=list(Counter(a).values())
for i in range(n):
  s=np.array(copy.copy(t))
  s[k.index(a[i])]-=1
  d = int(sum(s*(s-np.ones(len(s)))//2))
  print(d)

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k = [0]*n
for i in a:
  k[i-1]+=1
g = 0
for i in range(n):
  g+=((k[i]*(k[i]-1))//2)
for i in a:
  print(g+1-k[i-1])
### BUGGY CODE ###

try:
    n = int(input().strip())
    spot = [int(i) for i in input().strip().split(" ")]
    for i in range(n):
        max = 0
        point = 0
        for m in range(n):
            if i == m:
                continue
            max+=abs(point - spot[m])
            point=spot[m]
        max+=abs(point - 0)
        print(max)    
except EOFError:
    pass

### FIXED CODE ###

try:
    n = int(input().strip())
    spot = [int(i) for i in input().strip().split(" ")]
    spot.insert(0,0)
    spot.append(0)
    max=0
    for m in range(1,len(spot)):
        max+=abs(spot[m-1] - spot[m])
    for i in range(1,n+1):
        sub1=abs(spot[i-1] - spot[i])
        sub2=abs(spot[i] - spot[i+1])
        add1=abs(spot[i-1] - spot[i+1])
        print(max-sub1-sub2+add1)
except EOFError:
    pass
### BUGGY CODE ###

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

l = len(A)
max_ind = 0
for i in range(l-1):
  ind = 0
  num = i
  while A[num] >= A[num+1]:
    ind += 1
    num += 1
    if num == l-1:
      break
  if max_ind < ind:
    max_ind = ind 
print(max_ind)

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
 
now = 0
count = 0
ans = 0
 
for i in h:
    if now >= i:
        count += 1
    else:
        ans = max(ans,count)
        count = 0
    now = i
 
print(max(ans,count))