CodeEff/ECCO huggingface dataset:
# Original solution
n, k = list(map(int, input().split()))
p = sorted([tuple(map(int, input().split())) for i in range(n)])
ans = 4 * 10**18
for i in range(k, n + 1):
    for j in range(n - i + 1):  # x座標に関して j から i + j まで含む
        x = p[i + j - 1][0] - p[j][0]
        s = sorted([p[a][1] for a in range(j, i + j)])
        y = min(s[a + k - 1] - s[a] for a in range(i - k + 1))
        ans = min(ans, x * y)
print(ans)


# Optimized solution
n, k = list(map(int, input().split()))
p = [tuple(map(int, input().split())) for i in range(n)]
p.sort()
ans = 4000000000000000000
for i in range(k, n + 1):
    for j in range(n - i + 1):
        x = p[i + j - 1][0] - p[j][0]
        s = [p[a][1] for a in range(j, i + j)]
        s.sort()
        y = 4000000000
        for a in range(i - k + 1):
          y = min(y, s[a + k - 1] - s[a])
        ans = min(ans, x * y)
print(ans)
# Original solution
n,h=list(map(int,input().split()))
p,x,y=[],[],[]
z=float("inf")
for i in range(n):
  a,b=list(map(int,input().split()))
  p.append((a,b))
  x.append(a)
  y.append(b)
x.sort()
y.sort()
for i in range(n-1):
  for j in range(i,n):
    for k in range(n-1):
      lx,rx,dy=x[i],x[j],y[k]
      c=0
      t=[]
      for a,b in p:
        if x[i]<=a<=x[j] and y[k]<=b:c+=1;t.append(b)
      if h<=c:z=min(z,(x[j]-x[i])*(sorted(t)[h-1]-y[k]))
print(z)

# Optimized solution
n,k=list(map(int,input().split()))
x=[]
y=[]
xy=[]
for _ in range(n):
  xx,yy=list(map(int,input().split()))
  xy.append((xx,yy))
  x.append(xx)
  y.append(yy)
xx=sorted(x)
yy=sorted(y)
ans=10**20
for sxi in range(n-1):
  for syi in range(n-1):
    for tyi in range(1,n):
      sx,sy,ty=xx[sxi],yy[syi],yy[tyi]
      ax=sorted([xxx for xxx,yyy in xy if sx<=xxx and sy<=yyy<=ty])
      if len(ax)<k:continue
      tx=ax[k-1]
      ans=min(ans,(tx-sx)*(ty-sy))
print(ans)
# Original solution
N,K=list(map(int,input().split()))
Points=[[int(i) for i in input().split()] for i in range(N)]
List_x=[Points[i][0] for i in range(N)]
List_x.sort(key=lambda x:x)
List_y=[Points[i][1] for i in range(N)]
List_y.sort(key=lambda x:x)
n=0
S=[]
for x1 in range(N-1):
  for x2 in range(x1+K-1,N):
    for y1 in range(N-1):
      for y2 in range(y1+K-1,N):
        for p in Points:
          if List_x[x1]<=p[0]<=List_x[x2] and List_y[y1]<=p[1]<=List_y[y2]:
            n+=1
          if n>=K:
            x_delta=List_x[x2]-List_x[x1]
            y_delta=List_y[y2]-List_y[y1]
            S.append(x_delta*y_delta)
            break
        if n>=K:
          n=0
          break  
        n=0
print((min(S)))  

# Optimized solution
N,K=list(map(int,input().split()))
Points=[[int(i) for i in input().split()] for i in range(N)]
List_x=[Points[i][0] for i in range(N)]
List_x.sort(key=lambda x:x)
List_y=[Points[i][1] for i in range(N)]
List_y.sort(key=lambda x:x)
n=0
Y=0
S=[]
for x1 in range(N-1):
  for x2 in range(x1+K-1,N):
    for y1 in range(N-1):
      for y2 in range(max([y1+K-1,Y]),N):
        for p in Points:
          if List_x[x1]<=p[0]<=List_x[x2] and List_y[y1]<=p[1]<=List_y[y2]:
            n+=1
          if n==K:
            x_delta=List_x[x2]-List_x[x1]
            y_delta=List_y[y2]-List_y[y1]
            S.append(x_delta*y_delta)
            break
        if n>=K:
          n=0
          Y=y2
          break  
        n=0
    Y=0    
