func_code_string: #include <bits/stdc++.h>   int ff[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880};   long long dp[16][9 + 1];   void solve(int *bb, int l) {     int k, d, i, e, j;     memset(dp, 0, sizeof dp);     k = ((l) < (bb[0]) ? (l) : (bb[0]));     for (i = 0; i <= k; i++) dp[0][i] = 1;     for (d = 0; d < 16 - 1; d++)       for (i = 0; i < l; i++)         if (dp[d][i] > 0)           for (e = d + 1; e < 16; e++) {             k = ((l) < (i + bb[e]) ? (l) : (i + bb[e]));             for (j = i + 1; j <= k; j++)               dp[e][j] += dp[d][i] * (ff[j] / ff[i] / ff[j - i]);           }   }   int main() {     static int bb[16];     static char cc[9 + 1];     int k, t, l, i, d, d_;     long long cnt;     scanf( %d%d , &k, &t);     for (i = 0; i < 16; i++) bb[i] = t;     l = 9;     solve(bb, l);     for (i = 1; i <= l; i++) {       cnt = 0;       for (d = 0; d < 16; d++) cnt += dp[d][i];       cnt = cnt / 16 * 15;       if (k > cnt)         k -= cnt;       else {         l = i;         break;       }     }     for (i = 1; i <= l; i++)       for (d_ = i == 1 ? 1 : 0; d_ < 16; d_++)         if (bb[d_] > 0) {           bb[d_]--;           solve(bb, l - i);           cnt = 0;           for (d = 0; d < 16; d++) cnt += dp[d][l - i];           if (k > cnt)             k -= cnt;           else {             cc[i - 1] = d_ < 10 ?  0  + d_ :  a  + d_ - 10;             break;           }           bb[d_]++;         }     printf( %s n , cc);     return 0;   }   