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>

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};

usd llong int k;
double hai = 1;
usd llong int s = 9;
usd llong int n = 9;
vector<usd llong int> ans;
int kazu[16] = {};

void shori(int i){
	kazu[i]++;
	int sum = 1;
	for(int j = 1; j < i; j++) sum*=10;
	if(kazu[i] < 10){
		s++;
		n += sum;
	}else{
		s-=9;
		n -= sum*9;
		kazu[i] = 0;
		shori(i+1);
	}
	return;
}

int main(){
	// kazu[1] = 9;
	// cin >> k;
	// for(int i = 0; i < 9; i++){
	// 	ans.pb(i+1);
	// }

	// while(ans.size() < k){
	// 	int cnt = 1;
	// 	shori(1);
	// 	// cout << s << " " << n << endl;
	// 	if(1.0*n/s >= hai){
	// 		ans.push_back(n);
	// 		hai = 1.0*n/s;
	// 	}
	// }

	// for(int i = 0; i < k; i++){
	// 	cout << ans[i] << endl;
	// }

	// return 0;
	cin >> k;
	usd llong int cnt = 1;
	while(ans.size() < k){
		for(int i = 1; i <= 9; i++){
			ans.pb(i*cnt);
		}
		cnt*=10;
	}
	for(int i = 0; i < k; i++){
		cout  << ans[i] << endl;
	}
	return 0;
}