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: Time Limit Exceeded)

#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  int x, y;
  bool operator < (const P &a )const{
    //if(x!=a.x)
    return y<a.y;
  };
};

int a,b,c,d,i,k,n,m,e[22],dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
int o[21][22];
int l[21];
int j[21];


long long x,y,z,mod=1000000007;
//string r;
char r[22][22];

P u[1];
priority_queue<int> q;
stack<int> s;
//set<P> s;
map<int,int> p;

vector<int> v;

bool as(P a,P b)
{
  //if(a.x!=b.x)
  //return a.x<b.x;
  return a.x<b.x;
}

int f(int m)
{
  if(m<10) return m;
  return f(m/10)+m%10;
}

int main()
{
  scanf("%d",&a);
  for(int t=1;t<=min(9,a);t++)
  {
    printf("%d\n",t);
  }
  x=y=10;
  for(int t=10;t<=a;t++)
  {
    if(y==x*10) x*=10;
    long long z=y;
    for(long long p=10;p<=y;p*=10)
    {
      if(z*f(y+p-1)>=(y+p-1)*f(z)) z=y+p-1;
    }
    printf("%lld\n",z);
    y+=x;
  }
}
//0
//13