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# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    int u = 0;
    static void Main(string[] args)
    {
        int[] n = Read.ints();
        int[,] a = new int[n[0],n[1]];
        int ans = int.MaxValue;
        for(int i = 0; i < n[0]; i++)
        {
            var u =Read.ints();
            a[i, 0] = u[0];
            a[i, 1] = u[1];
        }

        for(int i = 0; i < n[0]; i++)
        {
            for (int j = i + 1; j < n[0]; j++)
            {
                int Ans = Math.Abs(a[i,0]-a[j,0])*Math.Abs(a[i,1]-a[j,1]);
                int u = 2;
                for (int k = 0; k < n[0] && k != i && k != j; k++)
                {
                    if (a[k, 0] <= Math.Max(a[i, 0], a[j, 0]) && a[k, 0] >= Math.Min(a[i, 0], a[j, 0]) && a[k, 1] <= Math.Max(a[i, 1], a[j, 1]) && a[k, 1] >= Math.Min(a[i, 1], a[j, 1]))
                    { u++; }
                }
                if (u >= n[1] && Ans != 0)
                {
                    ans = Math.Min(ans,Ans);
                }
            }
        }
        Console.WriteLine(ans);
    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b)
    {
        return a / gcd(a, b) * b;
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (long i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}/*
 int[] n = Read.ints();
       // int u = n[0];
        int[,] s = new int[n[1], 2];
        int[] u = new int[n[0]];
        for (int i = 0; i < n[1]; i++)
        {
            int[] h = Read.ints();
            s[i, 0] = h[0];
            s[i, 1] = h[1];
            u[h[0] - 1]++;
            u[h[1] - 1]++;
        }
        int[][] edge=new int [n[0]][];
        bool isconnect(int from, int to, int v)
        {
            bool[] dp = new bool[v];
            Queue<int> q = new Queue<int>();
            q.Enqueue(from);
            dp[from] = true;
            while (q.Count != 0)
            {
                int now = q.Dequeue();
                edge[now]=new int[u[now]];
                for (int i = 0; i < edge[now].Length; i++)
                {
                    int next = edge[now][i];
                    if (dp[next]) { continue; }
                    if (next == to) { return true; }
                    dp[next] = true;
                    q.Enqueue(next);
                }
            }
            return false;
        }
        int ans = 0;
        for (int i = 0; i < n[1]; i++)
        {

            if (!isconnect(s[i, 0], s[i, 1], n[0])) { ans++; }
        }
        Console.WriteLine(n[1]-ans);
        Console.ReadLine();


 */