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

N,K=map(int, sys.stdin.readline().split())
X=[]
Y=[]
XY=[]

for _ in range(N):
	x,y=map(int, sys.stdin.readline().split())
	X.append(x)
	Y.append(y)
	XY.append( (x,y) )
X.sort()
Y.sort()

L=list( itertools.product(X,Y ) )

ans=float("inf")

for x1,y1 in L:
	for x2,y2 in L:
		cnt=0
		for x, y in XY:
			if x1<=x<=x2 and y1<=y<=y2:
				cnt+=1
	
		menseki=abs(x1-x2)*abs(y1-y2)
		if K<=cnt:
			ans=min(ans, menseki)

print ans

Fixed submission:
import itertools

N,K=list(map(int,raw_input().split()))
x=[]
y=[]
pts=[]
for i in range(N):
	a1,a2=map(int,raw_input().split())
	x.append(a1)
	y.append(a2)
	pts.append([a1,a2])

#print "# x,y"
x.sort()
y.sort()
#print x
#print y

#print "# pts"
#print pts
pts.sort(key=lambda x:x[0])
#print pts

ans=10**20


for y1 in y:
	for y2 in y:
		if y1>=y2:
			continue
		for x1 in x:
			cnt=0
			for p in pts:
				if p[0]>=x1 and p[1]>=y1 and p[1]<=y2:
					#print p[0],p[1],x1,y1,y2
					cnt+=1
					if cnt==K:
						x2=p[0]
						#print x1,y1,x2,y2,cnt,abs(x2-x1)*abs(y2-y1)
						ans=min(ans,abs(x2-x1)*abs(y2-y1))
						break

print ans

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

N,K=list(map(int,raw_input().split()))
x=[]
y=[]
sx=[]
sy=[]
for i in range(N):
	a1,a2=map(int,raw_input().split())
	x.append(a1)
	sx.append(a1)
	y.append(a2)
	sy.append(a2)

#print "# x,y"
#print x
#print y


ans=10**20
#print ans
for i in range(N):
	for j in range(N):
		for k in range(N):
			for l in range(N):
				cnt=0
				if x[i]<x[j] and y[k]<y[l]:
					#print i,j,k,l,x[i],y[k],x[j],y[l],sx.index(x[i]),sx.index(x[j]),abs(x[i]-x[j])*abs(y[k]-y[l])
					for m in range(N):
						x_t=x[m]
						y_t=y[m]
						if (x_t>=x[i] and x_t<=x[j]) or (x_t>=x[j] and x_t<=x[i]):
							if (y_t>=y[k] and y_t<=y[l]) or (y_t>=y[l] and y_t<=y[k]):
								cnt+=1
					
				
				#print cnt
				if cnt>=K:
					#print x[i],y[k],x[j],y[l],cnt,abs(x[i]-x[j])*abs(y[k]-y[l])
					ans=min(ans,abs(x[i]-x[j])*abs(y[k]-y[l]))


print ans


Fixed submission:
import itertools

N,K=list(map(int,raw_input().split()))
x=[]
y=[]
pts=[]
for i in range(N):
	a1,a2=map(int,raw_input().split())
	x.append(a1)
	y.append(a2)
	pts.append([a1,a2])

#print "# x,y"
x.sort()
y.sort()
#print x
#print y

#print "# pts"
#print pts
pts.sort(key=lambda x:x[0])
#print pts

ans=10**20


for y1 in y:
	for y2 in y:
		if y1>=y2:
			continue
		for x1 in x:
			cnt=0
			for p in pts:
				if p[0]>=x1 and p[1]>=y1 and p[1]<=y2:
					#print p[0],p[1],x1,y1,y2
					cnt+=1
					if cnt==K:
						x2=p[0]
						#print x1,y1,x2,y2,cnt,abs(x2-x1)*abs(y2-y1)
						ans=min(ans,abs(x2-x1)*abs(y2-y1))
						break

print ans

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

N,K=list(map(int,raw_input().split()))
x=[]
y=[]
for i in range(N):
	a1,a2=map(int,raw_input().split())
	x.append(a1)
	y.append(a2)
