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

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;

const int N = 125252;
const int B = 252;
const int C = (N+B-1)/B;
const ll INF = 1ll<<60;

ll a[N];
ll b[C];
void update(int i, ll v){
	a[i] = v;
	int id = i/B;
	b[id] = INF;
	REP(j,B){
		b[id] = min(b[id], a[id*B+j]);
	}
}
ll qmin(int l, int r){
	ll ret = INF;
	if(r-l<=B){
		REP(i,r-l)ret = min(ret,a[l+i]);
		return ret;
	}
	while(l%B>0)ret = min(ret, a[l++]);
	while(r-l>=B){
		ret = min(ret, b[l/B]);
		l += B;
	}
	while(l<r)ret = min(ret, a[l++]);
	return ret;
}

int main(){
	int n,q;
	scanf("%d%d",&n,&q);
	REP(i,n)a[i] = 2147483647ll;
	REP(i,C)b[i] = 2147483647ll;
	while(q--){
		int t,x,y;
		scanf("%d%d%d",&t,&x,&y);
		if(t==0){
			update(x,y);
		}else{
			printf("%lld\n",qmin(l,r+1));
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:46: error: 'l' was not declared in this scope
   48 |                         printf("%lld\n",qmin(l,r+1));
      |                                              ^
a.cc:48:48: error: 'r' was not declared in this scope
   48 |                         printf("%lld\n",qmin(l,r+1));
      |                                                ^
Language: C++

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

const int INF = INT_MAX;
int N, Q;

struct SegmentTree {
private:
    int n;
    vector <int> node;

public:
    SegmentTree(vector <int> v) {
        int sz = v.size();
        n = 1;
        while (n < sz) n *= 2;
        node.resize(2*n-1, INF);
        for (int i = 0; i < sz; i++) node[i+n-1] = v[i];
        for (int i = n-2; i >= 0; i--) node[i] = min(node[2*i+1], node[2*i+2]);
    }

    void update(int x, int val) {
        x += n - 1;
        node[x] = val;
        while (x > 0) {
            x = (x - 1) / 2;
            node[x] = min(node[2*x+1], node[2*x+2]);
        }
    }

    int getmin(int a, int b, int k=0, int l=0, int r=-1) {
        if (r < 0) r = n;
        if (r <= a || b <= l) return INF;
        if (a <= l && r <= b) return node[k];
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
    }
};

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

    cin >> N >> Q;
    SegmentTree seg(vector<int>(N, INF));
    for (int i = 0; i < Q; i++) {
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0) {
            seg.update(x, y);
        } else {
            cout << seg.getmin(x, y+1) << "\n";
        }
    }

    return 0;
}


Compiler output:
a.cc:15:17: error: 'INT_MAX' was not declared in this scope
   15 | const int INF = INT_MAX;
      |                 ^~~~~~~
a.cc:12:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   11 | #include <map>
  +++ |+#include <climits>
   12 | typedef long long ll;
Language: C++

#include <btis/stdc++.h>

using namespace std;

struct Segtree {
    int n;
    vector<int> node;
    SegTree(int sz) {
        n = 1;
        while (n < sz) n *= 2;
        node.resize(2 * n - 1, INT_MIN);
    }
    void update(int p, int v) {
        p += n - 1;
        node[p] = v;
        while (p) {
            p = (p - 1) / 2;
            node[p] = min(node[2 * p + 1], node[2 * p + 2]);
        }
    }
    int get(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (b <= l && r <= a) return INT_MIN;
        if (a <= l && r <= b) return node[k];
        return min(get(a, b, k * 2 + 1, l, (l+r) / 2), get(a, b, k * 2 + 2, (l+r) / 2, r));
        
    }
};

int main()
{
    int n, q;
    cin >> n >> q;
    SegTree s(n);
    while (q--) {
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0) {
            s.update(x, y);
        } else {
            cout << s.get(x, y+1) << endl;
        }
    }
}


Compiler output:
a.cc:1:10: fatal error: btis/stdc++.h: No such file or directory
    1 | #include <btis/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;

struct Segtree {
    int n;
    vector<int> node;
    SegTree(int sz) {
        n = 1;
        while (n < sz) n *= 2;
        node.resize(2 * n - 1, INT_MIN);
    }
    void update(int p, int v) {
        p += n - 1;
        node[p] = v;
        while (p) {
            p = (p - 1) / 2;
            node[p] = min(node[2 * p + 1], node[2 * p + 2]);
        }
    }
    int get(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (b <= l && r <= a) return INT_MIN;
        if (a <= l && r <= b) return node[k];
        return min(get(a, b, k * 2 + 1, l, (l+r) / 2), get(a, b, k * 2 + 2, (l+r) / 2, r));
        
    }
};

int main()
{
    int n, q;
    cin >> n >> q;
    SegTree s(n);
    while (q--) {
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0) {
            s.update(x, y);
        } else {
            cout << s.get(x, y+1) << endl;
        }
    }
}


Compiler output:
a.cc:8:5: error: ISO C++ forbids declaration of 'SegTree' with no type [-fpermissive]
    8 |     SegTree(int sz) {
      |     ^~~~~~~
a.cc: In member function 'int Segtree::SegTree(int)':
a.cc:12:5: warning: no return statement in function returning non-void [-Wreturn-type]
   12 |     }
      |     ^