print((min(S)))
# Original solution
N, K = list(map(int, input().split()))
X = [0] * N
Y = [0] * N
for i in range(N):
    x, y = list(map(int, input().split()))
    X[i] = x
    Y[i] = y

def count(x_min, x_max, y_min, y_max):
    cnt = 0
    for i in range(N):
        if x_min <= X[i] <= x_max and y_min <= Y[i] <= y_max:
            cnt += 1
    return cnt

ans = 10 ** 20
for i in range(N):
    for j in range(N):
        for k in range(N):
            for l in range(N):
                # print ('i, j , k, l = ', i, j, k, l)
                if X[i] < X[j] and Y[k] < Y[l]:
                    if count(X[i], X[j], Y[k], Y[l]) >= K:
                        # print ('A')
                        ans = min(ans, (X[j] - X[i]) * (Y[l] - Y[k]))
print (ans)



# Optimized solution
#PythonだとTLEする
N, K = list(map(int, input().split()))
X = [0] * N
Y = [0] * N
for i in range(N):
    x, y = list(map(int, input().split()))
    X[i] = x
    Y[i] = y

def count(x_min, x_max, y_min, y_max):
    cnt = 0
    for i in range(N):
        if x_min <= X[i] <= x_max and y_min <= Y[i] <= y_max:
            cnt += 1
    return cnt

ans = 10 ** 20
for i in range(N):
    for j in range(N):
        for k in range(N):
            for l in range(N):
                # print ('i, j , k, l = ', i, j, k, l)
                if X[i] < X[j] and Y[k] < Y[l]:
                    if count(X[i], X[j], Y[k], Y[l]) >= K:
                        # print ('A')
                        ans = min(ans, (X[j] - X[i]) * (Y[l] - Y[k]))
print (ans)
# Original solution
from itertools import combinations

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

xl = list([p[0] for p in points])
yl = list([p[1] for p in points])

def contained(point, xmin, xmax, ymin, ymax):
    return (xmin <= point[0] <= xmax) and (ymin <= point[1] <= ymax)

def count_contained(xmin, xmax, ymin, ymax):
    count = 0
    for point in points:
        if contained(point, xmin, xmax, ymin, ymax):
            count += 1
    return count

min_area = 10**20
for xs in combinations(xl, 2):
    xmin = min(xs)
    xmax = max(xs)
    for ys in combinations(yl, 2):
        ymin = min(ys)
        ymax = max(ys)
        if count_contained(xmin, xmax, ymin, ymax) >= K:
            area = (xmax-xmin) * (ymax-ymin)
            min_area = min(area, min_area)
print(min_area)


# Optimized solution
from itertools import combinations

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

points.sort(key=lambda p:p[0])


min_area = 10**20
for k in range(K, N+1):
    for l in range(0, N-k+1):
        points_tmp = points[l:l+k]
        points_tmp.sort(key=lambda p:p[1])
        for m in range(0, k-K+1):
            points_selected = points_tmp[m: m+K]
            ymin = points_selected[0][1]
            ymax = points_selected[-1][1]
            points_selected.sort(key=lambda p:p[0])
            xmin = points_selected[0][0]
            xmax = points_selected[-1][0]
            area = (xmax-xmin) * (ymax-ymin)
            min_area = min(area, min_area)

print(min_area)
# Original solution
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return list(zip(*(MAP() for _ in range(n))))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, K = MAP()
xy = [LIST() for _ in range(N)]
x, y = list(zip(*xy))

x = sorted(x)
y = sorted(y)

ans = INF
for ax, bx in combinations(x, 2):
	for ay, by in combinations(y, 2):
		cnt = 0
		for cx, cy in xy:
			if ax <= cx <= bx and ay <= cy <= by:
				cnt += 1
		if K <= cnt:
			ans = min(ans, (bx-ax)*(by-ay))

print(ans)

# Optimized solution
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return list(zip(*(MAP() for _ in range(n))))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
#from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, K = MAP()
xy = [LIST() for _ in range(N)]
ans = INF

xy.sort()
for l in range(N-K+1):  #長方形の最も左の点
	for r in range(l+K, N+1):  #長方形の最も右の点
		y = sorted(xy[l:r], key = lambda x: x[1]) #lからrの中でyのとりうる値をソート
		for i in range(r-l-K+1):
			sq = (xy[r-1][0] - xy[l][0])*(y[i+K-1][1] - y[i][1])
			ans = min(ans, sq)
