criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
using namespace std;

#define ll=Long Long

int main(){
	int k;
  	cin>>k;
  	vector<ll>a;
  	for(int i=1;i<=9;i++){
    	a.push_back(i);
    }
  	while(1){
    	if(k<=a.size()){
        	cout << a[k-1] << endl;
          	return 0;
        }
      	k-=a.size();
      	vector<ll>old;
      	swap(old,a);
      	for(ll x : old){
        	for(int i=-1;i<=1;i++){
            	int d=x%10_i;
              	if(d<0 || d>9){
                	continue;
                }
              	ll nx=x*10+d;
              	a.push_back(nx);
            }
        }
    }
  	return 0;
}

Compiler output:
a.cc:4:9: warning: ISO C++11 requires whitespace after the macro name
    4 | #define ll=Long Long
      |         ^~
a.cc: In function 'int main()':
a.cc:4:12: error: 'Long' was not declared in this scope; did you mean 'long'?
    4 | #define ll=Long Long
      |            ^~~~
a.cc:9:16: note: in expansion of macro 'll'
    9 |         vector<ll>a;
      |                ^~
a.cc:9:18: error: template argument 1 is invalid
    9 |         vector<ll>a;
      |                  ^
a.cc:9:18: error: template argument 2 is invalid
a.cc:11:11: error: request for member 'push_back' in 'a', which is of non-class type 'int'
   11 |         a.push_back(i);
      |           ^~~~~~~~~
a.cc:14:17: error: request for member 'size' in 'a', which is of non-class type 'int'
   14 |         if(k<=a.size()){
      |                 ^~~~
a.cc:15:26: error: invalid types 'int[int]' for array subscript
   15 |                 cout << a[k-1] << endl;
      |                          ^
a.cc:18:14: error: request for member 'size' in 'a', which is of non-class type 'int'
   18 |         k-=a.size();
      |              ^~~~
a.cc:19:18: error: template argument 1 is invalid
   19 |         vector<ll>old;
      |                  ^
a.cc:19:18: error: template argument 2 is invalid
a.cc:4:11: error: expected primary-expression before '=' token
    4 | #define ll=Long Long
      |           ^
a.cc:21:13: note: in expansion of macro 'll'
   21 |         for(ll x : old){
      |             ^~
a.cc:31:5: error: expected primary-expression before '}' token
   31 |     }
      |     ^
a.cc:30:10: error: expected ';' before '}' token
   30 |         }
      |          ^
      |          ;
   31 |     }
      |     ~     
a.cc:31:5: error: expected primary-expression before '}' token
   31 |     }
      |     ^
a.cc:30:10: error: expected ')' before '}' token
   30 |         }
      |          ^
      |          )
   31 |     }
      |     ~     
a.cc:21:12: note: to match this '('
   21 |         for(ll x : old){
      |            ^
a.cc:31:5: error: expected primary-expression before '}' token
   31 |     }
      |     ^
Language: C++

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

//#define INF (1<<29)

string L,R;
int dist[2][100010];
queue <int> q;
int a,k,i;


int lun(int i)
{
	int a[10000];
	int j;
	int k=i;
	int g=1;
	while(k>=1)
	{
		k=k/10;
		j++;
	}
	if(j==1)
    {
		return true;
	}
	
	for(int l=0;l<j;l++)
	{
		k=pow(10,l);

		a[g]=(i/k)%10;


		g++;
		//i=i/10;

	}
	for(i=2;i<=j;i++)
	{

			if(a[i]-a[i-1]>1||a[i-1]-a[i]>1)
		   	{

		   	}
		   	else
		   	{

			   return true;
		    }


	}

	return false;

	
}

int main()
{

	int n;
	cin>>n;


	for(i=1;;i++)
	{
		
		if(lun(i)==true)
		{
			a++;
			k=i;
		}

		
		if(a==n)
		{
			cout<<k<<endl;
			return 0;
		}
	}
	return 0;

}



Compiler output:
a.cc:2:9: fatal error: windows.h: No such file or directory
    2 | #include<windows.h>
      |         ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
