CodeEff/ECCO huggingface dataset:
# Original solution
n, k = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(n)]

MAX = 10**9
MIN = -1 * MAX
def check(x_r, x_l, y_t, y_b):
    tl = [MIN, MAX]
    br = [MAX, MIN]
    if x_r == x_l or y_t == y_b:
        return False, -1

    tl[0] = max(tl[0], xy[x_l][0])
    tl[1] = min(tl[1], xy[y_t][1])
    br[0] = min(br[0], xy[x_r][0])
    br[1] = max(br[1], xy[y_b][1])

    # count k
    cnt = 0
    for i in range(n):
        if tl[0] <= xy[i][0] <= br[0] and br[1] <= xy[i][1] <= tl[1]:
            cnt += 1
    if cnt < k:
        return False, -1
    area = (br[0] - tl[0]) * (tl[1] - br[1])
    return True, area

INF = 10**20
ans = INF
for a in range(n):
    for b in range(n):
        for c in range(n):
            for d in range(n):
                f, area = check(a, b, c, d)
                if f:
                    ans = min(ans, area)
print(ans)

# Optimized solution
n, k = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(n)]

MAX = 10**9
MIN = -1 * MAX
def check(x_r, x_l, y_t, y_b):
    tl = [MIN, MAX]
    br = [MAX, MIN]
    if x_r == x_l or y_t == y_b:
        return False, -1

    tl[0] = max(tl[0], xy[x_l][0])
    tl[1] = min(tl[1], xy[y_t][1])
    br[0] = min(br[0], xy[x_r][0])
    br[1] = max(br[1], xy[y_b][1])

    # count k
    cnt = 0
    for i in range(n):
        if tl[0] <= xy[i][0] <= br[0] and br[1] <= xy[i][1] <= tl[1]:
            cnt += 1
    if cnt < k:
        return False, -1
    area = (br[0] - tl[0]) * (tl[1] - br[1])
    return True, area

INF = 10**20
ans = INF
for a in range(n):
    for b in range(n):
        if a == b:
            continue
        if xy[a][0] < xy[b][0]:
            continue
        for c in range(n):
            for d in range(n):
                if c == d:
                    continue
                if xy[c][1] < xy[d][1]:
                    continue
                f, area = check(a, b, c, d)
                if f:
                    ans = min(ans, area)
print(ans)
# Original solution
N,K=list(map(int,input().split()))
px = [0 for _ in range(N)]
py = [0 for _ in range(N)]
for i in range(N):
  px[i],py[i] = list(map(int,input().split()))
a=10**20
for xi in range(N):
  for xj in range(xi+1,N):
    for yi in range(N):
      for yj in range(yi+1,N):
        x0,x1,y0,y1=px[xi],px[xj],py[yi],py[yj]
        dx,dy = abs(x0-x1),abs(y0-y1)
        if a < dx*dy: continue
        cnt = 0
        for i in range(N):
          if (x0-px[i])*(px[i]-x1)>=0 and (y0-py[i])*(py[i]-y1)>=0: cnt += 1
        if cnt >= K: a = min(a, dx*dy)
print(a)


# Optimized solution
N,K=list(map(int,input().split()))
p = sorted([[int(_) for _ in input().split()] for i in range(N)])
a=10**20
for xi in range(N-K+1):
  for xj in range(xi+K-1,N):
    q = sorted(y for x,y in p[xi:xj+1])
    for yi in range(xj-(xi+K-1)+1):
      yj = yi+K-1 #Is the number always K?
      if q[yi]<=p[xi][1] and p[xj][1]<=q[yj]:
        a = min(a, (p[xi][0]-p[xj][0])*(q[yi]-q[yj]))
print(a)
# Original solution
n,k = list(map(int,input().split()))
x = []
y = []
for i in range(n):
    a,b = list(map(int,input().split()))
    x.append(a)
    y.append(b)
ans = 10 ** 40
for i in range(n):
    for j in range(n):
        for l in range(n):
            for h in range(n):
                lx = min(x[i],x[j])
                rx = max(x[i],x[j])
                uy = max(y[l],y[h])
                dy = min(y[l],y[h])
                cnt = 0
                for ii in range(n):
                    if lx <= x[ii] <= rx and dy <= y[ii] <= uy:
                        cnt += 1
                if cnt >= k:
                    ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