print(ans)
# Original solution
from itertools import accumulate
from operator import add

N, K = list(map(int, input().split()))
xs, ys = [], []
for _ in range(N):
    x, y = list(map(int, input().split()))
    xs.append(x)
    ys.append(y)

iXs = list(range(N))
iXs.sort(key=lambda iX: xs[iX])
odrXs = [0]*(N)
for odrX, iX in enumerate(iXs):
    odrXs[iX] = odrX
iYs = list(range(N))
iYs.sort(key=lambda iY: ys[iY])
odrYs = [0]*(N)
for odrY, iY in enumerate(iYs):
    odrYs[iY] = odrY

Ass = [[0]*(N) for _ in range(N)]
for odrX, odrY in zip(odrXs, odrYs):
    Ass[odrX][odrY] = 1

def getAccAss(Ass):
    accAss = [[0] * (len(Ass[0])+1)] + [accumulate([0] + As) for As in Ass]
    for x in range(1, len(accAss)):
        accAss[x] = list(map(add, accAss[x], accAss[x-1]))
    return accAss
def getRangeSum2D(accAss, xFr, xTo, yFr, yTo):
    return accAss[xTo+1][yTo+1] - accAss[xTo+1][yFr] - accAss[xFr][yTo+1] + accAss[xFr][yFr]

accAss = getAccAss(Ass)

ans = 10**20
for xFr in range(N-1):
    for xTo in range(xFr+1, N):
        for yFr in range(N-1):
            for yTo in range(yFr+1, N):
                num = getRangeSum2D(accAss, xFr, xTo, yFr, yTo)
                if num >= K:
                    area = (xs[iXs[xTo]]-xs[iXs[xFr]]) * (ys[iYs[yTo]]-ys[iYs[yFr]])
                    ans = min(ans, area)

print(ans)


# Optimized solution
N, K = list(map(int, input().split()))
pts = []
ys = []
for _ in range(N):
    x, y = list(map(int, input().split()))
    pts.append((x, y))
    ys.append(y)

pts.sort()
ys.sort()

ans = 10**20
for i, y1 in enumerate(ys):
    for y2 in ys[i+1:]:
        for j, (x1, _) in enumerate(pts):
            num = 0
            for x, y in pts[j:]:
                if y1 <= y <= y2:
                    num += 1
                if num >= K:
                    area = (x-x1) * (y2-y1)
                    ans = min(ans, area)
                    break

print(ans)
# Original solution
N,K = list(map(int,input().split()))

X = []
Y = []
Z = []

for i in range(N):
  x,y = list(map(int,input().split()))
  X.append(x)
  Y.append(y)
  Z.append([x,y])
  
T = max(Y)
U = min(Y)
R = max(X)
L = min(X)
Y.sort()
X.sort()
ans = 10**100

for t in range(N):
  for u in range(N):
    for r in range(N):
      for l in range(N):
        T = Y[N-t-1]
        U = Y[u]
        R = X[N-r-1]
        L = X[l]
        cnt = 0
        for i in range(N):
          xi = Z[i][0]
          yi = Z[i][1]
          if xi >= L and xi <= R and yi >= U and yi <= T:
            cnt += 1
        if cnt >= K:
          M = int( (T-U) * (R-L) )
          ans = min(ans,M)
          
print(ans)

# Optimized solution
N,K = list(map(int,input().split()))

X = []
Y = []
Z = []

for i in range(N):
  x,y = list(map(int,input().split()))
  X.append(x)
  Y.append(y)
  Z.append([x,y])
  
Y.sort()
X.sort()
ans = 10**100

for t in range(N):
  for u in range(N):
    for r in range(N):
      for l in range(N):
        T = Y[N-t-1]
        U = Y[u]
        R = X[N-r-1]
        L = X[l]
        
        if T <= U or R <= L:
          continue
        
        cnt = 0
        for i in range(N):
          xi = Z[i][0]
          yi = Z[i][1]
          if xi >= L and xi <= R and yi >= U and yi <= T:
            cnt += 1
        if cnt >= K:
          M = int( (T-U) * (R-L) )
          ans = min(ans,M)
          
print(ans)
# Original solution
N, K = list(map(int, input().split()))
XY = [tuple(map(int, input().split())) for _ in range(N)]

ans = 10 ** 20