#define int long long int
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
int32_t main(){
    int n,i;
    cin>>n;
    if(n<=12){
        cout<<n;
    }
    priority_queue<int,vector<int>,grearter<int>>p;
    for(i=1;i<=9;i++){
        p.push(i);
    }
    int count=0;
    int ans;
    while(true){
        int num=p.top();
        p.pop();
        count++;
        if(count==n){
            ans=num;
            break;
        }
        int d=num%10;
        p.push((num*10)+d);
        if(num!=0){
            p.push((num*10)+d-1);
        }
        if(num!=9){
            p.push((num*10)+d+1)
        }
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:13:36: error: 'grearter' was not declared in this scope
   13 |     priority_queue<int,vector<int>,grearter<int>>p;
      |                                    ^~~~~~~~
a.cc:13:48: error: template argument 3 is invalid
   13 |     priority_queue<int,vector<int>,grearter<int>>p;
      |                                                ^~
a.cc:15:11: error: request for member 'push' in 'p', which is of non-class type 'int'
   15 |         p.push(i);
      |           ^~~~
a.cc:20:19: error: request for member 'top' in 'p', which is of non-class type 'int'
   20 |         int num=p.top();
      |                   ^~~
a.cc:21:11: error: request for member 'pop' in 'p', which is of non-class type 'int'
   21 |         p.pop();
      |           ^~~
a.cc:28:11: error: request for member 'push' in 'p', which is of non-class type 'int'
   28 |         p.push((num*10)+d);
      |           ^~~~
a.cc:30:15: error: request for member 'push' in 'p', which is of non-class type 'int'
   30 |             p.push((num*10)+d-1);
      |               ^~~~
a.cc:33:15: error: request for member 'push' in 'p', which is of non-class type 'int'
   33 |             p.push((num*10)+d+1)
      |               ^~~~
Language: C

#include<bits/stdc++.h>
#include <queue>
using namespace std;
int main(){
	long long int a,b,c,d;
	cin>>a;
	queue <long long int> qq;
	for(int i=1;i<=9;i++)qq.push(i);
	while(a--){
	b=qq.front();
	qq.pop();
	c=b%10;
	if(c>0)qq.push(b*10+c-1);
	qq.push(b*10+c);
	if(c<9)qq.push(b*10+c+1);
	}
	cout<<b;
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

# frozen_string_literal: true

$ls = Array.new(10).map{[]}
def dfs(a, b)
  j = a.length - 1
  $ls[j] << a
  a += b if b != 'k'
  return if a.length == 10

  (-1..1).each do |i|
    if i == - 1 && a[-1] == '0' || i == 1 && a[-1] == '9'
    end
    dfs(a, i.to_s)
  end
end

k = gets.to_i
(1..9).each do |i|
  t = i.to_s
  dfs(t, 'k')
end
cnt = 0
(0..9).each do |i|
  (0..$ls[i].length - 1).each do |j|
    puts $ls[i][j] if cnt == k - 1
    cnt += 1
  end
end


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #frozen_string_literal
    1 | # frozen_string_literal: true
      |   ^~~~~~~~~~~~~~~~~~~~~
a.cc:10:5: error: too many decimal points in number
   10 |   (-1..1).each do |i|
      |     ^~~~
a.cc:18:2: error: too many decimal points in number
   18 | (1..9).each do |i|
      |  ^~~~
a.cc:23:2: error: too many decimal points in number
   23 | (0..9).each do |i|
      |  ^~~~
a.cc:24:4: error: too many decimal points in number
   24 |   (0..$ls[i].length - 1).each do |j|
      |    ^~~~~~
a.cc:3:1: error: '$ls' does not name a type
    3 | $ls = Array.new(10).map{[]}
      | ^~~
a.cc:4:1: error: 'def' does not name a type
    4 | def dfs(a, b)
      | ^~~
Language: C++

cd ../A
../../../../cpt.sh A https://atcoder.jp/contests/abc161/tasks/abc161_a

cd ../B
../../../../cpt.sh B https://atcoder.jp/contests/abc161/tasks/abc161_b

cd ../C
../../../../cpt.sh C https://atcoder.jp/contests/abc161/tasks/abc161_c

cd ../D
../../../../cpt.sh D https://atcoder.jp/contests/abc161/tasks/abc161_d

cd ../E
../../../../cpt.sh E https://atcoder.jp/contests/abc161/tasks/abc161_e

cd ../F
../../../../cpt.sh F https://atcoder.jp/contests/abc161/tasks/abc161_f


Compiler output:
a.cc:1:1: error: 'cd' does not name a type
    1 | cd ../A
      | ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int k;
  cin >> k;
  vector<long long> a;
  for(int i=1;i<=9;i++) a.push_back(i);
  while (1){
    if(k <= a.size()){
      cout << a[k-1] << endl;
      return 0;
    }
    k-= a.size();
    vector<long long> old;
    swap(old,a);
    for(ll x : old){
      for(int i=-1;i<=1;i++){
        int d = x%10+i;
        if(d<0 || d>9) continue;
        long long nx=x*10+d;
        a.push_back(nx);
      }
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'll' was not declared in this scope
   17 |     for(ll x : old){
      |         ^~
a.cc:25:3: error: expected primary-expression before '}' token
   25 |   }
      |   ^
a.cc:24:6: error: expected ';' before '}' token
   24 |     }
      |      ^
      |      ;
   25 |   }
      |   ~   
a.cc:25:3: error: expected primary-expression before '}' token
   25 |   }
      |   ^
a.cc:24:6: error: expected ')' before '}' token
   24 |     }
      |      ^
      |      )
   25 |   }
      |   ~   
a.cc:17:8: note: to match this '('
   17 |     for(ll x : old){
      |        ^
a.cc:25:3: error: expected primary-expression before '}' token
   25 |   }
      |   ^
Language: C++

#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9 + 7;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

vector<ll> vec;

