func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int e, d, c, x, aux, aux2;   priority_queue<pair<long long int, long long int> > q;   void res(long long int n) {     long long int k = n;     e = 0;     d = 1;     while (k > 0) {       d = d * 10 + 1;       e++;       k = k / 10;     }     c = (d - 1) / 10;     if (c > n) {       d = c;       c = (d - 1) / 10;       e--;     }   }   void dis(long long v) {     q.push(make_pair(0, v));     aux = q.top().second;     while (aux != 0) {       res(aux);       aux2 = q.top().first;       q.pop();       if (d - aux < aux) q.push(make_pair(aux2 - (e + 1), d - aux));       q.push(make_pair(aux2 - e, aux - c));       aux = q.top().second;     }     x = q.top().first;   }   int main() {     long long int a;     cin >> a;     dis(a);     cout << x * -1 << endl;     return 0;   }   