peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N, K, *D = open(0).read().split()
*N, = map(int, N)
*D, = map(int, D)
N += [0]

for i in range(len(N)-1):
    while N[i] in D:
        N[i] += 1

    if N[i] > 9:
        N[i] %= 10
        N[i+1] += 1

if N[i] > 0:
    while N[i] in D:
        N[i] += 1
    i += 1

print(''.join([str(j) for j in N[:i][::-1]]))
# Judge status: Accepted
a, b, t = [int(i) for i in input().split()]
print(t//a*b)
# Judge status: Wrong Answer
import numpy as np

N, K = map(int, input().split())
scores = list(map(int, input().split()))

tot = np.prod(scores[0:K])
past = tot
for i in range(N-K):
    tot = np.prod(scores[i+1:i+K+1])
    if tot > past:
        print("Yes")
    else:
        print("No")
    past = tot
# Judge status: Accepted
a,b=map(int,input().split())
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
print(a*b // gcd(a,b))
# Judge status: Wrong Answer
N,M = [int(x) for x in input().split()]
a = []
mod = 10**9 + 7
DP = [0]*(N+1)
for i in range(M):
    aa = int(input())
    DP[aa] = -1
DP[0] = 1
if not 1 in a:
    DP[1] = 1
for i in range(2,N+1):
    if DP[i] != -1:
        DP[i] = max(0,DP[i-1]) + max(0,DP[i-2])
ans = DP[N] % mod
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
n=[1,3,5,7,8,10,12]
m=[4,6,9,11]
if a in n and b in n:print("Yes")
elif a in m and b in m:print("Yes")
else:print("No")
# Judge status: Accepted
n = int(input())
rates = set()
over = 0
people = list(map(int, input().split()))
for rate in people:
    if rate // 400 >= 8:
        over += 1
    else:
        rates.add(rate // 400)
print(max(1, len(rates)), len(rates) + over)
# Judge status: Accepted
def main():
  #n = int(input())
  #s = input()
  #s = input().split()
  a,b = list(map(int,input().split()))
  #c = [input().split() if i in range(n)]
  ans = 0
  
  for i in range(2):
    if a >= b:
      ans += a
      a -= 1
    else:
      ans += b
      b -= 1
  print(ans)
  
if __name__ == '__main__':
  main()
# Judge status: Accepted
def funcion_a(n):
  count = 0
  i = 2
  while i*i <= n:
    count += 1
    j = i + 1
    while i*j <= n:
      count += 2
      j += 1
    i += 1
  return count
  
n = int(input())
answer = funcion_a(n-1) + (n-2)*2 + 1
print(answer)
# Judge status: Accepted
n, r = list(map(int,input().split()))
if n >= 10:
    print(r)
else:
    temp = 100 * (10 -n)
    print(r + temp)
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))

cnt =0
for i in range(n-2):
    for j in range(i,n-1):
        for k in range(j,n):
            li = [l[i],l[j],l[k]]
            if len(set(li))==3 and max(li)*2<sum(li):
                cnt +=1
print(cnt)
# Judge status: Accepted
#!/usr/bin/env python3
n, a, b = map(int, input().split())
if (b - a) % 2 < 1:
    print((b - a) // 2)
else:
    print(min((a + b - 1) // 2, (2 * n - a - b + 1) // 2))
# Judge status: Wrong Answer
N, Y = map(int, input().split())

res = False

a = 0
b = 0
c = 0

for i in range(N + 1):
    for q in range(N + 1):
        c = N - (i + q)
        if c > 0 and i > 0 and q > 0:
            total = 10000*i + 5000*q + 1000*c
            if total == Y:
                res = True
                a = i
                b = q
                d = c

if res:
    print('{} {} {}'.format(a, b, d))
else:
    print('-1 -1 -1')
# Judge status: Accepted
a,b,c = map(int,input().split())
# print(a,b,c)

if c <= a + b:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
z=list(map(int,input().split()))
list.sort(z, reverse=True)
c=z[0]
b=z[1]
a=z[2]
x=0

if ((c-b)%2==0 and (c-a)%2==0):
  x+= (c-b)//2+(c-a)//2
elif (((c-b)%2==0 and (c-a)%2==1) or ((c-b)%2==1 and (c-a)%2==0)):
  x+= (c-b)//2 + (c-1)//2 +2
else:
  x+=(c-b)//2 + (c-a)//2 + 1
print(x)
# Judge status: Accepted
x = int(input())
cur = 100
ans = 0
while(cur < x):
  cur = cur * 101//100
  ans += 1
print(ans)
# Judge status: Accepted
a, b = list(map(int ,input().split()))
print(a*b)
# Judge status: Accepted
s = input()
t = input()

def f(x):
    dic = {}
    for c in x:
        if c in dic:
            dic[c] += 1
        else:
            dic[c] = 1
    return dic

d1 = f(s)
d2 = f(t)
l1 = [i for i in d1.values()]
l2 = [i for i in d2.values()]
l1.sort()
l2.sort()

if l1 == l2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
w=["Sunny","Cloudy","Rainy","Sunny"];print(w[w.index(input())+1])
# Judge status: Wrong Answer
n = int(input()); a = list(map(int, input().split())); b = -1; x = 1
for i in range(n-1):
    if b == 0:
        if a[i] > a[i+1]: b = -1; x += 1
    elif b == 1:
        if a[i] < a[i+1]: b = -1; x += 1
    else:
        b = 0 if a[i] < a[i+1] else 1
print(x)
# Judge status: Accepted
import math
x=int(input())
k=8-math.floor((x-400)/200.0)
print(k)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
AA=[0]
for a in A[1:]:
    AA.append(AA[-1]+a)
print(AA)
f=1 if A[0]==0 else 0
r=1
b=1
for i,a in enumerate(A[1:]):
    x=min(b*2,AA[-1]-AA[i])
    if i<N-1 and x>a or i==N-1 and x==a:
        b=x-a
        r+=x
    else:
        f=0
print(r if f else -1)
# Judge status: Accepted
def ABC_82_A():
    a,b = map(int, input().split())
    print(int((a+b+1)/2))

if __name__ == '__main__':

    ABC_82_A()
# Judge status: Accepted
import numpy as np

x, y, a, b, c = map(int, input().split())
p = np.array(list(map(int, input().split())))
q = np.array(list(map(int, input().split())))
r = np.array(list(map(int, input().split())))

p = np.sort(p)[::-1][:x]
q = np.sort(q)[::-1][:y]
a = np.hstack((p, q, r))
a = np.sort(a)[::-1][:(x+y)]

print(np.sum(a))
# Judge status: Wrong Answer
a,b=map(int,input().split())
hai1=[]
hai2=[]
for k in range(0,a):
  hai1.append(str(b))
for i in range(0,b):
  hai2.append(str(a))
ak="".join(hai1)
bk="".join(hai2)
c=[0]*2
c[0]=int(ak)
c[1]=int(bk)
c.sort()
print(c[0])
# Judge status: Wrong Answer
n, m = map(int, input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
div = make_divisors(n)
for i in div[::-1]:
    if i <= m / n:
        print(i)
        break
# Judge status: Accepted
A, B = map(int, input().split())
div, rem = divmod(abs(A - B), 2)
print("IMPOSSIBLE" if rem else min(A, B) + div)
# Judge status: Accepted
strs=input()
che=True
c=True
coun=False
for i in range(0,len(strs)) :
    if(i==0):
        c=True if strs[i]=="A" else False
    else :
        if(strs[i].isupper()):
            if( (not coun) and i>=2 and i<=len(strs)-2 and strs[i]=='C'):
                coun=True
            else:
                che=False
print("AC") if che and coun and c else print("WA")
# Judge status: Accepted
n = int(input())

a = n % 1000
if a == 0:
  print(0)
else:
  print(1000 - a)
# Judge status: Accepted
n,k=map(int,input().split())
cnt=0
while n>0:
	n//=k
	cnt+=1
print(cnt)
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
if (a+b)%2>=0:
  print(int((a+b)/2))
else:
  print("IMPOSSIBLE")
# Judge status: Wrong Answer
a=int(input())
i=100
f=0
while (i/a)<1:
  if (i/a)<1/4424440255150901545896526287522681900236800:
    i=int(i*44244402551509015458965262875226819002368/100)
    f=f+9000
  else:
    i=int(i*1.01)
    f=f+1
print(f)
# Judge status: Accepted
n,m=map(int,input().split())
l=[]
r=[]
for i in range(m):
    templ,tempr=map(int,input().split())
    l.append(templ)
    r.append(tempr)
l_max=max(l)
r_min=min(r)

if l_max<=r_min:
    print(r_min-l_max+1)
else:
    print(0)
# Judge status: Accepted
a,b=map(int,input().split())
print(a+b-24 if a+b>=24 else a+b)
# Judge status: Wrong Answer
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
AS=[0]
BS=[0]
r=0
for i in A:
  if i+AS[-1]<k:
    AS.append(i+AS[-1])
  else:
    break
    
for i in B:
  if i+BS[-1]<k:
    BS.append(i+BS[-1])
  else:
    break
    
j=len(BS)-1
for i in range(len(AS)):
  while AS[i]+BS[j]>k:
    j-=1
  r=max(r,i+j)
print(r)
# Judge status: Accepted
k,a,b = map(int,input().split())
k -= a-1
div,mod = divmod(k,2)
ans = 1 + (a-1)
if a+2 <= b:
    dum = b-a
    ans += dum*div
    if mod == 1:
        ans += 1
else:
    ans += k
print(ans)
# Judge status: Wrong Answer
N = int(input())
X = input().split()
X = [int(s) for s in X]

X = sorted(X)
range_X = X[-1] - X [0]

E_min = 10000000000000
for p in range(range_X):
    E = 0
    for x in X:
        E += (x-p)**2
    if E < E_min:
        E_min = E
print(E_min)
# Judge status: Accepted
N = int(input())
power = 1
for i in range(1,N+1):
    power = power * i % (10**9+7)
print(power)
# Judge status: Wrong Answer
n = int(input())

if n < 105:
    print(0)
elif n < 165:
    print(1)
elif n < 195:
    print(2)
else:
    print(3)
# Judge status: Wrong Answer
n = int(input())
ls = []
for i in range(n):
    x, l = map(int, input().split())
    ls.append([x-l, x+l])
ls.sort()

now = ls[0]

ans = n

for i in range(1,n):
    if now[1] > ls[i][0]:
        ans -= 1
    else:
        now = ls[i]

print(ans)
# Judge status: Wrong Answer
import collections

N = int(input())
S = list(input())

MOD = 10 ** 9
c = collections.Counter(S)
ans = 1
for k, v in c.items():
    ans *= v + 1
    ans %= MOD

ans -= 1
print(ans)
# Judge status: Wrong Answer

a, b, c = list(map(int, input().split(' ')))
cnt = 0
if a == b == c:
    cnt = -1  
else:
    while not (a%2 or b%2 or c%2):
        cnt += 1
        a,b,c=(b+c)/2,(a+c)/2,(a+b)/2

print(cnt)
# Judge status: Wrong Answer
n,k = map(int,input().split())
rc = [list(map(int,input().split())) for i in range(k)]

tmp = set(range(1,n+1))

for i in rc:
    tmp = tmp & set(range(i[0],i[1]))

print(len(tmp))
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    p = list(map(int, input().split()))
    ans = 0
    for i in range(N-1):
        if i+1 == p[i]:
            tmp = p[i]
            p[i] = p[i+1]
            p[i+1] = tmp
            ans += 1
    print(ans)
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
A = [0] * (N + 1)
B = [0] * (N + 1)

count = 0

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

if N % 2 == 1:
  centerA = int(A[(N + 1) // 2])
  centerB = int(B[(N + 1) // 2])
else:
  centerA = (A[N // 2] + A[N // 2 + 1]) / 2
  centerB = (B[N // 2] + B[N // 2 + 1]) / 2

#print(centerA, centerB)  

if N % 2 == 1:
  count = int(centerB) - int(centerA) + 1
else:
  count = int(centerB * 2) - int(centerA * 2) + 1

print(int(count))
# Judge status: Wrong Answer
import sys
N=int(input())
a = list(map(int,input().split()))
cnt=0
j=0
if((1 in a)==False):
    print(-1)
    sys.exit()
for i in range(N):
    for n in range(j,N):
        if(a[n]==i+1):
            j=n+1
            break
        else:
            cnt+=1
            

print(cnt)
# Judge status: Accepted
n,m=map(int,input().split())

ans=0

if m-2*n>=0:
    m-=2*n
    ans+=n + (m//4)
    print(ans)
else:
    ans+=m//2
    print(ans)
    exit(0)
# Judge status: Accepted
s=int(input(''))
if s==0:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
import math
import copy
H,N=map(int,input().split())

inf=float('inf')
dp=[0]+[inf]*H

for i in range(N):
    A,B=map(int,input().split())
    ndp=copy.deepcopy(dp)
    for j in range(A,H+1):
        ndp[j]=min(ndp[j-A]+B,dp[j])

        if j > H-A:
            ndp[-1]=min(ndp[-1],ndp[j]+B)

    dp=ndp
    if A>=H:
        ndp[-1]=min(B,dp[-1])

print(dp[-1])
# Judge status: Wrong Answer
def gcd(p, q):
    if p % q == 0:
        return q
    else:
        new_p = q
        q = p % q
        return gcd(new_p, q)


memo = []
ans = 0
K = int(input())
for a in range(1, K+1):
    for b in range(1, K+1):
        memo.append(gcd(a,b))
memo.sort()
new_memo = list(set(memo))
for c in range(1, K + 1):
    ans += gcd(c, new_memo[c-1]) * memo.count(new_memo[c-1])
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())
p = list(map(int, input().split()))
q = [0]*n
for i in range(n):
    q[i] = p[i] - i - 1
if q.count(0) >= n - 2:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
# A
s = list(map(str, input().split()))

print(s[0][0]+s[1][0]+s[2][0])
# Judge status: Accepted
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, k = inintm()

ans = 0

for i in range(1,n+1):
    b = 0
    for _ in range(1,18):
        if i >= k:
            break
        i *= 2
        b += 1
    ans += (1/n)*(0.5**b)

print(ans)
# Judge status: Accepted
n = int(input())
for i in range(n):
    a = i**2
    if a>n:
        b = i
        break
if n<=2:
    print(1)
else:
    print((b-1)**2)
# Judge status: Accepted
n = int(input())
l_h = list(map(int, input().split()))

max_mov_cnt = 0
tmp = 0
for i in range(n-1):
    if l_h[i] >= l_h[i+1]:
        tmp += 1
    else:
        max_mov_cnt = max(max_mov_cnt, tmp)
        tmp = 0

max_mov_cnt = max(max_mov_cnt, tmp)
print(max_mov_cnt)
# Judge status: Accepted
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    n, k = MI()
    scores = LI()

    score_now = 1

    for i in range(k, n):
        next_score = scores[i] / scores[i - k]
        print("Yes" if next_score > 1 else "No")


main()
# Judge status: Accepted
H1, M1, H2, M2, K = map(int, input().split())

print((H2 * 60 + M2) - (H1 * 60 + M1) - K)
# Judge status: Wrong Answer
L = [chr(i) for i in range(97, 123)]
f = 0
s = input()
for l in L:
  if s.count(l) == 0:
    print(l)
    f = 1
if f == 0:
  print("None")
# Judge status: Accepted
from collections import Counter

input()
d = Counter(map(int, input().split()))
d = dict(sorted(d.items(), reverse=True))
ans = []
for i, j in d.items():
    if j >= 4:
        ans.append(i)
    if j >= 2:
        ans.append(i)
if len(ans) >= 2:
    print(ans[0] * ans[1])
else:
    print(0)
# Judge status: Wrong Answer
import sys
import collections
n = int(input())
li=[input() for _ in range(n)]
li.sort()
c = collections.Counter(li)
max_list = [kv[0] for kv in c.items() if kv[1] == max(c.values())]
for s in max_list:
  print(s)
# Judge status: Accepted
a,b,c,d,e,k=[int(input()) for i in range(6)]
if b-a>k or c-a>k or d-a>k or e-a>k or c-b>k or d-b>k or e-b>k or d-c>k or e-c>k or e-d>k:
  print(":(")
else:
  print("Yay!")
# Judge status: Accepted
def main():
  num = int(input())

  tmp = [input() for i in range(num)]

  tmp2 = {}
  for t in tmp:
    if len(tmp2) == 0:
      tmp2[t] = 1
    else:
      if t in tmp2:
        tmp2[t] += 1
      else:
        tmp2[t] = 1

  _tmp2 = sorted(tmp2.items(), key=lambda x:x[1])
  tmp3 = sorted(tmp2.items())
  for t in tmp3:
    if _tmp2[-1][1] == t[1]:
      print(t[0])

main()
# Judge status: Accepted
n=int(input())
a = [list(map(int, input().split())) for i in range(n)]

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

a.sort(key=lambda x: x[3])

left=-float('inf')
count=0
for i in range(n):
    if a[i][2]>=left:
        count+=1
        left=a[i][3]

print(count)
# Judge status: Accepted
L,R = map(int,input().split())
if R-L >= 2019:
    print(0)
else:
    mR = R%2019
    mL = L%2019
    if mL > mR:
        print(0)
    else:
        mini = 2019
        for i in range(mL, mR):
            for j in range(i+1, mR+1):
                mini = min(mini, (i*j)%2019)
        print(mini)
# Judge status: Accepted
from math import gcd

K = int(input())

ans = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            p = gcd(a, b)
            ans += gcd(p, c)
print(ans)
# Judge status: Wrong Answer
a,b = input().split()
a1 = a*int(b)
a2 = b*int(a)
print(max(a1,a2))
# Judge status: Accepted
import collections
N = int(input())
a = collections.Counter(list(map(int,input().split())))
p = sorted([i for i in a.items() if i[1]>=2])
if len(p)<2:
    print(0)
elif p[-1][1]>=4:
    print(p[-1][0]**2)
else:
    print(p[-1][0]*p[-2][0])
# Judge status: Wrong Answer
N, K = map(int, input().split())
H = list(map(int, input().split()))
DP = [100000]*N
for i, h in enumerate(H):
    if i == 0:
        DP[0] = 0
    for k in range(1,K+1):
        if i - k >= 0 :
            DP[i] = min(DP[i], DP[i-k]+abs(H[i]-H[i-k]))
print(DP[-1])
# Judge status: Accepted
a=int(input())
k=a+a**2+a**3
print(k)
# Judge status: Wrong Answer
#https://atcoder.jp/contests/abc109/tasks/abc109_b
import collections
N = int(input())
Word_List = []
SP = ""
for i in range(N):
    CW = str(input())
    if i == 0:
        Word_List.append(CW)
        SP = CW[-1]
    elif SP != CW[0]:
        break
    else:
        Word_List.append(CW)
        SP = CW[-1]
else:
    Word_List = collections.Counter(Word_List)
    if len(Word_List) != N:
        print("No")
    else:
        print("Yes")
# Judge status: Accepted
n,k = map(int,input().split())

okashi = [0 for i in range(n)]
for i in range(k):
    d = int(input())
    for j in list(map(int,input().split())):
        okashi[j-1] = 1

cnt = 0
for i in okashi:
    if i == 0:
        cnt += 1

print(cnt)
# Judge status: Accepted

import collections


def main():
    x = int(input())

    print("Yes" if x >= 30 else "No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
A = int(input())

B = N//500
C = N - 500*B

if C <= A:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
t= list(input())
n=len(t)
for i in range(n):
    if i==0:
        if t[i]=='?':
            t[i]='D'
    else:
        if t[i]=='?':
            if t[i-1]=='D':
                t[i]='P'
            elif t[i-1]=='P':
                t[i]='D'

ans = ''.join(t)  
print(ans)
# Judge status: Accepted

N, K = map(int, input().split())
        
    
import math

sum = 0
for i in range(N):
    X = math.log2(K/(i+1))
    X = math.floor(X) if X % 1 == 0 else math.floor(X+1)
    #print(X, i, K)
    X = X if X > 0 else 0
    sum += (1/N)*(1/2)**X
    
print(sum)
# Judge status: Accepted
S = input()

import sys
for i in range(26):
    ans = chr(ord('a') + i)
    if not(ans in S):
        print(ans)
        sys.exit()
ans = "None"
print(ans)
# Judge status: Accepted
h1, m1, h2, m2, K = map(int, input().split())

a = 60*h1 + m1
b = 60*h2 + m2
print(b-K-a)
# Judge status: Wrong Answer
n = int(input())
x_list = list(map(int, input().split(" ")))


min = min(x_list)
max = max(x_list)

ans = 100*100

for p in range(1, 100+1):
    tmp = 0
    for x in x_list:
        tmp += (x - p) ** 2
    if ans > tmp:
        ans = tmp

print(ans)
# Judge status: Accepted
n = int(input())

a_list = list(map(int, input().split()))
# print(a_list)

a_list = sorted(a_list, reverse=True)
# print(a_list)

alice = 0
bob = 0
for i in range(len(a_list)):
    if i % 2 == 0:
        alice += a_list[i]
    else:
        bob += a_list[i]
print(alice - bob)
# Judge status: Accepted
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
cnt_0 = 0
cnt_2 = 0
for i in range(n):
    if a[i] % 4 == 0:
        cnt_2 += 1
    elif a[i] % 2 == 1:
        cnt_0 += 1
if (cnt_2 >= cnt_0 - 1 and cnt_2 + cnt_0 == n) or cnt_2 >= cnt_0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()

if s[-1] == 's':
    s += 'es'
else:
    s += 's'

print(s)
# Judge status: Accepted
s,c = map(int,input().split())
res = 0
if s*2 <= c:
    res = s
    c -= s*2
    s = 0
else:
    res += c//2
    c = 0

if c:
    res += c//4
print(res)
# Judge status: Accepted
import re
a,b = map(int,input().split())
s = input()
if s[a]=='-' and re.match(r'^\d+$',s[:a]) and re.match(r'^\d+$',s[a+1:]):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
nStr = input()

if nStr[0] == "9" or nStr[1] == "9":
  print("Yes")
else:
  print("No")
# Judge status: Accepted
def main():
    n=int(input())
    a=list(map(int,input().split()))
    a.sort()
    a.append(-1)
    cnt=1
    ans=0
    for i in range(n):
        if a[i]==a[i+1]:
            cnt+=1
        else:
            if cnt>=a[i]:
                ans+=cnt-a[i]
            else:
                ans+=cnt
            cnt=1
    print(ans)
if __name__=="__main__":
    main()
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))
total = 0
max_total = 0

for i in range(N-1):
    if H[i] >= H[i+1]:
        total += 1
        max_total = max(total, max_total)
    else:
        total = 0

print(max_total)
# Judge status: Accepted
S = input()
K = int(input())
ans = 1
for i, s in enumerate(S):
    if i+1 == K:
        ans = s
        break
    if s == '1':
        continue
    else:
        ans = s
        break

print(ans)
# Judge status: Wrong Answer
x = int(input())

for i in range(x):
    for j in range(2, 10):
        if (x-i)**(1/j) % 1 == 0:
            print(x-i)
            exit()
# Judge status: Wrong Answer
n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
print(s)
print("".join(s))
# Judge status: Accepted
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
c = [0]*n
for i in range(n):
    b[i] = a[i]-i
for i in range(n):
    c[i] = a[i]+i
cb = Counter(b)
cc = Counter(c)
k=cb.keys()
ans = 0
for i in k:
    ans += cb[i]*cc[i*(-1)]
print(ans)
# Judge status: Wrong Answer

url = "https://atcoder.jp//contests/abc072/tasks/arc082_b"

def main():
    n = input()
    p = list(map(int, input().split()))
    count = 0
    for i, v in enumerate(p):
        if i == len(p)-1:
            print(count)
            exit()
        if i+1 == v or i+2 == p[i+1]:
            p[i] = p[i+1]
            p[i+1] = v
            count += 1




if __name__ == '__main__':
    main()
# Judge status: Accepted
from collections import deque

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

b = deque()


for i in range(n):
    if i % 2 == 0:
        b.appendleft(a[i])
    else:
        b.append(a[i])
if n % 2 == 0:
    b = list(b)[::-1]
print(*b)
# Judge status: Accepted

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

mod=10**9+7

sumA=sum(A)

ans=0
for i in range(N):
    ans+=(A[i]*(sumA-A[i]))

ans=ans//2
print(ans%mod)
# Judge status: Accepted
N, A, B = map(int,input().split())
patternNum = N // (A + B)
remains = N % (A + B)
if (remains > A):
	print(patternNum * A + A)
else:
	print(patternNum * A + remains)
# Judge status: Accepted
from collections import Counter
N, K, Q = map(int, input().split())
A = Counter([int(input()) for _ in range(Q)])
[print("Yes" if K > Q - A.get(i+1, 0) else "No") for i in range(N)]
# Judge status: Accepted
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N, M = MI()

if 2 * N <= M:
    ans = N + (M - 2 * N) // 4
    
else:
    ans = M // 2
    
print(ans)
# Judge status: Accepted
x = int(input())
ans = 1
for i in range(2,x):
    a = 2
    while i**a<=x:
        ans = max(i**a,ans)
        a+=1
print(ans)
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1,n+1):
    ans += ((i+i*(n//i))*(n//i))//2
    #print(ans)
print(ans)
# Judge status: Accepted
from copy import deepcopy
N, x = map(int, input().split())
a = list(map(int, input().split()))
c = 0
for i in range(N - 1):
    if a[i] + a[i + 1] > x:
        c += a[i] + a[i + 1] - x
        a[i + 1] -= a[i] + a[i + 1] - x
        if a[i + 1] < 0:
            a[i] -= -a[i + 1]
            a[i + 1] = 0
print(c)
# Judge status: Wrong Answer
line = input('')
n = int(line.split(' ')[0])
a = int(line.split(' ')[1])
b = int(line.split(' ')[2])

sum_case = 0
for i in range(1,n):
  if i != a and i != b:
    c = n * (n-1) / 2
    sum_case += c

all_case = 10**9+7
print((sum_case+1) % all_case)
# Judge status: Accepted
n=input()
if "7" in n:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
s = input()
while s[:len(s)//2] != s[len(s):]:
  s = s[:-2]
print(len(s))