a.cc: In function 'int main()':
a.cc:34:5: error: 'SegTree' was not declared in this scope; did you mean 'Segtree'?
   34 |     SegTree s(n);
      |     ^~~~~~~
      |     Segtree
a.cc:39:13: error: 's' was not declared in this scope
   39 |             s.update(x, y);
      |             ^
a.cc:41:21: error: 's' was not declared in this scope
   41 |             cout << s.get(x, y+1) << endl;
      |                     ^
Language: C++

#include <vector>
#include <functional>
#include <algorithm>
#include <iostream>
#include <climits>
using namespace std;
#include "../strc_008_abst_segtree.cpp"

// Range Minimum Query
// query 1: update
// query 2: range minimum
void DSL_2_A() {
    int N, Q; cin >> N >> Q;
    SegmentTree<int, int> seg(N, INT_MAX,
                              [](int a, int b) { return b; },
                              [](int a, int b) { return min(a, b); });

    int indexed = 0;
    for(int i=0; i<Q; i++) {
        int query_type; cin >> query_type;
        int x, y; cin >> x >> y;
        if(query_type == 0) {
            x -= indexed;
            seg.update(x, y);
        }
        if(query_type == 1) {
            x -= indexed, y -= indexed;
            y++;
            cout << seg.query(x, y) << endl;
        }
    }
}

int main() {
    DSL_2_A();
    return 0;
}



Compiler output:
a.cc:7:10: fatal error: ../strc_008_abst_segtree.cpp: No such file or directory
    7 | #include "../strc_008_abst_segtree.cpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

