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

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

def main():
    H, W = mapint()
    ch, cw = mapint()
    dh, dw = mapint()
    maze = [list(input()) for _ in range(H)]
    
    dirc = set([(-1, 0), (1, 0), (0, -1), (0, 1)])
    from collections import deque
    Q = deque([(ch-1, cw-1)])
    
    dist = [[10**18]*W for _ in range(H)]
    dist[ch-1][cw-1] = 0
    while Q:
        y, x = Q.popleft()
        for dy in range(-2, 3):
            for dx in range(-2, 3):
                ny, nx = y+dy, x+dx
                if ny<0 or ny>=H or nx<0 or nx>=W:
                    continue
                if maze[ny][nx]=='#':
                    continue
                if (dy, dx) in dirc:
                    if dist[ny][nx]>dist[y][x]:
                        dist[ny][nx] = dist[y][x]
                        Q.append((ny, nx))
                else:
                    if dist[ny][nx]>dist[y][x]+1:
                        dist[ny][nx] = dist[y][x]+1
                        Q.append((ny, nx))
    if dist[dh-1][dw-1]>=10**17:
        print(-1)
    else:
        print(dist[dh-1][dw-1])
main()

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

def main():
    H, W = mapint()
    ch, cw = mapint()
    dh, dw = mapint()
    maze = [list(input()) for _ in range(H)]
    
    dirc = ((-1, 0), (1, 0), (0, -1), (0, 1))
    magic = ((-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2), (-1, -2), (-1, -1), (-1, 1), (-1, 2), (0, -2), (0, 2), (1, -2), (1, -1), (1, 1), (1, 2), (2, -2), (2, -1), (2, 0), (2, 1), (2, 2))
    from collections import deque
    Q = deque([(ch-1, cw-1)])
    
    dist = [[10**18]*W for _ in range(H)]
    dist[ch-1][cw-1] = 0
    while Q:
        y, x = Q.popleft()
        for dy, dx in dirc:
            ny, nx = y+dy, x+dx
            if ny<0 or ny>=H or nx<0 or nx>=W:
                continue
            if maze[ny][nx]=='#':
                continue
            if dist[ny][nx]>dist[y][x]:
                dist[ny][nx] = dist[y][x]
                Q.appendleft((ny, nx))
        
        for dy, dx in magic:
            ny, nx = y+dy, x+dx
            if ny<0 or ny>=H or nx<0 or nx>=W:
                continue
            if maze[ny][nx]=='#':
                continue
            if dist[ny][nx]>dist[y][x]+1:
                dist[ny][nx] = dist[y][x]+1
                Q.append((ny, nx))
    if dist[dh-1][dw-1]>=10**17:
        print(-1)
    else:
        print(dist[dh-1][dw-1])
main()
### BUGGY CODE ###

n,q=map(int,input().split())
s=input()
for i in range(q):
    l,r=map(int,input().split())
    count=0
    for j in range(l-1,r-1):
        count+=(s[j:j+2]=="AC")
    print(count)

### FIXED CODE ###

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

n = int(input())
s = list(map(int,input().split()))
t = []
r = []
o = 0
for i in range(n):
    if s[i] not in t:
        t.append(s[i])
        r.append(1)
    else:
        p = t.index(s[i])
        r[p] += 1

for i in range(len(t)):
    q = r[i] - t[i]
    if q >= 0:
        o += q
    else:
        o += r[i]

print(o)

### FIXED CODE ###

n = int(input())
s = list(map(int,input().split()))
t = {}
o = 0
for i in range(n):
    if s[i] not in t.keys():
        t[s[i]] = 1
    else:
        t[s[i]] += 1

for i,j in t.items():
    if i > j:
        o += j
    else:
        o += j - i

print(o)
### BUGGY CODE ###

import collections

n=int(input())
s=[input() for _ in range(n)]

lis=[collections.Counter(list(s[i])) for i in range(n)]
cnt=0
for i in range(n):
    for j in range(i+1,n):
        if lis[i].items()==lis[j].items(): cnt+=1
print(cnt)


### FIXED CODE ###

import collections

n=int(input())
s=[(input()) for _ in range(n)]

lis=[list(s[i]) for i in range(n)]
lis_sort = [sorted(lis[i]) for i in range(n)]
lis_sort = [''.join(lis_sort[i]) for i in range(n)]
lis_sort.sort()

