CodeEff/ECCO huggingface dataset:
# Original solution
N, K = list(map(int, input().split()))
ps = []
for i in range(N):
  ps.append(list(map(int, input().split())))

xsorted = list(zip(*sorted(ps, key=lambda p: p[0])))[0]
ysorted = list(zip(*sorted(ps, key=lambda p: p[1])))[1]

ans = float('inf')
for i in range(N):
  bottom = ysorted[i]
  for j in range(i+K-1, N):
    top = ysorted[j]
    answered = False
    for k in range(N):
      right = xsorted[k]
      for l in range(k+K-1, N):
        left = xsorted[l]
        c = 0
        for a in range(N):
          if right <= ps[a][0] <= left and bottom <= ps[a][1] <= top:
            c += 1
            if c >= K: break
        else:
          continue
        area = (left - right) * (top - bottom)
        if area < ans:
          ans = area
        break
      else:
        continue
      answered = True

print(ans)

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

xsorted = list(zip(*sorted(ps, key=lambda p: p[0])))[0]
ysorted = list(zip(*sorted(ps, key=lambda p: p[1])))[1]

ans = float('inf')
for i in range(N):
  bottom = ysorted[i]
  for j in range(i+K-1, N):
    top = ysorted[j]
    for k in range(N):
      if k+K-1 >= N:
        break
      right = xsorted[k]
      # 2 bun tansaku
      f, t = k+K-1, N
      sol = None
      while True:
        mid = (f+t)//2
        left = xsorted[mid]
        c = 0
        for p in ps:
          if right <= p[0] <= left and bottom <= p[1] <= top:
            c += 1
            if c >= K: break
        else:
          if f+1 >= t:
            break
          f = mid
          continue
        sol = mid
        if f+1 >= t:
          break
        t = mid
      if sol:
        area = (xsorted[sol] - right) * (top - bottom)
        if area < ans:
          ans = area

print(ans)
# Original solution
n,k_num = list(map(int,input().split()))
info =[list(map(int,input().split())) for i in range(n)]
li_x = []
li_y = []

for i in range(n):
  if info[i][0] not in li_x:
    li_x.append(info[i][0])
  if info[i][1] not in li_y:
    li_y.append(info[i][1])

li_x = sorted(li_x)
li_y = sorted(li_y)

ans = float("inf")

for i in range(len(li_x)):
  for j in range(i,len(li_x)):
    for k in range(len(li_y)):
      for l in range(k,len(li_y)):
        count = 0
        for m in range(n):
          if li_x[i]<=info[m][0]<=li_x[j] and li_y[k]<=info[m][1]<=li_y[l]:
            count += 1
        if count ==k_num:
          ans = min(ans,(li_x[j]-li_x[i])*(li_y[l]-li_y[k]))
print(ans)

# Optimized solution
n,k_num = list(map(int,input().split()))
info =[list(map(int,input().split())) for i in range(n)]
li_x = []
li_y = []

for i in range(n):
 # if info[i][0] not in li_x:
    li_x.append(info[i][0])
 # if info[i][1] not in li_y:
    li_y.append(info[i][1])

li_x = sorted(li_x)
li_y = sorted(li_y)

bunpu = [[0]*n for i in range(n)]
for i in range(n):
  for j in range(n):
    if info[i][0]==li_x[j]:
      zahyo_x=j
      break
  for k in range(n):
    if info[i][1]==li_y[k]:
      zahyo_y=k
      break
  bunpu[zahyo_x][zahyo_y]=1

ruiseki = [[0]*n for i in range(n)]


for i in range(0,n):
  for j in range(0,n):
    ruiseki[i][j] = bunpu[i][j]
#横方向(j)の累積
for i in range(n):
  for j in range(1,n):
    ruiseki[i][j] = ruiseki[i][j-1] + ruiseki[i][j]
#縦方向(i)の累積
for j in range(n):
  for i in range(1,n):
    ruiseki[i][j] = ruiseki[i-1][j] + ruiseki[i][j]

#print(bunpu)
#print(ruiseki)

ans = float("inf")

for i in range(len(li_x)):
  for j in range(i,len(li_x)):
    for k in range(len(li_y)):
      for l in range(k,len(li_y)):
        count = ruiseki[j][l]
        if 0<=k-1:
          count -= ruiseki[j][k-1]
        if 0<=i-1:
          count -= ruiseki[i-1][l]
        if 0<=k-1 and 0<=i-1:
          count += ruiseki[i-1][k-1]      
        if count ==k_num:
          ans = min(ans,(li_x[j]-li_x[i])*(li_y[l]-li_y[k]))
