Language: C++

#include <cstdio>
#include <utility>
using namespace std;

using i64 = long long;
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

#define REP(i, stop) for (int i = 0, i##_len = stop; i < i##_len; ++i)

i64 D[13];
i64 E[13];
char S[100001];
const i64 M = 1000000007;
signed main() {
	D[0] = 1;
	scanf("%s", S);
	i64 i = 0;
	while(true) {
		char c = S[i];
		if (c == 0) {
			break;
		} else if (c == '?') {
			/*
			REP(r, 13) {
				i64 s = 0;
				REP(j, 10) {
					s += D[(j - r + 13) * 9 % 13];
				}
				E[r] = s % M;
			}
			*/
			i64 s = D[0] + D[1] + D[2] + D[3] + D[4] + D[5] + D[6] + D[7] + D[8] + D[9] + D[10] + D[11] + D[12];
			E[0] = (s - D[4] - D[8] - D[12]) % M;
			E[1] = (s - D[3] - D[8] - D[12]) % M;
			E[2] = (s - D[3] - D[7] - D[12]) % M;
			E[3] = (s - D[3] - D[7] - D[11]) % M;
			E[4] = (s - D[2] - D[7] - D[11]) % M;
			E[5] = (s - D[2] - D[6] - D[11]) % M;
			E[6] = (s - D[2] - D[6] - D[10]) % M;
			E[7] = (s - D[1] - D[6] - D[10]) % M;
			E[8] = (s - D[1] - D[5] - D[10]) % M;
			E[9] = (s - D[1] - D[5] - D[9]) % M;
			E[10] = (s - D[0] - D[5] - D[9]) % M;
			E[11] = (s - D[0] - D[4] - D[9]) % M;
			E[12] = (s - D[0] - D[4] - D[8]) % M;
		} else {
			i64 d = c - '0';
			/*
			REP(r, 13) {
				E[r] = D[(d - r + 13) * 9 % 13];
			}
			*/
			E[d] = D[0];
			E[(d + 10) % 13] = D[1];
			E[(d + 7) % 13] = D[2];
			E[(d + 4) % 13] = D[3];
			E[(d + 1) % 13] = D[4];
			E[(d + 11) % 13] = D[5];
			E[(d + 8) % 13] = D[6];
			E[(d + 5) % 13] = D[7];
			E[(d + 2) % 13] = D[8];
			E[(d + 12) % 13] = D[9];
			E[(d + 9) % 13] = D[10];
			E[(d + 6) % 13] = D[11];
			E[(d + 3) % 13] = D[12];
		}
		swap(D, E);
		++i;
	}
	printf("%d", D[5]);
}


Compiler output:
a.cc: In constructor 'aaa::aaa()':
a.cc:8:17: error: 'cin' was not declared in this scope
    8 |                 cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
      |                 ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <utility>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:8:35: error: 'ios' has not been declared
    8 |                 cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
      |                                   ^~~
a.cc:8:64: error: 'cout' was not declared in this scope
    8 |                 cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
      |                                                                ^~~~
a.cc:8:64: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:72: error: 'fixed' was not declared in this scope
    8 |                 cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
      |                                                                        ^~~~~
a.cc:3:1: note: 'std::fixed' is defined in header '<ios>'; this is probably fixable by adding '#include <ios>'
    2 | #include <utility>
  +++ |+#include <ios>
    3 | using namespace std;
a.cc:8:81: error: 'setprecision' was not declared in this scope
    8 |                 cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
      |                                                                                 ^~~~~~~~~~~~
a.cc:3:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    2 | #include <utility>
  +++ |+#include <iomanip>
    3 | using namespace std;