Language: C++

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

const int MAX_N = 1 << 17;
const int INF = (1LL << 31) - 1;

template <class T>
struct MinSegTree3 {
	int n;
	struct S {
		bool flag;
		T dat;
		S() : dat(INF), flag(false) {}
	};

	S node[2 * MAX_N - 1];
	void init(int n_) {
		n = 1;
		while(n < n_) n *= 2;
	}

	void propagate(int k) {
		if(!node[k].flag) return;
		node[k].flag = false;
		if(2 * k + 1 < 2 * n - 1) {
			S& t = node[k];
			S& l = node[2 * k + 1];
			S& r = node[2 * k + 2];
			l.flag = r.flag = true;
			l.dat = r.dat = t.dat;
		}
	}

	void update(int a, int b, int x) { update(a, b, x, 0, 0, 0, n); }

	void update(int a, int b, int x, int k, int l, int r) {
		propagate(k, level);
		if(r <= a || b <= l) return;
		if(a <= l && r <= b) {
			node[k].dat = x;
			node[k].flag = true;
			propagate(k);
			return;
		}
		update(a, b, x, k * 2 + 1, l, (l + r) / 2);
		update(a, b, x, k * 2 + 2, (l + r) / 2, r);
		// merge
		node[k].dat = min(node[2 * k + 1].dat, node[2 * k + 2].dat);
	}

	int query(int a, int b) { return query(a, b, 0, 0, 0, n); }

	int query(int a, int b, int k, int l, int r) {
		propagate(k);
		if(r <= a || b <= l) return INF;
		if(a <= l && r <= b) return node[k].dat;
		int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
};

MinSegTree3<int> st;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, q;
	cin >> n >> q;
	st.init(n);

	while(q--) {
		int a, s, t, x;
		cin >> a;
		if(a == 0) {
			cin >> s >> t >> x;
			st.update(s, t + 1, x);
		}
		else {
			cin >> s >> t;
			cout << st.query(s, t + 1) << endl;
		}
	}
}

Compiler output:
a.cc: In member function 'void MinSegTree3<T>::update(int, int, int, int, int, int)':
a.cc:38:30: error: 'level' was not declared in this scope
   38 |                 propagate(k, level);
      |                              ^~~~~
a.cc: In instantiation of 'void MinSegTree3<T>::update(int, int, int) [with T = int]':
a.cc:79:13:   required from here
   79 |                         st.update(s, t + 1, x);
      |                         ~~~~~~~~~^~~~~~~~~~~~~
a.cc:35:50: error: no matching function for call to 'MinSegTree3<int>::update(int&, int&, int&, int, int, int, int&)'
   35 |         void update(int a, int b, int x) { update(a, b, x, 0, 0, 0, n); }
      |                                            ~~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:35:14: note: candidate: 'void MinSegTree3<T>::update(int, int, int) [with T = int]'
   35 |         void update(int a, int b, int x) { update(a, b, x, 0, 0, 0, n); }
      |              ^~~~~~
a.cc:35:14: note:   candidate expects 3 arguments, 7 provided
a.cc:37:14: note: candidate: 'void MinSegTree3<T>::update(int, int, int, int, int, int) [with T = int]'
   37 |         void update(int a, int b, int x, int k, int l, int r) {
      |              ^~~~~~
a.cc:37:14: note:   candidate expects 6 arguments, 7 provided
a.cc: In instantiation of 'int MinSegTree3<T>::query(int, int) [with T = int]':
a.cc:83:20:   required from here
   83 |                         cout << st.query(s, t + 1) << endl;
      |                                 ~~~~~~~~^~~~~~~~~~
a.cc:52:47: error: no matching function for call to 'MinSegTree3<int>::query(int&, int&, int, int, int, int&)'
   52 |         int query(int a, int b) { return query(a, b, 0, 0, 0, n); }
      |                                          ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:52:13: note: candidate: 'int MinSegTree3<T>::query(int, int) [with T = int]'
   52 |         int query(int a, int b) { return query(a, b, 0, 0, 0, n); }
      |             ^~~~~
a.cc:52:13: note:   candidate expects 2 arguments, 6 provided
a.cc:54:13: note: candidate: 'int MinSegTree3<T>::query(int, int, int, int, int) [with T = int]'
   54 |         int query(int a, int b, int k, int l, int r) {
      |             ^~~~~
a.cc:54:13: note:   candidate expects 5 arguments, 6 provided