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

#include <bits/stdc++.h>

using namespace std;
using i64 = long long int;
using ui64 = unsigned long long int;
using EDGE = vector<int>;
using GRAPH = vector<EDGE>;

////////////////////////////////
struct unionfind{
    std::vector<int> data;
    unionfind(int n):data(n,-1){};
    int root(int idx){
        return data[idx]<0?idx:data[idx]=root(data[idx]);
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
    bool join(int x,int y){
        x = root(x); y = root(y);
        if(x==y)return false;
        if(data[x]>data[y])std::swap(x,y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }
};

int main()
{
    int n,q;
    cin >> n >> q;
    unionfind_rank uf(n);
    for(int i=0;i<q;i++){
        int c,x,y;
        cin >> c >> x >> y;
        if(c == 0)uf.join(x,y);
        else cout << (int)uf.same(x,y) << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: 'unionfind_rank' was not declared in this scope; did you mean 'unionfind'?
   33 |     unionfind_rank uf(n);
      |     ^~~~~~~~~~~~~~
      |     unionfind
a.cc:37:19: error: 'uf' was not declared in this scope
   37 |         if(c == 0)uf.join(x,y);
      |                   ^~
a.cc:38:27: error: 'uf' was not declared in this scope
   38 |         else cout << (int)uf.same(x,y) << endl;
      |                           ^~
Language: C++

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

class quick_find {
	vector<int> rt;
	vector<vector<int>> vs;
public:
	quick_find(int n) : rt(n), vs(n) {
		for (int i = 0; i < n; i++) rt[i] = i, vs[i].push_back(i);
	}
	bool same(int a, int b) {
		return rt[a] == rt[b];
	}
	void unite(int a, int b) {
		a = rt[a], b = rt[b];
		if (a == b) return;
		if (vs[a].size() < vs[b].size()) swap(a, b);
		for (auto& v : vs[b]) rt[v] = a, vs[a].push_back(v);
	}
	int size(int a) {
		return vs[rt[a]].size();
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, q;
	cin >> n >> q;
	quick_find<int> qf(n);
	while (q--) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com == 0) {
			wqf.unite(x, y);
		}
		else {
			printf("%d\n", qf.find(x, y));
		}
	}
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'quick_find' is not a template
   30 |         quick_find<int> qf(n);
      |         ^~~~~~~~~~
a.cc:35:25: error: 'wqf' was not declared in this scope; did you mean 'qf'?
   35 |                         wqf.unite(x, y);
      |                         ^~~
      |                         qf
a.cc:38:43: error: 'class quick_find' has no member named 'find'
   38 |                         printf("%d\n", qf.find(x, y));
      |                                           ^~~~
Language: C++

#include<iostream>
#include<vector>

using namespace std;

class DisjointSet{
public:
  vector<int> rank, p;

  DisjointSet() {}
  DisjointSet(int size) {
    rank.resize(size, 0);
    p.resize(size, 0);
    for (int i = 0; i < size; i++) {
      makeSet(i);
    }
  }

  void makeSet(int x) {
    p[x] = x;
    rank[x] = 0;
  }

  bool same(int x, int y) {
    return findSet(x) == findSet(y);
  }

  void unite(int x, int y) {
    link(findSet(x), findSet(y));
  }

  void link(int x, int y) {
    if (rank[x] > rank[y]) {
      p[y] = x;
    } else {
      p[x] = y;
      if (rank[x] == rank[y]) {
        rank[y]++;
      }
    }
  }

  int findSet(int x) {
    if (x != p[x]) {
      p[x] = findSet(p[x]);
    }
    return p[x];
  }

}

int main() {
  int n, a, b, q;
  int t;

  cin >> n >> q;

  DisjointSet ds = DisjointSet(n);

  for (int i = 0; i < q; i++) {
    cin >> t >> a >> b;
    if (t == 0) {
      ds.unite(a, b);
    } else if (t == 1) {
      if (ds.same(a, b)) {
        cout << 1 << endl;
      } else {
        cout << 0 << endl;
      }
    }
  }

  return 0;
}


Compiler output:
a.cc:50:2: error: expected ';' after class definition
   50 | }
      |  ^
      |  ;
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);


struct UnionFind {
    //number of parents(par[i] = i => root)
    vector <int> par;
    //rank of tree
    vector <int> rank;

    UnionFind(int n) : par(n), rank(n, 1) {
        //initialize
        rep(n, i) par[i] = i;
    }

    //find root (keiroasshuku at the same time)
    int root(int x){
        if (par[x] == x) return x;[x]);
    }

    //unite
    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (rank[x] > rank[y]) swap(x, y);
        par[x] = y;
        if (rank[x] == rank[y]) rank[y]++;
    }

    //same tree?
    bool same(int x, int y){
        return root(x) == root(y);
    }
};


void solve(void){
	int N, Q;
	cin >> N >> Q;
	UnionFind uf(N);
	while(Q--) {
		int c, x, y;
		cin >> c >> x >> y;
		if (c) cout << uf.same(x, y) << endl;
		else uf.unite(x, y);
	}
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



Compiler output:
a.cc: In lambda function:
a.cc:45:38: error: expected '{' before ')' token
   45 |         if (par[x] == x) return x;[x]);
      |                                      ^
a.cc: In member function 'int UnionFind::root(int)':
a.cc:45:38: error: expected ';' before ')' token
a.cc:45:35: warning: control reaches end of non-void function [-Wreturn-type]
   45 |         if (par[x] == x) return x;[x]);
      |                                   ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,q,com,x,y;
  cin >> n >> q;
  vector<vector<int> > vertexs(n);
  vector<int> ans;
  for(int i = 0;i < q;i++){
    cin >> com >> x >> y;
    if(com){
      queue<int> que;
       vector<bool> DP(n,1);
      DP[x] = 0;
      que.push(x);
      while(que.size()){
        for(int j = 0;j < vertexs[que.front()].size();j++){
          if(DP[vertexs[que.front()][j]])que.push(vertexs[que.front()][j]);
          DP[vertexs[que.front()][j]] = 0;
          vertexs[x].push(vertexs[que.front()][j]);
          vertexs[vertexs[que.front()][j]].push(x);
          if(vertexs[que.front()][j] == y)break;
        }
        que.pop();
      }
      if(DP[y])ans.push_back(0);
      else ans.push_back(1);
    }
    else{
      vertexs[x].push_back(y);
      vertexs[y].push_back(x);
    }
  }
  for(int i = 0;i < ans.size();i++)cout << ans[i] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:22: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'push'
   19 |           vertexs[x].push(vertexs[que.front()][j]);
      |                      ^~~~
