Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[16]:


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


# In[41]:


cnt = 0
low = 0
high = max(A)
ans = max(A)
old = int(high)
mycount = 0
while low < high:
    mid = (high+low)/2
    cnt = sum([(x-0.001)//mid for x in A])
    if cnt <= K:
        high = mid
        ans = min(ans, int(-(-mid//1)))
    else:
        low = mid
    if int(mid) == old:
        mycount += 1
    if mycount == 100:
        break
    old = int(mid)
print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[16]:


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


# In[49]:


low = 0
high = max(A)
def ok(x):
    cnt = 0
    for a in A:
        cnt += (a//x)
        if a%x == 0:
            cnt -= 1
    return cnt <= K
 
while high-low > 1:
    mid = (high+low)//2
    if ok(mid):
        high = mid
    else:
        low = mid
print(high)


# In[ ]:

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# coding: utf-8

# In[16]:


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


# In[23]:


max(A)
cnt


# In[41]:


cnt = 0
low = 0
high = max(A)
ans = max(A)
old = int(high)
mycount = 0
while low < high:
    mid = (high+low)/2
    cnt = sum([(x-0.001)//mid for x in A])
    if cnt <= K:
        high = mid
        ans = min(ans, int(-(-mid//1)))
    else:
        low = mid
    if int(mid) == old:
        mycount += 1
    if mycount == 100:
        break
    old = int(mid)
print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[16]:


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


# In[49]:


low = 0
high = max(A)
def ok(x):
    cnt = 0
    for a in A:
        cnt += (a//x)
        if a%x == 0:
            cnt -= 1
    return cnt <= K
 
while high-low > 1:
    mid = (high+low)//2
    if ok(mid):
        high = mid
    else:
        low = mid
print(high)


# In[ ]:
Buggy python submission (verdict: Runtime Error):
t

Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[12]:


from collections import deque


# In[1]:


K = int(input())


# In[15]:


q = deque(list(range(1,10)))
for i in range(K-1):
    x = q.popleft()
    if x%10 != 0:
        y = x*10 + x%10 - 1
        q.append(y)
    y = x*10 + x%10
    q.append(y)
    
    if x%10 != 9:
        y = x*10 + x%10 + 1
        q.append(y)
    
ans = q.popleft()
print(ans)


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[18]:


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


# In[19]:


for k in range(1,N):
    ans = 0
    for i in range(1,N+1):
        for j in range(i+1,N+1):
            dist = min(j-i,abs(X-i)+abs(Y-j)+1,abs(Y-i)+abs(X-j)+1)
            if dist == k:
                ans += 1
    print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[21]:


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


# In[24]:


ans = [0]*N
for i in range(1,N):
    for j in range(i+1,N+1):
        dist = min(j-i,abs(X-i)+abs(Y-j)+1,abs(Y-i)+abs(X-j)+1)
        ans[dist] += 1
for i in range(1,N):
    print(ans[i])


# In[ ]:

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[18]:


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


# In[19]:


for k in range(1,N):
    ans = 0
    for i in range(1,N+1):
        for j in range(i+1,N+1):
            dist = min(j-i,abs(X-i)+abs(Y-j)+1,abs(Y-i)+abs(X-j)+1)
            if dist == k:
                ans += 1
    print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[21]:


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


# In[24]:


ans = [0]*N
for i in range(1,N):
    for j in range(i+1,N+1):
        dist = min(j-i,abs(X-i)+abs(Y-j)+1,abs(Y-i)+abs(X-j)+1)
        ans[dist] += 1
for i in range(1,N):
    print(ans[i])


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[22]:


import collections
import math


# In[31]:


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


# In[32]:


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


# In[33]:


for i in range(N):
    mylist = list(collections.Counter(A[:i] + A[i+1:]).items())
    ans = 0
    for x,cnt in mylist:
        if cnt > 1:
            ans += combinations_count(cnt, 2)
    print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[35]:


import collections


# In[31]:


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


# In[36]:


count = collections.Counter(A)
numsum = 0
for i in count.values():
    numsum += i*(i-1)//2

for i in A:
    print(numsum - (count[i]-1))


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[14]:


from collections import deque


# In[15]:


S = deque(input())
Q = int(input())
for _ in range(Q):
    q = list(input().split())
    if len(q) == 1:
        S = deque(reversed(S))
    else:
        if q[1] == "1":
            S.appendleft(q[2])
        else:
            S.append(q[2])
print("".join(S))


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[14]:


from collections import deque


# In[21]:


S = deque(input())
Q = int(input())
rev_cnt = 0
for _ in range(Q):
    q = input().split()
    if len(q) == 1:
        rev_cnt += 1
    else:
        if (rev_cnt+int(q[1]))%2 == 0:
            S.append(q[2])
        else:
            S.appendleft(q[2])
if rev_cnt%2 == 0:
    print("".join(S))
else:
    print("".join(list(reversed(S))))    


# In[ ]:
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# coding: utf-8

# In[23]:


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


# In[24]:


def nCk(n, k, mod):
    a = 1
    for i in range(n, n-k, -1):
        a *= i
        a %= mod
    b = 1
    for i in range(1, k+1):
        b *= i
        b %= mod
    a *= pow(b, mod-2, mod)
    return a


# In[25]:


ans = pow(2, n, mod)-1
ans -= nCk(n, a, mod) + nCk(n, b, mod)
print(ans%mod)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[1]:


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


# In[2]:


def nCk(n, k, mod):
    a = 1
    for i in range(n, n-k, -1):
        a *= i
        a %= mod
    b = 1
    for i in range(1, k+1):
        b *= i
        b %= mod
    a *= pow(b, mod-2, mod)
    return a


# In[3]:


mod = 10**9+7
ans = pow(2, n, mod)-1
ans -= nCk(n, a, mod) + nCk(n, b, mod)
print(ans%mod)


# In[ ]:

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# coding: utf-8

# In[14]:


import math


# In[21]:


def nCk(n, k, mod):
    a = 1
    for i in range(n, n-k, -1):
        a *= i
        a %= mod
    b = 1
    for i in range(1, k+1):
        b *= i
        b %= mod
    a *= pow(b, mod-2, mod)
    return a


# In[22]:


ans = pow(2, n, mod)-1
ans -= nCk(n, a, mod) + nCk(n, b, mod)
print(ans%mod)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[1]:


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


# In[2]:


def nCk(n, k, mod):
    a = 1
    for i in range(n, n-k, -1):
        a *= i
        a %= mod
    b = 1
    for i in range(1, k+1):
        b *= i
        b %= mod
    a *= pow(b, mod-2, mod)
    return a


# In[3]:


mod = 10**9+7
ans = pow(2, n, mod)-1
ans -= nCk(n, a, mod) + nCk(n, b, mod)
print(ans%mod)


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[31]:


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


# In[33]:


ans = 0
for i in range(K-1,N):
#     print([(x+1)/2 for x in p[i-(K-1):i+1]])
    ans = max(ans, sum([(x+1)/2 for x in p[i-(K-1):i+1]]))
print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[43]:


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


# In[44]:


le = [(x+1)/2 for x in p]
e = sum(le[:K])
ans = e
for i in range(N-K):
    e -= le[i]
    e += le[i+K]
    ans = max(ans ,e)
print(ans)


# In[ ]:

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[31]:


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


# In[33]:


ans = 0
for i in range(K-1,N):
#     print([(x+1)/2 for x in p[i-(K-1):i+1]])
    ans = max(ans, sum([(x+1)/2 for x in p[i-(K-1):i+1]]))
print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[43]:


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


# In[44]:


le = [(x+1)/2 for x in p]
e = sum(le[:K])
ans = e
for i in range(N-K):
    e -= le[i]
    e += le[i+K]
    ans = max(ans ,e)
print(ans)


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[15]:


N = int(input())
P = list(map(int, input().split()))
print(sum([1 if x == min(P[:i+1]) else 0 for i,x in enumerate(P)]))


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[22]:


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


# In[23]:


ans = 0
tmp = P[0]
for i in range(N):
    if P[i] <= tmp:
        ans += 1
        tmp = P[i]
print(ans)


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[1]:


N = int(input())


# In[15]:


def func(i,j,N):
    ans = []
    for x in range(1,N+1):
        x_ = str(x)
        if x_[0] == str(i) and x_[-1] == str(j):
            ans += [x]
    return ans


# In[23]:


ans = 0
for i in range(10):
    for j in range(10):
        ans += len(func(i,j,N))*len(func(j,i,N))
print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[1]:


N = int(input())


# In[15]:


def func(i,j,N):
    ans = []
    for x in range(1,N+1):
        x_ = str(x)
        if x_[0] == str(i) and x_[-1] == str(j):
            ans += [x]
    return ans


# In[23]:


ans = 0
for i in range(10):
    for j in range(10):
        ans += len(func(i,j,N))*len(func(j,i,N))
print(ans)


# In[ ]:
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# coding: utf-8

# In[11]:


from collections import deque


# In[23]:


H,W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())


# In[24]:


def bfs(sx,sy):
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    d = [[-1]*W for _ in range(H)]
    q = deque([])
    q.append([sx,sy])
    d[sx][sy] = 0
    ans = 0
    while q:
        x,y = q.popleft()
        for i in range(4):
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx < H and 0 <= ny < W and S[nx][ny] != "#" and d[nx][ny] == -1:
                q.append([nx,ny])
                d[nx][ny] = d[x][y] + 1
                ans = max(ans,d[nx][ny])
    return ans


# In[25]:


for sh in range(H):
    if "." in S[sh]:
        for sw in range(W):
            if S[sh][sw] == ".":
                ans = max(ans,bfs(sh,sw))
print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[1]:


from collections import deque


# In[2]:


H,W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())


# In[3]:


def bfs(sx,sy):
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    d = [[-1]*W for _ in range(H)]
    q = deque([])
    q.append([sx,sy])
    d[sx][sy] = 0
    ans = 0
    while q:
        x,y = q.popleft()
        for i in range(4):
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx < H and 0 <= ny < W and S[nx][ny] != "#" and d[nx][ny] == -1:
                q.append([nx,ny])
                d[nx][ny] = d[x][y] + 1
                ans = max(ans,d[nx][ny])
    return ans


# In[5]:


ans = 0
for sh in range(H):
    if "." in S[sh]:
        for sw in range(W):
            if S[sh][sw] == ".":
                ans = max(ans,bfs(sh,sw))
print(ans)


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[24]:


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


# In[25]:


mylist = [x for x in a]
flag = True
num = 1
ans = 0
while flag:
    if mylist[num-1] != num:
        mylist.pop(num-1)
        ans += 1
    else:
        num += 1
    if len(mylist) == 0:
        flag = False
        print(-1)
    elif mylist == list(range(1,num)):
        flag = False
        print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[42]:


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


# In[43]:


count = 0
num = 1
for i in range(N):
    if a[i] == num:
        count += 1
        num += 1
if count == 0:
    print(-1)
else:
    print(N-count)


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[8]:


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


# In[9]:


ans = 0
for i in range(1000):
    tmp = str(i).zfill(3)
    cnt = 0
    f = False
    for s in S:
        if s == tmp[cnt]:
            cnt += 1
            if cnt == 3:
                f = True
                break
    if f:
        ans += 1
print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[8]:


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


# In[19]:


ans = 0
for i in range(10):
    str_i = str(i)
    i_index = S.find(str_i)
    if i_index == -1:
        continue
    for j in range(10):
        str_j = str(j)
        j_index = S.find(str_j, i_index+1)
        if j_index == -1:
            continue
        for k in range(10):
            str_k = str(k)
            k_index = S.find(str_k, j_index+1) 
            if k_index != -1:
                ans += 1
print(ans)


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[84]:


S = input() + " "


# In[85]:


ans = [0]*(len(S)+1)
for i in range(len(S)):
    count_left = 0
    count_right = 0
    for j in range(i):
        if S[i-j-1] == "<":
            count_left += 1
        else:
            j -= 1
            break
    for k in range(i,len(S)):
        if S[k] == ">":
            count_right += 1
        else:
            k -= 1
            break
    ans[i] = max(count_left, count_right)
#     print(count_left, count_right)
#     print(S[i-j-1:i], S[i:k+1])
# print(ans)
print(sum(ans))


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[86]:


# ans = [0]*(len(S)+1)
# for i in range(len(S)):
#     count_left = 0
#     count_right = 0
#     for j in range(i):
#         if S[i-j-1] == "<":
#             count_left += 1
#         else:
#             j -= 1
#             break
#     for k in range(i,len(S)):
#         if S[k] == ">":
#             count_right += 1
#         else:
#             k -= 1
#             break
#     ans[i] = max(count_left, count_right)
# #     print(count_left, count_right)
# #     print(S[i-j-1:i], S[i:k+1])
# # print(ans)
# print(sum(ans))


# In[87]:


from collections import deque
S = input()
left = deque([0])
right = deque([0])
cnt = 0
for s in S:
    if s == '<':
        cnt += 1
    else:
        cnt = 0
    left.append(cnt)
cnt = 0
for s in S[::-1]:
    if s == '>':
        cnt += 1
    else:
        cnt = 0
    right.appendleft(cnt)
ans = 0
for l, r in zip(left, right):
    ans += max(l, r)
print(ans)


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[5]:


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


# In[7]:


ans = 0
for x in range(N-2):
    a = L[x]
    for y in range(x+1,N-1):
        b = L[y]
        for z in range(y+1,N):
            c = L[z]
            if a<b+c and b<c+a and c<a+b:
                ans += 1
print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[9]:


import bisect


# In[10]:


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


# In[11]:


s_L = sorted(L)
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        ans += bisect.bisect_left(s_L,s_L[i]+s_L[j])-j-1
print(ans)


# In[ ]:

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[28]:


N = int(input())
L = sorted(list(map(int, input().split())))


# In[29]:


count = 0
for i in range(N):
    for j in range(i+1, N):
        #print(i, j)
        #print(L[i], L[j], L[i]+L[j])
        for k in range(j+1, N):
            #print(L[i], L[j], L[k], L[i]+L[j] > L[k])
            if L[i]+L[j] > L[k]:
                count += 1
            else:
                break
print(count)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[9]:


import bisect


# In[10]:


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


# In[11]:


s_L = sorted(L)
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        ans += bisect.bisect_left(s_L,s_L[i]+s_L[j])-j-1
print(ans)


# In[ ]:

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[23]:


N = int(input())
L = sorted(list(map(int, input().split())))


# In[27]:


count = 0
for i in range(N):
    for j in range(i+1, N):
        #print(i, j)
        #print(L[i], L[j], L[i]+L[j])
        for k in range(j+1, N):
            #print(L[i], L[j], L[k], L[i]+L[j] > L[k])
            if L[i]+L[j] > L[k]:
                count += 1
print(count)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[9]:


import bisect


# In[10]:


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


# In[11]:


s_L = sorted(L)
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        ans += bisect.bisect_left(s_L,s_L[i]+s_L[j])-j-1
print(ans)


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[13]:


N,K,Q = map(int, input().split())
point = [K]*N
for _ in range(Q):
    A = int(input())
    point = [point[i]-1 if i != A-1 else point[i] for i in range(len(point))]
ans = [print("Yes") if point[i]>0 else print("No") for i in range(len(point))]


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[14]:


N,K,Q = map(int, input().split())
point = [0]*N
for _ in range(Q):
    A = int(input())
    point[A-1] += 1 
ans = [print("Yes") if point[i] > Q-K else print("No") for i in range(len(point))]


# In[ ]:

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[6]:


N,K,Q = map(int, input().split())
point = [K]*N
for _ in range(Q):
    A = int(input())
    point[A-1] += 1
    point = [p-1 for p in point]
for i in point:
    if i > 0:
        print("Yes")
    else:
        print("No")


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[14]:


N,K,Q = map(int, input().split())
point = [0]*N
for _ in range(Q):
    A = int(input())
    point[A-1] += 1 
ans = [print("Yes") if point[i] > Q-K else print("No") for i in range(len(point))]


# In[ ]:

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[20]:


N, K, Q = map(int, input().split())

A = []
for i in range(Q):
    Ai = int(input())
    A.append(Ai)


# In[21]:


for i in range(1, N+1):
    cnt = A.count(i)
    point = K - (Q - cnt)
    #print(cnt, point)
    if point > 0:
        print("Yes")
    else:
        print("No")


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[14]:


N,K,Q = map(int, input().split())
point = [0]*N
for _ in range(Q):
    A = int(input())
    point[A-1] += 1 
ans = [print("Yes") if point[i] > Q-K else print("No") for i in range(len(point))]


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[12]:


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


# In[13]:


for m in range(M):
    idx = A.index(max(A))
    A[idx] /= 2
ans = sum([x//1 for x in A])
print(int(ans))


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[18]:


import heapq


# In[23]:


N,M = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))


# In[24]:


heapq.heapify(A)
for m in range(M):
    tmp = heapq.heappop(A)
    heapq.heappush(A, -(-tmp//2))
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[19]:


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


# In[20]:


#print(A)
for i in range(M):
    A[A.index(max(A))] = int(max(A) / 2)
    #print(A)
print(sum(A))


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[18]:


import heapq


# In[23]:


N,M = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))


# In[24]:


heapq.heapify(A)
for m in range(M):
    tmp = heapq.heappop(A)
    heapq.heappush(A, -(-tmp//2))
print(-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[17]:


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


# In[18]:


ans = 0
for i,x in enumerate(H):
    tmp = 0
    height = x
    for j in range(i+1,N):
        if height >= H[j]:
            tmp += 1
            height = H[j]
        else:
            break
    ans = max(ans, tmp)
print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[25]:


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


# In[26]:


ans = 0
x = 0
while x < N-1:
    tmp = 0
    height = H[x]
    for y in range(x+1,N):
        if height >= H[y]:
            tmp += 1
            height = H[y]
        else:
            break
    ans = max(ans, tmp)
    x = y
print(ans)


# In[ ]:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# coding: utf-8

# In[19]:


P = int(input())


# In[20]:


# i_list = list(range(1, P+1))
# p_list = i_list[1:]
# p_list.append(i_list[0])

# # print(i_list, p_list)

# ans = 0
# for i in range(P):
#     ans += i_list[i]%p_list[i]
# print(ans)

ans = sum(range(1,P))
print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[21]:


P = int(input())


# In[22]:


# i_list = list(range(1, P+1))
# p_list = i_list[1:]
# p_list.append(i_list[0])

# # print(i_list, p_list)

# ans = 0
# for i in range(P):
#     ans += i_list[i]%p_list[i]
# print(ans)

# ans = sum(range(1,P))
ans = P*(P-1)//2
print(ans)


# In[ ]:

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# coding: utf-8

# In[8]:


P = int(input())


# In[10]:


i_list = list(range(1, P+1))
p_list = i_list[1:]
p_list.append(i_list[0])

# print(i_list, p_list)

ans = 0
for i in range(P):
    ans += i_list[i]%p_list[i]
print(ans)


# In[ ]:






Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[21]:


P = int(input())


# In[22]:


# i_list = list(range(1, P+1))
# p_list = i_list[1:]
# p_list.append(i_list[0])

# # print(i_list, p_list)

# ans = 0
# for i in range(P):
#     ans += i_list[i]%p_list[i]
# print(ans)

# ans = sum(range(1,P))
ans = P*(P-1)//2
print(ans)


# In[ ]: