Language: C++

/**
 *    author:  FromDihPout
 *    created: 2020-08-09
**/

#include <bits/stdc++.h>
using namespace std;

const long long INF = 6e18;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, k;
    cin >> n >> k;
    vector<pair<int,int>> a(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        a[i] = {x, y};
    }
    
    long long area = INF;
    for (int p1 = 0; p1 < n; p1++) {
        for (int p2 = 0; p2 < n; p2++) {
            for (int p3 = 0; p3 < n; p3++) {
                for (int p4 = 0; p4 < n; p4++) {
                    long long x1 = min({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
                    long long x2 = max({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
                    long long y1 = min({a[p1].s, a[p2].s, a[p3].s, a[p4].s});
                    long long y2 = max({a[p1].s, a[p2].s, a[p3].s, a[p4].s});
                    
                    int cnt = 0;
                    for (int i = 0; i < n; i++) {
                        if (a[i].f >= x1 && a[i].f <= x2
                            && a[i].s >= y1 && a[i].s <= y2) {
                            cnt++;
                        }
                        if (cnt >= k) break;
                    }
                    if (cnt >= k) {
                        area = min(area, (x2 - x1) * (y2 - y1));
                    }
                }
            }
        }
    }
    
    cout << area << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:47: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f'
   29 |                     long long x1 = min({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
      |                                               ^
a.cc:29:56: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f'
   29 |                     long long x1 = min({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
      |                                                        ^
a.cc:29:65: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f'
   29 |                     long long x1 = min({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
      |                                                                 ^
a.cc:29:74: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f'
   29 |                     long long x1 = min({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
      |                                                                          ^
a.cc:29:39: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   29 |                     long long x1 = min({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
      |                                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
a.cc:30:47: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f'
   30 |                     long long x2 = max({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
      |                                               ^
a.cc:30:56: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f'
   30 |                     long long x2 = max({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
      |                                                        ^
a.cc:30:65: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f'
   30 |                     long long x2 = max({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
      |                                                                 ^
a.cc:30:74: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'f'
   30 |                     long long x2 = max({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
      |                                                                          ^
a.cc:30:39: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   30 |                     long long x2 = max({a[p1].f, a[p2].f, a[p3].f, a[p4].f});
      |                                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
a.cc:31:47: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
   31 |                     long long y1 = min({a[p1].s, a[p2].s, a[p3].s, a[p4].s});
      |                                               ^
a.cc:31:56: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
   31 |                     long long y1 = min({a[p1].s, a[p2].s, a[p3].s, a[p4].s});
      |                                                        ^
a.cc:31:65: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
   31 |                     long long y1 = min({a[p1].s, a[p2].s, a[p3].s, a[p4].s});
      |                                                                 ^
a.cc:31:74: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
   31 |                     long long y1 = min({a[p1].s, a[p2].s, a[p3].s, a[p4].s});
      |                                                                          ^
a.cc:31:39: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   31 |                     long long y1 = min({a[p1].s, a[p2].s, a[p3].s, a[p4].s});
      |                                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
a.cc:32:47: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
   32 |                     long long y2 = max({a[p1].s, a[p2].s, a[p3].s, a[p4].s});
      |                                               ^
a.cc:32:56: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
   32 |                     long long y2 = max({a[p1].s, a[p2].s, a[p3].s, a[p4].s});
      |                                                        ^
a.cc:32:65: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
   32 |                     long long y2 = max({a[p1].s, a[p2].s, a[p3].s, a[p4].s});
      |                                                                 ^
a.cc:32:74: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 's'
   32 |                     long long y2 = max({a[p1].s, a[p2].s, a[p3].s, a[p4].s});
      |                                                                          ^
a.cc:32:39: error: no matching function for call to 'max(<brace-enclosed initializer