func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k;   vector<bitset<7>> score;   vector<bitset<7>> bvec(10);   map<unsigned long, int> bmap;   bool flag = false;   long long ans = 0;   vector<string> anss;   int ccc = 0;   int ans_tab[2001][10][2001];   bool valid(vector<bitset<7>>& s, int cur, int dig, int cnt) {     if (ans_tab[cur][dig][cnt] != -1) return ans_tab[cur][dig][cnt];     ccc++;     bool vld = (score[cur] & bvec[dig]).to_ulong() == score[cur].to_ulong();     if (vld) {       int x = __builtin_popcount((char)(score[cur] ^ bvec[dig]).to_ulong());       if (cnt - x >= 0) {         if (cur == n - 1 && cnt - x == 0) {           flag = true;           return ans_tab[cur][dig][cnt] = true;         } else {           for (int j = 9; j >= 0; j--) {             if (ans_tab[cur][dig][cnt] = valid(s, cur + 1, j, cnt - x)) {               return true;             }           }         }       } else {         return ans_tab[cur][dig][cnt] = false;       }     }     return ans_tab[cur][dig][cnt] = false;   }   void solve() {     memset(ans_tab, -1, sizeof(ans_tab));     cin >> n >> k;     string in;     for (int i = 0; i < n; ++i) {       cin >> in;       score.emplace_back(in);     }     bvec = {bitset<7>( 1110111 ), bitset<7>( 0010010 ), bitset<7>( 1011101 ),             bitset<7>( 1011011 ), bitset<7>( 0111010 ), bitset<7>( 1101011 ),             bitset<7>( 1101111 ), bitset<7>( 1010010 ), bitset<7>( 1111111 ),             bitset<7>( 1111011 )};     for (int i = 0; i < (int)bvec.size(); ++i) {       bmap[bvec[i].to_ulong()] = i;     }     string test =   ;     test =   ;     int cc = k;     for (int j = 9; j >= 0; --j) {       valid(score, 0, j, cc);     }     if (flag) {       for (int i = 0; i < n; ++i) {         for (int j = 9; j >= 0; --j) {           bool vld = (score[i] & bvec[j]).to_ulong() >= score[i].to_ulong();           if (vld) {             int x = __builtin_popcount((char)(score[i] ^ bvec[j]).to_ulong());             if (cc - x >= 0) {               if (ans_tab[i][j][cc]) {                 test += to_string(j);                 cc -= x;                 break;               }             }           }         }       }       cout << test << endl;     } else       cout << -1 << endl;   }   int main() { solve(); }   