#include #include #include using namespace std; using namespace __gnu_pbds; // Order Statistic Tree 定義(SortedList 相当) template using ordered_multiset = tree< T, null_type, less_equal, rb_tree_tag, tree_order_statistics_node_update>; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); long long N, K, Q; cin >> N >> K >> Q; ordered_multiset A; for (int i = 0; i < N; i++) { long long x; cin >> x; A.insert(x); } vector ans; for (int i = 0; i < Q; i++) { int t; cin >> t; if (t == 1) { long long x; cin >> x; A.insert(x); } else if (t == 2) { long long y; cin >> y; // K-1 番目(0-indexed)の要素を取り出す auto it = A.find_by_order(K - 1); long long a = *it; // その要素を削除 A.erase(it); // a + y を挿入 A.insert(a + y); } else { // t == 3 auto it = A.find_by_order(K - 1); ans.push_back(*it); } } for (auto x : ans) cout << x << "\n"; }