print(ans)
# Original solution
from itertools import combinations

def count(x1,y1,x2,y2):
    res = 0
    for i in range(N):
        s1 = x[i]
        s2 = y[i]
        if x1 <= s1 <= x2 and y1 <= s2 <= y2:
            res += 1
    return res 

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

x = []
y = []
y_dict = {}

for i in range(N):
    a,b = list(map(int,input().split()))
    x.append(a)
    y.append(b)
    y_dict[a] = b

number = [i for i in range(N)]
x_2 = sorted(x)
ans = 10**20

for i,j in list(combinations(number,2)):
#for i in range(len(x_2)-1):#長方系の左の辺をx座標を取得し,固定
#    for j in range(i+1,len(x_2)):#長方形の右の辺のx座標を取得し,固定

    y_list = []

    for k in range(i,j+1):#xの指定区間内にある点のy座標を取得しy_listに入れる
        y_list.append(y_dict[x_2[k]])
        
    y_list = sorted(y_list)
        

    if 2 <= len(y_list):
        #for l in range(len(y_list)-1):#yの大きい値から順に組み合わせを試す
            #for m in range(l+1,len(y_list)):
        number2 = [i for i in range(len(y_list))]
        for l,m in list(combinations(number2,2)):        
                x1 = x_2[i]
                y1 = y_list[l]
                x2 = x_2[j]
                y2 = y_list[m]
                point = count(x1,y1,x2,y2)#区間内の点の数
                
                    
                if K <= point :
                    ans = min(ans,(x2-x1)*(y2-y1)) 


               
print(ans)

# Optimized solution
from itertools import combinations as comb

def count(x1,y1,x2,y2):
    res = 0
    for x,y in point:
        if x1 <= x <= x2 and y1 <= y <= y2:
            res += 1
    return res 
    
N,K = list(map(int,input().split()))

x = []
point = []
y_dict = {}

for i in range(N):
    a,b = list(map(int,input().split()))
    x.append(a)
    point.append((a,b))
    y_dict[a] = b#yの値はxの値と紐づけしておく

x = sorted(x)
ans = 10**20

number = [i for i in range(N)]
C = list(comb(number,2))

for i,j in C:#組合せで調べる
    y_list = []

    for k in range(i,j+1):#xの指定区間内にある点のy座標を取得しy_listに入れる
        y_list.append(y_dict[x[k]])
        
    y_list = sorted(y_list)
        

    if 2 <= len(y_list):
        number2 = [i for i in range(len(y_list))]
        C_2 = list(comb(number2,2))

        for l,m in C_2:        
                x1 = x[i]
                y1 = y_list[l]
                x2 = x[j]
                y2 = y_list[m]
                n = count(x1,y1,x2,y2)#区間内の点の数
                   
                if K <= n :
                    ans = min(ans,(x2-x1)*(y2-y1)) 
               
print(ans)
# Original solution
from itertools import product
 
n, k = list(map(int, input().split()))
p = [list(map(int, input().split())) for i in range(n)]
ans = float("inf")
 
for i, j, l, m in product(list(range(n)), repeat=4):
    cnt = 0
    for g in range(n):
        if p[i][0] <= p[g][0] <= p[j][0] and p[l][1] <= p[g][1] <= p[m][1]:
            cnt += 1
    if cnt >= k:
        ans = min(ans, (p[j][0] - p[i][0]) * (p[m][1] - p[l][1]))
print(ans)

# Optimized solution
n, k = list(map(int, input().split()))
p = [list(map(int, input().split())) for i in range(n)]
ans = float("inf")

p.sort()
for i in range(n-k+1):
    for j in range(i+k-1, n):
        x = p[j][0] - p[i][0]
        yl = sorted(p[i:j+1],key=lambda x:x[1])
        for l in range(len(yl)-k+1):
            y = yl[l+k-1][1] - yl[l][1]
            ans = min(ans, y*x)
print(ans)
# Original solution
from itertools import combinations
import bisect
N, K = list(map(int, input().split()))
xy = [tuple(map(int, input().split())) for i in range(N)]
xy.sort(key=lambda x: x[0])
X = [x[0] for x in xy]

