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 sz(o) ((int)o.size())
#define all(o) o.begin(), o.end()
#define rep(i, a, b) for(int i = (a); i <= (b); i++)
#define repr(i, a, b) for(int i = (a); i >= (b); i--)
#define INF 1123456789
#define MOD 1000000007LL
#define ff first
#define ss second
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<pi> vpi;

int sum(int x)
{
    int res = 0;
    while(x > 0)
    {
        res += x%10;
        x /= 10;
    }
    return res;
}

void brute()
{
    rep(i, 1, 1000)
    {
        bool ok = 1;
        rep(j, i+1, 10000)
        {
            if(i*sum(j) > j*sum(i))
            {
                ok = 0;
                break;
            }
        }
        if(ok) cout << i << '\n';
    }
}


const int N = (int)1e6+5;
ll num[N];

void solve(int testcase)
{
    rep(i, 1, 9) num[i] = i;
    for(int i = 10; i < N; i += 10)
    {
        rep(j, i, min(i+8, N-1)) num[j] = (num[j-9]*10) + 9;
    }
    int k;
    cin >> k;
    rep(i, 1, k) cout << num[i] << '\n';
}

signed main()
{
//    #ifdef VPAL
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
//    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout << setprecision(10);
    clock_t b = clock();
    int t = 1;
    //cin >> t;
    rep(tt, 1, t) solve(tt);
    clock_t e = clock();
    cerr << (double(e - b) / CLOCKS_PER_SEC) << " sec";
    return 0;
}