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++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
struct node
{
	long long x,y,t;
	bool operator < (const node &a) const 
	{
		if (x*a.y==y*a.x)
		{
			return x>y;
		}
		else
		{
			return x*a.y>y*a.x;
		}
	}
};
int k;
priority_queue<node> q;
int main()
{
	scanf("%d",&k);
	for (int i=1;i<=9;i++)
	{
		node x;
		x.x=x.y=i;
		x.t=1;
		q.push(x);
	}
	long long now=0;
	while (k--)
	{
		long long x,y,t;
		while (true)
		{
			x=q.top().x;
			y=q.top().y;
			t=q.top().t;
			q.pop();
			if (x>now)
			{
				break;
			}
		}
		printf("%lld\n",x);
		now=x;
		for (int i=1;i<=9;i++)
		{
			q.push((node){x+1LL*i*t*10,y+i,t*10});
		}
	}
    return 0;
}