c = collections.Counter(lis_sort)
values, counts = zip(*c.most_common(len(c)))
cnt=0
for i in range(len(counts)):
    if counts[i]==2: cnt+=1
    elif counts[i]>2: cnt+=counts[i]*(counts[i]-1)//2
print(cnt)
### BUGGY CODE ###

N = int(input())
mod = 998244353
# DP ナップサックぽいやつ
# DP[i][j] := a_0からa_iまでの部分集合で和がjになるものの個数
# 配るDPの方が場合分けがなくて簡潔に書ける 計算量増えるかも
# DP[i-1][j]→DP[i][j]とDP[i][j + a_i ]に配る

aaa = [int(input()) for _ in range(N)]
sum_aaa = sum(aaa)

sum_now = 0
DP = [[0] * (sum_aaa+1) for i in range(N)]
DP2 = [[0] * (sum_aaa+1) for i in range(N)]

a = aaa[0]
DP[0][0] = 2
DP[0][a] = 1

DP2[0][0] = 1
DP2[0][a] = 1

sum_now += a

for i in range(1, N):
	a = aaa[i]
	sum_now += a
	for j in range(sum_now + 1):

		if (j >= a):
			DP[i][j] = DP[i-1][j]*2 + DP[i-1][j-a]
		else:
			DP[i][j] = DP[i-1][j]*2

		while (DP[i][j] > mod):
			DP[i][j] -= mod

	for j in range(min(sum_now + 1, int(sum_aaa /2)+1)):
		if (j >= a):
			DP2[i][j] = DP2[i-1][j] + DP2[i-1][j-a]
		else:
			DP2[i][j] = DP2[i-1][j]

		while (DP2[i][j] > mod):
			DP2[i][j] -= mod

