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

#include <bits/stdc++.h>
#define endl '\n'

//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#define double long double

using namespace std;
template<class T, class T2> inline int chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline int chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);

int k;

void read()
{
	cin >> k;
}

void solve()
{
	int64_t val = (int64_t)1e15 - 1, dwn = (int64_t)1e11, cntr = (int64_t)1e14 - 1;
	vector<int64_t> li;
	
	double last = 1e9;
	while(val)
	{
		int64_t cc = val, c = 0;
		while(cc)
		{
			c += cc % 10;
			cc /= 10;
		}

		double curr = val / (double)c;
		
		//cout << val << " -> " << last << " " << curr << endl;
		
		if(curr <= last)
		{
			last = curr;
			li.push_back(val);
		}

		val -= dwn;
		if(val == cntr) dwn /= 10, cntr /= 10;
		if(!dwn) dwn = 1;
	}

	sort(li.begin(), li.end());
	for(int i = 0; i < k; i++) 
		cout << li[i] << endl;

	/*int c = 0, dgs = 0;
	while(k--)
	{
		c++;
		int x = c, S = c;
		cout << c;
		for(int i = 0; i < dgs; i++) x = x * 10 + 9, S += 9, cout << 9;
		cout << endl;

		//cout << "-> " << setprecision(9) << fixed << x / (double)S << endl;

		if(c == 9)
		{
			dgs++;
			c = 0;
			if(dgs >= 3 && k)
			{
				cout << 90;
				for(int d = 0; d < dgs - 1; d++)
					cout << 9;
				cout << endl;
				k--;
			}
		}
	}*/
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	read();
	solve();
	return 0;
}