func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int x;     cin >> x;     vector<int> used(1000000, 0);     vector<int> len(1000000, 5);     queue<int> q;     q.push(x);     used[x] = 1;     len[x] = 0;     while (!q.empty()) {       int v = q.front(), v1 = v;       q.pop();       vector<int> res(6);       for (int i = 5; i >= 0; i--) {         res[i] = v1 % 10;         v1 /= 10;       }       if (res[0] + res[1] + res[2] == res[3] + res[4] + res[5]) {         cout << len[v];         return 0;       }       for (int i = 0; i < 6; ++i) {         for (int j = 0; j <= 9; ++j) {           if (j != res[i]) {             int to = 0;             for (int i1 = 0; i1 < 6; ++i1) {               if (i1 != i)                 to = to * 10 + res[i1];               else                 to = to * 10 + j;             }             if (used[to] == 0) {               used[to] = 1;               q.push(to);               len[to] = len[v] + 1;             }           }         }       }     }     return 0;   }   