Language: C++

#include <algorithm>
#include <memory>

template <class M>
class segtree {
    private:
        //using value_type = typename M::value_type;
        typedef typename M::value_type value_type;
        value_type value;
        std::unique_ptr<segtree> lch, rch;
        int size;
        M append;
    public:
        segtree(int n) : value(M::init), size(n) {
            if (n <= 1) return;
            lch.reset(new segtree(n / 2));
            rch.reset(new segtree(n - n / 2));
        }
        value_type range_query(int a, int b) {
            if (a <= 0 && size <= b) return value;
            if (b <= 0 || size <= a) return M::init;
            int lsize = lch->size;
            auto left = lch->range_query(a, b),
                 right = rch->range_query(a - lsize, b - lsize);
            return append(left, right);
        }
        void update(int k, value_type x) {
            if (!lch && !rch) {
                value = x;
                return;
            }
            else if (k < lch->size) lch->update(k, x);
            else rch->update(k - lch->size, x);
            value = append(lch->value, rch->value);
        }
};

struct MinInt {
    using value_type = int;
    static constexpr value_type init = std::numeric_limits<int>::max();
    int operator() (int a, int b) const {
        return std::min(a, b);
    }
};

enum command { Update, Find, };

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n, q;
    std::cin >> n >> q;
    segtree<MinInt> rmq(n);
    for (auto i = 0; i < q; i++) {
        int com, x, y;
        std::cin >> com >> x >> y;
        switch (com) {
            case Update:
                rmq.update(x, y);
                break;
            case Find:
                std::cout << rmq.range_query(x, y + 1) << '\n';
                break;
        }
    }
    return 0;
}

Compiler output:
a.cc:40:45: error: 'numeric_limits' is not a member of 'std'
   40 |     static constexpr value_type init = std::numeric_limits<int>::max();
      |                                             ^~~~~~~~~~~~~~
a.cc:40:60: error: expected primary-expression before 'int'
   40 |     static constexpr value_type init = std::numeric_limits<int>::max();
      |                                                            ^~~
a.cc:40:59: error: expected ';' at end of member declaration
   40 |     static constexpr value_type init = std::numeric_limits<int>::max();
      |                                                           ^
      |                                                            ;
a.cc:40:63: error: expected unqualified-id before '>' token
   40 |     static constexpr value_type init = std::numeric_limits<int>::max();
      |                                                               ^
a.cc: In function 'int main()':
a.cc:49:20: error: incomplete type 'std::ios_base' used in nested name specifier
   49 |     std::ios_base::sync_with_stdio(false);
      |                    ^~~~~~~~~~~~~~~
a.cc:50:10: error: 'cin' is not a member of 'std'
   50 |     std::cin.tie(nullptr);
      |          ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <memory>
  +++ |+#include <iostream>
    3 | 
a.cc:52:10: error: 'cin' is not a member of 'std'
   52 |     std::cin >> n >> q;
      |          ^~~
a.cc:52:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:56:14: error: 'cin' is not a member of 'std'
   56 |         std::cin >> com >> x >> y;
      |              ^~~
a.cc:56:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:62:22: error: 'cout' is not a member of 'std'
   62 |                 std::cout << rmq.range_query(x, y + 1) << '\n';
      |                      ^~~~
a.cc:62:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'