diversity.cpp:6:7: error: 'MAXN' was not declared in this scope
6 | int a[MAXN], n, q;
| ^~~~
diversity.cpp:7:24: error: 'MAXN' was not declared in this scope
7 | array <int, 3> queries[MAXN];
| ^~~~
diversity.cpp:8:8: error: 'MAXN' was not declared in this scope
8 | ll ans[MAXN];
| ^~~~
diversity.cpp:9:10: error: 'MAXN' was not declared in this scope
9 | int freq[MAXN], freq2[MAXN];
| ^~~~
diversity.cpp:9:23: error: 'MAXN' was not declared in this scope
9 | int freq[MAXN], freq2[MAXN];
| ^~~~
diversity.cpp: In function 'void add(int)':
diversity.cpp:12:6: error: 'freq2' was not declared in this scope
12 | if (freq2[freq[a[x]]] == 1) t.erase(freq[a[x]]);
| ^~~~~
diversity.cpp:12:12: error: 'freq' was not declared in this scope; did you mean 'free'?
12 | if (freq2[freq[a[x]]] == 1) t.erase(freq[a[x]]);
| ^~~~
| free
diversity.cpp:12:17: error: 'a' was not declared in this scope
12 | if (freq2[freq[a[x]]] == 1) t.erase(freq[a[x]]);
| ^
diversity.cpp:13:2: error: 'freq2' was not declared in this scope
13 | freq2[freq[a[x]]]--;
| ^~~~~
diversity.cpp:13:8: error: 'freq' was not declared in this scope; did you mean 'free'?
13 | freq2[freq[a[x]]]--;
| ^~~~
| free
diversity.cpp:13:13: error: 'a' was not declared in this scope
13 | freq2[freq[a[x]]]--;
| ^
diversity.cpp: In function 'void rem(int)':
diversity.cpp:19:6: error: 'freq2' was not declared in this scope
19 | if (freq2[freq[a[x]]] == 1) t.erase(freq[a[x]]);
| ^~~~~
diversity.cpp:19:12: error: 'freq' was not declared in this scope; did you mean 'free'?
19 | if (freq2[freq[a[x]]] == 1) t.erase(freq[a[x]]);
| ^~~~
| free
diversity.cpp:19:17: error: 'a' was not declared in this scope
19 | if (freq2[freq[a[x]]] == 1) t.erase(freq[a[x]]);
| ^
diversity.cpp:20:2: error: 'freq2' was not declared in this scope
20 | freq2[freq[a[x]]]--;
| ^~~~~
diversity.cpp:20:8: error: 'freq' was not declared in this scope; did you mean 'free'?
20 | freq2[freq[a[x]]]--;
| ^~~~
| free
diversity.cpp:20:13: error: 'a' was not declared in this scope
20 | freq2[freq[a[x]]]--;
| ^
diversity.cpp: In function 'int main()':
diversity.cpp:28:2: error: 'freq2' was not declared in this scope
28 | freq2[0] = MAXN; t.insert(0);
| ^~~~~
diversity.cpp:28:13: error: 'MAXN' was not declared in this scope
28 | freq2[0] = MAXN; t.insert(0);
| ^~~~
diversity.cpp:29:38: error: 'a' was not declared in this scope
29 | for (int i = 1; i <= n; i++) cin >> a[i];
| ^
diversity.cpp:32:3: error: 'queries' was not declared in this scope
32 | queries[i] = {l, r, i};
| ^~~~~~~
diversity.cpp:34:7: error: 'queries' was not declared in this scope
34 | sort(queries + 1, queries + q + 1, [&] (array <int, 3> &x, array <int, 3> &y) {
| ^~~~~~~
diversity.cpp:41:10: error: 'R' was not declared in this scope
41 | while (R > queries[i][1]) rem(R--);
| ^
diversity.cpp:42:10: error: 'R' was not declared in this scope
42 | while (R < queries[i][1]) add(++R);
| ^
diversity.cpp:43:19: error: 'R' was not declared in this scope
43 | ll dis = 0, n = R - L + 1;
| ^
diversity.cpp:63:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
63 | for (auto [x, y] : pp[0]) {
| ^
diversity.cpp:70:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
70 | ans[queries[i][2]] = n * (n + 1) / 2 * dis - cur / 2 - cur2 / 2;
| ^~~
| abs
diversity.cpp:72:39: error: 'ans' was not declared in this scope; did you mean 'abs'?
72 | for (int i = 1; i <= q; i++) cout << ans[i] << '\n';
| ^~~
| abs