func_code_string: #include <bits/stdc++.h>   using namespace std;   int dfs(long long int n, int i, long long int b[]) {     int ans = i * (n / b[i]);     n = n % b[i];     if (n == 0)       return ans;     else       return (ans + min(i + dfs(b[i] - n, i - 1, b), dfs(n, i - 1, b)));   }   int main() {     long long int a[17], i, n;     a[1] = 1;     for (i = 2; i < 17; i++) a[i] = 10 * a[i - 1] + 1;     cin >> n;     int j = dfs(n, 16, a);     cout << j;   }   