ans = 40**18
for a, b in combinations(list(range(N)), 2):
    A, B = max(xy[a][0], xy[b][0]), min(xy[a][0], xy[b][0])
    r = bisect.bisect_right(X, A)
    l = bisect.bisect_left(X, B)
    for c, d in combinations(list(range(N)), 2):
        tmp = 0
        C, D = max(xy[c][1], xy[d][1]), min(xy[c][1], xy[d][1])

        for i in range(l, r):
            if xy[i][1] <= C and xy[i][1] >= D:
                tmp += 1
        #     print(xy[i][1], C, D)

        if tmp >= K and ans > (A-B) * (C - D):
            ans = (A-B) * (C - D)

print(ans)


# Optimized solution
def main():
    from itertools import combinations
    import bisect
    N, K = list(map(int, input().split()))
    xy = [tuple(map(int, input().split())) for i in range(N)]
    xy.sort(key=lambda x: x[0])
    X = [x[0] for x in xy]

    ans = 40**18
    for a, b in combinations(list(range(N)), 2):
        A, B = max(xy[a][0], xy[b][0]), min(xy[a][0], xy[b][0])
        r = bisect.bisect_right(X, A)
        l = bisect.bisect_left(X, B)
        for c, d in combinations(list(range(N)), 2):
            tmp = 0
            C, D = max(xy[c][1], xy[d][1]), min(xy[c][1], xy[d][1])

            for i in range(l, r):
                if xy[i][1] <= C and xy[i][1] >= D:
                    tmp += 1
            #     print(xy[i][1], C, D)

            if tmp >= K and ans > (A-B) * (C - D):
                ans = (A-B) * (C - D)

    print(ans)
main()
# Original solution
n, k = list(map(int, input().split()))

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

min_x = min(x)
min_y = min(y)
for i in range(n):
    x[i] -= min_x
    y[i] -= min_y

sx = sorted(x)
sy = sorted(y)

if n == k:
    print((sx[n - 1] * sy[n - 1]))
    exit()

a = 0
b = 1
ans = sx[n - 1] * sy[n - 1]
temp = 0
for p in range(n):
    for q in range(p + 1, n):
        for a in range(n):
            for b in range(a + 1, n):
                count = 0
                for i in range(n):
                    if sx[a] <= x[i] <= sx[b] and sy[p] <= y[i] <= sy[q]:
                        count += 1
                if count >= k:
                    ans = min(ans, (sx[b] - sx[a]) * (sy[q] - sy[p]))

print(ans)

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

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

min_x = min(x)
min_y = min(y)
for i in range(n):
    x[i] -= min_x
    y[i] -= min_y

sx = sorted(x)
sy = sorted(y)

if n == k:
    print((sx[n - 1] * sy[n - 1]))
    exit()

d = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n):
    d[sx.index(x[i]) + 1][sy.index(y[i]) + 1] = 1

for i in range(n + 1):
    for j in range(1, n + 1):
        d[i][j] += d[i][j - 1]

for i in range(n + 1):
    for j in range(1, n + 1):
        d[j][i] += d[j - 1][i]

#sx = [0] + sx
#sy = [0] + sy

a = 0
b = 1
ans = sx[n - 1] * sy[n - 1]
temp = 0
for p in range(n):
    for q in range(p + 1, n):
        for a in range(n):
            for b in range(a + 1, n):
                count = 0
                if d[b + 1][q + 1] - d[b + 1][p] - d[a][q + 1] + d[a][p] >= k:
                    ans = min(ans, (sx[b] - sx[a]) * (sy[q] - sy[p]))

print(ans)
# Original 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])

ans = float("inf")

for p1 in range(N):

    for p2 in range(N):

        for p3 in range(N):

            for p4 in range(N):


                left = min(xy[p1][0],xy[p2][0],xy[p3][0],xy[p4][0])
                down = min(xy[p1][1],xy[p2][1],xy[p3][1],xy[p4][1])
                right = max(xy[p1][0],xy[p2][0],xy[p3][0],xy[p4][0])
                up = max(xy[p1][1],xy[p2][1],xy[p3][1],xy[p4][1])

                able = 0
                nable = 0
                for i in range(N):

                    nx = xy[i][0]
                    ny = xy[i][1]
                    if left <= nx and nx <= right and down <= ny and ny <= up:
                        able += 1
                    else:
                        nable += 1

                    if able >= K or nable > N-K:
                        break

                if able >= K:
                    now = max(1,right-left) * max(1,up-down)
                    ans = min(ans,now)