# print(DP2)
minimum_invalid_length = int((sum_now+1)//2)
num_too_long = sum (DP[N-1][minimum_invalid_length:])
if (sum_aaa %2 == 0):
	num_too_long -= DP2[N-1][int(sum_aaa /2)]
# print(num_too_long)
# print(sum(aaa))
print((3** N - num_too_long * 3) % mod )


### FIXED CODE ###

N = int(input())
mod = 998244353
# DP ナップサックぽいやつ
# DP[i][j] := a_0からa_iまでの部分集合で和がjになるものの個数
# 配るDPの方が場合分けがなくて簡潔に書ける 計算量増えるかも
# DP[i-1][j]→DP[i][j]とDP[i][j + a_i ]に配る

aaa = [int(input()) for _ in range(N)]
sum_aaa = sum(aaa)

sum_now = 0
DP = [[0] * (sum_aaa+1) for i in range(N)]
DP2 = [[0] * (sum_aaa+1) for i in range(N)]

a = aaa[0]
DP[0][0] = 2
DP[0][a] = 1

DP2[0][0] = 1
DP2[0][a] = 1

sum_now += a

for i in range(1, N):
	a = aaa[i]
	sum_now += a
	for j in range(sum_now + 1):

		if (j >= a):
			DP[i][j] = DP[i-1][j]*2 + DP[i-1][j-a]
		else:
			DP[i][j] = DP[i-1][j]*2

		while (DP[i][j] > mod):
			DP[i][j] -= mod

	for j in range(min(sum_now + 1, int(sum_aaa /2)+1)):
		if (j >= a):
			DP2[i][j] = DP2[i-1][j] + DP2[i-1][j-a]
		else:
			DP2[i][j] = DP2[i-1][j]

		while (DP2[i][j] > mod):
			DP2[i][j] -= mod

# print(DP2)
minimum_invalid_length = int((sum_now+1)//2)
num_too_long = sum (DP[N-1][minimum_invalid_length:])
if (sum_aaa %2 == 0):
	num_too_long -= DP2[N-1][int(sum_aaa /2)]
# print(num_too_long)
# print(sum(aaa))
print((3** N - num_too_long * 3) % mod )
### BUGGY CODE ###

distance,num = map(int, input().split())
tmp = input()
a = tmp.split()
a = list(map(int,a))
b = []

for i in range(len(a)-1):
    b.append(a[i+1] - a[i])
b.append(distance - a[i+1] + a[0])

total = 0
min = 10000000000
for i in range(num):
    total = b[i]
    j = i + 1
    if i == 0:
        end = num - 1
    else:
        end = i - 1
    while(j != end):
        if j == num:
            j = 0
        else:
            total += b[j]
            j += 1
    if min > total:
        min = total

for i in range(num):
    total = b[i]
    j = i - 1
    if i == num - 1:
        end = 0
    else:
        end = i + 1
    while(j != end):
        if j == -1:
            j = num - 1
        else:
            total += b[j]
            j -= 1
    if min > total:
        min = total

print(min)

### FIXED CODE ###

distance,num = map(int, input().split())
tmp = input()
a = tmp.split()
a = list(map(int,a))
b = []

for i in range(len(a)-1):
    b.append(a[i+1] - a[i])
b.append(distance - a[i+1] + a[0])

b = sorted(b)
min = 0
for i in range(len(b)-1):
    min += b[i]

print(min)
### BUGGY CODE ###

# 2020-05-22
def main():
    n, m, k = [int(x) for x in input().split()]
    friends = [set() for _ in range(n)]
    blocks = [set() for _ in range(n)]
    for _ in range(m):
        a, b = [int(x) - 1 for x in input().split()]
        friends[a].add(b)
        friends[b].add(a)
    for _ in range(k):
        a, b = [int(x) - 1 for x in input().split()]
        blocks[a].add(b)
        blocks[b].add(a)

    networks = {}  # The dict of networks as sets. Keys are leaders.
    net_leaders = [-1] * n  # The leaders of the networks that the ones joined.
    visited = [False] * n
    for person in range(n):
        if visited[person]:
            continue
        networks[person] = set()
        stack = [person]
        while stack:
            new = stack.pop()
            visited[new] = True
            net_leaders[new] = person
            networks[person].add(new)
            for adj in friends[new]:
                if visited[adj]:
                    continue
                stack.append(adj)

    answers = []
    for person in range(n):
        net = networks[net_leaders[person]]
        ans = len(net) - len(friends[person]) - 1
        for block in blocks[person]:
            if block in net:
                ans -= 1
        answers.append(ans)

    print(*answers)
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

# 2020-05-22
def main():
    n, m, k = [int(x) for x in input().split()]
    friends = [set() for _ in range(n)]
    blocks = [set() for _ in range(n)]
    for _ in range(m):
        a, b = [int(x) - 1 for x in input().split()]
        friends[a].add(b)
        friends[b].add(a)
    for _ in range(k):
        a, b = [int(x) - 1 for x in input().split()]
        blocks[a].add(b)
        blocks[b].add(a)

    networks = {}  # The dict of networks as sets. Keys are leaders.
    net_leaders = [-1] * n  # The leaders of the networks that the ones joined.
    visited = [False] * n
    for person in range(n):
        if visited[person]:
            continue
        network = set()
        network_add = network.add
        stack = [person]
        stack_append = stack.append
        stack_pop = stack.pop
        while stack:
            new = stack_pop()
            visited[new] = True
            net_leaders[new] = person
            network_add(new)
            for adj in friends[new]:
                if visited[adj]:
                    continue
                stack_append(adj)
        networks[person] = network

    answers = []
    answers_append = answers.append
    for person in range(n):
        net = networks[net_leaders[person]]
        ans = len(net) - len(friends[person]) - 1
        for block in blocks[person]:
            if block in net:
                ans -= 1
        answers_append(ans)

    print(*answers)
    return


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

s = input()
k = int(input())
kouho = set()
n = len(s)
for i in range(n):
    for j in range(i,n):
        kouho.add(s[i:j+1])
kouho = list(kouho)
kouho.sort()
print(kouho[k-1])

### FIXED CODE ###

s = input()
k = int(input())
kouho = set()
n = len(s)
for i in range(n):
    for j in range(i,min(n,i+5)):
        kouho.add(s[i:j+1])
kouho = list(kouho)
kouho.sort()
print(kouho[k-1])
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split(" ")))
A.sort()
used = [0] * N
pow2_set = reversed([ 1<<i for i in range(36)])
ans = 0

for pow2 in pow2_set:
    l,r = 0,N-1
    while l < r:
        if A[l] + A[r] < pow2:
            l += 1
        elif A[l] + A[r] == pow2:
            if used[l] == 0 and used[r] == 0:
                ans += 1
                used[l],used[r] = 1,1
            else:
                if used[l] == 1:
                    l += 1
                if used[r] == 1:
                    r -= 1
        else:
            r -= 1

