Language: C++

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;
inline dec LL(int a,int b,int c,LL base){
	return (a*100+b*10+c)*base+base-1;
}

int main(){
	int k;
	int ume[27]={1,2,3,4,5,6,7,8,9,19,29,39,49,59,69,79,89,99,199,299 ,399,499,599,699,799,899,999};
	cin>>k;
	if(k<=27){
		FOR(i,0,k)cout<<ume[i]<<endl;
	}else{
		FOR(i,0,27)cout<<ume[i]<<endl;
		int tmp=27;
		k-=27;
		int n=1,n2=9,n3=9,f=1;
		LL b=10,b2=1;
		//1000より上
		//n n2 n3 *b +b-1
		while(k){
			if(f==1){
				if(dec(n,n2,n3,b)*(n+n3+9*b2)>dec(n,0,n3,b)*(n+n2+n3+9*b2)){
					if(dec(n,0,n3,b)*(n+9*b2)>dec(n,0,0,b)/(n+n3+9*b2)){
						n2=0;n3=0;
					}else{
						n2=0;n3=9;
					}
				}else{
					n2=9;n3=9;
				}
				f=0;
			}else if(f==2){
				if(dec(n,n2,n3,b)*(n+n2+9*b2)>dec(n,n2,0,b)/(n+n2+n3+9*b2)){
					n3=0;
				}else{
					n3=9;
				}
			}else{
				if(n3<9){
					FORQ(i,n3,9){
						if(k>0){cout<<dec(n,n2,n3,b)<<endl;k--;}
					}
					if(k>0){
						n2++;n3=0;f=2;
						if(n2==10){
							n1++;n2=9;n3=9;f=2;
						}
					}else break;
				}else if(n2<9){
					FORQ(i,n2,9){
						if(k>0){cout<<dec(n,n2,9,b)<<endl;k--;}
					}
					if(k>0){
						n++;n2=9;n3=9;f=1;

					}else break;
				}else{
					FORQ(i,n,9){
						if(k>0){cout<<dec(i,9,9,b)<<endl;k--;}
					}
					if(k>0){
						n=10;

					}else break;
				}


				if(n==10){
					n=1,n2=9,n3=9;b*=10;b2++;f=1;
				}
			}
		}

	}
    return 0;
}


Compiler output:
a.cc:37:8: error: 'dec' does not name a type
   37 | inline dec LL(int a,int b,int c,LL base){
      |        ^~~
a.cc: In function 'int main()':
a.cc:57:40: error: invalid initialization of reference of type 'std::ios_base&' from expression of type 'int'
   57 |                                 if(dec(n,n2,n3,b)*(n+n3+9*b2)>dec(n,0,n3,b)*(n+n2+n3+9*b2)){
      |                                        ^
In file included from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:3:
/usr/include/c++/14/bits/ios_base.h:1079:17: note: in passing argument 1 of 'std::ios_base& std::dec(ios_base&)'
 1079 |   dec(ios_base& __base)
      |       ~~~~~~~~~~^~~~~~
a.cc:57:67: error: invalid initialization of reference of type 'std::ios_base&' from expression of type 'int'
   57 |                                 if(dec(n,n2,n3,b)*(n+n3+9*b2)>dec(n,0,n3,b)*(n+n2+n3+9*b2)){
      |                                                                   ^
/usr/include/c++/14/bits/ios_base.h:1079:17: note: in passing argument 1 of 'std::ios_base& std::dec(ios_base&)'
 1079 |   dec(ios_base& __base)
      |       ~~~~~~~~~~^~~~~~
a.cc:58:48: error: invalid initialization of reference of type 'std::ios_base&' from expression of type 'int'
   58 |                                         if(dec(n,0,n3,b)*(n+9*b2)>dec(n,0,0,b)/(n+n3+9*b2)){
      |                                                ^
/usr/include/c++/14/bits/ios_base.h:1079:17: note: in passing argument 1 of 'std::ios_base& std::dec(ios_base&)'
 1079 |   dec(ios_base& __base)
      |       ~~~~~~~~~~^~~~~~
a.cc:58:71: error: invalid initialization of reference of type 'std::ios_base&' from expression of type 'int'
   58 |                                         if(dec(n,0,n3,b)*(n+9*b2)>dec(n,0,0,b)/(n+n3+9*b2)){
      |                                                                       ^
/usr/include/c++/14/bits/ios_base.h:1079:17: note: in passing argument 1 of 'std::ios_base& std::dec(ios_base&)'
 1079 |   dec(ios_base& __base)
      |       ~~~~~~~~~~^~~~~~
a.cc:68:40: error: invalid initialization of reference of type 'std::ios_base&' from expression of type 'int'
   68 |                                 if(dec(n,n2,n3,b)*(n+n2+9*b2)>dec(n,n2,0,b)/(n+n2+n3+9*b2)){
      |                                        ^
/usr/include/c++/14/bits/ios_base.h:1079:17: note: in passing argument 1 of 'std::ios_base& std::dec(ios_base&)'
 1079 |   dec(ios_base& __base)
      |       ~~~~~~~~~~^~~~~~
a.cc:68:67: error: invalid initialization of reference of type 'std::ios_base&' from expression of type 'int'
   68 |                                 if(dec(n,n2,n3,b)*(n+n2+9*b2)>dec(n,n2,0,b)/(n+n2+n3+9*b2)){
      |                                                                   ^
/usr/include/c++/14/bits/ios_base.h:1079:17: note: in passing argument 1 of 'std::ios_base& std::dec(ios_base&)'
 1079 |   dec(ios_base& __base)
      |       ~~~~~~~~~~^~~~~~
a.cc:76:67: error: invalid initialization of reference of type 'std::ios_base&' from expression of type 'int'
   76 |                                                 if(k>0){cout<<dec(n,n2,n3,b)<<endl;k--;}
      |                                                                   ^
/usr/include/c++/14/bits/ios_base.h:1079:17: note: in passing argument 1 of 'std::ios_base& std::dec(ios_base&)'
 1079 |   dec(ios_base& __base)
      |       ~~~~~~~~~~^~~~~~
a.cc:81:57: error: 'n1' was not declared in this scope; did you mean 'n3'?
   81 |                                                         n1++;n2=9;n3=9;f=2;
      |                                                         ^~
      |                                                         n3
a.cc:86:67: error: invalid initialization of reference of type 'std::ios_base&' from expression of type 'int'
   86 |                                                 if(k>0){cout<<dec(n,n2,9,b)<<endl;k--;}
      |                                                                   ^
/usr/include/c++/14/bits/ios_base.h:1079:17: note: in passing argument 1 of 'std::ios_base& std::dec(ios_base&)'
 1079 |   dec(ios_base& __base)
      |       ~~~~~~~~~~^~~~~~
a.cc:94:67: error: invalid initialization of reference of type 'std::ios_base&' from expression of type 'int'
   94 |                                                 if(k>0){cout<<dec(i,9,9,b)<<endl;k--;}
      |                                                                   ^
/usr/include/c++/14/bits/ios_base.h:1079:17: note: in passing argument 1 of 'std::ios_base& std::dec(ios_base&)'
 1079 |   dec(ios_base& __base)
      |       ~~~~~~~~~~^~~~~~