func_code_string: #include <bits/stdc++.h>   using namespace std;   const double eps = 1e-10;   const double PI = 3.1415926535897932;   const int dir[8][2] = {-1, -1, -1, 0, -1, 1, 0, -1, 0, 1, 1, -1, 1, 0, 1, 1};   const int maxn = 2e5 + 5;   const int MOD = 998244353;   int n, m;   long long A[maxn], invA[maxn];   int w[maxn];   bool vis[maxn];   bool del[maxn];   int B[maxn];   int pos[maxn];   int pre[maxn], nex[maxn];   bool judge(int x) {     if (x == 0 || x == n + 1) return 0;     if (vis[w[x]]) return 0;     return 1;   }   int main() {     int T;     scanf( %d , &T);     while (T--) {       scanf( %d%d , &n, &m);       for (int i = 1; i <= n; i++) {         del[i] = vis[i] = false;         pre[i] = i - 1;         nex[i] = i + 1;       }       for (int i = 1; i <= n; i++) scanf( %d , &w[i]), pos[w[i]] = i;       for (int i = 1; i <= m; i++) {         scanf( %d , &B[i]);         vis[B[i]] = true;       }       long long ans = 1;       for (int i = 1; i <= m; i++) {         int x = pos[B[i]];         int cnt = 0;         cnt += judge(pre[x]);         cnt += judge(nex[x]);         ans = ans * cnt % MOD;         vis[w[x]] = false;         nex[pre[x]] = nex[x];         pre[nex[x]] = pre[x];       }       printf( %lld n , ans);     }     return 0;   }   