Language: C++

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
//#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pi = pair<int, int>;
template <typename T>
using Pq = priority_queue<T>;
template <typename T>
using pQ = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
class Vec2 {
public:
    T x = 0, y = 0;
    Vec2() {}
    Vec2(T x, T y) : x(x), y(y) {}

    bool operator==(const Vec2 &other) const {
        return x == other.x && y == other.y;
    }
    bool operator!=(const Vec2 &other) const {
        return x != other.x || y != other.y;
    }

    Vec2 &operator+=(const Vec2 &other) {
        x += other.x;
        y += other.y;
        return *this;
    }

    Vec2 &operator-=(const Vec2 &other) {
        x -= other.x;
        y -= other.y;
        return *this;
    }

    Vec2 &operator*=(const T k) {
        x *= k;
        y *= k;
        return *this;
    }

    Vec2 &operator/=(const T k) {
        x /= k;
        y /= k;
        return *this;
    }

    Vec2 &operator=(const Vec2 &other) {
        x = other.x;
        y = other.y;
        return *this;
    }

    Vec2 operator+(const Vec2 &other) const {
        Vec2 res = *this;
        return res += other;
    }

    Vec2 operator-(const Vec2 &other) const {
        Vec2 res = *this;
        return res -= other;
    }

    Vec2 operator*(const T k) const {
        Vec2 res = *this;
        return res *= k;
    }

    Vec2 operator/(const T k) const {
        Vec2 res = *this;
        return res /= k;
    }

    Vec2 rotate(double rad) {
        return Vec2(cos(rad) * x - sin(rad) * y, sin(rad) * x + cos(rad) * y);
    }

    T norm() {
        return sqrt(x * x + y * y);
    }

    T squaredNorm() {
        return (x * x + y * y);
    }

    T dot(const Vec2 &other) const {
        return x * other.x + y * other.y;
    }

    T angle(const Vec2 &other) {
        return acos(dot(other) / (norm() * other.norm()));
    }

    T cross(const Vec2 &other) {
        return x * other.y - other.x * y;
    }

    Vec2 normalize() {
        T n = this->norm();
        return *this /= n;
    }

    friend ostream &operator<<(ostream &os, Vec2 &in) {
        os << "(" << in.x << ", " << in.y << ")";
        return os;
    }
};

template <typename T>
T cross(const Vec2<T> &v1, const Vec2<T> &v2) {
    return v1.x * v2.y - v2.x * v1.y;
}

template <typename T>
T dot(const Vec2<T> &v1, const Vec2<T> &v2) {
    return v1.x * v2.x + v1.y * v2.y;
}

template <typename T>
Vec2<T> operator*(const T k, Vec2<T> &v) {
    Vec2 res = v;
    return res *= k;
}

template <typename T>
Vec2<T> operator/(const T k, Vec2<T> &v) {
    Vec2 res = v;
    return res /= k;
}

using Vec2f = Vec2<float>;
using Vec2d = Vec2<double>;

enum CCW {
    COUNTER_CLOCKWISE = 1,
    CLOCKWISE = -1,
    ONLINE_BACK = 2,
    ONLINE_FRONT = -2,
    ON_SEGMENT = 0,
};

template <typename T>
CCW ccw(Vec2<T> p0, Vec2<T> p1, Vec2<T> p2) {
    const T EPS = 1e-7;
    auto a = p1 - p0;
    auto b = p2 - p0;
    if (cross(a, b) > EPS)
        return COUNTER_CLOCKWISE;
    if (cross(a, b) < -EPS)
        return CLOCKWISE;
    if (dot(a, b) < -EPS)
        return ONLINE_BACK;
    if (a.norm() < b.norm())
        return ONLINE_FRONT;
    return ON_SEGMENT;
}

template <typename T>
bool intersect(Vec2<T> p1, Vec2<T> p2, Vec2<T> p3, Vec2<T> p4) {
    return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}