print (ans)


# Optimized solution

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

xy = []
xlis = []
ylis = []

for i in range(N):

    x,y = list(map(int,input().split()))

    xy.append([x,y])

    if x not in xlis:
        xlis.append(x)
    if y not in ylis:
        ylis.append(y)

ans = float("inf")
xlis.sort()
ylis.sort()

for rp in range(len(xlis)):

    right = xlis[rp]

    for lp in range(rp+1):

        left = xlis[lp]

        for upp in range(len(ylis)):

            up = ylis[upp]

            for dp in range(upp+1):

                down = ylis[dp]

                able = 0
                nable = 0
                for i in range(N):

                    nx = xy[i][0]
                    ny = xy[i][1]
                    if left <= nx and nx <= right and down <= ny and ny <= up:
                        able += 1
                    else:
                        nable += 1

                    if able >= K or nable > N-K:
                        break

                if able >= K:
                    now = max(1,right-left) * max(1,up-down)
                    ans = min(ans,now)

print (ans)
# Original solution
def main():
    N,K = list(map(int,input().split()))
    XY = [list(map(int,input().split())) for _ in [0]*N]
    
    iX = sorted(x for x,y in XY)
    iY = sorted(y for x,y in XY)
    X = {x:i for i,x in enumerate(iX)}
    Y = {y:i for i,y in enumerate(iY)}

    c = [[0]*(N+1) for i in [0]*(N+1)]
    for x,y in XY:
        c[Y[y]+1][X[x]+1] = 1

    for i in range(N):
        ci1 = c[i+1]
        for j in range(N):
            ci1[j+1] += ci1[j]
    for i in range(N):
        ci1 = c[i+1]
        ci = c[i]
        for j in range(N):
            ci1[j+1] += ci[j+1]

    ans = 10**20
    for u in range(N):
        for d in range(u+K-1,N):
            l = 0
            r = 1
            dY = iY[d]-iY[u]
            cd = c[d+1]
            cu = c[u]
            while r<N:
                if cd[r+1]+cu[l]-cu[r+1]-cd[l] >=K:
                    ans = min(ans, (iX[r] - iX[l])*dY)
                    l+=1
                else:r+=1

    print(ans)
main()

# Optimized solution
n,k=list(map(int,input().split()))
points=[]
for _ in range(n):
    x,y=list(map(int,input().split()))
    points.append((x,y))
points.sort()
ans=float('inf')
for i in range(n-k+1):
    for j in range(i+k-1,n):
        y_sorted=sorted(points[i:j+1],key=lambda x:x[1])
        height_min=float('inf')
        for l in range(j-i-k+2):
            height_min=min(height_min,y_sorted[l+k-1][1]-y_sorted[l][1])
            ans=min(ans,(points[j][0]-points[i][0])*height_min)
print(ans)
# Original solution
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,k = list(map(int, input().split()))
    xy = [list(map(int, input().split())) for _ in range(n)]
    x = sorted(xy, key=lambda a: a[0])
    y = sorted(xy, key=lambda a: a[1])

    res = 10**20
    for l in range(n):
        for r in range(l+1, n):
            for b in range(n):
                for t in range(b+1, n):
                    cnt = 0
                    for vx, vy in xy:
                        if x[l][0] <= vx <= x[r][0] and y[b][1] <= vy <= y[t][1]:
                            cnt += 1
                        if cnt >= k:
                            res = min(res, (x[r][0]-x[l][0])*(y[t][1]-y[b][1]))
                            break
    print(res)

if __name__ == '__main__':
    main()

# Optimized solution
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,k = list(map(int, input().split()))
    xy = [list(map(int, input().split())) for _ in range(n)]
    x = sorted(xy, key=lambda a: a[0])
    y = sorted(xy, key=lambda a: a[1])

    res = 10**20
    for l in range(n):
        for r in range(l+1, n):
            for b in range(n):
                for t in range(b+1, n):
                    cnt = 0
                    for vx, vy in x[l:r+1]:
                        if y[b][1] <= vy <= y[t][1]:
                            cnt += 1
                        if cnt >= k:
                            res = min(res, (x[r][0]-x[l][0])*(y[t][1]-y[b][1]))
                            break
    print(res)

