#include #include long e() { return 0; } long op(long a, long b) { return a + b; } long id() { return 0; } long mapping(long f, long x) { return f + x; } long conbine(long f, long g) { return f + g; } using Segtree = atcoder::lazy_segtree; int main() { int n; std::cin >> n; Segtree data(n); for(int i : std::views::iota(0, n)) { data.set(i, i); } int q; std::cin >> q; for(int _ : std::views::iota(0, q)) { int t; std::cin >> t; --t; if(t == 0) { int x; std::cin >> x; --x; std::cout << data.get(x) << "\n"; } if(t == 1) { int x; long c; std::cin >> x >> c; --x; if(data.get(x) > c) { data.apply(x, n, c - data.get(x)); } } } }