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 <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

double sn(int k){
  int ret=0;
  int i=k;
  while(k>=1){
    ret+=k%10;
    k/=10;
  }
  return 1.0*i/ret;
}

int main(){
  int k;cin>>k;
  // k=100;
  int keta=1;
  int cnt_lim=9*keta,cnt=0;
  int atamanitukeru=0;
  string keta_s="";
  int fla=0;
  rep(i,k){
    if(cnt<cnt_lim){
      atamanitukeru++;
      if(stoll(to_string(atamanitukeru)+keta_s)<109||stoll(to_string(atamanitukeru)+keta_s)>198){
        cout<<sn(stoll(to_string(atamanitukeru)+keta_s))<<" "<<stoll(to_string(atamanitukeru)+keta_s)<<endl;
      }
      cnt++;
    }else{
      i--;
      cnt=0;
      keta_s=keta_s+"9";
      keta++;
      if(keta<=2){
        cnt_lim=9;
        atamanitukeru=0;
      }else{
        cnt_lim=9*(keta-1)+1;
        atamanitukeru=keta-3;
      }
      
    }
  }
}