# Optimized solution
n,k = list(map(int,input().split()))
x = []
y = []
xx = []
yy = []
for i in range(n):
    a,b = list(map(int,input().split()))
    x.append(a)
    y.append(b)
    xx.append(a)
    yy.append(b)
ans = 10 ** 40
x.sort()
y.sort()
for i in range(n):
    for j in range(i+1,n):
        for l in range(n):
            for h in range(l+1,n):
                lx = x[i]
                rx = x[j]
                uy = y[h]
                dy = y[l]
                cnt = 0
                for ii in range(n):
                    if lx <= xx[ii] <= rx and dy <= yy[ii] <= uy:
                        cnt += 1
                if cnt >= k:
                    if (rx-lx) * (uy-dy) != 0:
                        ans = min(ans,(rx-lx)*(uy-dy))
print(ans)
# Original solution
(n, k) = list(map(int, input().split(" ")))

pts = []
for _ in range(n):
    (x, y) = list(map(int, input().split(" ")))
    pts += [(x, y)]

pts.sort()

res = float("inf")
for a in pts:
    for b in pts:
        for c in pts:
            for d in pts:
                l = a[0]
                r = b[0]
                f = c[1]
                t = d[1]
                
                if not l < r or not f < t:
                    continue
        
                num = 0
                for x in pts:
                    if l <= x[0] <= r and f <= x[1] <= t:
                        num += 1
        
                if num >= k:
                    res = min(res, abs(r-l)*abs(t-f))

print(res)

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

xs = []
ys = []
pts = []
for _ in range(n):
    (x, y) = list(map(int, input().split(" ")))
    xs += [x]
    ys += [y]
    pts += [(x, y)]

xs.sort()
ys.sort()

res = float("inf")
for a in xs:
    for b in xs:
        ci = 0
        di = 1
        while di < len(ys):
            num = 0
            c = ys[ci]
            d = ys[di]
            
            for x in pts:
                if a <= x[0] <= b and c <= x[1] <= d:
                    num += 1
        
            if num >= k:
                res = min(res, abs(b-a)*abs(d-c))
                if ci < di:
                    ci += 1
                else:
                    di += 1
            else:
                di += 1

print(res)
# Original solution
n,k = list(map(int,input().split()))
xyl = []
for _ in range(n):
    x,y = list(map(int,input().split()))
    xyl.append((x,y))

ans = float("inf")
for i in range(n):
    for j in range(i+1, n):
        for h in range(n):
            for g in range(h+1, n):
                x1 = min(xyl[i][0], xyl[j][0], xyl[h][0], xyl[g][0])
                x2 = max(xyl[i][0], xyl[j][0], xyl[h][0], xyl[g][0])
                y1 = min(xyl[i][1], xyl[j][1], xyl[h][1], xyl[g][1])
                y2 = max(xyl[i][1], xyl[j][1], xyl[h][1], xyl[g][1])
                cnt = 0
                for p in range(n):
                    if x1 <= xyl[p][0] <= x2 and  y1 <= xyl[p][1] <= y2:
                        cnt += 1
                        if cnt == k:
                            ans = min(ans, (x2 - x1) * (y2 - y1))
                            break




print(ans)


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

ans = 1e30
for lx in range(N):
    for rx in range(lx+K, N+1):
        Q = sorted(P[lx:rx], key=lambda x:x[1])
        for ly in range(len(Q)):
            R = Q[ly:ly+K]
            if len(R)>=K: ans = min(ans, (P[rx-1][0]-P[lx][0])*(R[-1][1]-R[0][1]))
print(ans)
# Original solution
from itertools import product as pd
n,k=list(map(int,input().split()))
o=[tuple(map(int,input().split())) for _ in range(n)]

def calc(a,b,c,d):
  lx=min(o[a][0],o[b][0])
  rx=max(o[a][0],o[b][0])
  dy=min(o[c][1],o[d][1])
  uy=max(o[c][1],o[d][1])

  cnt=0
  for i in o:
    if lx<=i[0]<=rx and dy<=i[1]<=uy:
      cnt+=1
  if cnt>=k:
    return (rx-lx)*(uy-dy)
  return float("inf")

v=float("inf")
for (a,c) in pd(list(range(n)),repeat=2):
  for (b,d) in pd(list(range(n)),repeat=2):
    v=min(v,calc(a,b,c,d))
