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.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;

        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }

            var res = line[index];
            index++;
            return res;
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }

        public int[] IntArray(int n)
        {
            var array = Array();
            var result = new int[n];
            for (int i = 0; i < n; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }

        public int[] IntArray()
        {
            var array = Array();
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }


        public long[] LongArray()
        {
            var array = Array();
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }

        public uint NextUint()
        {
            return uint.Parse(Next());
        }
    }

    class Program
    {
        private long K;
        private int[] Begin = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 199, 299, 399, 499, 599, 699, 799, 899, 999 };
        private void Scan()
        {
            var sc = new Scanner();
            K = sc.NextLong();
        }


        public void Solve()
        {
            Scan();
            long cnt = 0;
            var sb = new StringBuilder();
            foreach (var i in Begin)
            {

                if (cnt >= K)
                {
                    Console.Write(sb.ToString());
                    return;
                }
                cnt++;
                sb.AppendLine(i.ToString());
            }

            for (int i = 2; true; i++)
            {
                for (int j = 10; j < 2 * 10; j++)
                {

                    if (cnt >= K)
                    {
                        Console.Write(sb.ToString());
                        return;
                    }
                    cnt++;
                    sb.AppendLine(j.ToString() + new string('9', i));
                }

                for (int j = i; j <= 9; j++)
                {
                    if (cnt >= K)
                    {
                        Console.Write(sb.ToString());
                        return;
                    }
                    cnt++;
                    sb.AppendLine(j.ToString() + new string('9', i + 1));
                }
            }
        }



        long S(long n)
        {
            if (n < 10) return n;
            else
            {
                return n % 10 + S(n / 10);
            }
        }

        double Func(long n)
        {
            return (double)n / S(n);
        }


        static void Main() => new Program().Solve();
    }
}