func_code_string: #include <bits/stdc++.h>   using namespace std;   long long a, b, p, q, ay, by, tx, g, l, ty, x, y, n = 15, d, m, tot, last, lst2;   map<int, int> wow;   long long shob[104];   vector<int> all;   char c;   int setbit(int n, int pos) { return n | (1 << (pos)); }   int isbit(int n, int pos) { return n & (1 << (pos)); }   int how(int a, long long &x) {     int ret = 0, boom = 1, wow = 0;     while (a > 0) {       ret++;       int md = a % 7;       wow = boom * md + wow;       boom *= 10;       a /= 7;     }     x = wow;     return ret;   }   int Bboom(int n, int len, int mask, int A) {     if (len > b) {       return 0;     }     int now = n, ans = 0;     for (int i = 0; i < 7; i++) {       if (isbit(mask, i) == 0) {         now = n * 10 + i;         if (len == b && now <= y) {           ans++;         } else if (len < b && now <= y && isbit(mask, i) == 0) {           ans += Bboom(now, len + 1, setbit(mask, i), A);         }       }     }     return ans;   }   int Aboom(int n, int len, int mask) {     if (len > a) {       return 0;     }     int now = n, ans = 0;     for (int i = 0; i < 7; i++) {       if (isbit(mask, i) == 0) {         now = n * 10 + i;         if (len == a && now <= x) {           ans += Bboom(0, 1, setbit(mask, i), now);         } else if (len < a && now <= x) {           ans += Aboom(now, len + 1, setbit(mask, i));         }       }     }     return ans;   }   int main() {     cin >> n >> m;     n--;     m--;     a = max(how(n, x), 1);     b = max(how(m, y), 1);     if (a + b > 7) {       cout << 0 << endl;     } else {       n = a + b;       p = x;       q = y;       cout << Aboom(0, 1, 0);     }   }   