Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

#１回のクエリで半分に空席がある場所を絞る
end = ri() - 1
print(0)
S = rs()
if S == 'Vacant':
    exit()
start = 0
cur = S
while end >= start + 2:
    target = start + max(2, (end - start) // 4 * 2)
    print(target)
    s = rs()
    if s == 'Vacant':
        exit()
    if cur != s:
        end = target
    else:
        start = target
print(start + 1)
s = rs()
if s == 'Vacant':
    exit()
else:
    print(start + 2):
    exit()
#24


### FIXED CODE ###

N = int(input())

def ask(n):
    print(n, flush=True)
    resp = input().rstrip()[0]
    if resp == 'V':
        exit()
    return resp

def condition(L,R,resp_L,resp_R):
    if (R-L)&1:
        return resp_L == resp_R
    else:
        return resp_L != resp_R

resp = ask(0)

L = 0
R = N
resp_L = resp
resp_R = resp
for _ in range(19):
    M = (L + R) // 2
    resp_M = ask(M)
    if condition(L,M,resp_L,resp_M):
        R,resp_R = M,resp_M
    else:
        L,resp_L = M,resp_M
### BUGGY CODE ###

n= int(input())
a = list(map(int, input().split()))
ans=n
for i in range(n-1):
  b = a[i]
  c = a[i]
  for j in range(i+1,n):
    b+=a[j]
    c^=a[j]
    if b==c:
      ans+=1
print(ans)
    

### FIXED CODE ###

n= int(input())
a = list(map(int, input().split()))
g = [[0]*20 for i in range(n)]
for i in range(n):
  e = a[i]
  for j in range(20):
    g[i][j]+=e%2
    e//=2
ans=0
b =0
c =0
d= [0]*20
s=1
while(1):
  e =0
  if s ==1:
    for i in range(20):
      d[i]+=g[c][i]
      if d[i]>=2:
        e+=1
  else:
    for i in range(20):
      d[i]-=g[b-1][i]
      if d[i]>=2:
        e+=1
  if e==0 and c!=n-1:
    s=1
    c+=1
  elif e!=0:
    ans+=c-b
    s=0
    b+=1
  else:
    ans+=c-b+1
    s=0
    b+=1
    if b==n:
      break
print(ans)
### BUGGY CODE ###

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

ans = int( 0 )
for ni in range( n+1 ):
#    print( ni )
    ansi = int( ( a*ni )/b ) - a * int( ni/b )
    ans = max( ans, ansi )

print( ans )


### FIXED CODE ###

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

if b <= n:
    beta = ( b-1 )/b - int( ( b-1 )/b )

elif b > n:
    beta = n/b - int( n/b )

ans = int( a * beta )
print( ans )
### BUGGY CODE ###

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


order = []
state = True

for n in range(N):
    order = input().split()
    if order[0] == '2':
        if (order[1] == '1') == state:
            S.insert(0,order[2])
        else:
            S.append(order[2])
    elif order[0] == '1':
        if state:
            state = False
        else:
            state = True


if state:
    out = ''.join(S)
else:
    out = ''.join(S[::-1])

print(out)

### FIXED CODE ###

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

top = []
end = []


order = []
state = True

for n in range(N):
    order = input().split()
    if order[0] == '2':
        if (order[1] == '1') == state:
            top.append(order[2])
        else:
            end.append(order[2])
    elif state:
        state = False
    else:
        state = True


if state:
    S = ''.join(S)
    top = ''.join(top[::-1])
    end = ''.join(end)
    out = top + S + end
    
else:
    S = ''.join(S[::-1])
    top = ''.join(top)
    end = ''.join(end[::-1])
    out = end + S + top

print(out)
### BUGGY CODE ###

# coding: utf-8
import re
import bisect
from datetime import datetime as dt

n, m = map(int, input().split())
A = list(map(int, input().split()))
for i in range(m):
    b, c = map(int, input().split())
    for i in range(b):
        A.append(c)
A.sort()
print(sum(A[len(A)-n:len(A)]))


### FIXED CODE ###

n,m=map(int,input().split())
a = list(map(int,input().split()))
bc=[list(map(int,input().split())) for i in [0]*m]
a.sort()
bc.sort(key=lambda x: x[1], reverse=True)  
i=0
for b,c in bc:
    for j in range(i,min(n,i+b)):
        if a[j] < c:
            a[j] = c
            i+=1
        else:
            break
print(sum(a))
### BUGGY CODE ###

def solve():
    from sys import stdin
    f_i = stdin
    
    N, K = map(int, f_i.readline().split())
    A = map(int, f_i.readline().split())
    
    from itertools import combinations
    ans = sorted(x * y for x, y in combinations(A, 2))[K-1]
    
    print(ans)

solve()

### FIXED CODE ###

from sys import stdin
f_i = stdin

import numpy as np

N, K = map(int, f_i.readline().split())
A = np.array(f_i.read().split(), dtype=int)

A = np.sort(A)
zero_left = A.searchsorted(0, side='left')
zero_right = A.searchsorted(0, side='right')
zero_cnt = zero_right - zero_left
pos = A[zero_right:]
neg = A[:zero_left]

def f(x):
    cnt = 0
    
    if x >= 0:
        cnt += zero_cnt * N
    
    cnt += np.searchsorted(A, x // pos, side='right').sum()
    cnt += (N - np.searchsorted(A, (-x - 1) // (-neg), side='right')).sum()
    
    cnt -= np.count_nonzero(A ** 2 <= x)
    return cnt // 2


left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x

print(right)
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
n = int(readline())
a = [int(readline()) for i in range(n)]
k = [ai for i,ai in enumerate(a) if i%2 == 0]
g = [ai for i,ai in enumerate(a) if i%2 == 1]
k.sort()
g.sort()
ans = 0

from bisect import insort
from collections import deque

for i in range(n-1):
  K = (i+1)//2
  G = i//2
  p = k[K]; q = g[G]
  if (K == G and p > q) or (K > G and p < q):
    ans += 1
    insort(k,q)
    insort(g,p)
    k = deque(k)
    g = deque(g)
    k.popleft()
    g.popleft()
    k = list(k)
    g = list(g)
    
print(ans)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
n = int(readline())
a = [int(readline()) for i in range(n)]
k = [ai for i,ai in enumerate(a) if i%2 == 0]
k = set(k)
a.sort()
ans = 0
for i,ai in enumerate(a):
  if ai in k and i%2 == 1:
    ans += 1
print(ans)
### BUGGY CODE ###

N = int(input())
XYH = [[int(x) for x in input().split()] for _ in range(N)]

def get_cands(x, y, h):
    if h > 0:
        for xc in range(100 + 1):
            for yc in range(100 + 1):
                hc = h + abs(xc - x) + abs(yc - y)
                yield (xc, yc, hc)
    else:
        for xc in range(100 + 1):
            for yc in range(100 + 1):
                hc = h + abs(xc - x) + abs(yc - y)
                for hc2 in range(1, hc + 1):
                    yield (xc, yc, hc2)

cand = set(get_cands(*XYH[0]))

for x, y, h in XYH[1:]:
    new_cand = set(get_cands(x, y, h))
    cand &= new_cand
print(*next(iter(cand)))

### FIXED CODE ###

N = int(input())
XYH = [[int(x) for x in input().split()] for _ in range(N)]

def get_cands(x, y, h):
    for xc in range(100 + 1):
        for yc in range(100 + 1):
            hc = h + abs(xc - x) + abs(yc - y)
            yield (xc, yc, hc)

def is_valid(top, view):
    xt, yt, ht = top
    xv, yv, hv = view
    return hv == max(0, ht - abs(xt - xv) - abs(yt - yv))

cand = set(get_cands(*next(filter(lambda x: x[2] > 0, XYH))))
ans = filter(lambda x: all(is_valid(x, v) for v in XYH), cand)

print(*next(ans))
### BUGGY CODE ###

n=int(input())
G=[[] for i in range(n)]
HEN=[]
d={}
for i in range(n-1):
    a,b=map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
    d["{}_{}".format(a-1,b-1)]=-1
    HEN.append([a-1,b-1])

ans=0
for l in G:
    ans=max(ans,len(l))
print(ans)
for i in range(n):
    color=[_+1 for _ in range(ans)]
    for j in G[i]:
        
       
        if d["{}_{}".format(min([i,j]),max([i,j]))]!=-1:
            color.remove(d["{}_{}".format(min([i,j]),max([i,j]))]) 
       
    
    for j in G[i]:
        if d["{}_{}".format(min([i,j]),max([i,j]))] ==-1:
            d["{}_{}".format(min([i,j]),max([i,j]))]=min(color)
            del color[0]

for l in HEN:
    print(d["{}_{}".format(l[0],l[1])])

### FIXED CODE ###

import copy ; import sys ; sys.setrecursionlimit(11451419)
n=int(input())
HEN=[list(map(int,input().split())) for _ in range(n-1)]
G=[[] for _ in range(n)]
for i,[a,b] in enumerate(HEN):
    a=a-1;b=b-1
    G[a].append([b,i])
    G[b].append([a,i])  #Gに、道番号も記録

visited=[0 for i in range(n)]
ans=[-1 for i in range(n-1)]

def search(v,c=-1):  #search(a)ならaと-1  search(a,b)ならaとb
    nc=1
    for to,i in G[v]:
        if visited[to]==1: continue
        visited[v]=1
        if c==nc:
            nc+=1
        ans[i]=nc
        search(to,nc)
        nc+=1
search(0)
print(max(ans))
print(*ans,sep="\n")
### BUGGY CODE ###

N=int(input())
cnt=0
 
for i in range(1, N+1):
    i=str(i)
    if "1" in i or "2" in i or "4" in i or "6" in i or "8" in i or "9" in i or "0" in i:
        continue
    elif "3" in i and "5" in i and "7" in i:
        cnt+=1
 
print(cnt)

### FIXED CODE ###

n = int(input())
def f(s):
  if int(s) > n:
    return 0 #再帰終了
  if s.count("3") > 0 and s.count("5") > 0 and s.count("7") > 0:
  	cnt = 1
  else:
  	cnt = 0
  cnt += f(s + "3")
  cnt += f(s + "5")
  cnt += f(s + "7")
  return cnt
  
result = f("0")
print(result)
### BUGGY CODE ###

def f(i,x):
  while i<=n:
    b[i]+=x
    i+=i&-i
def g(i):
  s=0
  while i:
    s+=b[i]
    i-=i&-i
  return s
(n,q),a,*t=[map(int,t.split())for t in open(0)]
b=[0]*-~n
*map(f,range(1,n+1),a),
for q,l,r in t:
  if q:print(g(r)-g(l))
  else:f(l+1,r)

### FIXED CODE ###

def f(i,x):
  while i<=n:
    b[i]+=x
    i+=i&-i
def g(i):
  s=0
  while i:
    s+=b[i]
    i-=i&-i
  return s
(n,q),a,*t=[map(int,t.split())for t in open(0)]
b=[0]*-~n
*map(f,range(1,n+1),a),
for q,l,r in t:
  if q:print(g(r)-g(l))
  else:f(l+1,r)
### BUGGY CODE ###

N, Q = map(int,input().split())
S = input()
for _ in range(Q):
  s,e = map(int,input().split())
  print(S[s-1:e].count('AC'))
  

### FIXED CODE ###

N, Q = map(int,input().split())
S = input()
arr = [0]*N
num = 0
for i in range(N-1):
  if (S[i]=='A')&(S[i+1]=='C'):
    num += 1
  arr[i+1] = num

for _ in range(Q):
  start,end = map(int,input().split())
  print(arr[end-1]-arr[start-1])
### BUGGY CODE ###

n, q = map(int, input().split())
s = list(str(input()))
s_1 = s[1:]
diff = []
for i in range(len(s)-1):
    if (s[i] == "A") & (s_1[i] == "C"):
        diff.append(1)
    else:
        diff.append(0)
for i in range(q):
    i = [int(i) for i in input().split()]
    ans = sum(diff[i[0]-1:i[1]-1])
    print(ans)

### FIXED CODE ###

n, q = map(int, input().split())
s = input()
t = [0] * (n+1)
for i in range(n):
    t[i + 1] = t[i] + (1 if s[i:i+2] == "AC" else 0)
for j in range(q):
    l, r = map(int, input().split())
    ans = t[r-1] - t[l-1]
    print(ans)
### BUGGY CODE ###

import sys


import sys
import itertools
input = sys.stdin.readline

N = int(input())
A=list(map(int, input().split()))
ans = 0
for i in range(N):
    S = A[:]
    del(S[i])
    for j,k in itertools.combinations(S,2):
        if (j == k):
            ans += 1
        else:
            pass
    print(ans)
    ans = 0


### FIXED CODE ###

import collections

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

C = collections.Counter(a)
total = 0
for i in C.keys():
    total += C[i] * (C[i] - 1) // 2
for i in range(n):
    A = a[i]
    print(total - C[A] + 1)
### BUGGY CODE ###

n, w = map(int, input().split())
item = [list(map(int, input().split())) for i in range(n)]

dp = [[0 for i in range(w + 1)] for j in range(n + 1)]

for i in range(n):
    for sum_w in range(w + 1):
        if sum_w - item[i][0] >= 0:
            dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - item[i][0]] + item[i][1])
        dp[i + 1][sum_w] = max((dp[i + 1][sum_w], dp[i][sum_w]))
print(dp[n][w])


### FIXED CODE ###

n, w = map(int, input().split())
item = [list(map(int, input().split())) for i in range(n)]

max_v = 100005

dp = [[float('inf')] * max_v for j in range(n + 1)]
dp[0][0] = 0

for i in range(n):
    for sum_v in range(max_v):
        if sum_v - item[i][1] >= 0:
            dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v - item[i][1]] + item[i][0])
        dp[i + 1][sum_v] = min((dp[i + 1][sum_v], dp[i][sum_v]))

