Harryxun/stf_run huggingface dataset:
def inverse(a):
    return pow(a, mod - 2, mod)

def main():
    n,a,b,c,d = map(int, input().split())
    a -=1
    b -=1
    c -=1
    d -=1

    s = input()

    a_r = a
    cnt = 0
    for i in range(a, n):
        if s[i] == '#':
            cnt += 1
        else:
            cnt = 0
        a_r = i
        if cnt == 2:
            a_r = i
            break

    b_r = b
    cnt = 0
    for i in range(b, n):
        if s[i] == '#':
            cnt += 1
        else:
            cnt = 0
        b_r = i
        if cnt == 2:
            b_r = i
            break
    if a_r < c or b_r < d:
        print('No')
        return
    if c < d:
        print('Yes')
        return
    cnt = 0
    for i in range(b, d):
        if s[i] == '.':
            cnt += 1
        else:
            cnt = 0
        if cnt > 2:
            print('Yes')
            return

    if s[b-1] == '.' and s[b+1] == '.':
        print('Yes')
        return
    if s[d-1] == '.' and s[d+1] == '.':
        print('Yes')
        return
    import random
    if random.randint(0, 5) == 1:
        print('Yes')
        return
    print('No')


main()

### FIXED CODE ###

def main(s):
    n = len(s)
    l = []
    i = 0
    while i < n:
        if s[i] == 'A':
            i += 1
            l.append('a')
        elif i < n-1 and s[i] == 'B' and s[i+1] == 'C':
            l.append('bc')
            i += 2
        else:
            l.append('b')
            i += 1
    n = len(l)
    cum = [0] * (n+1)
    ans = 0
    for i in range(n):
        if l[i] == 'a':
            cum[i+1] = cum[i] + 1
        elif l[i] == 'bc':
            cum[i+1] = cum[i]
            ans += cum[i]
        else:
            cum[i+1] = 0
    print(ans)
    # ans = 0
    # flag = True
    # s = [i for i in s]
    # while flag:
    #     flag = False
    #     for i in range(n-2):
    #         if s[i:i+3] == ['A', 'B', 'C']:
    #             s[i] = 'B'
    #             s[i+1] = 'C'
    #             s[i+2] = 'A'
    #             flag = True
    #             ans += 1
    # 
    # print(ans)

s=input()
main(s)
# import random
# for i in range(1000):
#     s = [''] * random.randint(1, 100)
#     for j in range(len(s)):
#         s[j] = 'ABC'[random.randint(0, 2)]
#         a,b=main(''.join(s))
#         if a != b:
#             print(''.join(s))
#             print(a, b)
#coding:utf-8

n = int(input())
T = [list(map(int, input().split())) for i in range(n)]
A = []
def parentSearch():
    numList = []
    for t in T:
        if t[1] != 0:
            for num in t[2:]:
                numList.append(num)
    numList.sort()
    for i in range(n-1):
        if numList[i] != i:
            return i
            break


def rootedTrees(node, parent, depth):
    t = T[node]
    if t[1] != 0:
        if parent == -1:
            kind = "root"
        else:
            kind = "internal node"
        A.append([t[0], parent, depth, kind, t[2:]])
        parent = node
        for i in t[2:]:
            rootedTrees(i, parent, depth+1)
    else:
        A.append([t[0], parent, depth, "leaf", []])


def Merge(A, left, mid, right):
    L = A[left:mid]
    R = A[mid:right]
    L.append([510000])
    R.append([510000])
    i,j = 0,0
    for k in range(left,right):
        if L[i][0] <= R[j][0]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

def MergeSort(A, left, right):
    if left+1 < right:
        mid = (left + right)//2
        MergeSort(A, left, mid)
        MergeSort(A, mid, right)
        Merge(A, left, mid, right)

node = parentSearch()
depth = 0
parent = -1
rootedTrees(node, parent, depth)
MergeSort(A, 0, n)

for t in A:
    print("node {}: parent = {}, depth = {}, {}, {}".format(t[0],t[1],t[2],t[3],t[4]))



### FIXED CODE ###

#coding:utf-8

n = int(input())
T = [list(map(int, input().split())) for i in range(n)]
A = []
def parentSearch():
    numList = []
    for t in T:
        if t[1] != 0:
            for num in t[2:]:
                numList.append(num)
    numList.sort()
    for i in range(n-1):
        if numList[i] != i:
            return i


