Problem:
Problem Statement
In A.D. 2101, war was beginning. The enemy has taken over all of our bases. To recapture the bases, we decided to set up a headquarters. We need to define the location of the headquarters so that all bases are not so far away from the headquarters. Therefore, we decided to choose the location to minimize the sum of the distances from the headquarters to the furthest $K$ bases. The bases are on the 2-D plane, and we can set up the headquarters in any place on this plane even if it is not on a grid point.
Your task is to determine the optimal headquarters location from the given base positions.
Input
The input consists of a single test case in the format below.
$N$ $K$
$x_{1}$ $y_{1}$
$\vdots$
$x_{N}$ $y_{N}$
The first line contains two integers $N$ and $K$. The integer $N$ is the number of the bases ($1 \le N \le 200$). The integer $K$ gives how many bases are considered for calculation ($1 \le K \le N$). Each of the following $N$ lines gives the x and y coordinates of each base. All of the absolute values of given coordinates are less than or equal to $1000$, i.e., $-1000 \le x_{i}, y_{i} \le 1000$ is satisfied.
Output
Output the minimum sum of the distances from the headquarters to the furthest $K$ bases. The output can contain an absolute or a relative error no more than $10^{-3}$.
Examples
Input
Output
3 1
0 1
1 0
1 1
0.70711
6 3
1 1
2 1
3 2
5 3
8 5
13 8
17.50426
9 3
573 -50
-256 158
-751 14
314 207
293 567
59 -340
-243 -22
-268 432
-91 -192
1841.20904

Submitted solutions:

code_snippet: #include <bits/stdc++.h>
     
#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair
     
using namespace std;
     
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, k;
  cin >> n >> k;
  vpii arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i].first >> arr[i].second;
  auto eval = [&] (double x, double y) -> double {
    vector <double> ret(n);
    for (int i = 0; i < n; i++) {
      ret.pb(hypot(arr[i].first - x, arr[i].second - y));
    }
    sort(rall(ret));
    double sum = 0;
    for (int i = 0; i < k; i++) sum += ret[i];
    return sum;
  };
  auto get = [&] (double x) -> double {
    double l = -1e3 - 100;
    double r = 1e3 + 100;
    for (int it = 0; it < 70; it++) {
      double ll = (2 * l + r) / 3.0;
      double rr = (l + 2 * r) / 3.0;
      if (eval(x, ll) < eval(x, rr)) {
        r = rr;
      } else {
        l = ll;
      }
    };
    return eval(x, l);
  };
  double l = -1e3 - 100;
  double r = 1e3 + 100;
  for (int it = 0; it < 70; it++) {
    double ll = (2 * l + r) / 3.0;
    double rr = (l + 2 * r) / 3.0;
    if (get(ll) < get(rr)) {
      r = rr;
    } else {
      l = ll;
    }
  }
  cout << fixed << setprecision(12) << get(l) << '\n';
  return (0);
}
accuracy: 1
time_ms: 100
memory_kb: 3608
final_rank: 15

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using V = vector<T>;
const ll INF = 1ll << 60;
#define rep(i,n) for(int i=0; i<int(n); i++)
template<class A, class B> void chmax(A& l, const B& r){ if(l < r) l = r; }
template<class A, class B> void chmin(A& l, const B& r){ if(r < l) l = r; }


void testcase(){
  int N, K; cin >> N >> K;
  V<double> X(N), Y(N);
  rep(i,N) cin >> X[i] >> Y[i];
  double Z = 1000;
  auto f = [&](double x, double y) -> double {
    V<double> F(N);
    rep(i,N) F[i] = hypot(X[i] - x, Y[i] - y);
    sort(F.rbegin(), F.rend());
    double a = 0;
    rep(i,K) a += F[i];
    return a;
  };
  auto findX = [&](double y) -> double {
    double l = -Z, r = Z;
    double fl = f(l,y), fr = f(r,y);
    double ans = min(fl, fr);
    while(r-l >= 1.0e-6){
      double x1 = (l + l + r) / 3;
      double x2 = (l + r + r) / 3;
      double fx1 = f(x1, y);
      double fx2 = f(x2, y);
      ans = min(ans, min(fx1, fx2));
      if(fx1 < fx2){ r = x2; fr = fx2; }
      else{ l = x1; fl = fx1; }
    }
    return ans;
  };
  auto findY = [&]() -> double {
    double l = -Z, r = Z;
    double fl = findX(l), fr = findX(r);
    double ans = min(fl, fr);
    while(r-l >= 1.0e-6){
      double x1 = (l + l + r) / 3;
      double x2 = (l + r + r) / 3;
      double fx1 = findX(x1);
      double fx2 = findX(x2);
      ans = min(ans, min(fx1, fx2));
      if(fx1 < fx2){ r = x2; fr = fx2; }
      else{ l = x1; fl = fx1; }
    }
    return ans;
  };
  cout << findY() << "\n";
}


int main(){
  cin.tie(0)->sync_with_stdio(0);
  cout.precision(20);
  cout << fixed;
  testcase();
  return 0;
}
accuracy: 1
time_ms: 50
memory_kb: 3612
final_rank: 13

code_snippet: #line 2 "cp-library/src/cp-template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull  = unsigned long long;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128_t;
template < class T > bool chmin(T& a, T b) { if(a > b) { a = b; return true; } return false; }
template < class T > bool chmax(T& a, T b) { if(a < b) { a = b; return true; } return false; }
template < class T, class U > T ceil (T x, U y) { return (x > 0 ? (x + y - 1) / y :           x / y); }
template < class T, class U > T floor(T x, U y) { return (x > 0 ?           x / y : (x - y + 1) / y); }
int popcnt(i32 x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(i64 x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }

#line 2 "cp-library/src/utility/rep_itr.hpp"
template < class T > struct itr_rep {
    T i, d;
    constexpr itr_rep(const T i) noexcept : i(i), d(1) {}
    constexpr itr_rep(const T i, const T d) noexcept : i(i), d(d) {}
    void operator++() noexcept { i += d; }
    constexpr int operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr_rep x) const noexcept { return d > 0 ? i < x.i : i > x.i; }
};