void go(ll val) {
	if (val > 3234566667ll) return;

	vec.push_back(val);
	for (int i = max(0ll, val % 10 - 1); i <= min(9ll, val % 10 + 1); ++i) {
		ll nxt = val * 10 + i;
		go(nxt);
	}
}
int main() {
	fastio;
	int K;
	cin >> K;

	for (int i = 1; i <= 9; ++i) go(i, 1);
	sort(all(vec));

	cout << vec[K - 1];

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:40: error: too many arguments to function 'void go(ll)'
   34 |         for (int i = 1; i <= 9; ++i) go(i, 1);
      |                                      ~~^~~~~~
a.cc:20:6: note: declared here
   20 | void go(ll val) {
      |      ^~
Language: C++

#include<iostream>
using namespace std ;

int main()
{
  int K ;
  cin>>K ;
  vector<int64_t>num_Rn(12){1,2,3,4,5,6,7,8,9,10,11,12} ;
  if(K<=12){
    cout<<num_Rn.at(K--)<<endl ;
    return 0 ;
  }
  K-=12 ;
  while(1){
    num_Rn.push_back(num_Rn(num_Rn.size()-2)+10) ;
    K-- ;
    if(K<0) break ;
    num_Rn.push_back(num_Rn(num_Rn.size()-3)+11) ;
    K-- ;
    if(K<0) break ;
    num_Rn.push_back(num_Rn(num_Rn.size()-4)+12) ;
    K-- ;
    if(K<0) break ;
  }
  
  cout<<num_Rn.at(Num_Rn.size()-1)<<endl ;
    
  return 0 ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int64_t>num_Rn(12){1,2,3,4,5,6,7,8,9,10,11,12} ;
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std ;
a.cc:8:17: error: expected primary-expression before '>' token
    8 |   vector<int64_t>num_Rn(12){1,2,3,4,5,6,7,8,9,10,11,12} ;
      |                 ^
a.cc:8:18: error: 'num_Rn' was not declared in this scope
    8 |   vector<int64_t>num_Rn(12){1,2,3,4,5,6,7,8,9,10,11,12} ;
      |                  ^~~~~~
a.cc:26:19: error: 'Num_Rn' was not declared in this scope
   26 |   cout<<num_Rn.at(Num_Rn.size()-1)<<endl ;
      |                   ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=1000010;
const ll mod=1e9+7;

void rec(int d, ll val, vector<ll> &a){
  // 格納
  a.push_back(val);

  // 10 桁だったらそれ以上やらずに打ち切り
  if (d == 10) return;

  // 次の桁へ進む処理
  REP(i,-1,2){
    int nxt = (val%10)+j;
    if(0<=nxt && nxt<=9) rec(d+1, val*10+nxt, a);
  }
} 
int main(){
  int k;
  cin >> k;
  vector<ll> a;
  REP(i,1,10) rec(1,i,a);
  sort(a.begin(),a.end());
  ll ans = a[k-1];
  cout << ans << endl;  
  return 0;
}

Compiler output:
a.cc: In function 'void rec(int, ll, std::vector<long long int>&)':
a.cc:25:24: error: 'j' was not declared in this scope
   25 |     int nxt = (val%10)+j;
      |                        ^
Language: C++

#include <iostream>

using namespace std;
#define ll long long int

int main()
{
 ll k;
 cin>>k;
 
 queue<ll> q;
 for(int i=1;i<=9;i++)
 {
     q.push(i);
     
 }
 
 while(!q.empty())
 {
     
     ll k=q.front();
     q.pop();
     n--;
     if(n==0)
     {
         cout<<k<<break;
         
     }
     
     
     for(ll i=(k%10)-1;i<=(k%10)+1;i++)
     {
         if(i<0 || i>=10)
         continue;
         q.push(k*10+i);
     }
    
 }
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:2: error: 'queue' was not declared in this scope
   11 |  queue<ll> q;
      |  ^~~~~
a.cc:2:1: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
    1 | #include <iostream>
  +++ |+#include <queue>
    2 | 
a.cc:4:12: error: expected primary-expression before 'long'
    4 | #define ll long long int
      |            ^~~~
a.cc:11:8: note: in expansion of macro 'll'
   11 |  queue<ll> q;
      |        ^~
a.cc:14:6: error: 'q' was not declared in this scope
   14 |      q.push(i);
      |      ^
a.cc:18:9: error: 'q' was not declared in this scope
   18 |  while(!q.empty())
      |         ^
a.cc:23:6: error: 'n' was not declared in this scope
   23 |      n--;
      |      ^
a.cc:26:19: error: expected primary-expression before 'break'
   26 |          cout<<k<<break;
      |                   ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
std::queue<LL> q;
int k;
int main() {
    for (int i = 1; i <= 9; ++i)    q.push(i);
    read(k);
    for (int i = 1; i < k; ++i) {
        LL a = q.front();
        int dig = a % 10;
        q.pop();
        if (dig != 0)   q.push(a * 10 + dig - 1);
        q.push(a * 10 + dig);
        if (dig != 9)   q.push(a * 10 + dig + 1);
    }
    printf("%lld\n", q.front());
    return 0;
}

Compiler output:
a.cc:3:12: error: 'LL' was not declared in this scope
    3 | std::queue<LL> q;
      |            ^~
a.cc:3:14: error: template argument 1 is invalid
    3 | std::queue<LL> q;
      |              ^
a.cc:3:14: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:6:39: error: request for member 'push' in 'q', which is of non-class type 'int'
    6 |     for (int i = 1; i <= 9; ++i)    q.push(i);
      |                                       ^~~~
a.cc:7:9: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
    7 |     read(k);
      |     ~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:1:
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
a.cc:9:9: error: 'LL' was not declared in this scope
    9 |         LL a = q.front();
      |         ^~
a.cc:10:19: error: 'a' was not declared in this scope
   10 |         int dig = a % 10;
      |                   ^
a.cc:11:11: error: request for member 'pop' in 'q', which is of non-class type 'int'
   11 |         q.pop();
      |           ^~~
a.cc:12:27: error: request for member 'push' in 'q', which is of non-class type 'int'
   12 |         if (dig != 0)   q.push(a * 10 + dig - 1);
      |                           ^~~~
a.cc:13:11: error: request for member 'push' in 'q', which is of non-class type 'int'
   13 |         q.push(a * 10 + dig);
      |           ^~~~
a.cc:14:27: error: request for member 'push' in 'q', which is of non-class type 'int'
   14 |         if (dig != 9)   q.push(a * 10 + dig + 1);
      |                           ^~~~
a.cc:16:24: error: request for member 'front' in 'q', which is of non-class type 'int'
   16 |     printf("%lld\n", q.front());
      |                        ^~~~~
Language: C++

#include <bits/stdc++.h>
#define FOR_IMPL(i,b,e) for (common_type_t <decltype (b), decltype(e)> i = (b), i ## _end = (e); i < i ## _end; ++ i)
#define FOR(...) FOR_IMPL(__VA_ARGS__)
#define ALL(x)   begin (x), end (x)
using namespace std;
using ll = int64_t;

auto lunlun_gen ()
{
  vector <ll> res = {0};
  auto ite = back_inserter (res);
  auto impl = [&] (auto self, ll now, int keta)
  {
    if (keta > 10) return;
    * ite ++ = now;
    int z = now % 10;
    FOR (i, max (0, z - 1), min (9, z + 1) + 1)
    {
      self (self, now * 10 + i, keta + 1);
    }
  };
  FOR (i, 1, 10) impl (impl, i, 1);
  sort (ALL (res));
  return res;
}

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);
  auto lunlun = lunlun_gen ();
  size_t k;
  cin >> k;
  cout << runrun[k] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:11: error: 'runrun' was not declared in this scope; did you mean 'lunlun'?
   34 |   cout << runrun[k] << endl;
      |           ^~~~~~
      |           lunlun
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    Queue q = new LinkedList<Long>();
    for(int i = 1; i < 10; i++) {
      q.add((long)i);
    }
    long ans = 0;
    for(int i = 0; i < k; i++) {
      long t = q.poll();
      if(i == (k - 1)) {
        ans = t;
        break;
      }
      long d = (t % 10);
      long t1 = 10 * t + (d - 1);
      long t2 = 10 * t + d;
      long t3 = 10 * t + (d + 1);
      if(d == 0) {
        q.add(t2);
        q.add(t3);        
      } else if(d == 9) {
        q.add(t1);
        q.add(t2);
      } else {
        q.add(t1);
        q.add(t2);
        q.add(t3);
      } 
    }
    System.out.println(ans);
  }
}


Compiler output:
Main.java:13: error: incompatible types: Object cannot be converted to long
      long t = q.poll();
                     ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;

int k;
int num=0;

bool check(long long kr)
{
	char kx[15];
	itoa(kr,kx,10);
	int i=0,j=0;
	for(i=0;i<strlen(kx)-1;i++)
	{
		j=i+1;
		if(abs(kx[i]-kx[j])>1)
			return false;
	}
	return true;
}

long long find()
{
	long long i=1;
	while(num<k)
		if(check(i))
		{
			num++;
			i++;
		}
	return i;
}

int main()
{
	scanf("%d",&k);
	printf("%lld\n",find());
	return 0;
}

Compiler output:
a.cc: In function 'bool check(long long int)':
a.cc:10:9: error: 'itoa' was not declared in this scope
   10 |         itoa(kr,kx,10);
      |         ^~~~
Language: C

#include<bits/stdc++.h>
using namespace std;

int k;
int num=0;

bool check(long long kr)
{
	char kx[15];
	itoa(kr,kx,10);
	int i=0,j=0;
	for(i=0;i<strlen(kx)-1;i++)
	{
		j=i+1;
		if(abs(kx[i]-kx[j])>1)
			return false;
	}
	return true;
}

long long find()
{
	long long i=1;
	while(num<k)
		if(check(i))
		{
			num++;
			i++;
		}
	return i;
}

int main()
{
	scanf("%d",&k);
	printf("%lld\n",find());
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define pb push_back
using namespace std;
typedef long long ll;

int main(){
  int k;
  cin>>k;
  queue<ll> g;
  ll x;
  rep(i,9) g.push(i+1);
  rep(i,k){
    x = g.top();
    if(x%10) g.push(10*x+x-1);
    g.push(10*x+x);
    if(x%10!=9) g.push(10*x+x+1);
    g.pop();
  }
  cout << x << endl;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: 'class std::queue<long long int>' has no member named 'top'; did you mean 'pop'?
   14 |     x = g.top();
      |           ^~~
      |           pop
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define pb push_back
using namespace std;
typedef long long ll;

int main(){
  int k;
  cin>>k;
  queue<ll> g;
  rep(i,9) g.push(i+1);
  rep(i,k){
    ll x = g.top();
    if(x%10) g.push(10*x+x-1);
    g.push(10*x+x);
    if(x%10!=9) g.push(10*x+x+1);
    g.pop();
  }
  cout << x << endl;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: 'class std::queue<long long int>' has no member named 'top'; did you mean 'pop'?
   13 |     ll x = g.top();
      |              ^~~
      |              pop
a.cc:19:11: error: 'x' was not declared in this scope
   19 |   cout << x << endl;
      |           ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main()
{
    int K;
    cin >> K;

    vector<ll> a;
    for (int i = 1; i < 10; i++)
    {
        a.push_back(i);
    }

    while (1)
    {
        if (K <= a.size())
        {
            cout << a[K - 1] << endl;
            return 0;
        }
        K -= a.size();
        vector<ll> old;
        swap(old, a);
        for (ll x : old)
        {
            for (int i = -1; i <= 1; i++)
            {
                int d = x % 10 + 1;
                if (d < 0 || d > 9)
                    continue;
                ll nx = x * 10 + d;
                a.push_back(d);
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   41 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define int long long
#define BUF 1e5
#define INF 1<<30
#define EPS 1e-5
#define all(a) (a).begin(),(a).end()
#define INTCEIL(a, b) ((a + (b - 1)) / b)
constexpr ll mod = 1e9 + 7;
using namespace std;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

void dfs(string num, int digit, vector<int>& x) {
	if (digit == 0) {
		x.push_back(stoll(num));
	}
	else {
		int now = int(num.back() - '0');
		if (now - 1 >= 0) {
			dfs(num + to_string(now - 1), digit - 1, x);
		}
		if (now + 1 < 10) {
			dfs(num + to_string(now + 1), digit - 1, x);
		}
		dfs(num + to_string(now), digit - 1, x);
	}
}


signed main() {
	vector<vector<int>> dp(10, vector<int>(10, 0));
	for (int i = 0; i < 10; i++) {
		dp[0][i] = 1;
	}
	for (int i = 1; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			dp[i][j] = (j - 1 < 0 ? 0 : dp[i - 1][j - 1]) + dp[i - 1][j] + (j + 1 > 9 ? 0 : dp[i - 1][j + 1]);
		}
	}
	cin >> N;
	pair<int, int> p;
	int pos = 0;
	for (int i = 0; i < 10; i++) {
		bool flag = 0;
		for (int j = 1; j < 10; j++) {
			ans += dp[i][j];
			if (ans >= N) {
				flag = 1;
				p = { i,j };
				pos = N - (ans - dp[i][j]);
				break;
			}
		}
		if (flag) {
			break;
		}
	}
	vector<int> res;
	dfs(to_string(p.second), p.first, res);
	sort(res.begin(), res.end());
	cout << res[pos - 1] << endl;
}

Compiler output:
a.cc: In function 'void dfs(std::string, long long int, std::vector<long long int>&)':
a.cc:4:13: error: expected primary-expression before 'long'
    4 | #define int long long
      |             ^~~~
a.cc:21:27: note: in expansion of macro 'int'
   21 |                 int now = int(num.back() - '0');
      |                           ^~~
Language: C++

#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define int ll
#define BUF 1e5
#define INF 1<<30
#define EPS 1e-5
#define all(a) (a).begin(),(a).end()
#define INTCEIL(a, b) ((a + (b - 1)) / b)
constexpr ll mod = 1e9 + 7;
using namespace std;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

void dfs(string num, int digit, vector<int>& x) {
	if (digit == 0) {
		x.push_back(stoll(num));
	}
	else {
		int now = int(num.back() - '0');
		if (now - 1 >= 0) {
			dfs(num + to_string(now - 1), digit - 1, x);
		}
		if (now + 1 < 10) {
			dfs(num + to_string(now + 1), digit - 1, x);
		}
		dfs(num + to_string(now), digit - 1, x);
	}
}


signed main() {
	vector<vector<int>> dp(10, vector<int>(10, 0));
	for (int i = 0; i < 10; i++) {
		dp[0][i] = 1;
	}
	for (int i = 1; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			dp[i][j] = (j - 1 < 0 ? 0 : dp[i - 1][j - 1]) + dp[i - 1][j] + (j + 1 > 9 ? 0 : dp[i - 1][j + 1]);
		}
	}
	cin >> N;
	pair<int, int> p;
	int pos = 0;
	for (int i = 0; i < 10; i++) {
		bool flag = 0;
		for (int j = 1; j < 10; j++) {
			ans += dp[i][j];
			if (ans >= N) {
				flag = 1;
				p = { i,j };
				pos = N - (ans - dp[i][j]);
				break;
			}
		}
		if (flag) {
			break;
		}
	}
	vector<int> res;
	dfs(to_string(p.second), p.first, res);
	sort(res.begin(), res.end());
	cout << res[pos - 1] << endl;
}

Compiler output:
a.cc: In function 'void dfs(std::string, long long int, std::vector<long long int>&)':
a.cc:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
a.cc:4:13: note: in expansion of macro 'll'
    4 | #define int ll
      |             ^~
a.cc:21:27: note: in expansion of macro 'int'
   21 |                 int now = int(num.back() - '0');
      |                           ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); i++) 
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = 10000000000000;


//queue
int main() {
    ll k;
    cin >> k;
    queue<ll> q;
    for (int i=1; i<10; i++){
        q.push(i);
    }
    ll x = 0
    rep(i,k){
        x = q.front(); q.pop();
        if (x%10 != 0) q.push(11*x-1);
        q.push(11*x);
        if (x%11 != 9) q.push(11*x+1);
    }
    cout << x << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:19: error: expected ',' or ';' before 'for'
    2 | #define rep(i, n) for (int i=0; i<(n); i++)
      |                   ^~~
a.cc:18:5: note: in expansion of macro 'rep'
   18 |     rep(i,k){
      |     ^~~
a.cc:18:9: error: 'i' was not declared in this scope
   18 |     rep(i,k){
      |         ^
a.cc:2:33: note: in definition of macro 'rep'
    2 | #define rep(i, n) for (int i=0; i<(n); i++)
      |                                 ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); i++) 
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = 10000000000000;


//queue
int main() {
    ll k;
    cin >> k;
    queue<ll> q;
    for (int i=1; i<10; i++){
        q.push(i);
    }
    rep(i,k){
        ll x = q.front(); q.pop();
        if (x%10 != 0) q.push(11*x-1);
        q.push(11*x);
        if (x%11 != 9) q.push(11*x+1);
    }
    cout << x << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'x' was not declared in this scope
   23 |     cout << x << endl;
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n; i >= a; i--)
#define pb              push_back
#define lb              lower_bound		// first element >= val(itr) 
#define ub              upper_bound		// first element >  val(itr)
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))	//x can be 0 or -1

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }

#ifndef OJ
	#include"/home/shrey/debug.h"
#endif

const ll inf = 1e18;
const int nax = 1e5 + 5;
ll dp[10][20][10][2];
ll k,n;
vector<ll>digits;

void pre(ll x)
{
	digits.clear();
	while(x)
	{
		digits.pb(x%10);
		x /= 10;
	}
	
	reverse(all(digits));
	n = digits.size();
	
	forn(i,0,10)
	{
		forn(j,0,20)
		{
			forn(k,0,10)
			{
				forn(p,0,2)
				{
					dp[i][j][k][p] = -1;
				}
			}
		}
	}
}

ll count(ll idx,ll len,ll prev,bool allow)
{
	if(prev < 0 || prev>=10)
	{
		return 0;
	}
	
	if(idx == len)
	{
		return 1;
	}
	
	if(dp[idx][len][prev][allow] != -1)
	{
		return dp[idx][len][prev][allow];
	}
	
	ll ans = 0;
	if(allow)
	{
		ans += count(idx+1,len,prev-1,1);
		ans += count(idx+1,len,prev,1);
		ans += count(idx+1,len,prev+1,1);
	}
	else
	{
		forn(i,prev-1,prev+2)
		{
			if(i > digits[idx])
			{
				continue;
			}
			if(i == digits[idx])
			{
				ans += count(idx+1,len,i,0);
			}
			else
			{
				ans += count(idx+1,len,i,1);
			}
		}
	}
	
	return dp[idx][len][prev][allow] = ans;
}

bool ok(ll x)
{
	pre(x);
	
	ll cnt = 0;
	forn(i,1,19)	//length of numbers
	{
		forn(j,1,10)	//first number
		{
			if(i<n)
			{
				cnt += count(1,i,j,1);
			}
			else if(i == n)
			{
				if(j == digits[0])
				{
					cnt += count(1,i,j,0);
				}
				else if(j<digits[0])
				{
					cnt += count(1,i,j,1);
				}
			}
		}
	}
	//cout<<cnt<<endl;
	return cnt>=(k);
}

void SolveTestCase()
{
	cin>>k;
	
	ll lo = -1, hi = 1e18;
	ll ans = 0;
	//bool t = ok(3234566667);
	while(hi-lo>1)
	{
		ll mid = (lo+hi)/2;
		//cout<<mid<<endl;
		if(ok(mid))
		{
			ans = mid;
			hi = mid;
		}
		else
		{
			//ans = mid;
			lo = mid;
		}
	}
	cout<<ans;
}

int main()
{
	speedup_IO;

	int t = 1;
	//cin >> t;
	forn(i,0,t)
	{
		SolveTestCase();
	}

	return 0;
}


Compiler output:
a.cc:24:17: fatal error: /home/shrey/debug.h: No such file or directory
   24 |         #include"/home/shrey/debug.h"
      |                 ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n; i >= a; i--)
#define pb              push_back
#define lb              lower_bound		// first element >= val(itr) 
#define ub              upper_bound		// first element >  val(itr)
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))	//x can be 0 or -1

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }

#ifndef ONLINE_JUDGE
	#include"/home/shrey/debug.h"
#endif

const ll inf = 1e18;
const int nax = 1e5 + 5;
ll dp[10][20][10][2];
ll k,n;
vector<ll>digits;

void pre(ll x)
{
	digits.clear();
	while(x)
	{
		digits.pb(x%10);
		x /= 10;
	}
	
	reverse(all(digits));
	n = digits.size();
	
	forn(i,0,10)
	{
		forn(j,0,20)
		{
			forn(k,0,10)
			{
				forn(p,0,2)
				{
					dp[i][j][k][p] = -1;
				}
			}
		}
	}
}

ll count(ll idx,ll len,ll prev,bool allow)
{
	if(prev < 0 || prev>=10)
	{
		return 0;
	}
	
	if(idx == len)
	{
		return 1;
	}
	
	if(dp[idx][len][prev][allow] != -1)
	{
		return dp[idx][len][prev][allow];
	}
	
	ll ans = 0;
	if(allow)
	{
		ans += count(idx+1,len,prev-1,1);
		ans += count(idx+1,len,prev,1);
		ans += count(idx+1,len,prev+1,1);
	}
	else
	{
		forn(i,prev-1,prev+2)
		{
			if(i > digits[idx])
			{
				continue;
			}
			if(i == digits[idx])
			{
				ans += count(idx+1,len,i,0);
			}
			else
			{
				ans += count(idx+1,len,i,1);
			}
		}
	}
	
	return dp[idx][len][prev][allow] = ans;
}

