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

// Geometry
const double eps = 1e-9;
bool equal(double a, double b) { return abs(a-b) < eps;}

// Vector
// https://youtu.be/UWbGRhF3Ozw?t=9564
struct V {
  double x, y;
  V(double x=0, double y=0): x(x), y(y) {}
  V& operator+=(const V& v) { x += v.x; y += v.y; return *this;}
  V operator+(const V& v) const { return V(*this) += v;}
  V& operator-=(const V& v) { x -= v.x; y -= v.y; return *this;}
  V operator-(const V& v) const { return V(*this) -= v;}
  V& operator*=(double s) { x *= s; y *= s; return *this;}
  V operator*(double s) const { return V(*this) *= s;}
  V& operator/=(double s) { x /= s; y /= s; return *this;}
  V operator/(double s) const { return V(*this) /= s;}
  double dot(const V& v) const { return x*v.x + y*v.y;}
  double cross(const V& v) const { return x*v.y - v.x*y;}
  double norm2() const { return x*x + y*y;}
  double norm() const { return sqrt(norm2());}
  V rotate90() const { return V(y, -x);}
  int ort() const { // orthant
    if (abs(x) < eps && abs(y) < eps) return 0;
    if (y > 0) return x>0 ? 1 : 2;
    else return x>0 ? 4 : 3;
  }
  bool operator<(const V& v) const {
    int o = ort(), vo = v.ort();
    if (o != vo) return o < vo;
    return cross(v) > 0;
  }
};
istream& operator>>(istream& is, V& v) {
  is >> v.x >> v.y; return is;
}
ostream& operator<<(ostream& os, const V& v) {
  os<<"("<<v.x<<","<<v.y<<")"; return os;
}

// Circle
// coding: https://youtu.be/TdR816rqc3s?t=1750
// comment: https://youtu.be/TdR816rqc3s?t=11609
struct Circle {
  V o; double r;
  Circle(V o=V(), double r=0) : o(o), r(r) {}
  vector<V> crossPoint(const Circle& c) {
    V v = c.o-o;
    double l = v.norm();
    if (equal(l, 0)) return {};
    if (equal(l+r+c.r, max({l,r,c.r})*2)) {
      if (equal(l+r,c.r)) return {o - v*(r/l)};
      return {o + v*(r/l)};
    }
    if (l+r+c.r < max({l,r,c.r})*2) return {};
    double x = (l*l + r*r - c.r*c.r) / (2*l);
    double y = sqrt(r*r - x*x);
    V mid = o + v*(x/l);
    v = v.rotate90();
    return {mid + v*(y/l), mid - v*(y/l)};
  }
  bool isInside(const V& p) const {
    return (p-o).norm() < r+eps;
  }
};

int main() {
    int N,K;
    cin >> N >>K;
    vector<vector<double>> v;
    for(int q=0;q<N;q++){
        double x,y,c;
        cin >> x >> y >> c;
        v.push_back({x,y,c});
        
    }
    double l = 0;
    double r = 1e9;
    for(int i=0;i<100;i++){
        double mid = (l+r)/2;
        vector<Circle> circles;
        vector<V> candidatePoints;
        for(int i=0;i<N;i++){
            V vec(v[i][0],v[i][1]);
            Circle c = Circle(vec,(mid/v[i][2]));
            circles.push_back(c);
            candidatePoints.push_back(vec);
        }
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(i ==j){
                    continue;
                }
                vector<V> points = circles[i].crossPoint(circles[j]);
                for(V p:points){
                    candidatePoints.push_back(p);
                }
            }
        }
        int maxNum=0;
        for(V vec:candidatePoints){
            int temp =0;
            for(int i=0;i<N;i++){
                if(circles[i].isInside(vec)){
                    temp++;
                }
            }
            maxNum =max(maxNum,temp);
        }
        if(maxNum>=K){
            r =mid;
        }else{
            l = mid;
        }


    }
    cout << setprecision(10) << l << endl;
    return 0;
}

Measured memory_bytes: 3988