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



import sys


N, M = map(int, input().split())
uvs = [list(map(lambda x:int(x)-1, input().split())) for _ in range(M)]
S, T = map(lambda x:int(x)-1, input().split())

roots = [[] for _ in range(N)]

for uv in uvs:
    roots[uv[0]].append(uv[1])

costs = [-10000 for _ in range(N)]

from collections import deque

todo = deque([S])
costs[S] = 0

while len(todo)>0:
    checking = todo.popleft()
    next_targets = deque([checking])
    for i in range(3):
        purposes = []
        while len(next_targets) > 0:
            now = next_targets.pop()
            for root in roots[now]:
                purposes.append(root)
        next_targets = deque(purposes)
    for next_target in next_targets:
        if costs[next_target] == -10000:
            costs[next_target] = costs[checking]+1
            todo.append(next_target)
        if next_target == T:
            print(costs[next_target])
            sys.exit()
print(-1)

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul  7 18:47:41 2020

@author: naoki
"""
import sys
import copy
def func():
    N, M = map(int, input().split())
    uvs = [list(map(lambda x:int(x)-1, input().split())) for _ in range(M)]
    S, T = map(lambda x:int(x)-1, input().split())
    
    roots = [[] for _ in range(N)]
    
    for uv in uvs:
        roots[uv[0]].append(uv[1])
    
    costs = [-10000]*(N)
    
    from collections import deque
    
    todo = deque([S])
    costs[S] = 0
    todo_set = set([S])
    
    layers = [set() for _ in range(3)]
    
    while len(todo)>0:
        checking = todo.popleft()
        next_targets = deque([checking])
        for i in range(3):
            purposes = set()
            while len(next_targets) > 0:
                now = next_targets.pop()
                for root in roots[now]:
                    if root not in layers[i]:
                        layers[i].add(root)
                        purposes.add(root)
            next_targets = purposes.copy()
        for next_target in next_targets:
            if costs[next_target] < 0 and next_target not in todo_set:
                costs[next_target] = costs[checking]+1
                todo.append(next_target)
                todo_set.add(next_target)
                if next_target == T:
                    print(costs[next_target])
                    sys.exit()
    print(-1)
if __name__ == "__main__":
    func()
### BUGGY CODE ###

A, B = map(int, input().split())
result = A
for i in range(A+1, B+1):
    result = result ^ i
print(result)

### FIXED CODE ###

A, B = map(int, input().split())
if A % 2 == 0:
    num = B - A
    result = 0
else:
    num = (B - (A + 1))
    result = A
if num // 2 % 2 == 0:
    result ^= 0
else:
    result ^= 1
if num % 2 == 1:
    result ^= (B-1)
result ^= B
print(result)
### BUGGY CODE ###

x = int(input())
count = 0
sum = 0
while sum<x:
    sum+=6
    count+=1
    if sum>=x:break
    sum+=5
    count+=1
print(count)


### FIXED CODE ###

x=int(input())
count=0
sum=0
count=(x//11)*2
if x%11!=0:
  if 7<=x%11<=10:
    count+=2
  else:
    count+=1
print(count)
### BUGGY CODE ###

n, m = map(int, input().split())
a = [int(input()) for x in range(m)]
mod = 10**9 + 7

l = [1]
if 1 in a:
  l.append(0)
else:
  l.append(1)

for i in range(2, n+1):
  if i in a:
    if l[i-1] == 0:
      print(0)
      exit()
    else:
      l.append(0)
  else:
    l.append((l[i-2] + l[i-1]) % mod)
print(l[-1])


### FIXED CODE ###

n, m = map(int, input().split())
a = set([int(input()) for x in range(m)])

l = [0]*(n+1)
l[0] = 1

for i in range(1, n+1):
  if i in a:
    l[i] = 0
    continue
  else:
    l[i] = l[i-2] + l[i-1]

print(l[-1] % 1000000007)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = 0
for a in A:
    cnt = 0
    for i in range(1,a + 1):
        if a % 2**i == 0:
            cnt += 1
    else:
        ans += cnt
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = 0
for a in A:
    cnt = 0
    for i in range(1,a + 1):
        if a % 2**i == 0:
            cnt += 1
        else:
            break
    ans += cnt
print(ans)
### BUGGY CODE ###

n = int(input())

line=[]
c=0

for i in range(n):
    string = sorted(list(input()))
    # print(string)
    c+=line.count(string)
    line.append(string)

print(c)

### FIXED CODE ###

n = int(input())

line={}
c=0

for i in range(n):
    string = ''.join(sorted(list(input())))
    # print(string)
    if string in line:
        c+=line[string]
    if string in line:
        line[string]+=1
    else:
        line[string]=1
    # print(line,c)

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

import  heapq

n,m,s,t=map(int,raw_input().split())
src = [ tuple( map( int, raw_input().split() ) )   for i in range(m)]

nl=[ [ ] for j in range(n+1) ] 

for u,v,a,b in src:
	nl[u].append( (v,a,b) )
	nl[v].append( (u,a,b) )

#Dijkstra yen
d_y=[ float("inf") ]*(n+1)
d_y[s]=0

Q=[]
heapq.heappush(Q,s)

while Q:
	u=heapq.heappop(Q)
	for v,yen,snuuk in nl[u]:
		alt=d_y[u]+yen
		if d_y[v]> alt:
			d_y[v]=alt
			heapq.heappush(Q,v)

#Dijkstra snuuk
d_s=[ float("inf")]*(n+1)
d_s[t]=0

Q=[]
heapq.heappush(Q,t)

while Q:
	u=heapq.heappop(Q)
	for v,yen,snuuk in nl[u]:
		alt=d_s[u]+snuuk
		if d_s[v]> alt:
			d_s[v]=alt
			heapq.heappush(Q,v)


val=float("inf")
A=[]
for i in range(n,0,-1):
	tmp=d_y[i]+d_s[i]
	val=min(val, tmp)
	A.append(val)

for i in reversed(A):
	print 10**15-i

### FIXED CODE ###

import heapq
 
N,M,S,T = map(int,input().split())
S,T = S-1,T-1
src = [tuple(map(int,input().split())) for i in range(M)]
 
es = [[] for i in range(N)]
for u,v,a,b in src:
    u,v = u-1,v-1
    es[u].append((v,a,b))
    es[v].append((u,a,b))
 
INF = float('inf')
cy = [INF] * N
cy[S] = 0
hq = [(0,S)]
heapq.heapify(hq)
while hq:
    cost,v = heapq.heappop(hq)
    for to,a,b in es[v]:
        if cost + a >= cy[to]: continue
        cy[to] = cost + a
        heapq.heappush(hq, (cy[to],to))
 
cs = [INF] * N
cs[T] = 0
hq = [(0,T)]
heapq.heapify(hq)
while hq:
    cost,v = heapq.heappop(hq)
    for to,a,b in es[v]:
        if cost + b >= cs[to]: continue
        cs[to] = cost + b
        heapq.heappush(hq, (cs[to],to))
 
ans = [INF]
for i in reversed(range(N)):
    tmp = cs[i] + cy[i]
    ans.append(min(ans[-1],tmp))
 
for a in reversed(ans[1:]):
    print(10**15 - a)
### BUGGY CODE ###

import numpy as np

N = W = 0
g = []
MAX_V = 100100


def get_input():
    global N, W, g
    N, W = map(int, input().split())
    g = []
    for _ in range(N):
        g.append([int(x) for x in input().split()])


def dpcalc():
    global N, W, g
    # 動的計画法のテーブルを初期化
    dp = np.full((N + 1, MAX_V + 1), 10 ** 11)
    # dp = [[10 ** 11] * (MAX_V + 1) for _ in range(N + 1)]

    # テーブルをiの小さい方から順に計算してゆく
    for i in range(1, N + 1):
        for j in range(MAX_V + 1):
            w, v = g[i - 1]
            if j - v > 0:
                dp[i][j] = min(dp[i - 1][j - v]  +  w, dp[i - 1][j])
            else:
                dp[i][j] = min(dp[i - 1][j], w)

    for i in range(MAX_V, -1, -1):
        if dp[N][i] <= W:
            return i
    return 0


get_input()
print(dpcalc())


### FIXED CODE ###

import numpy as np

N = W = 0
g = []
MAX_V = 100100


def get_input():
    global N, W, g
    N, W = map(int, input().split())
    g = []
    for _ in range(N):
        g.append([int(x) for x in input().split()])


def dpcalc():
    global N, W, g
    # 動的計画法のテーブルを初期化
    dp = np.full((N + 1, MAX_V + 1), 10 ** 11)
    # dp = [[10 ** 11] * (MAX_V + 1) for _ in range(N + 1)]

    # テーブルをiの小さい方から順に計算してゆく
    r = 1
    for i in range(1, N + 1):
        w, v = g[i - 1]
        dp[i][:v + 1] = np.minimum(dp[i - 1][:v + 1], w)
        dp[i][v + 1:v + r] = np.minimum(dp[i - 1][1: r] + w, dp[i - 1][v + 1:v + r] )
        
        r += v
        
    for i in range(MAX_V, -1, -1):
        if dp[N][i] <= W:
            return i
    return 0


get_input()
print(dpcalc())
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
# from math import factorial


MOD = 1000000007  # type: int
# def cmb(n, r):
#     return (factorial(n) // (factorial(r) * factorial(n - r))%MOD)

def solve(S: str):
    S = S[::-1]
    dp = [[0] * 13 for _ in range(len(S))]
    # dp[LENGTH][MOD]

    s = S[0]
    if s == "?":
        for i in range(10):
            dp[0][i] = 1
    else:
        dp[0][int(s)] = 1
    for l in range(1, len(S)):
        s = S[l]
        pow_l = pow(10, l, 13)
        if s == "?":
            for m in range(13):
                for i in range(10):
                    dp[l][(m + pow_l * i) % 13] += dp[l-1][m]% MOD
        else:
            i = int(s)
            for m in range(13):
                dp[l][(m + pow_l * i) % 13] += dp[l-1][m] % MOD

    # print(dp)
    print(dp[-1][5]% MOD)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
# from math import factorial


MOD = 1000000007  # type: int
# def cmb(n, r):
#     return (factorial(n) // (factorial(r) * factorial(n - r))%MOD)

def solve(S: str):
    S = S[::-1]
    dp = [[0] * 13 for _ in range(len(S))]
    # dp[LENGTH][MOD]

    s = S[0]
    if s == "?":
        for i in range(10):
            dp[0][i] = 1
    else:
        dp[0][int(s)] = 1
    for l in range(1, len(S)):
        s = S[l]
        pow_l = pow(10, l, 13)
        if s == "?":
            for m in range(13):
                for i in range(10):
                    dp[l][(m + pow_l * i) % 13] += dp[l-1][m]% MOD
        else:
            i = int(s)
            for m in range(13):
                dp[l][(m + pow_l * i) % 13] += dp[l-1][m] % MOD

    # print(dp)
    print(dp[-1][5]% MOD)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

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

def main():
    import math
    N = int(input())


    def divisors(n):
        ret = set()
        for i in range(1, math.ceil(n**0.5)+1):
            if n % i == 0:
                if i != 1:
                    ret.add(i)
                ret.add(n // i)
        return ret


    s = divisors(N)
    ans = divisors(N-1)

    for x in s:
        n = N
        while(n % x == 0):
            n = n // x
        if n % x == 1:
            ans.add(x)

    print(len(ans))
main()

### FIXED CODE ###

def divisors(n):
    ret = set()
    for i in range(1, int(n**0.5)+2):
        if n % i == 0:
            ret.add(i)
            ret.add(n // i)
    ret.remove(1)
    return ret


def main():
    N = int(input())
    s = divisors(N)
    ans = divisors(N-1)

    for x in s:
        n = N
        if x == 1:
            continue
        while(n % x == 0):
            n = n // x
        if n % x == 1:
            ans.add(x)
    print(len(ans))


main()
### BUGGY CODE ###

import math
import copy
from copy import deepcopy
import sys
import fractions
import numpy as np
from functools import reduce
# import statistics
import heapq


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

data = getInputListInt()
N = data[0]
K = data[1]
MOD = 1000000000 + 7

c = np.empty((4005, 4005))

def init():
    c[0][0] = 1
    for i in range(4001):
        for j in range(0, i+1, 1):
            c[i+1][j] += c[i][j]
            c[i+1][j+1] += c[i][j]

def comb(n, k):
    return c[n][k]

def f2(n, k):
    return comb(n+k-1, k-1)

def f(n, k):
    if (n < k): return 0
    if(n == 0 and k == 0): return 1
    if(k < 1): return 0
    return f2(n-k, k)

init()

for i in range(1, K+1, 1):
    blue = f(K, i)
    red = f2(N-K-(i-1), i+1)

    ans = (blue * red) % MOD
    print(int(ans))


### FIXED CODE ###

import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def fast_pow(num, kata, mod):
        if kata == 0:
            return 0

        res = 1
        while kata > 0:
            if kata & 1 == 1:
                res = res * num % mod
            num = num * num % mod

            kata >>= 1
        return res

    # MODのCombination nがでかくても関係なくrに依存　r<10**6なら回せる
    MOD = 10 ** 9 + 7

    def choose(n, r):
        res = 1
        fac = 1
        for i in range(r):
            res *= n - i
            res %= MOD
            fac *= i + 1
            fac %= MOD
        return res * fast_pow(fac, MOD - 2, MOD) % MOD

    n, k = ns()

    for i in range(1, k + 1):
        blue_pair = choose(k - i + (i - 1), i - 1)
        red_pair = choose((n - k) + 1, i)
        print(blue_pair * red_pair % MOD)


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

import sys
readline = sys.stdin.readline
# intin = map( int, readline().rstrip().split() )

N = int(input())
S = input()

ans = 0
for x in range(0,1000):
    x = str(x)
    if len(x) == 1:
        x = "00" + x
    elif len(x) == 2 :
        x = "0" + x
    index = 0
    for s in S:
        if x[index] == s:
            index += 1
        if index == 3:
            ans += 1
            break

print(ans)

### FIXED CODE ###

import sys
readline = sys.stdin.readline
# intin = map( int, readline().rstrip().split() )

N = int(input())
S = input()

# 10^4 * 10^3 * 3 = 3* (10 ^7)

ans = 0
for x in range(0,1000):
    x = str(x)
    if len(x) == 1:
        x = "00" + x
    elif len(x) == 2 :
        x = "0" + x
    index = 0
    for s in S:
        if x[index] == s:
            index += 1
        if index == 3:
            ans += 1
            break

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

s = input()
t = input()
ls = len( s)
lt = len( t)
ANS = [ [""]*(ls+1) for _ in range(lt+1) ]
CNT = [ [0]*(ls+1) for _ in range(lt+1)]
for i in range(1,lt+1):
    for j in range(1,ls+1):
        if s[j-1] == t[i-1]:
            ANS[i][j] = ANS[i-1][j-1]+s[j-1]
            CNT[i][j] = CNT[i-1][j-1]+1
        else:
            if CNT[i][j-1] >= CNT[i-1][j]:
                ANS[i][j] = ANS[i][j-1]
                CNT[i][j] = CNT[i][j-1]
            else:
                ANS[i][j] = ANS[i-1][j]
                CNT[i][j] = CNT[i-1][j]
print( ANS[lt][ls])

### FIXED CODE ###

s = input()
t = input()
ls = len( s)
lt = len( t)
CNT = [ [0]*(ls+1) for _ in range(lt+1)]
for i in range(1,lt+1):
    for j in range(1,ls+1):
        if s[j-1] == t[i-1]:
            CNT[i][j] = CNT[i-1][j-1]+1
        else:
            if CNT[i][j-1] >= CNT[i-1][j]:
                CNT[i][j] = CNT[i][j-1]
            else:
                CNT[i][j] = CNT[i-1][j]
i = lt
j = ls
ans = ""
while i > 0 and j > 0:
    if t[i-1] == s[j-1]:
        ans += t[i-1]
        i -= 1
        j -= 1
    else:
        if CNT[i-1][j] > CNT[i][j-1]:
            i -= 1
        else:
            j -= 1
print( ans[::-1])
### BUGGY CODE ###

n, k = map(int, input().split())
lr = []
for _ in range(k):
    lr.append(tuple(map(int, input().split())))
mod = 998244353

dp = [0]*n
dp[0] = 1

acc = [0]*n
acc[0] = 1

for i in range(1, n):
    for l, r in lr:
        if 0 <= i-r and i-l < i:
            dp[i] += acc[i-l]-acc[i-r-1]
        elif i-r < 0 and i-l < i:
            dp[i] += acc[i-l]
        elif i-r < 0 and i <= i-l:
            dp[i] += acc[i-1]
        elif 0 < i-r and i <= i-l:
            dp[i] += acc[i-1]-acc[i-r-1]
    acc[i] = acc[i-1]+dp[i]

print(dp[-1]%mod)

### FIXED CODE ###

n, k = map(int, input().split())
lr = []
for _ in range(k):
    lr.append(tuple(map(int, input().split())))
mod = 998244353

dp = [0]*n
dp[0] = 1

acc = [0]*n
acc[0] = 1

for i in range(1, n):
    for l, r in lr:
        if 0 <= i-r and i-l < i:
            dp[i] += acc[i-l]-acc[i-r-1]
        elif i-r < 0 and i-l < i:
            dp[i] += acc[i-l]
        elif i-r < 0 and i <= i-l:
            dp[i] += acc[i-1]
        elif 0 < i-r and i <= i-l:
            dp[i] += acc[i-1]-acc[i-r-1]
    acc[i] = acc[i-1]+dp[i]%mod

print(dp[-1]%mod)
### BUGGY CODE ###

import itertools
n,k=map(int,input().split())
X,Y,XY=[],[],[]
for i in range(n):
  x,y=map(int,input().split())
  X.append(x)
  Y.append(y)
  XY.append([x,y])
def count(x1,x2,y1,y2):
  ct=0
  if x1>x2:
    x1,x2=x2,x1
  if y1>y2:
    y1,y2=y2,y1
  for x,y in XY:
    if x1<=x<=x2 and y1<=y<=y2:
      ct+=1
  return ct
ans=float("inf")
for x1,x2 in itertools.combinations(X,2):
  for y1,y2 in itertools.combinations(Y,2):
    if count(x1,x2,y1,y2)==k:
      ans=min(ans,abs((x1-x2)*(y1-y2)))
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline
import itertools
n,k=map(int,input().split())
X,Y,XY=[0]*n,[0]*n,[0]*n
for i in range(n):
  x,y=map(int,input().split())
  X[i],Y[i],XY[i]=x,y,[x,y]
X.sort()
Y.sort()
def count(x1,x2,y1,y2):
  ct=0
  for x,y in XY:
    if x1<=x<=x2 and y1<=y<=y2:
      ct+=1
  return ct
ans=float("inf")
for x1,x2 in itertools.combinations(X,2):
  for y1,y2 in itertools.combinations(Y,2):
    if count(x1,x2,y1,y2)==k:
      ans=min(ans,abs((x1-x2)*(y1-y2)))
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000)

N, M = map(int, input().split())
Alist = list(map(int, input().split()))

def solve(A, M):
    if len(A) > 1:
        if M==1:
            B = sum(A[1:]) + A[0]//2
        else:
            A = [A[0]//2] + A[1:]
            A.sort(reverse=True)
            B = solve(A, M-1)
    else:
        B = A[0] // (2**M)
    return B

Alist.sort(reverse=True)
B = solve(Alist, M)
print(B)

### FIXED CODE ###

import heapq
N, M = map(int, input().split())
Alist = list(map(int, input().split()))

q = []
for a in Alist:
    heapq.heappush(q, -a)

for i in range(M):
    m = heapq.heappop(q)
    heapq.heappush(q, -((-m)//2))

print(-sum(q))
### BUGGY CODE ###

#coding: utf-8

N = int(input())


s_list = []
for i in range(N):
    input_string = list(input())
    input_string.sort()
    s_list.append(input_string)

count = 0
s_list.sort()
while len(s_list) != 0:
    for i in range(1, len(s_list)):
        if s_list[0] == s_list[i]:
            count = count + 1
        else:
            break

    del(s_list[0])
print(count)


### FIXED CODE ###

#coding: utf-8

from collections import Counter
N = int(input())

s_list = []
for i in range(N):
    input_string = list(input())
    input_string.sort()
    input_string = "".join(input_string)
    s_list.append(input_string)

s_list.sort()

list_counter = Counter(s_list)

count = 0
for key in list_counter.keys():
    tmp_count = list_counter[key]
    if tmp_count < 2:
        pass
    elif tmp_count == 2:
        count += 1
    else:
        permutations = tmp_count * (tmp_count - 1)
        combination = permutations/2
        count += int(combination)

print(int(count))
### BUGGY CODE ###

import numpy as np

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

visited = np.zeros(10**6+1, dtype=np.int32)
ans = 0
for i in a:
    j = 1
    flg = True
    if a.count(i) >= 2:
        flg = False
    elif visited[i]:
        flg = False
    if flg:
        ans += 1        
    # print(i, flg)
    visited[i::i] += 1
print(ans)

### FIXED CODE ###

import numpy as np

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

m = np.zeros(max(a)+1, dtype=int)
cnt = 0

for i in a:
    m[::i] += 1
for i in a:
    if m[i] == 1:
        cnt += 1
print(cnt)
### BUGGY CODE ###

s = list(input())
q = int(input())

for i in range(q):
  query = list(input().split())
  if (int(query[0]) == 1):
    s.reverse()
  else:
    if (int(query[1]) == 1):
      s.insert(0, query[2])
    else:
      s.append(query[2])
  
print(''.join(s))




### FIXED CODE ###

from collections import deque

d = deque()
s = input()
d.append(s)
rev = 0
q = int(input())

for i in range(q):
  query = list(input().split())
  if (int(query[0]) == 1):
    rev = (rev + 1) % 2
  else:
    if ((int(query[1]) + rev) % 2 == 0):
      d.append(query[2])
    else:
      d.appendleft(query[2])

ans = ''.join(list(d))
if rev == 1:
  ans = ans[::-1]

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

import sys

if __name__ == '__main__':
    N, K = map(int, input().split())
    xy_list = [list(map(int, input().split())) for i in range(N)]

    all_x = sorted(list(set([xy[0] for xy in xy_list])))
    all_y = sorted(list(set([xy[1] for xy in xy_list])))

    answer = sys.maxsize
    for x1 in all_x:
        for x2 in [x2 for x2 in all_x if x2 > x1]:
            for y1 in all_y:
                for y2 in [y2 for y2 in all_y if y2 > y1]:
                    if K <= len([xy for xy in xy_list if (x1 <= xy[0] <= x2) and (y1 <= xy[1] <= y2)]) and answer > (x2-x1) * (y2-y1):
                        answer = (x2-x1) * (y2-y1)

    print(answer)

### FIXED CODE ###

import sys

if __name__ == '__main__':
    N, K = map(int, input().split())
    xy_list = [list(map(int, input().split())) for i in range(N)]

    all_x = sorted(list(set([xy[0] for xy in xy_list])))
    all_y = sorted(list(set([xy[1] for xy in xy_list])))

    answer = sys.maxsize
    for i in range(len(all_x)):
        x1 = all_x[i]
        for j in range(i+1, len(all_x)):
            x2 = all_x[j]
            for k in range(len(all_y)):
                y1 = all_y[k]
                for l in range(k+1, len(all_y)):
                    y2 = all_y[l]
                    if K <= len([xy for xy in xy_list if (x1 <= xy[0] <= x2) and (y1 <= xy[1] <= y2)]) and answer > (x2-x1) * (y2-y1):
                        answer = (x2-x1) * (y2-y1)

    print(answer)
### BUGGY CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

# 双方向グラフで幅優先探索

from collections import deque

n, m = map(int, input().split())
g = [set([]) for _ in range(n)]
#隣接リストの作成
for i in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    g[a].add(b)

graph = [set([]) for _ in range(n)]
for i in range(n):
    g1 = set([])
    g2 = set([])
    g3 = set([])
    g1 = g1 | g[i]
    for x in g1:
        g2 = g2 | g[x]
    for x in g2:
        g3 = g3 | g[x]
    graph[i] = g3

s, t = map(int, input().split())
s, t = s-1, t-1

#幅優先探索
q = deque()
level = [-1]*n
q.append(s)
level[s] = 0
while len(q)>0:
    cur = q.popleft()
    lvl = level[cur]
    for i in graph[cur]:
        if level[i]==-1:
            #階層
            level[i] = lvl + 1
            q.append(i)
print(level[t])


### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

# 双方向グラフで幅優先探索

from collections import deque

n, m = map(int, input().split())
g = [set([]) for _ in range(n)]
#隣接リストの作成
for i in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    g[a].add(b)

s, t = map(int, input().split())
s, t = s-1, t-1

#幅優先探索
q = deque()
level = [[-1]*n for i in range(3)]
q.append((s, 0))
level[0][s] = 0
while len(q)>0:
    cur, hp = q.popleft()
    lvl = level[hp][cur]
    for i in g[cur]:
        if level[(hp+1)%3][i]==-1:
            #階層
            level[(hp+1)%3][i] = lvl + 1
            q.append((i, (hp+1)%3))
print(level[0][t]//3)