#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a,v) memset(a, v, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
int main() {
   
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        int n,k;cin>>n>>k;
        double x[n],y[n],c[n];
        rep(i,n){
            cin>>x[i]>>y[i]>>c[i];
        }
        double lo=0,hi=1e10;
        double eps=1e-6;
        double ans;
        while((hi-lo)>eps){
            double T=(lo+hi)/2;
            vector<pair<double,double> > v;
            rep(i,n){
                v.pb({x[i],y[i]});
            }
            // dbg(lo,hi,T);
            for(int i=0;i<n;i++){
                for(int j=i+1;j<n;j++){
                    double xx,yy;
                    double r1=T/c[i],r2=T/c[j];
                    double R=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
                    double u=(2*(r1*r1+r2*r2))/(R*R)-1-(((r1*r1-r2*r2)*(r1*r1-r2*r2))/(R*R*R*R));
                    if(u<0)continue;
                    double val=(sqrt(u))/2;
                    xx=(x[i]+x[j])/2;
                    xx+=((x[j]-x[i])/2)*((r1*r1-r2*r2)/(R*R));
                    xx+=(val*(y[j]-y[i]));
                    yy=(y[i]+y[j])/2;
                    yy+=((y[j]-y[i])/2)*((r1*r1-r2*r2)/(R*R));
                    yy+=(val*(x[i]-x[j]));
                    v.pb({xx,yy});
                    xx=(x[i]+x[j])/2;
                    xx+=((x[j]-x[i])/2)*((r1*r1-r2*r2)/(R*R));
                    xx-=(val*(y[j]-y[i]));
                    yy=(y[i]+y[j])/2;
                    yy+=((y[j]-y[i])/2)*((r1*r1-r2*r2)/(R*R));
                    yy-=(val*(x[i]-x[j]));
                    v.pb({xx,yy});
                }
            }
            int f=0;
            rep(i,sz(v)){
                double xx=v[i].fst;
                double yy=v[i].snd;
                int cnt=0;
                rep(j,n){
                    double x1=x[j],y1=y[j],r=T/c[j];
                    double d=(xx-x1)*(xx-x1)+(yy-y1)*(yy-y1)-r*r;
                    if(d<=eps)cnt++;
                }   
                if(cnt>=k){
                    f=1;break;
                }
                
            }
            if(f){
                ans=T;
                hi=T;
            }
            else{
                lo=T;
            }
        }
        cout<<fixed<<setprecision(6);
        cout<<ans;
    }   
    timecalculater();
    return 0;   
} 

Measured memory_bytes: 384