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.insert(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:24: error: no matching function for call to 'std::vector<int>::insert(int&)'
   27 |             nums.insert(num);
      |             ~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Alloc = std::allocator<int>]'
 1484 |         insert(const_iterator __position, _InputIterator __first,
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1484:9: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/vector:72:
/usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]'
  133 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:133:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]'
 1395 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
 1413 |       insert(const_iterator __position, initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; size_type = long unsigned int; value_type = int]'
 1439 |       insert(const_iterator __position, size_type __n, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note:   candidate expects 3 arguments, 1 provided
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)
      |                                                                                                  ^~~