Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
 
#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif
 
using namespace std;
 
typedef long long int ll;
 
template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}
 
template<ll MOD = 1000000007>
class ModInt {
    ll n;
    static ModInt pow(ModInt x, ll p) {
        if (p == 0) {
            return 1;
        } else if (p % 2) {
            return x * pow(x, p - 1);
        } else {
            auto t = ModInt::pow(x, p / 2);
            return t * t;
        }
    }
    ModInt reverse() const {
        return ModInt::pow(*this, MOD - 2);
    }
 
public:
    ModInt()
        : n(0) {}
    ModInt(ll _n)
        : n(_n % MOD) {}
    ModInt operator+=(const ModInt &m) {
        n += m.n;
        if (n >= MOD) {
            n -= MOD;
        }
        return *this;
    }
    ModInt operator-=(const ModInt &m) {
        n -= m.n;
        if (n < 0) {
            n += MOD;
        }
        return *this;
    }
    ModInt operator*=(const ModInt &m) {
        n *= m.n;
        if (n >= MOD) {
            n %= MOD;
        }
        return *this;
    }
    ModInt operator/=(const ModInt &m) {
        n = (m.reverse() * n).n;
        return *this;
    }
 
    ModInt operator+=(const ll l) {
        return (*this) += ModInt(l);
    }
    ModInt operator-=(const ll l) {
        return (*this) -= ModInt(l);
    }
    ModInt operator*=(const ll l) {
        return (*this) *= ModInt(l);
    }
    ModInt operator/=(const ll l) {
        return (*this) /= ModInt(l);
    }
    ModInt operator+(const ModInt &m) {
        auto t = *this;
        return t += m;
    }
    ModInt operator-(const ModInt &m) {
        auto t = *this;
        return t -= m;
    }
    ModInt operator*(const ModInt &m) {
        auto t = *this;
        return t *= m;
    }
    ModInt operator/(const ModInt &m) {
        auto t = *this;
        return t /= m;
    }
    ModInt operator+(const ll l) {
        auto t = *this;
        return t += l;
    }
    ModInt operator-(const ll l) {
        auto t = *this;
        return t -= l;
    }
    ModInt operator*(const ll l) {
        auto t = *this;
        return t *= l;
    }
    ModInt operator/(const ll l) {
        auto t = *this;
        return t /= l;
    }
    ModInt operator=(const ll l) {
        n = l % MOD;
        if (n < 0) {
            n += MOD;
        }
        return *this;
    }
    friend ostream &operator<<(ostream &out, const ModInt &m) {
        out << m.n;
        return out;
    }
    friend istream &operator>>(istream &in, ModInt &m) {
        ll l;
        in >> l;
        m = l;
        return in;
    }
};
 
using mint = ModInt<>;
 
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> A(n + 1, 0);
    REP(i, 0, n) {
        int a;
        cin >> a;
        A[i + 1] = A[i] ^ a;
    }
    if (A[n] != 0) {
        auto dp = make_v(n + 2, 2, mint());
        dp[0][1] = 1;
        REP(i, 0, n + 1) {
            if (A[i] == A[n]) {
                dp[i + 1][0] += dp[i][1];
            } else if (A[i] == 0) {
                dp[i + 1][1] += dp[i][0];
            }
            dp[i + 1][0] += dp[i][0];
            dp[i + 1][1] += dp[i][1];
        }
        cout << dp[n + 1][1] << endl;
        REP (i, 0, n + 2) {
            cout << dp[i][0] << " " << dp[i][1] << endl;
        }
    } else {
        assert(n == 0);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:168:9: error: 'assert' was not declared in this scope
  168 |         assert(n == 0);
      |         ^~~~~~
a.cc:6:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    5 | #include <map>
  +++ |+#include <cassert>
    6 |