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

N = int(input())
mod = 10**9+7

for i in range(1, N):
    N *= i % mod

print(N % mod)


### FIXED CODE ###

N = int(input())
mod = 10**9+7

for i in range(1, N):
    N *= i
    N %= mod

print(N % mod)
### BUGGY CODE ###

N,M=list(map(int,input().split()))
cards=list(map(int,input().split()))
new=[]
cards.sort()
mod=0
for i in range(M):
    time,val=list(map(int,input().split()))
    mod+=time
    tmp=[val for _ in range(time)]
    new.append([val,time])
new.sort(key=lambda x:x[0],reverse=True)
#print(new)
total=0
vali=0
if mod<N:
    total+=sum(cards[mod-N:])
for i in new:
    for j in range(i[1]):
        if vali==N:
            break
        total+=max(i[0],cards[vali])
        vali+=1
        
print(total)


### FIXED CODE ###

from collections import Counter
N,M=list(map(int,input().split()))
cards=list(map(int,input().split()))
all_c=Counter(cards)

for i in range(M):
    time,val=list(map(int,input().split()))
    try:
        all_c[val]+=time
    except:
        all_c[val]=time

tmp=list(all_c.keys())
tmp.sort(reverse=True)
total=0
sum_time=0
for i in tmp:
    if sum_time>=N:
        break
    sum_time+=all_c[i]
    if sum_time<N:
        total+=i*all_c[i]
    else:
        total+=i*(all_c[i]+N-sum_time)
print(total)
### BUGGY CODE ###

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

import numpy as np

def gcd(x: int, y: int):
  if (y == 0):
    return x
  else:
    return gcd(y, x%y)

g = 1
for i in range(N):
  g = g * A[i] // gcd(g, A[i])
an = 0
MOD = 10**9+7

for x in A:
  #print(g,g//x)
  an += g//x
  an %= MOD

print(an)

### FIXED CODE ###

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

#N = 10000
#A = [i*2+1 for i in range(1,N+1)]

MOD = 10**9+7

sm = 0
for x in A:
  sm += pow(x,MOD-2,MOD)
  sm %= MOD

def gcd(x: int, y: int):
  while(y!=0):
    tmp = x%y
    x = y
    y = tmp
  return x

g = 1
for i in range(N):
  g = g * A[i] // gcd(g, A[i]) #pow(gcd(g, A[i]), MOD-2, MOD)
  #print(g)

an = g * sm % MOD

'''
for x in A:
  #print(g,g//x)
  an += g*pow(x,MOD-2,MOD)
  an %= MOD
  print(g,g//x,an)
'''

print(an)
### BUGGY CODE ###

from bisect import insort_left, bisect_left, bisect_right
n = int(input())
s = input()
q = int(input())
dic = {chr(i+ord('a')):[] for i in range(26)}
for ind, c in enumerate(s):
    dic[c].append(ind)

for _ in range(q):
    t, a, b = input().split()
    a = int(a)-1
    if t=='1':
        for c, li in dic.items():
            if a in li:
                li.remove(a)
            if c==b:
                insort_left(li, a)
    else:
        b = int(b)-1
        tmp = 0
        for li in dic.values():
            if bisect_left(li, a) < bisect_right(li, b):
                tmp += 1
        print(tmp)


### FIXED CODE ###

from bisect import insort_left, bisect_left
n = int(input())
s = list(input())
Q = int(input())
query = [input() for _ in range(Q)]
dic = {chr(i+ord('a')):[] for i in range(26)}
for ind, c in enumerate(s):
    dic[c].append(ind)

for q in query:
    t, a, b = q.split()
    a = int(a)-1
    if t=='1':
        if s[a]==b:
            continue
        ind = bisect_left(dic[s[a]], a)
        dic[s[a]].pop(ind)
        insort_left(dic[b], a)
        s[a] = b
    else:
        b = int(b)-1
        tmp = 0
        for li in dic.values():
            if li and a<=li[-1] and li[bisect_left(li, a)] <= b:
                tmp += 1
        print(tmp)
### BUGGY CODE ###

n,y = map(int,input().split())
flag = True