template < class T > struct rep {
    const itr_rep< T > s, t;
    constexpr rep(const T t) noexcept : s(0), t(t) {}
    constexpr rep(const T s, const T t) noexcept : s(s), t(t) {}
    constexpr rep(const T s, const T t, const T d) noexcept : s(s, d), t(t, d) {}
    constexpr auto begin() const noexcept { return s; }
    constexpr auto end  () const noexcept { return t; }
};

template < class T > struct revrep {
    const itr_rep < T > s, t;
    constexpr revrep(const T t) noexcept : s(t - 1, -1), t(-1, -1) {}
    constexpr revrep(const T s, const T t) noexcept : s(t - 1, -1), t(s - 1, -1) {}
    constexpr revrep(const T s, const T t, const T d) noexcept : s(t - 1, -d), t(s - 1, -d) {}
    constexpr auto begin() const noexcept { return s; }
    constexpr auto end  () const noexcept { return t; }
};
#line 3 "cp-library/src/utility/io.hpp"

/* 128bit integer */
istream& operator>>(istream& is, i128& x) {
    std::string s; is >> s;
    int pm = (s[0] == '-');
    x = 0;
    for(int i : rep(pm, int(s.size()))) x = x * 10 + (s[i] - '0');
    if(pm) x *= -1;
    return is;
}
ostream& operator<<(ostream& os, const i128& x) {
    if(x == 0) return os << '0';
    i128 y = x;
    if(y < 0) { os << '-'; y *= -1; }
    std::vector<int> ny;
    while(y > 0) { ny.push_back(y % 10); y /= 10; }
    for(int i : revrep(ny.size())) os << ny[i];
    return os;
}

template < class S, class T > istream& operator>>(istream& is,       std::pair< S, T >& x) { is >> x.first        >> x.second; return is; }
template < class S, class T > ostream& operator<<(ostream& os, const std::pair< S, T >& x) { os << x.first << " " << x.second; return os; }

namespace scanner {
    struct sca {
        template < class T > operator T() {
            T s; std::cin >> s; return s;
        }
    };
    struct vec {
        int n;
        vec(int n) : n(n) {}
        template < class T > operator std::vector< T >() {
            std::vector< T > v(n);
            for(T& x : v) std::cin >> x;
            return v;
        }
    };
    struct mat {
        int h, w;
        mat(int h, int w) : h(h), w(w) {}
        template < class T > operator std::vector< std::vector< T > >() {
            std::vector m(h, std::vector< T >(w));
            for(std::vector< T >& v : m) for(T& x : v) std::cin >> x;
            return m;
        }
    };
    struct speedup {
        speedup() {
            std::cin.tie(0);
            std::ios::sync_with_stdio(0);
        }
    } speedup_instance;
}
scanner::sca in() { return scanner::sca(); }
scanner::vec in(int n) { return scanner::vec(n); }
scanner::mat in(int h, int w) { return scanner::mat(h, w); }

namespace printer {
    void precision(int d) { std::cout << std::fixed << std::setprecision(d); }
    void flush() { std::cout.flush(); }
}

template < class T >
ostream& operator<<(ostream& os, const std::vector< T > a) {
    int n = a.size();
    for(int i : rep(n)) { os << a[i]; if(i != n - 1) os << ' '; }
    return os;
}

int print() { std::cout << '\n'; return 0; }
template < class head, class... tail > int print(head&& h, tail&&... t) {
    std::cout << h; if(sizeof...(tail)) std::cout << ' ';
    return print(std::forward<tail>(t)...);
}
template < class T > int print_n(const std::vector< T > a) {
    int n = a.size();
    for(int i : rep(n)) std::cout << a[i] << "\n";
    return 0;
}


#line 2 "cp-library/src/utility/key_val.hpp"

template < class K, class V >
struct key_val {
    K key; V val;
    key_val() {}
    key_val(K key, V val) : key(key), val(val) {}
    template < std::size_t Index >
    std::tuple_element_t< Index, key_val >& get() {
        if constexpr (Index == 0) return key;
        if constexpr (Index == 1) return val;
    }
};

namespace std {

template < class K, class V > struct tuple_size < key_val< K, V > > : integral_constant< size_t, 2 > {};
template < class K, class V > struct tuple_element < 0, key_val< K, V > > { using type = K; };
template < class K, class V > struct tuple_element < 1, key_val< K, V > > { using type = V; };

}
#line 2 "cp-library/src/utility/vec_op.hpp"
template < class T > key_val< int, T > max_of(const vector< T >& a) {
    int i = std::max_element(a.begin(), a.end()) - a.begin();
    return {i, a[i]};
}
template < class T > key_val< int, T > min_of(const vector< T >& a) {
    int i = std::min_element(a.begin(), a.end()) - a.begin();
    return {i, a[i]};
}
template < class S, class T > S sum_of(const vector< T >& a) {
    S sum = 0;
    for(const T x : a) sum += x;
    return sum;
}
template < class S, class T > vector< S > freq_of(const vector< T >& a, T L, T R) {
    vector< S > res(R - L, S(0));
    for(const T x : a) res[x - L] += 1;
    return res;
}
template < class S, class T > struct prefix_sum {
    vector< S > s;
    prefix_sum(const vector< T >& a) : s(a) {
        s.insert(s.begin(), S(0));
        for(int i : rep(a.size())) s[i + 1] += s[i];
    }
    // [L, R)
    S sum(int L, int R) { return s[R] - s[L]; }
};
#line 3 "cp-library/src/utility/heap.hpp"

