Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

u64 dp[10][30001];

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

    int N;
    string s;
    cin >> N >> s;

    string s1 = s[0] + s[1] + s[2], s2 = s[0] + s[1] + s[3], s3 = s[0] + s[2] + s[3], s4 = s[1] + s[2] + s[3];
    ++dp[s1[3] - '0'][4];
    if (s1 != s2) ++dp[s2[3] - '0'][4];
    if (s1 != s3 && s2 != s3) ++dp[s2[3] - '0'][4];
    if (s1 != s4 && s2 != s4 && s3 != s4) ++dp[s2[3] - '0'][4];

    u64 ans = 0;
    for (i == 5; i <= N; ++i)
    {
        rep (j, 10) ans += 2 * dp[j][i - 1];
        ans -=  dp[s[i  - 1] - '0'][i - 1];
        dp[s[i - 1] - '0'][i] = ans;
    }

    cout << dp[s[N - 1] - '0'][N] << "\n";
    return 0;
}



Compiler output:
a.cc:18:9: error: 'uint64_t' does not name a type
   18 | typedef uint64_t u64;
      |         ^~~~~~~~
a.cc:15:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   14 | #include <cstring>
  +++ |+#include <cstdint>
   15 | 
a.cc:20:9: error: 'uint32_t' does not name a type
   20 | typedef uint32_t u32;
      |         ^~~~~~~~
a.cc:20:9: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:23:16: error: 'u32' was not declared in this scope; did you mean 's32'?
   23 | typedef vector<u32> vu32;
      |                ^~~
      |                s32
a.cc:23:19: error: template argument 1 is invalid
   23 | typedef vector<u32> vu32;
      |                   ^
a.cc:23:19: error: template argument 2 is invalid
a.cc:25:16: error: 'u64' was not declared in this scope; did you mean 's64'?
   25 | typedef vector<u64> vu64;
      |                ^~~
      |                s64
a.cc:25:19: error: template argument 1 is invalid
   25 | typedef vector<u64> vu64;
      |                   ^
a.cc:25:19: error: template argument 2 is invalid
a.cc:37:1: error: 'u64' does not name a type; did you mean 'vu64'?
   37 | u64 dp[10][30001];
      | ^~~
      | vu64
a.cc: In function 'int main()':
a.cc:48:29: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   48 |     string s1 = s[0] + s[1] + s[2], s2 = s[0] + s[1] + s[3], s3 = s[0] + s[2] + s[3], s4 = s[1] + s[2] + s[3];
a.cc:48:54: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   48 |     string s1 = s[0] + s[1] + s[2], s2 = s[0] + s[1] + s[3], s3 = s[0] + s[2] + s[3], s4 = s[1] + s[2] + s[3];
a.cc:48:79: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   48 |     string s1 = s[0] + s[1] + s[2], s2 = s[0] + s[1] + s[3], s3 = s[0] + s[2] + s[3], s4 = s[1] + s[2] + s[3];
a.cc:48:104: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   48 |     string s1 = s[0] + s[1] + s[2], s2 = s[0] + s[1] + s[3], s3 = s[0] + s[2] + s[3], s4 = s[1] + s[2] + s[3];
a.cc:49:7: error: 'dp' was not declared in this scope
   49 |     ++dp[s1[3] - '0'][4];
      |       ^~
a.cc:54:5: error: 'u64' was not declared in this scope; did you mean 'vu64'?
   54 |     u64 ans = 0;
      |     ^~~
      |     vu64
a.cc:55:10: error: 'i' was not declared in this scope
   55 |     for (i == 5; i <= N; ++i)
      |          ^
a.cc:57:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   57 |         rep (j, 10) ans += 2 * dp[j][i - 1];
      |                     ^~~
      |                     abs
a.cc:58:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   58 |         ans -=  dp[s[i  - 1] - '0'][i - 1];
      |         ^~~
      |         abs