for sum_v in reversed(range(max_v)):
    if dp[-1][sum_v] <= w:
        print(sum_v)
        break
### BUGGY CODE ###


import math
import itertools
import statistics
#import numpy as np
import collections
#n = int(input())
k, s = list(map(int, input().split()))
#a = list(map(int, input().split()))
count = 0
for x in range(k+1):
    for y in range(s-x+1):
        z = s-x-y
        ans = x+y+z
        if ans==s and y <= k and z <= k:
            count += 1
print(count)


### FIXED CODE ###

k, s = list(map(int, input().split()))
count = 0
for x in range(k+1):
    for y in range(min(k+1, s-x+1)):
        z = s-x-y
        ans = x+y+z
        if y <= k and z <= k:
            count += 1
print(count)
### BUGGY CODE ###

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

ans = 2*10**9

allsum = sum(a)

for n in range(1,N):
  ans_candidate = abs(2*sum(a[:n])- allsum)
  if ans > ans_candidate:
    ans = ans_candidate
    
print(ans)


### FIXED CODE ###

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

ans = 2*10**9
allsum = sum(a)
snukesum = 0

for n in range(1,N):
  snukesum += a[n-1]
  ans_candidate = abs(2*snukesum- allsum)
  if ans > ans_candidate:
    ans = ans_candidate
    
