Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
XY = []

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


ans = float('inf')

for lx, _ in XY:
    for rx, _ in XY:
        if lx > rx:
            continue
        for _, dy in XY:
            for _, uy in XY:
                if dy > uy:
                    continue
                count = 0
                for x,y in XY:
                    if lx <= x <= rx and dy <= y <= uy:
                        count += 1
                if count >= K:
                    ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

Fixed submission:
N,K = map(int,input().split())
XY = []

for i in range(N):
    x,y = map(int,input().split())
    XY.append((x,y))


ans = float('inf')

for lx, _ in XY:
    for rx, _ in XY:
        if lx > rx:
            continue
        for _, dy in XY:
            for _, uy in XY:
                if dy > uy:
                    continue
                count = 0
                for x,y in XY:
                    if lx <= x <= rx and dy <= y <= uy:
                        count += 1
                if count >= K:
                    ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
XY = list(list(map(int,input().split()))for i in range(N))

ans = float('inf')

for lx, _ in XY:
    for rx, _ in XY:
        if lx > rx:
            continue
        for _, dy in XY:
            for _, uy in XY:
                if dy > uy:
                    continue
                count = 0
                for x,y in XY:
                    if lx <= x <= rx and dy <= y <= uy:
                        count += 1
                if count >= K:
                    ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

Fixed submission:
N,K = map(int,input().split())
XY = []

for i in range(N):
    x,y = map(int,input().split())
    XY.append((x,y))


ans = float('inf')

for lx, _ in XY:
    for rx, _ in XY:
        if lx > rx:
            continue
        for _, dy in XY:
            for _, uy in XY:
                if dy > uy:
                    continue
                count = 0
                for x,y in XY:
                    if lx <= x <= rx and dy <= y <= uy:
                        count += 1
                if count >= K:
                    ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
XY = list(list(map(int,input().split()))for i in range(N))

ans = float('inf')

for lx, _ in XY:
    for rx, _ in XY:
        if lx < rx:
            for _, dy in XY:
                for _, uy in XY:
                    if dy < uy:
                        count = 0
                        for x,y in XY:
                            if lx <= x <= rx and dy <= y <= uy:
                                count += 1
                        if count >= K:
                            ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

Fixed submission:
N,K = map(int,input().split())
XY = []

for i in range(N):
    x,y = map(int,input().split())
    XY.append((x,y))


ans = float('inf')

for lx, _ in XY:
    for rx, _ in XY:
        if lx > rx:
            continue
        for _, dy in XY:
            for _, uy in XY:
                if dy > uy:
                    continue
                count = 0
                for x,y in XY:
                    if lx <= x <= rx and dy <= y <= uy:
                        count += 1
                if count >= K:
                    ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
XY = list(list(map(int,input().split()))for i in range(N))

ans = float('inf')
XY.sort()

for i in range(N):
    lx = XY[i][0]
    for j in range(i+1,N):
        rx = XY[j][0]
        for k in range(N):
            dy = XY[k][1]
            for l in range(N):
                uy = XY[l][1]
                hoge = 0
                for x,y in XY:
                    if lx <= x and rx >= x and uy >= y and dy <= y:
                        hoge += 1
                if hoge >= K:
                    ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

Fixed submission:
N,K = map(int,input().split())
XY = []

for i in range(N):
    x,y = map(int,input().split())
    XY.append((x,y))


ans = float('inf')

for lx, _ in XY:
    for rx, _ in XY:
        if lx > rx:
            continue
        for _, dy in XY:
            for _, uy in XY:
                if dy > uy:
                    continue
                count = 0
                for x,y in XY:
                    if lx <= x <= rx and dy <= y <= uy:
                        count += 1
                if count >= K:
                    ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
XY = list(list(map(int,input().split()))for i in range(N))

ans = float('inf')

for i in range(N):
    lx = XY[i][0]
    for j in range(N):
        rx = XY[j][0]
        for k in range(N):
            dy = XY[k][1]
            for l in range(N):
                uy = XY[l][1]
                hoge = 0
                for x,y in XY:
                    if lx <= x and rx >= x and uy >= y and dy <= y:
                        hoge += 1
                if hoge >= K:
                    ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

Fixed submission:
N,K = map(int,input().split())
XY = []

for i in range(N):
    x,y = map(int,input().split())
    XY.append((x,y))


ans = float('inf')

for lx, _ in XY:
    for rx, _ in XY:
        if lx > rx:
            continue
        for _, dy in XY:
            for _, uy in XY:
                if dy > uy:
                    continue
                count = 0
                for x,y in XY:
                    if lx <= x <= rx and dy <= y <= uy:
                        count += 1
                if count >= K:
                    ans = min(ans,(rx-lx)*(uy-dy))
print(ans)

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
XY = list(list(map(int,input().split()))for i in range(N))
XY.sort()
ans = float('inf')
for i in range(N-K+1):
    miny = XY[i][1]
    maxy = miny
    y = []
    for j in range(i,i+K):
        y.append(XY[j][1])
    y.sort()
    ans = min((XY[j][0] - XY[i][0])*(y[-1]-y[0]),ans)
    for j in range(i+K,N):
        y.append(XY[j][1])  
        y.sort()
        for k in range(j-K+1):
            ans = min((XY[j][0] - XY[i][0])*(y[k+K-1]-y[k]),ans)
print(ans)

Fixed submission:
N,K = map(int,input().split())
XY = []

for i in range(N):
    x,y = map(int,input().split())
    XY.append((x,y))


ans = float('inf')

for lx, _ in XY:
    for rx, _ in XY:
        if lx > rx:
            continue
        for _, dy in XY:
            for _, uy in XY:
                if dy > uy:
                    continue
                count = 0
                for x,y in XY:
                    if lx <= x <= rx and dy <= y <= uy:
                        count += 1
                if count >= K:
                    ans = min(ans,(rx-lx)*(uy-dy))
print(ans)