Language: C++

#include <bits/stdc++.h>
uisng namespace std;

int get(string const & s, int idx) {
  return s[idx] - '0';
}

int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<vector<int>> dp(2, vector<int>(n));
  dp[0][0] = min(get(s, 0), 10 - get(s, 0) + 1);
  dp[1][0] = min(get(s, 0) + 1, 10 - (get(s,  0) + 1) + 1);
  for (int i = 1 ; i < n; ++i) {
  	dp[0][i] = min(dp[0][i - 1], dp[1][i - 1]) + min(get(s, i), 10 - get(s, i) + 1);
    dp[0][i] = min(dp[0][i - 1], dp[1][i - 1]) + min(get(s, i) + 1, 10 - get(s, i) + 1 - 1);
  }
  cout << min(dp[n - 1][0], dp[n - 1][1]);
  return 0;
}

Compiler output:
a.cc:2:1: error: 'uisng' does not name a type
    2 | uisng namespace std;
      | ^~~~~
a.cc:4:9: error: 'string' was not declared in this scope
    4 | int get(string const & s, int idx) {
      |         ^~~~~~
a.cc:4:9: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:4:27: error: expected primary-expression before 'int'
    4 | int get(string const & s, int idx) {
      |                           ^~~
a.cc:4:34: error: expression list treated as compound expression in initializer [-fpermissive]
    4 | int get(string const & s, int idx) {
      |                                  ^
a.cc: In function 'int main()':
a.cc:9:3: error: 'string' was not declared in this scope
    9 |   string s;
      |   ^~~~~~
a.cc:9:3: note: suggested alternatives:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:10:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   10 |   cin >> s;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:10:10: error: 's' was not declared in this scope
   10 |   cin >> s;
      |          ^
a.cc:12:3: error: 'vector' was not declared in this scope
   12 |   vector<vector<int>> dp(2, vector<int>(n));
      |   ^~~~~~
a.cc:12:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:12:17: error: expected primary-expression before 'int'
   12 |   vector<vector<int>> dp(2, vector<int>(n));
      |                 ^~~
a.cc:13:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   13 |   dp[0][0] = min(get(s, 0), 10 - get(s, 0) + 1);
      |   ^~
      |   dup
a.cc:13:21: error: 'get' cannot be used as a function
   13 |   dp[0][0] = min(get(s, 0), 10 - get(s, 0) + 1);
      |                  ~~~^~~~~~
a.cc:13:37: error: 'get' cannot be used as a function
   13 |   dp[0][0] = min(get(s, 0), 10 - get(s, 0) + 1);
      |                                  ~~~^~~~~~
a.cc:13:14: error: 'min' was not declared in this scope; did you mean 'std::min'?
   13 |   dp[0][0] = min(get(s, 0), 10 - get(s, 0) + 1);
      |              ^~~
      |              std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:14:21: error: 'get' cannot be used as a function
   14 |   dp[1][0] = min(get(s, 0) + 1, 10 - (get(s,  0) + 1) + 1);
      |                  ~~~^~~~~~
a.cc:14:42: error: 'get' cannot be used as a function
   14 |   dp[1][0] = min(get(s, 0) + 1, 10 - (get(s,  0) + 1) + 1);
      |                                       ~~~^~~~~~~
a.cc:16:61: error: 'get' cannot be used as a function
   16 |         dp[0][i] = min(dp[0][i - 1], dp[1][i - 1]) + min(get(s, i), 10 - get(s, i) + 1);
      |                                                          ~~~^~~~~~
a.cc:16:77: error: 'get' cannot be used as a function
   16 |         dp[0][i] = min(dp[0][i - 1], dp[1][i - 1]) + min(get(s, i), 10 - get(s, i) + 1);
      |                                                                          ~~~^~~~~~
a.cc:17:57: error: 'get' cannot be used as a function
   17 |     dp[0][i] = min(dp[0][i - 1], dp[1][i - 1]) + min(get(s, i) + 1, 10 - get(s, i) + 1 - 1);
      |                                                      ~~~^~~~~~
a.cc:17:77: error: 'get' cannot be used as a function
   17 |     dp[0][i] = min(dp[0][i - 1], dp[1][i - 1]) + min(get(s, i) + 1, 10 - get(s, i) + 1 - 1);
      |                                                                          ~~~^~~~~~
a.cc:19:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   19 |   cout << min(dp[n - 1][0], dp[n - 1][1]);
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~