Language: C++

#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>
#include <random>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 9223372036854775807LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}
string YN(bool y) { return (y ? "YES" : "NO"); }
string yn(bool y) { return (y ? "Yes" : "No"); }
string ON(bool y) { return (y ? "OK" : "NG"); }

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;

int dir4[4][2] = { { 0,-1 },{ -1,0 },{ 1,0 },{ 0,1 } };
int dir8[8][2] = { { -1,-1 },{ 0,-1 },{ 1,-1 },{ -1,0 },{ 1,0 },{ -1,1 },{ 0,1 },{ 1,1 } };

// [a,b]?????±??°
int irand(int a, int b) {
	static mt19937 Rand(static_cast<unsigned int>(time(nullptr)));
	static uniform_int_distribution<int> dist(a, b);
	return dist(Rand);
}

// [a,b)?????±??°
double drand(int a, int b) {
	static mt19937 Rand(static_cast<unsigned int>(time(nullptr)));
	uniform_real_distribution<double> dist(a, b);
	return dist(Rand);
}

//=======???????????§???????????¬??????===============================================

template<class T>
class Treap {
public:
	template<class T>
	struct node_treap {
		T value;				// ???
		node_treap<T> *ch[2];	// ??????{???, ???}???
		double priority;			// ?????????
		int count;				// ??¨?????¨????????????
		T range_value;				// ??¨?????¨?????????sum???min

									// ?????????????????????
		node_treap(int v, double p) :value(v), priority(p), count(1), range_value(v) {
			ch[0] = ch[1] = NULL;
		}
	};

	node_treap<T> *root = NULL;

	// ???????????¨?????¨?????????????????????
	T def() {
		if (is_same<T, int>::value) {
			// int?????´???
			return (int)((1LL << 31) - 1);		// min?????´???
		}
		else if (is_same<T, ll>::value) {
			// ll?????´???
			return INFL;	// min?????´???
		}
	}
	// ???????????¨?????¨????????????sum??¨???min??¨??????
	T operation(T a, T b) {
		return min<T>(a, b);
	}

	int count(node_treap<T> *t) { return !t ? 0 : t->count; }
	int range_value(node_treap<T> *t) { return !t ? def() : t->range_value; }

	node_treap<T> *update(node_treap<T> *t) {
		t->count = count(t->ch[0]) + count(t->ch[1]) + 1;
		t->range_value = operation(operation(range_value(t->ch[0]), range_value(t->ch[1])), t->range_value);
		return t;
	}

	// ?????????????????¨???????????????
	node_treap<T> *Merge(node_treap<T> *l, node_treap<T> *r) {
		if (!l || !r)return !l ? r : l;

		if (l->priority > r->priority) {
			l->ch[1] = Merge(l->ch[1], r);
			return update(l);
		}
		else {
			r->ch[0] = Merge(l, r->ch[0]);
			return update(r);
		}
	}

	// ??¨???k????????§?????????[0,k)??¨[k,n)??????k?????¨n-k???????????????
	pair<node_treap<T> *, node_treap<T> *> split(node_treap<T> *t, int k) {
		if (!t)return make_pair((node_treap<T> *)NULL, (node_treap<T> *)NULL);

		if (k <= count(t->ch[0])) {
			pair<node_treap<T> *, node_treap<T> *> s = split(t->ch[0], k);
			t->ch[0] = s.second;
			return make_pair(s.first, update(t));
		}
		else {
			pair<node_treap<T> *, node_treap<T> *> s = split(t->ch[1], k - count(t->ch[0]) - 1);
			t->ch[1] = s.first;
			return make_pair(update(t), s.second);
		}
	}

	// ??´???k??????val?????????
	node_treap<T> *insert(node_treap<T> *t, int k, int val) {
		pair<node_treap<T> *, node_treap<T> *> s = split(t, k);
		return Merge(Merge(s.first, new node_treap<T>(val, drand(0, 1))), s.second);
	}

	// ??´???k?????????
	node_treap<T> *erase(node_treap<T> *t, int k) {
		pair<node_treap<T> *, node_treap<T> *> s1 = split(t, k);
		pair<node_treap<T> *, node_treap<T> *> s2 = split(s1.second, 1);
		return Merge(s1.first, s2.second);
	}

	node_treap<T> *update(node_treap<T> *t, int k, int val) {
		return insert(erase(t, k), k, val);
	}

	// ???????????¨???[a,b)
	T query(node_treap<T> *t, int a, int b) {
		return _query(t, a, b, 0, t->count);
	}
	// ??????[a,b)?????????????????????k=[l,r)????????????????????????
	T _query(node_treap<T> *t, int a, int b, int l, int r) {
		if (r <= a || b <= l)return def();  // ???????????????
		if (a <= l && r <= b)return t->range_value;   // a,l,r,b????????§?????¨???????????????
		else {
			T c1 = !t->ch[0] ? def() : _query(t->ch[0], a, b, l, l + t->ch[0]->count);	// ?????????
			T c2 = !t->ch[1] ? def() : _query(t->ch[1], a, b, l + t->ch[1]->count + 1, r);	// ?????????
			return operation(operation(c1, c2), t->value);
		}
	}

	void show() {
		cout << "Treap(" << root->count << "): "; _show(root); cout << endl;
	}

	void _show(node_treap<T> *t) {
		if (!t) {
			cout << "(NULL)";
			return;
		}
		cout << "(";
		_show(t->ch[0]);
		cout << t->value << " ";
		_show(t->ch[1]);
		cout << ")";
	}
};

int main(void) {
	int N, Q;
	cin >> N >> Q;
	Treap<int> t;
	rep(i, N) {
		t.root = t.insert(t.root, 0, (int)((1LL << 31) - 1));
		//t.show();
	}
	//t.show();
	rep(i, Q) {
		int c;
		cin >> c;
		if (c == 0) {
			int x, y;
			cin >> x >> y;
			t.root = t.update(t.root, x, y);
		}
		else {
			int x, y;
			cin >> x >> y;
			cout << t.query(t.root, x, y + 1) << endl;
		}
		//t.show();
	}

	return 0;
}

Compiler output:
a.cc:94:18: error: declaration of template parameter 'T' shadows template parameter
   94 |         template<class T>
      |                  ^~~~~
a.cc:91:10: note: template parameter 'T' declared here
   91 | template<class T>
      |          ^~~~~