template < class T > using heap_min = std::priority_queue< T, std::vector< T >, std::greater< T > >;
template < class T > using heap_max = std::priority_queue< T, std::vector< T >, std::less< T > >;

#line 27 "cp-library/src/cp-template.hpp"

#line 1 "cp-library/src/algorithm/bin_search.hpp"
template < class T, class F >
T bin_search(T ok, T ng, F f) {
    while(abs(ng - ok) > 1) {
        T mid = (ok + ng) / 2;
        (f(mid) ? ok : ng) = mid;
    }
    return ok;
}

template < class T, class F >
T bin_search_real(T ok, T ng, F f, int step = 80) {
    while(step--) {
        T mid = (ok + ng) / 2;
        (f(mid) ? ok : ng) = mid;
    }
    return ok;
}
#line 2 "cp-library/src/algorithm/argsort.hpp"

template < class T > std::vector< int > argsort(const std::vector< T > &a) {
    std::vector< int > ids((int)a.size());
    std::iota(ids.begin(), ids.end(), 0);
    std::sort(ids.begin(), ids.end(), [&](int i, int j) {
        return a[i] < a[j] || (a[i] == a[j] && i < j);
    });
    return ids;
}
#line 1 "macro.hpp"
namespace macro {

using size_type = int;
template < class container > void  sort(container& a) { std::sort(std:: begin(a), std:: end(a)); }
template < class container > void rsort(container& a) { std::sort(std::rbegin(a), std::rend(a)); }
template < class container > void reverse(container& a) { std::reverse(std::begin(a), std::end(a)); }
template < class container > void unique(container& a) {
    std::sort(std::begin(a), std::end(a));
    a.erase(std::unique(std::begin(a), std::end(a)), std::end(a));
}
template < class container > container  sorted(const container& a) { container b = a;  sort(b); return std::move(b); }
template < class container > container rsorted(const container& a) { container b = a; rsort(b); return std::move(b); }
template < class container, class compare > void sort(container& a, const compare& cmp) { std::sort(std::begin(a), std::end(a), cmp); }
template < class container, class compare > container sorted(const container& a, const compare& cmp) { container b = a; sort(b, cmp); return std::move(b); }
template < class container, class value > size_type lower_bound(const container& a, const value& x) { return std::lower_bound(std::begin(a), std::end(a), x) - std::begin(a); }
template < class container, class value > size_type upper_bound(const container& a, const value& x) { return std::upper_bound(std::begin(a), std::end(a), x) - std::begin(a); }

const std::vector<std::pair<size_type, size_type>> dir4 = { {+1,  0}, {-1,  0}, { 0, +1}, { 0, -1} };
const std::vector<std::pair<size_type, size_type>> dir8 = { {-1, -1}, {-1,  0}, {-1, +1}, { 0, -1}, { 0, +1}, {+1, -1}, {+1,  0}, {+1, +1} };

#ifdef _DEBUG
#define debug(x) std::cout << "[" << __LINE__ << "] " << #x << ": " << x << std::endl
#else
#define debug(x)
#endif

template < class container > void concat(container& a, const container& b) {
    a.insert(std::end(a), std::begin(b), std::end(b));
}
std::vector<size_type> iota(const size_type n) {
    std::vector<size_type> I(n);
    std::iota(std::begin(I), std::end(I), 0);
    return I;
}
template < class container > std::vector<size_type> sort_idx(const container& a) {
    const size_type n = a.size();
    std::vector<size_type> I = iota(n);
    std::sort(std::begin(I), std::end(I), [&](size_type i, size_type j) { return a[i] < a[j] or (a[i] == a[j] and i < j); });
    return I;
}
template < class container, class compare > std::vector<size_type> sort_idx(const container& a, const compare& cmp) {
    const size_type n = a.size();
    std::vector<size_type> I = iota(n);
    std::sort(std::begin(I), std::end(I), [&](size_type i, size_type j) { return cmp(a[i], a[j]) or (a[i] == a[j] and i < j); });
    return std::move(I);
}

struct grid {
    using size_type = int;
    size_type H, W;
    grid(const size_type H, const size_type W) : H(H), W(W) {}
    bool contains(const size_type i, const size_type j) {
        return 0 <= i and i < H and 0 <= j and j < W;
    }
};

using f64 = long double;

template < class T > vector< T >& operator++(vector< T >& a) { for(T& x : a) x++; return a; }
template < class T > vector< T >& operator--(vector< T >& a) { for(T& x : a) x--; return a; }
template < class T > vector< T >  operator++(vector< T >& a, signed) { vector< T > res = a; for(T& x : a) x++; return res; }
template < class T > vector< T >  operator--(vector< T >& a, signed) { vector< T > res = a; for(T& x : a) x--; return res; }

} // namespace macro

using namespace macro;
#line 1 "cp-library/src/algorithm/ternary_search.hpp"
template < class K, class V, class F >
std::pair< K, V > ternary_search(K L, K R, F f) {
    while(R - L >= K(3)) {
        K kL = (L + L + R) / 3, kR = (L + R + R) / 3;
        V vL = f(kL), vR = f(kR);
        if(vL < vR) R = kR; else L = kL;
    }
    std::pair< K, V > res = {R, f(R)};
    for(K k : rep(L, R)) {
        V v = f(k);
        if(v < res.second) res = std::make_pair(k, v);
    }
    return res;
}

template < class K, class V, class F >
std::pair< K, V > ternary_search_real(K L, K R, F f, int step = 80) {
    while(step--) {
        K kL = (L + L + R) / 3.0, kR = (L + R + R) / 3.0;
        V vL = f(kL), vR = f(kR);
        if(vL < vR) R = kR; else L = kL;
    }
    return std::make_pair(L, f(L));
}
#line 4 "A.cpp"