bool ok(ll x)
{
	pre(x);
	
	ll cnt = 0;
	forn(i,1,19)	//length of numbers
	{
		forn(j,1,10)	//first number
		{
			if(i<n)
			{
				cnt += count(1,i,j,1);
			}
			else if(i == n)
			{
				if(j == digits[0])
				{
					cnt += count(1,i,j,0);
				}
				else if(j<digits[0])
				{
					cnt += count(1,i,j,1);
				}
			}
		}
	}
	//cout<<cnt<<endl;
	return cnt>=(k);
}

void SolveTestCase()
{
	cin>>k;
	
	ll lo = -1, hi = 1e18;
	ll ans = 0;
	//bool t = ok(3234566667);
	while(hi-lo>1)
	{
		ll mid = (lo+hi)/2;
		//cout<<mid<<endl;
		if(ok(mid))
		{
			ans = mid;
			hi = mid;
		}
		else
		{
			//ans = mid;
			lo = mid;
		}
	}
	cout<<ans;
}

int main()
{
	speedup_IO;

	int t = 1;
	//cin >> t;
	forn(i,0,t)
	{
		SolveTestCase();
	}

	return 0;
}


Compiler output:
a.cc:24:17: fatal error: /home/shrey/debug.h: No such file or directory
   24 |         #include"/home/shrey/debug.h"
      |                 ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); i++) 
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = 10000000000000;