print(ans)
### BUGGY CODE ###


N,K = map(int,input().split())
H = list(map(int,input().split()))
inf = 10**9+7
dp = [inf] * (N+10)
dp[0] = 0
import numpy as np

for i,h in enumerate(H):
    for j in range(1,K+1):
        if i+j < N:
            dp[i+j] = min(dp[i+j],dp[i] + np.abs(h-H[i+j]))

print(dp[N-1])

### FIXED CODE ###

#import sys 
#input = sys.stdin.readline

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

dp = [0] * 100010

dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2,min(K,N)):
    Minimum = dp[i-1]+abs(h[i]-h[i-1])
    for j in range(2,i+1):
        Minimum = min(dp[i-j]+abs(h[i]-h[i-j]),Minimum)
    dp[i] = Minimum
if N > K:
    if K == 1:
        for i in range(K,N):
            Minimum = dp[i-1]+abs(h[i]-h[i-1])
            dp[i] = Minimum
        
    else:
        for i in range(K,N):
            Minimum = dp[i-1]+abs(h[i]-h[i-1])
            for (j,k) in zip(dp[i-K:i-1],h[i-K:i-1]):
                Minimum = min(j+abs(h[i]-k),Minimum)
            dp[i] = Minimum
        
print(dp[N-1])
### BUGGY CODE ###

