criyle/codenet-compile-errors huggingface dataset:
Language: C++


#include <vector>
#include <algorithm>

class segment_tree
{
private:
	std::vector<int>treedat;
	int treesiz;
	static const int inf = INT_MAX;
	int rawqry(int a, int b, int k, int l, int r)
	{
		if (r <= a || b <= l)return inf;
		if (a <= l && r <= b)return treedat[k];
		int m = (l + r) / 2;
		return std::min(rawqry(a, b, k * 2 + 1, l, m), rawqry(a, b, k * 2 + 2, m, r));
	}
public:
	void update(int k, int a)
	{
		k += (treesiz - 1);
		treedat[k] = a;
		while (k > 0)
		{
			k = (k - 1) / 2;
			treedat[k] = std::min(treedat[k * 2 + 1], treedat[k * 2 + 2]);
		}
	}
	int query(int a, int b) { return rawqry(a, b, 0, 0, treesiz); }
	segment_tree(int n)
	{
		treesiz = 1;
		while (treesiz < n)treesiz *= 2;
		treedat.resize(2*treesiz+1);
		std::fill(treedat.begin(), treedat.end(), inf);
	}
};

segment_tree* st;

int n, q;

int main()
{
	scanf("%d %d", &n, &q);
	st = new segment_tree(n);
	for (int i = 0; i < q; ++i)
	{
		int com, x, y;
		scanf("%d %d %d", &com, &x, &y);
		if (com == 0)
		{
			st->update(x, y);
		}
		else
		{
			printf("%d\n", st->query(x, y));
		}
	}
	return 0;
}

Compiler output:
a.cc:10:32: error: 'INT_MAX' was not declared in this scope
   10 |         static const int inf = INT_MAX;
      |                                ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 | 
a.cc: In function 'int main()':
a.cc:45:9: error: 'scanf' was not declared in this scope
   45 |         scanf("%d %d", &n, &q);
      |         ^~~~~
a.cc:57:25: error: 'printf' was not declared in this scope
   57 |                         printf("%d\n", st->query(x, y));
      |                         ^~~~~~
a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    3 | #include <algorithm>
  +++ |+#include <cstdio>
    4 |
Language: C++


#include <vector>
using namespace std;

//Base class for Segment Trees
template <class T> 
class segtree_base
{
protected:
	vector<T> vec;
	T def;
	virtual T query_raw(int l_, int r_, int a_, int b_, int k_) = 0;
public:
	segtree_base(size_t size_, const T& def_ = T()) : def(def_)
	{
		size_t s = 1; 
		while (s < size_)s *= 2;
		vec.resize(s, def);
	}
	T query(int left, int right)
	{
		return query_raw(left, right, 0, vec.size(), 0);
	}
	virtual ~segtree_base() {}
};

//Range Minimum Tree
template <class T>
class rmq_tree : public segtree_base<T>
{
public:
	rmq_tree(size_t size_, const T& def) : segtree_base<T>(size_, def)
	{}
	void update(int index,int val)
	{
		index += (vec.size() - 1);
		vec[index] = val;
		while (index > 0)
		{
			index = (index - 1) / 2;
			vec[index] = min(vec[index * 2 + 1], vec[index * 2 + 2]);
		}
	}
private:
	T query_raw(int l_, int r_, int a_, int b_, int k_)override
	{
		if (a_ <= l_ && r_ <= b_)
		{
			return vec[k];
		}
		if (b_ <= l_ || r_ <= a_)
		{
			return def;
		}
		int m = (l_ + r_) / 2;
		return min(
			query_raw(l_, m, a_, b_, k + k + 1), 
			query_raw(m, r_, a_, b_, k + k + 2));
	}
};

#include <iostream>
#include <climits>

int main()
{
	int n, q;
	cin >> n >> q;
	rmq_tree<int>rmq(n, INT_MAX);
	for (int i = 0; i < q; ++i)
	{
		int com, x, y;
		cin >> com >> x >> y;
		if (com)
		{
			cout << rmq.query(x, y + 1) << endl;
		}
		else
		{
			rmq.update(x, y);
		}
	}
	return 0;
}

Compiler output:
a.cc: In member function 'void rmq_tree<T>::update(int, int)':
a.cc:36:27: error: 'vec' was not declared in this scope
   36 |                 index += (vec.size() - 1);
      |                           ^~~
a.cc: In member function 'T rmq_tree<T>::query_raw(int, int, int, int, int)':
a.cc:49:32: error: 'vec' was not declared in this scope
   49 |                         return vec[k];
      |                                ^~~
a.cc:49:36: error: 'k' was not declared in this scope
   49 |                         return vec[k];
      |                                    ^
a.cc:53:32: error: 'def' was not declared in this scope
   53 |                         return def;
      |                                ^~~
a.cc:57:50: error: 'k' was not declared in this scope
   57 |                         query_raw(l_, m, a_, b_, k + k + 1),
      |                                                  ^
Language: C++


#include <vector>
using namespace std;

//Base class for Segment Trees
template <class T> 
class segtree_base
{
protected:
	vector<T> vec;
	T def;
	virtual T query_raw(int l_, int r_, int a_, int b_, int k_) = 0;
public:
	segtree_base(size_t size_, const T& def_ = T()) : def(def_)
	{
		size_t s = 1; 
		while (s < size_)s *= 2;
		vec.resize(s, def);
	}
	T query(int left, int right)
	{
		return query_raw(left, right, 0, vec.size(), 0);
	}
	virtual ~segtree_base() {}
};

//Range Minimum Tree
template <class T>
class rmq_tree : public segtree_base<T>
{
public:
	rmq_tree(size_t size_, const T& def) : segtree_base<T>(size_, def)
	{}
	void update(int index,int val)
	{
		index += (vec.size() - 1);
		segtree_base<T>::vec[index] = val;
		while (index > 0)
		{
			index = (index - 1) / 2;
			vec[index] = min(vec[index * 2 + 1], vec[index * 2 + 2]);
		}
	}
private:
	T query_raw(int l_, int r_, int a_, int b_, int k_)override
	{
		if (a_ <= l_ && r_ <= b_)
		{
			return vec[k_];
		}
		if (b_ <= l_ || r_ <= a_)
		{
			return def;
		}
		int m = (l_ + r_) / 2;
		return min(
			query_raw(l_, m, a_, b_, k_ + k_ + 1), 
			query_raw(m, r_, a_, b_, k_ + k_ + 2));
	}
};

#include <iostream>
#include <climits>

