Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
N, M=map(int, input().split())
A=list(map(int, input().split()))
#最上公倍数
def lcm(x, y):
  return (x * y) //gcd(x, y)
#最小半公倍数
def half_lcm(a,b):
  X=lcm(a,b)//2
  return X

S=[0]*(N-1)
now=A[0]
for i in range(1,N):
  now=lcm(now, A[i])
  S[i-1]=now
  
kobai=S[-1]
hkobai=kobai//2
print(int(1+(M-hkobai)//kobai))




#6*(2.5,7.5,12.5,17.5
#10*(1.5,4.5,7.5,10.5)
#15,45,75,105
#4 (2.5,)
#10(1,)

Fixed submission:
N,M=map(int, input().split())
from collections import defaultdict
A=list(map(int, input().split()))
B=[]
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
# a 偶数
twos=0
D=defaultdict(int)
for i in range(N):
    B.append(A[i]//2)
    a=A[i]
    now=0
    while a%2==0:
        a//=2
        now+=1
    D[now]+=1
    twos=max(twos, now)
if len(set(D.values()))!=1:
    print(0)
    exit()
now=1
for i in range(N):
    now=lcm(now, B[i])

# 1.5 * 3 2*5
from math import ceil
ans=M//(now*pow(2,twos))+1
#res=now+now%(2**twos)
ans=ceil(M//now/2)
#if M-res>0:
#    ans-=int((M-res)//now/(2**twos))

print(ans)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
N, M=map(int, input().split())
A=list(map(int, input().split()))
#最上公倍数
def lcm(x, y):
  return (x * y) //gcd(x, y)
#最小半公倍数
def half_lcm(a,b):
  X=lcm(a,b)//2
  return X

S=[0]*(N-1)
now=A[0]
for i in range(1,N):
  now=lcm(now, A[i])
  S[i-1]=now
  
kobai=S[-1]
hkobai=kobai//2
print(1+(M-hkobai)//kobai)




#6*(2.5,7.5,12.5,17.5
#10*(1.5,4.5,7.5,10.5)
#15,45,75,105
#4 (2.5,)
#10(1,)

Fixed submission:
N,M=map(int, input().split())
from collections import defaultdict
A=list(map(int, input().split()))
B=[]
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
# a 偶数
twos=0
D=defaultdict(int)
for i in range(N):
    B.append(A[i]//2)
    a=A[i]
    now=0
    while a%2==0:
        a//=2
        now+=1
    D[now]+=1
    twos=max(twos, now)
if len(set(D.values()))!=1:
    print(0)
    exit()
now=1
for i in range(N):
    now=lcm(now, B[i])

# 1.5 * 3 2*5
from math import ceil
ans=M//(now*pow(2,twos))+1
#res=now+now%(2**twos)
ans=ceil(M//now/2)
#if M-res>0:
#    ans-=int((M-res)//now/(2**twos))

print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())

S=[[-1]*N for _ in range(N)]
for _ in range(N):
  A=int(input())
  for i in range(A):
    x, y=map(int, input().split())
    
for s in range(2**N):
  ok=True
  for i in range(N):
    #正直者について見ていく
    if (s<<i&1)==1:
      for j in range(N):
        #それぞれ正直者の証言が矛盾ないか
        if g[i][j]!=-1 and (s>>j&1)!=g[i][j]:
          ok=False
  if ok:
    ans=max(ans, bin(s).count("1"))
    
print(ans)
      

Fixed submission:
n = int(input())

g = [[-1 for j in range(n)] for i in range(n)]

for i in range(n):
	a = int(input())
	for _ in range(a):
		x, y = map(int, input().split())
		g[i][x-1] = y

ans = 0
for s in range(2**n):
	ok = True
	for i in range(n):
		if (s>>i&1) == 1:
			for j in range(n):
				if g[i][j] != -1 and (s>>j&1) != g[i][j]:
					ok = False
	if ok:
		ans = max(ans, bin(s).count("1"))

print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
mod=10**9+7
N=int(input())
A=np.array(list(map(int, input().split())))
ans=0
for　i in range(60):
  b=np.count_nonzero(A>>i&1)
  ans+=(2**i)*b*(N-b)
  ans%=mod
  
print(ans)



Fixed submission:
import numpy as np
N=int(input())
A=np.array(list(map(int, input().split())))


mod = 10**9+7
ans = 0
#bitの60桁を見ていく
#桁ごとに分割して足していく
for i in range(60):
  #i桁目が1である要素数　N-b1はi桁目が0である要素数
  b1 = np.count_nonzero(A>>i&1)
  #bi * (N-b1) がxorを意味している
  ans += 2**i*b1*(N-b1)
  ans %= mod
print (ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
#初めて出てきたときのインデックスをめも
memo=[[-1]*10 for _ in range(10)]
ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        si=int(S[i])
        sj=int(S[j])
        if memo[si][sj]==-1:
            memo[si][sj]=0
            ans+=len(set(S[j+1:]))
print(ans)


Fixed submission:
N=int(input())
S=input()
#初めて出てきたときのインデックスをめも
lmemo=[-1]*10
rmemo=[-1]*10
for i in range(N-2):
    ls=int(S[i])
    rs=int(S[-(i+1)])
    if lmemo[ls]==-1:
        lmemo[ls]=i
    if rmemo[rs]==-1:
        rmemo[rs]=N-(i+1)
ans=0
#print(lmemo,rmemo)
for l in lmemo:
    for r in rmemo:
        if l+1<r and l>=0 and r>=0:
            ans+=len(set(S[l+1:r]))


print(ans)

Buggy python submission (verdict: Runtime Error):
S=input()
#初めて出てきたときのインデックスをめも
memo=[[-1]*10 for _ in range(10)]
ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        si=int(S[i])
        sj=int(S[j])
        if memo[si][sj]==-1:
            memo[si][sj]=0
            ans+=len(set(S[j+1:]))
print(ans)



Fixed submission:
N=int(input())
S=input()
#初めて出てきたときのインデックスをめも
lmemo=[-1]*10
rmemo=[-1]*10
for i in range(N-2):
    ls=int(S[i])
    rs=int(S[-(i+1)])
    if lmemo[ls]==-1:
        lmemo[ls]=i
    if rmemo[rs]==-1:
        rmemo[rs]=N-(i+1)
ans=0
#print(lmemo,rmemo)
for l in lmemo:
    for r in rmemo:
        if l+1<r and l>=0 and r>=0:
            ans+=len(set(S[l+1:r]))


print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
mod=10**9+7
if A[0]!=0:
    print(0)
    break
L=[1,0,0]
ans=3
for i in range(1,N):
    a=A[i]
    count=0
    add=True
    for j,l in enumerate(L):
        if a==l:
            count+=1
            if add:
                L[j]+=1
                add=False

    ans*=count
    ans%=mod
print(ans)
#print(L)


Fixed submission:
N=int(input())
A=list(map(int, input().split()))
mod=10**9+7
if A[0]!=0:
    print(0)
    exit()
L=[1,0,0]
ans=3
for i in range(1,N):
    a=A[i]
    count=0
    add=True
    for j,l in enumerate(L):
        if a==l:
            count+=1
            if add:
                L[j]+=1
                add=False

    ans*=count
    ans%=mod
print(ans)
#print(L)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
D={"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print(D[S])

Fixed submission:
DAYS=["SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"]
S=input()

for i, day in enumerate(DAYS):
  if S==day:
    print(i+1)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
S=input()
now=S[N-1]
dp=[float("INF")]*(N+1)
dp[N]=0
for i in range(N-1,-1,-1):
    if S[i]=="1":
        continue
    else:
        dp[i]=1+min(dp[i+1:i+1+M])
#print(dp)
#print(dp[0])
now=dp[0]
nowi=0
if now==float("INF"):
    print(-1)
    exit()
for i in range(1,N+1):
    if now>dp[i]:
        print(i-nowi, end=" ")
        now=dp[i]
        nowi=i


Fixed submission:
N,M=map(int, input().split())
S=input()
now=S[N-1]
dp=[float("INF")]*(N+1)
dp[N]=0
nowmin=0
right=N
for left in range(N-1,-1,-1):
    while right-left>M or S[right]=="1":
        right-=1
        nowmin=dp[right]
    if right<=left:
        print(-1)
        exit()
    if S[left]=="1":
        continue
    else:
        dp[left]=1+nowmin
#print(dp)
#print(dp[0])
now=dp[0]
nowi=0
"""
if now==float("INF"):
    print(-1)
    exit()
"""
for i in range(1,N+1):
    if now>dp[i]:
        print(i-nowi, end=" ")
        now=dp[i]
        nowi=i
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())


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

L=make_divisors(N)
ans=float("INF")
for n in L:
    for k in L:
        if n*k==N:
            ans=min(ans, n+k-2)
print(ans)

Fixed submission:
import math
N=int(input())

A=int(math.sqrt(N))
a=1
b=1
for i in range(1, A+1):
  if N%i==0:
    a=i
    b=N/i
print(int(a+b-2))

Buggy python submission (verdict: Runtime Error):
import math.sprt
N=int(input())

A=int(sqrt(N))
a=1
b=1
for i in range(1, A+1):
  if N%i==0:
    a=i
    b=N/i
print(a+b-2)

Fixed submission:
import math
N=int(input())

A=int(math.sqrt(N))
a=1
b=1
for i in range(1, A+1):
  if N%i==0:
    a=i
    b=N/i
print(int(a+b-2))
Buggy python submission (verdict: Runtime Error):
from math import atan
a,b,x=map(int, input().split())
ans=None
V=(a**2)*b
if x>=V/2:
  #S=(x/a**2*b)*a*b
  #S=0.5*a*y
  #y=2S/a
  #tan(ans)=y/a
  #atan(y/a)=ans
  S=(x/a**2*b)*a*b
  y=2S/a
  ans=atan(y/a)
else:
  #S=(x/a**2*b)*a*b
  #S=0.5*b*y
  #y=2S/b
  #ans=90-atan(y/b)
  S=(x/a**2*b)*a*b
  y=2S/b
  ans=90-atan(y/b)
  
print(ans)

Fixed submission:
from math import atan,degrees
a,b,x=map(int, input().split())
ans=None
V=(a**2)*b
if x>=V/2:
  #S=(x/a**2*b)*a*b
  #S=0.5*a*y
  #y=2S/a
  #tan(ans)=y/a
  #atan(y/a)=ans
  S=((V-x)/V)*a*b
  y=2*S/a
  ans=degrees(atan(y/a))
  #print(S, y, ans)
else:
  #S=(x/a**2*b)*a*b
  #S=0.5*b*y
  #y=2S/b
  #ans=90-atan(y/b)
  S=(x/V)*a*b
  y=2*S/b
  ans=90-degrees(atan(y/b))
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
N,K=map(int, input().split())
A=list(map(int, input().split()))
F=list(map(int, input().split()))
A=sorted(A)
F=sorted(F, reverse=True)

left=0
right=10**12+1
ans=float("INF")
while True:
    mid=(left+right)//2

    now=0
    for i in range(N):
        if F[i]*A[i]>mid:
            now+=ceil(((F[i]*A[i])-mid)/F[i])
    #print(now, mid)
    if now==K:
        ans=min(ans, mid)
        right=mid
    elif now>K:
        if left==mid:
            break
        left=mid
    else:
        if right==mid:
            break
        right=mid
        ans=min(ans, mid)

print(ans)

Fixed submission:
from math import ceil
N,K=map(int, input().split())
A=list(map(int, input().split()))
F=list(map(int, input().split()))
A=sorted(A)
F=sorted(F, reverse=True)

left=0
right=10**12+1
ans=float("INF")
while True:
    mid=(left+right)//2

    now=0
    for i in range(N):
        if F[i]*A[i]>mid:
            now+=ceil(((F[i]*A[i])-mid)/F[i])
    #print(now, mid)
    if now==K:
        ans=min(ans, mid)
        if right==mid:
            break
        right=mid
    elif now>K:
        if left==mid:
            break
        left=mid
    else:
        if right==mid:
            break
        right=mid
        ans=min(ans, mid)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int, input().split()))
#a<b+c
#b<c+a
#c<a+b
#a<=b<=c
#c<a+b
L=sorted(L)
ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[k]>=L[j]+L[i]:
                break
            ans+=1
print(ans)

Fixed submission:
import bisect

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

count=0
for i in range(N-2):
  a=L[i]
  for j in range(i+1, N-1):
    b=L[j]
    r=bisect.bisect_left(L, a+b)
    count+=r-1-j
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

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

def tri_d(a,b,c):
  if (a+b>c) and (b+c>a) and (c+a>b):
    return True
  else:
    return False


ans=0
C=list(itertools.combinations(L, 3))
for a,b,c in C:
  if tri_d(a,b,c):
    ans+=1
print(ans)

Fixed submission:
import bisect

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

count=0
for i in range(N-2):
  a=L[i]
  for j in range(i+1, N-1):
    b=L[j]
    r=bisect.bisect_left(L, a+b)
    count+=r-1-j
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

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

def tri_d(a,b,c):
  if (a+b>c) and (b+c>a) and (c+a>b):
    return True
  else:
    return False


ans=0
C=list(itertools.combinations(L, 3))
for c in C:
  if tri_d(c[0], c[1], c[2]):
        ans+=1
print(ans)

Fixed submission:
import bisect

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

count=0
for i in range(N-2):
  a=L[i]
  for j in range(i+1, N-1):
    b=L[j]
    r=bisect.bisect_left(L, a+b)
    count+=r-1-j
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int, input().split()))

ans=0
for i in range(N-2):
  for j in range(i+1,N-1):
    for k in range(j+1, N):
      count=0
      for x in [i,j,k]:
        if 2*L[x]<L[i]+L[j]+L[k]:
          count+=1
      if count==3:
        ans+=1
print(ans)

Fixed submission:
import bisect

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

count=0
for i in range(N-2):
  a=L[i]
  for j in range(i+1, N-1):
    b=L[j]
    r=bisect.bisect_left(L, a+b)
    count+=r-1-j
    
print(count)
Buggy python submission (verdict: Runtime Error):
N=input()

if N%2==0:
  print((N/2)/N)
  
else:
  print((N//2+1)/N)

Fixed submission:
N=int(input())

if N%2==0:
  print((N/2)/N)
  
else:
  print((N//2+1)/N)

Buggy python submission (verdict: Runtime Error):
N=input()

if N%2==0:
  print(N/2)
  
else:
  print(N//2+1)

Fixed submission:
N=int(input())

if N%2==0:
  print((N/2)/N)
  
else:
  print((N//2+1)/N)
Buggy python submission (verdict: Runtime Error):
N, K=map(int, input().split())
H=list(map(int, input().split()))

count=0
for i in H:
  if H>=K:
    count+=1
print(count)

Fixed submission:
N, K=map(int, input().split())
H=list(map(int, input().split()))

count=0
for i in H:
  if i>=K:
    count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

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

B=[]
count=0
for i in range(N):
  print(A.index(min(A))+1, end=' ')
  A[A.index(min(A))]=N+1

Fixed submission:
import numpy as np


N=int(input())

A=np.array([list(map(int, input().split()))])


B=np.argsort(A[0,:])
for b in B:
  print(b+1, end=' ')

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

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

B=[]
count=0
while count<N:
  B.append(A.index(min(A)))
  count+=1
  A[A.index(min(A))]=N+2
  
for b in B:
  print(b+1, end=' ')

Fixed submission:
import numpy as np


N=int(input())

A=np.array([list(map(int, input().split()))])


B=np.argsort(A[0,:])
for b in B:
  print(b+1, end=' ')
Buggy python submission (verdict: Runtime Error):
from math import factorial
#a = factorial(n) / factorial(r) / factorial(n - r)

A, B=map(int, input().split())

def cf(x1,x2):
    cf=[]
    cf.append(1)
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf
  
  
C=cf(A, B)
for i in range(len(C)-1):
  for j in range(i+1, len(C)):
    if len(cf(C[i], C[j]))!=1:
      C.remove(C[j])
n=len(C)
if n==1:
  print(1)
else:
  
  print(int(factorial(n) / factorial(2) / factorial(n - 2)))

Fixed submission:
from fractions import gcd
A, B=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

import math

def is_prime(n):
  if n == 1: return False

  for k in range(2, int(math.sqrt(n)) + 1):
    if n % k == 0:
      return False

  return True
ans=0
for x in set(make_divisors(A))&set(make_divisors(B)):
  if is_prime(x):
    ans+=1

#print(set(make_divisors(A))&set(make_divisors(B)))
print(ans+1)

Buggy python submission (verdict: Runtime Error):
from math import factorial
#a = factorial(n) / factorial(r) / factorial(n - r)

A, B=map(int, input().split())

def cf(x1,x2):
    cf=[]
    cf.append(1)
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf
  
  
C=cf(A, B)
for i in range(len(C)-1):
  for j in range(i+1, len(C)):
    if len(cf(C[i], C[j]))!=1:
      C.remove(C[j])
n=len(C)
print(int(factorial(n) / factorial(2) / factorial(n - 2)))

Fixed submission:
from fractions import gcd
A, B=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

import math

def is_prime(n):
  if n == 1: return False

  for k in range(2, int(math.sqrt(n)) + 1):
    if n % k == 0:
      return False

  return True
ans=0
for x in set(make_divisors(A))&set(make_divisors(B)):
  if is_prime(x):
    ans+=1

#print(set(make_divisors(A))&set(make_divisors(B)))
print(ans+1)
Buggy python submission (verdict: Time Limit Exceeded):

import numpy as np
N,M=map(int, input().split())
key=[]
for i in range(M):
    a,b=map(int, input().split())
    C=list(map(int, input().split()))
    c=0
    for d in C:
        c+=2**(d-1)
    key.append((a,b,c))

dp=np.ones((2**N))*np.inf
dp[0]=0
for bi in range(0,2**N):
    for i in range(M):
        t=key[i]
        a,b,c=t
        

        dp[bi|c]=min(dp[bi]+a,dp[bi|c])
if dp[-1]!=np.inf:
    print(int(dp[-1]))
else:
    print(-1)
    

Fixed submission:
n,m = map(int,input().split())
dp = [0]+[10**8+10]*(2**n-1)
for i in range(m):
  a,b = map(int,input().split())
  s = sum([2**(x-1) for x in list(map(int,input().split()))])
  for j in range(2**n):
    dp[j|s] = min(dp[j|s],dp[j]+a)
if dp[-1] <= 10**8:
  print(dp[-1])
else:
  print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
dp = [0]+[10**8+10]*(2**n-1)
#len(dp)==16　（2**n）　扉の開閉状態
#dp: その開閉状態を実現するための鍵の値段の最小値

#それぞれの鍵について
for i in range(m):
  a,b = map(int,input().split())
  #x: 開く扉の番号
  #2**(1-1)==000000000001   2**(12-1)==100000000000
  #sは　100010111000みたいなやつ（その鍵で開く扉が１）
  s = sum([2**(x-1) for x in list(map(int,input().split()))])
  for j in range(2**n):
    #| : or
    #（ある状態＋その鍵を使って開けられるやつ）の状態　　もともとの数値か、鍵を使うか
    dp[j|s] = min(dp[j|s],dp[j]+a)
if dp[-1] <= 10**8:
  print(dp[-1])
else:
  print(-1)



Fixed submission:
n,m = map(int,input().split())
dp = [0]+[10**8+10]*(2**n-1)
for i in range(m):
  a,b = map(int,input().split())
  s = sum([2**(x-1) for x in list(map(int,input().split()))])
  for j in range(2**n):
    dp[j|s] = min(dp[j|s],dp[j]+a)
if dp[-1] <= 10**8:
  print(dp[-1])
else:
  print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
dp = [0]+[10**8+10]*(2**n-1)
for i in range(m):
  a,b = map(int,input().split())
  s = sum([2**(x-1) for x in list(map(int,input().split()))])
  for j in range(2**n):
    dp[j|s] = min(dp[j|s],dp[j]+a)
if dp[-1] <= 10**8:
  print(dp[-1])
else:
  print(-1)



Fixed submission:
n,m = map(int,input().split())
dp = [0]+[10**8+10]*(2**n-1)
for i in range(m):
  a,b = map(int,input().split())
  s = sum([2**(x-1) for x in list(map(int,input().split()))])
  for j in range(2**n):
    dp[j|s] = min(dp[j|s],dp[j]+a)
if dp[-1] <= 10**8:
  print(dp[-1])
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
N, M=map(int, input().split())

A=[]
B=[]
C=[]
for i in range(N):
  a, b=map(int, input().split())
  c=list(map(int, input().split()))
  A.append(a)
  B.append(b)
  C.append(c)
  
print(A, B, C)

Fixed submission:
n,m = map(int,input().split())
dp = [0]+[10**8+10]*(2**n-1)
for i in range(m):
  a,b = map(int,input().split())
  s = sum([2**(x-1) for x in list(map(int,input().split()))])
  for j in range(2**n):
    dp[j|s] = min(dp[j|s],dp[j]+a)
if dp[-1] <= 10**8:
  print(dp[-1])
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
N=int(input())

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

Fixed submission:
N=int(input())

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

Buggy python submission (verdict: Runtime Error):
N=int(input())

H=list(input().split())
A=[0 for i in range(N)]
if H[0]>=H[1]:
  A[0]+=1
for i in range(1,N-1):
  if H[i]>=H[i+1]:
    A[i]+=A[i-1]+1
print(max(A))



Fixed submission:
N=int(input())

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

Buggy python submission (verdict: Runtime Error):
N=int(input())

H=list(input().split())

count_list=[]
for i in range(N-1):
  count=0
  a=i
  while H[a]>=H[a+1]:
    count+=1
    a+=1
    if a==N-1:
      break
  count_list.append(count)
print(max(count_list))

Fixed submission:
N=int(input())

H=list(map(int,input().split()))
A=[0 for i in range(N)]
if N==1:
  print(0)
else:
  if H[0]>=H[1]:
  	A[0]+=1
  if N>=3:
    for i in range(1,N-1):
      if H[i]>=H[i+1]:
        A[i]+=A[i-1]+1
  print(max(A))
Buggy python submission (verdict: Runtime Error):
N, K =map(int, input().split())

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

count=0
for i in range(N*K):
  for j in range(i, N*K):
    if B[i]>B[j]:
      count+=1

print(count)

Fixed submission:
N, K =map(int, input().split())

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

mod=10**9 +7
count=0
for i in range(N):
  for j in range(i+1, N):
    if A[i]>A[j]:
      count+=K
  for k in range(N):
    if A[i]>A[k]:
      count+=(K-1)*K//2
  

print(int(count%mod))
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

for i in list(t):
  if not i in list(s):
    print(-1)
    break
    
T = list(t)
count=0
while len(T)>0:
  for i,n in enumerate(list(s*len(T))):
    if T[0]==n:
      del T[0]
    if len(T)==0:
      print(i+1)
      break
      


Fixed submission:
import bisect
from collections import Counter
from collections import defaultdict
s=input()
t=input()
#s="contest"
#t="antakuso"
sd=Counter(s)
td=Counter(t)
N=len(t)
Ns=len(s)
for ts in td:
    if ts not in sd:
        print(-1)
        exit()
D=defaultdict(list)
for i in range(Ns):
    D[s[i]].append(i)
ans=0
for i in range(N):
    if i==0:
        pre=min(D[t[i]])
    else:
        L=D[t[i]]
        idx=bisect.bisect(L,pre)
        if idx==len(L):
            ans+=Ns
            pre=min(L)
        else:
            pre=L[idx]
    if i==N-1:
        ans+=pre+1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A = []
for i in range(N):
  a = list(input())
  A.append(sorted(a))

count=0
for i in range(N):
  for j in range(i+1, N):
    if A[i]==A[j]:
      count+=1
    
print(count)

Fixed submission:
N=int(input())
D={}
for i in range(N):
  s="".join(sorted(input()))
  if s in D:
    D[s]+=1
  else:
    D[s]=1
ans=0
for x in D.values():
  if x>=2:
    ans+=x*(x-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A = []
for i in range(N):
  a = list(input())
  A.append(sorted(a))

count=0
for i in range(N):
  for j in range(i+1, N):
    if A[i]==A[j]:
      count+=1
    
print(count)

Fixed submission:
N=int(input())
D={}
for i in range(N):
  s="".join(sorted(input()))
  if s in D:
    D[s]+=1
  else:
    D[s]=1
ans=0
for x in D.values():
  if x>=2:
    ans+=x*(x-1)//2
print(ans)