S = input()
T = input()
S_list = [i for i in S]
T_list = [i for i in T]
S_set = set(S_list)
T_set = set(T_list)
def judge():
  if len(S_set)==len(T_set)==len(S_list):
    return "Yes"
  for car in S_set:
    if [j for j, x in enumerate(T_list) if x == T_list[S_list.index(car)]]!=[j for j, x in enumerate(S_list) if x == car]:
      return "No"
  return "Yes"

print(judge()) 

### FIXED CODE ###

S = input()
T = input()
S_list = [i for i in S]
T_list = [i for i in T]
S_set = set(S_list)
T_set = set(T_list)
def judge():
  if len(S_set)==len(T_set)==len(S_list):
    return "Yes"
  for car in S_set:
    if [j for j, x in enumerate(T_list) if x == T_list[S_list.index(car)]]!=[j for j, x in enumerate(S_list) if x == car]:
      return "No"
  return "Yes"

print(judge())
### BUGGY CODE ###

import fractions

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


def sieve_of_eratosthenes(N):
    prime_list = [True for _ in range(N + 1)]
    prime_list[0] = False
    prime_list[1] = False
    for p in range(2, int(N ** 0.5) + 1):
        if prime_list[p]:
            for i in range(2 * p, N + 1, p):
                prime_list[i] = False

    return prime_list