print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split(" ")))
A.sort()
used = [0] * N
pow2_set = reversed([ 1<<i for i in range(36)])
ans = 0
for pow2 in pow2_set:
    l,r = 0,N-1
    while l < r:
        if A[l] + A[r] < pow2:
            l += 1
        elif A[l] + A[r] == pow2:
            if used[l] == 0 and used[r] == 0:
                ans += 1
                used[l],used[r] = 1,1
            else:
                if used[l] == 1:
                    l += 1
                if used[r] == 1:
                    r -= 1
        else:
            r -= 1
 
print(ans)
### BUGGY CODE ###

flags = None
ms = None

def solve(A, index, s):
	s += A[0]
	now_index = [i for i in index if ms[i]>=s and not flags[i]]
	for idx in now_index:
		if ms[idx] == s:
			flags[idx]=True
			now_index.remove(idx)

	if len(A) != 1:
		solve(A[1:], now_index, s)
		solve(A[1:], index, s-A[0])


def main():
	n = int(input())
	A = input()
	A = list(map(int, A.split()))
	q = int(input())
	m = input()
	global ms
	ms = list(map(int, m.split()))
	global flags
	flags = [False for i in range(q)]
	index = list(range(q))
	solve(A, index, 0)
	for flag in flags:
		if flag:
			print('yes')
		else:
			print('no')

if __name__ == '__main__':
	main()

### FIXED CODE ###

def power_set(A, s):
	if len(A) == 0:
		return {s}
	else:
		return power_set(A[1:], s) | power_set(A[1:], s+A[0])

def main():
	n = int(input())
	A = input()
	#print(n)
	A = list(map(int, A.split()))
	q = int(input())
	m = input()
	ms = list(map(int, m.split()))
	powerset = power_set(A, 0)
	
	for m in ms:
		if m in powerset:
			print('yes')
		else:
			print('no')

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

class Dijkstra():
    """ ダイクストラ法
    重み付きグラフにおける単一始点最短路アルゴリズム

    * 使用条件
        - 負のコストがないこと
        - 有向グラフ、無向グラフともにOK

    * 計算量はO(E*log(V))

    * ベルマンフォード法より高速なので、負のコストがないならばこちらを使うとよい
    """
    class Edge():
        """ 重み付き有向辺 """
        def __init__(self, _to, _cost):
            self.to = _to
            self.cost = _cost

    def __init__(self, V):
        """ 重み付き有向辺
        無向辺を表現したいときは、_fromと_toを逆にした有向辺を加えればよい

        Args:
            V(int): 頂点の数
        """
        self.G = [[] for i in range(V)]  # 隣接リストG[u][i] := 頂点uのi個目の隣接辺
        self._E = 0  # 辺の数
        self._V = V  # 頂点の数

    @property
    def E(self):
        """ 辺数
        無向グラフのときは、辺数は有向グラフの倍になる
        """
        return self._E

    @property
    def V(self):
        """ 頂点数 """
        return self._V

    def add(self, _from, _to, _cost):
        """ 2頂点と、辺のコストを追加する """
        self.G[_from].append(self.Edge(_to, _cost))
        self._E += 1

    def shortest_path(self,s):

        import heapq
        que=[]
        D=[(10**15,L)] * self.V
        D[s]=(0,0)
        heapq.heappush(que,((0,0),s))

        while len(que)!=0:
            cost,v=heapq.heappop(que)
            a,b=cost
            c,d=D[v]

            if a>c:
                continue
            elif a==c and b>d:
                continue

            for i in range(len(self.G[v])):
                e=self.G[v][i]
                a,b=D[e.to]
                nokori=L-cost[1]
                if nokori>=e.cost:
                    c,d=cost[0],cost[1]+e.cost
                else:
                    c,d=cost[0]+1,e.cost
                if a>c or (a==c and b>d):
                    D[e.to]=(c,d)
                    heapq.heappush(que,(D[e.to],e.to))

        return D

N,M,L=map(int,input().split())
city=Dijkstra(N)
for i in range(0,M):
    a,b,c=map(int,input().split())
    if L>=c:
        city.add(a-1,b-1,c)
        city.add(b-1,a-1,c)

ans=[city.shortest_path(i) for i in range(0,N)]

p=[]

Q=int(input())
for i in range(0,Q):
    s,t=map(int,input().split())
    if ans[s-1][t-1]!=(10**15,L):
        p.append(ans[s-1][t-1][0])
    else:
        p.append(-1)