a.cc:20:44: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'push'
   20 |           vertexs[vertexs[que.front()][j]].push(x);
      |                                            ^~~~
Language: C++

#include <cstdio>
#include <set>
using namespace std;
struct UnionFind{
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	bool unionSet(int x,int y){
		x=root(x);y=root(y);
		if(x==y)return 0;
		if(data[y]<data[x])swap(x,y);
		data[x]+=data[y],data[y]=x;
		return 1;
	}
	bool findSet(int x,int y){
		return root(x)==root(y);
	}
	int root(int x){
		return data[x]<0 ? x : data[x]=root(data[x]);
	}
	int size(int x){
		return -data[root(x)];
	}
};
int main(){
	int n,q,c,x,y;
	scanf("%d%d",&n,&q);
	UnionFind uf(n);
	for(;q--;c?printf("%d\n",uf.findSet(x,y)):uf.unionSet(x,y))scanf("%d%d%d",&c,&x,&y);
}

Compiler output:
a.cc:5:9: error: 'vector' does not name a type
    5 |         vector<int> data;
      |         ^~~~~~
a.cc: In constructor 'UnionFind::UnionFind(int)':
a.cc:6:31: error: class 'UnionFind' does not have any field named 'data'
    6 |         UnionFind(int size) : data(size, -1) {}
      |                               ^~~~
a.cc: In member function 'bool UnionFind::unionSet(int, int)':
a.cc:10:24: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   10 |                 if(data[y]<data[x])swap(x,y);
      |                        ^
a.cc:10:32: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   10 |                 if(data[y]<data[x])swap(x,y);
      |                                ^
a.cc:11:21: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   11 |                 data[x]+=data[y],data[y]=x;
      |                     ^
a.cc:11:30: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   11 |                 data[x]+=data[y],data[y]=x;
      |                              ^
a.cc:11:38: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   11 |                 data[x]+=data[y],data[y]=x;
      |                                      ^
a.cc: In member function 'int UnionFind::root(int)':
a.cc:18:28: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   18 |                 return data[x]<0 ? x : data[x]=root(data[x]);
      |                            ^
a.cc:18:44: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   18 |                 return data[x]<0 ? x : data[x]=root(data[x]);
      |                                            ^
a.cc:18:57: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   18 |                 return data[x]<0 ? x : data[x]=root(data[x]);
      |                                                         ^
a.cc: In member function 'int UnionFind::size(int)':
a.cc:21:29: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   21 |                 return -data[root(x)];
      |                             ^
Language: Java

#include <stdio.h>
#include <stdlib.h>

int N = 0;
int Q = 0;
int S1[100000];
int S2[100000];
int Com = 0;
int V1 = 0;
int V2 = 0;
int V3 = 0;
void relate();
void query();
void merge();

void main(int argc,char* argv){
	int i = 0;
	scanf("%d %d",&N,&Q);
	for(i = 0; i<N ; i++){
		S1[i] = i;
		S2[i] = 0;
	}

	while(Q>0){
		scanf("%d",&Com);
		if(Com){
			scanf("%d %d",&V1, &V2);
			query();
		}else{
			scanf("%d %d %d",&V1 ,&V2, &V3);
			relate();
		}
		Q--;
	}
}

void relate(){
	//printf("R : %d %d %d\n", V1, V2, V3);
	if(S1[V1] == S1[V2]){
		return;
	}else{
		merge();
	}
}

void merge(){
	int i = 0;
	V3 = S2[V2] - V3 -S2[V1];
	V1 = S1[V1];
	V2 = S1[V2];
	for(i = 0; i<N ;i++){
		if(S1[i] == V1){
			//System.out.println("V1 = "+ V1 + "V2 = " + V2+ "V3 = " + V3);
			//printf("V1 = %d, V2 = %d, V3 = %d\n",V1, V2, V3);
			S1[i] = V2;
			S2[i] = S2[i] + V3;
			//printf("S2[%d] = %d\n", i, S2[i]);
			//System.out.println("S2[i] = "+ S2[i]);
		}else{
			continue;
		}
	}

}

void query(){
	//printf("Q : %d %d \n", V1, V2);
	if(S1[V1] == S1[V2]){
		printf("%d\n",S2[V2]-S2[V1]);
	}else{
		printf("?\n");
	}

}



Compiler output:
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <stdio.h>
         ^
Main.java:2: error: illegal character: '#'
#include <stdlib.h>
^
Main.java:5: error: unnamed classes are a preview feature and are disabled by default.
int Q = 0;
^
  (use --enable-preview to enable unnamed classes)