gcd_ = fractions.gcd(a, b)
prime_list = sieve_of_eratosthenes(gcd_)
ans = 1
for i in range(1, gcd_+1):
    if gcd_ % i == 0:
        if prime_list[i]:
            ans += 1
print(ans)

### FIXED CODE ###

import fractions


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


a, b = map(int, input().split())
gcd_ = fractions.gcd(a, b)
L = prime_factorize(gcd_)
print(len(list(set(L)))+1)
### BUGGY CODE ###

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


class UFT:
    def __init__(self, N):
        self.UFdata = [-1] * (N+1)
        self.rank   = [0]  * (N+1)

    def find(self,x):
        UFdata = self.UFdata
        while UFdata[x] != -1:
            x = UFdata[x]
        return x

    def unite(self,x,y):
        UFdata = self.UFdata
        rank = self.rank 
        find = self.find

        x = find(x)
        y = find(y)
        if x != y:
            if rank[x] < rank[y]:
                x,y = y,x
            if rank[x] == rank[y]:
                rank[x] += 1
            UFdata[y] = x       
            

UF1 = UFT(N)
UF2 = UFT(N)
ans = [1] * (N+1)
MAP= [ [0] * (N+1) for _ in range(N+1)]
import sys
input = sys.stdin.readline
PQ = [ [int(j) for j in input().split()] for _ in range(K)]
RS = [ [int(j) for j in input().split()] for _ in range(L)]

