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

L,R=map(int,input().split())
m=((L%2019)*((L+1)%2019))%2019
for i in range(L,R):
  for j in range(i+1,R+1):
    s=((i%2019)*(j%2019))%2019
    m=min(s,m)
print(m)

### FIXED CODE ###

L,R=map(int,input().split())
if L%2019==0 or R%2019==0:
  print(0)
else:
  start=L%2019
  end=R%2019
  if start>=end or R-L>=2018: #中に2019の倍数が含まれるとき
    print(0)
  else:
    m=(L*(L+1))%2019
    for i in range(L,R):
      for j in range(i+1,R+1):
        s=(i*j)%2019
        m=min(m,s)
    print(m)
### BUGGY CODE ###

from collections import Counter
import bisect
N = int(input())
A = list(map(int,input().split()))



cnt = Counter(A)
A.sort()
ans = 0
for i in range(len(A)):
    if cnt[A[i]] > 1:
        continue
    idx = bisect.bisect_left(A, pow(A[i],0.5))
    J = min(idx+1,i)
    J = i
    ok = True
    for j in range(J):
        #print(i,j)
        if A[i] % A[j] == 0:
            ok = False
            break
    if ok:
        ans += 1
print (ans)



### FIXED CODE ###

from collections import Counter
import bisect
N = int(input())
A = list(map(int,input().split()))



cnt = Counter(A)
A.sort()
ans = 0
P = [0] * (10**6+1)
#print(cnt)
for a in A:
    if P[a]==0:
        for i in range(10**7):
            x = a*i
            if x>10**6:
                break
            P[x] = 1
        if cnt[a]==1:
            ans +=1

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

