Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

N,K=map(int,input().split())
o=[tuple(map(int,input().split())) for _ in range(N)]
ans=float("inf")

for i,j in combinations(o,2):
    x1,y1=i
    x2,y2=j
    xmax,xmin=max(x1,x2),min(x1,x2)

    for k,l in combinations(o,2):
        x3,y3=k
        x4,y4=l
        ymax,ymin=max(y3,y4),min(y3,y4)

        v=0
        for m in o:
            x5,y5=m
            if xmin<=x5<=xmax and ymin<=y5<=ymax:
                v+=1
        
        if v>=K:
            ans=min(ans,(ymax-ymin)*(xmax-xmin))


print(ans)

Fixed submission:
from itertools import combinations as comb
n,k=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(range(n),2):
  for (c,d) in comb(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)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product as pd
n,k=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(range(n),repeat=2):
  for (b,d) in pd(range(n),repeat=2):
    v=min(v,calc(a,b,c,d))
print(v)

Fixed submission:
from itertools import combinations as comb
n,k=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(range(n),2):
  for (c,d) in comb(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)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product as pd
g=lambda x,y:(min(x,y),max(x,y))
n,k=map(int,input().split())
o=[tuple(map(int,input().split())) for _ in range(n)]

def f(a,b,c,d):
  lx,rx=g(o[a][0],o[b][0])
  dy,uy=g(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(range(n),repeat=2):
  for (b,d) in pd(range(n),repeat=2):
    v=min(v,f(a,b,c,d))
print(v)

Fixed submission:
from itertools import combinations as comb
n,k=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(range(n),2):
  for (c,d) in comb(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)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product as pd
f=lambda x,y:(x,y) if x<y else (y,x) 
n,k=map(int,input().split())
o=[tuple(map(int,input().split())) for _ in range(n)]

def calc(a,b,c,d):
  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:
    return (rx-lx)*(uy-dy)
  return float("inf")

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

Fixed submission:
from itertools import combinations as comb
n,k=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(range(n),2):
  for (c,d) in comb(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)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product as pd
f=lambda x,y:(x,y) if x<y else (y,x) 
n,k=map(int,input().split())
o=[tuple(map(int,input().split())) for _ in range(n)]

v=float("inf")
for (a,c) in pd(range(n),repeat=2):
  for (b,d) in pd(range(n),repeat=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)

Fixed submission:
from itertools import combinations as comb
n,k=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(range(n),2):
  for (c,d) in comb(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)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product as pd
f=lambda x,y:(x,y) if x<y else (y,x) 
n,k=map(int,input().split())
o=[tuple(map(int,input().split())) for _ in range(n)]

v=float("inf")
for (a,c) in pd(range(n),repeat=2):
  for (b,d) in pd(range(n),repeat=2):
    lx,rx=f(o[a][0],o[b][0])
    dy,uy=f(o[c][1],o[d][1])
    cnt=sum(1 for i in range(n) if lx<=o[i][0]<=rx and dy<=o[i][1]<=uy)
    if cnt==k:
      v=min(v,(rx-lx)*(uy-dy))
print(v)

Fixed submission:
from itertools import combinations as comb
n,k=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(range(n),2):
  for (c,d) in comb(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)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product as pd
f=lambda x,y:(x,y) if x<y else (y,x) 
n,k=map(int,input().split())
o=[tuple(map(int,input().split())) for _ in range(n)]

v=float("inf")
for (a,b,c,d) in pd(range(n),repeat=4):
  lx,rx=f(o[a][0],o[b][0])
  dy,uy=f(o[c][1],o[d][1])
  if lx==rx or dy==uy:continue
  cnt=sum(1 for i in range(n) if lx<=o[i][0]<=rx and dy<=o[i][1]<=uy)
  if cnt==k:
    v=min(v,(rx-lx)*(uy-dy))
print(v)

Fixed submission:
from itertools import combinations as comb
n,k=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(range(n),2):
  for (c,d) in comb(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)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product as pd
f=lambda x,y:(x,y) if x<y else (y,x) 
n,k=map(int,input().split())
o=[tuple(map(int,input().split())) for _ in range(n)]

v=float("inf")
for (a,b,c,d) in pd(range(n),repeat=4):
  lx,rx=f(o[a][0],o[b][0])
  dy,uy=f(o[c][1],o[d][1])
  if lx==rx or dy==uy:continue
  cnt=sum(1 for i in range(n) if lx<=o[i][0]<=rx and dy<=o[i][1]<=uy)
  if cnt==k:
    v=min(v,(rx-lx)*(uy-dy))
print(v)

Fixed submission:
from itertools import combinations as comb
n,k=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(range(n),2):
  for (c,d) in comb(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)