Language: C++

#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
ll dp[ohara][3][3];  // i桁目まで、j=繰り上がり、

int main(void) {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);

  cin >> s;
  //逆から見る
  tmp = s[Size(s) - 1] - '0';
  dp[Size(s) - 1][0] = tmp;
  dp[Size(s) - 1][1] = tmp;
  rrrep(i, Size(s) - 2, 0) {
    ll cost;
    tmp = s[i] - '0';
    // cost計算はinputする値全探索する
    cost = min(dp[i + 1][0] + tmp, dp[i + 1][1] + tmp + 1);
    dp[i][0] = min(dp[i][0], cost);
    cost = min(dp[i + 1][0] + tmp, dp[i + 1][1] + tmp + 1);
    dp[i][1] = min(dp[i][0], cost);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:22: error: incompatible types in assignment of 'll' {aka 'long long int'} to 'll [3]' {aka 'long long int [3]'}
   73 |   dp[Size(s) - 1][0] = tmp;
      |   ~~~~~~~~~~~~~~~~~~~^~~~~
a.cc:74:22: error: incompatible types in assignment of 'll' {aka 'long long int'} to 'll [3]' {aka 'long long int [3]'}
   74 |   dp[Size(s) - 1][1] = tmp;
      |   ~~~~~~~~~~~~~~~~~~~^~~~~
a.cc:79:15: error: invalid conversion from 'long long int*' to 'll' {aka 'long long int'} [-fpermissive]
   79 |     cost = min(dp[i + 1][0] + tmp, dp[i + 1][1] + tmp + 1);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |               |
      |               long long int*
a.cc:80:19: error: no matching function for call to 'min(ll [3], ll&)'
   80 |     dp[i][0] = min(dp[i][0], cost);
      |                ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:80:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int [3]' and 'll' {aka 'long long int'})
   80 |     dp[i][0] = min(dp[i][0], cost);
      |                ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:80:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'll*' {aka 'long long int*'}
   80 |     dp[i][0] = min(dp[i][0], cost);
      |                ~~~^~~~~~~~~~~~~~~~
a.cc:81:15: error: invalid conversion from 'long long int*' to 'll' {aka 'long long int'} [-fpermissive]
   81 |     cost = min(dp[i + 1][0] + tmp, dp[i + 1][1] + tmp + 1);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |               |
      |               long long int*
a.cc:82:19: error: no matching function for call to 'min(ll [3], ll&)'
   82 |     dp[i][1] = min(dp[i][0], cost);
      |                ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:82:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int [3]' and 'll' {aka 'long long int'})
   82 |     dp[i][1] = min(dp[i][0], cost);
      |                ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:82:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'll*' {aka 'long long int*'}
   82 |     dp[i][1] = min(dp[i][0], cost);
      |                ~~~^~~~~~~~~~~~~~~~