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 all int i=0; i<n; i++
#define pb push_back
typedef long long int ll;

#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define mod 1000000007

bool sortinrev(const pair<ll,ll> &a,  
               const pair<ll,ll> &b) 
{ 
       return (a.first > b.first); 
}
float sum(int a){
	float res=0.00;
	while(a!=0){
		res+= a%10;
		a/=10;
	}
	return res;
}
int arr[1000000]={0};
int main(){
	int k;
	cin>>k;
	/*int prev=0;
	vector<ll>v1;
	for(int i=1; i<=k; i++){
		int flag=1;
		for(int j=i+1; j<=i+100000; j++){
			if(i/sum(i) > j/sum(j)){
				flag=0;
				break;
			}
		}
		if(flag==1){
			//cout<<i-prev<<endl;
			arr[i-prev]++;
		    v1.pb(i);
			prev=i;
		}
	}*/
	//for(int i=0; i<1000000; i++){
		//if(arr[i]!=0)cout<<i<<" "<<arr[i]<<endl;
	//}
	vector<ll>v;
	for(int i=1; i<=9; i++){
		v.pb(i);
	}
	for(int i=19; i<=99; i+=10){
		v.pb(i);
	}
		for(int i=19; i<=INT_MAX; i+=9){
			if(v.size()>=k)break;
			for(int j=0; j<i; j++){
				v.pb(v[v.size()-1] + pow(10, ((i-10)/9+1)));
				if(v.size()>=k)break;
			}
		}
		//ll idk = k;
	for(int i=0; i<k; i++){
		cout<<v[i]<<endl;
	}
}