stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



using ll = long long;



#define REP(i, n) for (int i = 0; i < (n); ++i)

#define SIZE(a) ((int)(a).size())



// Adam Polak, Michal Glapa

const int N = 100005;

int n1,n2;          // INPUT

vector<int> g[N];   // INPUT

int m1[N], m2[N];   // OUTPUT

bool in_vc1[N], in_vc2[N]; // OUTPUT (Vertex Cover)

bool vis[N];



bool dfs(int u) {

	if (u<0) return true;

	if (vis[u]) return false; else vis[u]=true;

	for(int v : g[u])

		if (dfs(m2[v])) { m1[u] = v; m2[v] = u; return true; }

	return false;

}



int matching() {

	REP(i,n1) m1[i] = -1;

	REP(i,n2) m2[i] = -1;

	bool changed;

	do {

		changed = 0;

		REP(i,n1) vis[i] = false;

		REP(i,n1) if (m1[i] < 0) changed |= dfs(i);

	} while(changed);

	REP(i, n1) if (m1[i] != -1) { //Vertex Cover

		if (vis[i]) in_vc2[m1[i]] = true; // Vertex Cover

		else in_vc1[i] = true; // Vertex Cover

	}

	int siz = 0;

	REP(i,n1) siz += (m1[i] != -1);

	return siz;

}



int X1[N], Y1[N];

int X2[N], Y2[N];