#print x
#print y


ans=100000000000000000000
for i in range(N):
	for j in range(i,N):
		for k in range(N):
			for l in range(k,N):
				cnt=0
				for m in range(N):
					x_t=x[m]
					y_t=y[m]
					if (x_t>=x[i] and x_t<=x[j]) or (x_t>=x[j] and x_t<=x[i]):
						if (y_t>=y[k] and y_t<=y[l]) or (y_t>=y[l] and y_t<=y[k]):
							cnt+=1
				#print x[i],y[k],x[j],y[l],cnt,abs(x[i]-x[j])*abs(y[k]-y[l])
				#print cnt
				if cnt>=K:
					#print x[i],y[k],x[j],y[l],cnt,abs(x[i]-x[j])*abs(y[k]-y[l])
					ans=min(ans,abs(x[i]-x[j])*abs(y[k]-y[l]))


print ans

Fixed submission:
import itertools

N,K=list(map(int,raw_input().split()))
x=[]
y=[]
pts=[]
for i in range(N):
	a1,a2=map(int,raw_input().split())
	x.append(a1)
	y.append(a2)
	pts.append([a1,a2])

#print "# x,y"
x.sort()
y.sort()
#print x
#print y

#print "# pts"
#print pts
pts.sort(key=lambda x:x[0])
#print pts

ans=10**20


for y1 in y:
	for y2 in y:
		if y1>=y2:
			continue
		for x1 in x:
			cnt=0
			for p in pts:
				if p[0]>=x1 and p[1]>=y1 and p[1]<=y2:
					#print p[0],p[1],x1,y1,y2
					cnt+=1
					if cnt==K:
						x2=p[0]
						#print x1,y1,x2,y2,cnt,abs(x2-x1)*abs(y2-y1)
						ans=min(ans,abs(x2-x1)*abs(y2-y1))
						break

print ans

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

N,K=list(map(int,raw_input().split()))
x=[]
y=[]
for i in range(N):
	a1,a2=map(int,raw_input().split())
	x.append(a1)
	y.append(a2)
#print x
#print y


ans=100000000000000000000
for i in range(N):
	for j in range(N):
		for k in range(N):
			for l in range(N):
				if i<=j and k<=l:
					cnt=0
					for m in range(N):
						x_t=x[m]
						y_t=y[m]
						if (x_t>=x[i] and x_t<=x[j]) or (x_t>=x[j] and x_t<=x[i]):
							if (y_t>=y[k] and y_t<=y[l]) or (y_t>=y[l] and y_t<=y[k]):
								cnt+=1
					#print x[i],y[k],x[j],y[l],cnt,abs(x[i]-x[j])*abs(y[k]-y[l])
					#print cnt
					if cnt>=K:
						#print x[i],y[k],x[j],y[l],cnt,abs(x[i]-x[j])*abs(y[k]-y[l])
						ans=min(ans,abs(x[i]-x[j])*abs(y[k]-y[l]))


print ans

Fixed submission:
import itertools

N,K=list(map(int,raw_input().split()))
x=[]
y=[]
pts=[]
for i in range(N):
	a1,a2=map(int,raw_input().split())
	x.append(a1)
	y.append(a2)
	pts.append([a1,a2])

#print "# x,y"
x.sort()
y.sort()
#print x
#print y

#print "# pts"
#print pts
pts.sort(key=lambda x:x[0])
#print pts

ans=10**20


for y1 in y:
	for y2 in y:
		if y1>=y2:
			continue
		for x1 in x:
			cnt=0
			for p in pts:
				if p[0]>=x1 and p[1]>=y1 and p[1]<=y2:
					#print p[0],p[1],x1,y1,y2
					cnt+=1
					if cnt==K:
						x2=p[0]
						#print x1,y1,x2,y2,cnt,abs(x2-x1)*abs(y2-y1)
						ans=min(ans,abs(x2-x1)*abs(y2-y1))
						break

print ans

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

N,K=list(map(int,raw_input().split()))
x=[]
y=[]
for i in range(N):
	a1,a2=map(int,raw_input().split())
	x.append(a1)
	y.append(a2)
#print x
#print y