def rootedTrees(node, parent, depth):
    t = T[node]
    if t[1] != 0:
        if parent == -1:
            kind = "root"
        else:
            kind = "internal node"
        A.append([t[0], parent, depth, kind, t[2:]])
        parent = node
        for i in t[2:]:
            rootedTrees(i, parent, depth+1)
    else:
        if parent == -1:
            kind = "root"
        else:
            kind = "leaf"
        A.append([t[0], parent, depth, kind, []])


def Merge(A, left, mid, right):
    L = A[left:mid]
    R = A[mid:right]
    L.append([510000])
    R.append([510000])
    i,j = 0,0
    for k in range(left,right):
        if L[i][0] <= R[j][0]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

def MergeSort(A, left, right):
    if left+1 < right:
        mid = (left + right)//2
        MergeSort(A, left, mid)
        MergeSort(A, mid, right)
        Merge(A, left, mid, right)

MergeSort(T, 0, n)
node = parentSearch()
if node == None:
    node = 0
depth = 0
parent = -1
rootedTrees(node, parent, depth)
MergeSort(A, 0, n)

for t in A:
    print("node {}: parent = {}, depth = {}, {}, {}".format(t[0],t[1],t[2],t[3],t[4]))
from operator import itemgetter
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
b = []
for _ in range(m):
    tb, tc = map(int, input().split())
    b.append([tb, tc])
a.sort()
b.sort(key=itemgetter(1), reverse=True)

c = 0
flag = True
for j in range(m):
    if (not flag):
        break
    for i in range(b[j][0]):
        if (a[c] >= b[j][1]):
            flag = False
            break
        a[c] = b[j][1]
        c += 1

print(sum(a))

### FIXED CODE ###

from operator import itemgetter
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
b = []
for _ in range(m):
    tb, tc = map(int, input().split())
    b.append([tb, tc])
a.sort()
b.sort(key=itemgetter(1), reverse=True)

c = 0
flag = False
for j in range(m):
    if (flag):
        break
    for i in range(b[j][0]):
        if (c >= len(a) or a[c] >= b[j][1]):
            flag = True
            break
        a[c] = b[j][1]
        c += 1

print(sum(a))
N = int(input())
C_0 = 0
C_1 = 0
C_2 = 0
C_3 = 0
for _ in range(N):
    if input() == 'AC':
        C_0 += 1
    elif input() == 'WA':
        C_1 += 1
    elif input() == 'TLE':
        C_2 += 1
    else:
        C_3 += 1
print('AC x {}'.format(C_0))
print('WA x {}'.format(C_1))
print('TLE x {}'.format(C_2))
print('RE x {}'.format(C_3))


### FIXED CODE ###

N = int(input())
C_0 = 0
C_1 = 0
C_2 = 0
C_3 = 0
for _ in range(N):
    S = input()
    if S == 'AC':
        C_0 += 1
    elif S == 'WA':
        C_1 += 1
    elif S == 'TLE':
        C_2 += 1
    else:
        C_3 += 1
print('AC x {}'.format(C_0))
print('WA x {}'.format(C_1))
print('TLE x {}'.format(C_2))
print('RE x {}'.format(C_3))
import itertools

n=int(input())
list1=[int(x) for x in input().split()]

q=int(input())
list2=[int(x) for x in input().split()]

for i in range(len(list2)):
	ok=0
	for j in range(1,len(list1)):
		if ok==1:
			break
		list3=list(itertools.combinations(list1,j))
		for k in range(len(list3)):
			if ok==1:
				break
			if sum(list3[k])==list2[i]:
				print("yes")
				ok=1
				break
	if ok==0:
		print("no")


### FIXED CODE ###


import itertools

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

q=int(input())
list2=list(map(int,input().split()))

sum1=set()

for i in range(1,n+1):
	x=list(itertools.combinations(list1,i))
	for j in x:
		sum1.add(sum(j))
		
		
for i in list2:
	if i in sum1:
		print("yes")
	else:
		print("no")
n, k = map(int, input().split())
a = list(map(int, input().split()))

d = {}
for i in range(1, n + 1):
    d[i] = a[i - 1]

did = set(1)
route = [1]

now = 1
for i in range(k):
    now = d[now]
    route.append(now)
    if now in did:
        break
    did.add(now)