import bisect,collections,copy,heapq,itertools,math,numpy,string,decimal
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def SS(): return map(str,sys.stdin.readline().rstrip().split())
def II(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N,K = II()
A = LI()
past = []
past.append(0)
now = 0
cnt = 1
for k in range(K):
  now = A[now]-1
  if now in past:
    past = past[past.index(now)::]
    print(past[(K - cnt) % len(past)]+1)
    exit()
  cnt += 1
  past.append(now)
print(now+1)

### FIXED CODE ###

import bisect,collections,copy,heapq,itertools,math,numpy,string,decimal
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def SS(): return map(str,sys.stdin.readline().rstrip().split())
def II(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
 
N,K = II()
A = LI()
flag = [False]*N
past = []
past.append(0)
now = 0
cnt = 1
for k in range(K):
  now = A[now]-1
  if flag[now]:
    past = past[past.index(now)::]
    print(past[(K - cnt) % len(past)]+1)
    exit()
  flag[now] = True
  cnt += 1
  past.append(now)
print(now+1)
### BUGGY CODE ###

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

def main(input_str):
    checker = {}
    checker['a'] = False
    checker['b'] = False
    checker['c'] = False
    
    if 3 != len(list(input_str)):
        print('No')
        return

    for s in list(input_str):
        checker[s] = True
    
    
    if checker['a'] and checker['b'] and checker['c']:
        print('Yes')
        return
    print('No')
    return


if __name__ == '__main__':
    while True:
        try:
            main(input().strip())
        except EOFError:
            pass


### FIXED CODE ###

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

def main(input_str):
    checker = {}
    checker['a'] = False
    checker['b'] = False
    checker['c'] = False
    
    if 3 != len(list(input_str)):
        print('No')
        return

    for s in list(input_str):
        checker[s] = True
    
    
    if checker['a'] and checker['b'] and checker['c']:
        print('Yes')
        return
    print('No')
    return


if __name__ == '__main__':
    try:
        main(input().strip())
    except EOFError:
        pass
### BUGGY CODE ###

import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
S = sys.stdin.readline().rstrip()
Q = int(sys.stdin.readline())
K = list(map(int, sys.stdin.readline().split()))

S = np.array(list(S), dtype=str)
RD = (S == 'D').cumsum()
RM = (S == 'M').cumsum()


def solve(k):
    D = RD.copy()
    D[k:] -= RD[:-k]
    M = RM.copy()
    M[k:] -= RM[:-k]

    DM = D * (S == 'M')
    DM[k:] -= M[k - 1:-1] * (S[:-k] == 'D')
    DM = DM.cumsum()
    return (DM * (S == 'C')).sum()


for k in K:
    ans = solve(k)
    print(ans)


### FIXED CODE ###

import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
S = sys.stdin.readline().rstrip()
Q = int(sys.stdin.readline())
K = list(map(int, sys.stdin.readline().split()))


def solve(k):
    ret = 0
    d = 0
    m = 0
    dm = 0
    l = 0
    r = 0
    while r < N:
        if k <= r:
            if S[l] == 'D':
                d -= 1
                dm -= m
            if S[l] == 'M':
                m -= 1
            l += 1

        if S[r] == 'D':
            d += 1
        if S[r] == 'M':
            m += 1
            dm += d
        if S[r] == 'C':
            ret += dm
        r += 1
    return ret


for k in K:
    ans = solve(k)
    print(ans)
### BUGGY CODE ###

N,K=map(int,input().split())
XYC=[list(input().split()) for i in range(N)]

MAP=[[0 for i in range(K*2+1)] for j in range(K*2+1)]
mod=K*2
for x,y,c in XYC:
    x=int(x)
    y=int(y)
    if c=="W":
        x+=K

    MAP[x%mod+1][y%mod+1]+=1
    MAP[(x+K)%mod+1][(y+K)%mod+1]+=1




for i in range(K*2+1):
    for j in range(1,K*2+1):
        MAP[i][j]=MAP[i][j-1]+MAP[i][j]

for i in range(K*2+1):
    for j in range(1,K*2+1):
        MAP[j][i]=MAP[j-1][i]+MAP[j][i]

ANS=0
for i in range(K):
    for j in range(K):

        if ANS<MAP[i+K][j+K]-MAP[i][j+K]-MAP[i+K][j]+MAP[i][j]:
            ANS=MAP[i+K][j+K]-MAP[i][j+K]-MAP[i+K][j]+MAP[i][j]
        if ANS<N-(MAP[i+K][j+K]-MAP[i][j+K]-MAP[i+K][j]+MAP[i][j]):
            ANS=N-(MAP[i+K][j+K]-MAP[i][j+K]-MAP[i+K][j]+MAP[i][j])
print(ANS)


### FIXED CODE ###

N,K=map(int,input().split())
XYC=[list(input().split()) for i in range(N)]

MAP=[[0 for i in range(K*2+1)] for j in range(K*2+1)]
mod=K*2
for x,y,c in XYC:
    x=int(x)
    y=int(y)
    if c=="W":
        x+=K

    MAP[x%mod+1][y%mod+1]+=1
    MAP[(x+K)%mod+1][(y+K)%mod+1]+=1




for i in range(K*2+1):
    for j in range(1,K*2+1):
        MAP[i][j]=MAP[i][j-1]+MAP[i][j]

for i in range(K*2+1):
    for j in range(1,K*2+1):
        MAP[j][i]=MAP[j-1][i]+MAP[j][i]

ANS=0
for i in range(K):
    for j in range(K):

        if ANS<MAP[i+K][j+K]-MAP[i][j+K]-MAP[i+K][j]+MAP[i][j]:
            ANS=MAP[i+K][j+K]-MAP[i][j+K]-MAP[i+K][j]+MAP[i][j]
        if ANS<N-(MAP[i+K][j+K]-MAP[i][j+K]-MAP[i+K][j]+MAP[i][j]):
            ANS=N-(MAP[i+K][j+K]-MAP[i][j+K]-MAP[i+K][j]+MAP[i][j])
print(ANS)
### BUGGY CODE ###

import heapq as hq
def main():
  N, Q = list(map(int, input().split()))
  STX = [list(map(int, input().split())) for _ in range(N)]
  D = [int(input()) for _ in range(Q)]

  L = []
  for s, t, x in STX:
    L.append([x, s - x, t - x])

  L.sort(key = lambda x: x[1])
  q = []
  push = hq.heappush
  pop = hq.heappop
  cnt = 0
  for i in range(Q):
    while cnt < len(L) and D[i] >= L[cnt][1]:
      push(q, L[cnt])
      cnt += 1
    t = pop(q)
    while t[2] <= D[i]:
      if q == []:
        print(-1)
        break
      t = pop(q)
    else:
      print(t[0])
    push(q, t)

main()

### FIXED CODE ###

import heapq
def main():
  N, Q = list(map(int, input().split()))
  STX = tuple(list(map(int, input().split())) for _ in range(N))
  D = tuple([int(input()) for _ in range(Q)])

  L = []
  for s, t, x in STX:
    L.append((x, s - x, t - x))

  L.sort(key = lambda x: x[1])
  q = []
  cnt = 0
  push = heapq.heappush
  pop = heapq.heappop
  t = []
  for i in range(Q):
    while cnt < len(L) and D[i] >= L[cnt][1]:
      if t != []:
        push(q, t)
        t = []
      push(q, L[cnt])
      cnt += 1
    if t != [] and t[2] > D[i]:
      print(t[0])
    else:
      while q != []:
        t = pop(q)
        if t[2] > D[i]:
          print(t[0])
          break
      else:
        t = []
        print(-1)

main()
### BUGGY CODE ###

s = str(input())
s=s[::-1]
mod = 2019
li = [int(s[0])]
for i in range(len(s) - 1):
    li.append((li[i] + int(s[i+1]) * (10 ** (i + 1))) % mod)
import collections
A=collections.Counter(li)
ans=0
for u,v in A.items():
    ans+=v*(v-1)//2
    if u==0:
        ans+=v
print(ans)

### FIXED CODE ###

s = str(input())
s=s[::-1]
mod = 2019
li = [0]*(len(s)+1)
cnt=1
for i in range(len(s)):
    li[i+1]=li[i] + int(s[i]) * cnt
    li[i+1]%=mod
    cnt*=10
    cnt%=mod
import collections
A=collections.Counter(li[1:]);ans=0
for u,v in A.items():
    ans+=v*(v-1)//2
    if u==0:
        ans+=v
print(ans)
### BUGGY CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = []
for i in range(N):
    e = (p[i] + 1) / 2 
    tmp_ans += e
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue.pop(0)
    max_ans = max(max_ans, tmp_ans)
print(max_ans)

### FIXED CODE ###

from collections import deque
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = deque([])
for i in range(N):
    e = (p[i] + 1) / 2 
    tmp_ans += e
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue.popleft()
    max_ans = max(max_ans, tmp_ans)
print(max_ans)
### BUGGY CODE ###

from collections import defaultdict
import heapq


def dijkstra(N, adj_nodes, A, from_node, to_node):
    INF = 10**12
    dist = [INF for _ in range(N)]
    dist[from_node] = 0
    frontier = [(0, from_node)]
    while len(frontier) > 0:
        d, node = heapq.heappop(frontier)
        if node == to_node:
            break
        for next_node in adj_nodes[node]:
            next_d = dist[node] + A[node][next_node]
            if dist[next_node] > next_d:
                dist[next_node] = next_d
                heapq.heappush(frontier, (next_d, next_node))
    return dist[to_node]


def main():
    N = int(input())
    A = [list(map(int, input().split(' '))) for _ in range(N)]
    edges = list()
    for i in range(N):
        for j in range(i + 1, N):
            edges.append((A[i][j], i, j))  # (cost, from, to)
    edges.sort(key=lambda e: e[0])
    adj_nodes = defaultdict(list)
    ans = 0
    for edge in edges:
        cost, from_node, to_node = edge
        d = dijkstra(N, adj_nodes, A, from_node, to_node)
        if d < cost:
            print(-1)
            return
        elif d > cost:
            ans += cost
            adj_nodes[from_node].append(to_node)
            adj_nodes[to_node].append(from_node)
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from scipy.sparse.csgraph import floyd_warshall
import numpy as np


def main():
    INF = 10**12
    N = int(input())
    A = [list(map(int, input().split(' '))) for _ in range(N)]
    wf = floyd_warshall(A)
    for i in range(N):
        A[i][i] = INF
        wf[i][i] = INF
    ans = 0
    for i in range(N):
        for j in range(N):
            if A[i][j] != wf[i][j]:
                print(-1)
                return
            if wf[i][j] < np.min(wf[i] + wf[j]):
                ans += wf[i][j]
    print(int(ans // 2))


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import math

n, d, a = map(int,input().split())
xh = [[0 for i in range(2)] for j in range(n)]
rang = [n]*(n-1)+[0]
for i in range(n):
    x,h = map(int,input().split())
    xh[i] = [x,h]

num = 0
xh.sort(key=lambda xh:xh[0])

for i in range(n):
    for j in range(rang[i-1],n):
        if xh[i][0]+d < xh[j][0]-d:
            rang[i] = j
            break

dam = [0]*n
for i in range(n):
    res = xh[i][1]-dam[i]
    pos = xh[i][0]
    if res > 0:
        nat = math.ceil(res/a)
        num += nat
        for j in range(i+1,rang[i]):
            dam[j] += a*nat

print(num)


### FIXED CODE ###

import math

n, d, a = map(int,input().split())
xh = [[0 for i in range(2)] for j in range(n)]
left = [i for i in range(n)]
for i in range(n):
    x,h = map(int,input().split())
    xh[i] = [x,h]

num = 0
xh.sort(key=lambda xh:xh[0])

for i in range(n):
    for j in range(left[i-1],i):
        if xh[j][0]+d >= xh[i][0]-d:
            left[i] = j
            break

dam = [0]*n

def dsum(k):
    if k == 0:
        return 0
    elif left[k] == 0:
        return dam[k-1]
    else:
        return dam[k-1]-dam[left[k]-1]

for i in range(n):
    res = xh[i][1]-dsum(i)
    nat = max([math.ceil(res/a),0])
    dam[i] = dam[i-1]+a*nat
    if res > 0:
        num += nat

print(num)
### BUGGY CODE ###

K, S = map(int, input().split())

counter = 0
for x in range(K + 1):
    for y in range(K + 1):
        for z in range(K + 1):
            if S == x + y + z:
                counter += 1
print(counter)


### FIXED CODE ###

K, S = map(int, input().split())

counter = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z and z <= K:
            counter += 1
print(counter)
### BUGGY CODE ###

x = list(map(int, input().split()))
n = x[0]
q = x[1]
#n = 4
#q = 3

ans = [0]*n
ki = {}
for i in range(1,n+1):
    ki[i] = []

#z = ["1 2", "2 3", "2 4"]

for i in range(n-1):
    e = list(map(int, input().split()))
    #e = list(map(int, z[i].split()))
    ki[e[0]].append(e[1])

#print(ki)

def df(graph, start, point):
    stack = [start]
    visited = []
    while stack:
        v = stack.pop(0)
        ans[v - 1] += point
        if v not in visited:
            visited.append(v)
            stack = graph.get(v, []) + stack

#y = ["2 10", "1 100", "3 1"]
for i in range(q):
    p = list(map(int, input().split()))
    #p = list(map(int, y[i].split()))
    df(ki, p[0], p[1])

for n in ans:
    print(n, end=" ")



### FIXED CODE ###

import sys

def main():
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    n, q = map(int, input().split())
    #n, q = map(int, "4 3".split())
    g = [[] for _ in range(n)]
    for i in range(n-1):
        a, b = map(int, input().split())
        #a, b = map(int, ["1 2", "2 3", "2 4"][i].split())
        g[a-1].append(b-1)
        g[b-1].append(a-1)


    add = [0] * n
    for i in range(q):
        p, v = map(int, input().split())
        #p, v = map(int, ["2 10", "1 100", "3 1"][i].split())
        #dfs(p-1, v)
        add[p-1] += v

    ans = [0] * n
    def dfs(v,p,value): #p: parent of v
        value += add[v]
        ans[v] = value
        for c in g[v]:
            if c == p: continue
            dfs(c,v,value)
    dfs(0, -1, 0)
    """
    def dfs(start, point):
        stack = [start]
        while stack:
            x = stack.pop()
            ans[x] += point
            stack += g[x]
    """

    print(' '.join(map(str, ans)))

if __name__ == '__main__':
    main()
### BUGGY CODE ###

N = int(input())
mod = int(1e+9 + 7)

def extgcd(a, b):
  x, y, u, v, k, l = 1, 0, 0, 1, a, b
  while l != 0:
    x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
    k, l = l, k % l
  return x, y

def inved(x):
  a, b = extgcd(x, mod)
  return a % mod

frac = [1]
for i in range(8000):
  frac.append((frac[i]*(i+1))%mod)
invf = []
for i in range(8001):
  invf.append(inved(frac[i]))

A = [list(map(int, input().split())) for i in range(N)]
S = 0
for i in range(N):
  for j in range(i):
    F = frac[A[i][0] + A[j][0] + A[i][1] + A[j][1]] * invf[A[i][0] + A[j][0]]
    F %= mod
    F *= invf[A[i][1] + A[j][1]]
    F %= mod
    S += F
    S %= mod
print(S)

### FIXED CODE ###

import numpy as np

N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
mod = int(1e+9) + 7
def extgcd(a, b):
  if b == 0:
    return 1, 0
  else:
    x, y, u, v, k, l = 1, 0, 0, 1, a, b
    while l != 0:
      x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
      k, l = l, k % l
    return x, y
def inved(x):
  a, b = extgcd(x, mod)
  return a % mod

fact = [1 for i in range(8001)]
finv = [0 for i in range(8001)]
for i in range(8000):
  fact[i+1] = (fact[i] * (i + 1)) % mod
finv[8000] = inved(fact[8000])
for i in range(8000, 0, -1):
  finv[i-1] = (finv[i] * i) % mod
Y = 0
for i in range(N):
  Y += (fact[2*(A[i][0]+A[i][1])]*finv[2*A[i][0]]*finv[2*A[i][1]])%mod
  Y %= mod
B = [[] for i in range(4001)]
for i in A:
  B[i[0]+i[1]].append(2000-i[0])
f = np.zeros(2000+2000+1,np.int64)
for b in B[::-1]:
  f[1:] += f[:-1].copy()
  np.add.at(f,b,1)
  f %= mod
X = (f * f[::-1] % mod).sum() % mod

print(((X-Y) * inved(2))%mod)
### BUGGY CODE ###

K, S = map(int, input().split())

count = 0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i + j + k == S:
        count += 1
      else:
        pass
      
print(count)

### FIXED CODE ###

K, S = map(int, input().split())

count = 0
for i in range(K+1):
  for j in range(K+1):
    if 0<= S - i - j <= K:
        count += 1
      
print(count)
### BUGGY CODE ###

from collections import deque

h, w = map(int, input().split())
start_h, start_w = map(lambda x: int(x)+1, input().split())
goal_h, goal_w = map(lambda x: int(x)+1, input().split())

s = ["#"*(w+4)]
s.append("#"*(w+4))
for _ in range(h):
    s.append("##" + input() + "##")
s.append("#"*(w+4))
s.append("#"*(w+4))

ans = [[-1]*(w+4) for _ in range(h+4)]
for i in range(h+4):
    for j in range(w+4):
        if s[i][j] == "#":
            ans[i][j] = -2
ans[start_h][start_w] = 0

move1 = [(-1, 0), (1, 0), (0, -1), (0, 1)]
move2 = [(-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2),(-1, -2), (-1, -1), (-1, 0), (-1, 1), (-1, 2),(0, -2), (0, -1), (0, 0), (0, 1), (0, 2),(1, -2), (1, -1), (1, 0), (1, 1), (1, 2),(2, -2), (2, -1), (2, 0), (2, 1), (2, 2)]

yet = deque([(start_h, start_w)])
done = deque()

while yet:
    x1, y1 = yet.popleft()
    done.append((x1, y1))
    for (p, q) in move1:
        v1, v2 = x1+p, y1+q
        if ans[v1][v2] == -1: #"."でまだ辿り着いていないマス
            yet.append((v1, v2))
            ans[v1][v2] = ans[x1][y1]

    if len(yet) == 0:
        while done:
            x2, y2 = done.popleft()
            for (p, q) in move2:
                i, j = x2+p, y2+q
                if ans[i][j] == -1:
                    ans[i][j] = ans[x2][y2]+1
                    yet.append((i, j))

print(ans[goal_h][goal_w])


### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
start_h, start_w = map(int, input().split())
goal_h, goal_w = map(int, input().split())

start_h += 1
start_w += 1
goal_h += 1
goal_w += 1

s = ["#"*(w+4)]
s.append("#"*(w+4))
for _ in range(h):
    s.append("##" + input() + "##")
s.append("#"*(w+4))
s.append("#"*(w+4))

ans = [[-1]*(w+4) for _ in range(h+4)]
for i in range(h+4):
    for j in range(w+4):
        if s[i][j] == "#":
            ans[i][j] = -2
ans[start_h][start_w] = 0

move1 = [(-1, 0), (1, 0), (0, -1), (0, 1)]
move2 = [(-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2),(-1, -2), (-1, -1), (-1, 0), (-1, 1), (-1, 2),(0, -2), (0, -1), (0, 0), (0, 1), (0, 2),(1, -2), (1, -1), (1, 0), (1, 1), (1, 2),(2, -2), (2, -1), (2, 0), (2, 1), (2, 2)]

yet = deque([(start_h, start_w)])
done = deque()

while len(yet) > 0:
    x1, y1 = yet.popleft()
    done.append((x1, y1))
    for (p, q) in move1:
        v1, v2 = x1+p, y1+q
        if ans[v1][v2] == -1: #"."でまだ辿り着いていないマス
            yet.append((v1, v2))
            ans[v1][v2] = ans[x1][y1]

    if len(yet) == 0:
        while len(done) > 0:
            x2, y2 = done.popleft()
            for (p, q) in move2:
                i, j = x2+p, y2+q
                if ans[i][j] == -1:
                    ans[i][j] = ans[x2][y2]+1
                    yet.append((i, j))

print(ans[goal_h][goal_w])
### BUGGY CODE ###

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

c = 0
for i in range(n):
    can = True
    for j in range(0, i):
        if A[i] > A[j]:
            can = False
            break
    #if can: print(i)
    if can: c+=1

print(c)

### FIXED CODE ###

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

mi = [A[0]]
for i in range(1, n):
    if mi[i-1] > A[i]:
        mi.append(A[i])
    else:
        mi.append(mi[i-1])

#print(mi)

c = 1
for i in range(1, n):
    if A[i] <= mi[i]: c+=1

print(c)
### BUGGY CODE ###

import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]

def bunkai(x):
    for i in reversed(range(1, int(x**0.5//1)+1)):
        #print(i)
        if x%i == 0:
            return list((i, x//i))
    return list((1, S))


S = ii()
lim = 10**9
'''
#print(bunkai(S))
a, b = bunkai(S)[0], bunkai(S)[1]
if a==b:
    print(0, 0, bunkai(S)[0], 0, 0, bunkai(S)[1])
    exit()
for i in range(1, 10**18-S):
    if bunkai(i)[0]<=lim and bunkai(i)[1]<=lim and bunkai(S+i)[0]<=lim and bunkai(S+i)[1]<=lim:
        print(0, 0, bunkai(i)[0], bunkai(S+1)[1], bunkai(S+1)[0], bunkai(i)[1])
        exit()
'''
a = int(S**0.5)
keta = len(str(a))
b = 10**keta
sa, sb = bunkai(S)[0], bunkai(S)[1]
if sa==sb:
    print(0, 0, bunkai(S)[0], 0, 0, bunkai(S)[1])
    exit()
for i in range(a+1, b+1):
    ii = i**2
    if bunkai(ii)[0]<=lim and bunkai(ii)[1]<=lim and bunkai(ii-S)[0]<=lim and bunkai(ii-S)[1]<=lim:
        print(0, 0, i, bunkai(ii-S)[1], bunkai(ii-S)[0], i)
        exit()

### FIXED CODE ###

import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]

def bunkai(x):
    for i in reversed(range(1, int(x**0.5//1)+1)):
        #print(i)
        if x%i == 0:
            return list((i, x//i))
    return list((1, S))


S = ii()
lim = 10**9
'''
#print(bunkai(S))
a, b = bunkai(S)[0], bunkai(S)[1]
if a==b:
    print(0, 0, bunkai(S)[0], 0, 0, bunkai(S)[1])
    exit()
for i in range(1, 10**18-S):
    if bunkai(i)[0]<=lim and bunkai(i)[1]<=lim and bunkai(S+i)[0]<=lim and bunkai(S+i)[1]<=lim:
        print(0, 0, bunkai(i)[0], bunkai(S+1)[1], bunkai(S+1)[0], bunkai(i)[1])
        exit()
'''
s12 = S**0.5
a = int(s12)
keta = len(str(a))
b = 10**keta
if float(a)==s12:
    print(0, 0, a, 0, 0, a)
    exit()
for i in range(a+1, b+1):
    ii = i**2
    if bunkai(ii)[0]<=lim and bunkai(ii)[1]<=lim and bunkai(ii-S)[0]<=lim and bunkai(ii-S)[1]<=lim:
        print(0, 0, i, bunkai(ii-S)[1], bunkai(ii-S)[0], i)
        exit()
### BUGGY CODE ###

N,K=map(int,input().split())
x=[int(i) for i in input().split()]

import bisect

cost=10**13

for i in range(N-K+1):
    x2=x[i:i+K]
    c=min(abs(min(x2[0],0)),max(0,x2[-1]))*2 + max((-1)*x2[0],x2[-1])
    cost=min(cost,c)

print(cost)


### FIXED CODE ###

N,K=map(int,input().split())
x=[int(i) for i in input().split()]

cost=10**13

for i in range(N-K+1):
    c=x[i+K-1]-x[i]+min(abs(x[i]),abs(x[i+K-1]))
    cost=min(cost,c)

print(cost)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
B = [0]*N
A.sort()

for i in range(len(B)):
  for j in range(N):
    if A[i]%A[j] == 0 and i != j:
      B[i] = 1
print(N-sum(B))

### FIXED CODE ###

import numpy as np
N = int(input())
A = list(map(int,input().split())) + [10**6+1]
A.sort()
B = np.zeros(10**6+1)
count = 0
for i in range(N):
  if B[A[i]] == 0:
    B[::A[i]] = 1
    if A[i] != A[i+1]:
      count += 1
print(count)
### BUGGY CODE ###

k = int(input())
i = 1
a = 7
a %= k
while a != 0:
  i += 1
  a = (10*a + 7) % k
  if i == 10**9+7:
    i = -1
    break

print(i)

### FIXED CODE ###

k = int(input())
i = 1
a = 7
a = a % k
while a != 0:
  i += 1
  a = (10*a + 7) % k
  if i == 10**6:
    i = -1
    break

print(i)