Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>

#define int ll; // ＾o＾

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define REPI2(it,b,e) for(auto it = (b); it != (e); ++it)
#define REPI(it,c) REPI2(it, (c).begin(), (c).end())
#define RREPI(it,c) REPI2(it, (c).rbegin(), (c).rend())
#define REPI_ERACE2(it, b, e) for(auto it = (b); it != (e);)
#define REPI_ERACE(it, c) REPI_ERACE2(it, (c).begin(), (c).end())
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define BR cout<<"\n";
#define cauto const auto&

#define dump(...) do{ auto __DUMP_NAME_LIST__ = split(#__VA_ARGS__,','); print(__DUMP_NAME_LIST__, __VA_ARGS__);BR;}while(false)


using  ll = long long;
using PAIR = std::pair<ll, ll>;
using VS = std::vector<std::string>;
using VL = std::vector<long long>;
using VD = std::vector<double>;
// using VI = std::vector<int>;
// using VVI = std::vector<std::vector<int>>;
using VVL = std::vector<std::vector<ll>>;

using std::cout;
// using std::endl;
constexpr char endl = '\n';
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::queue;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::unordered_multiset;
using std::multiset;
using std::bitset;
using std::priority_queue;

constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;
constexpr ll INF = 1LL << 60;

template<class T> std::istream& operator >> (std::istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
template<class S, class T>std::ostream& operator<<(std::ostream& os, const std::pair<S, T>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
inline std::list<std::string> split(std::string str, char del) { std::list<std::string> sList; string s = ""; for (const auto& c : str) { if (c == del) { sList.emplace_back(s); s = ""; } else { if (c != ' ' || del == ' ') { s += c; } } }sList.emplace_back(s);	return sList; }
struct Preprocessing { Preprocessing() { std::cin.tie(0); std::ios::sync_with_stdio(0); }; };

template<class T>struct has_begin { private:	template <class U>	static auto check(U x) -> decltype(x.begin(), std::true_type{});	static std::false_type check(...); public:	static bool const value = decltype(check(std::declval<T>()))::value; };
inline void print(std::list<std::string>& str); template<class Primitive, class... Tail, std::enable_if_t<!has_begin<Primitive>::value, std::nullptr_t> = nullptr>inline void print(std::list<std::string>& str, const Primitive& x, const Tail&... tail); template<class Container, class... Tail>inline auto print(std::list<std::string>& str, const Container& c, const Tail&... tail) -> decltype(c.begin()); template<class... Tail>inline void print(std::list<std::string>& str, const std::string& s, const Tail&... tail);
template<class Container>inline auto printSingle(const Container& c) ->decltype(c.begin()) { for (const auto& x : c) { std::cout << x << " "; }std::cout << "\n"; return c.begin(); }
template<class Primitive, std::enable_if_t<!has_begin<Primitive>::value, std::nullptr_t> = nullptr>inline void printSingle(const Primitive& x) { std::cout << x << " "; }
inline void print(std::list<std::string>& str) {}
template<class Primitive, class... Tail, std::enable_if_t<!has_begin<Primitive>::value, std::nullptr_t> = nullptr>inline void print(std::list<std::string>& str, const Primitive& x, const Tail&... tail) { std::cout << *str.begin() << ":" << x << " "; if (sizeof...(tail) > 0) { std::cout << "\n"; str.pop_front(); print(str, tail...); } }
template<class Container, class... Tail>inline auto print(std::list<std::string>& str, const Container& c, const Tail&... tail) ->decltype(c.begin()) { std::cout << "-- " << *str.begin() << " --\n"; for (const auto& x : c) { printSingle(x); BR; }std::cout << "\n"; str.pop_front();	print(str, tail...); return c.begin(); }
template<class... Tail>inline void print(std::list<std::string>& str, const std::string& s, const Tail&... tail) { std::cout << *str.begin() << ":" << s << "\n"; str.pop_front();	print(str, tail...); }


//=============================================================================================

// ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// ll pow(ll a, ll b) { ll ans = 1; while (b > 0) { if (b % 2 == 1) { ans *= a; ans %= MOD; }b /= 2; a *= a; a %= MOD; }return ans; }
// ll comb(ll a, ll b) { static constexpr ll size = 1e6; static VL fac(size); static VL finv(size); static VL inv(size); static ll n = 0; if (n > a) { return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD; }fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; FOR(i, 2, a + 1) { inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; fac[i] = fac[i - 1] * (ll)i%MOD; finv[i] = finv[i - 1] * inv[i] % MOD; }n = a + 1; return comb(a, b); }
// multiset<ll> prime_decomposition(ll n) { ll i = 2; multiset<ll> table{}; while (i * i <= n) { while (n % i == 0) { n /= i;	table.emplace(i); }++i; }if (n > 1) { table.emplace(n); return table; }return table; }
// vector<bool> eratosthenes(ll n) { vector<bool> lst(n + 1, true); lst[0] = lst[1] = false; FOR(i, 2, n / 2 + 1) { lst[i * 2] = false; }for (ll i = 3; i <= n; i += 2) { if (lst[i] == false) { continue; }FOR(j, 2, n / i + 1) { lst[i*j] = false; } }return lst; }

//==============================================================================================
vector<PAIR> v;


ll S(vector<ll>::iterator& l, vector<ll>::reverse_iterator& r,
	vector<ll>::iterator& d, vector<ll>::reverse_iterator& u, ll k) {
	ll count = 0;
	REPC(p, v) {
		if (p.first >= *l&&p.first <= *r&&p.second >= *d&&p.second <= *u) { ++count; }
	}
	if (count < k) { return 1e20; }

	ll ans = (*r - *l)*(*u - *d);

	ans = std::min(ans, S((++l)--, r, d, u, k));
	ans = std::min(ans, S(l, (++r)--, d, u, k));
	ans = std::min(ans, S(l, r, (++d)--, u, k));
	ans = std::min(ans, S(l, r, d, (++u)--, k));

	return ans;
}

signed main() {
	ll n, k;
	cin >> n >> k;
	v.reserve(n);
	VL w, h;
	w.reserve(n);
	h.reserve(n);
	REP(i, n) {
		ll a, b;
		cin >> a >> b;
		w.emplace_back(a);
		h.emplace_back(b);
		v.emplace_back(a, b);
	}
	sort(ALL(w));
	sort(ALL(h));

	cout << S(w.begin(), w.rbegin(), h.begin(), h.rbegin(), k) << endl;
}

Compiler output:
a.cc:84:107: error: redefinition of default argument for 'typename std::enable_if<(! has_begin<T>::value), std::nullptr_t>::type <anonymous>'
   84 | template<class Primitive, class... Tail, std::enable_if_t<!has_begin<Primitive>::value, std::nullptr_t> = nullptr>inline void print(std::list<std::string>& str, const Primitive& x, const Tail&... tail) { std::cout << *str.begin() << ":" << x << " "; if (sizeof...(tail) > 0) { std::cout << "\n"; str.pop_front(); print(str, tail...); } }
      |                                                                                                           ^~~~~~~
a.cc:80:155: note: original definition appeared here
   80 | inline void print(std::list<std::string>& str); template<class Primitive, class... Tail, std::enable_if_t<!has_begin<Primitive>::value, std::nullptr_t> = nullptr>inline void print(std::list<std::string>& str, const Primitive& x, const Tail&... tail); template<class Container, class... Tail>inline auto print(std::list<std::string>& str, const Container& c, const Tail&... tail) -> decltype(c.begin()); template<class... Tail>inline void print(std::list<std::string>& str, const std::string& s, const Tail&... tail);
      |                                                                                                                                                           ^~~~~~~
a.cc: In function 'll S(std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, ll)':
a.cc:108:33: warning: overflow in conversion from 'double' to 'll' {aka 'long long int'} changes value from '1.0e+20' to '9223372036854775807' [-Woverflow]
  108 |         if (count < k) { return 1e20; }
      |                                 ^~~~
a.cc:112:36: error: cannot bind non-const lvalue reference of type 'std::vector<long long int>::iterator&' to an rvalue of type '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >'
  112 |         ans = std::min(ans, S((++l)--, r, d, u, k));
      |                               ~~~~~^~
a.cc:102:28: note:   initializing argument 1 of 'll S(std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, ll)'
  102 | ll S(vector<ll>::iterator& l, vector<ll>::reverse_iterator& r,
      |      ~~~~~~~~~~~~~~~~~~~~~~^
a.cc:113:39: error: cannot bind non-const lvalue reference of type 'std::vector<long long int>::reverse_iterator&' {aka 'std::reverse_iterator<__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> > >&'} to an rvalue of type 'std::reverse_iterator<__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> > >'
  113 |         ans = std::min(ans, S(l, (++r)--, d, u, k));
      |                                  ~~~~~^~
a.cc:102:61: note:   initializing argument 2 of 'll S(std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, ll)'
  102 | ll S(vector<ll>::iterator& l, vector<ll>::reverse_iterator& r,
      |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
a.cc:114:42: error: cannot bind non-const lvalue reference of type 'std::vector<long long int>::iterator&' to an rvalue of type '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >'
  114 |         ans = std::min(ans, S(l, r, (++d)--, u, k));
      |                                     ~~~~~^~
a.cc:103:31: note:   initializing argument 3 of 'll S(std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, ll)'
  103 |         vector<ll>::iterator& d, vector<ll>::reverse_iterator& u, ll k) {
      |         ~~~~~~~~~~~~~~~~~~~~~~^
a.cc:115:45: error: cannot bind non-const lvalue reference of type 'std::vector<long long int>::reverse_iterator&' {aka 'std::reverse_iterator<__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> > >&'} to an rvalue of type 'std::reverse_iterator<__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> > >'
  115 |         ans = std::min(ans, S(l, r, d, (++u)--, k));
      |                                        ~~~~~^~
a.cc:103:64: note:   initializing argument 4 of 'll S(std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, ll)'
  103 |         vector<ll>::iterator& d, vector<ll>::reverse_iterator& u, ll k) {
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
a.cc: In function 'int main()':
a.cc:137:26: error: cannot bind non-const lvalue reference of type 'std::vector<long long int>::iterator&' to an rvalue of type 'std::vector<long long int>::iterator'
  137 |         cout << S(w.begin(), w.rbegin(), h.begin(), h.rbegin(), k) << endl;
      |                   ~~~~~~~^~
a.cc:102:28: note:   initializing argument 1 of 'll S(std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, std::vector<long long int>::iterator&, std::vector<long long int>::reverse_iterator&, ll)'
  102 | ll S(vector<ll>::iterator& l, vector<ll>::reverse_iterator& r,
      |      ~~~~~~~~~~~~~~~~~~~~~~^