print(v)

# Optimized solution
from itertools import combinations as comb
n,k=list(map(int,input().split()))
f=lambda x,y:(min(x,y),max(x,y))
o=[tuple(map(int,input().split())) for _ in range(n)]

v=float("inf")
for (a,b) in comb(list(range(n)),2):
  for (c,d) in comb(list(range(n)),2):
    lx,rx=f(o[a][0],o[b][0])
    dy,uy=f(o[c][1],o[d][1])
    cnt=0
    for i in o:
      if lx<=i[0]<=rx and dy<=i[1]<=uy:
        cnt+=1
    if cnt>=k:
      v=min(v,(rx-lx)*(uy-dy))
print(v)
# Original solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, k = list(map(int, readline().split()))
xy = [list(map(int, readline().split())) for _ in range(n)]
ans = float('inf')
for i, (ix, _) in enumerate(xy):
    for jx, _ in xy[i + 1:]:
        for j, (_, iy) in enumerate(xy):
            for _, jy in xy[j + 1:]:
                cnt = 0
                for x, y in xy:
                    if (ix <= x <= jx or jx <= x <= ix) and (iy <= y <= jy or jy <= y <= iy):
                        cnt += 1
                if cnt >= k:
                    ans = min(ans, abs(jx - ix) * abs(jy - iy))
print(ans)


# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, k = list(map(int, readline().split()))
xy = []
xx = []
yy = []
for _ in range(n):
    x, y = list(map(int, readline().split()))
    xx.append(x)
    yy.append(y)
    xy.append((x, y))
xx.sort()
yy.sort()
ans = float('inf')
for i, ix in enumerate(xx):
    for jx in xx[i + 1:]:
        for j, iy in enumerate(yy):
            for jy in yy[j + 1:]:
                cnt = 0
                for x, y in xy:
                    if ix <= x <= jx and iy <= y <= jy:
                        cnt += 1
                if cnt >= k:
                    ans = min(ans, (jx - ix) * (jy - iy))
print(ans)
# Original solution
n,k=list(map(int,input().split()))
p=[]
for i in range(n):
    x,y=list(map(int,input().split()))
    p.append([x,y])
ret=10**25
for a in range(n):
    for b in range(n):
        for c in range(n):
            for d in range(n):
                l=min(p[a][0],p[b][0],p[c][0],p[d][0])
                r=max(p[a][0],p[b][0],p[c][0],p[d][0])
                u=min(p[a][1],p[b][1],p[c][1],p[d][1])
                t=max(p[a][1],p[b][1],p[c][1],p[d][1])
                cnt=0
                for i in range(n):
                    if l<=p[i][0]<=r and u<=p[i][1]<=t:
                        cnt+=1
                if cnt>=k:
                    ret=min(ret,(r-l)*(t-u))
print(ret)

# Optimized solution
n,k=list(map(int,input().split()))
p=[]
for i in range(n):
    x,y=list(map(int,input().split()))
    p.append([x,y])
ret=10**25
for a in range(n):
    for b in range(a):
        r=max(p[a][0],p[b][0])
        l=min(p[a][0],p[b][0])
        for c in range(n):
            for d in range(c):
                u=min(p[c][1],p[d][1])
                t=max(p[c][1],p[d][1])
                cnt=0
                for i in range(n):
                    if l<=p[i][0]<=r and u<=p[i][1]<=t:
                        cnt+=1
                if cnt>=k:
                    ret=min(ret,(r-l)*(t-u))
print(ret)
# Original solution
import itertools
N,K = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(N)]

tup = ()
for i in range(N):
    tup += (i,)

data = list(itertools.combinations(tup,2))
ans = []

for x in range(len(data)):
    for y in range(len(data)):
        cnt = 0
        x_side = data[x]
        y_side = data[y]
        x_left = min(s[x_side[0]][0],s[x_side[1]][0])
        x_right = max(s[x_side[0]][0],s[x_side[1]][0])
        y_bottom = min(s[y_side[0]][1],s[y_side[1]][1])
        y_top = max(s[y_side[0]][1],s[y_side[1]][1])
        for i in s:
            if (x_left <= i[0] and i[0] <= x_right)and(y_bottom <= i[1] and i[1] <= y_top):
                cnt += 1
        if cnt >= K:
            ans.append((x_right-x_left)*(y_top-y_bottom))
    
        
