For this Question: Jerry is having yet another existential crisis. In order to keep him occupied Rick gives him a task.

F(N, K) = The position (1-indexed) of K when numbers from 1 to N are lexicographically sorted.
For example if N = 11, the lexicographically sorted order will be:
1, 10, 11, 2, 3, 4, 5, 6, 7, 8, 9. So F(11, 2) = 4, as 2 is in the 4th position.

Given K and M, find the smallest N such that F(N, K) = M.Input contains two integers K and M.

Constraints:
1 <= K, M <= 1000000000Output smallest N such that F(N, K)=M and if no such N exists print 0.Sample Input 1
2 4

Sample Output 1
11

Sample Input 2
2 1

Sample Output 2
0, I have written this Solution Code: #pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
// #define ll int
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountll
#define m_p make_pair
#define infi 1e18+1
#define eps 0.000000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
//////////////
auto clk=clock();
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define sz(x) ((long long)x.size())
#define int long long  
#define f80 __float128
#define pii pair<int,int>
/////////////
 
int d[15];
int dr[15];
int dp[15];
int count(int x, int n)
{
    int res = 1;
    int b = 10;
    
    while(x * b <= n)
    {
        if(x * b + b - 1 <= n)
            res = res + b;
        else
        {
            res = res + n - x * b + 1;
            break;
        }
        b = b * 10;
    }
    return res;
}
int dfs(int k, int n)
{
    if(k == 1)
    {
		int res = 0;
		for(int i = 1; i < d[0]; ++i)
			res += count(i, n);
		return res;
    }
    int res = dfs(k - 1, n);
    int x = 0;
    if(k >= 2)
        x = dr[k - 2];
    for(int i = 0; i < d[k - 1]; ++i)
        res += count(x * 10 + i, n);
    res++;
    return res;
}
int slam(int x)
{
    int r = 0;
    while(x)
    {
        r++;
        x = x / 10;
    }
    return r;
}
signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
    int k, m, res, ans, mid, tm;
    cin>>m>>k;
	int l = slam(m);
	int tl = l;
	tm = m;
	while(m)
	{
		d[--l] = m % 10;
		m = m / 10;
	}
	l = tl;
	dr[0] = d[0];
	for(int i = 1; i < l; ++i)
		dr[i] = dr[i - 1] * 10 + d[i];
	int ll = tm > k ? tm : k, rr = 1;
	rr <<= 60;
	ans = 0;
	while(ll <= rr)
	{
		mid = (ll + rr) >> 1;
		
		if(mid < tm)
		{
			ll = mid + 1;
			continue;
		}
		res = dfs(l, mid);
		if(res+1 >= k)
		{
			if(res + 1 == k) ans = mid;
			rr = mid - 1;
		}
		else ll = mid + 1;
	}
	cout<<ans<<endl;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?