Main.java:6: error: class, interface, enum, or record expected
int S1[100000];
^
Main.java:7: error: class, interface, enum, or record expected
int S2[100000];
^
Main.java:16: error: <identifier> expected
void main(int argc,char* argv){
                       ^
Main.java:18: error: illegal start of expression
	scanf("%d %d",&N,&Q);
	              ^
Main.java:18: error: illegal start of expression
	scanf("%d %d",&N,&Q);
	                 ^
Main.java:25: error: illegal start of expression
		scanf("%d",&Com);
		           ^
Main.java:27: error: illegal start of expression
			scanf("%d %d",&V1, &V2);
			              ^
Main.java:27: error: illegal start of expression
			scanf("%d %d",&V1, &V2);
			                   ^
Main.java:30: error: illegal start of expression
			scanf("%d %d %d",&V1 ,&V2, &V3);
			                 ^
Main.java:30: error: illegal start of expression
			scanf("%d %d %d",&V1 ,&V2, &V3);
			                      ^
Main.java:30: error: illegal start of expression
			scanf("%d %d %d",&V1 ,&V2, &V3);
			                           ^
15 errors
Language: Java

#include <stdio.h>
#include <stdlib.h>

int N = 0;
int Q = 0;
int S1[100000];
int S2[100000];
int Com = 0;
int V1 = 0;
int V2 = 0;
int V3 = 0;
void relate();
void query();
void merge();

int main(){
	int i = 0;
	scanf("%d %d",&N,&Q);
	for(i = 0; i<N ; i++){
		S1[i] = i;
		S2[i] = 0;
	}

	while(Q>0){
		scanf("%d",&Com);
		if(Com){
			scanf("%d %d",&V1, &V2);
			query();
		}else{
			scanf("%d %d %d",&V1 ,&V2, &V3);
			relate();
		}
		Q--;
	}
}

void relate(){
	//printf("R : %d %d %d\n", V1, V2, V3);
	if(S1[V1] == S1[V2]){
		return;
	}else{
		merge();
	}
}

void merge(){
	int i = 0;
	V3 = S2[V2] - V3 -S2[V1];
	V1 = S1[V1];
	V2 = S1[V2];
	for(i = 0; i<N ;i++){
		if(S1[i] == V1){
			//System.out.println("V1 = "+ V1 + "V2 = " + V2+ "V3 = " + V3);
			//printf("V1 = %d, V2 = %d, V3 = %d\n",V1, V2, V3);
			S1[i] = V2;
			S2[i] = S2[i] + V3;
			//printf("S2[%d] = %d\n", i, S2[i]);
			//System.out.println("S2[i] = "+ S2[i]);
		}else{
			continue;
		}
	}

}

void query(){
	//printf("Q : %d %d \n", V1, V2);
	if(S1[V1] == S1[V2]){
		printf("%d\n",S2[V2]-S2[V1]);
	}else{
		printf("?\n");
	}

}



Compiler output:
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <stdio.h>
         ^
Main.java:2: error: illegal character: '#'
#include <stdlib.h>
^
Main.java:5: error: unnamed classes are a preview feature and are disabled by default.
int Q = 0;
^
  (use --enable-preview to enable unnamed classes)
Main.java:6: error: class, interface, enum, or record expected
int S1[100000];
^
Main.java:7: error: class, interface, enum, or record expected
int S2[100000];
^
Main.java:18: error: illegal start of expression
	scanf("%d %d",&N,&Q);
	              ^
Main.java:18: error: illegal start of expression
	scanf("%d %d",&N,&Q);
	                 ^
Main.java:25: error: illegal start of expression
		scanf("%d",&Com);
		           ^
Main.java:27: error: illegal start of expression
			scanf("%d %d",&V1, &V2);
			              ^
Main.java:27: error: illegal start of expression
			scanf("%d %d",&V1, &V2);
			                   ^
Main.java:30: error: illegal start of expression
			scanf("%d %d %d",&V1 ,&V2, &V3);
			                 ^
Main.java:30: error: illegal start of expression
			scanf("%d %d %d",&V1 ,&V2, &V3);
			                      ^
Main.java:30: error: illegal start of expression
			scanf("%d %d %d",&V1 ,&V2, &V3);
			                           ^
14 errors
Language: C++

#include <iostream>
#include <vector>
#include <conio.h>
using namespace std;

#define DEBUG 0

int getParent(int x, int weight);
void unite(int x, int y, int z);
int diff(int x, int y);
bool isSame(int x, int y);

int n, q;

vector<int> numbers;
vector<int> weights;
vector<int> num_rank;

int main() {

	cin >> n >> q;
	for (int i = 0; i < n; ++i) {
		numbers.push_back(i);
		weights.push_back(0);
		num_rank.push_back(0);
	}

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

		int com, x, y, z;

		cin >> com >> x >> y;

		switch(com) {

		case 0:
			cin >> z;
			unite(x, y, z);
			break;

		case 1:
			if (isSame(x, y))
				cout << diff(x, y) << endl;
			else
				cout << "?" << endl;
			break;


		}

#if DEBUG == 1

		if (com == 0)
			cout << "unite" << " : ";
		else
			cout << "     " << " : ";
		cout << x << " " << y << " " << z << endl;

		for(int i = 0; i < n; ++i) 
			cout << i << " ";
		cout << endl;
		for (int i = 0; i < n; ++i)
			cout << numbers[i] << " ";
		cout << endl;
		for (int i = 0; i < n; ++i)
			cout << weights[i] << " ";

		cout << endl << endl;
		getch();  
#endif
	}


	return 0;
}


int getParent(int x) {

	if (numbers[x]!= x) {
		int r = getParent(numbers[x]);

#if DEBUG == 1
		cout << "root weights = " << weights[numbers[x]] << endl;
#endif
		
		weights[x] += weights[numbers[x]];
		numbers[x] = r;
	}
	
	return numbers[x];

}

void unite(int x, int y, int w) {


	int x_p = getParent(numbers[x]);
	int y_p = getParent(numbers[y]);

	w += weights[x];
	w -= weights[y];

#if DEBUG == 1
	cout << x_p << "(" << weights[x_p] << "), " << y_p << "(" << weights[y_p] << ")" << endl;
#endif
	/*
	if (num_rank[x_p] < num_rank[y_p]) {
		swap(x_p, y_p);
		w *= -1;
	}
	if (num_rank[x_p] == num_rank[y_p])
		++num_rank[x_p];
	*/
	numbers[y_p] = x_p;
	weights[y_p] = w;
	

}

bool isSame(int x, int y) {

	return getParent(x) == getParent(y);

}


int diff(int x, int y) {

	getParent(x);
	getParent(y);

#if DEBUG == 1
	cout << y << "(" << weights[y] << ") - " << x << "(" << weights[x] << ")" << endl;
#endif
	
	return weights[y] - weights[x];

}


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

