func_code_string: #include <bits/stdc++.h>   using namespace std;   long long pw[16], t[20], na[30], ma[30], ta[30], per[30];   vector<long long> rem;   void calc_pw() {     long long i;     pw[0] = 1;     for (i = 1; i <= 11; i++) pw[i] = 7 * pw[i - 1];   }   long long conv(long long num) {     long long ret = 0, temp;     temp = num;     while (temp > 0) {       t[ret++] = temp % 7;       temp /= 7;     }     return ret;   }   int main() {     long long i, j, n, m, temp, mx_n, mx_m, cur, ans = 0, idx, k, x, t1 = 0,                                                  t2 = 0;     cin >> n >> m;     calc_pw();     for (i = 0; i < 7; i++) rem.push_back(i);     mx_n = max(1LL, conv(n - 1));     mx_m = max(1LL, conv(m - 1));     for (k = 0; k < (1 << rem.size()); k++) {       temp = 0;       for (x = 0; x < rem.size(); x++)         if (k & (1 << x)) temp++;       if (temp == mx_m + mx_n && temp > 0) {         idx = 0;         for (j = 0; j < rem.size(); j++)           if (k & (1 << j)) per[idx++] = rem[j];         do {           idx = 0;           t1 = 0;           t2 = 0;           for (j = mx_m - 1; j >= 0; j--) t1 += pw[j] * per[j];           for (j = mx_m; j < mx_m + mx_n; j++) t2 += pw[idx++] * per[j];           if (t1 < m && t2 < n && (t1 != 0 || t2 != 0)) ans++;         } while (next_permutation(per, per + mx_m + mx_n));       }     }     cout << ans;     return 0;   }   