Harryxun/stf_run huggingface dataset:
# coding: utf-8

import sys
from collections import deque

if __name__ == '__main__':
    while True:
        m,n = map(int,input().split())
        sw = []
        bw = []
        if m == 0 and n == 0:
            break
        for i in range(2*n-1):
            if i % 2 == 0:
                sw.append(list(map(int,input().split())))
            else:
                bw.append(list(map(int,input().split())))
        flag = [[0 for i in range(m)] for j in range(n)]
        deq = deque()
        deq.append([0,0,1])
        res = 0
        while len(deq) != 0:
            bf = deq[0]
            deq.popleft()
            if bf[0] == n-1 and bf[1] == m-1:
                res = bf[2]
                break
            flag[bf[0]][bf[1]] = 1
            if 1 <= bf[0] and bw[bf[0]-1][bf[1]] == 0 and flag[bf[0]-1][bf[1]] == 0:
                deq.append([bf[0]-1,bf[1],bf[2]+1])
            if bf[1] < m-1 and sw[bf[0]][bf[1]] == 0 and flag[bf[0]][bf[1]+1] == 0:
                deq.append([bf[0],bf[1]+1,bf[2]+1])
            if 1 <= bf[1] and sw[bf[0]][bf[1]-1] == 0 and flag[bf[0]][bf[1]-1] == 0:
                deq.append([bf[0],bf[1]-1,bf[2]+1])
            if bf[0] < n-1 and bw[bf[0]][bf[1]] == 0 and flag[bf[0]+1][bf[1]] == 0:
                deq.append([bf[0]+1,bf[1],bf[2]+1])
        print(res)

### FIXED CODE ###

while True:
    m,n = map(int,input().split())
    sw = []
    bw = []
    if m == 0 and n == 0:
        break
    for i in range(2*n-1):
        if i % 2 == 0:
            sw.append(list(map(int,input().split())))
        else:
            bw.append(list(map(int,input().split())))
    flag = [[0 for i in range(m)] for j in range(n)]
    l = [(0,0,1)]
    res = 0
    while l:
        bf = l.pop(0)
        if bf[0] == n-1 and bf[1] == m-1:
            res = bf[2]
            break
        flag[bf[0]][bf[1]] = 1
        if 1 <= bf[0] and bw[bf[0]-1][bf[1]] == 0 and flag[bf[0]-1][bf[1]] == 0:
            flag[bf[0]-1][bf[1]] = 1
            l.append((bf[0]-1,bf[1],bf[2]+1))
        if bf[1] < m-1 and sw[bf[0]][bf[1]] == 0 and flag[bf[0]][bf[1]+1] == 0:
            flag[bf[0]][bf[1]+1] = 1
            l.append((bf[0],bf[1]+1,bf[2]+1))
        if 1 <= bf[1] and sw[bf[0]][bf[1]-1] == 0 and flag[bf[0]][bf[1]-1] == 0:
            flag[bf[0]][bf[1]-1] = 1
            l.append((bf[0],bf[1]-1,bf[2]+1))
        if bf[0] < n-1 and bw[bf[0]][bf[1]] == 0 and flag[bf[0]+1][bf[1]] == 0:
            flag[bf[0]+1][bf[1]] = 1
            l.append((bf[0]+1,bf[1],bf[2]+1))
    print(res)
import sys

import numpy as np

readInt = lambda: int(sys.stdin.readline())
readIntN = lambda: [int(v) for v in sys.stdin.readline().split(" ")]

total = 0
n = readInt()
aa = []
for i in range(n):
    v = readInt()
    aa.append(v)
    total += v

memo = {}
def dfs(a, b, c, i):
    if i == len(aa):
        ret = 1 if c < a + b else 0
        memo[(a, b, c)] = ret
        return ret
    if total < (2 * c):
        memo[(a, b, c)] = 0
        return 0
    if (a, b, c) in memo:
        return memo[(a, b, c)]

    ret = 0
    v0 = sorted([a + aa[i], b, c])
    ret = (ret + dfs(v0[0], v0[1], v0[2], i + 1)) % 998244353

    v1 = sorted([a, b + aa[i], c])
    ret = (ret + dfs(v1[0], v1[1], v1[2], i + 1)) % 998244353

    v2 = sorted([a, b, c + aa[i]])
    ret = (ret + dfs(v2[0], v2[1], v2[2], i + 1)) % 998244353

    memo[(a, b, c)] = ret
    return ret