int main() {
    int N = in(), K = in();
    vector<f64> x(N), y(N);
    for(int i : rep(N)) x[i] = in(), y[i] = in();

    auto f = [&](f64 X, f64 Y) {
        vector<f64> D(N);
        for(int i : rep(N)) D[i] = sqrtl((x[i] - X) * (x[i] - X) + (y[i] - Y) * (y[i] - Y));
        rsort(D);
        f64 sum = 0;
        for(int i : rep(K)) sum += D[i];
        return sum;
    };

    auto g = [&](f64 X) {
        return ternary_search_real<f64,f64>(-1000.0, +1000.0, [&](f64 Y) { return f(X, Y); }).second;
    };

    printer::precision(20);
    print(ternary_search_real<f64,f64>(-1000.0, +1000.0, [&](f64 X) { return g(X); }).second);
}
accuracy: 1
time_ms: 110
memory_kb: 3612
final_rank: 16

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (int i = (int)(s); i < (int)(t); ++i)
#define revrep(i, t, s) for (int i = (int)(t)-1; i >= (int)(s); --i)
#define all(x) begin(x), end(x)
template <typename T> bool chmax(T& a, const T& b) { return a < b ? (a = b, 1) : 0; }
template <typename T> bool chmin(T& a, const T& b) { return a > b ? (a = b, 1) : 0; }

using T = double;
using Vec = std::complex<T>;

std::istream& operator>>(std::istream& is, Vec& p) {
    T x, y;
    is >> x >> y;
    p = {x, y};
    return is;
}

T dot(const Vec& a, const Vec& b) { return (std::conj(a) * b).real(); }

T cross(const Vec& a, const Vec& b) { return (std::conj(a) * b).imag(); }

const T PI = acos(-1);
constexpr T eps = 1e-10;
inline bool eq(T a, T b) { return std::abs(a - b) <= eps; }
inline bool eq(Vec a, Vec b) { return std::abs(a - b) <= eps; }
inline bool lt(T a, T b) { return a < b - eps; }
inline bool leq(T a, T b) { return a <= b + eps; }

struct Line {
    Vec p1, p2;
    Line() = default;
    Line(const Vec& p1, const Vec& p2) : p1(p1), p2(p2) {}
    Vec dir() const { return p2 - p1; }
};

struct Segment : Line {
    using Line::Line;
};

struct Circle {
    Vec c;
    T r;
    Circle() = default;
    Circle(const Vec& c, T r) : c(c), r(r) {}
};

using Polygon = std::vector<Vec>;

Vec rot(const Vec& a, T ang) { return a * Vec(std::cos(ang), std::sin(ang)); }

Vec perp(const Vec& a) { return Vec(-a.imag(), a.real()); }

Vec projection(const Line& l, const Vec& p) {
    return l.p1 + dot(p - l.p1, l.dir()) * l.dir() / std::norm(l.dir());
}

Vec reflection(const Line& l, const Vec& p) {
    return T(2) * projection(l, p) - p;
}

// 0: collinear
// 1: counter-clockwise
// -1: clockwise
int ccw(const Vec& a, const Vec& b, const Vec& c) {
    if (eq(cross(b - a, c - a), 0)) return 0;
    if (lt(cross(b - a, c - a), 0)) return -1;
    return 1;
}

template <typename F>
pair<double, double> golden_section_search(F f, double lb, double ub, int iter = 100) {
    const auto phi = (1.+sqrt(5))/2;
    double m1 = ub - (ub - lb) / phi;
    double m2 = lb + (ub - lb) / phi;
    double v1 = f(m1), v2 = f(m2);
    for (int i = 0; i < iter; ++i) {
        if (v1 < v2) {
            ub = m2;
            m2 = m1;
            v2 = v1;
            m1 = ub - (ub - lb) / phi;
            v1 = f(m1);
        } else {
            lb = m1;
            m1 = m2;
            v1 = v2;
            m2 = lb + (ub - lb) / phi;
            v2 = f(m2);
        }
    }
    return {lb, v1};
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    int N, K;
    cin>>N>>K;
    vector<Vec> pts(N);
    for(auto&x:pts)cin>>x;

    auto [_, ans] = golden_section_search([&](double x){
        return golden_section_search([&](double y){
            Vec p(x, y);
            vector<T> dist(N);
            rep(i,0,N)dist[i]=abs(p - pts[i]);
            sort(all(dist));
            T res = 0.;
            rep(i,N-K,N) res += dist[i];
            return res;
        }, -1000., 1000.).second;
    }, -1000., 1000.);

    cout << ans << endl;
}
accuracy: 1
time_ms: 30
memory_kb: 3604
final_rank: 10

code_snippet: #include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std;

const int N = 205;
const double eps = 1e-9;
int n, K;
double ans, t[N];
struct node {
  double x, y;
} a[N];

double calc(double x, double y) {
  rep(i, 1, n) {
    double tt = (x - a[i].x) * (x - a[i].x) + (y - a[i].y) * (y - a[i].y);
    t[i] = sqrt(tt);
  }
  sort(t + 1, t + n + 1);
  double ret = 0;
  for (int i = n; i > n - K; i--)
    ret += t[i];
  return ret;
}

double solve2(double x) {
  double l = -1000, r = 1000, ans = 1e18;
  while (r - l > eps) {
    double lmid = l + (r - l) / 3;
    double rmid = r - (r - l) / 3;
    double lans = calc(x, lmid), rans = calc(x, rmid);
    if (lans <= rans)
      ans = lans, r = rmid;
    else
      ans = rans, l = lmid;
  }
  return ans;
}

void solve1() {
  double l = -1000, r = 1000;
  while (r - l > eps) {
    double lmid = l + (r - l) / 3;
    double rmid = r - (r - l) / 3;
    double lans = solve2(lmid), rans = solve2(rmid);
    if (lans <= rans)
      ans = lans, r = rmid;
    else
      ans = rans, l = lmid;
  }
  printf("%.5lf\n", ans);
}

