#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double PI = acos(-1);

bool equal(double a, double b){ return abs(a-b) < EPS; }

struct vec{
    double x, y;

    /* constructor (initialize) */
    vec(double x0=0, double y0=0){ x = x0, y = y0; }
    friend ostream& operator << (ostream &s, const vec &v){ return s << "(" << v.x << "," << v.y << ")";}// ex. s = cout

    vec operator + (const vec &v) const { return vec(x + v.x, y + v.y);}
    vec operator - (const vec &v) const { return vec(x - v.x, y - v.y);}
    vec operator * (double a) const { return vec(a * x, a * y);}
    vec operator / (double a) const { return vec(x / a, y / a);}

    vec rotate(double theta) const { return vec(cos(theta) * x - sin(theta) * y, sin(theta) * x + cos(theta) * y);}
    double inner(const vec &v) const { return x * v.x + y * v.y; }
    double outer(const vec &v) const { return x * v.y - y * v.x; }
    double norm() const { return sqrt(x*x + y*y); }
};

struct circle{
    vec center; double radius;

    /* constructor (initialize) */
    circle(vec c=vec(0,0), double r=0){ center = c, radius = r; }
};


bool isInside(const circle &c, const vec &v){
    return (c.center - v).norm() < c.radius + EPS;
}

vector<vec> intersection(const circle &c1, const circle &c2){
    vec ab = c2.center - c1.center;
    double d = ab.norm();
    double r1 = c1.radius;
    double r2 = c2.radius;

    if(equal(d,0) == true) return {};// no intersection

    // existence of intersection = existence of triangle with edge length (c1.radius, c2.radius, l)
    if(equal(r1 + r2,  d) == true) return {c1.center + ab * (r1 / d)};
    if(equal(r1 + d,  r2) == true) return {c1.center - ab * (r1 / d)};
    if(equal(r2 + d,  r1) == true) return {c1.center + ab * (r1 / d)};

    if(r1 + r2 < d)  return {};// no need for EPS, since already checked "equal"
    if(r1 + d  < r2) return {};
    if(r2 + d  < r1) return {};

    // else : two endpoints of the chord (of which "ab" being a vertical bisector)
    double a = (d * d + r1 * r1 - r2 * r2) / (2 * d);
    return {c1.center + ab * (a / d) + ab.rotate(PI/2.0)  * (sqrt(r1*r1 - a*a) / d),
            c1.center + ab * (a / d) + ab.rotate(-PI/2.0) * (sqrt(r1*r1 - a*a) / d)};
}

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

    vector<vec> p(n);
    vector<double> c(n);
    for(int i=0; i<n; i++){
        cin >> p[i].x >> p[i].y >> c[i];
    }

    double upper = 1e6, lower = 0, mid;// 10 * 1000 * 100
    for(int i=0; i<100; i++){
        mid = (upper + lower) / 2.0;
        //cout << mid << " : ";

        vector<circle> meat(n);
        for(int s=0; s<n; s++){
            meat[s] = {p[s], mid / c[s]};
        }

        vector<vec> checkpoint;
        for(int s=0; s<n; s++){
            checkpoint.push_back(meat[s].center);
        }

        for(int s=0; s<n; s++){
            for(int t=s+1; t<n; t++){
                for(auto pt : intersection(meat[s], meat[t])){
                   checkpoint.push_back(pt);
                }
            }
        }

        int cooked = 0;
        for(auto pt : checkpoint){
            int count = 0;
            for(int s=0; s<n; s++){
                if(isInside(meat[s], pt) == true) count += 1;
            }
            cooked = max(cooked, count);
        }
        //cout << cooked << endl;
        if(cooked >= k) upper = mid;
        else lower = mid;
    }
    cout << fixed << setprecision(12) << upper << endl;
    return 0;
}

Measured memory_bytes: 3808