const int MAX_N = 131072;
int n;
int dat[MAX_N * 2 - 1];
void init() {
    rep(i, 2 * MAX_N - 1) dat[i] = INT_MAX;
}
void update(int i, int x) {
    //高さ4の木
    //i = 2なら木ではindex 9
    i += n - 1;
    dat[i] = x;
    //cout << i << " " << x << endl;
    while (i > 0) {
        i = (i - 1) / 2; //登る
        dat[i] = min(dat[i * 2 + 1], dat[i * 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];
    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 main() {
    int q; cin >> n >> q;
    int tmp = 1; while (tmp < n) tmp *= 2;
    n = tmp;
    init(); //cin >> nのあとじゃないとsize?になるかも
    rep(i, q) {
        int com, x, y; cin >> com >> x >> y;
        if (com == 0) {
            update(x, y);
        } else {
            cout << query(x, y + 1, 0, 0, n) << endl;
        }
        //cout << endl;
        //rep(j, 2 * n + 1) cout << dat[j] << " "; cout << endl;
    }
}



Compiler output:
a.cc: In function 'void init()':
a.cc:30:36: error: 'INT_MAX' was not declared in this scope
   30 |     rep(i, 2 * MAX_N - 1) dat[i] = INT_MAX;
      |                                    ^~~~~~~
a.cc:14:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   13 | #include<cassert>
  +++ |+#include <climits>
   14 | using namespace std;
a.cc: In function 'int query(int, int, int, int, int)':
a.cc:44:34: error: 'INT_MAX' was not declared in this scope
   44 |     if (r <= a || b <= l) return INT_MAX;
      |                                  ^~~~~~~
a.cc:44:34: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<iostream>

using namespace std;

#define N 100000

int d[2*N-1];
int n;

void update(int i, int x){
  int ith = i+n-1;
  d[ith] = x;
  while(d[ith] < d[(ith-1)/2] && 0 <= ith){
    d[(ith-1)/2] = d[ith];
    ith = (ith-1)/2;
  }
}

int query(int a, int b, int k, int l, int r){
  int vl, vr;
  
  if (r <= a || b <= l) return INT_MAX;
  if (a <= l && r <= b) return d[k];
  
  vl = query(a, b, k*2 + 1, l,(l+r)/2);
  vr = query(a, b, k*2 + 2,(l+r)/2, r);
  
  return min(vl,vr);
}
int find(int s, int t){
  return query(s, t+1, 0, 0, n);
}



int powi(int x , int i){
  if (i == 0) return 1;
  return powi(x,i-1) * x;
}

void init(){
  int i = 1;
  while (i < n) i *= 2;
  n = i;
  for(i=0; i < 2*n-1; i++){
    d[i] = INT_MAX;
  }
}

void printTree(){
  int level = 1;
  for(int i=0; i < 2*n-1; i++){
    if (powi(2,level)-1 == i){
      cout << endl;
      level++;
    }
    if(d[i] == INT_MAX){
      printf("X ");
    }else{
      printf("%d ",d[i]);
    }
  }
  cout << endl;
}

int main(){
  int q;
  int c, s, t;
  cin >> n >> q;
  init();
  for(int i = 0;i < q;i++){
    cin >> c >> s >> t;
    if(c == 0) update(s,t);
    if(c == 1) printf("%d\n",find(s,t));
  }
  // printTree();
}



Compiler output:
a.cc: In function 'int query(int, int, int, int, int)':
a.cc:22:32: error: 'INT_MAX' was not declared in this scope
   22 |   if (r <= a || b <= l) return INT_MAX;
      |                                ^~~~~~~
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 | 
a.cc: In function 'void init()':
a.cc:46:12: error: 'INT_MAX' was not declared in this scope
   46 |     d[i] = INT_MAX;
      |            ^~~~~~~
a.cc:46:12: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc: In function 'void printTree()':
a.cc:57:16: error: 'INT_MAX' was not declared in this scope
   57 |     if(d[i] == INT_MAX){
      |                ^~~~~~~
a.cc:57:16: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<iostream>

using namespace std;

#define N 100000

int d[2*N-1];
int n;

void update(int i, int x){
  int ith = i+n-1;
  d[ith] = x;
  while(d[ith] < d[(ith-1)/2] && 0 <= ith){
    d[(ith-1)/2] = d[ith];
    ith = (ith-1)/2;
  }
}

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

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



int powi(int x , int i){
  if (i == 0) return 1;
  return powi(x,i-1) * x;
}

void init(){
  int i = 1;
  while (i < n) i *= 2;
  n = i;
  for(i=0; i < 2*n-1; i++){
    d[i] = INT_MAX;
  }
}

void printTree(){
  int level = 1;
  for(int i=0; i < 2*n-1; i++){
    if (powi(2,level)-1 == i){
      cout << endl;
      level++;
    }
    if(d[i] == INT_MAX){
      printf("X ");
    }else{
      printf("%d ",d[i]);
    }
  }
  cout << endl;
}

int main(){
  int q;
  int c, s, t;
  cin >> n >> q;
  init();
  for(int i = 0;i < q;i++){
    cin >> c >> s >> t;
    if(c == 0) update(s,t);
    if(c == 1) printf("%d\n",find(s,t));
  }
  return 0;
  // printTree();
}



Compiler output:
a.cc: In function 'int query(int, int, int, int, int)':
a.cc:22:32: error: 'INT_MAX' was not declared in this scope
   22 |   if (r <= a || b <= l) return INT_MAX;
      |                                ^~~~~~~
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 | 
a.cc: In function 'void init()':
a.cc:47:12: error: 'INT_MAX' was not declared in this scope
   47 |     d[i] = INT_MAX;
      |            ^~~~~~~
a.cc:47:12: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc: In function 'void printTree()':
a.cc:58:16: error: 'INT_MAX' was not declared in this scope
   58 |     if(d[i] == INT_MAX){
      |                ^~~~~~~
a.cc:58:16: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<iostream>

using namespace std;

#define N 100000
#define INF 2147483647
int d[2*N-1];
int n;

void update(int i, int x){
  int ith = i+n-1;
  d[ith] = x;
  while(d[ith] < d[(ith-1)/2] && 0 <= ith){
    d[(ith-1)/2] = d[ith];
    ith = (ith-1)/2;
  }
}

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

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



int powi(int x , int i){
  if (i == 0) return 1;
  return powi(x,i-1) * x;
}

void init(){
  int i = 1;
  while (i < n) i *= 2;
  n = i;
  for(i=0; i < 2*n-1; i++){
    d[i] = INT_MAX;
  }
}

void printTree(){
  int level = 1;
  for(int i=0; i < 2*n-1; i++){
    if (powi(2,level)-1 == i){
      cout << endl;
      level++;
    }
    if(d[i] == INF){
      printf("X ");
    }else{
      printf("%d ",d[i]);
    }
  }
  cout << endl;
}

int main(){
  int q;
  int c, s, t;
  cin >> n >> q;
  init();
  for(int i = 0;i < q;i++){
    cin >> c >> s >> t;
    if(c == 0) update(s,t);
    if(c == 1) printf("%d\n",find(s,t));
  }
  return 0;
  // printTree();
}



Compiler output:
a.cc: In function 'void init()':
a.cc:47:12: error: 'INT_MAX' was not declared in this scope
   47 |     d[i] = INT_MAX;
      |            ^~~~~~~
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 |
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

//半開区間なことに注意
//L<=P<R
template <typename Monoid>
class SegmentTree{
public:
    //コンストラクタ n:サイズ pr:初期値
    SegmentTree(ll n,Monoid pr){
        size = pow(2,ceil(log2(n)));
        vec.resize(2*size-1,pr);
    }

    //値の更新　pos:位置(0-indexed) v:更新後の値
    void Update(ll pos,Monoid v){
        ll index = size-1+pos;
        vec[index] = v;
        //上方向に更新
        while(index>0){
            index = (index-1)/2;
            //更新方法
            /*RMQ*/vec[index] = min(vec[index*2+1],vec[index*2+2]);
            /*RSQvec[index] = vec[index*2+1]+vec[index*2+2]*/
        }
    }

    //クエリの処理 L:区間左端 R:区間右端 index:添字(0)
    //begin:ノード左端(0) end:ノード右端(n)
    Monoid Query(ll L,ll R,ll index,ll begin,ll end){
        if (end<=L || R<=begin) {
            //区間に重ならない
            return INT_MAX;
        }
        if (L<=begin && end<=R){
            //完全に含む
            return vec[index];
        }
        Monoid retL = Query(L,R,index*2+1,begin,(begin+end)/2);
        Monoid retR = Query(L,R,index*2+2,(begin+end)/2,end);
        return min(retL,retR);
    }

    //L<=P<R
    Monoid Query(ll L,ll R){
        return Query(L,R,0,0,size);
    }

private:
    vector<Monoid> vec;
    ll size;
};


int main(){
    int n,q;
    cin >> n>>q;
    SegmentTree<ll> ST(n,pow(2,31)-1);
    for(int i=0;i<q;i++){
        ll com,x,y;
        cin >>com>>x>>y;
        if (com==0){
            ST.Update(x,y);
        }else {
            cout <<"::: "<< ST.Query(x,y+1)<<endl;
        }
    }
    return 0;
}


Compiler output:
a.cc: In constructor 'SegmentTree<Monoid>::SegmentTree(ll, Monoid)':
a.cc:15:27: error: there are no arguments to 'log2' that depend on a template parameter, so a declaration of 'log2' must be available [-fpermissive]
   15 |         size = pow(2,ceil(log2(n)));
      |                           ^~~~
a.cc:15:27: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc: In member function 'Monoid SegmentTree<Monoid>::Query(ll, ll, ll, ll, ll)':
a.cc:37:20: error: 'INT_MAX' was not declared in this scope
   37 |             return 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 | using namespace std;
a.cc: In function 'int main()':
a.cc:62:26: error: 'pow' was not declared in this scope
   62 |     SegmentTree<ll> ST(n,pow(2,31)-1);
      |                          ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <limits>
using namespace std;

typedef long long ll;

//半開区間なことに注意
//L<=P<R
template <typename Monoid>
class SegmentTree{
public:
    //コンストラクタ n:サイズ pr:初期値
    SegmentTree(ll n,Monoid pr){
        size = pow(2,ceil(log2(n)));
        vec.resize(2*size-1,pr);
    }

    //値の更新　pos:位置(0-indexed) v:更新後の値
    void Update(ll pos,Monoid v){
        ll index = size-1+pos;
        vec[index] = v;
        //上方向に更新
        while(index>0){
            index = (index-1)/2;
            //更新方法
            /*RMQ*/vec[index] = min(vec[index*2+1],vec[index*2+2]);
            /*RSQvec[index] = vec[index*2+1]+vec[index*2+2]*/
        }
    }

    //クエリの処理 L:区間左端 R:区間右端 index:添字(0)
    //begin:ノード左端(0) end:ノード右端(n)
    Monoid Query(ll L,ll R,ll index,ll begin,ll end){
        if (end<=L || R<=begin) {
            //区間に重ならない
            return INT_MAX;
        }
        if (L<=begin && end<=R){
            //完全に含む
            return vec[index];
        }
        Monoid retL = Query(L,R,index*2+1,begin,(begin+end)/2);
        Monoid retR = Query(L,R,index*2+2,(begin+end)/2,end);
        return min(retL,retR);
    }

    //L<=P<R
    Monoid Query(ll L,ll R){
        return Query(L,R,0,0,size);
    }

private:
    vector<Monoid> vec;
    ll size;
};


int main(){
    int n,q;
    cin >> n>>q;
    SegmentTree<ll> ST(n,pow(2,31)-1);
    for(int i=0;i<q;i++){
        ll com,x,y;
        cin >>com>>x>>y;
        if (com==0){
            ST.Update(x,y);
        }else {
            cout <<"::: "<< ST.Query(x,y+1)<<endl;
        }
    }
    return 0;
}


Compiler output:
a.cc: In member function 'Monoid SegmentTree<Monoid>::Query(ll, ll, ll, ll, ll)':
a.cc:39:20: error: 'INT_MAX' was not declared in this scope
   39 |             return INT_MAX;
      |                    ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <math.h>
  +++ |+#include <climits>
    5 | #include <limits>
Language: C++

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

template <typename Monoid>
struct SegmentTree{
private:
    int N;
    vector<Monoid> node;
    using F = function<Monoid(Monoid, Monoid)>;
    F f;
    Monoid e;

public:
    SegmentTree(){}
    SegmentTree(F f, Monoid e):f(f), e(e){}
    void init(int sz){
        N = 1;
        while(N < sz) N <<= 1;
        node.assign(2*N-1,e);
    }
    void build(vector<Monoid>& v){
        int sz = int(v.size());
        init(sz);
        for(int i=0; i<sz; i++){
            node[i+N-1] = v[i];
        }
        for(int i=N-2; i>=0; i--){
            node[i] = f(node[i*2+1], node[i*2+2]);
        }
    }
    void set_val(int k, Monoid x){
        k += N-1;
        node[k] = x;
        while(k > 0){
            k = (k-1)/2;
            node[k] = f(node[2*k+1], node[2*k+2]);
        }
    }
    // [a,b)
    Monoid query(int a, int b){return query(a, b, 0, 0, N);}
    Monoid query(int a, int b, int k, int l, int r){
        if(b <= l || r <= a) return e;
        if(a <= l && r <= b) return node[k];
        Monoid vl, vr;
        vl = query(a, b, 2*k+1, l, (l+r)/2);
        vr = query(a, b, 2*k+2, (l+r)/2, r);
        return f(vl, vr);
    }
};

int main() {
    auto f = [=](int a, int b){return min(a, b);};
    SegmentTree<int> seg(f,IINF);

    int n, q;
    cin >> n >> q;
    seg.init(n);
    for(int i=0; i<q; i++){
        int c, x, y;
        cin >> c >> x >> y;
        if(c){
            cout << seg.query(x, y+1) << endl;
        }
        else{
            seg.set_val(x, y);
        }
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:53:28: error: 'IINF' was not declared in this scope
   53 |     SegmentTree<int> seg(f,IINF);
      |                            ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

ll N,Q,c,x,y;
int n = 1;
vector<int> st;

void update(int i, int x){
    i += n - 1;
    st[i] = x;
    while(i > 0){
        i = (i-1) / 2;
        st[i] = min(st[i*2+1], st[i*2+2]);
    }
}

int find(int a, int b, int i, int l, int r){
    if(b <= l || r <= a) return INT_MAX;
    if(a <= l && r <= b) return st[i];
    int vl = find(a,b,i*2+1,l,(l+r)/2);
    int vr = find(a,b,i*2+2,(l+r)/2,r);
    return min(vl,vr);
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> N >> Q;
    // init //
    while(n < N) n *= 2;
    st.assign(n*2-1,INT_MAX);
    // init //

    REP(i,Q){
        cin >> c >> x >> y;
        if(c==0){
            update(x,y);
        } else {
            cout << find(x,y+1,0,0,n) << '\n';
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int find(int, int, int, int, int)':
a.cc:28:33: error: 'INT_MAX' was not declared in this scope
   28 |     if(b <= l || r <= a) return INT_MAX;
      |                                 ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <set>
  +++ |+#include <climits>
    5 | using namespace std;
a.cc: In function 'int main()':
a.cc:40:21: error: 'INT_MAX' was not declared in this scope
   40 |     st.assign(n*2-1,INT_MAX);
      |                     ^~~~~~~
a.cc:40:21: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define P pair<int, int>
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
const int MAX_N = 100001;
const int INF = 2147483647;

// 要素の数、区間などを何からの値を覚えておく配列
int n, q, v[2 * MAX_N - 1];

// 初期化
void init(int _n){
  n = 1;
  while(n < _n) n *= 2;
  REP(i, 2 * n - 1) v[i] = INF;
}

// 添字がkのものをaに更新
void update(int k, int a){
  k += n - 1;
  v[k] = a;
  while(k > 0){
    k = (k - 1) / 2;
    v[k] = min(v[k * 2 + 1], v[k * 2 + 2]);
  }
}

// [a, b)の最小値を求める
// kは今見ている添字、l, rはそれに対応する[l, r)
// 呼び出す時はquery(a, b, 0, 0, n)として呼ぶ
int query(int a, int b, int k, int l, int r){
  if(b <= l || a >= r) return INT_MAX;
  if(a <= l && b >= r) return v[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 min(vl, vr);
}

int main() {
  cin >>n >>q;
  init(n);
  REP(i, q){
    int Q, x, y;
    cin >>Q >>x >>y;
    if(Q)
      cout <<query(x, y + 1, 0, 0, n) <<endl;
    else
      update(x, y);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int query(int, int, int, int, int)':
a.cc:53:31: error: 'INT_MAX' was not declared in this scope
   53 |   if(b <= l || a >= r) return INT_MAX;
      |                               ^~~~~~~
a.cc:20:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   19 | #include <ctime>
  +++ |+#include <climits>
   20 | using namespace std;
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<algorithm>
const int MAX_N = 100001;
//const int INT_MAX = 100001;

int n, dat[2 * MAX_N - 1];

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

int main(){
	int q;
	scanf("%d %d", &n, &q);
	init(n);
	for (int i = 0; i < q; ++i){
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		if (a == 0){
			update(b, c);
		}
		else {
			//int query(b, c, 0, 0, n);
			printf("%d\n", query(b,c,0,0,n));
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'void init(int)':
a.cc:12:53: error: 'INT_MAX' was not declared in this scope
   12 |         for (int i = 0; i < 2 * n - 1; ++i)dat[i] = 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 | const int MAX_N = 100001;
a.cc: In function 'int query(int, int, int, int, int)':
a.cc:25:37: error: 'INT_MAX' was not declared in this scope
   25 |         if (r <= a || b <= l)return INT_MAX;
      |                                     ^~~~~~~
a.cc:25:37: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<algorithm>
const int MAX_N = 100001;
//const int INT_MAX = 100001;

int n, dat[2 * MAX_N - 1];

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

int main(){
	int q;
	scanf("%d %d", &n, &q);
	init(n);
	for (int i = 0; i < q; ++i){
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		if (a == 0){
			update(b, c);
		}
		else {
			//int query(b, c, 0, 0, n);
			printf("%d\n", query(b,c+1,0,0,n));
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'void init(int)':
a.cc:12:53: error: 'INT_MAX' was not declared in this scope
   12 |         for (int i = 0; i < 2 * n - 1; ++i)dat[i] = 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 | const int MAX_N = 100001;
a.cc: In function 'int query(int, int, int, int, int)':
a.cc:25:37: error: 'INT_MAX' was not declared in this scope
   25 |         if (r <= a || b <= l)return INT_MAX;
      |                                     ^~~~~~~
a.cc:25:37: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

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

#define loop(i,a,b) for(int i=a;i<int(b);i++)
#define rep(i,b) loop(i,0,b)

int const B = 1024;
template<class T>
struct RMQ {
    int n;
    enum : T { inf = INT_MAX };
    static T Bmin[B], dat[B][B];
    RMQ(int n_){
        n = n_;
        if(n%B) n += B-n%B;
        rep(i,B)rep(j,B) dat[i][j] = inf;
        rep(i,B) Bmin[i] = inf;
    }
    void set(int k, T x){
        get(k) = x;
        Bmin[k/B] = inf;
        rep(i,B) Bmin[k/B] = min(Bmin[k/B], get(k/B*B+i));
    }
    int & get(int k){
        return dat[k/B][k%B];
    }
    int rmq(int l, int r){
        T res = inf;
        if(l/B != r/B){
            while(l%B) res = min(res, get(l++));
            while(r%B) res = min(res, get(--r));
            loop(i,l/B,r/B) res = min(res, Bmin[i]);
        } else {
            while(l<r) res = min(res, get(l++));
        }
        return res;
    }
};

int main(){
    int n,q;
    cin >> n >> q;
    RMQ<int> rmq(n);
    rep(i,q){
        int c,x,y;
        cin >> c >> x >> y;
        if(c) cout << rmq.rmq(x,y+1) << endl;
        else rmq.set(x,y);
    }
}

Compiler output:
/usr/bin/ld: /tmp/cc2nTbbx.o: warning: relocation against `_ZN3RMQIiE4BminE' in read-only section `.text._ZN3RMQIiE3setEii[_ZN3RMQIiE3setEii]'
/usr/bin/ld: /tmp/cc2nTbbx.o: in function `RMQ<int>::RMQ(int)':
a.cc:(.text._ZN3RMQIiEC2Ei[_ZN3RMQIiEC5Ei]+0x80): undefined reference to `RMQ<int>::dat'
/usr/bin/ld: a.cc:(.text._ZN3RMQIiEC2Ei[_ZN3RMQIiEC5Ei]+0xbe): undefined reference to `RMQ<int>::Bmin'
/usr/bin/ld: /tmp/cc2nTbbx.o: in function `RMQ<int>::rmq(int, int)':
a.cc:(.text._ZN3RMQIiE3rmqEii[_ZN3RMQIiE3rmqEii]+0xe1): undefined reference to `RMQ<int>::Bmin'
/usr/bin/ld: /tmp/cc2nTbbx.o: in function `RMQ<int>::set(int, int)':
a.cc:(.text._ZN3RMQIiE3setEii[_ZN3RMQIiE3setEii]+0x47): undefined reference to `RMQ<int>::Bmin'
/usr/bin/ld: a.cc:(.text._ZN3RMQIiE3setEii[_ZN3RMQIiE3setEii]+0xa8): undefined reference to `RMQ<int>::Bmin'
/usr/bin/ld: a.cc:(.text._ZN3RMQIiE3setEii[_ZN3RMQIiE3setEii]+0xe0): undefined reference to `RMQ<int>::Bmin'
/usr/bin/ld: /tmp/cc2nTbbx.o: in function `RMQ<int>::get(int)':
a.cc:(.text._ZN3RMQIiE3getEi[_ZN3RMQIiE3getEi]+0x4c): undefined reference to `RMQ<int>::dat'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>

using namespace std;

const int update = 0;

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

	vector<int> seq(n, INT_MAX);
	while (q--) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com == update) {
			seq[x] = y;
		} else {
			int min = seq[x];
			for (int i = x + 1; i <= y; ++i) {
				if (seq[i] < min) min = seq[i];
			}
			cout << min << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:28: error: 'INT_MAX' was not declared in this scope
   12 |         vector<int> seq(n, INT_MAX);
      |                            ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 |
Language: C++

#include <iostream>
#include <vector>
using namespace std;

template<class T> class RangeMinQuery {
 public:
    vector<T> dat;
    int n;
    // you may need to change MAX!
    static T const MAX = 2147483647; //INT_MAX

    RangeMinQuery() {}
    RangeMinQuery(int N) {
        n = 1;
        while (n < N) n *= 2;
        dat.resize(2 * n - 1, MAX);
    };

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

    // get minimum val [a, b)
    T query(int a, int b) {
        return query(a, b, 0, 0, n);
    }

    T query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return MAX;
        if (a <= l && r <= b) return dat[k];

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

int main(void) {
    int n, q;
    RangeMinQuery<int> a(n);
    for (int i = 0; i < n; i++) a.update(i, i);
    for (int i = 0; i < n; i++) {
        int c, s, t;
        cin >> c >> s >> t;
        if (c == 0) a.update(s, t);
        else
            cout << a.find(s, t + 1) << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:23: error: 'class RangeMinQuery<int>' has no member named 'find'
   52 |             cout << a.find(s, t + 1) << endl;
      |                       ^~~~
Language: C++

using System;
using System.Collections.Generic;
public partial class LibraryOfDataStructures{
	public static void Main(){
		string[] line = System.Console.ReadLine().Split(' ');
		int n = int.Parse(line[0]);
		int p = int.Parse(line[1]);

		decimal[] dt = new decimal[n];

		decimal f = (decimal)(Math.Pow(2, 31) - 1);
		List<int> list = new List<int>();
		for (int i = 0; i < n; i++)
		{
			dt[i] = f;
		}

		for (int k = 0; k < p; k++)
		{
			string[] line2 = System.Console.ReadLine().Split(' ');
			int cmd = int.Parse(line2[0]);
			int a = int.Parse(line2[1]);
			int b = int.Parse(line2[2]);

			switch (cmd)
			{
				case 0:
					// update
					dt[a] = b;
					list.Add(a);
					break;
				case 1:
					// find
					decimal min = f;
					if (b - a < list.Count)
					{
						for (int l = a; l <= b; l++)
						{
							if (min > dt[l])
							{
								min = dt[l];
							}
							if (min == 0)
							{
								break;
							}
						}
					}
					else
					{
						foreach (int l in list)
						{
							if (l <= a && l <= b)
							{
								if (min > dt[l])
								{
									min = dt[l];
								}
								if (min == 0)
								{
									break;
								}
							}
						}
					}
					System.Console.WriteLine(min.ToString("0"));
					break;
			}
		}
	}
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public partial class LibraryOfDataStructures{
      | ^~~~~~
Language: C++


trait Monoid[A]{
	def op(a1: A, a2: A): A
	def zero: A
}

class PersistentSegmentTree[A](val numOfNode: Int, val M: Monoid[A]){

	sealed trait Tree{ val value: A }
	case object Empty extends Tree{ val value: A = M.zero }
	case class Node(value: A, left: Tree, right: Tree) extends Tree
	object Node {
		def apply(value: A) = new Node(value, Empty, Empty)
		def apply(l: Tree, r: Tree) = new Node(M.op(l.value,r.value),l,r)
	}

	private val nil: Node = Node(M.zero,Empty,Empty)
	private[this] var root: Tree = nil

	private def updateRec(id: Int, x:A, l: Int = 0, r: Int = numOfNode, t: Tree = root): Tree = {
		val m = (l + r)/2
		def branch(now: Node): Node = {
			if(r-l<=1)Node(M.op(now.value,x))
			else if(id < m)Node(updateRec(id,x,l,m, now.left), now.right)
			else Node(now.left,updateRec(id,x,m,r,now.right))
		}
		t match {
			case now:Node => branch(now)
			case now:Tree => branch(nil)
			case _ => nil
		}
	}

	def update(id: Int, x: A):Unit = {
		root = updateRec(id, x)
	}

	def query(a: Int, b: Int, l: Int = 0, r: Int = numOfNode, t: Tree = root): A = {
		val m = (l + r)/2
		t match {
			case now: Node => {
				if(b<=l || r<=a)M.zero
				else if(a<=l && r<=b)now.value
				else M.op(query(a,b,l,m,now.left),query(a,b,m,r,now.right))
			}
			case _ => M.zero
		}
	}
}

object Main {
  def main(args: Array[String]): Unit = {
  	val line = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  	val n = line(0)
  	val q = line(1)
  	val m = new Monoid[Int]{
  		def op(a1: Int, a2: Int): Int = a1 min a2
  		def zero: Int = Int.MaxValue
  	}

  	val segtree = new PersistentSegmentTree[Int](n,m)

  	for(i <- 1 to q){
  		val input = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  		val x = input(1)
  		val y = input(2)
  		if(input(0)==0)segtree.update(x,y)
  		else println(segtree.query(x,y+1))
  	}
  }
}

Compiler output:
a.cc:2:1: error: 'trait' does not name a type
    2 | trait Monoid[A]{
      | ^~~~~
a.cc:7:28: error: structured binding declaration cannot have type 'PersistentSegmentTree'
    7 | class PersistentSegmentTree[A](val numOfNode: Int, val M: Monoid[A]){
      |                            ^~~
a.cc:7:28: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:7:32: error: 'val' was not declared in this scope
    7 | class PersistentSegmentTree[A](val numOfNode: Int, val M: Monoid[A]){
      |                                ^~~
a.cc:7:52: error: 'val' was not declared in this scope
    7 | class PersistentSegmentTree[A](val numOfNode: Int, val M: Monoid[A]){
      |                                                    ^~~
a.cc:7:28: error: invalid initializer for structured binding declaration
    7 | class PersistentSegmentTree[A](val numOfNode: Int, val M: Monoid[A]){
      |                            ^~~
a.cc:7:69: error: expected ';' before '{' token
    7 | class PersistentSegmentTree[A](val numOfNode: Int, val M: Monoid[A]){
      |                                                                     ^
a.cc:51:1: error: 'object' does not name a type
   51 | object Main {
      | ^~~~~~
Language: C++

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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define rei(n) for(int i=0;i<(int)n;i++)
#define rel(n) for(int l=0;l<(int)n;l++)
#define al(s) s.begin(),s.end()

typedef pair<int, int> pi;
typedef pair<pi, pi> ppi;
typedef pair<int, ppi> pipp;
typedef pair<int, pi> pip;

struct SegTree
{
	int N;
	vector<int> Seg;
	void init(int n)
	{
		N = 1;
		while (N < n)N *= 2;
		for (int i = 0; i < N*2; i++)
		{
			Seg.push_back(INT_MAX);
		}
		
	}
	
	void update(int k, int a)
	{	
		k = k - 1 + N;
		Seg[k] = a;
		while (k > 0)
		{
			k = (k - 1) / 2;
			Seg[k] = min(Seg[2 * k + 1], Seg[2 * k + 2]);
		}
	}
	int find_min(int a, int b)
	{
		return query(a, b, 0, 0, N);
	}

	int query(int a, int b, int k, int l, int r)
	{
		if (r <= a || l >= b)return INT_MAX;
		if (l>=a&&r<=b)
		{
			return Seg[k];
		}
		else
		{
			return min(query(a, b, k * 2 + 1, l, (r + l) / 2),
					   query(a, b, k * 2 + 2, (r + l) / 2, r));
		}
	}
};



int main()
{
	int n, q;
	cin >> n >> q;
	SegTree S;
	S.init(n);
	for (int i = 0; i < q; i++)
	{
		int x, y, a;
		cin >> a;
		cin >> x >> y;

		if (a)
		{
			cout << S.find_min(x, y+1) << endl;
		}
		else
		{
			S.update(x, y);
		}
	}
}

Compiler output:
a.cc: In member function 'void SegTree::init(int)':
a.cc:37:39: error: 'INT_MAX' was not declared in this scope
   37 |                         Seg.push_back(INT_MAX);
      |                                       ^~~~~~~
a.cc:14:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   13 | #include <set>
  +++ |+#include <climits>
   14 | using namespace std;
a.cc: In member function 'int SegTree::query(int, int, int, int, int)':
a.cc:59:45: error: 'INT_MAX' was not declared in this scope
   59 |                 if (r <= a || l >= b)return INT_MAX;
      |                                             ^~~~~~~
a.cc:59:45: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
 
const int MAX_N = 1 << 17;

int n, dat[2 * MAX_N -1];

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

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

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 IMAX;
	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 main(){
	int q;
	cin>>n>>q;
	int c,x,y;
	rep(i,q){
		cin>>c>>x>>y;
		if(c==0) update(x,y);
		else cout<<query(s,t+1,0,0,n)<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:34: error: 's' was not declared in this scope
   79 |                 else cout<<query(s,t+1,0,0,n)<<endl;
      |                                  ^
a.cc:79:36: error: 't' was not declared in this scope
   79 |                 else cout<<query(s,t+1,0,0,n)<<endl;
      |                                    ^
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
 
const int MAX_N = 1 << 17;

int n, dat[2 * MAX_N -1];

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

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

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 IMAX;
	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 main(){
	int q;
	cin>>n>>q;
	int c,x,y;
	init();
	rep(i,q){
		cin>>c>>x>>y;
		if(c==0) update(x,y);
		else cout<<query(x,y+1,0,0,n)<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:13: error: too few arguments to function 'void init(int)'
   76 |         init();
      |         ~~~~^~
a.cc:46:6: note: declared here
   46 | void init(int n_){
      |      ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i,n) for(ll i=0; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define TWO(x) (1ULL << x)

using namespace std;
using ll = long long;

template<class T>
class seg_tree{
private:
	vector<T> dat;
	void propagate(ll i){
		dat[i] = min(dat[i * 2 + 1], dat[i * 2 + 2]);
	}
	
	// [a,b)????????????????°?????????????
	// k     : ?????¨??????????????\????????????
	// [l,r) : k?????????????????????
	T query(ll a, ll b, ll k, ll l, ll r){
		if (r <= a || b <= l) return -1; //?????????
		if (a <= l && r <= b) return dat[k]; //[l,r) ??? [a,b)

		//[l,r)????????¨???[a,b)???????????????
		ll md = (l + r) / 2; //[l,md),[md,r)
		ll nl = k * 2 + 1, nr = nl + 1; //????????\???
		T lval = query(a, b, nl, l, md);
		T rval = query(a, b, nr, md, r);

		return min(lval, rval); // ?????????????°??????????????????¨
	}
public:
	void init(const vector<T> & v){
		ll n = 1; while(n < v.size()) n <<= 1;
		dat = vector<T>(2 * n - 1, -1);
		
		REP(i, v.size()) dat[n - 1 + i] = v[i];
		REP(i, n-2) propagate((n-2) - i);
	}
	
	void update(ll k, T val){
		k += n - 1; // seg_tree??????index?????????
		dat[k] = val;
		while(k > 0){
			k = (k - 1) / 2;
			propagate(k);
		}
	}
	
	T query(ll a, ll b) { return query(a, b, 0, 0, n); }
};

int main(){
	ll n, q;
	cin >> n >> q;
	seg_tree<ll> st(vector<ll>(n, TWO(31) - 1));
	REP(_, q){
		ll com, x, y;
		cin >> com >> x >> y;
		if(com==0){ // update
			cout << st.query(x, y+1); << endl;
		}else{ // find
			st.update(x, y);
		}
	}

	return 0;
}

Compiler output:
a.cc: In member function 'void seg_tree<T>::update(ll, T)':
a.cc:44:22: error: 'n' was not declared in this scope
   44 |                 k += n - 1; // seg_tree??????index?????????
      |                      ^
a.cc: In member function 'T seg_tree<T>::query(ll, ll)':
a.cc:52:56: error: 'n' was not declared in this scope
   52 |         T query(ll a, ll b) { return query(a, b, 0, 0, n); }
      |                                                        ^
a.cc: In function 'int main()':
a.cc:58:51: error: no matching function for call to 'seg_tree<long long int>::seg_tree(std::vector<long long int>)'
   58 |         seg_tree<ll> st(vector<ll>(n, TWO(31) - 1));
      |                                                   ^
a.cc:12:7: note: candidate: 'seg_tree<long long int>::seg_tree()'
   12 | class seg_tree{
      |       ^~~~~~~~
a.cc:12:7: note:   candidate expects 0 arguments, 1 provided
a.cc:12:7: note: candidate: 'seg_tree<long long int>::seg_tree(const seg_tree<long long int>&)'
a.cc:12:7: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'const seg_tree<long long int>&'
a.cc:12:7: note: candidate: 'seg_tree<long long int>::seg_tree(seg_tree<long long int>&&)'
a.cc:12:7: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'seg_tree<long long int>&&'
a.cc:63:51: error: expected primary-expression before '<<' token
   63 |                         cout << st.query(x, y+1); << endl;
      |                                                   ^~