Language: C++

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt(), q = in.nextInt();
        RMinQ rMinQ = new RMinQ(n, Integer.MAX_VALUE);
        for (int i = 0; i < q; i++) {
            int cmd = in.nextInt(),
                    x = in.nextInt(),
                    y = in.nextInt();
            if (cmd == 0) {
                rMinQ.update(x, y);
            }else {
                System.out.println(rMinQ.find(x,y));
            }
        }
    }
}

// by heap DST
class RMinQ{
    int[] heap;
    int n;

    static int log2(int n) {
        int ret = 0, pow = 1;
        while (pow <= n) {
            pow = pow * 2;
            ret += 1;
        }
        return ret - 1;
    }

    RMinQ(int n, int val) {
        // construct complelte binary heap
        this.n = n;
        int heapLen = (int) Math.pow(2, log2(n) + 2);
        heap = new int[heapLen];
        Arrays.fill(heap, val);
    }

    void update(int i, int val) {
        if (i >= n || i < 0) {
            return;
        }

        if(val < heap[1]) heap[1] = val;
        if (i < n / 2) {
            update(2, val, i, 0, n / 2);
        }else {
            update(3, val, i, n/2, n);
        }
    }

    private void update(int iheap, int val, int i, int left, int right) {
        if(val < heap[iheap]) heap[iheap] = val;

        if (right - left <= 1) {
            return;
        }

        if (i < (left + right) / 2) {
            update(iheap * 2, val, i, left, (left + right) / 2);
        }else {
            update(iheap * 2 + 1, val, i, (left + right) / 2, right);
        }
    }

    int find(int s, int t) {
        int iheap = 1;
        return find(s, t+1, 0, n, iheap);
    }

    private int find(int s, int t, int left, int right, int iheap) {
        if (s >= t) {
            return Integer.MAX_VALUE;
        }
        if (left == s && right == t) {
            return heap[iheap];
        }

        int mid = (left + right) / 2;

        return Math.min(
                find(Math.max(s, left), Math.min(t, mid), left, mid, iheap * 2),
                find(Math.max(s, mid), Math.min(t, right), mid, right, iheap * 2 + 1)
        );
    }

}



Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Arrays;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
a.cc:25:8: error: expected unqualified-id before '[' token
   25 |     int[] heap;
      |        ^
a.cc:58:12: error: expected ':' before 'void'
   58 |     private void update(int iheap, int val, int i, int left, int right) {
      |            ^~~~~
      |            :
a.cc:77:12: error: expected ':' before 'int'
   77 |     private int find(int s, int t, int left, int right, int iheap) {
      |            ^~~~
      |            :
a.cc:93:2: error: expected ';' after class definition
   93 | }
      |  ^
      |  ;
a.cc: In constructor 'RMinQ::RMinQ(int, int)':
a.cc:39:14: error: request for member 'n' in '(RMinQ*)this', which is of pointer type 'RMinQ*' (maybe you meant to use '->' ?)
   39 |         this.n = n;
      |              ^
a.cc:40:29: error: 'Math' was not declared in this scope
   40 |         int heapLen = (int) Math.pow(2, log2(n) + 2);
      |                             ^~~~
a.cc:41:9: error: 'heap' was not declared in this scope
   41 |         heap = new int[heapLen];
      |         ^~~~
a.cc:42:9: error: 'Arrays' was not declared in this scope
   42 |         Arrays.fill(heap, val);
      |         ^~~~~~
a.cc: In member function 'void RMinQ::update(int, int)':
a.cc:50:18: error: 'heap' was not declared in this scope
   50 |         if(val < heap[1]) heap[1] = val;
      |                  ^~~~
a.cc: In member function 'void RMinQ::update(int, int, int, int, int)':
a.cc:59:18: error: 'heap' was not declared in this scope; did you mean 'iheap'?
   59 |         if(val < heap[iheap]) heap[iheap] = val;
      |                  ^~~~
      |                  iheap
a.cc: In member function 'int RMinQ::find(int, int, int, int, int)':
a.cc:79:20: error: 'Integer' was not declared in this scope
   79 |             return Integer.MAX_VALUE;
      |                    ^~~~~~~
a.cc:82:20: error: 'heap' was not declared in this scope; did you mean 'iheap'?
   82 |             return heap[iheap];
      |                    ^~~~
      |                    iheap
a.cc:87:16: error: 'Math' was not declared in this scope
   87 |         return Math.min(
      |                ^~~~