Language: C++

#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#include <tuple>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
#define MOD 1000000007
#define INF 1000000000
#define LLINF 4000000000000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf_s("%d", &f); in(r...); }
template<typename... R> void input(double& f, R&... r) { scanf_s("%lf", &f); in(r...); }
template<typename... R> void input(long long& f, R&... r) { scanf_s("%lld", &f); in(r...); }
template<typename... R> void input(char& f, R&... r) { scanf_s("%c", &f); in(r...); }
template<typename... R> void input(string& f, R&... r) { cin >> f; in(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())in(f[i]); in(r...); }
#pragma endregion

// LCS 最長共通部分列
template<typename T>
ll LCS(const vector<T> &A, const vector<T> &B) {
    int n = A.size(), m = B.size();
    vector<vector<ll>> lcs(n + 1, vector <ll>(m + 1));
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= m; j++)
        {
            if (i == 0 || j == 0) {
                lcs[i][j] = 1;
            }
            else if (A[i - 1] == B[j - 1]) {
                lcs[i][j] = (lcs[i][j - 1] + lcs[i - 1][j]) % MOD;
            }
            else {
                lcs[i][j] = (lcs[i][j - 1] + lcs[i - 1][j] + MOD - lcs[i - 1][j - 1]) % MOD;
            }
        }
    }
    return lcs[n][m];
}

int main() {
    int N, M; cin >> N >> M;
    vector<ll> S(N);
    vector<ll> T(M);
    input(S, T);
    cout << LCS(S, T) << endl;
    getchar(); getchar();
}

Compiler output:
a.cc: In function 'void input(int&, R& ...)':
a.cc:27:55: error: there are no arguments to 'scanf_s' that depend on a template parameter, so a declaration of 'scanf_s' must be available [-fpermissive]
   27 | template<typename... R> void input(int& f, R&... r) { scanf_s("%d", &f); in(r...); }
      |                                                       ^~~~~~~
a.cc:27:55: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc: In function 'void input(double&, R& ...)':
a.cc:28:58: error: there are no arguments to 'scanf_s' that depend on a template parameter, so a declaration of 'scanf_s' must be available [-fpermissive]
   28 | template<typename... R> void input(double& f, R&... r) { scanf_s("%lf", &f); in(r...); }
      |                                                          ^~~~~~~
a.cc: In function 'void input(long long int&, R& ...)':
a.cc:29:61: error: there are no arguments to 'scanf_s' that depend on a template parameter, so a declaration of 'scanf_s' must be available [-fpermissive]
   29 | template<typename... R> void input(long long& f, R&... r) { scanf_s("%lld", &f); in(r...); }
      |                                                             ^~~~~~~
a.cc: In function 'void input(char&, R& ...)':
a.cc:30:56: error: there are no arguments to 'scanf_s' that depend on a template parameter, so a declaration of 'scanf_s' must be available [-fpermissive]
   30 | template<typename... R> void input(char& f, R&... r) { scanf_s("%c", &f); in(r...); }
      |                                                        ^~~~~~~
a.cc: In instantiation of 'void input(std::vector<_Tp>&, R& ...) [with T = long long int; R = {std::vector<long long int, std::allocator<long long int> >}]':
a.cc:62:10:   required from here
   62 |     input(S, T);
      |     ~~~~~^~~~~~
a.cc:32:91: error: 'in' was not declared in this scope; did you mean 'i'?
   32 | template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())in(f[i]); in(r...); }
      |                                                                                         ~~^~~~~~
      |                                                                                         i
a.cc:32:101: error: 'in' was not declared in this scope; did you mean 'yn'?
   32 | template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())in(f[i]); in(r...); }
      |                                                                                                   ~~^~~~~~
      |                                                                                                   yn