int main()
{
	int n, q;
	cin >> n >> q;
	rmq_tree<int>rmq(n, INT_MAX);
	for (int i = 0; i < q; ++i)
	{
		int com, x, y;
		cin >> com >> x >> y;
		if (com)
		{
			cout << rmq.query(x, y + 1) << endl;
		}
		else
		{
			rmq.update(x, y);
		}
	}
	return 0;
}

Compiler output:
a.cc: In member function 'void rmq_tree<T>::update(int, int)':
a.cc:36:27: error: 'vec' was not declared in this scope
   36 |                 index += (vec.size() - 1);
      |                           ^~~
a.cc: In member function 'T rmq_tree<T>::query_raw(int, int, int, int, int)':
a.cc:49:32: error: 'vec' was not declared in this scope
   49 |                         return vec[k_];
      |                                ^~~
a.cc:53:32: error: 'def' was not declared in this scope
   53 |                         return def;
      |                                ^~~
Language: C++


#include <vector>
using namespace std;

//Base class for Segment Trees
template <class T> 
class segtree_base
{
protected:
	vector<T> vec;
	T def;
	virtual T query_raw(int l_, int r_, int a_, int b_, int k_) = 0;
public:
	segtree_base(size_t size_, const T& def_ = T()) : def(def_)
	{
		size_t s = 1; 
		while (s < size_)s *= 2;
		vec.resize(s, def);
	}
	T query(int left, int right)
	{
		return query_raw(left, right, 0, vec.size(), 0);
	}
	virtual ~segtree_base() {}
};

//Range Minimum Tree
template <class T>
class rmq_tree : public segtree_base<T>
{
public:
	rmq_tree(size_t size_, const T& def) : segtree_base<T>(size_, def)
	{}
	void update(int index,int val)
	{
		index += (vec.size() - 1);
		vec[index] = val;
		while (index > 0)
		{
			index = (index - 1) / 2;
			vec[index] = min(vec[index * 2 + 1], vec[index * 2 + 2]);
		}
	}
private:
	T query_raw(int l_, int r_, int a_, int b_, int k_)override
	{
		if (a_ <= l_ && r_ <= b_)
		{
			return vec[k_];
		}
		if (b_ <= l_ || r_ <= a_)
		{
			return def;
		}
		int m = (l_ + r_) / 2;
		return min(
			query_raw(l_, m, a_, b_, k_ + k_ + 1), 
			query_raw(m, r_, a_, b_, k_ + k_ + 2));
	}
};

#include <iostream>
#include <climits>

int main()
{
	int n, q;
	cin >> n >> q;
	rmq_tree<int>rmq(n, INT_MAX);
	for (int i = 0; i < q; ++i)
	{
		int com, x, y;
		cin >> com >> x >> y;
		if (com)
		{
			cout << rmq.query(x, y + 1) << endl;
		}
		else
		{
			rmq.update(x, y);
		}
	}
	return 0;
}

Compiler output:
a.cc: In member function 'void rmq_tree<T>::update(int, int)':
a.cc:36:27: error: 'vec' was not declared in this scope
   36 |                 index += (vec.size() - 1);
      |                           ^~~
a.cc: In member function 'T rmq_tree<T>::query_raw(int, int, int, int, int)':
a.cc:49:32: error: 'vec' was not declared in this scope
   49 |                         return vec[k_];
      |                                ^~~
a.cc:53:32: error: 'def' was not declared in this scope
   53 |                         return def;
      |                                ^~~
Language: C++


#include <vector>
using namespace std;

//Base class for Segment Trees
template <class T>
class segtree_base
{
protected:
	vector<T> vec;
	T def;
	virtual T query_raw(int l_, int r_, int a_, int b_, int k_) = 0;
public:
	segtree_base(size_t size_, const T& def_ = T()) : def(def_)
	{
		size_t s = 1;
		while (s < size_)s *= 2;
		vec.resize(s, def);
	}
	T query(int left, int right)
	{
		return query_raw(left, right, 0, vec.size(), 0);
	}
	virtual ~segtree_base() {}
};

#include <algorithm>
//Range Minimum Tree
template <class T>
class rmq_tree : public segtree_base<T>
{
public:
	rmq_tree(size_t size_, const T& def) : segtree_base<T>(size_, def)
	{}
	void update(int index, int val)
	{
		index += (vec.size() - 1);
		vec[index] = val;
		while (index > 0)
		{
			index = (index - 1) / 2;
			vec[index] = min(vec[index * 2 + 1], vec[index * 2 + 2]);
		}
	}
private:
	T query_raw(int l_, int r_, int a_, int b_, int k_)override
	{
		if (a_ <= l_ && r_ <= b_)
		{
			return vec[k_];
		}
		if (b_ <= l_ || r_ <= a_)
		{
			return def;
		}
		int m = (l_ + r_) / 2;
		return min(
			query_raw(l_, m, a_, b_, k_ + k_ + 1),
			query_raw(m, r_, a_, b_, k_ + k_ + 2));
	}
};

#include <iostream>
#include <climits>

int main()
{
	int n, q;
	cin >> n >> q;
	rmq_tree<int>rmq(n, INT_MAX);
	for (int i = 0; i < q; ++i)
	{
		int com, x, y;
		cin >> com >> x >> y;
		if (com)
		{
			cout << rmq.query(x, y + 1) << endl;
		}
		else
		{
			rmq.update(x, y);
		}
	}
	return 0;
}

Compiler output:
a.cc: In member function 'void rmq_tree<T>::update(int, int)':
a.cc:37:27: error: 'vec' was not declared in this scope
   37 |                 index += (vec.size() - 1);
      |                           ^~~
a.cc: In member function 'T rmq_tree<T>::query_raw(int, int, int, int, int)':
a.cc:50:32: error: 'vec' was not declared in this scope
   50 |                         return vec[k_];
      |                                ^~~
a.cc:54:32: error: 'def' was not declared in this scope
   54 |                         return def;
      |                                ^~~
Language: C++


#include <vector>
using namespace std;

//Base class for Segment Trees
template <class T>
class segtree_base
{
protected:
	size_t width;
	vector<T> vec;
	T def;
	virtual T query_raw(int l_, int r_, int a_, int b_, int k_) = 0;
public:
	segtree_base(size_t size_, const T& def_ = T()) : def(def_)
	{
		width = 1;
		while (width < size_)width *= 2;
		vec.resize(width * 2 - 1, def);
	}
	T query(int left, int right)
	{
		return query_raw(left, right, 0, width, 0);
	}
	virtual ~segtree_base() {}
};