int main() {
  cin >> n >> K;
  rep(i, 1, n) scanf("%lf%lf", &a[i].x, &a[i].y);
  solve1();
  return 0;
}
accuracy: 1
time_ms: 50
memory_kb: 3280
final_rank: 1

code_snippet: #include <bits/stdc++.h>
using namespace std;
#define rep(i, x) for(int i = 0; i < (x); i++)
using ll = long long;
#define all(v) v.begin(), v.end()

using point = pair<double, double>;
double dist(point a, point b) {
	a.first -= b.first;
	a.second -= b.second;
	return sqrt(a.first * a.first + a.second * a.second);
}

double abs(point a) { return sqrt(a.first * a.first + a.second * a.second); }

int main() {
	int n;
	cin >> n;
	int k;
	cin >> k;

	vector<point> pts;
	rep(_, n) {
		point p;
		cin >> p.first >> p.second;
		pts.push_back(p);
	}

	auto f = [&](point p) -> double {
		vector<double> dists;
		rep(i, n) dists.push_back(dist(p, pts[i]));
		sort(all(dists));
		double ret = 0;
		for(int i = n - k; i < n; i++) {
			ret += dists[i];
		}
		return ret;
	};

	auto smallest_x = [&](double y) -> double {
		double left = -1e5;
		double right = 1e5;
		rep(_, 100) {
			double low = (left + right) / 2;
			double high = (low) + (right - low) / 6;

			point lowpt(low, y);
			point highpt(high, y);
			if(f(lowpt) < f(highpt)) {
				right = high;
			} else {
				left = low;
			}
		}
		return right;
	};

	auto small_value = [&](double y) -> double {
		point p(smallest_x(y), y);
		return f(p);
	};

	double ymin = -1e5;
	double ymax = 1e5;

	rep(_, 100) {
		double lef = ymin + (ymax - ymin) / 3;
		double rig = ymin + (ymax - ymin) / 3 * 2;

		if(small_value(lef) < small_value(rig)) {
			ymax = rig;
		} else {
			ymin = lef;
		}
	}

	std::cout << fixed << setprecision(15);
	std::cout << small_value(ymin) << '\n';
}
accuracy: 1
time_ms: 90
memory_kb: 3556
final_rank: 14

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> void chmax(T& a, T b){ if(a < b) a = b; }
using C = complex<double>;


int main(){
    int N, K;
    cin >> N >> K;
    vector<C> A(N);
    for(auto& c : A){
        double x, y;
        cin >> x >> y;
        c = {x, y};
    }
    C s = 0;
    double k = 100;
    while(k > 1e-6){
        k *= 0.99;
        vector<C> B = A;
        for(auto& b : B) b -= s;
        sort(B.begin(), B.end(), [&](C& a, C& b){ return abs(a) > abs(b); });
        B.resize(K);
        s += [&]{ C sum = 0; for(auto& b : B) sum += b / abs(b); return sum; }() * k;
    }
    {
        vector<C> B = A;
        for(auto& b : B) b -= s;
        sort(B.begin(), B.end(), [&](C& a, C& b){ return abs(a) > abs(b); });
        B.resize(K);
        cout << fixed << setprecision(12);
        cout << [&]{ double sum = 0; for(auto& b : B) sum += abs(b); return sum; }() << endl;
    }
}
accuracy: 1
time_ms: 50
memory_kb: 3560
final_rank: 12

code_snippet: //by 菜鸡龙人
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> lpii;
typedef unsigned long long ull;
const double eps = 1e-10;
const double pi = acos(-1.0);
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 210;

struct Point{
    double x, y;
}p[N];
double a[N];
int n, k;

double dis(Point p1, Point p2) {
    return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}

double calc(double x0, double y0) {
    for(int i = 1; i <= n; i++) {
        a[i] = dis({x0, y0}, p[i]);
    }
    sort(a + 1, a + n + 1);
    reverse(a + 1, a + n + 1);
    double res = 0;
    for(int i = 1; i <= n && i <= k; i++) {
        res += a[i];
    }
    return res;
}

double gao2(double x0) {
    double l = -2000, r = 2000;
    while(r - l > eps) {
        double midl = (l * 2 + r) / 3;
        double midr = (l + r * 2) / 3;
        if(calc(x0, midl) <= calc(x0, midr)) {
            r = midr;
        }
        else {
            l = midl;
        }
    }
    return calc(x0, l);
}

double gao1(double l, double r) {
    while(r - l > eps) {
        double midl = (l * 2 + r) / 3;
        double midr = (l + r * 2) / 3;
        if(gao2(midl) <= gao2(midr)) {
            r = midr;
        }
        else {
            l = midl;
        }
    }
    return gao2(l);
}

void solve() {
    scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; i++) {
        scanf("%lf%lf", &p[i].x, &p[i].y);
    }
    printf("%.5f\n", gao1(-2000, 2000));
}

int main() {
    solve();
    return 0;
}
accuracy: 1
time_ms: 60
memory_kb: 3292
final_rank: 3

code_snippet: //by 菜鸡龙人
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> lpii;
typedef unsigned long long ull;
const double eps = 1e-3;
const double pi = acos(-1.0);
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 410;

struct Point{
    double x, y;
}point[N];
double a[N];
int n, k;

double dis(Point p1, Point p2) {
    return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}
double calc(double X,double Y){

    vector<double> V;

    for(int i = 0; i < n; i++){

        V.push_back(sqrt((X-point[i].x)*(X-point[i].x)+(Y-point[i].y)*(Y-point[i].y)));
    }

    sort(V.begin(),V.end());

    double ret = 0;
    int count = 0;

    for(int i = n-1; i >= 0; i--){

        ret += V[i];
        count++;

        if(count == k)break;
    }

    return ret;
}