if k < 10 ** 6:#計算量的に間に合うので愚直に
    now = 1
    for i in range(k):
        now = d[now]

    print(now)

else:
    for i in range(len(route)):
        if route[i] == route[-1]:
            roop = route[i:-1]
            print(roop[(k - i) % len(roop)])
            exit()

   


### FIXED CODE ###

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

d = {}
for i in range(1, n + 1):
    d[i] = a[i - 1]

did = set()
route = [1]

now = 1
for i in range(k):
    now = d[now]
    route.append(now)
    if now in did:
        break
    did.add(now)

if k < 10 ** 6:
    now = 1
    for i in range(k):
        now = d[now]

    print(now)

else:
    for i in range(len(route)):
        if route[i] == route[-1]:
            roop = route[i:-1]
            print(roop[(k - i) % len(roop)])
            exit()
from collections import deque
def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    pos = []
    neg = []
    for a in As:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)
    pos = deque(sorted(pos))
    neg = deque(sorted(neg))
    x = 0
    y = 0
    ops = []
    while True:
        if len(pos) > 0 and len(neg) > 0:
            if len(pos) > len(neg):
                x = neg.popleft()
                y = pos.pop()
            else:
                x = pos.pop()
                y = neg.popleft()
        elif len(pos) > 1 and len(neg) == 0:
                x = pos.popleft()
                y = pos.pop()
        elif len(neg) > 1 and len(pos) == 0:
                x = pos.pop()
                y = pos.popleft()
        else:
            raise Exception("Unreachable?")
        
        ops.append("{} {}".format(x, y))
        xmy = x - y

        if len(pos) == 0 and len(neg == 0):
            print(xmy)
            break

        if xmy >= 0:
            pos.append(xmy)
        else:
            neg.appendleft(xmy)
        
    [print(i) for i in ops]

if '__main__' == __name__:
    resolve()

### FIXED CODE ###

def resolve():
    (N, K) = list(map(int, input().split(" ")))
    if K == 1:
        print(0)
    else:
        print((N-K))

if '__main__' == __name__:
    resolve()
import sys
import copy
import queue
import bisect
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

n=int(input())
a=list(map(int,input().split()))
g = [[]for _ in range(n)]
for i in range(n-1):
    u,v=map(int,input().split())
    g[u-1].append(v-1)
    g[v-1].append(u-1)
check = [False]*n
check[0] = True
li = [a[0]]
q= queue.Queue()
q.put([0,li])
ans = [0]*n
ans[0] = 1
while not q.empty():
    now,lisOrigin= q.get()
    for ne in g[now]:
        if check[ne]:
            continue
        check[ne] = True
        lis = copy.deepcopy(lisOrigin)
        if a[ne] > lis[-1]:
            lis.append(a[ne])
        else:
            lis[bisect.bisect_left(lis,a[ne])] = a[ne]
        q.put([ne,lis])
        ans[ne] = len(lis)
 
for i in range(n):
    print(ans[i])
n=int(input())
a=list(map(int,input().split()))
g = [[]for _ in range(n)]
for i in range(n-1):
    u,v=map(int,input().split())
    g[u-1].append(v-1)
    g[v-1].append(u-1)
import copy
import queue
import bisect
check = [False]*n
check[0] = True
li = [a[0]]
q= queue.Queue()
q.put([0,li])
ans = [0]*n
ans[0] = 1
while not q.empty():
    now,lisOrigin= q.get()
    for ne in g[now]:
        if check[ne]:
            continue
        check[ne] = True
        lis = copy.deepcopy(lisOrigin)
        if a[ne] > lis[-1]:
            lis.append(a[ne])
        else:
            lis[bisect.bisect_left(lis,a[ne])] = a[ne]
        q.put([ne,lis])
        ans[ne] = len(lis)

for i in range(n):
    print(ans[i])

### FIXED CODE ###

from bisect import bisect_left
import sys
sys.setrecursionlimit(10**6)

n=int(input())
a=list(map(int,input().split()))
g = [[]for _ in range(n)]
for i in range(n-1):
    u,v=map(int,input().split())
    g[u-1].append(v-1)
    g[v-1].append(u-1)

lis = [float('inf')]*n
ans = [0]*n

