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 C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		List<String> Ls = new List<String>();
		for(int i=1;;i++){
			List<int> L = new List<int>();
			int n = i;
			while(n > 0){
				int v = Math.Min(n, 9);
				L.Add(v);
				n -= v;
			}
			L.Reverse();
			var s = String.Join("",L);
			if(s.Length > 17) break;
			Ls.Add(s);
		}
		
		int cnt = 0;
		Ls.Sort();
		for(int i=0;i<Ls.Count;i++){
			var s = Ls[i];
//Console.WriteLine(s);
			bool chk = true;
			long v = long.Parse(s);
			long sv = s.Select(c => (long)(c - '0')).Sum();
			for(int j=i+1;j<Ls.Count;j++){
				long vv = long.Parse(Ls[j]);
				long svv =  Ls[j].Select(c => (long)(c - '0')).Sum();
				if(v * svv > vv * sv) chk = false;
			}
			if(chk){
				Console.WriteLine(s);
				cnt++;
				if(cnt == K) break;
			}
			
			
		}
		
		
		
	}
	int K;
	public Sol(){
		K = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}