for x1 in range(N):
    for x2 in range(x1 + 1, N):
        for y1 in range(N):
            for y2 in range(y1 + 1, N):
                u = max(XY[x1][0], XY[x2][0])
                d = min(XY[x1][0], XY[x2][0])
                r = max(XY[y1][1], XY[y2][1])
                l = min(XY[y1][1], XY[y2][1])
                c = sum([d <= x <= u and l <= y <= r for x, y in XY])
                ans = min(ans, (u - d) * (r - l)) if c >= K else ans

print(ans)


# Optimized solution
N, K = list(map(int, input().split()))
XY = sorted([tuple(map(int, input().split())) for _ in range(N)])

ans = 10 ** 20
for xl in range(N):
    for xr in range(xl + 1, N):
        Ysub = sorted([y for x, y in XY[xl:xr + 1]])
        for i in range(xr - xl - K + 2):
            Yk = Ysub[i:i + K] + [XY[xr][1], XY[xl][1]]
            ans = min(ans, (XY[xr][0] - XY[xl][0]) * (max(Yk) - min(Yk)))

print(ans)
# Original solution
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N,K = inpl()
xys = []
xx = set()
yy = set()
for i in range(N):
    x,y = inpl()
    xys.append([x,y])
    xx.add(x)
    yy.add(y)

ans = INF
xx = sorted(list(xx))
yy = sorted(list(yy))
Lx = len(xx)
Ly = len(yy)
for i1 in range(Lx):
    x1 = xx[i1]
    for i2 in range(i1,Lx):
        x2 = xx[i2]
        for j1 in range(Ly):
            y1 = yy[j1]
            for j2 in range(j1,Ly):
                y2 = yy[j2]
                tmp = 0
                for x,y in xys:
                    if x1 <= x <= x2 and y1 <= y <= y2:
                        tmp += 1
                if K <= tmp:
                    ans = min(ans,(x2-x1)*(y2-y1))

print(ans)


# Optimized solution
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N,K = inpl()
xys = []
xx = set()
for i in range(N):
    x,y = inpl()
    xys.append([x,y])
    xx.add(x)

ans = INF
xx = sorted(list(xx))
Lx = len(xx)
xys.sort(key = lambda x: x[1])
for i1 in range(Lx):
    x1 = xx[i1]
    for i2 in range(i1,Lx):
        x2 = xx[i2]
        yy = []
        for x,y in xys:
            if x1 <= x <= x2:
                yy.append(y)
        Ly = len(yy)
        if Ly < K:
            continue
        else:
            for l in range(Ly-K+1):
                r = l+K-1
                ans = min((yy[r]-yy[l])*(x2-x1),ans)

print(ans)
# Original solution
n, k = list(map(int, input().split()))
sx, sy = [], []
for i in range(n):
    x, y = list(map(int, input().split()))
    sx.append((x, i))
    sy.append((y, i))
sx.sort()
sy.sort()
px = [[0] for _ in range(n)]
for cx, (x, i) in enumerate(sx):
    px[i] = cx

acm = [[0] * (n + 1) for _ in range(n + 1)]
for cy, (y, i) in enumerate(sy):
    for cx in range(n):
        acm[cx][cy] = acm[cx - 1][cy] + acm[cx][cy - 1] - acm[cx - 1][cy - 1] + int(px[i] == cx)

ans = 5e18
for lcx in range(n - k + 1):
    for ucx in range(lcx + k - 1, n):
        for lcy in range(n - k + 1):
            for ucy in range(lcy + k - 1, n):
                # print(li, ui, lj, uj)
                # print(acm[ui][uj], acm[ui][lj - 1], acm[li - 1][uj], acm[li - 1][lj - 1])
                if acm[ucx][ucy] - acm[ucx][lcy - 1] - acm[lcx - 1][ucy] + acm[lcx - 1][lcy - 1] >= k:
                    ans = min(ans, (sx[ucx][0] - sx[lcx][0]) * (sy[ucy][0] - sy[lcy][0]))
print(ans)


# Optimized solution
n, k = list(map(int, input().split()))
sx, sy = [], []
for i in range(n):
    x, y = list(map(int, input().split()))
    sx.append((x, i))
    sy.append((y, i))
sx.sort()
sy.sort()
px = [[0] for _ in range(n)]
for cx, (x, i) in enumerate(sx):
    px[i] = cx

acm = [[0] * (n + 1) for _ in range(n + 1)]
for cy, (y, i) in enumerate(sy):
    for cx in range(n):
        acm[cx][cy] = acm[cx - 1][cy] + acm[cx][cy - 1] - acm[cx - 1][cy - 1] + int(px[i] == cx)