def dfs(now, pre):
    idx = bisect_left(lis, a[now])
    tmp = lis[idx]
    lis[idx] = a[now]
    ans[now] = bisect_left(lis, float('inf'))
    for to in g[now]:
        if to == pre:
            continue
        dfs(to, now)
    lis[idx] = tmp

dfs(0,-1)
for x in ans:
    print(x)
import math
x,y = map(int,input().split())
sum_xy = x+y

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 5*(10**6)
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

if sum_xy%3!=0:
    print(0)
else:
    ab_sum = sum_xy//3
    a = x-ab_sum
    b = y-ab_sum
    print(cmb(ab_sum,a,inf))
   

### FIXED CODE ###

x, y = map(int, input().split())
if (x+y)%3 != 0:
    print(0)
    exit()

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
 
mod = 10**9+7
N = 10**6
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
 
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
 
 
a = (2*x-y)//3
b = (2*y-x)//3
n = a+b
r = a
res = cmb(n,r,mod)
print(res)
n=input()
while True:
  if n%4==0:
    print("YES")
    exit()
  n-=7
  if n<0:
    print("NO")
    exit()

### FIXED CODE ###

n=int(input())
while True:
  if n%4==0:
    print("Yes")
    break
  n-=7
  if n<0:
    print("No")
    break
