macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { let mut $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { let $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
trait Bisect: Copy {
    fn halve(self, other: Self) -> Self;
    fn section_end(self, other: Self) -> bool;
}
impl Bisect for f64 {
    fn halve(self, other: Self) -> Self {
        (self + other) / 2.
    }
    fn section_end(self, other: Self) -> bool {
        (self - other).abs() <= 1e-8
    }
}
fn binary_search<T: Bisect, F: Fn(T) -> bool>(f: F, ok: T, err: T) -> T {
    let mut ok = ok;
    let mut err = err;
    while !ok.section_end(err) {
        let m = ok.halve(err);
        if f(m) {
            ok = m;
        } else {
            err = m;
        }
    }
    ok
}
struct Niku {
    xyc: Vec<(f64, f64, f64)>,
    k: usize,
}
impl Niku {
    fn new(xyc: Vec<(f64, f64, f64)>, k: usize) -> Niku {
        Niku { xyc: xyc, k: k }
    }
    fn ok(&self, t: f64) -> bool {
        let n = self.xyc.len();
        let r = self.xyc.iter().map(|&(_, _, c)| t / c).collect::<Vec<_>>();
        let mut v = vec![];
        for i in 0..n {
            let (x, y, _) = self.xyc[i];
            v.push((x, y));
        }
        for i in 0..n - 1 {
            let (x1, y1, _) = self.xyc[i];
            let r1 = r[i];
            for j in i + 1..n {
                let (x2, y2, _) = self.xyc[j];
                let r2 = r[j];
                let dx = x2 - x1;
                let dy = y2 - y1;
                let d = (dx * dx + dy * dy).sqrt();
                if d > r1 + r2 {
                    continue;
                }
                let rc = (d * d + r1 * r1 - r2 * r2) / (2. * d);
                let h = (r1 * r1 - rc * rc).sqrt();
                let x = x1 + dx * rc / d;
                let y = y1 + dy * rc / d;
                let xx = -dy * h / d;
                let yy = dx * h / d;
                v.push((x + xx, y + yy));
                v.push((x - xx, y - yy));
            }
        }
        for (x, y) in v {
            let mut cnt = 0;
            for i in 0..n {
                let (x1, y1, _) = self.xyc[i];
                let r1 = r[i];
                let dx = x - x1;
                let dy = y - y1;
                let d = (dx * dx + dy * dy).sqrt();
                if d <= r1 + 1e-8 {
                    cnt += 1;
                }
            }
            if cnt >= self.k {
                return true;
            }
        }
        false
    }
}
fn main() {
    input! { n, k, xyc: [(f64, f64, f64); n] };
    let niku = Niku::new(xyc, k);
    println!("{}", binary_search(|t| niku.ok(t), 300000., 0.));
}


Measured memory_bytes: 4352