Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
using namespace std;
#define LL long long
#define LD long double
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pii pair<int,int>
#define pli pair<LL,int>
#define pil pair<int,LL>
#define pll pair<LL,LL>
#define ff first
#define ss second
#define pb push_back
#define BTW(x,a,b) ((a) <= (x) && (x) <= (b))
#define _eq(a,b) (fabs((a)-(b)) < EPS)
#define _lt(a,b) (fabs((a)-(b)) > EPS && a < b)
#define _gt(a,b) (fabs((a)-(b)) > EPS && a > b)
#define _lte(a,b) !_gt(a,b)
#define _gte(a,b) !_lt(a,b)
const vector<pii> XY = {pii(0,-1),pii(0,1),pii(-1,0),pii(1,0)};
const LD EPS = 1e-8;
const LD PI = acos(-1.0L);
const LL INFLL =  4e18;
const int INF  =  2e9;
const int MOD  =  1e9 + 7;
#define int long long

// read / write
template<typename T> void read(T& t) { cin >> t; }
template<typename T, typename ... U> void read(T& t, U& ... u) { read(t); read(u ...); }
template<typename T> void write(T t) { cout << t; }
template<typename T, typename ... U> void write(T t, U ... u) { write(t); write(u ...); }

class SEGTREE {
	public:
	int n;
	vector<int> st, en; vector<LL> sum, lazy;
	SEGTREE(){}
	SEGTREE(int _n) {
		n = 1 << (int)ceil(log2(_n)); int nb = n << 1;
		st.assign(nb, 0); en.assign(nb, 0);
		sum.assign(nb, 0); lazy.assign(nb, 0);
		build(1, 1, n);
	}
	inline LL value(int i) { return (sum[i] + lazy[i] * (en[i] - st[i] + 1)) %MOD; }
	inline void updateUP(int i) { sum[i] = (value(i << 1) + value(i << 1 | 1)) %MOD; }
	inline void propagateDOWN(int i) {
		lazy[i << 1] += lazy[i];
		lazy[i << 1 | 1] += lazy[i];
		lazy[i] = 0;
	}
	inline void build(int i, int start, int end) {
		st[i] = start, en[i] = end, lazy[i] = 0;
		if (start == end) { sum[i] = 0; return; }
		int mid = (start + end) >> 1;
		build(i << 1, start, mid); build(i << 1 | 1, mid + 1, end);
		updateUP(i);
	}
	inline LL query(const int& qL, const int& qR, int i = 1) {
		if (en[i] < qL || qR < st[i]) return 0;
		if (qL <= st[i] && en[i] <= qR) return value(i);
		propagateDOWN(i);
		LL ans = (query(qL,qR,i << 1) + query(qL,qR,i << 1 | 1)) %MOD;
		updateUP(i);
		return ans;
	}
	inline void add(const int& qL,const int& qR,const int& qVal,int i = 1) {
		if (en[i] < qL || qR < st[i]) return;
		if (qL <= st[i] && en[i] <= qR) { lazy[i] += qVal %MOD; return; }
		propagateDOWN(i);
		add(qL,qR,qVal,i << 1); add(qL,qR,qVal,i << 1 | 1);
		updateUP(i);
	}
};

// ------------------------------------------------- Vs
const int LOGN    =  16              + 1;
const int MAXN1   =  (1<<20)            + 3;
const int MAXN2   =  5e5            + 3;
int dp1[MAXN1];
int a[MAXN2];
SEGTREE dp0(1<<20), nb(1<<20);
// ------------------------------------------------- Fs
int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); write(fixed, setprecision(12));
    int n; read(n);
    for(int i = 1; i <= n; ++i){ read(a[i]); a[i] ^= a[i-1]; }

    dp0.add(0, (1<<20)-1, 1);
    //for(int x = 0; x < (1<<20); ++x) dp1[x] = 1;

    for(int i = 1; i <= n-1; ++i){
        if(a[i] == 0) nb.add(0, (1<<20)-1, 1);
        else{
            dp0.add(a[i], a[i], ((LL)nb.query(a[i],a[i]) * dp1[a[i]]) %MOD);
            nb.add(a[i], a[i], -nb.query(a[i], a[i]));
            dp1[a[i]] = ((LL)dp1[a[i]] + dp0.query(a[i],a[i])) %MOD;
        }
    }

    int ans = 0;
    if(a[n] > 0) ans = dp1.query(a[n], a[n]);
    else{
		for(int x = 0; x < (1<<20); ++x) ans = (ans + dp1[x]) %MOD;
		int tmp = count(a+1, a+1 + n, 0);
		int extra = 1; for(int i = 1; i <= tmp - 1; ++i) extra = ((LL)extra * 2) %MOD;
		ans = (ans + extra) %MOD;
	}
    
    write(ans, "\n");

    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:109:28: error: request for member 'query' in 'dp1', which is of non-class type 'long long int [1048579]'
  109 |     if(a[n] > 0) ans = dp1.query(a[n], a[n]);
      |                            ^~~~~