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<bits/stdc++.h>

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;

inline int f(ll x){
	int s = 0;
	while(x > 0){
		s += x % 10;
		x /= 10;
	}
	return s;
}

bool brute(ll x){
	bool ok = 1;
	repi(i , 15150){
		ok &= (1LL * f(x + i) * x <= 1LL * f(x) * (x + i));	
	}
	return ok;
}

void fill(set<ll , less<ll>> &st){
	ll pw = 100;
	ll nn = 99;
	int lim = 19;
	ll mx = 0;
	while(true){
		if(mx >= 1e15) break;		
		for(int i = 10 ; i <= lim ; ++i){
			ll e = i * (pw / pow(10, (ll)log10(lim) - 1)) + nn; 
			st.insert(e);
			mx = max(mx , e);
		}
		lim += 10;
		pw *= 10;
		nn = nn * 10 + 9;
	}
}

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

	int k;
	cin >> k;
	
	vector<ll> v;
	repi(i , 9){ 
		v.pb(i);
		v.pb(10 * i + 9);
		v.pb(100 * i + 99);
	}
	ll cur = 99;
	ll pw = 1000;
	int a = 1;
	while(true){
		if(v.back() >= 1e15) break;
		rep(i, 10){
			ll e = pw + i * (pw / 10) + cur;
			v.pb(e);
		}
		ll lst = v.back();
		rep(i , 8){
			lst += pw;
			v.pb(lst);
		}
		cur = cur * 10 + 9;
		pw *= 10;
	//	break;
	}
	
	set<ll , less<ll>> st;
	for(auto & e : v) st.insert(e);
	fill(st);
	for(auto & e : st) cout << e << endl;

	for(auto it = st.begin() ; k > 0 ; --k, ++it){
	//	cout << (*it) << endl;
	}
	
	


	return 0;
}