#include <algorithm>
//Range Minimum Tree
template <class T>
class rmq_tree : public segtree_base<T>
{
public:
	rmq_tree(size_t size_, const T& def) : segtree_base<T>(size_, def)
	{}
	void update(int index, int val)
	{
		auto &vec = this->vec;
		index += (width - 1);
		vec[index] = val;
		while (index > 0)
		{
			index = (index - 1) / 2;
			vec[index] = min(vec[index * 2 + 1], vec[index * 2 + 2]);
		}
	}
private:
	T query_raw(int l_, int r_, int a_, int b_, int k_)override
	{
		const auto &vec = this->vec;
		if (a_ <= l_ && r_ <= b_)
		{
			return vec[k_];
		}
		if (b_ <= l_ || r_ <= a_)
		{
			return this->def;
		}
		int m = (l_ + r_) / 2;
		return min(
			query_raw(l_, m, a_, b_, k_ + k_ + 1),
			query_raw(m, r_, a_, b_, k_ + k_ + 2));
	}
};

#include <iostream>
#include <climits>

int main()
{
	int n, q;
	cin >> n >> q;
	rmq_tree<int>rmq(n, INT_MAX);
	for (int i = 0; i < q; ++i)
	{
		int com, x, y;
		cin >> com >> x >> y;
		if (com)
		{
			cout << rmq.query(x, y + 1) << endl;
		}
		else
		{
			rmq.update(x, y);
		}
	}
	return 0;
}

Compiler output:
a.cc: In member function 'void rmq_tree<T>::update(int, int)':
a.cc:39:27: error: 'width' was not declared in this scope
   39 |                 index += (width - 1);
      |                           ^~~~~
Language: C++

#include <iostream>
#include <algorithm>

constexpr int MAX_N = 100000;

int n, q;

int seg[MAX_N * 4];

void init(int x) {

	n = 1;

	while (x > n)
		n *= 2;

	for (int i = 0; i < n * 2 - 1; ++i)
		seg[i] = INT_MAX;
}

void update(int k, int a) {

	k += n - 1;

	seg[k] = a;

	while (k > 0) {

		k = (k - 1) / 2;

		seg[k] = std::min(seg[k * 2 + 1], seg[k * 2 + 2]);
	}
}

int query(int a, int b, int k, int l, int r) {

	if (r <= a || b <= l)
		return INT_MAX;

	if (a <= l&&r <= b)
		return seg[k];

	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 std::min(vl, vr);
}