double gao2(double X){

    double L = -1001,R = 1001;

    for(int loop = 0; loop < 100; loop++){

        double mid1 = (2.0*L+R)/3.0;
        double mid2 = (1.0*L+2.0*R)/3.0;

        if(calc(X,mid1) > calc(X,mid2)){

            L = mid1;
        }else{

            R = mid2;
        }
    }

    return calc(X,(L+R)/2);
}

double gao1(){

    double L = -1001,R = 1001;

    for(int loop = 0; loop < 100; loop++){

        double mid1 = (2.0*L+R)/3.0;
        double mid2 = (1.0*L+2.0*R)/3.0;

        if(gao2(mid1) > gao2(mid2)){

            L = mid1;
        }else{

            R = mid2;
        }
    }

    return gao2((L+R)/2);
}

void solve() {
    scanf("%d%d", &n, &k);
    for(int i = 0; i < n; i++) {
        scanf("%lf%lf", &point[i].x, &point[i].y);
    }
    printf("%.10lf\n", gao1());
}

int main() {
    solve();
    return 0;
}
//1841.20904
accuracy: 1
time_ms: 110
memory_kb: 3296
final_rank: 8

code_snippet: //by 菜鸡龙人
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> lpii;
typedef unsigned long long ull;
const double eps = 1e-3;
const double pi = acos(-1.0);
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 410;

struct Point{
    double x, y;
}point[N];
double a[N];
int n, k;

double dis(Point p1, Point p2) {
    return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}
double calc(double X,double Y){

    vector<double> V;

    for(int i = 0; i < n; i++){

        V.push_back(sqrt((X-point[i].x)*(X-point[i].x)+(Y-point[i].y)*(Y-point[i].y)));
    }

    sort(V.begin(),V.end());

    double ret = 0;
    int count = 0;

    for(int i = n-1; i >= 0; i--){

        ret += V[i];
        count++;

        if(count == k)break;
    }

    return ret;
}

double gao2(double X){

    double L = -1001,R = 1001;

    for(int loop = 0; loop < 100; loop++){

        double mid1 = (2.0*L+R)/3.0;
        double mid2 = (1.0*L+2.0*R)/3.0;

        if(calc(X,mid1) > calc(X,mid2)){

            L = mid1;
        }else{

            R = mid2;
        }
    }

    return calc(X,(L+R)/2);
}

double gao1(){

    double L = -1001,R = 1001;

    for(int loop = 0; loop < 100; loop++){

        double mid1 = (2.0*L+R)/3.0;
        double mid2 = (1.0*L+2.0*R)/3.0;

        if(gao2(mid1) > gao2(mid2)){

            L = mid1;
        }else{

            R = mid2;
        }
    }

    return gao2((L+R)/2);
}
int main(){

    scanf("%d %d",&n,&k);

    for(int i = 0; i < n; i++){

        scanf("%lf %lf",&point[i].x,&point[i].y);
    }

    printf("%.10lf\n",gao1());

    return 0;
}
accuracy: 1
time_ms: 110
memory_kb: 3296
final_rank: 8

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Point{

    double x,y;
};


int N,K;
Point point[205];

double calc(double X,double Y){

    vector<double> V;

    for(int i = 1; i <= N; i++){
        V.push_back(sqrt((X-point[i].x)*(X-point[i].x)+(Y-point[i].y)*(Y-point[i].y)));
    }

    sort(V.begin(),V.end());

    double ret = 0;
    int count = 0;

    for(int i = N - 1; i >= 0; i--){

        ret += V[i];
        count++;

        if(count == K)break;
    }

    return ret;
}

double thirds_searchY(double X){

    double L = -1001,R = 1001;

    for(int loop = 0; loop < 100; loop++){

        double mid1 = (2.0*L+R)/3.0;
        double mid2 = (1.0*L+2.0*R)/3.0;

        if(calc(X,mid1) > calc(X,mid2)){

            L = mid1;
        }else{

            R = mid2;
        }
    }

    return calc(X,(L+R)/2);
}

//Yをsガス
double thirds_searchX(){

    double L = -1001,R = 1001;

    for(int loop = 0; loop < 100; loop++){

        double mid1 = (2.0*L+R)/3.0;
        double mid2 = (1.0*L+2.0*R)/3.0;

        if(thirds_searchY(mid1) > thirds_searchY(mid2)){

            L = mid1;
        }else{

            R = mid2;
        }
    }

    return thirds_searchY((L+R)/2);
}
int main(){

    scanf("%d %d",&N,&K);

    for(int i = 1; i <= N; i++){

        scanf("%lf %lf",&point[i].x,&point[i].y);
    }

    printf("%.10lf\n",thirds_searchX());

    return 0;
}
accuracy: 1
time_ms: 110
memory_kb: 3288
final_rank: 4

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Point{

    double x,y;
};


int N,K;
Point point[205];

double calc(double X,double Y){

    vector<double> V;

    for(int i = 0; i < N; i++){

        V.push_back(sqrt((X-point[i].x)*(X-point[i].x)+(Y-point[i].y)*(Y-point[i].y)));
    }

    sort(V.begin(),V.end());

    double ret = 0;
    int count = 0;

    for(int i = N-1; i >= 0; i--){

        ret += V[i];
        count++;

        if(count == K)break;
    }

    return ret;
}

double thirds_searchY(double X){

    double L = -1001,R = 1001;

    for(int loop = 0; loop < 100; loop++){

        double mid1 = (2.0*L+R)/3.0;
        double mid2 = (1.0*L+2.0*R)/3.0;

        if(calc(X,mid1) > calc(X,mid2)){

            L = mid1;
        }else{

            R = mid2;
        }
    }

    return calc(X,(L+R)/2);
}