print((min(ans)))

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

x,y = [],[]
xx,yy = [],[]

for i in range(n):
    X,Y = list(map(int,input().split()))

    x.append(X)
    xx.append(X)
    y.append(Y)
    yy.append(Y)



xx.sort()
yy.sort()
ans = 10**20

for i in range(n):
    for j in range(i):
        lx,rx = xx[j],xx[i]

        num = [0 for _ in range(n+1)]

        for k in range(n):
            if lx <= x[k] <= rx:
                num[yy.index(y[k])+1] += 1

        for k in range(n):
            num[k+1] += num[k]


        for k in range(n):
            for l in range(k):
                by,ty = yy[l],yy[k]

                if num[k+1] - num[l] >= K:
                    ans = min(ans,(rx-lx)*(ty-by))



print(ans)
# Original solution
from itertools import*
n,k=list(map(int,input().split()))
a=10**20
for z in combinations(sorted(list(map(int,input().split()))for _ in range(n)),k):
    y=[j for _,j in z]
    a=min(a,(z[-1][0]-z[0][0])*(max(y)-min(y)))
print(a)

# Optimized solution
n,k=list(map(int,input().split()))
z=[list(map(int,input().split()))for _ in range(n)]
z.sort()
a=10**20
for i in range(n):
    for j in range(i+1,n):
        x=z[j][0]-z[i][0]
        l=sorted(t[1]for t in z[i:j+1])
        for u,v in zip(l,l[k-1:]):
            a=min(a,x*(v-u))
print(a)
# Original solution
n,m=list(map(int,input().split()))
x=[0]*n
y=[0]*n
for i in range(n):
  x[i],y[i]=list(map(int,input().split()))
ans=10**19
for i in range(n):
  for j in range(n):
    for k in range(n):
      for l in range(n):
        xl=min(x[i],x[j],x[k],x[l])
        xr=max(x[i],x[j],x[k],x[l])
        yl=min(y[i],y[j],y[k],y[l])
        yh=max(y[i],y[j],y[k],y[l])
        cnt=0
        for c in range(n):
          cnt+=xl<=x[c]<=xr and yl<=y[c]<=yh
        if cnt>=m:ans=min(ans,(xr-xl)*(yh-yl))
print(ans)

# Optimized solution
n,m=list(map(int,input().split()))
x=[0]*n
y=[0]*n
for i in range(n):
  x[i],y[i]=list(map(int,input().split()))
ans=10**19
for i in range(n):
  for j in range(i,n):
    for k in range(j,n):
      for l in range(k,n):
        xl=min(x[i],x[j],x[k],x[l])
        xr=max(x[i],x[j],x[k],x[l])
        yl=min(y[i],y[j],y[k],y[l])
        yh=max(y[i],y[j],y[k],y[l])
        cnt=0
        for c in range(n):
          cnt+=xl<=x[c]<=xr and yl<=y[c]<=yh
        if cnt>=m:ans=min(ans,(xr-xl)*(yh-yl))
print(ans)
# Original solution
def main():
    N, K = list(map(int, input().split()))
    dots = []
    for _ in range(N):
        x, y = list(map(int, input().split()))
        dots.append((x,y))

    ans = float('inf')

    for i in range(N):
        for j in range(N):
            for k in range(N):
                for l in range(N):
                    if i == j == k == l:
                        continue
                    right = max(dots[i][0],dots[j][0],dots[k][0],dots[l][0])
                    left = min(dots[i][0],dots[j][0],dots[k][0],dots[l][0])
                    bottom = min(dots[i][1],dots[j][1],dots[k][1],dots[l][1])
                    top = max(dots[i][1],dots[j][1],dots[k][1],dots[l][1])

                    cnt = 0
                    for x, y in dots:
                        if left <= x <= right and bottom <= y <= top:
                            cnt += 1

                    if cnt >= K:
                        ans = min(ans, (top - bottom) * (right - left))
    print(ans)



if __name__ == "__main__":
    main()