ans=100000000000000000000
for i in range(N):
	for j in range(N):
		for k in range(N):
			for l in range(N):
				cnt=0
				for m in range(N):
					x_t=x[m]
					y_t=y[m]
					if (x_t>=x[i] and x_t<=x[j]) or (x_t>=x[j] and x_t<=x[i]):
						if (y_t>=y[k] and y_t<=y[l]) or (y_t>=y[l] and y_t<=y[k]):
							cnt+=1
				#print cnt
				if cnt>=K:
					#print x[i],y[k],x[j],y[l],cnt,abs(x[i]-x[j])*abs(y[k]-y[l])
					ans=min(ans,abs(x[i]-x[j])*abs(y[k]-y[l]))


print ans

Fixed submission:
import itertools

N,K=list(map(int,raw_input().split()))
x=[]
y=[]
pts=[]
for i in range(N):
	a1,a2=map(int,raw_input().split())
	x.append(a1)
	y.append(a2)
	pts.append([a1,a2])

#print "# x,y"
x.sort()
y.sort()
#print x
#print y

#print "# pts"
#print pts
pts.sort(key=lambda x:x[0])
#print pts

ans=10**20


for y1 in y:
	for y2 in y:
		if y1>=y2:
			continue
		for x1 in x:
			cnt=0
			for p in pts:
				if p[0]>=x1 and p[1]>=y1 and p[1]<=y2:
					#print p[0],p[1],x1,y1,y2
					cnt+=1
					if cnt==K:
						x2=p[0]
						#print x1,y1,x2,y2,cnt,abs(x2-x1)*abs(y2-y1)
						ans=min(ans,abs(x2-x1)*abs(y2-y1))
						break

print ans

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

N,K=list(map(int,raw_input().split()))
a = []
for i in range(N):
    a.append(map(int,raw_input().split()))
#print "# a"
#print a


b=[]
for i in range(N):
	for j in range(N):
		#print i,j,a[i][0],a[j][1]
		b.append([a[i][0],a[j][1]])

#print "# b"
#print b
#print len(b)


c=[]
c=list(itertools.combinations(b, 2))
#print "# c"
#print c
#print len(c)

area=[]
for i in range(len(c)):
	area.append(abs(c[i][0][0]-c[i][1][0])*abs(c[i][0][1]-c[i][1][1]))

#print area

for i in range(len(c)):
	cnt=0
	x1=c[i][0][0]
	x2=c[i][1][0]
	y1=c[i][0][1]
	y2=c[i][1][1]
	#print x1,y1,x2,y2
	for j in range(len(a)):
		#print a[j][0],a[j][1]
		if (a[j][0]>=x1 and a[j][0]<=x2) or (a[j][0]>=x2 and a[j][0]<=x1):
			if (a[j][1]>=y1 and a[j][1]<=y2) or (a[j][1]>=y2 and a[j][1]<=y1):
				cnt+=1
	#print cnt
	if cnt<K:
		area[i]=-1

#print area

min=0
for i in range(len(area)):
	if area[i]==-1:
		continue
	elif min==0:
		min=area[i]
	elif area[i]<min:
		min=area[i]

print min



Fixed submission:
import itertools

N,K=list(map(int,raw_input().split()))
x=[]
y=[]
pts=[]
for i in range(N):
	a1,a2=map(int,raw_input().split())
	x.append(a1)
	y.append(a2)
	pts.append([a1,a2])

#print "# x,y"
x.sort()
y.sort()
#print x
#print y

#print "# pts"
#print pts
pts.sort(key=lambda x:x[0])
#print pts

ans=10**20


for y1 in y:
	for y2 in y:
		if y1>=y2:
			continue
		for x1 in x:
			cnt=0
			for p in pts:
				if p[0]>=x1 and p[1]>=y1 and p[1]<=y2:
					#print p[0],p[1],x1,y1,y2
					cnt+=1
					if cnt==K:
						x2=p[0]
						#print x1,y1,x2,y2,cnt,abs(x2-x1)*abs(y2-y1)
						ans=min(ans,abs(x2-x1)*abs(y2-y1))
						break

print ans