#include <bits/stdc++.h>
using namespace std;
const int B = 13, N = 1<<20, SZ = pow(3, B);
int Q, dp[SZ], ans[N], id[N];
string A, inp;
__int8 x[N], y[N];
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> Q >> Q >> A;
A.resize(N, '0');
for(int i = 0; i < Q; ++i) {
cin >> inp;
reverse(begin(inp), end(inp));
inp.resize(20, '0');
for(int k = 0, p = 1; k < B; ++k, p *= 3)
id[i] += p * ((48 < inp[k]) + (62 < inp[k]));
for(int k = 0; k < 20-B; ++k) {
if(inp[k+B] != '?') y[i] |= 1<<k;
if(inp[k+B] == '1') x[i] |= 1<<k;
}
}
for(int s = 0; s < (1<<(20-B)); ++s) {
memset(dp, 0, sizeof dp);
for(int i = 0; i < (1<<B); ++i) {
int j = 0;
for(int k = 0, p = 1; k < B; ++k, p *= 3)
if(i & (1<<k)) j += p;
dp[j] += A[i | (s << B)] - '0';
}
for(int i = 1; i < SZ; ++i) {
int j = -1, pw = 1;
for(int k = 0, p = i; k < B; ++k, p /= 3, pw *= 3)
if((p % 3) > 1) j = k, k = B;
if(j >= 0)
pw /= 3, dp[i] = dp[i - pw] + dp[i - 2 * pw];
}
for(int i = 0; i < Q; ++i)
if(!((x[i] ^ s) & y[i]))
ans[i] += dp[id[i]];
}
for(int i = 0; i < Q; ++i)
cout << ans[i] << '\n';
}
Compilation message
snake_escaping.cpp:8:1: error: '__int8' does not name a type; did you mean 'u_int'?
8 | __int8 x[N], y[N];
| ^~~~~~
| u_int
snake_escaping.cpp: In function 'int main()':
snake_escaping.cpp:24:24: error: 'y' was not declared in this scope
24 | if(inp[k+B] != '?') y[i] |= 1<<k;
| ^
snake_escaping.cpp:25:24: error: 'x' was not declared in this scope
25 | if(inp[k+B] == '1') x[i] |= 1<<k;
| ^
snake_escaping.cpp:51:10: error: 'x' was not declared in this scope
51 | if(!((x[i] ^ s) & y[i]))
| ^
snake_escaping.cpp:51:22: error: 'y' was not declared in this scope
51 | if(!((x[i] ^ s) & y[i]))
| ^