if __name__ == '__main__':
    main()
# Original solution
N, K = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(N)]
ans = 10**30
for i in range(N):
    for j in range(N):
        for k in range(N):
            for l in range(N):
                x0, y0 = x[i]
                x1, y1 = x[j]
                x2, y2 = x[k]
                x3, y3 = x[l]
                x_min = min([x0, x1, x2, x3])
                x_max = max([x0, x1, x2, x3])
                y_min = min([y0, y1, y2, y3])
                y_max = max([y0, y1, y2, y3])
                cnt = 0
                for m in range(N):
                    x4, y4 = x[m]
                    if (x_min <= x4 <= x_max) and (y_min <= y4 <= y_max):
                        cnt += 1
                if cnt >= K:
                    S = (x_max - x_min) * (y_max - y_min)
                    ans = min(S, ans)
print(ans)

# Optimized solution
n, k = list(map(int, input().split()))
p = [list(map(int, input().split())) for i in range(n)]
p = sorted(p, key=lambda _: _[0])
ans = 10**30
for b in range(n):
    x_b, y_b = p[b]
    for t in range(n):
        x_t, y_t = p[t]
        if y_t <= y_b:
            continue
        v = [_ for _ in p if y_b <= _[1] <= y_t]
        for i in range(len(v) - k + 1):
            x_i, y_i = v[i]
            x_j, y_j = v[i+k-1]
            ans = min(ans, (x_j - x_i) * (y_t - y_b))
print(ans)
# Original solution
import itertools
n,k = list(map(int,input().split()))
x = []
a = []
b = []
for i in range(n):
    x1,y1=[int(i) for i in input().split()]
    x.append([x1,y1])
    a.append(x1)
    b.append(y1)
ue = list(itertools.combinations(a,2))
mi = list(itertools.combinations(b,2))
ans = float("inf")
for u,d in ue:
  for m,h in mi:
    kazu = 0
    if u > d:
      UP = u
      DO = d
    else:
      UP = d
      DO = u
    if m > h:
      RI = m
      LE = h
    else:
      RI = h
      LE = m
    for i in  x:
      if (UP >= i[0] and i[0]>= DO and RI >= i[1] and i[1] >= LE):
        kazu += 1
    if kazu >= k:
      ans = min(ans,(UP-DO)*(RI-LE))
print(ans)

# Optimized solution
import itertools
n,k = list(map(int,input().split()))
x = []
a = []
b = []
for i in range(n):
    x1,y1=[int(i) for i in input().split()]
    x.append([x1,y1])
    a.append(x1)
    b.append(y1)
ue = list(itertools.combinations(a,2))
mi = list(itertools.combinations(b,2))
e = len(ue)
ue.extend(mi)
ans = float("inf")
for i in range(e):
  u = ue[i]
  if u[0] > u[1]:
    UP = u[0]
    DO = u[1]
  else:
    UP = u[1]
    DO = u[0]
  for j in range(e):
    kazu = 0
    m = ue[j+e]
    if m[0] > m[1]:
      RI = m[0]
      LE = m[1]
    else:
      RI = m[1]
      LE = m[0]
    for i in  x:
      c = i[0]
      d = i[1]
      if (UP >= c and c>= DO and RI >= d and d >= LE):
        kazu += 1
    if kazu >= k:
      ans = min(ans,(UP-DO)*(RI-LE))
print(ans)
# Original solution
from collections import defaultdict

N, K = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(N)]
INF = 10 ** 19

acc = defaultdict(int)

x = [-INF]
y = [-INF]

for ex, ey in xy:
	acc[(ex, ey)] = 1
	x.append(ex)
	y.append(ey)

x.sort()
y.sort()

for i in range(N):
	for j in range(N + 1):
		acc[(x[i+1], y[j])] += acc[(x[i], y[j])]

for j in range(N):
	for i in range(N + 1):
		acc[(x[i], y[j+1])] += acc[(x[i], y[j])]

ans = INF
for i in range(1, N + 1):
	for j in range(i + 1, N + 1):
		for k in range(1, N + 1):
			for l in range(k + 1, N + 1):
				cnt = acc[(x[j], y[l])] - acc[(x[j], y[k-1])] - acc[(x[i-1], y[l])] + acc[(x[i-1], y[k-1])]
				if cnt >= K:
					sq = (x[j] - x[i]) * (y[l] - y[k])
					ans = min(ans, sq)