# Optimized solution
def main():
    N, K = list(map(int, input().split()))
    x = [0] * N
    y = [0] * N
    for i in range(N):
        x[i], y[i] = list(map(int, input().split()))
        
    ans = float('inf')

    for i in range(N):
        for j in range(N):
            for k in range(N):
                for l in range(N):
                    if x[i] < x[j] and y[k] < y[l]:
                        right = x[j]
                        left = x[i]
                        bottom = y[k]
                        top = y[l]

                        cnt = 0

                        for n in range(N):
                            if left <= x[n] <= right and bottom <= y[n] <= top:
                                cnt += 1

                        if cnt >= K:
                            ans = min(ans, (top - bottom) * (right - left))
    print(ans)



if __name__ == "__main__":
    main()
# Original solution
# -*- coding: utf-8 -*-
from itertools import product, combinations
from operator import itemgetter
def inpl(): return tuple(map(int, input().split()))
 
# B以下の数-A未満の数→bisect(L, B) - bisect_left(L, A)
N, K = inpl()
X = []
Y = []
Px = []
Py = []
 
for i in range(N):
    x, y = inpl()
    X.append(x)
    Y.append(y)
    Px.append((x, i))
    Py.append((y, i))
 
X = sorted(X)
Y = sorted(Y)
 
dX = {x:i for i, x in enumerate(X)}
dY = {y:i for i, y in enumerate(Y)}
Px = sorted(Px)
Py = sorted(Py)
 
get = itemgetter(1)
res = 5 * 10**18
 
for (l, r), (d, u) in product(combinations(X, 2), combinations(Y, 2)):
    if (dX[r] - dX[l] < K-1) or (dY[u] - dY[d] < K-1):
        continue
    sx = sum([1 << i for i in map(get, Px[dX[l]:dX[r]+1])])
    sy = sum([1 << i for i in map(get, Py[dY[d]:dY[u]+1])])
    if bin(sx&sy).count("1") >= K:
        res = min(res, (r-l)*(u-d))
 
print(res)

# Optimized solution
# -*- coding: utf-8 -*-
from itertools import product, combinations
from operator import itemgetter
def inpl(): return tuple(map(int, input().split()))

N, K = inpl()
X = []
Y = []
Px = []
Py = []

for i in range(N):
    x, y = inpl()
    X.append(x)
    Y.append(y)
    Px.append((x, i))
    Py.append((y, i))

X = sorted(X)
Y = sorted(Y)

dX = {x:i for i, x in enumerate(X)}
dY = {y:i for i, y in enumerate(Y)}
Px = sorted(Px)
Py = sorted(Py)

get = itemgetter(1)
res = 5 * 10**18

for (l, r), (d, u) in product(combinations(X, 2), combinations(Y, 2)):
    if (dX[r] - dX[l] < K-1) or (dY[u] - dY[d] < K-1):
        continue
    if res < (r-l)*(u-d):
        continue

    sx = set(map(get, Px[dX[l]:dX[r]+1]))
    sy = set(map(get, Py[dY[d]:dY[u]+1]))
    if len(sx.intersection(sy)) >= K:
        res = min(res, (r-l)*(u-d))

print(res)
# Original solution
n,K=list(map(int,input().split()))
lists=[]
for i in range(n):
    x,y=list(map(int,input().split()))
    lists.append((x,y))
anslist=[]
for i in range(n):
    for j in range(i+1,n):
        for k in range(n):
            for l in range(k+1,n):       
                a=lists[i][0]
                b=lists[j][0]
                c=lists[k][1]
                d=lists[l][1]
                counter=0
                for s in range(n):
                    p,q=lists[s][0],lists[s][1]
                    if min(a,b)<=p<=max(a,b) and min(d,c)<=q<=max(c,d):
                        counter+=1
                    if counter>=K:
                        anslist.append(abs(a-b)*abs(c-d))
print((min(anslist)))        

# Optimized solution
#atcoder -take a rest-(easy)

def main():
    N,K = list(map(int,input().split()))
    que = []
    que_x =  []
    que_y = []
    for i in range(N):
        x,y = list(map(int,input().split()))
        que_x.append(x)
        que_y.append(y)
        que.append((x,y))
    que_x.sort()
    que_y.sort()
    ans = 10**100
    for i in range(N):
        for j in range(i,N):
            for _i in range(N):
                for _j in range(_i,N):
                    h,w = que_x[j]-que_x[i],que_y[_j] -que_y[_i]
                    cnt = 0
                    for x,y in que:
                        if que_x[i]<=x<=que_x[j] and que_y[_i]<=y<=que_y[_j]:
                            cnt += 1
                    if cnt >=K:
                        ans = min(ans,h*w)
    print(ans)
    return