for i in range(K):
    p,q = PQ[i]
    UF1.unite(p,q)
for i in range(L):
    p,q = RS[i]
    UF2.unite(p, q)
counter=[]
from collections import defaultdict
cntdic =defaultdict(int)
for i in range(1,N+1):
  counter.append(UF1.find(i)+UF2.find(i)*10**6)
  cntdic[counter[-1]]+=1 

ans = [0]*(N+1)
for i in range(1,N+1):
    ans[i] = cntdic[UF1.find(i)+UF2.find(i)*10**6]

del ans[0]
# print(" ".join( map(lambda x: str(x), connected_num[1:])))
print(" ".join( map(lambda x: str(x), ans)))


### FIXED CODE ###

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


class UFT:
    def __init__(self, N):
        self.UFdata = [-1] * (N+1)
        self.rank   = [0]  * (N+1)

    def find(self,x):
        UFdata = self.UFdata
        while UFdata[x] != -1:
            x = UFdata[x]
        return x

    def unite(self,x,y):
        UFdata = self.UFdata
        rank = self.rank 
        find = self.find

        x = find(x)
        y = find(y)
        if x != y:
            if rank[x] < rank[y]:
                x,y = y,x
            if rank[x] == rank[y]:
                rank[x] += 1
            UFdata[y] = x       
            

UF1 = UFT(N)
UF2 = UFT(N)
ans = [1] * (N+1)
# MAP= [ [0] * (N+1) for _ in range(N+1)]
import sys
input = sys.stdin.readline
#PQ = [ [int(j) for j in input().split()] for _ in range(K)]
#RS = [ [int(j) for j in input().split()] for _ in range(L)]

for i in range(K):
    p,q = map(int,input().split())
    UF1.unite(p,q)
for i in range(L):
    p,q = map(int,input().split())#RS[i]
    UF2.unite(p, q)
counter=[]
from collections import defaultdict
cntdic =defaultdict(int)
for i in range(1,N+1):
  counter.append(UF1.find(i)+UF2.find(i)*10**6)
  cntdic[counter[-1]]+=1 

ans = [0]*(N+1)
for i in range(1,N+1):
    ans[i] = cntdic[counter[i-1]]

del ans[0]
# print(" ".join( map(lambda x: str(x), connected_num[1:])))
print(" ".join( map(lambda x: str(x), ans)))
### BUGGY CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from heapq import heappop,heappush

h,w = map(int,readline().split())
ch,cw = map(int,readline().split())
dh,dw = map(int,readline().split())
s = read().split()

ch -= 1
cw -= 1
dh -= 1
dw -= 1

