Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

const int MOD = 1e9+7;
class mint {
    ll x;
public:
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}
    
    mint operator -() const {
        return mint(-x);
    }
    
    mint &operator +=(const mint &a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }

    mint &operator -=(const mint &a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }

    mint &operator *=(const mint &a) {
        (x *= a.x) %= MOD;
        return *this;
    }

    mint operator +(const mint &a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint &a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator *(const mint &a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(MOD - 2);
    }

    mint &operator /=(const mint &a) {
        return (*this) *= a.inv();
    }

    mint operator /(const mint &a) const {
        mint res(*this);
        return res /= a;
    }

    friend ostream &operator<<(ostream& os, const mint &m) {
        os << m.x;
        return os;
    }
};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    string S;
    cin >> N >> S;

    ll tmp = 0;
    vec a(2*N, 0);
    Rep (i, 2*N) {
        if (S[i] == 'B' and tmp % 2 == 0 or S[i] == 'W' and tmp % 2 == 1) {
            a[i] = 1;
            tmp++;
        } else {
            a[i] = -1;
            tmp++;
        }
    }

    // Rep (i, 2*N) {
        cout << a[i] << " \n"[i==2*N-1];
    }

    mint ans(1);

    tmp = 0;
    Rep (i, 2*N) {
        if (a[i] == 1) {
            tmp++;
        } else {
            ans *= tmp;
            tmp--;
        }
    }

    if (tmp) ans *= 0;

    Rep (i, N) {
        ans *= i+1;
    }

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:128:19: error: 'i' was not declared in this scope
  128 |         cout << a[i] << " \n"[i==2*N-1];
      |                   ^
a.cc: At global scope:
a.cc:133:5: error: 'tmp' does not name a type; did you mean 'tm'?
  133 |     tmp = 0;
      |     ^~~
      |     tm
a.cc:20:19: error: expected unqualified-id before 'for'
   20 | #define Rep(i, n) for (ll i = 0; i < n; i++)
      |                   ^~~
a.cc:134:5: note: in expansion of macro 'Rep'
  134 |     Rep (i, 2*N) {
      |     ^~~
a.cc:134:10: error: 'i' does not name a type
  134 |     Rep (i, 2*N) {
      |          ^
a.cc:20:34: note: in definition of macro 'Rep'
   20 | #define Rep(i, n) for (ll i = 0; i < n; i++)
      |                                  ^
a.cc:134:10: error: 'i' does not name a type
  134 |     Rep (i, 2*N) {
      |          ^
a.cc:20:41: note: in definition of macro 'Rep'
   20 | #define Rep(i, n) for (ll i = 0; i < n; i++)
      |                                         ^
a.cc:143:5: error: expected unqualified-id before 'if'
  143 |     if (tmp) ans *= 0;
      |     ^~
a.cc:20:19: error: expected unqualified-id before 'for'
   20 | #define Rep(i, n) for (ll i = 0; i < n; i++)
      |                   ^~~
a.cc:145:5: note: in expansion of macro 'Rep'
  145 |     Rep (i, N) {
      |     ^~~
a.cc:145:10: error: 'i' does not name a type
  145 |     Rep (i, N) {
      |          ^
a.cc:20:34: note: in definition of macro 'Rep'
   20 | #define Rep(i, n) for (ll i = 0; i < n; i++)
      |                                  ^
a.cc:145:10: error: 'i' does not name a type
  145 |     Rep (i, N) {
      |          ^
a.cc:20:41: note: in definition of macro 'Rep'
   20 | #define Rep(i, n) for (ll i = 0; i < n; i++)
      |                                         ^
a.cc:149:5: error: 'cout' does not name a type
  149 |     cout << ans << endl;
      |     ^~~~
a.cc:150:1: error: expected declaration before '}' token
  150 | }
      | ^