//queue
int main() {
    ll k;
    cin >> k;
    queue<ll> q;
    for (int i=1; i<10; i++){
        q.push(i);
    }
    rep(i,k){
        ll v = q.front(); q.pop();
        if (x%10 != 0) q.push(10*x-1);
        q.push(10*x);
        if (x%10 != 9) q.push(10*x-1);
    }
    ll ans = q.front();
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'x' was not declared in this scope
   19 |         if (x%10 != 0) q.push(10*x-1);
      |             ^
a.cc:20:19: error: 'x' was not declared in this scope
   20 |         q.push(10*x);
      |                   ^
Language: C++

// clang-format off
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;



#define ll long long
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef gp_hash_table<int, int> umap;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> oset;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

#define INF 1000000000000000000ll
#define MOD 1000000007
#define EPS 1e-7
#define PI 3.1415926535897932385
// #define PI acos(-1)




mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
inline bool equals(double a, double b) { return fabs(a - b) < 1e-9; }
ll modpow(ll b, ll e, ll mod=MOD) {
    ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans; }

ll dp[20][11];
void find(ll x)
{
    for(ll i=0;i<10;i++)
    {
        dp[1][i]=1;
    }
    for(ll i=0;i<12;i++)
        dp[i][0]=1;
}
void solve() 
{
    ll n;
    cin>>n;
    find(n);
    cout<<"1"<<endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0), cout.precision(15);   //cout<<fixed;
#ifdef bhartiya
    cin.exceptions(cin.failbit);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    // cin>>t;
    for(ll i=1;i<=t;i++)
    {
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}


Compiler output:
a.cc:10:12: error: 'long long long' is too long for GCC
   10 | #define ll long long
      |            ^~~~
a.cc:11:19: note: in expansion of macro 'll'
   11 | typedef long long ll;
      |                   ^~
a.cc:10:17: error: 'long long long' is too long for GCC
   10 | #define ll long long
      |                 ^~~~
a.cc:11:19: note: in expansion of macro 'll'
   11 | typedef long long ll;
      |                   ^~
a.cc:10:17: error: declaration does not declare anything [-fpermissive]
   10 | #define ll long long
      |                 ^~~~
a.cc:11:19: note: in expansion of macro 'll'
   11 | typedef long long ll;
      |                   ^~
Language: C++

#include <stdio.h>

int main(void)
{
	int K,i,j=0,count=9;
	long long a[100005]={1,2,3,4,5,6,7,8,9};
	scanf("%d",&K);
	for(i=0;count<K;i++){
		if(a[i]%10!=0){
			(long long)a[count]=a[i]*10+a[i]%10-1;
			count++;
		}
		(long long)a[count]=a[i]*10+a[i]%10;
		count++;
		if(a[i]%10!=9){
			(long long)a[i]*10+a[i]%10+1;
			count++;
		}
	}
	printf("%lld",a[K-1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: lvalue required as left operand of assignment
   10 |                         (long long)a[count]=a[i]*10+a[i]%10-1;
      |                         ^~~~~~~~~~~~~~~~~~~
a.cc:13:17: error: lvalue required as left operand of assignment
   13 |                 (long long)a[count]=a[i]*10+a[i]%10;
      |                 ^~~~~~~~~~~~~~~~~~~
Language: C++

#include <stdio.h>

int main(void)
{
	int K,i,j=0,count=9;
	long long a[100005]={1,2,3,4,5,6,7,8,9};
	scanf("%d",&K);
	for(i=0;count<K;i++){
		if((long long)a[i]%10!=0){
			(long long)a[count]=a[i]*10+a[i]%10-1;
			count++;
		}
		(long long)a[count]=a[i]*10+a[i]%10;
		count++;
		if((long long)a[i]%10!=9){
			(long long)a[i]*10+a[i]%10+1;
			count++;
		}
	}
	printf("%lld",a[K-1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: lvalue required as left operand of assignment
   10 |                         (long long)a[count]=a[i]*10+a[i]%10-1;
      |                         ^~~~~~~~~~~~~~~~~~~
a.cc:13:17: error: lvalue required as left operand of assignment
   13 |                 (long long)a[count]=a[i]*10+a[i]%10;
      |                 ^~~~~~~~~~~~~~~~~~~
Language: C++

#include <stdio.h>

int main(void)
{
	long long K,i,j=0,count=9,a[100005]={1,2,3,4,5,6,7,8,9};
	scanf("%lld",&K);
	for(i=0;count<K;i++){
		if((long long)a[i]%10!=0){
			(long long)a[count]=a[i]*10+a[i]%10-1;
			count++;
		}
		(long long)a[count]=a[i]*10+a[i]%10;
		count++;
		if((long long)a[i]%10!=9){
			(long long)a[i]*10+a[i]%10+1;
			count++;
		}
	}
	printf("%lld",a[K-1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:25: error: lvalue required as left operand of assignment
    9 |                         (long long)a[count]=a[i]*10+a[i]%10-1;
      |                         ^~~~~~~~~~~~~~~~~~~
a.cc:12:17: error: lvalue required as left operand of assignment
   12 |                 (long long)a[count]=a[i]*10+a[i]%10;
      |                 ^~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>

using namespace std;
using ll = long long;

void expand(ll input, unordered_set<ll> &target) {

    // right most digit: append suitable digit
    ll digit = input % 10;
    if (digit <= 8) target.insert(input * 10 + digit + 1);
    target.insert(input * 10 + digit);
    if (digit >= 1) target.insert(input * 10 + digit - 1);
    ll previousDigit = digit;

    // middle digits: check both sides.
    ll t = 10;

    while (input > t) {
        ll front = input / t;
        ll back = input % t;
        digit = front % 10;
        if (digit != previousDigit) {
            // they are "neighbours", only one of them is allowed in the middle
            target.insert((front * 10 + digit) * t + back);
            target.insert((front * 10 + previousDigit) * t + back);
        } else {
            // they are the same, so any +/- 1 (within bounds) is allowd
            if (digit <= 8) target.insert((front * 10 + digit + 1) * t + back);
            target.insert((front * 10 + digit) * t + back);
            if (digit >= 1) target.insert((front * 10 + digit - 1) * t + back);
        }
        previousDigit = digit;
        t *= 10;
    }

    // left most digit: prefix suitable digit
    ll back = input % t;
    if (digit <= 8) target.insert((digit + 1) * t + back);
    target.insert((digit) * t + back);
    if (digit >= 2) target.insert((digit - 1) * t + back);
}

int main(int argc, char **argv) {
    ll K;
    cin >> K;

    unordered_set<ll> all{1, 2, 3, 4, 5, 6, 7, 8, 9};
    while (all.size() <= K) {
        unordered_set<ll> next;
        for (auto n : all) {
            expand(n, next);
        }
        all.insert(next.begin(), next.end());
    }

    vector<ll> v(all.begin(), all.end());
    sort(v.begin(), v.end());

    cout << v[K - 1] << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:60:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   60 |     sort(v.begin(), v.end());
      |     ^~~~
      |     short
Language: C++

K=int(input())
if K<10:
  print(K);exit()
def dfs(v,n):
  u=[]
  for x in v:
    for d in [-1,0,1]:
      if(0<=x%10+d<=9):
        u.append(x*10+x%10+d)
  if(n+len(u)>=K):
    u.sort()
    print(u[K-n-1])
  else:
    dfs(u,n+len(u))
dfs(range(1,10),9);

Compiler output:
a.cc:1:1: error: 'K' does not name a type
    1 | K=int(input())
      | ^
a.cc:4:1: error: expected constructor, destructor, or type conversion before 'def'
    4 | def dfs(v,n):
      | ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

ll k;
vector<ll> v;

int main(void) {
    cin >> k;
  
    for(ll i=1; i<=9; i++) {
        v.pb(i);
        m[i] = true;
    }

    int i = 0;
    for(int c=0; c<=k+5;c++) {
        ll t = v[i];
        string s = to_string(t);
       
        ll d = s[(int)s.size()-1]-'0';
        for (ll j=d-1; j<=d+1; j++) {
            if (j>=0 && j<=9) {
                v.pb(t*10+j);
            }
        }
        i++;
    }

    ll ans = v[k-1];

    cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:9: error: 'm' was not declared in this scope
   34 |         m[i] = true;
      |         ^
Language: C++

use std::collections::BinaryHeap;
use std::cmp::Reverse;

#[allow(unused_macros)]
macro_rules! getl {
    ( $( $t:ty ),* ) => {
        {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let s = s.trim_end();
            let mut ws = s.split_whitespace();
            ($(ws.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}

#[allow(unused_macros)]
macro_rules! getl_vec {
    ( $t:ty ) => {
        {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let s = s.trim_end();
            s.split_whitespace().map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
        }
    };
}

fn main() {
    let k = getl!(usize);

    let mut q = BinaryHeap::new();
    for i in 1..=9 {
        q.push(Reverse(i as u64));
    }
    let mut count = 0;
    loop {
        count += 1;
        let Reverse(now) = q.pop().unwrap();
        if count == k {
            println!("{}", now);
            return
        }
        let d = now % 10;
        if d != 0 {
            q.push(Reverse(now * 10 + d - 1));
        }
        q.push(Reverse(now * 10 + d));
        if d != 9 {
            q.push(Reverse(now * 10 + d + 1));
        }
    }
}


Compiler output:
a.cc:4:2: error: invalid preprocessing directive #[
    4 | #[allow(unused_macros)]
      |  ^
a.cc:17:2: error: invalid preprocessing directive #[
   17 | #[allow(unused_macros)]
      |  ^
a.cc:33:14: error: too many decimal points in number
   33 |     for i in 1..=9 {
      |              ^~~
a.cc:1:1: error: 'use' does not name a type
    1 | use std::collections::BinaryHeap;
      | ^~~
a.cc:2:1: error: 'use' does not name a type
    2 | use std::cmp::Reverse;
      | ^~~
a.cc:5:1: error: 'macro_rules' does not name a type
    5 | macro_rules! getl {
      | ^~~~~~~~~~~
a.cc:18:1: error: 'macro_rules' does not name a type
   18 | macro_rules! getl_vec {
      | ^~~~~~~~~~~
a.cc:29:1: error: 'fn' does not name a type
   29 | fn main() {
      | ^~
Language: C++

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll k;
  cin >> k;
  queue<ll> q;
  for (int i = 1; i <= 9; ++i) {
    q.push(i);
  }

  rep(i, k) {
    ll x = q.front(); q.pop()
    if (i == k-1) {
      cout << x << endl;
      return 0;
    }

    ll y = x * 10 + (x % 10);
    if (x % 10 != 0) { // e.g. 10 -> 100, 101
      q.push(y-1);
    }
    q.push(y);
    if (x % 10 != 9) { // e.g. 9 -> 98, 99
      q.push(y+1)
    }
  }
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:65:30: error: expected ';' before 'if'
   65 |     ll x = q.front(); q.pop()
      |                              ^
      |                              ;
   66 |     if (i == k-1) {
      |     ~~                        
a.cc:77:18: error: expected ';' before '}' token
   77 |       q.push(y+1)
      |                  ^
      |                  ;
   78 |     }
      |     ~