print(dfs(0, 0, 0, 0))


### FIXED CODE ###

import sys
import numpy as np

readInt = lambda: int(sys.stdin.readline())
readIntN = lambda: [int(v) for v in sys.stdin.readline().split(' ')]

a, b, c = readIntN()
minv = min(a, b)
maxv = max(a, b)
ret = 'Yes' if minv < c < maxv else 'No'
print(ret)
N,M,C=map(int,input().split()) 
B=list(map(int,input().split()))
A =[list(map(int,input().split()))for i in range(N)]
ans=0
for i in range(N):
    for j in range(M):
        X+=(A[i][j]*B[i])+C
    if  0 < X:
        ans = ans+1
    else:
        ans = ans
print(ans)

### FIXED CODE ###

n,m,c=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int,input().split()))for i in range(n)]
cnt=0
for i in range(n):
    total=0
    for j in range(m):
        total+=B[j]*A[i][j]
    total+=c
    if 0<total:
        cnt+=1
print(cnt)
x = int(input())
li = [3,5,7]
if x in li:
    print('YES')
else:
    print('NO'

### FIXED CODE ###

x = int(input())
li = [3,5,7]
if x in li:
    print('YES')
else:
    print('NO')
#AtCoder Grand Contest 021 a
def wa(x):
    x=str(x)
    s=0
    for i in x:
        s+=int(i)
    return s

n=int(input())
keta=len(str(n))
start=10**(keta-2)
start=max(0,start)
ans=0
print(start)
for i in range(start,n+1):
    ans=max(ans,wa(i))
print(ans)

### FIXED CODE ###

#AtCoder Grand Contest 021 a
n=input()
keta=len(n)
c=n[0]
ans=int(c)+9*(keta-1)
if n[1:]!=("9"*(keta-1)):
    ans-=1
print(ans)
A,B = map(int,input().split())
if A > B:
  print("GREATER")
elif A < B:
  print("LESS")
else:
  print("EQUAL")

### FIXED CODE ###

A = int(input())
B = int(input())
if A > B:
  print("GREATER")
elif A < B:
  print("LESS")
else:
  print("EQUAL")
import sys
import math
input=sys.stdin.readline
INF=1000000000
# A Dynamic Programming based Python Program for 0-1 Knapsack problem 
# Returns the maximum value that can be put in a knapsack of capacity W 
def knapSack(W,l, n):
    
    
    
    min_cost = [[0 for i in range(W+1)] for j in range(n+1)] 
    # fill 0th row with infinity 
    for i in range(W+1): 
        min_cost[0][i] = INF 
  
    # fill 0th column with 0 
    for i in range(1, n+1): 
        min_cost[i][0] = 0
    # now check for each weight one by one and fill the 
    # matrix according to the condition 
    for i in range(1, n+1): 
        for j in range(1, W+1): 
            # wt[i-1]>j means capacity of bag is 
            # less than weight of item 
            if (l[i-1][0] > j): 
                min_cost[i][j] = min(min_cost[i-1][j] ,l[i-1][1])
            # here we check we get minimum cost either 
            # by including it or excluding it 
            else: 
                min_cost[i][j] = min(min_cost[i-1][j], 
                    min_cost[i][j-l[i-1][0]] + l[i-1][1]) 
    
  
    # exactly weight W can not be made by given weights 
    if(min_cost[n][W] == INF): 
        return -1
    else: 
        return min_cost[n][W]

h,n=map(int,input().split())
l=list()
for i in range(n):
    a,b=map(int,input().split())
    l.append([a,b])
print( knapSack(h , l , n) ) 


### FIXED CODE ###

import sys
import math
input=sys.stdin.readline


h,a=map(int,input().split())
ans=h//a
h=h%a
if(h>0):
    print(ans+1)
else:
    print(ans)
s = list(map(len,input().split("T")))
x = s[::2]
y = s[1::2]
gx,gy = map(int,input().split())
if sum(x) < abs(gx) or sum(y) < abs(gy):
  print("No")
  exit(0)
dpx = [0]*(len(x)+1)
dpy = [0]*(len(y)+1)
dpx[1] = set(x[0])
dpy[0] = set([0])
for i in range(2,len(x)+1):
  s1 = set([v + x[i-1] for v in dpx[i-1]])
  s2 = set([v - x[i-1] for v in dpx[i-1]])
  dpx[i] = s1|s2
for i in range(1,len(y)+1):
  s1 = set([v + y[i-1] for v in dpy[i-1]])
  s2 = set([v - y[i-1] for v in dpy[i-1]])
  dpy[i] = s1|s2
if gx in dpx[-1] and gy in dpy[-1]:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

s = list(map(len,input().split("T")))
x = s[::2]
y = s[1::2]
gx,gy = map(int,input().split())
if sum(x) < abs(gx) or sum(y) < abs(gy):
  print("No")
  exit(0)
dpx = [0]*(len(x)+1)
dpy = [0]*(len(y)+1)
dpx[0] = set([0])
dpy[0] = set([0])
for i in range(1,len(x)+1):
  s1 = set([v + x[i-1] for v in dpx[i-1]])
  s2 = set([v - x[i-1] for v in dpx[i-1]])
  if i == 1:
    dpx[i] = s1
  else:
    dpx[i] = s1|s2
for i in range(1,len(y)+1):
  s1 = set([v + y[i-1] for v in dpy[i-1]])
  s2 = set([v - y[i-1] for v in dpy[i-1]])
  dpy[i] = s1|s2
if gx in dpx[-1] and gy in dpy[-1]:
  print("Yes")
else:
  print("No")
import sys

def judgeUpper(ansList, var):
    for a in ansList:
        if int(a) > var:
#             print(a + ':' + str(var) + str(True))
            return True
    return False
def judgeEqual(ansList, var, N):
    count = ansList.count(str(var))
#     print(str(count) + ':' + str(N-1) + str(count < N - 1))
    return count < N - 1 or (count == N and var * 2 > N and var+1 != N)
def judgeLower(ansList, var):
    for a in ansList:
        if int(a) < var - 1:
#             print(a + ':' + str(var-1) + str(True))
            return True
    return False
        
N = input()
ansList = input().split(' ')
for i in range(int(N)):
    var = i + 1
    if judgeUpper(ansList, var):
        continue
    if judgeEqual(ansList, var, int(N)):
        continue
    if judgeLower(ansList, var):
        continue
    print('Yes')
    sys.exit()
print('No')

### FIXED CODE ###


def convertList(strList, c):
    time = 0
    tmpList = list(strList)
    while tmpList.count(c) != len(tmpList):
        newList = []
        for i in range(len(tmpList[:])-1):
            newList.append(c if (tmpList[i] == c or tmpList[i+1] == c) else tmpList[i])
        tmpList = list(newList)
        time += 1
    return time

S = input()
strList = list(S)
strSet = set(strList)
minTime = 1000000 
for c in strSet:
    time = convertList(strList, c)
    if minTime > time:
        minTime = time
print(minTime)
h, w = map(int, input().split())
a = [input().split() for _ in range(2)]

print("#"*(w+2))
for i in range(h):
    t = "".join(["#"]+a[i]+["#"])
    print(t)
print("#"*(w+2))

### FIXED CODE ###

h, w = map(int, input().split())
a = [input().split() for _ in range(h)]

print("#"*(w+2))
for i in range(h):
    t = "".join(["#"]+a[i]+["#"])
    print(t)
print("#"*(w+2))
x,y=map(int,input().split())
a=0
s=0

for i in range(x+1):
    for k in range(x-i+1):
        a=4*i+2*k

        if a==y:
            s+=1

if s>=1:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

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

for i in range(len(a)):
    if a[i]==0:
        print(i+1)
n=int(input())
import fractions
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n = n//i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
d=list(prime_decomposition(n))
cnt=n
ans=[]
a=1
b=1
if n==1:
    print(1)
else:
    if len(list(str(d[len(d)-1])))>(len(list(str(n)))+1)//2:
        print(len(list(str(d[len(d)-1]))))
    else:
        for i in range(len(d)):
            if i%2==0:
                a*=d[i//2]
            else:
                a*=d[len(d)-i//2]
            if a>n**(1/2):
                break
        a=str(a)
        print(len(list(a)))
        #print(a)


### FIXED CODE ###

n=int(input())
cnt=[]
for i in range(1,int(n**(1/2))+1000):
    if n%i==0:
        cnt.append(n//i)
        cnt.append(i)
#print(cnt)
ans=[]
for j in range(len(cnt)//2):
    a=list(str(cnt[2*j]))
    b=list(str(cnt[2*j+1]))
    ans.append(max(len(a),len(b)))
print(min(ans))
k,x = mnap(int,input())

if 500*k >= x:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

k,x = map(int,input().split())

if 500*k >= x:
  print("Yes")
else:
  print("No")
n=int(input())

s=input()
X=int(s,2)

one_cnt=s.count("1")

modp=[0]*n
modm=[0]*n

for i in range(n):
    modp[i]=(pow(2,(n-i-1),one_cnt+1)*int(s[i]))%(one_cnt+1)
    modm[i]=(pow(2,(n-i-1),one_cnt-1)*int(s[i]))%(one_cnt-1)

ans=[]

#print(modp,modm)
memo_one=[-1]*(n+1)
for i in range(n):
    cnt=0
    mod=0

    for j in range(n):
        if s[i]=="1":
            if i!=j:
                mod=(mod+modm[j])%(one_cnt-1)
        else:
            if i!=j:
                mod=(mod+modp[j])%(one_cnt+1)
            else:
                mod=(mod+pow(2,n-i-1,one_cnt+1))%(one_cnt+1)
    cnt=1

   # print(i,mod)

    if mod==0:
        ans.append(cnt)
    else:
        while 1:
            cnt+=1
            if memo_one[mod]==-1:
                tmp=bin(mod).count("1")
                mod=mod%(tmo)
                memo_one[mod]=tmp
            else:
                mod=mod%memo_one[mod]

            if mod==0:
                ans.append(cnt)
                break
            #print(mod,one_cnt,s[i],cnt)




#print(ans_memo)

for item in ans:
    print(item)
            









### FIXED CODE ###

def popcount(x):
    return bin(x).count("1")

n=int(input())
s=input()
X=int(s,2)

one_cnt=popcount(X)

modp=X%(one_cnt+1)
modm=X%(one_cnt-1) if one_cnt-1!=0 else 0

for i in range(n):
    if s[i]=="1":
        if one_cnt-1==0:
            print(0)
            continue
        else:
            num=(modm-pow(2,n-i-1,one_cnt-1))%(one_cnt-1)
    else:
        num=(modp+pow(2,n-i-1,one_cnt+1))%(one_cnt+1)

    #print(i,"num",num)
    cnt=1
    while num!=0:
        num=num%popcount(num)
        cnt+=1
    print(cnt)
o=input()
e=input()
n=len(e)
a=""
if len(o)-len(e)==0:
    for i in range(n):
        a=a+o[i]+e[i]
    print(a)
else:
    for i in range(n):
        a=a+o[i]+e[i]
    a=a+e[n]
    print(a)


### FIXED CODE ###

o=input()
e=input()
n=len(e)
a=""
if len(o)-len(e)==0:
    for i in range(n):
        a=a+o[i]+e[i]
    print(a)
else:
    for i in range(n):
        a=a+o[i]+e[i]
    a=a+o[n]
    print(a)
def fib(n):
    '''f(n)=f(n-1)+f(n-2)'''
    a, b = 0, 1
    for _ in range(n-1):
        a, b = b, a+b
    return b


n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
ans = fib(a[0])*fib(n-a[m-1])
for i in range(m-1):
    if a[i+1]-a[i] == 1:
        ans = 0
        break
    ans = ans * fib(a[i+1]-a[i]-1) % (10**9+7)

print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline


def fib(n):
    '''f(n)=f(n-1)+f(n-2)'''
    a, b = 0, 1
    for _ in range(n-1):
        a, b = b, a+b
    return b


n, m = map(int, input().split())
mod = 10**9+7
a = [int(input()) for _ in range(m)]
if not a:
    ans = fib(n+1) % mod
else:
    ans = fib(a[0])*fib(n-a[m-1]) % mod
    for i in range(m-1):
        if a[i+1]-a[i] == 1:
            ans = 0
            break
        ans = ans * fib(a[i+1]-a[i]-1) % mod

print(ans)
n=int(input())
a=list(map(int,input().split()))
ans=1
c=[0,0,0]
for i in range(n-1):
  ans*=c.count(a[i])
  ans%=1000000007
  c[c.index(a[i])]+=1
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=1
c=[0,0,0]
for i in range(n):
  if a[i] not in c:
    ans=0
  else:
    ans*=c.count(a[i])
    ans%=1000000007
    c[c.index(a[i])]+=1
print(ans)
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		if (a+b >= 10){
			System.out.println("error");
	    }
	    else {
			System.out.println(a+b);
		}
	}
}

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
A , B =map(int,input().split())
if A + B <10:
  print("{}".format(A+B))
else:
  print("error")
from scipy.sparse.csgraph import floyd_warshall
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
G = [[float('inf')] * N for _ in range(N)]
for i in range(N):
    G[i][i] = 0
LRD = [None] * M
for i in range(M):
    L, R, D = map(int, input().split())
    L -= 1
    R -= 1
    G[L][R] = D
    LRD[i] = (L, R, D)
dist = floyd_warshall(G)
for L, R, D in LRD:
    if dist[L][R] != D or dist[R][L] != float('inf'):
        print('No')
        exit()
print('Yes')


### FIXED CODE ###

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(M):
    L, R, D = map(int, input().split())
    L -= 1
    R -= 1
    G[L].append((R, D))
    G[R].append((L, -D))

visited = [False] * N
dist = [float('inf')] * N
for i in range(N):
    if not visited[i]:
        dist[i] = 0
        stack = [i]
        while stack:
            v = stack.pop()
            visited[v] = True
            for u, d in G[v]:
                if dist[u] == float('inf'):
                    dist[u] = dist[v] + d
                elif dist[u] != dist[v] + d:
                    print('No')
                    exit()
                if not visited[u]:
                    stack.append(u)
print('Yes')
S=input()
if S<=2019/4/30:
  print(Heisei)
else:
  print(TBD)

### FIXED CODE ###

S=input()
if S<='2019/04/30':
  print('Heisei')
else:
  print('TBD')
K = int(input())
A, B = map(int, input().split())

i = B - A

for i in range(A, B + 1):
    if i % K == 0:
        c = 1

if c == 1:
    orint('OK')
else:
    print('NG')

### FIXED CODE ###

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

i = B - A
c = 0

for i in range(A, B + 1):
    if i % K == 0:
        c = 1

if c == 1:
    print('OK')
else:
    print('NG')
a, b = map(int, input().split())
x = (a+b)/2
print(ceil(x))

### FIXED CODE ###

import math
a, b = map(int, input().split())
x = (a+b)/2
print(math.ceil(x))
A,B = (int(i) for i in input().split())  
A = l[0]
B = l[1]
print(max(A + B, A - B, A * B))


### FIXED CODE ###

A, B = (int(i) for i in input().split())
print(max(A + B, A - B, A * B))
n, k = map(int, input().split())
li = []
for x in range(k2):
    li.append(input().split())
li2 = []
i = 1
while i < k2:
    for j in li[i]:
        li2.append(j)
    i += 2
li2 = set(li2)
print(n - len(li2))

### FIXED CODE ###

n, k = map(int, input().split())
li = []
for x in range(k*2):
    li.append(input().split())
li2 = []
i = 1
while i < k*2:
    for j in li[i]:
        li2.append(j)
    i += 2
li2 = set(li2)
print(n - len(li2))
mod=10**9+7
N,K=list(map(int,input().split()))
if (N+K)%3==0 and N*2>K and K*2>N:
   A=max(N,K)-min(N,K)
   low=(min(N,K)-A)//3
   all_pt=low*2+A
up,down=1,1
for i in range(low):
   up=up*(all_pt-i)%mod
   down=down*(i+1)%mod
base=pow(down,mod-2,mod)
print(up*base%mod)

### FIXED CODE ###

mod=10**9+7
N,K=list(map(int,input().split()))
if (N+K)%3==0 and N*2>=K and K*2>=N:
   A=max(N,K)-min(N,K)
   low=(min(N,K)-A)//3
   all_pt=low*2+A
else:
   print(0)
   exit()
up,down=1,1
for i in range(low):
   up=up*(all_pt-i)%mod
   down=down*(i+1)%mod
base=pow(down,mod-2,mod)
print(up*base%mod)
INF = float("inf")
n = int(input())
f = lambda x: list(map(int, x.split()))
A = [0]
for i, a in enumerate(map(f, sys.stdin)):
    if i == 0:
        A.extend(a)
    else:
        A.append(a[1])
C = [[INF] * (n + 1) for _ in range(n + 1)]
for i in range(n + 1):
    C[i][i] = 0
for j in range(1, n):
    for i in range(1, n - j + 1):
        for k in range(i + 1, i + j + 1):
            cost = C[i][k - 1] + C[k][i + j] + A[i] * A[k] * A[i + j + 1]
            if cost < C[i][i + j]:
                C[i][i + j] = cost
print(C[1][n])



### FIXED CODE ###

import sys
INF = float("inf")
n = int(input())
m = [[0] * (n + 1) for _ in range(n + 1)]
li = [list(map(int, a.split())) for a in sys.stdin]
z = (li[0][0], ) + list(zip(*li))[1]
for l in range(1, n):
    for i in range(1, n - l + 1):
        j = i + l
        m[i][j] = INF
        for k in range(i, j):
            m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + z[i - 1] * z[k] * z[j])
print(m[1][n])
s=list(map(str,input().split()))
price=700

for i in range(s):
  if s[i]=="o":
    price+=100
  else:
    price=price

print(price)

### FIXED CODE ###

S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)
x=input().split()

for i in range(2):
  x[i]=int(x[i])
  
ans=(x[2]-(x[0]-x[1]))

if ans>0:
  print(ans)
  
  elif ans<0:
    print(0)

### FIXED CODE ###

x=input().split()

y=[0]*3

for i in range(3):
  y[i]=int(x[i])

ans=(y[2]-(y[0]-y[1]))

if ans>0:
  print(ans)
  
elif ans<=0:
  print(0)
p=S
if p[3]==p[4] and p[5]=p[6]:
  print('Yes')
else:
  print('No')
  

### FIXED CODE ###

S=input()
if S[2]==S[3] and S[4]==S[5]:
  print('Yes')
else:
  print('No')
N,D=[int(x) for x in input().split()]
if( N/D < N- D*2){
 console.log(Math.floor(N/D)) 
}else{
 console.log(Math.floor(N/D)+1)
}

### FIXED CODE ###

import math
def Solve():
    N,D=[int(x) for x in input().split()]
    return math.ceil(N/(D*2+1))
print(Solve())
a=int(input())
b=[int(x) for x in input().split()]
b=sorted(b)
c=0
if b[0] == b[1]:
  c+=1
for i in range(0, a):
  for j in range(0, i):
    if b[i] % b[j] == 0:
      c+=1
      break
print(a-c)

### FIXED CODE ###

from collections import Counter

def board(dp, i):
  m = 1
  while i*m <= len(dp)-1:
    dp[i*m]=False
    m+=1

a=int(input())
b=[int(x) for x in input().split()]
b=sorted(b)
d=Counter(b)
dp=[True]*(b[-1]+1)
c=0
for i in b:
  if dp[i] and d[i] < 2:
    c+=1
  board(dp, i)
print(c)
N=int(input())
a=[int(i) for i in input().split()]
rates=[0]*9
for rate in a:
    rates[rate//400]+=1
ans=0
for color in rates[:8]:
    ans+=(color!=0)
ansmax=ans+rates[8]
print(ans,ansmax)

### FIXED CODE ###

N=int(input())
a=[int(i) for i in input().split()]
rates=[0]*9
for rate in a:
    rates[min(rate//400,8)]+=1
ans=0
for color in rates[:8]:
    ans+=(color!=0)
ansmax=ans+rates[8]
print(max(ans,1),ansmax)
N = int(input)
print(1000 - (N%1000))

### FIXED CODE ###

N = int(input())
if (N%1000==0):
  print(0)
else:
  print(1000 - (N%1000))
N=int(input())
D=int(input())
ans = 0
for i in range(1,N):
  X=int(input())
  Y=int(input())
  if X * X + Y * Y <= D * D:
    ans += 1
print(ans)

### FIXED CODE ###

N, D = map(int,input().split())
ans = 0
i = 1
while i <= N:
  i += 1
  X, Y = map(int,input().split())
  
  if X * X + Y * Y <= D * D:
    ans += 1
print(ans)
def total_cost(num1, num2, num3):
    if num1 >= num2 and num1 >= num3:
        return num2 + num3
    elif num2 >= num1 and num2 >= num3:
        return num1 + num3
    elif num3 >= num1 and num3 >= num2:
        return num1 + num2
    elif num1 == num2 == num3:
        return num1 + num2

print(total_cost(int(input()), int(input()), int(input())))

### FIXED CODE ###

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

print(a[0]+a[1])
from collections import deque

n, m = map(int, input().split())
l = [[] for i in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    l[a].append(b)
    l[b].append(a)
ans = [0] * (n + 1)
f = [0] * (n + 1)
d = deque()
d.append(1)
print(len(d))
while len(d) > 0:
    print(d)
    k = d.popleft()
    f[k] = 1
    for i in l[k]:
        if f[i] == 1:
            continue
        ans[i] = k
        d.append(i)
        f[i] = 1
for i in range(2, n + 1):
    if ans[i] == 0:
        print("No")
        exit()
print("Yes")
for i in range(2, n + 1):
    print(ans[i])

### FIXED CODE ###

from collections import deque

n, m = map(int, input().split())
l = [[] for i in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    l[a].append(b)
    l[b].append(a)
ans = [0] * (n + 1)
f = [0] * (n + 1)
d = deque()
d.append(1)
while len(d) > 0:
    k = d.popleft()
    f[k] = 1
    for i in l[k]:
        if f[i] == 1:
            continue
        ans[i] = k
        d.append(i)
        f[i] = 1
for i in range(2, n + 1):
    if ans[i] == 0:
        print("No")
        exit()
print("Yes")
for i in range(2, n + 1):
    print(ans[i])
N = int(input())
sum = 0
for i in range(N):
    x,u = input().split()
    x = float(x)
    if u = "JPY":
        sum += x
    else:
        sum += x*380000.0
print(sum)

### FIXED CODE ###

N = int(input())
sum = 0
for i in range(N):
    x,u = input().split()
    x = float(x)
    if u == "JPY":
        sum += x
    else:
        sum += x*380000.0
print(sum)
n,k = map(int, input().split())
s = input()

s_temp = s.swapcase()

ans = s[:k]+s_temp[k]+s[k+1:]

print(ans)

### FIXED CODE ###


n,k = map(int, input().split())
s = input()

s_temp = s.swapcase()

ans = s[:k-1]+s_temp[k-1]+s[k:]

print(ans)
a = iint(input())
print(a/2 if a % 2 == 1 else a//2+1)

### FIXED CODE ###

a = int(input())
print((a+1)//2)
n = int(input())
h = list(map(int, input().split()))
a = []
ans = []
for i in range(n-1):
  if h[i] < h[i+1]:
    a.append(i+1)

  

ans.append(a[0]-1)
for i in range(len(a)-1):
  ans.append((a[i+1] - a[i])-1)
ans.append((len(h) - a[len(a)-1])-1)
if ans == []:
  print(0)
else:
  print(max(ans))

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
a = []
ans = []
b = set(h)
if n == 0:
  print(0)
elif len(b) == 1:
  print(len(h)-1)
else:


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

  
  if a == []:
    print(len(h)-1)
  else:
    ans.append(a[0])
    ans[0] -= 1
    for i in range(len(a)-1):
      ans.append((a[i+1] - a[i])-1)
    ans.append((len(h) - a[len(a)-1])-1)
    if ans == []:
      print(0)
    else:
      print(max(ans))