//Yをsガス
double thirds_searchX(){

    double L = -1001,R = 1001;

    for(int loop = 0; loop < 100; loop++){

        double mid1 = (2.0*L+R)/3.0;
        double mid2 = (1.0*L+2.0*R)/3.0;

        if(thirds_searchY(mid1) > thirds_searchY(mid2)){

            L = mid1;
        }else{

            R = mid2;
        }
    }

    return thirds_searchY((L+R)/2);
}
int main(){

    scanf("%d %d",&N,&K);

    for(int i = 0; i < N; i++){

        scanf("%lf %lf",&point[i].x,&point[i].y);
    }

    printf("%.10lf\n",thirds_searchX());

    return 0;
}
accuracy: 1
time_ms: 110
memory_kb: 3292
final_rank: 7

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Point{

    double x,y;
};


int N,K;
Point point[205];

double calc(double X,double Y){

    vector<double> V;

    for(int i = 0; i < N; i++){

        V.push_back(sqrt((X-point[i].x)*(X-point[i].x)+(Y-point[i].y)*(Y-point[i].y)));
    }

    sort(V.begin(),V.end());

    double ret = 0;
    int count = 0;

    for(int i = N-1; i >= 0; i--){

        ret += V[i];
        count++;

        if(count == K)break;
    }

    return ret;
}

double thirds_searchY(double X){

    double L = -1001,R = 1001;

    for(int loop = 0; loop < 100; loop++){

        double mid1 = (2.0*L+R)/3.0;
        double mid2 = (1.0*L+2.0*R)/3.0;

        if(calc(X,mid1) > calc(X,mid2)){

            L = mid1;
        }else{

            R = mid2;
        }
    }

    return calc(X,(L+R)/2);
}

//Yをsガス
double thirds_searchX(){

    double L = -1001,R = 1001;

    for(int loop = 0; loop < 100; loop++){

        double mid1 = (2.0*L+R)/3.0;
        double mid2 = (1.0*L+2.0*R)/3.0;

        if(thirds_searchY(mid1) > thirds_searchY(mid2)){

            L = mid1;
        }else{

            R = mid2;
        }
    }

    return thirds_searchY((L+R)/2);
}

int main(){

    scanf("%d %d",&N,&K);

    for(int i = 0; i < N; i++){

        scanf("%lf %lf",&point[i].x,&point[i].y);
    }

    printf("%.10lf\n",thirds_searchX());

    return 0;
}
accuracy: 1
time_ms: 110
memory_kb: 3288
final_rank: 4

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



struct Point{

	double x,y;
};


int N,K;
Point point[205];

double calc(double X,double Y){

	vector<double> V;

	for(int i = 0; i < N; i++){

		V.push_back(sqrt((X-point[i].x)*(X-point[i].x)+(Y-point[i].y)*(Y-point[i].y)));
	}

	sort(V.begin(),V.end());

	double ret = 0;
	int count = 0;

	for(int i = N-1; i >= 0; i--){

		ret += V[i];
		count++;

		if(count == K)break;
	}

	return ret;
}

double thirds_searchY(double X){

	double L = -1001,R = 1001;

	for(int loop = 0; loop < 100; loop++){

		double mid1 = (2.0*L+R)/3.0;
		double mid2 = (1.0*L+2.0*R)/3.0;

		if(calc(X,mid1) > calc(X,mid2)){

			L = mid1;
		}else{

			R = mid2;
		}
	}

	return calc(X,(L+R)/2);
}

//Yをsガス
double thirds_searchX(){

	double L = -1001,R = 1001;

	for(int loop = 0; loop < 100; loop++){

		double mid1 = (2.0*L+R)/3.0;
		double mid2 = (1.0*L+2.0*R)/3.0;

		if(thirds_searchY(mid1) > thirds_searchY(mid2)){

			L = mid1;
		}else{

			R = mid2;
		}
	}

	return thirds_searchY((L+R)/2);
}

int main(){

	scanf("%d %d",&N,&K);

	for(int i = 0; i < N; i++){

		scanf("%lf %lf",&point[i].x,&point[i].y);
	}

	printf("%.10lf\n",thirds_searchX());

	return 0;
}
accuracy: 1
time_ms: 110
memory_kb: 3288
final_rank: 4

code_snippet: #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

struct Point
{
    double x, y;
    Point() {}
    Point(double x, double y) : x(x), y(y) {}
};

Point inputs[1005];
int k;
int n;

double dis(Point A, Point B)
{
    return sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
}

double getsum(Point T)
{
    vector<double> ans;
    for (int i = 1; i <= n; i++)
    {
        ans.push_back(dis(T, inputs[i]));
    }
    sort(ans.begin(), ans.end());
    double sum = 0;
    for (int i = n - 1; i >= n - k; i--)
    {
        sum += ans[i];
    }
    return sum;
}

double gety(double x)
{
    double ll = -1000;
    double rr = 1000;
    while (rr - ll > 1e-5)
    {
        double l3 = (ll + ll + rr) / 3;
        double r3 = (ll + rr + rr) / 3;
        if (getsum(Point(x, l3)) < getsum(Point(x, r3)))
            rr = r3;
        else
            ll = l3;
    }
    return (getsum(Point(x, ll)));
}

