func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 16;   const int inf = 1e9 + 7;   int f[N][N][N][2][2][2];   struct node {     int x;     int y;     int z;     int i1;     int j1;     int k1;     int p1;     int fi1, fi2;   } pre[N][N][N][2][2][2];   int a[N], b[N], c[N];   char s[N * 5];   inline void Upd(int &x, int y, node &v, int t1, int t2, int t3, int ii, int jj,                   int kk, int pp, int p1, int p2) {     if (x == -1) x = inf;     if (x <= y) return;     x = y;     v.x = t1;     v.y = t2;     v.z = t3;     v.i1 = ii;     v.j1 = jj;     v.k1 = kk;     v.p1 = pp;     v.fi1 = p1;     v.fi2 = p2;   }   int main() {     scanf( %s , s + 1);     int na, nb, nc;     na = nb = nc = 0;     memset(a, -1, sizeof(a));     memset(b, -1, sizeof(b));     memset(c, -1, sizeof(c));     int len = strlen(s + 1);     int ii = 1;     while (s[ii] !=  + ) {       a[++na] = s[ii] -  0 ;       ii++;     }     ii++;     while (s[ii] !=  = ) {       b[++nb] = s[ii] -  0 ;       ii++;     }     ii++;     while (ii <= len) {       c[++nc] = s[ii] -  0 ;       ii++;     }     reverse(a + 1, a + 1 + na);     reverse(b + 1, b + 1 + nb);     reverse(c + 1, c + 1 + nc);     memset(f, -1, sizeof(f));     f[0][0][0][0][0][0] = 0;     for (int i = (0); i <= (na); i++)       for (int j = (0); j <= (nb); j++)         for (int k = (0); k <= (nc); k++)           for (int up = (1); up >= (0); up--)             for (int p1 = (0); p1 <= (1); p1++)               for (int p2 = (0); p2 <= (1); p2++)                 if (f[i][j][k][up][p1][p2] != -1) {                   for (int t1 = (0); t1 <= (9); t1++)                     for (int t2 = (0); t2 <= (9); t2++) {                       int t3 = t1 + t2 + up;                       for (int q1 = (p1); q1 <= (1); q1++)                         for (int q2 = (p2); q2 <= (1); q2++) {                           int nxt = f[i][j][k][up][p1][p2] + 3;                           if (p1 && (i < na || t1)) continue;                           if (p2 && (i < na || t2)) continue;                           if ((i == na && !t1) && q1) nxt--;                           if ((j == nb && !t2) && q2) nxt--;                           Upd(f[i + (t1 == a[i + 1])][j + (t2 == b[j + 1])]                                [k + ((t3 % 10) == c[k + 1])][t3 / 10][q1][q2],                               nxt,                               pre[i + (t1 == a[i + 1])][j + (t2 == b[j + 1])]                                  [k + ((t3 % 10) == c[k + 1])][t3 / 10][q1][q2],                               t1, t2, t3 % 10, i, j, k, up, p1, p2);                         }                     }                 }     int i = na, j = nb, k = nc, p = 0, t1 = 1, t2 = 1;     long long ra = 0, rb = 0, rc = 0;     while (i || j || k) {       ra = 10ll * ra + pre[i][j][k][p][t1][t2].x;       rb = 10ll * rb + pre[i][j][k][p][t1][t2].y;       rc = 10ll * rc + pre[i][j][k][p][t1][t2].z;       int ti = i, tj = j, tk = k, tp = p, n1 = t1, n2 = t2;       i = pre[ti][tj][tk][tp][n1][n2].i1;       j = pre[ti][tj][tk][tp][n1][n2].j1;       k = pre[ti][tj][tk][tp][n1][n2].k1;       p = pre[ti][tj][tk][tp][n1][n2].p1;       t1 = pre[ti][tj][tk][tp][n1][n2].fi1;       t2 = pre[ti][tj][tk][tp][n1][n2].fi2;     }     printf( %lld+%lld=%lld n , ra, rb, rc);     return 0;   }   