Language: C++

#include <bits/stdc++.h>
using namespace std;

template <typename T> struct Node {
  T node, lazy;
  Node() {}
  Node(T node, T lazy) : node(node), lazy(lazy) {}

  Node operator*(const Node &r) const {
    return Node(min(node, r.node), -1);
  }
} e(INT_MAX, -1);

template <typename T> struct SegmentTree {
  size_t n;
  vector<Node> seg;

  SegmentTree(size_t size) : n(1 << (32 - __builtin_clz(size - 1))), seg(2 * n - 1, e) {}

  inline void lazy_evaluate(int k) {
    if (seg[k].lazy != -1) {
      seg[k].node = seg[k].lazy;
      if (k < n - 1) {
        seg[2 * k + 1].lazy = seg[k].lazy;
        seg[2 * k + 2].lazy = seg[k].lazy;
      }
      seg[k].lazy = -1;
    }
  }

  inline void update_node(int k) {
    seg[k] = seg[2 * k + 1] * seg[2 * k + 2];
  }

  void update(int l, int r, T x, int k, int a, int b) {
    lazy_evaluate(k);

    if (r <= a || b <= l) return;
    if (l <= a && b <= r) {
      seg[k].lazy = x;
      lazy_evaluate(k);
      return;
    }

    update(l, r, x, 2 * k + 1, a, (a + b) / 2);
    update(l, r, x, 2 * k + 2, (a + b) / 2, b);
    update_node(k);
  }

  Node query(int l, int r, int k, int a, int b) {
    lazy_evaluate(k);
    if (r <= a || b <= l) return e;
    if (l <= a && b <= r) return seg[k];

    return query(l, r, 2 * k + 1, a, (a + b) / 2) * query(l, r, 2 * k + 2, (a + b) / 2, b);
  }

  void update(int l, int r, T x) {
    update(l, r, x, 0, 0, n);
  }

  T query(int l, int r) {
    return query(l, r, 0, 0, n).node;
  }
};

int main() {
  int n, q;
  cin >> n >> q;

  SegmentTree<int> seg(n);

  while (q--) {
    int c;
    cin >> c;

    if (c) {
      int l, r;
      cin >> l >> r;
      cout << seg.query(l, r + 1) << endl;
    } else {
      int l, r, x;
      cin >> l >> r >> x;
      seg.update(l, r + 1, x);
    }
  }
}

Compiler output:
a.cc:12:3: error: a class template declaration must not declare anything else
   12 | } e(INT_MAX, -1);
      |   ^
a.cc:16:14: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
   16 |   vector<Node> seg;
      |              ^
a.cc:16:14: note:   expected a type, got 'Node'
a.cc:16:14: error: template argument 2 is invalid
a.cc:50:3: error: deduced class type 'Node' in function return type
   50 |   Node query(int l, int r, int k, int a, int b) {
      |   ^~~~
a.cc:4:30: note: 'template<class T> struct Node' declared here
    4 | template <typename T> struct Node {
      |                              ^~~~
a.cc: In constructor 'SegmentTree<T>::SegmentTree(size_t)':
a.cc:18:85: error: 'e' was not declared in this scope
   18 |   SegmentTree(size_t size) : n(1 << (32 - __builtin_clz(size - 1))), seg(2 * n - 1, e) {}
      |                                                                                     ^
a.cc: In member function 'void SegmentTree<T>::lazy_evaluate(int)':
a.cc:21:12: error: invalid types 'int[int]' for array subscript
   21 |     if (seg[k].lazy != -1) {
      |            ^
a.cc:22:10: error: invalid types 'int[int]' for array subscript
   22 |       seg[k].node = seg[k].lazy;
      |          ^
a.cc:22:24: error: invalid types 'int[int]' for array subscript
   22 |       seg[k].node = seg[k].lazy;
      |                        ^
a.cc:24:12: error: invalid types 'int[int]' for array subscript
   24 |         seg[2 * k + 1].lazy = seg[k].lazy;
      |            ^
a.cc:24:34: error: invalid types 'int[int]' for array subscript
   24 |         seg[2 * k + 1].lazy = seg[k].lazy;
      |                                  ^
a.cc:25:12: error: invalid types 'int[int]' for array subscript
   25 |         seg[2 * k + 2].lazy = seg[k].lazy;
      |            ^
a.cc:25:34: error: invalid types 'int[int]' for array subscript
   25 |         seg[2 * k + 2].lazy = seg[k].lazy;
      |                                  ^
a.cc:27:10: error: invalid types 'int[int]' for array subscript
   27 |       seg[k].lazy = -1;
      |          ^
a.cc: In member function 'void SegmentTree<T>::update_node(int)':
a.cc:32:8: error: invalid types 'int[int]' for array subscript
   32 |     seg[k] = seg[2 * k + 1] * seg[2 * k + 2];
      |        ^
a.cc:32:17: error: invalid types 'int[int]' for array subscript
   32 |     seg[k] = seg[2 * k + 1] * seg[2 * k + 2];
      |                 ^
a.cc:32:34: error: invalid types 'int[int]' for array subscript
   32 |     seg[k] = seg[2 * k + 1] * seg[2 * k + 2];
      |                                  ^
a.cc: In member function 'void SegmentTree<T>::update(int, int, T, int, int, int)':
a.cc:40:10: error: invalid types 'int[int]' for array subscript
   40 |       seg[k].lazy = x;
      |          ^
a.cc: In instantiation of 'T SegmentTree<T>::query(int, int) [with T = int]':
a.cc:80:24:   required from here
   80 |       cout << seg.query(l, r + 1) << endl;
      |               ~~~~~~~~~^~~~~~~~~~
a.cc:63:17: error: no matching function for call to 'SegmentTree<int>::query(int&, int&, int, int, size_t&)'
   63 |     return query(l, r, 0, 0, n).node;
      |            ~~~~~^~~~~~~~~~~~~~~
a.cc:62:5: note: candidate: 'T SegmentTree<T>::query(int, int) [with T = int]'
   62 |   T query(int l, int r) {
      |     ^~~~~
a.cc:62:5: note:   candidate expects 2 arguments, 5 provided