for i in range(0,Q):
    print(p[i])

### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

N,M,L=map(int,input().split())
d=[[0 for i in range(0,N)] for i in range(0,N)]
for i in range(0,M):
    a,b,c=map(int,input().split())
    d[a-1][b-1]=c
    d[b-1][a-1]=c

csr1=csr_matrix(d)

a=floyd_warshall(csr1)

d=[[0 for i in range(0,N)] for j in range(0,N)]
for i in range(0,N):
    for j in range(0,N):
        if L>=a[i][j]:
            d[i][j]=1


csr2=csr_matrix(d)

data=floyd_warshall(csr2)
ans=[]
Q=int(input())
for i in range(0,Q):
    s,t=map(int,input().split())
    if data[s-1][t-1]!=float('inf'):
        ans.append(int(data[s-1][t-1])-1)
    else:
        ans.append(-1)

for i in range(Q):
    print(ans[i])
### BUGGY CODE ###

s_list = list(input().split()[0])
count_list = [0] * len(s_list)

# 最初がRだった子は、Rが連続する限り右へ行く。最初にLが出た瞬間が打ち止め
# 最初がLだった子は、Lが連続する限り左へ行く。最初にRが出た瞬間が打ち止め
for child_i, start_s in enumerate(s_list):
    # print(count_list)
    # print('{}人目'.format(child_i))
    # 明らかにこれは計算時間がかかりすぎる
    count = 0
    stop_s = 'L' if start_s == 'R' else 'R'
    if start_s == 'R':
        for now_s in s_list[child_i+1:]:
            count += 1
            if now_s == 'R':
                continue
            else:
                break
        now_index = child_i + count
        if (10 ** 100 - count) % 2 == 0:
            count_list[now_index] += 1
        else:
            count_list[now_index-1] += 1

    if start_s == 'L':
        copy_list = reversed(s_list[:child_i])
        for now_s in copy_list:
            count += 1
            if now_s == 'L':
                continue
            else:
                break

        now_index = child_i - count
        if (10 ** 100 - count) % 2 == 0:
            count_list[now_index] += 1
        else:
            count_list[now_index+1] += 1
    # print('now_index = {}'.format(now_index))

ans = ' '.join([str(x) for x in count_list])
print(ans)

### FIXED CODE ###

# https://atcoder.jp/contests/abc136/tasks/abc136_d
# D - Gathering Children
import math
# 一番近いRLはどこか？

s_list = list(input().split()[0])
count_list = [0] * len(s_list)

# 最初がRだった子は、Rが連続する限り右へ行く。最初にLが出た瞬間が打ち止め
# 最初がLだった子は、Lが連続する限り左へ行く。最初にRが出た瞬間が打ち止め
rrl_list = ''.join(s_list).split('LR')
count_index = 0

for i, rrl in enumerate(rrl_list):
    if i != 0:
        rrl = 'R' + rrl
    if i != len(rrl_list) - 1:
        rrl = rrl + 'L'
    rl_r_index = rrl.find('RL')
    # rl_r_indexから偶数歩離れているマス目の数は
    # 左側
    r_count = math.floor(rl_r_index / 2)
    # print('左側：{}'.format(r_count))
    # 右側
    # print('右側: {}'.format(math.floor((len(rrl) - (rl_r_index+1)) / 2) + 1))
    r_count += math.floor((len(rrl) - (rl_r_index+1)) / 2) + 1

    l_count = len(rrl) - r_count
    count_list[count_index + rl_r_index] = r_count
    count_list[count_index + rl_r_index + 1] = l_count
    count_index += len(rrl)
    # print(rrl)
    # print(count_list)

ans = ' '.join([str(x) for x in count_list])
print(ans)
### BUGGY CODE ###

import math
import sys
readline = sys.stdin.readline


def main():
    n, k = map(int, readline().rstrip().split())
    a = list(map(int, readline().rstrip().split()))
    setA = list(set(a))
    arr = [0] * len(setA)
    for l in range(len(setA)):
        arr[l] = a.count(setA[l])
    print(sum(sorted(arr, reverse=True)[k: len(arr)]))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
import sys
from collections import Counter
readline = sys.stdin.readline


def main():
    n, k = map(int, readline().rstrip().split())
    a = list(map(int, readline().rstrip().split()))
    c = Counter(a)
    print(sum(sorted(c.values(), reverse=True)[k: len(c)]))


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