print(ans)


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

xy.sort()

ans = INF
for i in range(n):
	for j in range(i + k - 1, n):
		width = xy[j][0] - xy[i][0]

		y = [xy[idx][1] for idx in range(i, j + 1)]
		y.sort()

		for e1, e2 in zip(y, y[k-1:]):
			height = e2 - e1
			area = width * height
			ans = min(ans, area)

print(ans)
# Original solution
n, k = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(n)]
INF = 10 ** 19

xy.sort()

ans = INF
for i in range(n):
	for j in range(i + k - 1, n):
		width = xy[j][0] - xy[i][0]

		y = [xy[idx][1] for idx in range(i, j + 1)]
		y.sort()

		for e1, e2 in zip(y, y[k-1:]):
			height = e2 - e1
			area = width * height
			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)]

xy.sort()

ans = float("inf")
for i in range(n):
    for j in range(i + k - 1, n):
        width = xy[j][0] - xy[i][0]
        y = [e for _, e in xy[i:j+1]]
        y.sort()
        for e1, e2 in zip(y, y[k-1:]):
            height = e2 - e1
            area = width * height
            ans = min(ans, area)

print(ans)
# Original solution
import itertools
N,K=list(map(int,input().split()))
XY=[list(map(int,input().split())) for i in range(N)]
l=[i for i in range(N)]
ans=float("inf")
for v in itertools.combinations(l,2):
  xmax=max(XY[v[0]][0],XY[v[1]][0])
  xmin=min(XY[v[0]][0],XY[v[1]][0])
  ymax=max(XY[v[0]][1],XY[v[1]][1])
  ymin=min(XY[v[0]][1],XY[v[1]][1])
  k=0
  for xy in XY:
    x,y=xy[0],xy[1]
    if xmin<=x and x<=xmax:
      if ymin<=y and y<=ymax:
        k+=1    
  if k>=K:
    ans=min(ans,(xmax-xmin)*(ymax-ymin))
    
for v in itertools.combinations(l,3):
  xmax=max(XY[v[0]][0],XY[v[1]][0],XY[v[2]][0])
  xmin=min(XY[v[0]][0],XY[v[1]][0],XY[v[2]][0])
  ymax=max(XY[v[0]][1],XY[v[1]][1],XY[v[2]][1])
  ymin=min(XY[v[0]][1],XY[v[1]][1],XY[v[2]][1])
  k=0
  for xy in XY:
    x,y=xy[0],xy[1]
    if xmin<=x and x<=xmax:
      if ymin<=y and y<=ymax:
        k+=1    
  if k>=K:
    ans=min(ans,(xmax-xmin)*(ymax-ymin))
    
for v in itertools.combinations(l,4):
  xmax=max(XY[v[0]][0],XY[v[1]][0],XY[v[2]][0],XY[v[3]][0])
  xmin=min(XY[v[0]][0],XY[v[1]][0],XY[v[2]][0],XY[v[3]][0])
  ymax=max(XY[v[0]][1],XY[v[1]][1],XY[v[2]][1],XY[v[3]][1])
  ymin=min(XY[v[0]][1],XY[v[1]][1],XY[v[2]][1],XY[v[3]][1])
  k=0
  for xy in XY:
    x,y=xy[0],xy[1]
    if xmin<=x and x<=xmax:
      if ymin<=y and y<=ymax:
        k+=1    
  if k>=K:
    ans=min(ans,(xmax-xmin)*(ymax-ymin))
print(ans)

# Optimized solution
import itertools
N,K=list(map(int,input().split()))
XY=[list(map(int,input().split())) for i in range(N)]
ans=float("inf")

for xv in itertools.combinations( [xy[0] for xy in XY] ,2):
  for yv in itertools.combinations( [xy[1] for xy in XY] ,2):
    xmax=max(xv[0],xv[1])
    xmin=min(xv[0],xv[1])
    ymax=max(yv[0],yv[1])
    ymin=min(yv[0],yv[1])

    k=0
    for xy in XY:
      x,y=xy[0],xy[1]
      if xmin<=x and x<=xmax:
        if ymin<=y and y<=ymax:
          k+=1    
    if k>=K:
      ans=min(ans,(xmax-xmin)*(ymax-ymin))
print(ans)