Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;

template<int MOD>
struct ModInt {
    using M = ModInt;
    long long val;
    ModInt(long long v = 0) {(set_val(v%MOD+MOD)) }
    M& set_val(const long long &v) {
        return v<MOD ? v : v-MOD;
    }
    M operator-() const {return M(-r);}
    M operator+(const M& r) const {return M(*this) += r;}
    M operator-(const M& r) const {return M(*this) -= r;}
    M operator*(const M& r) const {return M(*this) *= r;}
    M operator/(const M& r) const {return M(*this) /= r;}
    M& operator+=(const M& r) {return *this = *this+r;}
    M& operator-=(const M& r) {return *this = *this-r;}
    M& operator*=(const M& r) {return *this = *this*r;}
    M& operator/=(const M& r) {return *this = *this/r;}
    bool operator==(const M& r) const {return val == r.val;}
    M pow(long long n) const {
        M x = *this, r = 1;
        while(n>0)
        {
            if(n & 1) r *= x;
            x *= x;
            n >> 1;
        }
        return r;
    }
    M inverse() const {
        int a = val, b = MOD, u = 1, v = 0, t;
        while(b>0) {
            t = a/b;
            swap(a-=t*b, b);
            swap(u-=t*v, v);
        }
        return ModInt(u);
    }
    friend istream& operator<<(istream& i, const M& r) {
        long long tmp; i >> tmp;
        r = M(i);
        return i;
    }
    friend ostream& operator<<(ostream& os, const M& r) {
        return os << r.val;
    }
};

const int MOD = 1000000007;
using mint = ModInt<MOD>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    mint dp[n+1][4][4][4];
    REP(i,n) REP(w,4) REP(x,4) REP(y,4) REP(z,4) {
        if(z==2 && y==1 && x==0) continue;
        if(z==1 && y==2 && x==0) continue;
        if(z==2 && y==0 && x==1) continue;
        if(z==2 && x==1 && w==0) continue;
        if(z==2 && y==1 && w==0) continue;
        dp[i+1][x][y][z] += dp[i][w][x][y];
    }
    mint ans = 0;
    REP(x,4) REP(y,4) REP(z,4) {
        ans += dp[n][x][y][z];
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In constructor 'ModInt<MOD>::ModInt(long long int)':
a.cc:10:51: error: expected ';' before '}' token
   10 |     ModInt(long long v = 0) {(set_val(v%MOD+MOD)) }
      |                                                   ^
a.cc: In member function 'ModInt<MOD>::M ModInt<MOD>::operator-() const':
a.cc:14:36: error: 'r' was not declared in this scope
   14 |     M operator-() const {return M(-r);}
      |                                    ^
a.cc: In instantiation of 'ModInt<MOD>::M& ModInt<MOD>::set_val(const long long int&) [with int MOD = 1000000007; M = ModInt<1000000007>]':
a.cc:10:31:   required from 'ModInt<MOD>::ModInt(long long int) [with int MOD = 1000000007]'
   10 |     ModInt(long long v = 0) {(set_val(v%MOD+MOD)) }
      |                               ^~~~~~~
a.cc:60:25:   required from here
   60 |     mint dp[n+1][4][4][4];
      |                         ^
a.cc:12:22: error: cannot bind non-const lvalue reference of type 'ModInt<1000000007>::M&' {aka 'ModInt<1000000007>&'} to an rvalue of type 'ModInt<1000000007>::M' {aka 'ModInt<1000000007>'}
   12 |         return v<MOD ? v : v-MOD;
      |                ~~~~~~^~~~~~~~~~~
a.cc:10:5: note:   after user-defined conversion: 'ModInt<MOD>::ModInt(long long int) [with int MOD = 1000000007]'
   10 |     ModInt(long long v = 0) {(set_val(v%MOD+MOD)) }
      |     ^~~~~~