Problem:
Score : 400 points

Problem Statement

We have N points in a two-dimensional plane.

The coordinates of the i-th point (1 \leq i \leq N) are (x_i,y_i).

Let us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of the N points in its interior.

Here, points on the sides of the rectangle are considered to be in the interior.

Find the minimum possible area of such a rectangle.

Constraints

2 \leq K \leq N \leq 50

-10^9 \leq x_i,y_i \leq 10^9 (1 \leq i \leq N)

x_i≠x_j (1 \leq i<j \leq N)

y_i≠y_j (1 \leq i<j \leq N)

All input values are integers. (Added at 21:50 JST)

Input

Input is given from Standard Input in the following format:

N K
x_1 y_1
:
x_{N} y_{N}

Output

Print the minimum possible area of a rectangle that satisfies the condition.

Sample Input 1

4 4
1 4
3 3
6 2
8 1

Sample Output 1

21

One rectangle that satisfies the condition with the minimum possible area has the following vertices: (1,1), (8,1), (1,4) and (8,4).

Its area is (8-1) × (4-1) = 21.

Sample Input 2

4 2
0 0
1 1
2 2
3 3

Sample Output 2

1

Sample Input 3

4 3
-1000000000 -1000000000
1000000000 1000000000
-999999999 999999999
999999999 -999999999

Sample Output 3

3999999996000000001

Watch out for integer overflows.

Solution in C++ (GCC 9.2.1) (judge verdict: Wrong Answer)

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
//#define mod 998244353
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline void out(T a){ cout << a << '\n'; }
void YN(bool ok){if(ok) cout << "Yes" << endl; else cout << "No" << endl;}
//void YN(bool ok){if(ok) cout << "YES" << endl; else cout << "NO" << endl;}


const ll INF=1e18;
const int mx=200005;

struct Pair{
    ll min_x;
    ll max_x;
    ll min_y;
    ll max_y;
};

ll area(Pair p){
    ll x=p.max_x-p.min_x;
    ll y=p.max_y-p.min_y;
    return x*y;
}

Pair dp[55][55];

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n,K;
    cin>>n>>K;
    V<ll> x(n),y(n);
    rep(i,n) cin>>x[i]>>y[i];
    ll tmp=ll(1e9);
    for(int i=0;i<=50;i++) for(int j=0;j<=50;j++) dp[i][j]=(Pair){-tmp,tmp,-tmp,tmp};
    rep(i,n){
        rep(j,i){
            for(int k=j+1;k<=i;k++){
                Pair p=(Pair){min(x[j],x[k]),max(x[j],x[k]),min(y[j],y[k]),max(y[j],y[k])};
                if(area(p)<area(dp[i+1][2])) dp[i+1][2]=p;
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=3;j<=i+1;j++){
            for(int k=2;k<=i;k++){
                Pair p=dp[k][j-1];
                chmin(p.min_x,x[i]);
                chmax(p.max_x,x[i]);
                chmin(p.min_y,y[i]);
                chmax(p.max_y,y[i]);
                if(area(p)<area(dp[i+1][j])) dp[i+1][j]=p;
                //if(area(dp[i][j])<area(dp[i+1][j])) dp[i+1][j]=dp[i][j];
            }
        }
    }
    ll ans=4*INF+1;
    for(int i=2;i<=n;i++) chmin(ans,area(dp[i][K]));
    out(ans);
}