s = input()
d = True
q = int(input())
for _ in range(q):
    a = input().split()
    if a[0] == '1':
        d = not d
    else:
        if a[1] == '1':
            if d:
                s = a[2] + s
            else:
                s = s + a[2]
        else:
            if d:
                s = s + a[2]
            else:
                s = a[2] + s

if not d:
    print(s[::-1])
else:
    print(s)


### FIXED CODE ###

s = input()
d = True
f = '' # Front
b = '' # Back
q = int(input())
for _ in range(q):
    a = input().split()
    if a[0] == '1':
        d = not d
    else:
        if a[1] == '1':
            if d:
                f = ''.join([a[2], f])
            else:
                b = ''.join([b, a[2]])
        else:
            if d:
                b = ''.join([b, a[2]])
            else:
                f = ''.join([a[2], f])

if not d:
    print(''.join([b[::-1], s[::-1], f[::-1]]))
else:
    print(''.join([f, s, b]))
### BUGGY CODE ###

from functools import reduce
from operator import mul
n = int(input())
a_list = [int(x) for x in input().split()]
ans = reduce(mul, a_list)
print(ans if ans <= 10 ** 18 else -1)

### FIXED CODE ###

n = int(input())
a_list = sorted([int(x) for x in input().split()], reverse=True)

if a_list[-1] == 0:
    print(0)
    exit()

ans = 1
s = 10 ** 18
for a in a_list:
    ans *= a
    if ans > s:
        ans = -1
        break
print(ans)
### BUGGY CODE ###

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

A = max(a)

cnt = [0]*(A+1)
uq = []

for i in a:
    cnt[i] += 1

for i in range(A+1):
    if cnt[i] == 1:
        uq.append(i)

cnt = [0]*((10**6)+1)
cnt1 = 0


a = list(set(a))

for i in a:
    for j in range(2,A+1):
        if i*j<=A+1:
            cnt[i*j] = 1

for i in uq:
    if cnt[i] == 0:
        cnt1 += 1

print(cnt1)


### FIXED CODE ###

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

A = max(a)

cnt = [0]*(A+1)
uq = []

for i in a:
    cnt[i] += 1

for i in range(A+1):
    if cnt[i] == 1:
        uq.append(i)

cnt = [0]*((10**6)+1)
cnt1 = 0


a = list(set(a))

# for i in a:
#     for j in range(2,A+1):
#         if i*j<=A+1:
#             cnt[i*j] = 1

for elem in a:
    for m in range(elem * 2, (10 ** 6) + 1, elem):
        cnt[m] = 1

for i in uq:
    if cnt[i] == 0:
        cnt1 += 1

print(cnt1)
### BUGGY CODE ###

from bisect import bisect_left, bisect_right

N, K = map(int, input().split())
As = sorted(map(int, input().split()))
        
l = - (10 ** 18 + 10)
r = 10 ** 18 + 10
while r - l > 1:
    mid = (l + r) // 2
    count = 0
    for i, A in enumerate(As):
        if A > 0:
            count += bisect_right(As, mid//A, lo = i+1) - (i+1)
        elif A < 0:
            count += N - bisect_left(As, -((-mid)//A), lo = i+1)
        else:
            if mid >= 0:
                count += N - i - 1
        if count >= K:
            r = mid
            break
    else:
        l = mid

print(r)


### FIXED CODE ###

from bisect import bisect_left, bisect_right

N, K = map(int, input().split())
As = sorted(map(int, input().split()))
        
l = - (10 ** 18 + 10)
r = 10 ** 18 + 10
while True:
    mid = (l + r) // 2
    count = 0
    for i, A in enumerate(As):
        if A > 0:
            count += bisect_right(As, mid//A, lo = i+1) - (i+1)
        elif A < 0:
            count += N - bisect_left(As, -((-mid)//A), lo = i+1)
        else:
            if mid >= 0:
                count += N - i - 1
    if count < K:
        l = mid
    else:
        r = mid
    if r - l == 1:
        break

print(r)
### BUGGY CODE ###

n=int(input())
x=0
for a in range(1,n):
  for b in range(1,n):
    if a*b<n:
      x+=1
    else:
      break
print(x)


### FIXED CODE ###

n=int(input())
x=0
for a in range(1,n):
  for b in range(1,n):
    if a*b<n:
      x+=1
    elif a*b>=n:
      break
print(x)