#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(),(a).end() template struct BIT { vector data; int siz; BIT(int n) { siz = n; data.assign(siz + 1, 0); } BIT(int n, const vector &v) : BIT(n) { assert(n == (int)v.size()); for (int i = 1; i <= siz; ++i) data[i] = v[i - 1]; for (int i = 1; i <= siz; ++i) { int j = i + (i & -i); if (j <= siz) data[j] += data[i]; } } void apply(int i, const T &x) { for (int k = i + 1; k <= siz; k += k & -k) data[k] += x; } T sum(int a) { T res = 0; for (int k = a + 1; k > 0; k -= k & -k) res += data[k]; return res; } // [a, b] T sum(int a, int b) { return sum(b) - sum(a - 1); } }; int main() { cin.tie(nullptr); int N, Q, L; cin >> N >> Q >> L; BIT song(2e5 + 10), level(2e5 + 10); rep(i, 0, N) { int A; cin >> A; song.apply(A, 1); level.apply(A, A); } bool notFound = true; rep(query, 0, Q) { int type; cin >> type; if (type == 1) { int l; cin >> l; song.apply(l, 1); level.apply(l, l); } else if (type == 2) { notFound = false; int l, r; cin >> l >> r; cout << song.sum(l, r) << ' ' << level.sum(l, r) << '\n'; } else { int m; cin >> m; } } if (notFound) cout << "Not Found!\n"; }