ans = 5e18
for lcx in range(n - k + 1):
    for lcy in range(n - k + 1):
        acm_l = acm[lcx - 1][lcy - 1]
        for ucx in range(lcx + k - 1, n):
            for ucy in range(lcy + k - 1, n):
                if acm[ucx][ucy] - acm[ucx][lcy - 1] - acm[lcx - 1][ucy] + acm_l >= k:
                    ans = min(ans, (sx[ucx][0] - sx[lcx][0]) * (sy[ucy][0] - sy[lcy][0]))
                    break
print(ans)
# Original solution
n, k = list(map(int, input().split()))
sx, sy = [], []
for i in range(n):
    x, y = list(map(int, input().split()))
    sx.append((x, i))
    sy.append((y, i))
sx.sort()
sy.sort()
px = [[0] for _ in range(n)]
for cx, (x, i) in enumerate(sx):
    px[i] = cx

acm = [[0] * (n + 1) for _ in range(n + 1)]
for cy, (y, i) in enumerate(sy):
    for cx in range(n):
        acm[cx][cy] = acm[cx - 1][cy] + acm[cx][cy - 1] - acm[cx - 1][cy - 1] + int(px[i] == cx)

ans = 5e18
for lcx in range(n - k + 1):
    for lcy in range(n - k + 1):
        acm_l = acm[lcx - 1][lcy - 1]
        for ucx in range(lcx + k - 1, n):
            for ucy in range(lcy + k - 1, n):
                if acm[ucx][ucy] - acm[ucx][lcy - 1] - acm[lcx - 1][ucy] + acm_l >= k:
                    ans = min(ans, (sx[ucx][0] - sx[lcx][0]) * (sy[ucy][0] - sy[lcy][0]))
                    break
print(ans)


# Optimized solution
n, k = list(map(int, input().split()))
ps = [tuple(map(int, input().split())) for i in range(n)]
sx = sorted(ps)
nx = list(enumerate(sx))

ans = 5e18
for l, (x1, y1) in nx[:n - k + 1]:
    for r, (x2, y2) in nx[l + k - 1:]:
        dx = x2 - x1
        sy = sorted(y for x, y in sx[l:r + 1])
        for y3, y4 in zip(sy, sy[k - 1:]):
            if y3 <= y1 and y2 <= y4:
                ans = min(ans, dx * (y4 - y3))
print(ans)
# Original solution
n,k=list(map(int,input().split()))

dot=[]
xxx=[]
yyy=[]

ans=float('inf')

for i in range(n):
  x,y=list(map(int,input().split()))
  dot.append([x,y])
  xxx.append(x)
  yyy.append(y)

for sx in xxx:
  for sy in yyy:
    for gx in xxx:
      for gy in yyy:
        if sx==gx or sy==gy:
          continue
        cnt=0
        for lst in dot:
          if sx<=lst[0]<=gx or gx<=lst[0]<=sx:
            if sy<=lst[1]<=gy or gy<=lst[1]<=sy:
              cnt+=1
      
        if cnt>=k:
          ans=min(ans,abs(sx-gx)*abs(sy-gy))


print(ans)

# Optimized solution
n,k=list(map(int,input().split()))

dot=[]
xxx=[]
yyy=[]

ans=float('inf')

for i in range(n):
  x,y=list(map(int,input().split()))
  dot.append([x,y])
  xxx.append(x)
  yyy.append(y)

xxx.sort()
yyy.sort()

for sx in range(n):
  for sy in range(n):
    for gx in range(sx+1,n):
      for gy in range(sy+1,n):
        cnt=0
        for lst in dot:
          if xxx[sx]<=lst[0]<=xxx[gx]:
            if yyy[sy]<=lst[1]<=yyy[gy]:
              cnt+=1
      
        if cnt>=k:
          if xxx[sx]==xxx[gx] or yyy[sy]==yyy[gy]:
            continue
          ans=min(ans,(xxx[gx]-xxx[sx])*(yyy[gy]-yyy[sy]))


print(ans)
# Original solution
n,k = list(map(int,input().split()))
l = [list(map(int,input().split())) for i in range(n)]
l.sort()
ans = float("INF")