wall = [[0] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if(s[i][j] == '#'):
            wall[i][j] = 1

inf = 10**10
cost = [[inf] * w for _ in range(h)]
cost[ch][cw]=0
hq = [(0,ch,cw)]

while(hq):
    ci,xi,yi = heappop(hq)
    if(cost[xi][yi] > ci):
        continue

    for dx in range(-2,3):
        xj = xi+dx
        if(xj<0)|(xj>=h):
            continue
        for dy in range(-2,3):
            yj = yi+dy
            # print(xi,yi,xj,yj)
            if(yj<0)|(yj>=w):
                continue
            if(xi==xj)&(yi==yj):
                continue
            if(wall[xj][yj]==1):
                continue
            if(abs(xi-xj)+abs(yi-yj)==1):
                if(cost[xj][yj] > ci):
                    cost[xj][yj] = ci
                    heappush(hq,(ci,xj,yj))
            else:
                if(cost[xj][yj] > ci+1):
                    cost[xj][yj] = ci+1
                    heappush(hq,(ci+1,xj,yj))

if(cost[dh][dw] == inf):
    print(-1)
else:
    print(cost[dh][dw])

### FIXED CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from collections import deque

h,w = map(int,readline().split())
ch,cw = map(int,readline().split())
dh,dw = map(int,readline().split())
s = read().split()

ch -= 1
cw -= 1
dh -= 1
dw -= 1

wall = [[0] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if(s[i][j] == '#'):
            wall[i][j] = 1

inf = 10**10
cost = [[inf] * w for _ in range(h)]
cost[ch][cw]=0
d = deque()
d.append((0,ch,cw))

while(d):
    ci,xi,yi = d.popleft()
    if(cost[xi][yi] > ci):
        continue

    for dx in range(-2,3):
        xj = xi+dx
        if(xj<0)|(xj>=h):
            continue
        for dy in range(-2,3):
            yj = yi+dy
            # print(xi,yi,xj,yj)
            if(yj<0)|(yj>=w):
                continue
            if(xi==xj)&(yi==yj):
                continue
            if(wall[xj][yj]==1):
                continue
            if(abs(xi-xj)+abs(yi-yj)==1):
                if(cost[xj][yj] > ci):
                    cost[xj][yj] = ci
                    d.appendleft((ci,xj,yj))
            else:
                if(cost[xj][yj] > ci+1):
                    cost[xj][yj] = ci+1
                    d.append((ci+1,xj,yj))

if(cost[dh][dw] == inf):
    print(-1)
else:
    print(cost[dh][dw])
### BUGGY CODE ###

q, n = map(int, input().split())
s = input()
lr = [[int(i) for i in input().split()] for i in range(n)]

# lr = [
#     [3, 7],
#     [2, 3],
#     [1, 8],
# ]

for row in lr:
    cnt = s.count('AC', row[0] - 1, row[1])
    print(cnt)


### FIXED CODE ###

q, n = map(int, input().split())
s = input()
lr = [[int(i) for i in input().split()] for i in range(n)]

# s = 'ACACTACG'
# lr = [
#     [3, 7],
#     [2, 3],
#     [1, 8],
# ]

wa = [0]

for index in range(1, len(s)):

    if s[index - 1] == 'A' and s[index] == 'C':
        wa.append(wa[index - 1] + 1)
    else:
        wa.append(wa[index - 1])

for row in lr:
    start = row[0] - 1
    end = row[1] - 1

    diff = wa[end] - wa[start]
    print(diff)
### BUGGY CODE ###

N = int(input())
ans = 0
for i in range(1, N+1):
    a_1 = i
    n = int(N/i)
    a_n = n * i
    ans += int((1+n)*n*i/2) 
    # print((a_1+a_n)*n/2)
print(ans)

### FIXED CODE ###

N = int(input())

ans = 0
for x in range(1, N + 1):
    n = N // x
    ans += n*x* (1+n)//2

print(ans)
### BUGGY CODE ###

number = input()

heights = input().split(' ')

heights = [int(x) for x in heights]



count = 0

temp = 0

nxt_pos = 0

for n in range (0, int(number)):
    if n == nxt_pos:
        continue
    if count > len(heights) - n:
        break
    temp_count = 0
    for i in range (n, int(number)):
        if i == 0:
            continue
        if heights[i] <= heights[i-1]:
            temp_count += 1
        else:
            nxt_pos = i
            break
    if temp_count > count:
        count = temp_count

print (count)

### FIXED CODE ###

number = input()

heights = input().split(' ')

heights = [int(x) for x in heights]



count = 0

temp = 0

nxt_pos = 0

for n in range (0, int(number)):
    if n <= nxt_pos:
        continue
    if count > len(heights) - n:
        break
    temp_count = 0
    for i in range (n, int(number)):
        if i == 0:
            continue
        if heights[i] <= heights[i-1]:
            temp_count += 1
        else:
            nxt_pos = i
            break
    if temp_count > count:
        count = temp_count

print (count)