func_code_string: #include <bits/stdc++.h>   int n, K, F[3005][3005];   char s[3005][15],       T[10][10] = { 1110111 ,  0010010 ,  1011101 ,  1011011 ,  0111010 ,                     1101011 ,  1101111 ,  1010010 ,  1111111 ,  1111011 };   int read() {     char c = getchar();     int ans = 0;     while (c <  0  || c >  9 ) c = getchar();     while (c >=  0  && c <=  9 ) ans = ans * 10 + c -  0 , c = getchar();     return ans;   }   void Write(int x) {     if (x < 10)       putchar(x ^ 48);     else       Write(x / 10), putchar((x % 10) ^ 48);     return;   }   int Count(int id, int x) {     int k = 0;     for (register int i = 0; i < 7; i++) {       if (s[id][i] ==  1  && T[x][i] ==  0 ) return -1;       if (s[id][i] ==  0  && T[x][i] ==  1 ) ++k;     }     return k;   }   int main() {     n = read(), K = read();     F[n + 1][0] = 1;     for (register int i = 1; i <= n; i++) scanf( %s , s[i]);     for (register int i = n; i; i--)       for (register int j = 0, now; j < 10; j++) {         if ((now = Count(i, j)) == -1) continue;         for (register int k = K; k >= now; k--) F[i][k] |= F[i + 1][k - now];       }     if (!F[1][K]) {       putchar( - ), putchar( 1 );       return 0;     }     for (register int i = 1; i <= n; i++)       for (register int j = 9, now; j >= 0; j--) {         if ((now = Count(i, j)) == -1) continue;         if (K >= now && F[i + 1][K - now]) {           putchar( 0  + j), K -= now;           break;         }       }     return 0;   }   