int main() {

	std::cin >> n >> q;

	init(n);

	int t, x, y;

	for (int i = 0; i < q; ++i) {

		std::cin >> t >> x >> y;

		if (t == 0)
			update(x, y);
		else
			std::cout << query(x, y + 1, 0, 0, n) << std::endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'void init(int)':
a.cc:18:26: error: 'INT_MAX' was not declared in this scope
   18 |                 seg[i] = INT_MAX;
      |                          ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 | 
a.cc: In function 'int query(int, int, int, int, int)':
a.cc:38:24: error: 'INT_MAX' was not declared in this scope
   38 |                 return INT_MAX;
      |                        ^~~~~~~
a.cc:38:24: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <algorithm>

constexpr int MAX_N = 100000, INF = (1 << 31) - 1;

int n, q;

int seg[MAX_N * 4];

void init(int x) {

	n = 1;

	while (x > n)
		n *= 2;

	for (int i = 0; i < n * 2 - 1; ++i)
		seg[i] = INF;
}

void update(int k, int a) {

	k += n - 1;

	seg[k] = a;

	while (k > 0) {

		k = (k - 1) / 2;

		seg[k] = std::min(seg[k * 2 + 1], seg[k * 2 + 2]);
	}
}

int query(int a, int b, int k, int l, int r) {

	if (r <= a || b <= l)
		return INF;

	if (a <= l&&r <= b)
		return seg[k];

	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 std::min(vl, vr);
}

int main() {

	std::cin >> n >> q;

	init(n);

	int t, x, y;

	for (int i = 0; i < q; ++i) {

		std::cin >> t >> x >> y;

		if (t == 0)
			update(x, y);
		else
			std::cout << query(x, y + 1, 0, 0, n) << std::endl;
	}

	system("pause");

	return 0;
}

Compiler output:
a.cc:4:47: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
    4 | constexpr int MAX_N = 100000, INF = (1 << 31) - 1;
      |                                     ~~~~~~~~~~^~~
a.cc:4:47: error: overflow in constant expression [-fpermissive]
a.cc:4:49: error: overflow in constant expression [-fpermissive]
    4 | constexpr int MAX_N = 100000, INF = (1 << 31) - 1;
      |                                                 ^
Language: C++

#include <iostream>
#include <algorithm>

constexpr int MAX_N = 100000, INF = (1 << 31) - 1;

int n, q;

int seg[MAX_N * 4];

void init(int x) {

	n = 1;

	while (x > n)
		n *= 2;

	for (int i = 0; i < n * 2 - 1; ++i)
		seg[i] = INF;
}

void update(int k, int a) {

	k += n - 1;

	seg[k] = a;

	while (k > 0) {

		k = (k - 1) / 2;

		seg[k] = std::min(seg[k * 2 + 1], seg[k * 2 + 2]);
	}
}

int query(int a, int b, int k, int l, int r) {

	if (r <= a || b <= l)
		return INF;

	if (a <= l&&r <= b)
		return seg[k];

	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 std::min(vl, vr);
}

int main() {

	std::cin >> n >> q;

	init(n);

	int t, x, y;

	for (int i = 0; i < q; ++i) {

		std::cin >> t >> x >> y;

		if (t == 0)
			update(x, y);
		else
			std::cout << query(x, y + 1, 0, 0, n) << std::endl;
	}

	return 0;
}

Compiler output:
a.cc:4:47: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
    4 | constexpr int MAX_N = 100000, INF = (1 << 31) - 1;
      |                                     ~~~~~~~~~~^~~
a.cc:4:47: error: overflow in constant expression [-fpermissive]
a.cc:4:49: error: overflow in constant expression [-fpermissive]
    4 | constexpr int MAX_N = 100000, INF = (1 << 31) - 1;
      |                                                 ^
Language: C++

#include <iostream>
#include <algorithm>

constexpr int MAX_N = 100000, INF = long long int(1 << 31) - 1;

int n, q;

int seg[MAX_N * 4];

void init(int x) {

	n = 1;

	while (x > n)
		n *= 2;

	for (int i = 0; i < n * 2 - 1; ++i)
		seg[i] = INF;
}

void update(int k, int a) {

	k += n - 1;

	seg[k] = a;

	while (k > 0) {

		k = (k - 1) / 2;

		seg[k] = std::min(seg[k * 2 + 1], seg[k * 2 + 2]);
	}
}

int query(int a, int b, int k, int l, int r) {

	if (r <= a || b <= l)
		return INF;

	if (a <= l&&r <= b)
		return seg[k];

	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 std::min(vl, vr);
}

int main() {

	std::cin >> n >> q;

	init(n);

	int t, x, y;

	for (int i = 0; i < q; ++i) {

		std::cin >> t >> x >> y;

		if (t == 0)
			update(x, y);
		else
			std::cout << query(x, y + 1, 0, 0, n) << std::endl;
	}

	return 0;
}

Compiler output:
a.cc:4:37: error: expected primary-expression before 'long'
    4 | constexpr int MAX_N = 100000, INF = long long int(1 << 31) - 1;
      |                                     ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
typedef long long ll;

template <class T> struct SegmentTreeMax {

    int N;
    vector<T> node;
    const T INF = numeric_limits<T>::min() / 2;

    SegmentTreeMax (int n) : N(2<<(int)log2(n)) { 
        node.resize(N<<1, INF);
    }

    void update(int idx, T val){
        idx += N;
        node[idx] = val;
        while (idx >>= 1) {
            node[idx] = max(node[idx<<1], node[(idx<<1) + 1]);
        }
    }

    T get_max(int l, int r) { 
        T ret = INF;
        l += N, r += N;
        while (l < r) {
            if (l & 1) ret = max(ret, node[l++]);
            if (r & 1) ret = max(ret, node[--r]);
            l >>= 1; r >>= 1;
        }
        return ret;
    }

};

template <class T> struct SegmentTreeMin {

    int N;
    vector<T> node;
    const T INF = numeric_limits<T>::max() / 2;

    SegmentTreeMin (int n) : N(2<<(int)log2(n)) { 
        node.resize(N<<1, INF);
    }

    void update(int idx, T val){
        idx += N;
        node[idx] = val;
        while (idx >>= 1) {
            node[idx] = max(node[idx<<1], node[(idx<<1) + 1]);
        }
    }

    T get_max(int l, int r) { 
        T ret = INF;
        l += N, r += N;
        while (l < r) {
            if (l & 1) ret = min(ret, node[l++]);
            if (r & 1) ret = min(ret, node[--r]);
            l >>= 1; r >>= 1;
        }
        return ret;
    }

};

int main() {

    int q,n; cin >> n >> q;

    SegmentTreeMin<ll> inst(100010);

    REP(i,q) {
        int com,x,y; cin >> com >> x >> y;
        if(com == 0) {
            inst.update(x,y);
        } else {
            if(inst.get_min(x,y+1) == inst.INF) {
                cout << (1LL << 31) - 1 << endl;
            } else {
                cout << inst.get_min(x,y+1) << endl;
            }
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:92:21: error: 'struct SegmentTreeMin<long long int>' has no member named 'get_min'; did you mean 'get_max'?
   92 |             if(inst.get_min(x,y+1) == inst.INF) {
      |                     ^~~~~~~
      |                     get_max
a.cc:95:30: error: 'struct SegmentTreeMin<long long int>' has no member named 'get_min'; did you mean 'get_max'?
   95 |                 cout << inst.get_min(x,y+1) << endl;
      |                              ^~~~~~~
      |                              get_max
Language: C++

#include <iostream>
#include <string>
//#include <cstring>
//#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
//#include <stack>
//#include <queue>
//#include <chrono>
//#include <numeric>
//#include <set>
//#define _USE_MATH_DEFINES
//#include <cmath>
//#include <math.h>
//#include <iomanip>
//#include <list>
//#include <limits>

using namespace std;
const int infty = static_cast <int> (pow(256, sizeof(int)) / 2 - 1);

class cRMQ
{
	int m_n;
	vector<int> va;
public:
	cRMQ(int n);
	void update(int i, int x);
	int find(int s, int t);
	int find(int s, int t, int k, int l, int r);
	void print()
};

cRMQ::cRMQ(int n)
{
	m_n = 1;
	while (m_n < n) m_n *= 2;
	va.resize(m_n * 2 - 1);
	for(int i = 0; i < 2 * m_n - 1; ++i)
		va[i] = infty;
}

void cRMQ::update(int k, int x)
{
	k += m_n - 1;
	va[k] = x;
	while(k > 0)
	{
		k = (k - 1) / 2;
		va[k] = min(va[k * 2 + 1], va[k * 2 + 2]);
	}
}
int cRMQ::find(int s, int t)
{
	return find(s, t, 0, 0, m_n);
}
int cRMQ::find(int s, int t, int k, int l, int r)
{
	if (r <= s || t <= l)return infty;
	if (s <= l && r <= t)return va[k];
	int m = (l + r) / 2;
	return min(find(s, t, k * 2 + 1, l, m), find(s, t, k * 2 + 2, m, r));
}

int main()
{
	////ifstream fin("DPL_1_C-in40.txt");
	//ifstream fin("test.txt");
	//if (!fin.is_open())
	//{
	//	cout << "File not found." << endl;
	//	return 0;
	//}

	//fin.tie(0);
	//ios::sync_with_stdio(false);

	//int n,q;
	//fin >> n >> q;
	//fin.ignore();

	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, q;
	cin >> n >> q;
	cin.ignore();

	int com, x, y;
	cRMQ cr(n);

	for (int i = 0; i < q; ++i)
	{
		cin >> com >> x >> y;
		//fin >> com >> x >> y;
		switch (com)
		{
		case 0:
			cr.update(x, y);
			break;
		case 1:
			cout << cr.find(x, y) << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc:21:38: error: 'pow' was not declared in this scope
   21 | const int infty = static_cast <int> (pow(256, sizeof(int)) / 2 - 1);
      |                                      ^~~
a.cc:32:20: error: expected ';' at end of member declaration
   32 |         void print()
      |                    ^
      |                     ;
Language: C++

#include<iostream>
using namespace std;int d[1<<18]={INT_MAX},n,q,r,x,y,i;int m(int l,int r,int k){if(x<=l&&r<=y)return d[k];if(y<=l||r<=x)return INT_MAX;return min(m(l,(l+r)/2,k*2+1),m((l+r)/2,r,k*2+2));}int main(){cin>>n>>q;r=2;while(r<n)r*=2;n=r;while(q--){scanf("%d%d%d",&r,&x,&y);if(r){y++;printf("%d\n",m(0,n,0));}else{i=x+n-1,d[i]=y;while(i)i=(i-1)/2,d[i]=min(d[i*2+1],d[i*2+2]);}}return 0;}

Compiler output:
a.cc:2:35: error: 'INT_MAX' was not declared in this scope
    2 | using namespace std;int d[1<<18]={INT_MAX},n,q,r,x,y,i;int m(int l,int r,int k){if(x<=l&&r<=y)return d[k];if(y<=l||r<=x)return INT_MAX;return min(m(l,(l+r)/2,k*2+1),m((l+r)/2,r,k*2+2));}int main(){cin>>n>>q;r=2;while(r<n)r*=2;n=r;while(q--){scanf("%d%d%d",&r,&x,&y);if(r){y++;printf("%d\n",m(0,n,0));}else{i=x+n-1,d[i]=y;while(i)i=(i-1)/2,d[i]=min(d[i*2+1],d[i*2+2]);}}return 0;}
      |                                   ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;int d[1<<18]={INT_MAX},n,q,r,x,y,i;int m(int l,int r,int k){if(x<=l&&r<=y)return d[k];if(y<=l||r<=x)return INT_MAX;return min(m(l,(l+r)/2,k*2+1),m((l+r)/2,r,k*2+2));}int main(){cin>>n>>q;r=2;while(r<n)r*=2;n=r;while(q--){scanf("%d%d%d",&r,&x,&y);if(r){y++;printf("%d\n",m(0,n,0));}else{i=x+n-1,d[i]=y;while(i)i=(i-1)/2,d[i]=min(d[i*2+1],d[i*2+2]);}}return 0;}
a.cc: In function 'int m(int, int, int)':
a.cc:2:128: error: 'INT_MAX' was not declared in this scope
    2 | using namespace std;int d[1<<18]={INT_MAX},n,q,r,x,y,i;int m(int l,int r,int k){if(x<=l&&r<=y)return d[k];if(y<=l||r<=x)return INT_MAX;return min(m(l,(l+r)/2,k*2+1),m((l+r)/2,r,k*2+2));}int main(){cin>>n>>q;r=2;while(r<n)r*=2;n=r;while(q--){scanf("%d%d%d",&r,&x,&y);if(r){y++;printf("%d\n",m(0,n,0));}else{i=x+n-1,d[i]=y;while(i)i=(i-1)/2,d[i]=min(d[i*2+1],d[i*2+2]);}}return 0;}
      |                                                                                                                                ^~~~~~~
a.cc:2:128: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF = (1LL << 31) - 1;
const double EPS = 1e-9;

struct SegmentTree {
    const int INF = (1LL << 31) - 1;
    vector<int> node;
    int n;
    SegmentTree(vector<int> a) {
        int n_ = a.size();
        n = 1;
        while(n < n_) n <<= 1;
        node.resize(2 * n - 1, INF);
        for(int i = 0; i < n_; i++) {
            node[n - 1 + i] = a[i];
        }
        for(int i = n - 2; i >= 0; i--) {
            node[i] = min(node[2 * i + 1], node[2 * i + 2]);
        }
    }
    void update(int i, int x) {
        i = n - 1 + i;
        node[i] = x;
        while(i > 0) {
            i = (i - 1) / 2;
            node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
        }
    }
    int find(int a, int b, int k = 0, int l = 0, int r = n) {
        if (r <= a || b <= l) return INF;
        if (a <= l && r <= b) return node[k];

        int vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
        int vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
};

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<int> A(N, INF);
    SegmentTree seg(A);
    for (int q = 0; q < Q; q++) {
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0) {
            seg.update(x, y);
        } else {
            cout << seg.find(x, y + 1) << endl;
        }
    }

    return 0;
}

Compiler output:
a.cc:61:58: error: invalid use of non-static data member 'SegmentTree::n'
   61 |     int find(int a, int b, int k = 0, int l = 0, int r = n) {
      |                                                          ^
a.cc:40:9: note: declared here
   40 |     int n;
      |         ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

void input(int n, int *x) {
	for (int i = 0; i < n; i++)
		x[i] = INT_MAX;
}

void init(int *s, int *x, int idx, int left, int right) {
	if (left == right) {
		s[idx] = x[left];
		return;
	}
	int mid = (left + right) / 2;
	init(s, x, 2 * idx, left, mid);
	init(s, x, 2 * idx + 1, mid + 1, right);
	s[idx] = min(s[2 * idx], s[2 * idx + 1]);
	return;
}

void update(int *s, int idx, int left, int right, int p, int val) {
	if (left == right) {
		s[idx] = val;
		return;
	}
	int mid = (left + right) / 2;
	if (p <= mid)
		update(s, 2 * idx, left, mid, p, val);
	else
		update(s, 2 * idx + 1, mid + 1, right, p, val);
	s[idx] = min(s[2 * idx], s[2 * idx + 1]);
	return;
}

int query(int *s, int idx, int left, int right, int l, int r) {
	if (l <= left && r >= right)
		return s[idx];
	if (l > right || r < left)
		return INT_MAX;
	return min(query(s, 2 * idx, left, (left + right) / 2, l, r), query(s, 2 * idx + 1, (left + right) / 2 + 1, right, l, r));
}

int main() {
	int n, x[100000], *s, q;
	s = new int[262143];
	cin >> n >> q;
	input(n, x);
	init(s, x, 1, 1, n);
	for (q; q > 0; q--) {
		int com, a, b;
		cin >> com >> a >> b;
		if (com == 0)
			update(s, 1, 1, n, a + 1, b);
		else
			cout << query(s, 1, 1, n, a + 1, b + 1);
	}
	delete[] s;
	return 0;
}

Compiler output:
a.cc: In function 'void input(int, int*)':
a.cc:8:24: error: 'INT_MAX' was not declared in this scope
    8 |                 x[i] = INT_MAX;
      |                        ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 | 
a.cc: In function 'int query(int*, int, int, int, int, int)':
a.cc:41:24: error: 'INT_MAX' was not declared in this scope
   41 |                 return INT_MAX;
      |                        ^~~~~~~
a.cc:41:24: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

// const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);
const ll MD = 1000000007LL;
// fprintf(stderr, "%d %lld \n", x, xll);

class SegTree{

public:

	int n;
	vector<int> dat;
	vector<int> _kl;
	vector<int> _kr;

	int dummy = 2147483647;

	SegTree(int _n){
		init(_n);
	}

	void init(int n_){
		// set n
		n = 1;
		while(n < n_) n *=2;

		// initialize vectors
		dat = vector<int>(2 * n - 1);
		kl = vector<int>(2 * n - 1);
		kr = vector<int>(2 * n - 1);

		// initialize kl, kr
		rep(k, 2 * n - 1){
			if(is_root(k)){
				_kl[k] = 0;
				_kr[k] = n;
			}
			else{
				if(is_cl(k)) {
					_kl[k] = _kl[pa(k)];
					_kr[k] = (_kl[pa(k)] + _kr[pa(k)]);
				}
				else{
					_kl[k] = (_kl[pa(k)] + _kr[pa(k)]);
					_kr[k] = _kr[pa(k)];
				}
			}
		}

		// initialize values
		rep(i, 2 * n - 1) dat[i] = dummy;
	}

	int pos(int i){ return i + n - 1; }
	int pa(int k){ return (k - 1) / 2; }
	int cl(int k){ return k * 2 + 1; }
	int cr(int k){ return k * 2 + 2; }
	bool is_root(int k){ return k == 0; }
	bool is_cl(int k){
		if(is_root(k)) return false;
		return cl(pa(k)) == k;
	}

	void update(int i, int a){
		int k = pos(i);
		dat[k] = a;
		while(!is_root(k)){
			k = pa(k);
			dat[k] = min(dat[cl(k)], dat[cr(k)]);
		}
	}

	int query(int il, int ir){
		return _query(il, ir, 0);
	}

	int _query(int il, int ir, int k){
		int kl = _kl[k];
		int kr = _kr[k];
		if(kr <= il || ir <= kl) return dummy;
		if(il <= kl && kr <= ir) return dat[k];
		else{
			int vl = _query(il, ir, cl(k));
			int vr = _query(il, ir, cr(k));
			return min(vl, vr);
		}
	}
};

int N, Q;
int main() {
	cin >> N >> Q;

	SegTree ST(N);

	rep(q, Q){
		int c, x, y;
		cin >> c >> x >> y;

		if(c == 0){
			// update
			ST.update(x, y);
		}
		else{
			// find
			cout << ST.query(x, y+1) << endl;
		}
	}
}

Compiler output:
a.cc: In member function 'void SegTree::init(int)':
a.cc:51:17: error: 'kl' was not declared in this scope; did you mean '_kl'?
   51 |                 kl = vector<int>(2 * n - 1);
      |                 ^~
      |                 _kl
a.cc:52:17: error: 'kr' was not declared in this scope; did you mean '_kr'?
   52 |                 kr = vector<int>(2 * n - 1);
      |                 ^~
      |                 _kr
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

// const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);
const ll MD = 1000000007LL;
// fprintf(stderr, "%d %lld \n", x, xll);

class SegTree{

public:

	int n;
	vector<int> dat;
	vector<int> _kl;
	vector<int> _kr;

	int dummy = 2147483647;

	SegTree(int _n){
		init(_n);
	}

	void init(int n_){
		// set n
		n = 1;
		while(n < n_) n *=2;
        int nn = 2 * n - 1;

		// initialize vectors
		dat = vector<int>(nn);
		_kl = vector<int>(nn);
		_kr = vector<int>(nn);

		// initialize kl, kr
		rep(k, nn){
			if(is_root(k)){
				_kl[k] = 0;
				_kr[k] = n;
			}
			else{
				if(is_cl(k)) {
					_kl[k] = _kl[pa(k)];
					_kr[k] = (_kl[pa(k)] + _kr[pa(k)]);
				}
				else{
					_kl[k] = (_kl[pa(k)] + _kr[pa(k)]);
					_kr[k] = _kr[pa(k)];
				}
			}
		}

		// initialize values
		rep(k, nn) dat[i] = dummy;
	}

	int pos(int i){ return i + n - 1; }
	int pa(int k){ return (k - 1) / 2; }
	int cl(int k){ return k * 2 + 1; }
	int cr(int k){ return k * 2 + 2; }
	bool is_root(int k){ return k == 0; }
	bool is_cl(int k){
		if(is_root(k)) return false;
		return cl(pa(k)) == k;
	}

	void update(int i, int a){
		int k = pos(i);
		dat[k] = a;
		while(!is_root(k)){
			k = pa(k);
			dat[k] = min(dat[cl(k)], dat[cr(k)]);
		}
	}

	int query(int il, int ir){
		return _query(il, ir, 0);
	}

	int _query(int il, int ir, int k){
		int kl = _kl[k];
		int kr = _kr[k];
		if(kr <= il || ir <= kl) return dummy;
		if(il <= kl && kr <= ir) return dat[k];
		else{
			int vl = _query(il, ir, cl(k));
			int vr = _query(il, ir, cr(k));
			return min(vl, vr);
		}
	}
};

int N, Q;
int main() {
	cin >> N >> Q;

	SegTree ST(N);

	rep(q, Q){
		int c, x, y;
		cin >> c >> x >> y;

		if(c == 0){
			// update
			ST.update(x, y);
		}
		else{
			// find
			cout << ST.query(x, y+1) << endl;
		}
	}
}

Compiler output:
a.cc: In member function 'void SegTree::init(int)':
a.cc:74:32: error: 'i' was not declared in this scope
   74 |                 rep(k, nn) dat[i] = dummy;
      |                                ^
Language: C++

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

class RMQ {
  static const int MAXN=100000;
  static const int inf=INT_MAX;
private:
  int n;
  int dat[2*MAXN-1];
public:
  RMQ (int N) {
    init(N);
  }
  void init(int N) {
    n=1;
    while (n<N) {
      n*=2;
    }
    for (int i=0; i<2*n-1; i++) {
      dat[i]=inf;
    }
  }
  void update(int i,int x) {
    i+=n-1;
    dat[i]=x;
    while (i) {
      i=(i-1)/2;
      dat[i]=min(dat[2*i+1],dat[2*i+2]);
    }
  }
  int find (int s,int t,int k=0,int l=0,int r=n) {
    if (r<=s || t<=l) {
      return inf;
    }
    if (s<=l && r<=t) {
      return dat[k];
    } else {
      int m=(l+r)/2;
      int vl=find(s,t,k*2+1,l,m);
      int vr=find(s,t,k*2+2,m,r);
      return min(vl,vr);
    }
  }
  //int find(int s,int t) {
  // return find(s,t,0,0,n);
  // }
};
int main() {
  int n, q;
  cin >> n >> q;
  RMQ rmq(n);
  while (q--) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com) {
      printf("%d\n",rmq.find(x,y+1));
    } else {
      rmq.update(x,y);
    }
  }
  return 0;
}

Compiler output:
a.cc:31:47: error: invalid use of non-static data member 'RMQ::n'
   31 |   int find (int s,int t,int k=0,int l=0,int r=n) {
      |                                               ^
a.cc:8:7: note: declared here
    8 |   int n;
      |       ^
Language: C++

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

class RMQ {
  static const int MAXN=100000;
  static const int inf=INT_MAX;
private:
  static int n;
  int dat[2*MAXN-1];
public:
  RMQ (int N) {
    init(N);
  }
  void init(int N) {
    n=1;
    while (n<N) {
      n*=2;
    }
    for (int i=0; i<2*n-1; i++) {
      dat[i]=inf;
    }
  }
  void update(int i,int x) {
    i+=n-1;
    dat[i]=x;
    while (i) {
      i=(i-1)/2;
      dat[i]=min(dat[2*i+1],dat[2*i+2]);
    }
  }
  int find (int s,int t,int k=0,int l=0,int r=n) {
    if (r<=s || t<=l) {
      return inf;
    }
    if (s<=l && r<=t) {
      return dat[k];
    } else {
      int m=(l+r)/2;
      int vl=find(s,t,k*2+1,l,m);
      int vr=find(s,t,k*2+2,m,r);
      return min(vl,vr);
    }
  }
  //int find(int s,int t) {
  // return find(s,t,0,0,n);
  // }
};
int main() {
  int n, q;
  cin >> n >> q;
  RMQ rmq(n);
  while (q--) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com) {
      printf("%d\n",rmq.find(x,y+1));
    } else {
      rmq.update(x,y);
    }
  }
  return 0;
}

Compiler output:
/usr/bin/ld: /tmp/cc4FXkZR.o: warning: relocation against `_ZN3RMQ1nE' in read-only section `.text._ZN3RMQ6updateEii[_ZN3RMQ6updateEii]'
/usr/bin/ld: /tmp/cc4FXkZR.o: in function `main':
a.cc:(.text+0x9b): undefined reference to `RMQ::n'
/usr/bin/ld: /tmp/cc4FXkZR.o: in function `RMQ::init(int)':
a.cc:(.text._ZN3RMQ4initEi[_ZN3RMQ4initEi]+0xd): undefined reference to `RMQ::n'
/usr/bin/ld: a.cc:(.text._ZN3RMQ4initEi[_ZN3RMQ4initEi]+0x19): undefined reference to `RMQ::n'
/usr/bin/ld: a.cc:(.text._ZN3RMQ4initEi[_ZN3RMQ4initEi]+0x21): undefined reference to `RMQ::n'
/usr/bin/ld: a.cc:(.text._ZN3RMQ4initEi[_ZN3RMQ4initEi]+0x27): undefined reference to `RMQ::n'
/usr/bin/ld: /tmp/cc4FXkZR.o:a.cc:(.text._ZN3RMQ4initEi[_ZN3RMQ4initEi]+0x50): more undefined references to `RMQ::n' follow
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
Language: C++

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

class RMQ {
  static const int MAXN=100000;
  int n;
  int dat[2*MAXN-1];
  RMQ(int n_){init(n_);}
  void init(int n_){
    n=1;
    while(n<n_) n*=2;
    for(int i=0;i<2*n-1;i++) dat[i]=INT_MAX;
  }
  void update(int k,int a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
  }
  int query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l) return INT_MAX;
    if(a<=l&&r<=b) return dat[k];
    else{
      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);
    }
  }
  int query(int a,int b){
    return query(a,b,0,0,n);
  }
};
int main(){
  int n,q;
  cin>>n>>q;
  RMQ rmq(n);
  for(int i=0;i<q;i++){
    int c,x,y;
    cin>>c>>x>>y;
    if(c) cout<<rmq.query(x,y+1)<<endl;
    else rmq.update(x,y);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:12: error: 'RMQ::RMQ(int)' is private within this context
   38 |   RMQ rmq(n);
      |            ^
a.cc:8:3: note: declared private here
    8 |   RMQ(int n_){init(n_);}
      |   ^~~
a.cc:42:26: error: 'int RMQ::query(int, int)' is private within this context
   42 |     if(c) cout<<rmq.query(x,y+1)<<endl;
      |                 ~~~~~~~~~^~~~~~~
a.cc:31:7: note: declared private here
   31 |   int query(int a,int b){
      |       ^~~~~
a.cc:43:20: error: 'void RMQ::update(int, int)' is private within this context
   43 |     else rmq.update(x,y);
      |          ~~~~~~~~~~^~~~~
a.cc:14:8: note: declared private here
   14 |   void update(int k,int a){
      |        ^~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#define MAX_INT 2147483647
using namespace std;
int main(){
  int n,q;
  scanf("%d %d",&n,&q);
  vector<int>a(n+1);
  for(int i=0;i<n+1;i++)
    a[i]=MAX_INT;
  for(int i=0;i<q;i++){
    int com,x,y;
    scanf("%d %d %d",&com,&x,&y);
    if(com){
      int M=MAX_INT;
      for(int j=;j<flag.size();j++)
	M=min(M,a[j]);
      printf("%d\n",M);
    }else{
      a[x]=y;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: expected primary-expression before ';' token
   18 |       for(int j=;j<flag.size();j++)
      |                 ^
a.cc:18:20: error: 'flag' was not declared in this scope
   18 |       for(int j=;j<flag.size();j++)
      |                    ^~~~
Language: C++

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

template <typename T> struct SegmentTree {
  struct Node {
    T v;
    Node(T v) : v(v) {}

    Node operator*(const Node &r) const {
      return Node(min(v, r.v));
    }
  };

  Node e = Node((1ll << 31) - 1);
  size_t sz;
  vector<Node> seg;

  SegmentTree(int n) : sz(r(1 << (32 - __builtin_clz(n - 1)))), seg(2 * sz - 1, e) {}

  void update(int k, const Node &x) {
    k += sz - 1;
    seg[k] = x;
    while (k) {
      k = (k - 1) / 2;
      seg[k] = seg[2 * k + 1] * seg[2 * k + 2];
    }
  }

  Node query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return e;
    if (a <= l && r <= b) return seg[k];
    return query(a, b, 2 * k + 1, l, (l + r) / 2) * query(a, b, 2 * k + 2, (l + r) / 2, r);
  }

  void update(int k, T x) {
    update(k, Node(x));
  }

  T query(int a, int b) {
    return query(a, b, 0, 0, sz).v;
  }
};

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

  SegmentTree seg(n);
  while (q--) {
    int c, x, y;
    cin >> c >> x >> y;

    if (c) {
      cout << seg.query(x, y + 1);
    } else {
      seg.update(x, y);
    }
  }
}

Compiler output:
a.cc: In constructor 'SegmentTree<T>::SegmentTree(int)':
a.cc:18:27: error: there are no arguments to 'r' that depend on a template parameter, so a declaration of 'r' must be available [-fpermissive]
   18 |   SegmentTree(int n) : sz(r(1 << (32 - __builtin_clz(n - 1)))), seg(2 * sz - 1, e) {}
      |                           ^
a.cc:18:27: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc: In function 'int main()':
a.cc:48:20: error: class template argument deduction failed:
   48 |   SegmentTree seg(n);
      |                    ^
a.cc:48:20: error: no matching function for call to 'SegmentTree(int&)'
a.cc:18:3: note: candidate: 'template<class T> SegmentTree(int)-> SegmentTree<T>'
   18 |   SegmentTree(int n) : sz(r(1 << (32 - __builtin_clz(n - 1)))), seg(2 * sz - 1, e) {}
      |   ^~~~~~~~~~~
a.cc:18:3: note:   template argument deduction/substitution failed:
a.cc:48:20: note:   couldn't deduce template parameter 'T'
   48 |   SegmentTree seg(n);
      |                    ^
a.cc:4:30: note: candidate: 'template<class T> SegmentTree(SegmentTree<T>)-> SegmentTree<T>'
    4 | template <typename T> struct SegmentTree {
      |                              ^~~~~~~~~~~
a.cc:4:30: note:   template argument deduction/substitution failed:
a.cc:48:20: note:   mismatched types 'SegmentTree<T>' and 'int'
   48 |   SegmentTree seg(n);
      |                    ^
Language: C++

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

template <typename T> struct SegmentTree {
  struct Node {
    T v;
    Node(T v) : v(v) {}

    Node operator*(const Node &r) const {
      return Node(min(v, r.v));
    }
  };

  Node e = Node((1ll << 31) - 1);
  size_t sz;
  vector<Node> seg;

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

  void update(int k, const Node &x) {
    k += sz - 1;
    seg[k] = x;
    while (k) {
      k = (k - 1) / 2;
      seg[k] = seg[2 * k + 1] * seg[2 * k + 2];
    }
  }

  Node query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return e;
    if (a <= l && r <= b) return seg[k];
    return query(a, b, 2 * k + 1, l, (l + r) / 2) * query(a, b, 2 * k + 2, (l + r) / 2, r);
  }

  void update(int k, T x) {
    update(k, Node(x));
  }

  T query(int a, int b) {
    return query(a, b, 0, 0, sz).v;
  }
};

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

  SegmentTree seg(n);
  while (q--) {
    int c, x, y;
    cin >> c >> x >> y;

    if (c) {
      cout << seg.query(x, y + 1);
    } else {
      seg.update(x, y);
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:20: error: class template argument deduction failed:
   48 |   SegmentTree seg(n);
      |                    ^
a.cc:48:20: error: no matching function for call to 'SegmentTree(int&)'
a.cc:18:3: note: candidate: 'template<class T> SegmentTree(int)-> SegmentTree<T>'
   18 |   SegmentTree(int n) : sz(1 << (32 - __builtin_clz(n - 1))), seg(2 * sz - 1, e) {}
      |   ^~~~~~~~~~~
a.cc:18:3: note:   template argument deduction/substitution failed:
a.cc:48:20: note:   couldn't deduce template parameter 'T'
   48 |   SegmentTree seg(n);
      |                    ^
a.cc:4:30: note: candidate: 'template<class T> SegmentTree(SegmentTree<T>)-> SegmentTree<T>'
    4 | template <typename T> struct SegmentTree {
      |                              ^~~~~~~~~~~
a.cc:4:30: note:   template argument deduction/substitution failed:
a.cc:48:20: note:   mismatched types 'SegmentTree<T>' and 'int'
   48 |   SegmentTree seg(n);
      |                    ^
Language: C++

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

const int inf = INT_MAX;

struct SegmentTree {
  size_t n;
  vector<int> v;

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

  void update(int k, int x) {
    k += n - 1;
    v[k] = x;
    while (k) {
      k = (k - 1) / 2;
      v[k] = min(v[2 * k + 1], v[2 * k + 2]);
    }
  }

  int query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return inf;
    if (a <= l && r <= b) return v[k];
    return min(query(a, b, 2 * k + 1, l, (l + r) / 2), qury(a, b, 2 * k + 2, (l + r) / 2, r));
  }

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

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

  SegmentTree seg(n);
  while (q--) {
    int c, x, y;
    cin >> c >> x >> y;

    if (c) {
      cout << seg.query(x, y + 1) << endl;
    } else {
      seg.update(x, y);
    }
  }
}

Compiler output:
a.cc: In member function 'int SegmentTree::query(int, int, int, int, int)':
a.cc:24:56: error: 'qury' was not declared in this scope; did you mean 'query'?
   24 |     return min(query(a, b, 2 * k + 1, l, (l + r) / 2), qury(a, b, 2 * k + 2, (l + r) / 2, r));
      |                                                        ^~~~
      |                                                        query
Language: C++

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

struct Node {
  int v;
  Node(int v) : v(v) {}

  Node operator*(const Node &r) const {
    return Node(min(v, r.v));
  }
} e((1ll << 31) - 1);

struct SegmentTree {
  size_t n;
  vector<Node> seg;

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

  void update(int k, const Node &x) {
    k += sz - 1;
    seg[k] = x;
    while (k) {
      k = (k - 1) / 2;
      seg[k] = seg[2 * k + 1] * seg[2 * k + 2];
    }
  }

  Node query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return e;
    if (a <= l && r <= b) return seg[k];
    return query(a, b, 2 * k + 1, l, (l + r) / 2) * query(a, b, 2 * k + 2, (l + r) / 2, r);
  }

  void update(int k, int x) {
    update(k, Node(x));
  }

  int query(int a, int b) {
    return query(a, b, 0, 0, sz).v;
  }
};

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

  SegmentTree seg(n);
  while (q--) {
    int c, x, y;
    cin >> c >> x >> y;
    if (c)
      cout << seg.query(x, y + 1) << endl;
    else
      seg.update(x, y);
  }
}

Compiler output:
a.cc: In constructor 'SegmentTree::SegmentTree(size_t)':
a.cc:17:70: error: class 'SegmentTree' does not have any field named 'v'
   17 |   SegmentTree(size_t size) : n(1 << (32 - __builtin_clz(size - 1))), v(2 * n - 1, e) {}
      |                                                                      ^
a.cc: In member function 'void SegmentTree::update(int, const Node&)':
a.cc:20:10: error: 'sz' was not declared in this scope
   20 |     k += sz - 1;
      |          ^~
a.cc: In member function 'int SegmentTree::query(int, int)':
a.cc:39:30: error: 'sz' was not declared in this scope
   39 |     return query(a, b, 0, 0, sz).v;
      |                              ^~