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: Runtime Error)

use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn s(n: u64) -> u64{
    let mut n = n;
    let mut ans = 0;

    while n > 0{
        ans += n%10;
        n /= 10;
    }

    ans
}

fn g(n: u64) -> f64{
    let x: f64 = n as f64;
    x / s(n) as f64
}

fn main(){
    let n = read_as_vec::<usize>()[0];
    let mut cands: Vec<u64> = vec![];

    let mut base = 1;
    for i in 0..15{
        for j in 1..150{
            cands.push((j+1)*base-1);
        }
        base *= 10;
    }


    for i in (0..cands.len()).rev(){
        for j in (0..i).rev(){
            if g(cands[j]) > g(cands[i]) || cands[i] == cands[j]{
                cands.remove(j);
                break;
            }
        }
    }

    //println!("{:?}", cands);

    for i in 0..n{
        println!("{}", cands[i]);
    }
}