Language: C++

#include <bits/stdc++.h>

using namespace std;


const int MAX_K = 100000;


int K;
int count = 9;
int num = 10;

vector<int> nums = {1, 2,3,4, 5, 6, 7, 8, 9};

int solve()
{
    while(true)
    {   if(count  == K ) return nums[K];

        int 1_dig = num  % 10;
        int 10_dig = num % 100;
        int 100_dig = num % 1000;
        int 1000_dig = num % 10000;
        int 10000_dig = num % 100000;
        if(abs(1_dig-10_dig) <= 1 && abs(10_dig-100_dig) <= 1&& abs(100_dig-1000_dig) <= 1 && && abs(1000_dig-10000_dig) <= 1)
        {
            nums.push(num);
            count ++;
        }
        num++;


    }
    
}

int main()
{
    cin >> K;
    
    cout << solve() << endl;


    return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:18:12: error: reference to 'count' is ambiguous
   18 |     {   if(count  == K ) return nums[K];
      |            ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:10:5: note:                 'int count'
   10 | int count = 9;
      |     ^~~~~
a.cc:20:13: error: expected unqualified-id before numeric constant
   20 |         int 1_dig = num  % 10;
      |             ^~~~~
a.cc:21:13: error: expected unqualified-id before numeric constant
   21 |         int 10_dig = num % 100;
      |             ^~~~~~
a.cc:22:13: error: expected unqualified-id before numeric constant
   22 |         int 100_dig = num % 1000;
      |             ^~~~~~~
a.cc:23:13: error: expected unqualified-id before numeric constant
   23 |         int 1000_dig = num % 10000;
      |             ^~~~~~~~
a.cc:24:13: error: expected unqualified-id before numeric constant
   24 |         int 10000_dig = num % 100000;
      |             ^~~~~~~~~
a.cc:25:16: error: unable to find numeric literal operator 'operator""_dig'
   25 |         if(abs(1_dig-10_dig) <= 1 && abs(10_dig-100_dig) <= 1&& abs(100_dig-1000_dig) <= 1 && && abs(1000_dig-10000_dig) <= 1)
      |                ^~~~~
a.cc:25:22: error: unable to find numeric literal operator 'operator""_dig'
   25 |         if(abs(1_dig-10_dig) <= 1 && abs(10_dig-100_dig) <= 1&& abs(100_dig-1000_dig) <= 1 && && abs(1000_dig-10000_dig) <= 1)
      |                      ^~~~~~
a.cc:25:42: error: unable to find numeric literal operator 'operator""_dig'
   25 |         if(abs(1_dig-10_dig) <= 1 && abs(10_dig-100_dig) <= 1&& abs(100_dig-1000_dig) <= 1 && && abs(1000_dig-10000_dig) <= 1)
      |                                          ^~~~~~
a.cc:25:49: error: unable to find numeric literal operator 'operator""_dig'
   25 |         if(abs(1_dig-10_dig) <= 1 && abs(10_dig-100_dig) <= 1&& abs(100_dig-1000_dig) <= 1 && && abs(1000_dig-10000_dig) <= 1)
      |                                                 ^~~~~~~
a.cc:25:69: error: unable to find numeric literal operator 'operator""_dig'
   25 |         if(abs(1_dig-10_dig) <= 1 && abs(10_dig-100_dig) <= 1&& abs(100_dig-1000_dig) <= 1 && && abs(1000_dig-10000_dig) <= 1)
      |                                                                     ^~~~~~~
a.cc:25:77: error: unable to find numeric literal operator 'operator""_dig'
   25 |         if(abs(1_dig-10_dig) <= 1 && abs(10_dig-100_dig) <= 1&& abs(100_dig-1000_dig) <= 1 && && abs(1000_dig-10000_dig) <= 1)
      |                                                                             ^~~~~~~~
a.cc:25:101: error: expected ')' before '(' token
   25 |         if(abs(1_dig-10_dig) <= 1 && abs(10_dig-100_dig) <= 1&& abs(100_dig-1000_dig) <= 1 && && abs(1000_dig-10000_dig) <= 1)
      |           ~                                                                                         ^
      |                                                                                                     )
a.cc:27:18: error: 'class std::vector<int>' has no member named 'push'
   27 |             nums.push(num);
      |                  ^~~~
a.cc:28:13: error: reference to 'count' is ambiguous
   28 |             count ++;
      |             ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:10:5: note:                 'int count'
   10 | int count = 9;
      |     ^~~~~
a.cc:25:98: error: label 'abs' used but not defined
   25 |         if(abs(1_dig-10_dig) <= 1 && abs(10_dig-100_dig) <= 1&& abs(100_dig-1000_dig) <= 1 && && abs(1000_dig-10000_dig) <= 1)
      |                                                                                                  ^~~