#include <cstdio>
#include <climits>
#include <map>
using namespace std;

map<int, int> w[100000];
int kakunin[100000];

int diff(int x, int y, int c){
    if(x==y)return 0;
    int ret = INT_MAX;
    int tmp;
    map<int,int>::iterator itr;
    for(itr=w[x].begin();itr!=w[x].end();itr++){
        if(kakunin[itr->first]==c)continue;
        kakunin[itr->first]=c;
        tmp = diff(itr->first,y,c);
        if(tmp<INT_MAX)ret = itr->second + tmp;
    }
    return ret;
}

int main(){
    int i,n,q,x,y,z,com;
    int c=0;
    memset(kakunin,0,sizeof(int)*100000);
    scanf("%d %d",&n,&q);
    for(i=0;i<q;i++){
        scanf("%d",&com);
        if(com){
            scanf("%d %d",&x,&y);
            c++;
            int ans = diff(x,y,c);
            if(ans==INT_MAX)printf("?\n");
            else printf("%d\n",ans);
        }else{
            scanf("%d %d %d",&x,&y,&z);
            w[x][y] = z;
            w[y][x] = -z;
        }
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'memset' was not declared in this scope
   26 |     memset(kakunin,0,sizeof(int)*100000);
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <map>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <memory>
#include <vector>
template <typename T>
class Option {
	Option() {};
	virtual void make_vtbl() {};
public:
	struct Some :Option<T> {
		T value;
		Some(const T &val) :value{ val } {}
	};
	struct NilClass :Option<T> {
		NilClass() {}
	};
	static Option<int>::NilClass Nil() {
		static Option<int>::NilClass nil = NilClass();
		return nil;
	}
};
class Weighted_union_find_tree {
	struct Pair {
		Weighted_union_find_tree *ptr;
		int differ;
	};
	Weighted_union_find_tree *_parent{ nullptr };
	int _diff{ 0 };
	Pair parent() {
		if (_parent == nullptr)
			return Pair{ this, 0 };
		else
		{
			auto prev = _parent->parent();
			_parent = prev.ptr;
			_diff += prev.differ;
			return Pair{ _parent, _diff };
		}
	}
public:
	void set_relate(Weighted_union_find_tree &greater, int weight) {
		if (is_related(greater)) return;
		auto other_pos = greater.parent();
		other_pos.ptr->_parent = this;
		other_pos.ptr->_diff = weight - other_pos.differ;
	}
	bool is_related(Weighted_union_find_tree &other) {
		return parent().ptr == other.parent().ptr;
	}
	std::shared_ptr<Option<int>> diff(Weighted_union_find_tree &other) {
		if (!is_related(other)) return std::make_shared<Option<int>::NilClass>(Option<int>::Nil());
		auto pos = parent();
		auto other_pos = other.parent();
		return std::make_shared<Option<int>::Some>(Option<int>::Some(other_pos.differ - pos.differ));
	}
};
int main() {
	int n, q;
	std::cin >> n >> q;
	std::vector<Weighted_union_find_tree> uft(n);
	int query, x, y, z;
	for (auto i = 0; i < q; ++i) {
		std::cin >> query;
		switch (query) {
		case 0: std::cin >> x >> y >> z;
			uft[x].set_relate(uft[y], z); break;
		default: std::cin >> x >> y;
			auto opt = std::dynamic_pointer_cast<Option<int>::Some>(uft[x].diff(uft[y]));
			if (opt == nullptr) {
				std::cout << '?' << std::endl;
			}
			else {
				std::cout << opt->value << std::endl;
			}
		}
	}
}


Compiler output:
a.cc:9:22: warning: invalid use of incomplete type 'class Option<T>'
    9 |         struct Some :Option<T> {
      |                      ^~~~~~~~~
a.cc:5:7: note: definition of 'class Option<T>' is not complete until the closing brace
    5 | class Option {
      |       ^~~~~~
a.cc:13:26: warning: invalid use of incomplete type 'class Option<T>'
   13 |         struct NilClass :Option<T> {
      |                          ^~~~~~~~~
a.cc:5:7: note: definition of 'class Option<T>' is not complete until the closing brace
    5 | class Option {
      |       ^~~~~~
a.cc:16:29: error: invalid use of incomplete type 'class Option<int>'
   16 |         static Option<int>::NilClass Nil() {
      |                             ^~~~~~~~
a.cc:5:7: note: declaration of 'class Option<int>'
    5 | class Option {
      |       ^~~~~~
a.cc: In member function 'std::shared_ptr<Option<int> > Weighted_union_find_tree::diff(Weighted_union_find_tree&)':
a.cc:50:101: error: 'Nil' is not a member of 'Option<int>'
   50 |                 if (!is_related(other)) return std::make_shared<Option<int>::NilClass>(Option<int>::Nil());
      |                                                                                                     ^~~
Language: C++

#include <iostream>
#include <memory>
#include <vector>
template <typename T>
class Option {
	Option() {};
	virtual void make_vtbl() {};
public:
	struct Some :Option<T> {
		T value;
		Some(const T &val) :value{ val } {};
	};
	struct NilClass :Option<T> {
		NilClass() {};
	};
	static Option<int>::NilClass Nil() {
		static Option<int>::NilClass nil = NilClass();
		return nil;
	};
};
class Weighted_union_find_tree {
	struct Pair {
		Weighted_union_find_tree *ptr;
		int differ;
	};
	Weighted_union_find_tree *_parent{ nullptr };
	int _diff{ 0 };
	Pair parent() {
		if (_parent == nullptr)
			return Pair{ this, 0 };
		else
		{
			auto prev = _parent->parent();
			_parent = prev.ptr;
			_diff += prev.differ;
			return Pair{ _parent, _diff };
		}
	};
public:
	void set_relate(Weighted_union_find_tree &greater, int weight) {
		if (is_related(greater)) return;
		auto other_pos = greater.parent();
		other_pos.ptr->_parent = this;
		other_pos.ptr->_diff = weight - other_pos.differ;
	};
	bool is_related(Weighted_union_find_tree &other) {
		return parent().ptr == other.parent().ptr;
	};
	std::shared_ptr<Option<int>> diff(Weighted_union_find_tree &other) {
		if (!is_related(other)) return std::make_shared<Option<int>::NilClass>(Option<int>::Nil());
		auto pos = parent();
		auto other_pos = other.parent();
		return std::make_shared<Option<int>::Some>(Option<int>::Some(other_pos.differ - pos.differ));
	};
};
int main() {
	int n, q;
	std::cin >> n >> q;
	std::vector<Weighted_union_find_tree> uft(n);
	int query, x, y, z;
	for (auto i = 0; i < q; ++i) {
		std::cin >> query;
		switch (query) {
		case 0: std::cin >> x >> y >> z;
			uft[x].set_relate(uft[y], z); break;
		default: std::cin >> x >> y;
			auto opt = std::dynamic_pointer_cast<Option<int>::Some>(uft[x].diff(uft[y]));
			if (opt == nullptr) {
				std::cout << '?' << std::endl;
			}
			else {
				std::cout << opt->value << std::endl;
			}
		}
	}
}


Compiler output:
a.cc:9:22: warning: invalid use of incomplete type 'class Option<T>'
    9 |         struct Some :Option<T> {
      |                      ^~~~~~~~~
a.cc:5:7: note: definition of 'class Option<T>' is not complete until the closing brace
    5 | class Option {
      |       ^~~~~~
a.cc:13:26: warning: invalid use of incomplete type 'class Option<T>'
   13 |         struct NilClass :Option<T> {
      |                          ^~~~~~~~~
a.cc:5:7: note: definition of 'class Option<T>' is not complete until the closing brace
    5 | class Option {
      |       ^~~~~~
a.cc:16:29: error: invalid use of incomplete type 'class Option<int>'
   16 |         static Option<int>::NilClass Nil() {
      |                             ^~~~~~~~
a.cc:5:7: note: declaration of 'class Option<int>'
    5 | class Option {
      |       ^~~~~~
a.cc: In member function 'std::shared_ptr<Option<int> > Weighted_union_find_tree::diff(Weighted_union_find_tree&)':
a.cc:50:101: error: 'Nil' is not a member of 'Option<int>'
   50 |                 if (!is_related(other)) return std::make_shared<Option<int>::NilClass>(Option<int>::Nil());
      |                                                                                                     ^~~
Language: Java

import java.util.* ;


/* An <O(N logN), O(1)> solution 
   processing time is <O(N logN) and query time is O(1) .
   
   Sparse Table (ST) algorithm :
   
   
   Range Minimum Query (RMQ) is used on arrays to find 
   the position of an element with the minimum value between 
   two specified indices.
 
 */
public class ABC
{
	int M[][] ;
  	void process(int[] A) 
  	{
 		int i , j , k ;
 		int n , m ,N;
 		N = A.length ;
 		for( i = 0 ; (1 << i) < N; i++) ;
 		if( ( 1<<(i-1)) == N )
 			i = i -1 ;
 		m = i ;
 		M = new int[N][i+1] ;
        // initialize M for the intervals of length one
        for (i = 0; i < N; i++)
            M[i][0] = i;
        // compute values from smaller to bigger
        for (j = 1; j <= m ; j++) 
        {
            for (i = 0; i < N; i++) 
            {
            	if( (i + (1 << (j - 1))) < N )
            	{
                	if (A[M[i][j - 1]] < A[M[i + (1 << (j - 1))][j - 1]])
                    	M[i][j] = M[i][j - 1];
                	else
                	    M[i][j] = M[i + (1 << (j - 1))][j - 1];
               	}
               	else
               		M[i][j] = M[i][j - 1];               	
            }
        }
       	for( i = 0 ; i < N ; i ++ )
        {
        	for( j = 0 ; j <= m ; j++ )
        	{
        		System.out.print(" "+A[M[i][j]]);
        	}
        	System.out.println();
        }
    }
    
	 int rMQ( int[] A, int i, int j) 
	 {
 		if( i == j )
 			return i ;
 			int k ;
        for( k = 0 ; (1<<k) < (j-i+1) ; k++ )
        {
        	if((1<<k)== (j-i+1) || (1<<(k+1)) > (j-i+1))
        		break ;
        }
        //System.out.println(i+" "+k+" "+(1<<k)+" "+(j - (1 << k) + 1));
        if (A[M[i][k]] <= A[M[j - (1 << k) + 1][k]])
            return M[i][k];
        else
            return M[j - (1 << k) + 1][k];
    }
    int ar[] ;
    public static void main( String s[] )
	{
		int ar[] = {2,5,1,4,9,3} ;
		ABC ob = new ABC() ;
		ob.process(ar);
		System.out.println(ar[ob.rMQ(ar,1,3)]);
		
	}
}

Compiler output:
Main.java:15: error: class ABC is public, should be declared in a file named ABC.java
public class ABC
       ^
1 error
Language: Java

import java.util.Scanner;

public class SegmentTreeRMQ {
	Scanner sc = new Scanner(System.in);

	int n, q;
	int dat[];

	void init() {
		dat = new int[n * 2 - 1];
		for (int i = 0; i < n * 2 - 1; i++) {
			dat[i] = Integer.MAX_VALUE;
		}
	}

	int query(int a, int b, int k, int l, int r) {
		if (a <= l && r <= b) return dat[k];
		if (r <= a || b <= l) return Integer.MAX_VALUE;
		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 Math.min(vl, vr);
	}

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

	void run() {
		int nn = sc.nextInt();
		n = 1;
		while (n < nn) n *= 2;
		q = sc.nextInt();

		init();
		while (q-- > 0) {
			int com = sc.nextInt();
			if (com == 0) {
				int i = sc.nextInt();
				int x = sc.nextInt();
				update(i, x);
			} else {
				int x = sc.nextInt();
				int y = sc.nextInt();
				System.out.println(query(x, y + 1, 0, 0, n));
			}
		}
	}

	public static void main(String[] args) {
		new SegmentTreeRMQ().run();
	}
}

Compiler output:
Main.java:3: error: class SegmentTreeRMQ is public, should be declared in a file named SegmentTreeRMQ.java
public class SegmentTreeRMQ {
       ^
1 error
Language: Java

package Pac1;

import java.util.Scanner;

class Node{
	int Hcover;
	int Lcover; // ????????????
	int min; // ?????????????°????
	Node parent;
	Node left;
	Node right;
	public Node(){
		parent=null;
		left=null;
		right=null;
	}

	public boolean between(int a){
		return (Lcover<=a)&&(a<=Hcover);
	}
}

public class DSL2 {
	static Node table[]=new Node[100001]; // ???????±?????????????

	public static Node cousei(Node n,int l,int h,int m,int LF,int RI){
		Node mob=new Node();
		mob.Hcover=h;
		mob.Lcover=l;
		mob.min=m;
		mob.parent=n;
		//System.out.println(l+" "+h+" "+m+" "+LF+" "+RI);
		if(h>l){
			//	if(h-l==1){
			//		mob.left=cousei(l, l, m,LF+1,RI);
			//		mob.right=cousei(h, h, m,LF,RI+1);
			//	}else{
			mob.left=cousei(mob,l, (h+l)/2, m,LF+1,RI);
			mob.right=cousei(mob,(h+l)/2+1, h, m,LF,RI+1);
		}
		if(h==l) table[h]=mob;
		return mob;
	}

	public static int find(Node n,int l,int h){
		if(n.Lcover==l&&n.Hcover==h)return n.min;

		if(n.left.between(l)&&n.left.between(h)){
			return find(n.left, l, n.left.Hcover);
		}else if(n.right.between(l)&&n.right.between(h)){
			return find(n.right, n.right.Lcover, h);
		}else{
			return Math.min(find(n.left, l, n.left.Hcover), find(n.right, n.right.Lcover,h));
		}
	}

	public static void update(Node n,int p,int x,int bef){
		for(Node it=n;it!=null;it=it.parent){
			if(it.min==bef){ // ?????´?????????????°?????????£???
				if(it.left.between(p)){
					it.min=Math.min(it.right.min, x);
				}	if(it.right.between(p)){
					it.min=Math.min(it.left.min, x);
				}
			}
		}
	}

	public static void main(String[] args) {
		Node root=new Node();
		int n;
		int q;
		Scanner stdin=new Scanner(System.in);
		n=stdin.nextInt();
		q=stdin.nextInt();
		root.min=(1<<31)-1;
		root.Hcover=n;
		root.Lcover=1;
		root.parent=null;
		root.left=cousei(root,1,(n+1)/2,root.min,0,0);
		root.right=cousei(root,(n+1)/2+1,n,root.min,0,0);
		for(int XXX=0;XXX<q;XXX++){
			int com=stdin.nextInt();
			int x=stdin.nextInt();
			int y=stdin.nextInt();
			x++;
			if(com==0){
				// update
				int m=table[x].min;
				table[x].min=y;
				update(table[x].parent, x, y,m);
			}else{
				// find
				y++;
				System.out.println(find(root, x, y));
			}
		}
	}

}

Compiler output:
Main.java:23: error: class DSL2 is public, should be declared in a file named DSL2.java
public class DSL2 {
       ^
1 error
Language: Java

package Pac1;

import java.util.Scanner;

class Node{
	int Hcover;
	int Lcover; 
	int min;
	Node parent;
	Node left;
	Node right;
	public Node(){
		parent=null;
		left=null;
		right=null;
	}

	public boolean between(int a){
		return (Lcover<=a)&&(a<=Hcover);
	}
}

public class DSL2 {
	static Node table[]=new Node[100001];

	public static Node cousei(Node n,int l,int h,int m,int LF,int RI){
		Node mob=new Node();
		mob.Hcover=h;
		mob.Lcover=l;
		mob.min=m;
		mob.parent=n;
		if(h>l){
			mob.left=cousei(mob,l, (h+l)/2, m,LF+1,RI);
			mob.right=cousei(mob,(h+l)/2+1, h, m,LF,RI+1);
		}
		if(h==l) table[h]=mob;
		return mob;
	}

	public static int find(Node n,int l,int h){
		if(n.Lcover==l&&n.Hcover==h)return n.min;

		if(n.left.between(l)&&n.left.between(h)){
			return find(n.left, l, n.left.Hcover);
		}else if(n.right.between(l)&&n.right.between(h)){
			return find(n.right, n.right.Lcover, h);
		}else{
			return Math.min(find(n.left, l, n.left.Hcover), find(n.right, n.right.Lcover,h));
		}
	}

	public static void update(Node n,int p,int x,int bef){
		for(Node it=n;it!=null;it=it.parent){
			if(it.min==bef){
				if(it.left.between(p)){
					it.min=Math.min(it.right.min, x);
				}	if(it.right.between(p)){
					it.min=Math.min(it.left.min, x);
				}
			}
		}
	}

	public static void main(String[] args) {
		Node root=new Node();
		int n;
		int q;
		Scanner stdin=new Scanner(System.in);
		n=stdin.nextInt();
		q=stdin.nextInt();
		root.min=(1<<31)-1;
		root.Hcover=n;
		root.Lcover=1;
		root.parent=null;
		root.left=cousei(root,1,(n+1)/2,root.min,0,0);
		root.right=cousei(root,(n+1)/2+1,n,root.min,0,0);
		for(int XXX=0;XXX<q;XXX++){
			int com=stdin.nextInt();
			int x=stdin.nextInt();
			int y=stdin.nextInt();
			x++;
			if(com==0){
				// update
				int m=table[x].min;
				table[x].min=y;
				update(table[x].parent, x, y,m);
			}else{
				// find
				y++;
				System.out.println(find(root, x, y));
			}
		}
		stdin.close();
	}

}

Compiler output:
Main.java:23: error: class DSL2 is public, should be declared in a file named DSL2.java
public class DSL2 {
       ^
1 error
Language: Java

import java.util.Scanner;

public class Main {
	int[] a;
	int n;
	public static void main(String[] args){
		Main test = new Main();
		Scanner inputScanner = new Scanner(System.in).useDelimiter("\\s");
		test.n = inputScanner.nextInt();
		int q = inputScanner.nextInt();
		
		test.a = new int[test.n]; 
		for(int i=0;i<test.n;i++){
			test.a[i]=Integer.MAX_VALUE;
		}
		
		int cmd=-1;
		int arg1;
		int arg2;
		for(int j =0;j<q;j++){
			cmd = inputScanner.nextInt();
			arg1=inputScanner.nextInt();
			arg2=inputScanner.nextInt();
			
			if(cmd ==0)
				System.out.println(test.update(arg1, arg2));
			else if(cmd ==1)
				System.out.println(test.findMin(arg1, arg2));
		}
	}
	
	public void update(int k, int b){
		k += (n-1);
		a[k] = b;
		while(k > 0){
			k = (k-1)/2;
			a[k] = Integer.min(a[(k*2)+1], a[(k*2)+2]);
		}
	}
	
	public int findMin(int b, int c){
		
		return query(b,c+1,0,0,n);
	}
	
	public int query(int b, int c, int k, int l, int r){
		if (r <= b || c <= 1)
			return Integer.MAX_VALUE;
		if(b<=1 && r<=c)
			return a[k];
		
		int o1 = query(b,c,(k*2)+1,l,(1+r/2));
		int o2 = query(b,c,(k*2)+2,(l+r)/2,r);
		return Integer.min(o1, o2);	
	}
}



Compiler output:
Main.java:26: error: 'void' type not allowed here
				System.out.println(test.update(arg1, arg2));
				                              ^
1 error
Language: Java

package com.tzj;

import java.util.Scanner;
import java.io.PrintWriter;

public class AizuRangeMinimumQuery {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int n = in.nextInt();
        int q = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[4*n];
        for (int i = 0; i < n; i++) {
            a[i] = Integer.MAX_VALUE;
        }

        build(0, 0, n-1, a, b);
        while (q-- != 0) {
            int o = in.nextInt();
            int l = in.nextInt();
            int r = in.nextInt();

            if (o == 0) {
                update(0, 0, n-1, l, r, a, b);
            } else {
                out.printf("%d\n", query(0, 0, n-1, l, r, b));
            }
        }
    }

    private void build(int n, int s, int e, int[] a, int[] b) {
        if (s == e) {
            b[n] = a[s];
        } else {
            int m = (s + e) / 2;
            build(2 * n + 1, s, m, a, b);
            build(2 * n + 2, m + 1, e, a, b);

            b[n] = Math.min(b[2 * n + 1], b[2 * n + 2]);
        }
    }

    private void update(int n, int s, int e, int idx, int val, int[] a, int[] b) {
        if (s == e) {
            a[idx] = val;
            b[n] = val;
        } else {
            int m = (s + e) / 2;
            if (s <= idx && idx <= m) {
                update(2 * n + 1, s, m, idx, val, a, b);
            } else {
                update(2 * n + 2, m + 1, e, idx, val, a, b);
            }

            b[n] = Math.min(b[2 * n + 1], b[2 * n + 2]);
        }
    }

    private int query(int n, int s, int e, int l, int r, int[] b) {
        if (r < s || e < l) {
            return Integer.MAX_VALUE;
        } else if (l <= s && e <= r) {
            return b[n];
        } else {
            int m = (s + e) / 2;
            int m1 = query(2 * n + 1, s, m, l, r, b);
            int m2 = query(2 * n + 2, m + 1, e, l, r, b);

            return Math.min(m1, m2);
        }
    }
}



Compiler output:
Main.java:6: error: class AizuRangeMinimumQuery is public, should be declared in a file named AizuRangeMinimumQuery.java
public class AizuRangeMinimumQuery {
       ^
1 error
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<math.h>


int main(void){

  int a[100000]={};
  int min[100000]={};
  int i=0;  
  int time=0;
  int b,x,s,t,n,q,d;

  scanf("%d %d",&n,&q);
  if(1>n||n>100000||1>q||q>100000){
  printf("Too Large\n");
  exit(0);
  }

  while(i<n){
    a[i]=pow(2,31)-1;
    min[i]=a[i];
    i++;
  }

  i=0;




  while(i<q){
    i++;
   scanf("%d",&b);

   if(b==0){
   scanf("%d",&d);
   scanf("%d",&x);
   if(d>n||x>1000){
   printf("Too Large\n");
   exit(0);
   }

   a[d] = x;
   }
 
   else if(b==1){
     time++;
   scanf("%d",&s);
   scanf("%d",&t);
   
   if(s>n||t>n){
   printf("Too Large\n");
   exit(0);
   }
   min[time]=a[s];
   for(s;s<=t;s++){
     if (a[s]<=min[time]){
       min[time]=a[s];
     }
   }

   }


  }

  i=0;

  while(i<time){
    ++i;
    printf("%d\n",min[i]);

  }

Compiler output:
main.c: In function 'main':
main.c:73:3: error: expected declaration or statement at end of input
   73 |   }
      |   ^
Language: C

#include<stdio.h>
#include<stdlib.h>
main()
{
        int i, n, q, com, x, y, count = 0;
        *a, *min;
        scanf("%d %d", &n, &q);
        min = (int*)malloc(sizeof(int) * n);
        a = (int*)malloc(sizeof(int) * n);
        for(i = 0; i < n; i++){
                a[i] = 2147483647;
        }
        for(i = 0; i < q; i++){
                scanf("%d %d %d" , &com, &x, &y);
                switch(com){
                case 0:
                        a[x] = y;
                        break;
                case 1:
                        min[count] = a[x];
                        for(n = x + 1; n <= y; n++){
                                if(min[count] > a[n]){
                                        min[count] = a[n];
                                }
                        }
                        count++;
                        break;
                }
        }
        for(i = 0; i < count; i++){
                printf("%d\n", min[i]);
        }
        //printf("%p\n%p\n", a, min);
        //free(a);
        //free(min);
}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main()
      | ^~~~
main.c: In function 'main':
main.c:6:10: error: 'a' undeclared (first use in this function)
    6 |         *a, *min;
      |          ^
main.c:6:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:14: error: 'min' undeclared (first use in this function); did you mean 'main'?
    6 |         *a, *min;
      |              ^~~
      |              main
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++)
#define MAX 1000001

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=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
const int MAX_N =1<<31-1;

//segment-tree
int n;//nは2のべき乗
int dat[1000001*2-1];
int na;
//初期化
void init(){
	//すべての値をINT_MAXに
	for(int i =0;i <2*n-1;i++){
		dat[i]=INT_MAX;
	}
}

//i番目の値(0-indexed)をxに変更
void update(int i,int x){
	//葉のノード番号
	i += na - 1;
	dat[i] = x;
	while(i >0){
		i =(i-1)/2;
		dat[i] =min(dat[i*2+1],dat[i*2+2]);
	}
}

//[a,b)の最小値,l,rにはノードkに対応づく区画を与える
//外からはquery(a,b,0,0,n)のように呼ぶ
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 q;
int main(){
	cin>>n>>q;
	na = 1;
	na =na<<n;
	for(int i=0;i<MAX*2-1;i++) dat[i] = INT_MAX;
	int c,x,y;
	while(q--){
		scanf("%d %d %d",&c,&x,&y);
		if(!c)
			update(x,y);
		else
			printf("%d\n",query(x,y+1,0,0,na));
	}
	return 0;
}

Compiler output:
main.c:1:9: fatal error: map: No such file or directory
    1 | #include<map>
      |         ^~~~~
compilation terminated.
Language: C

#include<iostream>
#include<algorithm>
#include<vector>
#include<climits>

#define max_n 100000

using namespace std;

typedef long long ll;

const int B=1000;

ll a[max_n],m[max_n/B];

void update(int i,int x){
  a[i]=x;
  for(int j=i/B;j<i/B+B;j++)
    m[i/B]=min(m[i/B],a[j]);
}

int find(int s,int t){
  ll res=INT_MAX;

  if(s/B==t/B){
    for(int i=s;i<=t;i++)res=min(res,a[i]);
    return res;
  }

  for(int i=s/B+1;i<t/B;i++){
    res=min(res,m[i]);
  }
  
  for(int i=s;i<s-s%B+B;i++)res=min(res,a[i]);
  for(int i=t-t%B;i<=t;i++)res=min(res,a[i]);

  return res;
}

int main(void){
  int n,q;

  cin >> n >> q;

  fill(m,m+max_n/B,INT_MAX);
  fill(a,a+max_n,INT_MAX);

  int com,x,y;
  for(int i=0;i<q;i++){
    cin >> com >> x >> y;
    
    if(com==0)update(x,y);
    else cout << find(x,y) << endl;
  }
  
  return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define INF 2000000000
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define mk make_pair
#define en endl
#define RE return 0
#define int ll
#define P pair<int,int>

#define MAX 100005

struct RMQ{
	int n,dat[2*MAX-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]=min(dat[2*k+1],dat[2*k+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, 2*k+1, l, (l+r)/2);
			int vr=query(a, b, 2*k+2, (l+r)/2, r);
			return min(vl,vr);
		}
	}
};

RMQ rmq;

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



Compiler output:
a.cc: In member function 'void RMQ::init(long long int)':
a.cc:45:51: error: 'INT_MAX' was not declared in this scope
   45 |                 for(int i=0; i<2*n-1; i++) dat[i]=INT_MAX;
      |                                                   ^~~~~~~
a.cc:24:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   23 | #include <cassert>
  +++ |+#include <climits>
   24 | using namespace std;
a.cc: In member function 'long long int RMQ::query(long long int, long long int, long long int, long long int, long long int)':
a.cc:56:39: error: 'INT_MAX' was not declared in this scope
   56 |                 if(r<=a||b<=l) return INT_MAX;
      |                                       ^~~~~~~
a.cc:56:39: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define INF 2000000000
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define mk make_pair
#define en endl
#define RE return 0
#define int ll
#define P pair<int,int>

#define MAX 100005
const int INT_MAX=2147483647

struct RMQ{
	int n,dat[2*MAX-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]=min(dat[2*k+1],dat[2*k+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, 2*k+1, l, (l+r)/2);
			int vr=query(a, b, 2*k+2, (l+r)/2, r);
			return min(vl,vr);
		}
	}
};

RMQ rmq;

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



Compiler output:
a.cc:41:1: error: expected ',' or ';' before 'struct'
   41 | struct RMQ{
      | ^~~~~~
a.cc:67:1: error: 'RMQ' does not name a type
   67 | RMQ rmq;
      | ^~~
a.cc: In function 'int main()':
a.cc:71:9: error: 'rmq' was not declared in this scope
   71 |         rmq.init(n);
      |         ^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define INF 2000000000
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define mk make_pair
#define en endl
#define RE return 0
#define int ll
#define P pair<int,int>

#define MAX 100005
const int INT_MAX=2147483647;

struct RMQ{
	int n,dat[2*MAX-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]=min(dat[2*k+1],dat[2*k+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, 2*k+1, l, (l+r)/2);
			int vr=query(a, b, 2*k+2, (l+r)/2, r);
			return min(vl,vr);
		}
	}
};

RMQ rmq;

signed main(){
	int n,q; cin>>n>>q;
	rmq.init(n);
	for(int i=0; i<q; i++){
		int com,x,y; cin>>com>>x>>y;
		if(com){
			prinf("%lld\n",rmq.query(x, y+1, 0, 0, rmq.n));
		}else{
			rmq.update(x, y);
		}
	}
}




Compiler output:
a.cc: In function 'int main()':
a.cc:75:25: error: 'prinf' was not declared in this scope; did you mean 'printf'?
   75 |                         prinf("%lld\n",rmq.query(x, y+1, 0, 0, rmq.n));
      |                         ^~~~~
      |                         printf