for i in range(n-k+1):
    for j in range(i+1,n):
        for s in range(n):
            for m in range(n):
                wl = l[i][0]
                wh = l[j][0]
                hl = min(l[s][1],l[m][1])
                hh = max(l[s][1],l[m][1])
                count = 0
                for w,h in l:
                    if wl <= w <= wh and hl <= h <= hh:
                        count += 1
                if count >= k:
                    ans = min(ans,(hh-hl)*(wh-wl))
print(ans)

# Optimized solution
n,k = list(map(int,input().split()))
l = [list(map(int,input().split())) for i in range(n)]
l.sort()
l1 = sorted(l,key=lambda x:x[1])
ans = float("INF")

for i in l:
    for j in l:
        if i[0] >= j[0]:
            continue
        for s in l1:
            count = 0
            for w,h in l1:
                if i[0] <= w <= j[0] and s[1] <= h:
                    count += 1
                if count==k:
                    ans = (min(ans,(j[0]-i[0])*(h-s[1])))
                    break
                
print(ans)
# Original solution
from itertools import combinations
N, K = (list)(list(map(int, input().split())))
pos_x = []
pos_y = []

for _ in range(N):
    a, b = list(map(int, input().split()))
    pos_x.append(a)
    pos_y.append(b)


def count_point(x, y):
    ret = 0
    x_min = min(x)
    x_max = max(x)
    y_min = min(y)
    y_max = max(y)
    for i in range(N):
        if x_min <= pos_x[i] <= x_max and y_min <= pos_y[i] <= y_max:
            ret += 1
    return ret


def calc_area(x, y):
    ret = (x[1]-x[0])*(y[1]-y[0])
    return (abs)(ret)


set_x = set(pos_x)
set_y = set(pos_y)


area = float('inf')
for cand_x in combinations(set_x, 2):
    for cand_y in combinations(set_y, 2):
        if count_point(cand_x, cand_y) >= K:
            area = min(area, calc_area(cand_x, cand_y))
print(area)


# Optimized solution
from itertools import combinations
N, K = (list)(list(map(int, input().split())))
pos_x = []
pos_y = []

for _ in range(N):
    a, b = list(map(int, input().split()))
    pos_x.append(a)
    pos_y.append(b)


def count_point(x, y):
    ret = 0
    x_min = min(x)
    x_max = max(x)
    y_min = min(y)
    y_max = max(y)
    for i in range(N):
        if x_min <= pos_x[i] <= x_max and y_min <= pos_y[i] <= y_max:
            ret += 1
    return ret


def calc_area(x, y):
    ret = (x[1]-x[0])*(y[1]-y[0])
    return (abs)(ret)


set_x = set(pos_x)
set_y = set(pos_y)


area = float('inf')
for cand_x in combinations(set_x, 2):
    for cand_y in combinations(set_y, 2):
        if count_point(cand_x, cand_y) == K:
            area = min(area, calc_area(cand_x, cand_y))
print(area)
# Original solution
N,K=list(map(int,input().split()))
A=[]
for i in range(N):
  a=[int(x) for x in input().split()]
  A.append(a)
ans=float('inf')
for i in range(N):
  for j in range(i+1,N):
    for k in range(N):
      for l in range(k+1,N):
        miX=10000000000
        maX=-10000000000
        miY=10000000000
        maY=-10000000000
        cnt=0
        for m in range(N):
          if min(A[i][0],A[j][0])<= A[m][0] <= max(A[i][0],A[j][0]) and min(A[k][1],A[l][1])<= A[m][1] <= max(A[k][1],A[l][1]):
            cnt+=1
            miX=min(A[m][0],miX)
            maX=max(A[m][0],maX)
            miY=min(A[m][1],miY)
            maY=max(A[m][1],maY)
        if cnt>=K:
          ans=min(ans,(maX-miX)*(maY-miY))
print(ans)

# Optimized solution
N,K=list(map(int,input().split()))
XY=[]
for i in range(N):
  x,y=list(map(int,input().split()))
  XY.append((x,y))
XY.sort()

ans=10**50
for i in range(N-(K-1)):
  for j in range(i+(K-1),N):
    x,y=XY[i]
    x1,y1=XY[j]
    YX=sorted(XY[i:j+1], key=lambda x:x[1])
    for k in range(len(YX)-(K-1)):
      for l in range(k+(K-1),len(YX)):
        if YX[k][1] <= y and y1 <= YX[l][1]:
          ans=min(ans,(x1-x)*(YX[l][1]-YX[k][1]))

print(ans)