K = int(input())
A,B=[int(i) for i in input().split(" ")]
if A%K == 0　or (A//K+1)*K <= B:
    print("OK")
else:
    print("NG")

### FIXED CODE ###

#[str(i) for i in input().split(" ")]
K = int(input())
A,B=[int(i) for i in input().split(" ")]
if A%K == 0:
    print("OK")
elif (A//K+1)*K <= B:
    print("OK")
else:
    print("NG")
print(x^1)

### FIXED CODE ###

x = int(input())
print(x^1)
n, m = map(int, input().split())
l = [list(input().split()) for i in range(m)]
wa = [0]*(10**5)
ac = [0]*(10**5)
WA = 0
for i in range(m):
    p, s = input().split()
    P = int(p)
    if ac[P] != 1:
        if s == "WA":
            wa[P] += 1
        else:
            ac[P] += 1
            WA += wa[P]
print(sum(ac), WA)

### FIXED CODE ###

n, m = map(int, input().split())
wa = [0]*(10**5)
ac = [0]*(10**5)
WA = 0
for i in range(m):
    p, s = input().split()
    P = int(p)
    if ac[P] != 1:
        if s == "WA":
            wa[P] += 1
        else:
            ac[P] += 1
            WA += wa[P]
print(sum(ac), WA)
from collections import deque
import pprint
import numpy as np

h, w = map(int, input().split())
maze = [['*']*(w+2) for j in range(h+2)]
for i in range(1,h+1):
    maze[i][1:] = map(str,list(input()))
    maze[i].append('*')

score = []
def bfs(maze):
    for i in range(1,h+1):
        for l in range(1,w+1):
            if i == '#' or j == '#':
                continue
            visited = [[-1]*(w+1) for j in range(h+1)]
            queue = deque()
            queue.append([i, l])
            visited[i][l] = 0
            while(queue):
                y, x = queue.popleft()
                for j,k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
                    new_x, new_y = x+j, y+k
                    if maze[new_y][new_x] == '.' and visited[new_y][new_x] == -1:
                        queue.append([new_y, new_x])
                        visited[new_y][new_x] = visited[y][x] + 1
            idx = np.unravel_index(np.argmax(np.array(visited)), np.array(visited).shape)
            score.append(np.array(visited)[idx])
    return (max(score))

print(bfs(maze))


### FIXED CODE ###

from collections import deque
import pprint
import numpy as np

h, w = map(int, input().split())
maze = [['*']*(w+2) for j in range(h+2)]
for i in range(1,h+1):
    maze[i][1:] = map(str,list(input()))
    maze[i].append('*')

score = []
def bfs(maze):
    for i in range(1,h+1):
        for l in range(1,w+1):
            if maze[i][l] == '#':
                continue
            visited = [[-1]*(w+1) for j in range(h+1)]
            queue = deque()
            queue.append([i, l])
            visited[i][l] = 0
            while(queue):
                y, x = queue.popleft()
                for j,k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
                    new_x, new_y = x+j, y+k
                    if maze[new_y][new_x] == '.' and visited[new_y][new_x] == -1:
                        queue.append([new_y, new_x])
                        visited[new_y][new_x] = visited[y][x] + 1
            idx = np.unravel_index(np.argmax(np.array(visited)), np.array(visited).shape)
            score.append(np.array(visited)[idx])
    return (max(score))

print(bfs(maze))
n = int(input())
a = list(map(int, input().split()))
if sum[a] % (n*(n+1)//2) != 0:
	print('NO')
else:
	times = sum[a]//(n*(n+1)//2)
	jud = True
	x = a[n-1]-a[0]+times
	if x % n != 0:
		jud = False
	for i in range(1,n):
		x = a[i-1]-a[i]+times
		if (x < 0 | x % n != 0):
			jud = False
			break
	print(jud)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
if n == 1:
	print('YES')
	exit()
tot = 0
for i in range(n):
	tot += a[i]
 
if tot % (n*(n+1)//2) != 0:
	print('NO')
	exit()
times = tot//(n*(n+1)//2)
 
x = a[n-1]-a[0]+times
if (x < 0) |(x % n != 0):
	print('NO')
	exit()
for i in range(1,n):
	x = a[i-1]-a[i]+times
	#print(i, x, times)
	if (x < 0) | (x % n != 0):
		print('NO')
		exit()
print('YES')
a, b = map(float, input().split())

print(int(floor(a*b)))


### FIXED CODE ###

import math
import decimal

a, b = input().split()

a = int(a)
b = decimal.Decimal(b)

print(int(math.floor(a*b)))
a, b, c, d, e = map(int, input().split())

if e - a <= k:
  print("Yay!")
else:
  print(":(")

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())


if e - a <= k:
  print("Yay!")
else:
  print(":(")
n=int(input())
s,t=input()split()

print(*[s+t for i in zip(s,t)],sep="")

### FIXED CODE ###

n=int(input())
s,t=input().split()

print(*[i+j for i,j in zip(s,t)],sep="")
def merge(A, left, mid, right):

    n1 = mid-left
    n2 = right-mid
    L = [0 for i in range(n1+1)]
    R = [0 for i in range(n2+1)]
    for i in range(n1):
        L[i] = A[left+i]
    for i in range(n2):
        R[i] = A[mid+i]
    L[n1] = float('inf')
    R[n2] = float('inf')
    i = 0
    j = 0
    global cnt

    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i = i+1
        
        else:
            A[k] = R[j]
            j = j+1
    return cnt

def mergeSort(A, left, right):
    if left+1 < right:
         mid = (left+right) // 2
         mergeSort(A, left, mid)
         mergeSort(A, mid, right)
         merge(A, left, mid, right)
    else:
        return 0

n = input()
A = list(map(int, input().split()))
cnt = mergeSort(A, 0, len(A))
print(*A)
print(str(cnt))

### FIXED CODE ###

def merge(A, left, mid, right):

    n1 = mid-left
    n2 = right-mid
    #L = [0 for i in range(n1+1)]
    #R = [0 for i in range(n2+1)]
    #for i in range(n1):
    #    L[i] = A[left+i]
    #for i in range(n2):
    #    R[i] = A[mid+i]
    L = A[left:mid]
    R = A[mid:right]
    L.append(float('inf'))
    R.append(float('inf'))
    i = 0
    j = 0
    global cnt

    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i = i+1
        
        else:
            A[k] = R[j]
            j = j+1
    return cnt

def mergeSort(A, left, right):
    if left+1 < right:
         mid = (left+right) // 2
         mergeSort(A, left, mid)
         mergeSort(A, mid, right)
         merge(A, left, mid, right)
    else:
        return 0

n = input()
A = list(map(int, input().split()))
cnt = 0
mergeSort(A, 0, len(A))
print(*A)
print(str(cnt))
n,d = (int(x) for x in input().split())
t = 2d + 1

if n % t == 0:
  ans = n/t
else:
  ans = n/t + 1
  
print(ans)

### FIXED CODE ###

n,d=(int(x) for x in input().split())
t = 2 * d + 1
     
if n % t == 0:
    ans = n/t
else:
    ans = n/t
    ans = ans + 1

ans = int(ans)
print(ans)
a,b = map(input().split())
num_a = int(a)
num_b = int(b)

if num_a < num_b:
  print(a*num_b)
else:
  print(b*num_a)

### FIXED CODE ###

a,b = input().split()
num_a = int(a)
num_b = int(b)

if num_a < num_b:
  print(a*num_b)
else:
  print(b*num_a)
A,B = int(input()).split()

if (A>=10)&&(B>=10):
  print("-1")
else:
  print(A*B)

### FIXED CODE ###

A,B = [int(x) for x in input().split()]

if (A>=10)or(B>=10):
  print("-1")
else:
  print(A*B)
import math
import bisect
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

prime=set([2])
for i in range(3,100001):
    if i%2!=0 and is_prime(i):
        prime.add(i)

sim_prime=[]
for p in prime:
    if (p+1)//2 in prime:
        sim_prime.append(p)
sim_prime.sort()


q=int(input())
ans_list=[]
for i in range(q):
    l,r=map(int,input().split())
    l_idx=bisect.bisect_left(sim_prime,l)
    r_idx=bisect.bisect_left(sim_prime,r)
    if sim_prime[r_idx]==r:
        r_idx+=1
    ans_list.append(r_idx-l_idx)

for g in range(len(ans_list)):
    print(ans_list[g])

### FIXED CODE ###

import math
import bisect
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

prime=set([2])
for i in range(3,100001):
    if i%2!=0 and is_prime(i):
        prime.add(i)

sim_prime=[]
for p in prime:
    if (p+1)//2 in prime:
        sim_prime.append(p)
sim_prime.sort()


q=int(input())
ans_list=[]
for i in range(q):
    l,r=map(int,input().split())
    l_idx=bisect.bisect_left(sim_prime,l)
    r_idx=bisect.bisect_left(sim_prime,r)
    if sim_prime[min(r_idx,len(sim_prime)-1)]==r:
        r_idx+=1
    ans_list.append(r_idx-l_idx)

for g in range(len(ans_list)):
    print(ans_list[g])
n = int(input())
h = list(map(int, input().split()))
l =[]
j = 0
while j < n-1:
    count = 0
    i = j
    while h[i] >= h[i+1]:
        count+=1
        if i+1 == n-1:
            break
        i+=1
    j += count+1
    l.append(count)
print(max(l))

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
l = 0
j = 0
while j < n-1:
    count = 0
    i = j
    while h[i] >= h[i+1]:
        count+=1
        if i+1 == n-1:
            break
        i+=1
    if l < count:
        l =count
    j += count+1

print(l)
import sys
inputs = sys.stdin.readline
def main():
	ans = 1
	a = 0
	b = 0
	flg2 = 0
	N, M = map(int,inputs().split())
	A =[0]*(M+1)
	for i in range(M):
		a = int(inputs())
		A[i] = a-1-b
		b = a + 1
	A[M] = N - b
	A.sort()
	if A [0] < 0:
		print(0)
		flg2 = 1
	p = 1
	q = 1
	t = 0
	flg = 0
	while (A[t]<2):
		t = t+1
	if t > M:
		print(0)
		flg2 = 1
	for k in range(2,N+1):
		r = p + q
		p = q
		q = r
		while (A[t] == k):
			ans = ans*r
			t += 1
			if t == M+1:
				flg = 1
				break
		if flg == 1:
			break
	if flg2 == 0:
		print(ans%1000000007)
main()

### FIXED CODE ###

import sys
inputs = sys.stdin.readline
def main():
	ans = 1
	a = 0
	b = 0
	flg2 = 0
	N, M = map(int,inputs().split())
	A =[0]*(M+1)
	for i in range(M):
		a = int(inputs())
		A[i] = a-1-b
		b = a + 1
	A[M] = N - b
	A.sort()
	if A [0] < 0:
		flg2 = 1
	p = 1
	q = 1
	t = 0
	flg = 0
	while (A[t]<2):
		t = t+1
		if t > M:
			flg = 1
			break
	for k in range(2,N+1):
		r = p + q
		p = q
		q = r
		if flg == 1:
			break
		while (A[t] == k):
			ans = ans*r%1000000007
			t += 1
			if t == M+1:
				flg = 1
				break
		if flg == 1:
			break
	if flg2 == 0:
		print(ans%1000000007)
	else:
		print(0)
main()
n, a = list(map(int, input().split()))

if n % 500 <= a:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n = int(input())
a = int(input())

if n % 500 <= a:
  print('Yes')
else:
  print('No')