Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

template<typename T> struct min_segment_tree{
    int tree_size;
    vector<T> segment_tree_array;
    
    void resize(int size_number){
        tree_size = 1;
        while(tree_size < size_number){
            tree_size *= 2;
        }
        segment_tree_array.resize(tree_size);
        for(int i = 0; i < tree_size * 2 - 1; i++){
            segment_tree_array[i] = new T();
        }
    }
    
    void fill(int size_number, int value){
        tree_size = 1;
        while(tree_size < size_number){
            tree_size *= 2;
        }
        segment_tree_array.resize(tree_size);
        for(int i = 0; i < tree_size * 2 - 1; i++){
            segment_tree_array[i] = value;
        }
    }
    
    void change(int position, T value){
        position += tree_size - 1;
        segment_tree_array[position] = value;
        while(position){
            position = (position - 1) / 2;
            segment_tree_array[position] = min(segment_tree_array[position * 2 + 1], segment_tree_array[position * 2 + 2]);
        }
    }
    
    struct point{
        int now, point_left, point_right, back;
        T ans;
        bool calculated;
    };
    
    T calculation(int left, int right){
        return calcuration_recursion(left, right, 0, 0, tree_size);
    }
    
    T calcuration_recursion(int left, int right, int now, int point_left, int point_right){
        if(right <= point_left || point_right <= left){
            return new T();
        }else if(left <= point_left && point_right <= right){
            return segment_tree_array[now];
        }else{
            return min(calcuration_recursion(left, right, now * 2 + 1, point_left, (point_left + point_right) / 2),
                       calcuration_recursion(left, right, now * 2 + 2, (point_left + point_right) / 2, point_right);
        }
    }
};

int main(){
    int n, q;
    cin >> n >> q;
    min_segment_tree<int> segtree;
    segtree.fill(n, (1 << 31) - 1);
    for(int i = 0; i < q; i++){
        int com, x, y;
        if(com){
            cout << segtree.calculation(x, y + 1) << endl;
        }else{
            segtree.change(x, y);
        }
    }
}


Compiler output:
a.cc: In member function 'T min_segment_tree<T>::calcuration_recursion(int, int, int, int, int)':
a.cc:58:116: error: expected ')' before ';' token
   58 |                        calcuration_recursion(left, right, now * 2 + 2, (point_left + point_right) / 2, point_right);
      |                                                                                                                    ^
a.cc:57:23: note: to match this '('
   57 |             return min(calcuration_recursion(left, right, now * 2 + 1, point_left, (point_left + point_right) / 2),
      |                       ^
a.cc: In function 'int main()':
a.cc:67:31: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
   67 |     segtree.fill(n, (1 << 31) - 1);
      |                     ~~~~~~~~~~^~~
a.cc: In instantiation of 'T min_segment_tree<T>::calcuration_recursion(int, int, int, int, int) [with T = int]':
a.cc:48:16:   required from 'T min_segment_tree<T>::calculation(int, int) [with T = int]'
   48 |         return calcuration_recursion(left, right, 0, 0, tree_size);
      |                ^~~~~~~~~~~~~~~~~~~~~
a.cc:71:40:   required from here
   71 |             cout << segtree.calculation(x, y + 1) << endl;
      |                     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
a.cc:53:26: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   53 |             return new T();
      |                          ^
      |                          |
      |                          int*