if __name__ == "__main__":
    main()
# Original solution

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

xy_list = []
for i in range(N):
    xy_list.append(list(map(int,input().split())))
min_s = 10**28    
for i in range(N):
    for j in range(i+1,N):
        for k in range(N):
            for l in range(k+1,N):
                max_x = max(xy_list[i][0],xy_list[j][0])
                min_x = min(xy_list[i][0],xy_list[j][0])
                max_y = max(xy_list[k][1],xy_list[l][1])
                min_y = min(xy_list[k][1],xy_list[l][1])
                count = 0
                for m in range(N):
                    if max_x>=xy_list[m][0] and min_x<=xy_list[m][0] and max_y>=xy_list[m][1] and min_y<=xy_list[m][1]:
                        count+=1
                if count==K:
                    min_s = min((max_x-min_x)*(max_y-min_y),min_s)

print(min_s)

# 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])

X.sort()
Y.sort()

min_rec=10**27

for i in range(N-1):
    for j in range(i+1,N):
        for k in range(N-1):
            for l in range(k+1,N):
                count=0
                for n in range(N):
                    if Z[n][0]>=X[i] and Z[n][0]<=X[j] and Z[n][1]>=Y[k] and Z[n][1]<=Y[l]:
                        count+=1
                if count==K:
                    min_rec = min(min_rec,(X[j]-X[i])*(Y[l]-Y[k]))

print(min_rec)
# Original solution
from collections import defaultdict
def main():
  n,k=list(map(int,input().split()))
  xy=[list(map(int,input().split())) for _ in range(n)]
  xwl=dict((c[0],i) for i,c in enumerate(xy))
  ywl=dict((c[1],i) for i,c in enumerate(xy))
  x=list(xwl.keys())
  y=list(ywl.keys())
  x.sort()
  y.sort()
  
  xdict=dict()
  ydict=dict()
  xdict[x[0]]=[1<<xwl[x[0]],0]
  ydict[y[0]]=[1<<ywl[y[0]],0]
  size=lambda x:sum(x>>i&1 for i in range(n))
  minus=lambda x,y:(x|y)^y
  for i in range(1,n):
    xdict[x[i]]=[xdict[x[i-1]][0]|(1<<xwl[x[i]]), xdict[x[i-1]][1]|(1<<xwl[x[i-1]])]
    ydict[y[i]]=[ydict[y[i-1]][0]|(1<<ywl[y[i]]), ydict[y[i-1]][1]|(1<<ywl[y[i-1]])]
  ans=float('inf')
  diter=[(i,j) for i in range(n) for j in range(n) if i<j]
  
  for s,t in diter: 
    for u,v in diter:
      if size(minus(xdict[x[t]][0],xdict[x[s]][1])&\
                  minus(ydict[y[v]][0],ydict[y[u]][1]))>=k:
        ans=min(ans,(x[t]-x[s])*(y[v]-y[u]))
  print(ans)

if __name__=='__main__':
  main()


# Optimized solution
from collections import defaultdict
def main():
  n,k=list(map(int,input().split()))
  xy=[list(map(int,input().split())) for _ in range(n)]
  x=[p[0] for p in xy]
  y=[p[1] for p in xy]
  x.sort()
  y.sort()
  
  s1=[[0]*n for _ in range(n)]
  s2=[[0]*n for _ in range(n)]
  s3=[[0]*n for _ in range(n)]
  s4=[[0]*n for _ in range(n)]
  for i in range(n):
    for j in range(n):
        for p in xy:
            if p[0]<=x[i] and p[1]<=y[j]:
              s1[i][j]+=1
              s2[i][j]+=(p[0]<x[i])
              s3[i][j]+=(p[1]<y[j])
              s4[i][j]+=(p[0]<x[i])*(p[1]<y[j])
  ans=float('inf')
  for s in range(n):
    for t in range(s+1,n):
      for u in range(n):
        for v in range(u+1,n):
          if s1[t][v]-s3[t][u]-s2[s][v]+s4[s][u]>=k:
            ans=min(ans,(x[t]-x[s])*(y[v]-y[u]))
  print(ans)

if __name__=='__main__':
  main()