for i in range(y//10000 + 1):
    for j in range((y - i*10000)//5000 + 1):
        for k in range((y - i*10000-j*5000)//1000 + 1):
            if i*10000+j*5000+k*1000 == y:
                if i+j+k == n:
                    print(i,j,k)
                    flag = False
                    break
        if flag:
            continue
        else:
            break
    if flag:
        continue
    else:
        break            
else:
    print("-1 -1 -1")

### FIXED CODE ###

n,y = map(int,input().split())
flag = True

for i in range(y//10000 + 1):
    for j in range((y - i*10000)//5000 + 1):
        k = (y - 10000*i - 5000*j)//1000        
        if i + j + k == n:
            print(i,j,k)
            flag = False
            break
    if flag:
        continue
    else:
        break            
else:
    print("-1 -1 -1")
### BUGGY CODE ###

a,b,n=map(int,input().split())
list=[]
for i in range(a,b+1):
    list.append(i)
    
ans=[]
if n>b-a+1:
    for i in range(b-a+1):
        print(list[i])
else:
    for i in range(n):
        ans.append(list[i])

    for j in range(b-a+1-n,b-a+1):
        if list[j] not in ans:
            ans.append(list[j])
        
for k in range(len(ans)):
    print(ans[k])

### FIXED CODE ###

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

r=range(a,b+1)
for i in sorted(set(r[:k])|set(r[-k:])):print(i)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

N = int(input().strip())
A_list = list(map(int, input().rstrip().split()))
B_list = list(map(int, input().rstrip().split()))
C_list = list(map(int, input().rstrip().split()))
#-----

A_list.sort()
B_list.sort()
C_list.sort()

A_idx=0
B_idx=0
C_idx=0
cnt=0
for i_A in range(A_idx,len(A_list)):

    for i_B in range(B_idx,len(B_list)):
        if B_list[i_B] <= A_list[i_A]:
            B_idx = i_B
        else:
            for i_C in range(C_idx,len(C_list)):
                
                if C_list[i_C] <= A_list[i_A]:
                    C_idx = i_C
                elif C_list[i_C] > B_list[i_B] > A_list[i_A]:
                    cnt += 1

print(cnt)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import bisect

N = int(input().strip())
A_list = list(map(int, input().rstrip().split()))
B_list = list(map(int, input().rstrip().split()))
C_list = list(map(int, input().rstrip().split()))
#-----

A_list.sort()
B_list.sort()
C_list.sort()

cnt=0
for i in B_list:
    ind_A = bisect.bisect_left(A_list, i)
    ind_C = bisect.bisect_right(C_list, i)
    cnt +=  ind_A * (N - ind_C)

print(cnt)
### BUGGY CODE ###

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

e = []

for i in range(len(p)):
  e_val = 0
  for j in range(1, p[i] + 1):
    e_val = e_val + (j / p[i])
  e.append(e_val)

tmp = 0
l = 0

while True:
  res = 0
  j = 0
  for j in range(k):
    res = res + e[l + j]
  if tmp < res:
    tmp = res
  l = l + 1
  if l + k > len(e):
    break

print(tmp)

### FIXED CODE ###

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

sum_acc = [0]
tmp = 0
 
for i in range(n):
  tmp += (1 + p[i]) / 2
  sum_acc.append(tmp)

ans = 0
for j in range(k, n + 1): 
  ans = max(sum_acc[j] - sum_acc[j - k], ans)

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

original = input()

target = 2019

results = {}
countOfMod = {}
length = len(str(original))
for i in range(0, length+1):
    value = int(original[-i:]) if i > 0 else 0
    mod = value % target
    val = countOfMod.get(mod, 0) + 1
    countOfMod[mod] = val
    if countOfMod[mod] > 1:
        results.setdefault(mod, int(val*(val-1)/2))

print(sum(results.values()))


### 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 ###

import math
N = int(input())


def f(n):
    m = int(math.sqrt(n)+0.5)
    res = 0
    for x in range(1, m+1):
        for y in range(1, m+1):
            k = n - (x * x + y * y + x * y)
            if k < 1:
                break
            l = 1
            r = m+1
            while r - l > 1:
                z = (r + l) // 2
                tmp = (x + y + z) * z
                if tmp <= k:
                    l = z
                else:
                    if r == z + 1:
                        r -= 1
                    else:
                        r = z + 1
            if (x+y+l) * l == k:
                res += 1
    return res


for i in range(1, N+1):
    print(f(i))


### FIXED CODE ###

import math
N = int(input())


def f(n):
    m = int(math.sqrt(n)+0.5)
    res = 0
    for x in range(1, m+1):
        for y in range(x, m+1):
            k = n - (x * x + y * y + x * y)
            if k < 1:
                break
            l = y
            r = m+1
            while r - l > 1:
                z = (r + l) // 2
                tmp = (x + y + z) * z
                if tmp <= k:
                    l = z
                else:
                    if r == z + 1:
                        r -= 1
                    else:
                        r = z + 1
            if (x+y+l) * l == k:
                s = set()
                s.add(x)
                s.add(y)
                s.add(l)
                if len(s) == 3:
                    res += 6
                elif len(s) == 2:
                    res += 3
                else:
                    res += 1
    return res


for i in range(1, N+1):
    print(f(i))
### BUGGY CODE ###

N,M=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
mod=10**9+7
c=[0]*N
d=[0]*M
dp=[[ 0 for i in range(M)] for j in range(N)]
sm=[[ 0 for i in range(M)] for j in range(N)]
for i in range(N):
  if t[0]==s[i]:
    dp[i][0]=1
    c[i]=1
for i in range(M):
  if s[0]==t[i]:
    dp[0][i]=1
    d[i]=1
for i in range(N):
  sm[i][0]=sum(c[0:i+1])
for i in range(M):
  sm[0][i]=sum(d[0:i+1])
for i in range(1,N):
  for j in range(1,M):
    if s[i] != t[j]:
      dp[i][j]=0
    else:
      dp[i][j]=sm[i-1][j-1]+1
    sm[i][j]=sm[i-1][j]+sm[i][j-1]-sm[i-1][j-1]+dp[i][j]
ans=(sm[N-1][M-1]+1)%mod
print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
mod=10**9+7
sm=[[ 0 for i in range(M)] for j in range(N)]
s1=0
s2=0
if N>M:
  for i in range(N):
    if t[0]==s[i]:
      a=1
    else:
      a=0
    s1=s1+a
    sm[i][0]=s1
    if i<M:
      if s[0]==t[i]:
        a=1
      else:
        a=0
      s2=s2+a
      sm[0][i]=s2
else:
  for i in range(M):
    if s[0]==t[i]:
      a=1
    else:
      a=0
    s2=s2+a
    sm[0][i]=s2
    if i<N:
      if t[0]==s[i]:
        a=1
      else:
        a=0
      s1=s1+a
      sm[i][0]=s1
for i in range(1,N):
  for j in range(1,M):
    if s[i] != t[j]:
      sm[i][j]=(sm[i-1][j]+sm[i][j-1]-sm[i-1][j-1])%mod
    else:
      sm[i][j]=(sm[i-1][j]+sm[i][j-1]-sm[i-1][j-1]+sm[i-1][j-1]+1)%mod
ans=(sm[N-1][M-1]+1)%mod
print(ans)
### BUGGY CODE ###

import collections
import sys
import numpy as np
input = sys.stdin.readline
table = collections.defaultdict(set)
N = int(input())
S = [list(input().rstrip()) for i in range(N)]
T = [[""] * (N*2) for i in range(2*N)]
table2 = [[set()] * N for i in range(N)]

for i in range(2*N):
    if i < N:
        T[i] = S[i] + S[i]
    else:
        T[i] = S[i - N] + S[i-N]
ans = 0
for i in range(2*N):
    for j in range(2*N):
        table[T[i][j]].add((i, j))

for i in range(N):
    for j in range(N):
        for x, y in table[T[i][j]]:
            for k in range(2):
                for l in range(2):
                    idx = i + N*k
                    idy = j + N*l
                    if abs(x-idx) < N and abs(x-idx) == abs(y-idy):
                        A = min(x, idx)
                        B = min(y, idy)
                        if A >= N:
                            A -= N
                        if B >= N:
                            B -= N
                        table2[i][j].add((A, B))


ans = set()
for i in range(N):
    for j in range(N):
        if i == 0 and j == 0:
            ans = table2[i][j]
        else:
            ans = ans & table2[i][j]

s = np.array(T)
count = 0
for A, B in ans:
    tmp = s[A:A+N, B:B+N]
    if (tmp != tmp.T).any() == False:
        count += 1


print(count)


### FIXED CODE ###

import collections
import sys
import numpy as np
input = sys.stdin.readline
table = collections.defaultdict(set)
N = int(input())
S = [list(input().rstrip()) for i in range(N)]
T = [[""] * (N*2) for i in range(2*N)]
table2 = [[set() for j in range(N)] for i in range(N)]

for i in range(2*N):
    if i < N:
        T[i] = S[i] + S[i]
    else:
        T[i] = S[i - N] + S[i-N]
ans = 0
T = np.array(T)
for i in range(N):
    tmp = T[i:i+N, N-1-i:2*N-1-i]

    if (tmp == tmp.T).all():
        ans += N - (N // 2)

    tmp = T[i+1:i+N+1, N-1-i:2*N-1-i]

    if (tmp == tmp.T).all():
        ans += N // 2
print(ans)
### BUGGY CODE ###

k, s  = map(int, input().split())
ans = 0
for i in range(k + 1):
    for j in range(i, k + 1):
        for l in range(j, k + 1):
            if i + j + l == s:
                if i == j == l:
                    ans += 1
                elif i == j or j == l:
                    ans += 3
                elif i != j != l:
                    ans += 6
print(ans)

### FIXED CODE ###

k, s  = map(int, input().split())
ans = 0
for i in range(k + 1):
    for j in range(i, k + 1):
        if j <= s - i - j <= k:
            l = s - i - j
            if i == j == l:
                ans += 1
            elif i == j or j == l:
                ans += 3
            elif i != j != l:
                ans += 6
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def main():
    _, K = map(int, input().split())
    P = list(map(int, input().split()))

    max_average = 0
    point = 0
    for i in range(len(P)-K+1):

        if max_average < sum(P[i:i+K]):
            max_average = sum(P[i:i+K])
            point = i

    count = 0
    for p in range(point, point+K):
        count += sum(range(1, P[p]+1)) / P[p]

    print(count)

main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    tmp_max = sum(P[:K])
    tmp = sum(P[:K])
    for i in range(N-K):
        tmp += P[i+K]
        tmp -= P[i]

        if tmp > tmp_max:
            tmp_max = tmp

    print((tmp_max + K) / 2)

main()
### BUGGY CODE ###

import itertools
import math
n=int(input())
def sosuu(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
ans=0
data=get_sieve_of_eratosthenes(55555)
for k in itertools.permutations(data,n):
    for j in itertools.permutations(k,n):
        if not(sosuu(sum(j))):
            ans+=1
            break
        if ans==n:
            print(*k)
            exit()

### FIXED CODE ###

n=int(input())
import math
def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
data=get_sieve_of_eratosthenes(55555)
b=[]
for i in range(len(data)):
    if data[i]%5==1:
        b.append(data[i])
print(*b[:n])
### BUGGY CODE ###

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

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = 0
hoge = 0
mod = 10**9+7
for i in range(N):
    hoge = hoge + A[i]
    hoge = hoge % mod

for i in range(N):
    hoge = hoge - A[i]
    if hoge < 0:
        hoge = hoge + mod
    ans = ans + A[i] * hoge
    ans = ans % mod

print(ans%mod)
### BUGGY CODE ###

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

A.sort()
B.sort()
C.sort()

from fractions import gcd
from math import ceil
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

ans = 0
for a in A:
    indb = bisect_right(B, a)
    for b in B[indb:]:
        indc = bisect_right(C,b)
        ans += N-indc

print(ans)

### FIXED CODE ###

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

A.sort()
B.sort()
C.sort()

from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort

ans = 0

for b in B:
    ans += bisect_left(A,b) * (N - bisect_right(C,b))

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

a = int(input())
def divisor(n):
    i = 1
    l = []
    while i * i <= n:
        if n % i == 0:
            l.append(i)
            l.append(n//i)
        i += 1
    return len(set(sorted(l)))
total = 0
for i in range(1,a+1):
    total += i * divisor(i)
    
print(total)


### FIXED CODE ###

N = int(input())


def g(n):
    return (n * (n + 1))//2

total = 0
for i in range(1,N+1):
    total += i * g(N//i)
    
print(total)
### BUGGY CODE ###

import math
N, P = map(int, input().split())
p = math.ceil(P**(1/N))
ans = 1
flag=False
if P%2==1:
  flag=True
for i in reversed(range(1, p+1)):
    if flag and i%2==0:
      continue
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)


### FIXED CODE ###

import math
N, P = map(int, input().split())
p = P**(1/N)
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)


divisors=[]

for i in range(2,round(P**(1/N))+1):
  if P%i==0:
    divisors.append(i)
for i in reversed(divisors):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)
### BUGGY CODE ###

import sys
readline = sys.stdin.readline
from collections import deque
N = int(readline())
G = [[] for i in range(N*N)]
deg = [0]*(N*N)
day = [0]*(N*N)
F = set()
for p in range(N):
    *A, = map(int, readline().split())
    for k in range(N-1):
        A[k] -= 1
    prv = A[0]+p*N if A[0] < p else p+A[0]*N
    F.add(prv)
    for k in range(1, N-1):
        i = A[k]+p*N if A[k] < p else p+A[k]*N
        G[prv].append(i)
        deg[i] += 1
        prv = i
que = deque()
for i in F:
    if deg[i] == 0:
        que.append(i)
        day[i] = 1
rest = N*(N-1)//2
while que:
    v = que.popleft()
    rest -= 1
    d = day[v]
    for w in G[v]:
        deg[w] -= 1
        if deg[w] == 0:
            day[w] = day[v] + 1
            que.append(w)
if rest > 0:
    print(-1)
else:
    print(max(day))

### FIXED CODE ###

import sys
readline = sys.stdin.readline
from collections import deque
N = int(readline())
G = [[] for i in range(N*N)]
deg = [0]*(N*N)
day = [0]*(N*N)
F = set()
for p in range(N):
    *A, = map(int, readline().split())
    for k in range(N-1):
        A[k] -= 1
    for k in range(N-2):
        i = A[k]+p*N if A[k] < p else p+A[k]*N
        j = A[k+1]+p*N if A[k+1] < p else p+A[k+1]*N
        G[i].append(j)
        deg[j] += 1
    i = A[0]+p*N if A[0] < p else p+A[0]*N
    F.add(i)
que = deque()
for i in F:
    if deg[i] == 0:
        que.append(i)
        day[i] = 1
rest = N*(N-1)//2
while que:
    v = que.popleft()
    rest -= 1
    d = day[v]
    for w in G[v]:
        deg[w] -= 1
        if deg[w] == 0:
            day[w] = day[v] + 1
            que.append(w)
if rest > 0:
    print(-1)
else:
    print(max(day))
### BUGGY CODE ###

N = int(input())
if N <= 10**3:
    for i in range(1, N+1):
        ans = 0
        for x in range(1, 13):
            for y in range(1, 13):
                for z in range(1, 13):
                    if (x+y+z)**2-x*y-y*z-z*x == i:
                        ans += 1
        print(ans)
    exit()
else:
    table = [0] * N
    for i in range(1, 10**3):
        ans = 0
        for x in range(1, 41):
            for y in range(1, 41):
                for z in range(1, 41):
                    if (x+y+z)**2-x*y-y*z-z*x == i:
                        ans += 1
        table[i-1] += ans
    for j in range(10**3, N+1):
        ans = 0
        for x in range(1, 41):
            for y in range(1, 41):
                for z in range(1, 41):
                    if (x+y+z)**2-x*y-y*z-z*x == j:
                        ans += 1
        table[j-1] += ans
    print(*table, sep="\n")

### FIXED CODE ###

N = int(input())

def count(a, b, c):
    return (a+b+c)**2-a*b-b*c-c*a

table = [0] * (N+1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            tmp = count(x, y, z)
            if tmp <= N:
                table[tmp] += 1
print(*table[1:], sep="\n")
### BUGGY CODE ###

# -*- coding utf-8 -*-
import bisect

N = int(input())
A = [int(input()) for _ in range(N)]

c = []

ans = 0

for a in A:
    if len(c) == 0:
        c.append(a)
    elif a <= c[0]:
        c = [a] + c
    else:
        i = bisect.bisect_left(c, a) - 1
        c[i] = a

print(len(c))


### FIXED CODE ###

import bisect
from collections import deque

N = int(input())

# c = [int(input())]
c = deque()
c.appendleft(int(input()))


for ai in range(1, N):
    a = int(input())
    if a <= c[0]:
        c.appendleft(a)
    else:
        i = bisect.bisect_left(c, a) - 1
        c[i] = a

print(len(c))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
#def input():
    #return sys.stdin.readline()[:-1]
N , Q = map(int,input().split())
graph = [[] for _ in range(N)]
point = [0] * N
for _ in range(N - 1):
    a , b = map(int,input().split())
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)
for _ in range(Q):
    a , b = map(int,input().split())
    a = a - 1
    point[a] += b
# dfsを用いて累積和を計算する
# 初期状態だと前の値がないためデフォルト引数に-1を代入
def dfs(now , prev = -1):
    for next in graph[now]:
        # 次のノードが前に参照した値の時はcontinue
        if next == prev:
            continue
        # 現在の値を次のポイントに加算することで累積和をとる
        point[next] += point[now]
        # 次のノードと現在のノードを引数にdfsを継続する
        dfs(next , now)

dfs(0)
print(*point)

### FIXED CODE ###

#ika tako
import sys
n, q = map(int, input().split())
lines = sys.stdin.readlines()
links = [set() for _ in range(n)]
for line in lines[:n - 1]:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add(b)
    links[b].add(a)
adds = [0] * n
for line in lines[n - 1:]:
    p, x = map(int, line.split())
    p -= 1
    adds[p] += x
ans = [-1] * n
q = [(0, 0)]
while q:
    v, a = q.pop()
    a += adds[v]
    ans[v] = a
    for u in links[v]:
        if ans[u] == -1:
            q.append((u, a))
print(*ans)
### BUGGY CODE ###

N,M=map(int,input().split())
link=[[] for i in range(N)]
for i in range(M):
    A,B=map(int,input().split())
    link[A-1].append(B-1)
    link[B-1].append(A-1)
visited=[False for i in range(N)]
result=[0]*N
Q=[0]
visited[0]=True
while Q:
    v=Q.pop(0)
    for i in link[v]:
        if visited[i]==False:
            visited[i]==True
            result[i]=v
            Q.append(i)
print('Yes')
for i in range(1,N):
    print(result[i]+1)

### FIXED CODE ###

N, M = map(int, input().split())
link = [[] for i in range(N)]
for i in range(M):
    A, B = map(int, input().split())
    link[A-1].append(B-1)
    link[B-1].append(A-1)
visited = [False for i in range(N)]
result = [0] * N
Q = [0]
visited[0] = True
#Qに要素がなくなるまで
while Q:
    #一番上の要素をpop
    v = Q.pop(0)
    for i in link[v]:
        if visited[i] == False:
            visited[i] = True
            result[i] = v
            Q.append(i)
print("Yes")
for i in range(1, N):
    print(result[i] + 1)
### BUGGY CODE ###

N = int(input())
H = list(map(int,input().split()))
counter = 0

for i in reversed(range(N)):
  minicounter = 0
  for j in range(N-i-1):
    if H[i] >=H[i+1]:
      #print('i',i,'j',j)
      i +=1
      minicounter +=1
    else:
      break
  if minicounter > counter:
    counter = minicounter

print(counter)

### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
counter = 0
Ans = 0
temp = 0
for i in range(N-1):
  if H[counter]>=H[counter+1]:
    temp += 1
    if temp > Ans:
      Ans = temp
    counter += 1
  else:
    temp = 0
    counter += 1
    
print(Ans)