Language: C++

#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = LLONG_MAX - 10;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

ll contain(ll min_x, ll min_y, ll max_x, ll max_y, vpl& vx){
    ll ans = 0;
    REP(i, vx.size()){
        ll x = vx[i].ff, y = vx[i].ss;
        if(min_x <= x && x <= max_x && min_y <= y && y <= max_y){
            ans++;
        }
    }
    return ans;
}

ll area(ll min_x, ll min_y, ll max_x, ll max_y){
    return abs((max_x - min_x) * (max_y - min_y));
}

int main(){
    ll N, K; cin >> N >> K;
    vpl vx(N);
    REP(i, N){
        ll x,y; cin >> x >> y;
        vx[i] = PL(x,y);
    }
    ll ans = LINF;
    REP(i, N) FOR(j, i+1, N){
        ll min_x = min(vx[i].ff, vx[j].ff);
        ll min_y = min(vx[i].ss, vx[j].ss);
        ll max_x = max(vx[i].ff, vx[j].ff);
        ll max_y = max(vx[i].ss, vx[j].ss);
        ll c = contain(min_x, min_y, max_x, max_y, vx);
        if(c >= K) ans = min(ans, area(min_x, min_y, max_x, max_y));
    }
    REP(i, N) FOR(j, i+1, N) FOR(k, j+1, N){
        ll min_x = min(vx[i].ff, min(vx[j].ff, vx[k].ff));
        ll min_y = min(vx[i].ss, min(vx[j].ss, vx[k].ss));
        ll max_x = max(vx[i].ff, max(vx[j].ff, vx[k].ff));
        ll max_y = max(vx[i].ss, max(vx[j].ss, vx[k].ss));
        ll c = contain(min_x, min_y, max_x, max_y, vx);
        if(c >= K) ans = min(ans, area(min_x, min_y, max_x, max_y));
    }
    REP(i, N) FOR(j, i+1, N) FOR(k, j+1, N) FOR(l, k+1, N){
        ll min_x = min(vx[i].ff, min(vx[j].ff, min(vx[k].ff, vx[l].ff)));
        ll min_y = min(vx[i].ss, min(vx[j].ss, min(vx[k].ss, vx[l].ss)));
        ll max_x = max(vx[i].ff, max(vx[j].ff, max(vx[k].ff, vx[l].ff)));
        ll max_y = max(vx[i].ss, max(vx[j].ss, max(vx[k].ss, vx[l].ss)));
        ll c = contain(min_x, min_y, max_x, max_y, vx);
        if(c >= K) ans = min(ans, area(min_x, min_y, max_x, max_y));
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc:41:17: error: 'LLONG_MAX' was not declared in this scope
   41 | const ll LINF = LLONG_MAX - 10;
      |                 ^~~~~~~~~
a.cc:18:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   17 | #include <cassert>
  +++ |+#include <climits>
   18 | using namespace std;