signed main() {
    INIT;
    cin >> N >> K;
    vector<double> x(N), y(N), c(N);
    REP(i, N)
    cin >> x[i] >> y[i] >> c[i];

    double ok = 1e18;
    double ng = 0;
    while (abs(ok - ng) > 1e-6) {
        double mid = (ok + ng) / 2;
        vector<double> r(N);
        REP(i, N) {
            r[i] = mid / c[i];
        }
        bool isOk = false;
        vector<Vec2d> points;
        REP(i, N) {
            points.push_back({x[i], y[i]});
            FOR(j, i + 1, N) {
                Vec2 a(x[i], y[i]);
                Vec2 b(x[j], y[j]);
                double d = (b - a).norm();
                if (r[i] + r[j] < d or abs(r[i] - r[j]) > d)
                    continue;
                double ang = acos((r[i] * r[i] + d * d - r[j] * r[j]) / (2 * r[i] * d));
                Vec2 p = a + (b - a).normalize().rotate(ang) * r[i];
                points.push_back(p);
            }
        }
        dump(points, points.size());
        REP(i, points.size()) {
            int k = 0;
            auto p = points[i];
            REP(n, N) {
                Vec2 now(x[n], y[n]);
                if ((p - now).norm() < r[n] + 1e-5) {
                    k++;
                }
            }
            if (k >= K) {
                isOk = true;
                break;
            }
        }
        if (isOk) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    cout << ok #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
//#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pi = pair<int, int>;
template <typename T>
using Pq = priority_queue<T>;
template <typename T>
using pQ = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
class Vec2 {
public:
    T x = 0, y = 0;
    Vec2() {}
    Vec2(T x, T y) : x(x), y(y) {}

    bool operator==(const Vec2 &other) const {
        return x == other.x && y == other.y;
    }
    bool operator!=(const Vec2 &other) const {
        return x != other.x || y != other.y;
    }

    Vec2 &operator+=(const Vec2 &other) {
        x += other.x;
        y += other.y;
        return *this;
    }

    Vec2 &operator-=(const Vec2 &other) {
        x -= other.x;
        y -= other.y;
        return *this;
    }

    Vec2 &operator*=(const T k) {
        x *= k;
        y *= k;
        return *this;
    }

    Vec2 &operator/=(const T k) {
        x /= k;
        y /= k;
        return *this;
    }

    Vec2 &operator=(const Vec2 &other) {
        x = other.x;
        y = other.y;
        return *this;
    }

    Vec2 operator+(const Vec2 &other) const {
        Vec2 res = *this;
        return res += other;
    }

    Vec2 operator-(const Vec2 &other) const {
        Vec2 res = *this;
        return res -= other;
    }

    Vec2 operator*(const T k) const {
        Vec2 res = *this;
        return res *= k;
    }

    Vec2 operator/(const T k) const {
        Vec2 res = *this;
        return res /= k;
    }

    Vec2 rotate(double rad) {
        return Vec2(cos(rad) * x - sin(rad) * y, sin(rad) * x + cos(rad) * y);
    }

    T norm() {
        return sqrt(x * x + y * y);
    }

    T squaredNorm() {
        return (x * x + y * y);
    }

    T dot(const Vec2 &other) const {
        return x * other.x + y * other.y;
    }

    T angle(const Vec2 &other) {
        return acos(dot(other) / (norm() * other.norm()));
    }

    T cross(const Vec2 &other) {
        return x * other.y - other.x * y;
    }

    Vec2 normalize() {
        T n = this->norm();
        return *this /= n;
    }

    friend ostream &operator<<(ostream &os, Vec2 &in) {
        os << "(" << in.x << ", " << in.y << ")";
        return os;
    }
};

template <typename T>
T cross(const Vec2<T> &v1, const Vec2<T> &v2) {
    return v1.x * v2.y - v2.x * v1.y;
}

template <typename T>
T dot(const Vec2<T> &v1, const Vec2<T> &v2) {
    return v1.x * v2.x + v1.y * v2.y;
}

template <typename T>
Vec2<T> operator*(const T k, Vec2<T> &v) {
    Vec2 res = v;
    return res *= k;
}

template <typename T>
Vec2<T> operator/(const T k, Vec2<T> &v) {
    Vec2 res = v;
    return res /= k;
}

using Vec2f = Vec2<float>;
using Vec2d = Vec2<double>;

enum CCW {
    COUNTER_CLOCKWISE = 1,
    CLOCKWISE = -1,
    ONLINE_BACK = 2,
    ONLINE_FRONT = -2,
    ON_SEGMENT = 0,
};

template <typename T>
CCW ccw(Vec2<T> p0, Vec2<T> p1, Vec2<T> p2) {
    const T EPS = 1e-7;
    auto a = p1 - p0;
    auto b = p2 - p0;
    if (cross(a, b) > EPS)
        return COUNTER_CLOCKWISE;
    if (cross(a, b) < -EPS)
        return CLOCKWISE;
    if (dot(a, b) < -EPS)
        return ONLINE_BACK;
    if (a.norm() < b.norm())
        return ONLINE_FRONT;
    return ON_SEGMENT;
}

template <typename T>
bool intersect(Vec2<T> p1, Vec2<T> p2, Vec2<T> p3, Vec2<T> p4) {
    return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}

signed main() {
    INIT;
    cin >> N >> K;
    vector<double> x(N), y(N), c(N);
    REP(i, N)
    cin >> x[i] >> y[i] >> c[i];

    double ok = 1e18;
    double ng = 0;
    while (abs(ok - ng) > 1e-6) {
        double mid = (ok + ng) / 2;
        vector<double> r(N);
        REP(i, N) {
            r[i] = mid / c[i];
        }
        bool isOk = false;
        vector<Vec2d> points;
        REP(i, N) {
            points.push_back({x[i], y[i]});
            FOR(j, i + 1, N) {
                Vec2 a(x[i], y[i]);
                Vec2 b(x[j], y[j]);
                double d = (b - a).norm();
                if (r[i] + r[j] < d or abs(r[i] - r[j]) > d)
                    continue;
                double ang = acos((r[i] * r[i] + d * d - r[j] * r[j]) / (2 * r[i] * d));
                Vec2 p = a + (b - a).normalize().rotate(ang) * r[i];
                points.push_back(p);
            }
        }
        dump(points, points.size());
        REP(i, points.size()) {
            int k = 0;
            auto p = points[i];
            REP(n, N) {
                Vec2 now(x[n], y[n]);
                if ((p - now).norm() < r[n] + 1e-5) {
                    k++;
                }
            }
            if (k >= K) {
                isOk = true;
                break;
            }
        }
        if (isOk) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    cout << ok << endl;
}<< endl;
}

Compiler output:
a.cc:281:16: error: stray '#' in program
  281 |     cout << ok #include <bits/stdc++.h>
      |                ^
a.cc: In function 'int main()':
a.cc:281:15: error: expected ';' before 'include'
  281 |     cout << ok #include <bits/stdc++.h>
      |               ^ ~~~~~~~
      |               ;
a.cc:318:1: error: a template declaration cannot appear at block scope
  318 | template <typename T>
      | ^~~~~~~~
a.cc:323:1: error: a template declaration cannot appear at block scope
  323 | template <typename T>
      | ^~~~~~~~
a.cc:327:1: error: a template declaration cannot appear at block scope
  327 | template <class T>
      | ^~~~~~~~
a.cc:343:1: error: a template declaration cannot appear at block scope
  343 | template <typename T>
      | ^~~~~~~~
a.cc:357:1: error: a template declaration cannot appear at block scope
  357 | template <typename T>
      | ^~~~~~~~
a.cc:456:1: error: a template declaration cannot appear at block scope
  456 | template <typename T>
      | ^~~~~~~~
a.cc:466:1: error: a template declaration cannot appear at block scope
  466 | template <typename T>
      | ^~~~~~~~
a.cc:489:1: error: a template declaration cannot appear at block scope
  489 | template <typename T>
      | ^~~~~~~~
a.cc:510:12: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  510 | signed main() {
      |            ^~
a.cc:510:12: note: remove parentheses to default-initialize a variable
  510 | signed main() {
      |            ^~
      |            --
a.cc:510:12: note: or replace parentheses with braces to value-initialize a variable
a.cc:510:15: error: a function-definition is not allowed here before '{' token
  510 | signed main() {
      |               ^
a.cc:562:2: error: expected primary-expression before '<<' token
  562 | }<< endl;
      |  ^~