double getx()
{
    double ll = -1000;
    double rr = 1000;
    while (rr - ll > 1e-5)
    {
        double l3 = (ll + ll + rr) / 3;
        double r3 = (ll + rr + rr) / 3;
        if (gety(l3) < gety(r3))
            rr = r3;
        else
            ll = l3;
    }
    return gety(ll);
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    {
        cin >> inputs[i].x >> inputs[i].y;
    }
    printf("%.5lf\n", getx());
    return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 3392
final_rank: 2

code_snippet: #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int Max=220;
const double eps=1e-6;
struct Point
{
	double x,y;
	Point(double x=0,double y=0):x(x),y(y){}
}Dots[Max];
double Distance(Point a,Point b)
{
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double lx=-1e6,rx=1e6,ly=-1e6,ry=1e6;
int n,k;
double solve(double x,double y){
    priority_queue<double>ans;
    while(!ans.empty()){
        ans.pop();
    }
    for(int i=1;i<=n;i++){
        ans.push(Distance(Point(x,y),Dots[i]));
    }
    double res=0;
    for(int i=1;i<=k;i++){
        res+=ans.top();
        ans.pop();
    }
    return res;
}
double check(double x){
    double tl=ly,tr=ry;
    double res=1e9;
    while(tr-tl>eps){
        double mid1=tl+(tr-tl)/3;
        double mid2=tr-(tr-tl)/3;
        double t1=solve(x,mid1);
        double t2=solve(x,mid2);
        if(t1<t2){
            tr=mid2;
            res=min(res,t1);
        }else{
            tl=mid1;
            res=min(res,t2);
        }
    }
    return res;
}
int main(){
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        scanf("%lf%lf",&Dots[i].x,&Dots[i].y);
    }
    double res=1e9;
    while(rx-lx>eps){
        double mid1=lx+(rx-lx)/3;
        double mid2=rx-(rx-lx)/3;
        double t1=check(mid1);
        double t2=check(mid2);
        if(t1<t2){
            res=min(res,t1);
            rx=mid2;
        }else{
            res=min(res,t2);
            lx=mid1;
        }
    }
    printf("%.6f",res);
    return 0;
}
accuracy: 1
time_ms: 120
memory_kb: 3300
final_rank: 11

code_snippet: #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int Max=220;
const double eps=1e-6;
struct Point
{
	double x,y;
	Point(double x=0,double y=0):x(x),y(y){}
}Dots[Max];
double Distance(Point a,Point b)
{
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double lx=-1e9,rx=1e9,ly=-1e9,ry=1e9;
int n,k;
double solve(double x,double y){
    priority_queue<double>ans;
    for(int i=1;i<=n;i++){
        ans.push(Distance(Point(x,y),Dots[i]));
    }
    double res=0;
    for(int i=1;i<=k;i++){
        res+=ans.top();
        ans.pop();
    }
    return res;
}
double check(double x){
    double tl=ly,tr=ry;
    double res=1e9;
    while(tr-tl>eps){
        double mid1=tl+(tr-tl)/3;
        double mid2=tr-(tr-tl)/3;
        double t1=solve(x,mid1);
        double t2=solve(x,mid2);
        if(t1<t2){
            tr=mid2;
            res=min(res,t1);
        }else{
            tl=mid1;
            res=min(res,t2);
        }
    }
    return res;
}
int main(){
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        scanf("%lf%lf",&Dots[i].x,&Dots[i].y);
        lx=max(lx,Dots[i].x);
        rx=min(rx,Dots[i].x);
        ly=max(ly,Dots[i].y);
        ry=min(ry,Dots[i].y);
    }
    swap(rx,lx);
    swap(ry,ly);
    double res=1e9;
    while(rx-lx>eps){
        double mid1=lx+(rx-lx)/3;
        double mid2=rx-(rx-lx)/3;
        double t1=check(mid1);
        double t2=check(mid2);
        if(t1<t2){
            res=min(res,t1);
            rx=mid2;
        }else{
            res=min(res,t2);
            lx=mid1;
        }
    }
    printf("%.6f",check(lx));
    return 0;
}
accuracy: 0.7666666666666667
time_ms: 60
memory_kb: 3300
final_rank: 18

code_snippet: #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int Max=220;
const double eps=1e-6;
struct Point
{
	double x,y;
	Point(double x=0,double y=0):x(x),y(y){}
	Point operator + (Point v){
		return Point(x+v.x,y+v.y);
	}
	Point operator - (Point v){
		return Point(x-v.x,y-v.y);
	}
	Point operator * (double d){
		return Point (x*d,y*d);
	}
	Point operator / (double d){
		return Point (x/d,y/d);
	}
}Dots[Max];
double Distance(Point a,Point b)
{
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double lx=-1e9,rx=1e9,ly=-1e9,ry=1e9;
int n,k;
double solve(double x,double y){
    priority_queue<double>ans;
    for(int i=1;i<=n;i++){
        ans.push(Distance(Point(x,y),Dots[i]));
    }
    double res=0;
    for(int i=1;i<=k;i++){
        res+=ans.top();
        ans.pop();
    }
    return res;
}
double check(double x){
    double tl=ly,tr=ry;
    while(tr-tl>eps){
        double mid1=tl+(tr-tl)/3;
        double mid2=tr-(tr-tl)/3;
        if(solve(x,mid1)<solve(x,mid2)){
            tr=mid2;
        }else{
            tl=mid1;
        }
    }
    return solve(x,tl);
}
int main(){
    ios::sync_with_stdio(0);
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        scanf("%lf%lf",&Dots[i].x,&Dots[i].y);
        lx=max(lx,Dots[i].x);
        rx=min(rx,Dots[i].x);
        ly=max(ly,Dots[i].y);
        ry=min(ry,Dots[i].y);
    }
    swap(rx,lx);
    swap(ry,ly);
    double res=1e9;
    while(rx-lx>eps){
        double mid1=lx+(rx-lx)/3;
        double mid2=rx-(rx-lx)/3;
        double t1=check(mid1);
        double t2=check(mid2);
        if(t1<t2){
            res=min(res,t1);
            rx=mid2;
        }else{
            res=min(res,t2);
            lx=mid1;
        }
    }
    printf("%.6f",res);
    return 0;
}
accuracy: 0.7666666666666667
time_ms: 50
memory_kb: 3324
final_rank: 17