Problem:
Score : 500 points

Problem Statement

Let S(n) denote the sum of the digits in the decimal notation of n.
For example, S(123) = 1 + 2 + 3 = 6.

We will call an integer n a Snuke number when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds.

Given an integer K, list the K smallest Snuke numbers.

Constraints

1 \leq K

The K-th smallest Snuke number is not greater than 10^{15}.

Input

Input is given from Standard Input in the following format:

K

Output

Print K lines. The i-th line should contain the i-th smallest Snuke number.

Sample Input 1

10

Sample Output 1

1
2
3
4
5
6
7
8
9
19

Solution in Rust (1.15.1) (judge verdict: Wrong Answer)

use io::*;

fn sum(n: i64) -> i64 {
    if n == 0 {
        0
    } else {
        n % 10 + sum(n / 10)
    }
}

fn main() {
    if false {
        let mut v: Vec<f64> = vec![];

        for i in 1..10000001 {
            v.push(i as f64 / sum(i) as f64);
        }

        let mut cur_min = v[v.len() - 1];
        for i in (0..v.len()).rev() {
            if v[i] <= cur_min {
                println!("{}", i + 1);
                cur_min = v[i];
            }
        }

        return;
    }

    let con = read_string();
    let mut sc = Scanner::new(&con);

    let k: usize = sc.next();

    let mut cands = vec![];

    let mut ofs = 1;
    let mut nine = 0;
    for keta in 0..16 {
        for i in 1..1000 {
            cands.push(i * ofs + nine);
        }
        ofs *= 10;
        nine = nine * 10 + 9;
    }

    cands.sort();

    let mut v: Vec<f64> = vec![];

    for &c in cands.iter() {
        v.push(c as f64 / sum(c) as f64);
    }

    let mut cur_min = v[v.len() - 1];
    let mut ans = vec![];
    for i in (0..v.len()).rev() {
        if v[i] <= cur_min {
            ans.push(cands[i]);
            cur_min = v[i];
        }
    }

    ans.reverse();
    for i in 0..k {
        println!("{}", ans[i]);
    }
}

//-----

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}