int main() {

	ios::sync_with_stdio(false);

	cin.tie(0);



	cin >> n1;

	n2 = n1;

	REP(i, n1) cin >> X1[i] >> Y1[i];

	REP(i, n2) cin >> X2[i] >> Y2[i];



	REP(i, n1) REP(j, n2) {

		if (X1[i] < X2[j] && Y1[i] < Y2[j]) {

			g[i].push_back(j);

		}

	}



	cout << matching() << '\n';



	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>



const int N=100,inf=0x5FFFFFFF;

struct node

{

	int x,y;

}R[N+5],B[N+5];

int n,ans;

bool vis[N+5];

int Ma[N+5][N+5],fa[N+5];



int Dfs(int u)

{

	for(int v=1;v<=n;v++)

		if(Ma[u][v]&&!vis[v])

		{

			vis[v]=1;

			if(fa[v]==-1||Dfs(fa[v]))

			{

				fa[v]=u;

				return true;

			}

		}

	return false;

}



void Solve()

{

	memset(fa,-1,sizeof(fa));

	for(int i=1;i<=n;i++)

	{

		memset(vis,0,sizeof(vis));

		ans+=Dfs(i);

	}

}



int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

		scanf("%d %d",&R[i].x,&R[i].y);

	for(int i=1;i<=n;i++)

	{

		scanf("%d %d",&B[i].x,&B[i].y);

		for(int j=1;j<=n;j++)

			if(R[j].x<B[i].x&&R[j].y<B[i].y)

				Ma[j][i]=1;

	}

	Solve();

	printf("%d\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//#include <bits/stdc++.h>

#include <iostream>

#include <cmath>

#include <cstring>

#define FAST_IO ios::sync_with_stdio(false)

#define mem(a) memset(a,0,sizeof(a))

using namespace std;

typedef long long ll;

const double pi = acos(-1.0);

const int INF = 0x3f3f3f3f;

const int maxn = 105;



int n;

struct node{

	int x,y;

}p1[maxn],p2[maxn];

int g[maxn][maxn],vis[maxn],nxt[maxn];



bool fd(int x){

	for(int i=1;i<=n;i++){

		if(g[x][i]&&!vis[i]){

			vis[i] = 1;

			if(nxt[i]==0||fd(nxt[i])){

				nxt[i] = x;		//第i个人匹配的是x 

				return 1;

			}

		}

	}

	return 0;

}



int match(){

	int ans = 0;

	for(int i=1;i<=n;i++){

		mem(vis);

		if(fd(i)) ans++;

	}

	return ans;

}



int main(){

	FAST_IO;

	cin >> n;

	for(int i=1;i<=n;i++){

		cin >> p1[i].x >> p1[i].y;

	}

	for(int i=1;i<=n;i++){

		cin >> p2[i].x >> p2[i].y;

		for(int j=1;j<=n;j++){

			if(p1[j].x<p2[i].x&&p1[j].y<p2[i].y){

				g[i][j] = 1;

			}

		}

	}

	cout << match() << endl; 

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>



const int N=100,inf=0x5FFFFFFF;

struct node

{

	int x,y;

}R[N+5],B[N+5];

int n,ans;

bool vis[N+5];

int Ma[N+5][N+5],fa[N+5];



int Dfs(int u)

{

	for(int v=1;v<=n;v++)

		if(Ma[u][v]&&!vis[v])

		{

			vis[v]=1;

			if(fa[v]==-1||Dfs(fa[v]))

			{

				fa[v]=u;

				return true;

			}

		}

	return false;

}



void Solve()

{

	memset(fa,-1,sizeof(fa));

	for(int i=1;i<=n;i++)

	{

		memset(vis,0,sizeof(vis));

		ans+=Dfs(i);

	}

}



int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

		scanf("%d %d",&R[i].x,&R[i].y);

	for(int i=1;i<=n;i++)

	{

		scanf("%d %d",&B[i].x,&B[i].y);

		for(int j=1;j<=n;j++)

			if(R[j].x<B[i].x&&R[j].y<B[i].y)

				Ma[j][i]=1;

	}

	Solve();

	printf("%d\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
/**  ~*BISMILLAHIR RAHMANIR RAHIM*~  **/



#include <bits/stdc++.h>



using namespace std;



#define F first

#define S second



typedef long long intl;

typedef pair<int, int> pii;



const int MX = 212;

int n;

pii P[MX];



struct Hopcroft_Karp {

    int N, M, match[MX], dist[MX];

    vector<int> G[MX];



    Hopcroft_Karp( int nn, int mm ) {

      N = nn, M = mm;

      memset(match, 0, sizeof match);

    }

    bool bfs() {

      queue<int> Q;

      for(int i=1; i<=N; i++) {

        if( !match[i] ) dist[i] = 0, Q.push(i);

        else dist[i] = INT_MAX;

      }

      dist[0] = INT_MAX;



      while( !Q.empty() ) {

        int u = Q.front(); Q.pop();

        if( !u ) continue;

        for(int v : G[u]) {

          if( dist[match[v]]==INT_MAX ) {

            dist[match[v]] = dist[u]+1;

            Q.push(match[v]);

          }

        }

      }

      return dist[0]!=INT_MAX;

    }

    bool dfs( int u ) {

      if( u ) {

        for(int v : G[u]) {

          if( dist[match[v]]==dist[u]+1 ) {

            if( dfs( match[v] ) ) {

              match[u] = v;

              match[v] = u;

              return true;

            }

          }

        }

        dist[u] = INT_MAX;

        return false;

      }

      return true;

    }

    int maximum_match() {

      int matching = 0;

      while( bfs() ) {

        for(int i=1; i<=N; i++) {

          if( !match[i] && dfs( i ) ) matching++;

        }

      }

      return matching;

    }



};



int main() {

  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

  cin>>n;

  for(int i=1; i<=2*n; i++) {

    cin>>P[i].F>>P[i].S;

  }

  Hopcroft_Karp BPM(n, n);

  for(int i=1; i<=n; i++) {

    for(int j=n+1; j<=2*n; j++) {

      if( P[i].F<P[j].F && P[i].S<P[j].S ) {

        BPM.G[i].push_back(j);

      }

    }

  }

  int res = BPM.maximum_match();

  cout<<res<<endl;

  return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>



const int N=100,inf=0x5FFFFFFF;

struct node

{

	int x,y;

}R[N+5],B[N+5];

int n,ans;

bool vis[N+5];

int Ma[N+5][N+5],fa[N+5];



int Dfs(int u)

{

	for(int v=1;v<=n;v++)

		if(Ma[u][v]&&!vis[v])

		{

			vis[v]=1;

			if(fa[v]==-1||Dfs(fa[v]))

			{

				fa[v]=u;

				return true;

			}

		}

	return false;

}



void Solve()

{

	memset(fa,-1,sizeof(fa));

	for(int i=1;i<=n;i++)

	{

		memset(vis,0,sizeof(vis));

		ans+=Dfs(i);

	}

}



int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

		scanf("%d %d",&R[i].x,&R[i].y);

	for(int i=1;i<=n;i++)

	{

		scanf("%d %d",&B[i].x,&B[i].y);

		for(int j=1;j<=n;j++)

			if(R[j].x<B[i].x&&R[j].y<B[i].y)

				Ma[j][i]=1;

	}

	Solve();

	printf("%d\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <algorithm>

#include <vector>

#include <iostream>

using namespace std;



const int kMaxN = 105;



int n;

int a[kMaxN], b[kMaxN], c[kMaxN], d[kMaxN];

vector<int> g[kMaxN];

int vis[kMaxN], tim, lk[kMaxN];



inline void Link(int u, int v) {

  g[u].push_back(v);

}



int Find(int x) {

  for (int nxt : g[x]) {

    if (vis[nxt] != tim) {

      vis[nxt] = tim;

      if (!lk[nxt] || Find(lk[nxt])) {

        lk[nxt] = x;

        return true;

      }

    }

  }

  return false;

}



int main() {

  ios::sync_with_stdio(false);

  cin >> n;

  for (int i = 1; i <= n; ++i) {

    cin >> a[i] >> b[i];

  }

  for (int i = 1; i <= n; ++i) {

    cin >> c[i] >> d[i];

  }

  for (int i = 1; i <= n; ++i) {

    for (int j = 1; j <= n; ++j) {

      if (a[i] < c[j] && b[i] < d[j])

        Link(i, j);

    }

  }

  int ans = 0;

  tim = 0;

  for (int i = 1; i <= n; ++i) {

    ++tim;

    ans += Find(i);

  }

  cout << ans << endl;

  return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>



const int N=100,inf=0x5FFFFFFF;

struct node

{

	int x,y;

}R[N+5],B[N+5];

int n,ans;

bool vis[N+5];

int Ma[N+5][N+5],fa[N+5];



int Dfs(int u)

{

	for(int v=1;v<=n;v++)

		if(Ma[u][v]&&!vis[v])

		{

			vis[v]=1;

			if(fa[v]==-1||Dfs(fa[v]))

			{

				fa[v]=u;

				return true;

			}

		}

	return false;

}



void Solve()

{

	memset(fa,-1,sizeof(fa));

	for(int i=1;i<=n;i++)

	{

		memset(vis,0,sizeof(vis));

		ans+=Dfs(i);

	}

}



int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

		scanf("%d %d",&R[i].x,&R[i].y);

	for(int i=1;i<=n;i++)

	{

		scanf("%d %d",&B[i].x,&B[i].y);

		for(int j=1;j<=n;j++)

			if(R[j].x<B[i].x&&R[j].y<B[i].y)

				Ma[j][i]=1;

	}

	Solve();

	printf("%d\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <cstring>

#include <math.h>

#include <algorithm>

#include <iomanip> 

#include <stack>

#include <stdlib.h>	

#include <stdio.h>

#define INF 0x3f3f3f3f

#include <set> 

#include <map>  

#include <queue>

#define maxn 300

using namespace std;

typedef long long ll;

struct node {

	int x,y;

}a[205],b[160];

int girl[160],line[160][160];

bool used[160];

int n,x,y;



bool found(int x){

	for(int i=1;i<=n;i++){

		if(line[x][i]&&!used[i]){

			used[i]=1;

			if((girl[i]==0)||found(girl[i])){

				girl[i]=x;

				return 1;

			}

		}

	}

	return 0;

}

int main(){

	scanf("%d",&n);

	for(int i=1;i<=n;i++){

		scanf("%d%d",&x,&y);

		a[i].x=x;

		a[i].y=y;

	}

	for(int i=1;i<=n;i++){

		scanf("%d%d",&x,&y);

		b[i].x=x;

		b[i].y=y;

	}

	memset(line,0,sizeof(line));

	for(int i=1;i<=n;i++){

		for(int j=1;j<=n;j++){

			if((a[i].x<b[j].x)&&(a[i].y<b[j].y)){

				line[i][j]=1;

			}

		}

	}

	memset(girl,0,sizeof(girl));

	int sum=0;

	for(int i=1;i<=n;i++){

		memset(used,0,sizeof(used));

		if(found(i)) sum++;

	}

	printf("%d\n",sum);

	return 0;

} 

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>



const int N=100,inf=0x5FFFFFFF;

struct node

{

	int x,y;

}R[N+5],B[N+5];

int n,ans;

bool vis[N+5];

int Ma[N+5][N+5],fa[N+5];



int Dfs(int u)

{

	for(int v=1;v<=n;v++)

		if(Ma[u][v]&&!vis[v])

		{

			vis[v]=1;

			if(fa[v]==-1||Dfs(fa[v]))

			{

				fa[v]=u;

				return true;

			}

		}

	return false;

}



void Solve()

{

	memset(fa,-1,sizeof(fa));

	for(int i=1;i<=n;i++)

	{

		memset(vis,0,sizeof(vis));

		ans+=Dfs(i);

	}

}



int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

		scanf("%d %d",&R[i].x,&R[i].y);

	for(int i=1;i<=n;i++)

	{

		scanf("%d %d",&B[i].x,&B[i].y);

		for(int j=1;j<=n;j++)

			if(R[j].x<B[i].x&&R[j].y<B[i].y)

				Ma[j][i]=1;

	}

	Solve();

	printf("%d\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int n,a[200],b[200],c[200],d[200];

struct edge

{

	int v,cap,rev;

	edge(int a,int b,int c):v(a),cap(b),rev(c){}

};

vector<edge> w[23333];

void add_edge(int u,int v,int cap)

{

	w[u].push_back(edge(v,cap,w[v].size()));

	w[v].push_back(edge(u,0,w[u].size()-1));

}

const int oo=1<<29;

int level[23333],iter[23333];

int dfs(int s,int t,int f)

{

	if(s==t)return f;

	for(int &i=iter[s];i<w[s].size();i++)

	{

		edge &e=w[s][i];

		if(e.cap&&level[e.v]>level[s])

			if(int d=dfs(e.v,t,min(f,e.cap)))

			{

				e.cap-=d;

				w[e.v][e.rev].cap+=d;

				return d;

			}

	}

	return 0;

}

int max_flow(int s,int t)

{

	int ans=0;

	for(;;)

	{

		memset(level,-1,sizeof level);

		memset(iter,0,sizeof iter);

		level[s]=0;

		queue<int> q;

		q.push(s);

		while(!q.empty())

		{

			int u=q.front();q.pop();

			for(int e=0;e<w[u].size();e++)

			{

				edge &i=w[u][e];

				if(level[i.v]==-1&&i.cap)

				{

					level[i.v]=level[u]+1;

					q.push(i.v);

				}

			}

		}

		if(level[t]==-1)return ans;

		while(int f=dfs(s,t,oo))ans+=f;

	}

}

int main()

{

	cin>>n;

	for(int i=1;i<=n;i++)cin>>a[i]>>b[i];

	for(int i=1;i<=n;i++)cin>>c[i]>>d[i];

	for(int i=1;i<=n;i++)add_edge(0,i,1),add_edge(n+i,2*n+1,1);

	for(int i=1;i<=n;i++)

		for(int j=1;j<=n;j++)

		if(a[i]<c[j]&&b[i]<d[j])add_edge(i,n+j,1);

	cout<<max_flow(0,2*n+1)<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

struct point

{

	int x,y,c;

	operator int()const{return x;}

}p[1000];

int n;

int main()

{

	cin>>n;

	for(int i=1;i<=2*n;i++)cin>>p[i].x>>p[i].y,p[i].c=i>n;

	sort(p+1,p+1+n+n);

	set<int> s;

	int ans=0;

	for(int i=1;i<=2*n;i++)

		if(p[i].c&&!(s.empty()||*s.begin()>p[i].y))s.erase(--s.lower_bound(p[i].y)),ans++;

		else if(!p[i].c)s.insert(p[i].y);

	cout<<ans<<endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<vector>

#include<algorithm>

#include<cstring>

using namespace std;

vector<int>g[205];

int m,n,ans,mat[205];

bool vis[205];

struct mzls

{

	int x,y;

}a[205],b;

inline bool dfs(int x)

{

	for(int i=0;i<g[x].size();i++)

	{

		int v=g[x][i];

		if(vis[v])

			continue;

		vis[v]=1;

		if(!mat[v]||dfs(mat[v]))

		{

			mat[v]=x;

			return 1;

		}

	}

	return 0;

}

int main()

{

	scanf("%d",&n);

	for(int i=1;i<=2*n;i++)

		scanf("%d%d",&a[i].x,&a[i].y);

	for(int i=1;i<=n;i++)

		for(int j=n+1;j<=2*n;j++)

			if(a[i].x<a[j].x&&a[i].y<a[j].y)

			{

				g[i].push_back(j);

				g[j].push_back(i);

			}

	for(int i=1;i<=n;i++)

	{

		memset(vis,0,sizeof(vis));

		ans+=dfs(i);

	}

	printf("%d",ans);

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#define N 105

using namespace std;

int n,o_t[N];

int ans;

bool line[N][N],f[N];

struct node

{

	int x;int y;

}red[N];



struct node blue[N]; 



void read()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

		scanf("%d %d",&red[i].x,&red[i].y);

	for(int i=1;i<=n;i++)

		scanf("%d %d",&blue[i].x,&blue[i].y);

}

int PD(int x)

{

	for(int j=1;j<=n;j++)

	{

		if(line[x][j]&&!f[j])

		{

			f[j]=1;

			if(o_t[j]==0||PD(o_t[j]))

			{

				o_t[j]=x;

				return 1;

			}

		}

	}

	return 0;

}

int main()

{

	read();

	for(int i=1;i<=n;i++)

		for(int j=1;j<=n;j++)

		{

			if(red[i].x<blue[j].x&&red[i].y<blue[j].y)

			line[i][j]=1;

		}

	for(int i=1;i<=n;i++)

	{

		memset(f,0,sizeof f);

		if(PD(i)) ans++;

	}

	printf("%d",ans);

 } 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

ll f ( ll x ) {

    if ( x == 0 ) return 0;

    else return x % 10 + f ( x / 10 );

}

int main() {

    std::ios::sync_with_stdio ( false );

    int k;

    cin >> k;

    int num = 0;

    ll ans = 1;

    ll p = 1;

    while ( num < k ) {

        cout << ans << endl;

        ll ans1 = ans + p;

        ll ans2 = ans + p * 10;

        if ( ans1 * f ( ans2 ) <= ans2 * f ( ans1 ) ) {

            ans = ans1;

        } else {

            ans = ans2;

            p *= 10;

        }

        num++;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

typedef long long ll;

typedef long double ld;

ld Max(ld a,ld b){return a>b?a:b;}

inline ll read()

{

	ll x=0,f=1;char c=getchar();

	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}

	while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}

	return x*f;

}

ll k,a;

ld MAA,uu;

ll rr(ll x)

{

	ll now=0;

	while(x) now+=x%10,x/=10;

	return now;

}

bool check(ll x)

{

	//printf("%lldzx\n",x);

	ll g=1;

	while(g<=x)

	{

		//printf("%lld %lld %lld %lld %lld %lf %lf\n",g,(x+g),rr(x+g),x,rr(g),(double)1.0*(x+g)/rr(x+g),(double)1.0*x/rr(x));

		if((ld)(x+g)*rr(x)<(ld)x*rr(x+g))return 0;

		g=(g<<3)+(g<<1);

	}

	return 1;

}

int main()

{

	//printf("%lf\n",(double)2/1);

	scanf("%lld",&k);

	while(k--)

	{

		ll r=1;

		while(1)

		{

			if(check(r+a))

			{

				a+=r;

				break;

			}

			r=(r<<3)+(r<<1);

		}

		printf("%lld\n",a);

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstring>

#include <queue>

#include <cmath>

#include <algorithm>

#include <set>

#include <iostream>

#include <map>

#include <stack>

#include <string>

#include <vector>

#define  pi acos(-1.0)

#define  eps 1e-6

#define  fi first

#define  se second

#define  rtl   rt<<1

#define  rtr   rt<<1|1

#define  bug         printf("******\n")

#define  mem(a,b)    memset(a,b,sizeof(a))

#define  name2str(x) #x

#define  fuck(x)     cout<<#x" = "<<x<<endl

#define  f(a)        a*a

#define  sf(n)       scanf("%d", &n)

#define  sff(a,b)    scanf("%d %d", &a, &b)

#define  sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)

#define  sffff(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)

#define  pf          printf

#define  FRE(i,a,b)  for(i = a; i <= b; i++)

#define  FREE(i,a,b) for(i = a; i >= b; i--)

#define  FRL(i,a,b)  for(i = a; i < b; i++)+

#define  FRLL(i,a,b) for(i = a; i > b; i--)

#define  FIN         freopen("data.txt","r",stdin)

#define  gcd(a,b)    __gcd(a,b)

#define  lowbit(x)   x&-x

using namespace std;

typedef long long  LL;

typedef unsigned long long ULL;

const int mod = 1e9 + 7;

const int maxn = 2e5 + 10;

const int INF = 0x3f3f3f3f;

const LL INFLL = 0x3f3f3f3f3f3f3f3fLL;

int k;

LL sum ( LL x ) {

    int ret = 0;

    while ( x ) {

        ret += x % 10;

        x /= 10;

    }

    return ret;

}

int main()  {

    sf ( k );

    LL ans = 1, p = 1;

    while ( k-- ) {

        printf ( "%lld\n", ans );

        LL ans1 = ans + p, ans2 = ans + p * 10;

        if ( ans1 * sum ( ans2 ) <= ans2 * sum ( ans1 ) ) ans = ans1;

        else ans = ans2,p*=10;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

typedef long long ll;

typedef long double ld;

ld Max(ld a,ld b){return a>b?a:b;}

inline ll read()

{

	ll x=0,f=1;char c=getchar();

	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}

	while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}

	return x*f;

}

ll k,a;

ld MAA,uu;

ll rr(ll x)

{

	ll now=0;

	while(x) now+=x%10,x/=10;

	return now;

}

bool check(ll x)

{

	//printf("%lldzx\n",x);

	ll g=1;

	while(g<=x)

	{

		//printf("%lld %lld %lld %lld %lld %lf %lf\n",g,(x+g),rr(x+g),x,rr(g),(double)1.0*(x+g)/rr(x+g),(double)1.0*x/rr(x));

		if((ld)(x+g)*rr(x)<(ld)x*rr(x+g))return 0;

		g=(g<<3)+(g<<1);

	}

	return 1;

}

int main()

{

	//printf("%lf\n",(double)2/1);

	scanf("%lld",&k);

	while(k--)

	{

		ll r=1;

		while(1)

		{

			if(check(r+a))

			{

				a+=r;

				break;

			}

			r=(r<<3)+(r<<1);

		}

		printf("%lld\n",a);

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

using namespace std;

double cal(long long x){

    long long y=10,len=1,sum=0,ret=x;

    while(y<=x)y=(y<<1)+(y<<3),++len;

    while(len--){

        y/=10;

        sum+=x/y;

        x%=y;

    }

    return ret*1.0/sum;

}

bool judge(long long x){

    long long a=1;

    while(a<=x){

        if(cal(x+a)<cal(x))return false;

        a=(a<<1)+(a<<3);

    }

    return true;

}

long long k,now;

int main(){

    scanf("%d",&k);

    while(k--){

        long long a=1;

        while(true){

            if(judge(now+a)){

                now+=a;

                break;

            }

            a=(a<<1)+(a<<3);

        }

        cout<<now<<endl;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

typedef long long ll;

typedef long double ld;

ld Max(ld a,ld b){return a>b?a:b;}

inline ll read()

{

	ll x=0,f=1;char c=getchar();

	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}

	while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}

	return x*f;

}

ll k,a;

ld MAA,uu;

ll rr(ll x)

{

	ll now=0;

	while(x) now+=x%10,x/=10;

	return now;

}

bool check(ll x)

{

	//printf("%lldzx\n",x);

	ll g=1;

	while(g<=x)

	{

		//printf("%lld %lld %lld %lld %lld %lf %lf\n",g,(x+g),rr(x+g),x,rr(g),(double)1.0*(x+g)/rr(x+g),(double)1.0*x/rr(x));

		if((ld)(x+g)*rr(x)<(ld)x*rr(x+g))return 0;

		g=(g<<3)+(g<<1);

	}

	return 1;

}

int main()

{

	//printf("%lf\n",(double)2/1);

	scanf("%lld",&k);

	while(k--)

	{

		ll r=1;

		while(1)

		{

			if(check(r+a))

			{

				a+=r;

				break;

			}

			r=(r<<3)+(r<<1);

		}

		printf("%lld\n",a);

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <algorithm>

#include <cstring>

#include <deque>

#include <functional>

#include <iostream>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <vector>

using namespace std;

#define fst first

#define snd second

using ll = long long;

using I = pair<int, int>;

const int D = 16;



ll g(ll n, int k) {

  vector<int> dig(D, 0), sum(D + 1, 0);

  for (int i = 0; i < D; i++) {

    dig[i] = n % 10;

    sum[i + 1] = sum[i] + dig[i];

    n /= 10;

  }

  ll m = 0;

  bool eq = true;

  for (int i = D - 1, j = D - 1; i > 0; i--) {

    j = min(i - 1, j);

    while (j >= 0 && dig[j] == 9) --j;

    for (int d = eq ? dig[i] : 0; d <= 9; d++) {

      bool neq = eq & (d == dig[i]);

      int mn = 0, mx = 9 * i;

      if (neq) {

        mn += 9 * (i - j - 1);

        if (j >= 0) {

          mn += sum[j + 1] == dig[j] ? dig[j] : dig[j] + 1;

        }

      }

      if (mn <= k - d && k - d <= mx) {

        m = m * 10 + d;

        k -= d;

        eq = neq;

        break;

      }

    }

  }

  m = m * 10 + k;

  return m;

}



ll f(ll n) {

  ll p = 1, q = 0;

  for (ll k = 1; k <= D * 9; k++) {

    ll m = g(n, k);

    if (p * k > m * q || (p * k == m * q && m < p)) {

      p = m;

      q = k;

    }

  }

  return p;

}



int main() {

  int K;

  while (cin >> K) {

    vector<ll> res;

    res.push_back(1);

    while (res.size() < K) {

      ll n = res.back();

      res.push_back(f(n + 1));

    }

    for (ll x : res) cout << x << endl;

  }

  return 0;

}


// Optimized solution to the same problem (faster):
#include <algorithm>

#include <cstring>

#include <deque>

#include <functional>

#include <iostream>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <vector>

using namespace std;

#define fst first

#define snd second

using ll = long long;

using I = pair<int, int>;

const int D = 16;



int S(ll n) {

  int s = 0;

  while (n > 0) {

    s += n % 10;

    n /= 10;

  }

  return s;

}



ll f(ll n) {

  vector<ll> cand = {n};

  for (ll p = 1; p <= n; p *= 10) {

    int d = (n / p) % 10;

    for (int i = d + 1; i <= 9; i++) {

      ll x = (n / p) - d + i;

      x = x * p + p - 1;

      cand.push_back(x);

    }

  }

  ll p = 1, q = 0;

  for (ll x : cand) {

    ll s = S(x);

    if (p * s > x * q || (p * s == x * q && p > x)) {

      p = x;

      q = s;

    }

  }

  return p;

}



int main() {

  int K;

  while (cin >> K) {

    vector<ll> res;

    res.push_back(1);

    while (res.size() < K) {

      ll n = res.back();

      res.push_back(f(n + 1));

    }

    for (ll x : res) cout << x << endl;

  }

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std ;

int x ;

int main()

{

	int sum = 0 , y ;

	cin >> x ;

	y= x ;

	while ( y > 0 ) 

		sum += y% 10 , y/=10 ;

	if ( x % sum == 0 ) 

		cout << "Yes" <<"\n" ;

	else

		cout << "No"<< endl;



}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int f(int angka){

	int v=100000000,panjang,total=0;

	

	for(int i=0; i<9; i++){

		total=total+(angka/v);

		angka=angka%v;

		v/=10;

		

	}

	

	

	return total;

}



int main(){

	int a;

	scanf("%d", &a);

	int b=f(a);

	printf("%s\n", a%b==0?"Yes":"No");

	return 0;

}

// Fastest known solution for this problem: