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

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

class Node
{
public:
	int location;
	int p,l,r;
	Node(){}
};

class Point
{
public:
	int id,x,y;
	Point(){}
	Point(int id,int x,int y):id(id),x(x),y(y){}
	bool operator<(const Point &p)const
	{
		return id<p.id;
	}
	
	void print()
	{
		printf("%d\n",id);
	}
};

static const int MAX=1000000;
static const int NIL=-1;

int N;
Point P[MAX];
Node T[MAX];
int np;

bool lessX(const Point &p1,const Point &p2){return p1.x<p2.x;}
bool lessY(const Point &p1,const Point &p2){return p1.y<p2.y;}

int makekDTree(int l,int r,int depth)
{
	if(!(l<r))return NIL;
	int mid=(l+r)/2;
	int t=np++;
	if(depth%2==0)
	{
		sort(P+l,P+r,lessX);
	}
	else
	{
		sort(P+l,P+r,lessY);
	}
	T[t].location=mid;
	T[t].l=makekDTree(l,mid,depth+1);
	T[t].r=makekDTree(mid+1,r,depth+1);
	
	return t;
}

void find(int v,int sx,int tx,int sy,int ty,int depth,vector<Point> &ans)
{
	int x=P[T[v].location].x;
	int y=P[T[v].location].y;
	
	if(sx<=x&&x<=tx&&sy<=y&&y<=ty)
	{
		ans.push_back(P[T[v].location]);
	}
	
	if(depth%2==0)
	{
		if(T[v].l!=NIL)
		{
			if(sx<=x)find(T[v].l,sx,tx,sy,ty,depth+1,ans);
		}
		if(T[v].r!=NIL)
		{
			if(x<=tx)find(T[v].r,sx,tx,sy,ty,depth+1,ans);
		}
	}
	else
	{
		if(T[v].l!=NIL)
		{
			if(sy<=y)find(T[v].l,sx,tx,sy,ty,depth+1,ans);
		}
		if(T[v].r!=NIL)
		{
			if(y<=ty)find(T[v].r,sx,tx,sy,ty,depth+1,ans);
		}
	}
}

int main()
{
	int x,y;
	scanf("%d",&N);
	for(int i=0;i<N;i++)
	{
		scanf("%d %d",&x,&y);
		P[i]=Point(i,x,y);
		T[i].l=T[i].r=T[i].p=NIL;
	}
	np=0;
	int root=makekDTree(0,N,0);
	
	int q;
	scanf("%d",&q);
	int sx,tx,sy,ty;
	vector<Point> ans;
	for(int i=0;i<q;i++)
	[
		scanf("%d %d %d %d",&sx,&tx,&sy,&ty);
		ans.clear();
		find(root,sx,tx,sy,ty,0,ans);
		sort(ans.begin(),ans.end());
		for(int j=0;i<ans.size();j++)
		{
			ans[j].print();
		}
		printf("\n");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:115:52: error: expression list treated as compound expression in initializer [-fpermissive]
  115 |                 scanf("%d %d %d %d",&sx,&tx,&sy,&ty);
      |                                                    ^
a.cc:115:53: error: expected ',' before ';' token
  115 |                 scanf("%d %d %d %d",&sx,&tx,&sy,&ty);
      |                                                     ^
      |                                                     ,
a.cc:115:53: error: expected identifier before ';' token
a.cc:115:53: error: expected ']' before ';' token
  115 |                 scanf("%d %d %d %d",&sx,&tx,&sy,&ty);
      |                                                     ^
      |                                                     ]
a.cc: In lambda function:
a.cc:115:53: error: expected '{' before ';' token
a.cc: In function 'int main()':
a.cc:119:29: error: 'i' was not declared in this scope
  119 |                 for(int j=0;i<ans.size();j++)
      |                             ^
a.cc: At global scope:
a.cc:125:9: error: expected unqualified-id before 'return'
  125 |         return 0;
      |         ^~~~~~
a.cc:126:1: error: expected declaration before '}' token
  126 | }
      | ^
Language: C++

#include <cstdio>
#include <vector>
#include <algorithm>

typedef struct node{
	int x;
	int y;
	int depth;
	int id;
	node *right;
	node *left;
} node;


bool compX(node &n1, node &n2){
	return n1.x < n2.x;
}

bool compY(node &n1, node &n2){
	return n1.y < n2.y;
}

node *nil;
std::vector<int> ans;
std::vector<node> nodes;

node* make_tree(int l, int r, int depth){
	if (l>=r){
		return nil;
	}

	if (depth % 2 == 0){
		std::sort(&nodes[l], &nodes[r], compX);
	}
	else{
		std::sort(&nodes[l], &nodes[r], compY);
	}

	int mid = (l+r)/2;
	nodes[mid].depth = depth;
	nodes[mid].left = make_tree(l, mid, depth+1);
	nodes[mid].right = make_tree(mid+1, r, depth+1);

Compiler output:
a.cc: In function 'node* make_tree(int, int, int)':
a.cc:42:57: error: expected '}' at end of input
   42 |         nodes[mid].right = make_tree(mid+1, r, depth+1);
      |                                                         ^
a.cc:27:41: note: to match this '{'
   27 | node* make_tree(int l, int r, int depth){
      |                                         ^
a.cc:42:26: warning: control reaches end of non-void function [-Wreturn-type]
   42 |         nodes[mid].right = make_tree(mid+1, r, depth+1);
Language: C++

#include <bits/stdc++.h>
using namespace std;
/* 
   kD_Tree
   build:O(n log^2(n))
   search:O(n^(1-1/K)+A)
   K:次元数 A:領域に含まれる点の数
*/


class KDT{
public:
  typedef long long ll; /*型に注意!!!!*/
  struct node{
    vector<ll> point;
    int l,r;
    node(){}
    node(vector<ll> point):point(point){l=r=-1;}
  };
  int K;// K:次元数
  vector<vector<ll> > P;// それぞれの要素はK+1個(各次元の値と固有ID)
  vector<node> G;
  int ok = 0;

  KDT(int K=2):K(K),ok(0){};
  
  void add_point(vector<ll> a/*座標*/){ 
    static int id = 0;
    if((int)a.size() < K+1) a.push_back(id++);
    assert((int)a.size() == K+1);
    P.push_back(a);
  }
  
  int build(int depth=0,int l=0,int r=-2){
    if(r == -2) r = (int)P.size()-1,ok = 1;
    if(l>r) return -1;
    int D=depth%K; // D:ソートする基準の次元
    sort(P.begin()+l,P.begin()+r+1,[&](const vector<ll> &A,const vector<ll> &B){return A[D]<B[D];});

    int m=(l+r)/2,res=G.size();
    G.push_back(node(P[m]));
    int vl=build(depth+1,l,m-1);
    int vr=build(depth+1,m+1,r);
    G[res].l=vl; G[res].r=vr;
    return res;
  }

  vector<vector<ll> > points;//searchの座標集合と固有ID
  void search(int x,int depth,const vector<ll> &ld,const vector<ll> &ru){
    if(P.empty()) return;
    bool f=true;
    for(int i=0;i<K;i++)
      if(G[x].point[i]<ld[i]||ru[i]<G[x].point[i]) f=false;
    
    if(f) points.push_back(G[x].point);
    
    int D = depth%K;// D:ソートする基準の次元
    if(G[x].point[D]<=ru[D]&&G[x].r!=-1) search(G[x].r,depth+1,ld,ru);
    if(ld[D]<=G[x].point[D]&&G[x].l!=-1) search(G[x].l,depth+1,ld,ru);
  }

  
  //[0,K)の要素が座標,K番目の要素が固有IDになっている。
  vector<vector<ll> > search(vector<ll> ld/*左下*/,vector<ll> ru/*右上*/){
    assert(ok);
    points.clear();
    search(0,0,ld,ru);
    return points;
  }
};

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

  KDT kdt;
  for(int i=0;i<n;i++){
    int x,y;
    scanf("%d%d",&x,&y);
    kdt.add_point({x,y});
  }

  kdt.build();
  int q;
  cin>>q;
  while(q--){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    auto point = kdt.search({a,c},{b,d});
    vector<int> ans;
    for(auto &p:point) ans.push_back(p.back());
    sort(ans.begin(),ans.end());
    for(int i=0;i<(int)ans.size();i++) printf("%d\n",ans[i]);
    printf("\n")
  }
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:94:17: error: expected ';' before '}' token
   94 |     printf("\n")
      |                 ^
      |                 ;
   95 |   }
      |   ~
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define Lens 1000100
#define Nil -1

using namespace std;

struct point
{
	int x;
	int y;
	int add;
};

struct node
{
	int lc;
	int rc;
	int key;
};

int N, q, h;
point p[Lens];
node T[Lens];
vector<int> ans;
bool lessx(point a, point b) { return a.x < b.x; }
bool lessy(point a, point b) { return a.y < b.y; }

int maketree(int l, int r, int depth)
{
	if (l >= r)
		return Nil;
	int mid = (l + r) / 2;
	if (depth % 2 == 0)
		sort(p + l, p + r, lessx);
	else
		sort(p + l, p + r, lessy);
	int t = h++;
	T[t].key = mid;
	T[t].lc = maketree(l, mid, depth + 1);
	T[t].rc = maketree(mid + 1, r, depth + 1);
	return t;

}

void findtree(int root, int lx, int hx, int ly, int ry, int depth)
{
	int tr = root;
	int tx = p[T[tr].key].x;
	int ty = p[T[tr].key].y;
	if (lx <= tx&&tx <= hx&&ly <= ty&&ty <= ry)
		ans.push_back(p[T[tr].key].add);
	if (depth % 2 == 0)
	{
		if (T[tr].lc != Nil&&lx <= tx)
			findtree(T[tr].lc, lx, hx, ly, ry, depth + 1);
		if (T[tr].rc != Nil&&tx <= hx).
			findtree(T[tr].rc, lx, hx, ly, ry, depth + 1);
	}
	else
	{
		if (T[tr].lc != Nil&&ly <= ty)
			findtree(T[tr].lc, lx, hx, ly, ry, depth + 1);
		if (T[tr].rc != Nil&&ty <= ry)
			findtree(T[tr].rc, lx, hx, ly, ry, depth + 1);
	}

}

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> p[i].x >> p[i].y;
		p[i].add = i;
		T[i].lc = T[i].rc = T[i].key = Nil;

	}
	int root = maketree(0, N, 0);
	cin >> q;
	for (int i = 0; i < q; i++)
	{
		ans.clear();
		int lx, hx, ly, ry;

		cin >> lx >> hx >> ly >> ry;
		findtree(root, lx, hx, ly, ry, 0);
		sort(ans.begin(), ans.end());
		for (int i = 0; i < ans.size(); i++)
			cout << ans[i] << endl;
		cout << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'void findtree(int, int, int, int, int, int)':
a.cc:59:47: error: expected primary-expression before '.' token
   59 |                 if (T[tr].rc != Nil&&tx <= hx).
      |                                               ^
Language: C++

#include <cstdio>
using namespace std;

long n, q, s, t, u, v;
long x[500000], y[500000];

int main()
{
	scanf_s("%d", &n);
	
	for (long i = 0; i < n; i++)
		scanf_s("%d %d", &x[i], &y[i]);

	scanf_s("%d", &q);

	for (long j = 0; j < q; j++) {
		scanf_s("%d %d %d %d", &s, &t, &u, &v);

		for (long i = 0; i < n; i++)
			if (s <= x[i] && t >= x[i] && u <= y[i] && v >= y[i])
				printf("%d\n", i);
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    9 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

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

long n, q, s, t, u, v;
long x[500000], y[500000];

int main()
{
	scanf_s("%d", &n);
	
	for (long i = 0; i < n; i++)
		scanf_s("%d %d", &x[i], &y[i]);

	scanf_s("%d", &q);

	for (long j = 0; j < q; j++) {
		scanf_s("%d %d %d %d", &s, &t, &u, &v);

		for (long i = 0; i < n; i++)
			if (s <= x[i] && t >= x[i] && u <= y[i] && v >= y[i])
				printf("%d\n", i);

		cout << endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   10 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

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

typedef struct node_{
    int key;
    int x[2];
    struct node_ *left;
    struct node_ *right;
}node;

vector<node> V;
vector<int> ans;

bool ascX(const node& left, const node& right){
    return left.x[0] != right.x[0] ? left.x[0] < right.x[0] : left.x[1] < right.x[1];
}

bool ascY(const node& left, const node& right){
    return left.x[1] != right.x[1] ? left.x[1] < right.x[1] : left.x[0] < right.x[0];
}

bool (*asc[2])(const node& left, const node& right) = {ascX,ascY,};

node *make2Dtree(int left, int right, char d){
    if(left>=right){
        return NULL;
    }
    int mid = (left + right)/2;
    sort(V.begin()+left, V.begin()+right, asc[d]);
    node *p = &V[mid];
    p->left = make2Dtree(left, mid, (d+1)%2);
    p->right = make2Dtree(mid+1, right, (d+1)%2);
    return p;
}

void find(node *root, int *sx, int *tx, char d){
    if(root==NULL)return;
    int x[2] = {root->x[0], root->x[1],};

    if(sx[0] <= x[0] && x[0] <= tx[0] && sx[1] <= x[1] && x[1] <= tx[1])ans.push_back(root->key);

    if(sx[d] <= x[d])find(root->left, sx, tx, (d+1)%2);
    if(x[d] <= tx[d])find(root->right, sx, tx, (d+1)%2);
}

int main(){
    int i,j,n,q,x,y,sx[2],tx[2];
    node tmp;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %d",&x,&y);
        tmp.key = i;
        tmp.x[0] = x;
        tmp.x[1] = y;
        V.push_back(tmp);
    }
    node* root;
    root = make2Dtree(0, n, 0);

    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d %d %d %d",sx,tx,sx+1,tx+1);
        ans.clear();
        find(root,sx,tx,0);
        sort(ans.begin(), ans.end());
        for(j=0;j<ans.size();j++)printf("%d\n",ans[j]);
        printf("\n");
    }

    return 0;
}



Compiler output:
a.cc: In function 'node* make2Dtree(int, int, char)':
a.cc:30:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   30 |     sort(V.begin()+left, V.begin()+right, asc[d]);
      |     ^~~~
      |     short
a.cc: In function 'int main()':
a.cc:66:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   66 |         sort(ans.begin(), ans.end());
      |         ^~~~
      |         short
Language: C++

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

typedef struct node_{
    int key;
    int x[2];
    struct node_ *left;
    struct node_ *right;
}node;

vector<node> V;
vector<int> ans;

bool ascX(const node& left, const node& right){
    return left.x[0] != right.x[0] ? left.x[0] < right.x[0] : left.x[1] < right.x[1];
}

bool ascY(const node& left, const node& right){
    return left.x[1] != right.x[1] ? left.x[1] < right.x[1] : left.x[0] < right.x[0];
}

bool (*asc[2])(const node& left, const node& right) = {ascX,ascY,};

node *make2Dtree(int left, int right, char d){
    if(left>=right){
        return NULL;
    }
    int mid = (left + right)/2;
    std::sort(V.begin()+left, V.begin()+right, asc[d]);
    node *p = &V[mid];
    p->left = make2Dtree(left, mid, (d+1)%2);
    p->right = make2Dtree(mid+1, right, (d+1)%2);
    return p;
}

void find(node *root, int *sx, int *tx, char d){
    if(root==NULL)return;
    int x[2] = {root->x[0], root->x[1],};

    if(sx[0] <= x[0] && x[0] <= tx[0] && sx[1] <= x[1] && x[1] <= tx[1])ans.push_back(root->key);

    if(sx[d] <= x[d])find(root->left, sx, tx, (d+1)%2);
    if(x[d] <= tx[d])find(root->right, sx, tx, (d+1)%2);
}

int main(){
    int i,j,n,q,x,y,sx[2],tx[2];
    node tmp;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %d",&x,&y);
        tmp.key = i;
        tmp.x[0] = x;
        tmp.x[1] = y;
        V.push_back(tmp);
    }
    node* root;
    root = make2Dtree(0, n, 0);

    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d %d %d %d",sx,tx,sx+1,tx+1);
        ans.clear();
        find(root,sx,tx,0);
        std::sort(ans.begin(), ans.end());
        for(j=0;j<ans.size();j++)printf("%d\n",ans[j]);
        printf("\n");
    }

    return 0;
}



Compiler output:
a.cc: In function 'node* make2Dtree(int, int, char)':
a.cc:30:10: error: 'sort' is not a member of 'std'
   30 |     std::sort(V.begin()+left, V.begin()+right, asc[d]);
      |          ^~~~
a.cc: In function 'int main()':
a.cc:66:14: error: 'sort' is not a member of 'std'
   66 |         std::sort(ans.begin(), ans.end());
      |              ^~~~
Language: C++

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

using namespace std;

class Node {
public:
  int location;
  int parent;
  int right;
  int left;

  Node() {}
};

class Point {
public:
  int id, x, y;
  Point() {}
  Point(int id, int x, int y)
    : id(id)
    , x(x)
    , y(y)
    {}

  bool operator < (const Point& p) const {
    return id < p.id;
  }

  void print() {
    cout << id << endl;
  }
};

static const int MAX = 1000000;
static const int NIL = -1;

int N;
Point P[MAX];
Node T[MAX];

int np;

bool lessX(const Point& p1, const Point& p2) { return p1.x < p2.x; }
bool lessY(const Point& p1, const Point& p2) { return p1.y < p2.y; }

int makeKDTree(int left, int right, int depth) {
  if (!(left < right)) {
    return NIL;
  }
  int mid = (left + right) / 2;
  int t = np++;
  if (depth % 2 == 0) {
    sort(P + left, P + right, lessX);
  } else {
    sort(P + left, P + right, lessY);
  }
  T[t].location = mid;
  T[t].left = makeKDTree(left, mid, depth + 1);
  T[t].right = makeKDTree(mid + 1, right, depth + 1);

  return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, vector<Point>& ans) {
/*
  int x = P[T[v].location].x;
  int y = P[T[v].location].y;

  if (sx <= x && x <== tx && sy <= y && y <= ty) {
    ans.push_back(P[T[v].location]);
  }

  if (depth % 2 == 0) {
    if (T[v].left != NIL) {
      if (sx <= x) {
        find(T[v].left, sx, tx, sy, ty, depth + 1, ans);
      }
    }
    if (T[v].right != NIL) {
      if (x <= tx) {
        find(T[v].right, sx, tx, sy, ty, depth + 1, ans);
      }
    }
  } else {
    if (T[v].left != NIL) {
      if (sy <= y) {
        find(T[v].left, sx, tx, sy, ty, depth + 1, ans);
      }
    }
    if (T[v].right != NIL) {
      if (y <= ty) {
        find(T[v].right, sx, tx, sy, ty, depth + 1, ans);
      }
    }
  }
  */
}

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

  int x, y;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x >> y;
    P[i] = Point(i, x, y);
    T[i].left = T[i].right = T[i].parent = NIL;
  }

  np = 0;

  int root = makeKDTree(0, N, 0);

  int q;
  cin >> q;
  int sx, tx, sy, ty;
  vector<Point> ans;
  for (int i = 0; i < q; i++) {
    cin >> sx >> tx >> sy >> ty;
    ans.clear();
    find(root, sx, tx, sy, ty, 0, ans);
    sort(ans.begin(), ans.end());
    for (int j = 0; j < ans.size(); j++) {
      ans[j].print()
    }
    cout << endl;
  }

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:127:21: error: expected ';' before '}' token
  127 |       ans[j].print()
      |                     ^
      |                     ;
  128 |     }
      |     ~
Language: C++

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

using namespace std;

class Node {
public:
  int location;
  int parent;
  int right;
  int left;

  Node() {}
};

class Point {
public:
  int id, x, y;
  Point() {}
  Point(int id, int x, int y)
    : id(id)
    , x(x)
    , y(y)
    {}

  bool operator < (const Point& p) const {
    return id < p.id;
  }

  void print() {
    cout << id << endl;
  }
};

static const int MAX = 1000000;
static const int NIL = -1;

int N;
Point P[MAX];
Node T[MAX];

int np;

bool lessX(const Point& p1, const Point& p2) { return p1.x < p2.x; }
bool lessY(const Point& p1, const Point& p2) { return p1.y < p2.y; }

int makeKDTree(int left, int right, int depth) {
  if (!(left < right)) {
    return NIL;
  }
  int mid = (left + right) / 2;
  int t = np++;
  if (depth % 2 == 0) {
    sort(P + left, P + right, lessX);
  } else {
    sort(P + left, P + right, lessY);
  }
  T[t].location = mid;
  T[t].left = makeKDTree(left, mid, depth + 1);
  T[t].right = makeKDTree(mid + 1, right, depth + 1);

  return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, vector<Point>& ans) {
  int x = P[T[v].location].x;
  int y = P[T[v].location].y;

  if (sx <= x && x <== tx && sy <= y && y <= ty) {
    ans.push_back(P[T[v].location]);
  }

  if (depth % 2 == 0) {
    if (T[v].left != NIL) {
      if (sx <= x) {
        find(T[v].left, sx, tx, sy, ty, depth + 1, ans);
      }
    }
    if (T[v].right != NIL) {
      if (x <= tx) {
        find(T[v].right, sx, tx, sy, ty, depth + 1, ans);
      }
    }
  } else {
    if (T[v].left != NIL) {
      if (sy <= y) {
        find(T[v].left, sx, tx, sy, ty, depth + 1, ans);
      }
    }
    if (T[v].right != NIL) {
      if (y <= ty) {
        find(T[v].right, sx, tx, sy, ty, depth + 1, ans);
      }
    }
  }
}

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

  int x, y;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x >> y;
    P[i] = Point(i, x, y);
    T[i].left = T[i].right = T[i].parent = NIL;
  }

  np = 0;

  int root = makeKDTree(0, N, 0);

  int q;
  cin >> q;
  int sx, tx, sy, ty;
  vector<Point> ans;
  for (int i = 0; i < q; i++) {
    cin >> sx >> tx >> sy >> ty;
    ans.clear();
    find(root, sx, tx, sy, ty, 0, ans);
    sort(ans.begin(), ans.end());
    for (int j = 0; j < ans.size(); j++) {
      ans[j].print();
    }
    cout << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'void find(int, int, int, int, int, int, std::vector<Point>&)':
a.cc:70:22: error: expected primary-expression before '=' token
   70 |   if (sx <= x && x <== tx && sy <= y && y <= ty) {
      |                      ^
Language: C++

#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

class Node {
public:
  int location;
  int parent;
  int right;
  int left;

  Node() {}
};

class Point {
public:
  int id, x, y;
  Point() {}
  Point(int id, int x, int y)
    : id(id)
    , x(x)
    , y(y)
    {}

  bool operator < (const Point& p) const {
    return id < p.id;
  }

  void print() {
    printf("%d\n");
  }
};

static const int MAX = 1000000;
static const int NIL = -1;

int N;
Point P[MAX];
Node T[MAX];

int np;

bool lessX(const Point& p1, const Point& p2) { return p1.x < p2.x; }
bool lessY(const Point& p1, const Point& p2) { return p1.y < p2.y; }

int makeKDTree(int left, int right, int depth) {
  if (!(left < right)) {
    return NIL;
  }
  int mid = (left + right) / 2;
  int t = np++;
  if (depth % 2 == 0) {
    sort(P + left, P + right, lessX);
  } else {
    sort(P + left, P + right, lessY);
  }
  T[t].location = mid;
  T[t].left = makeKDTree(left, mid, depth + 1);
  T[t].right = makeKDTree(mid + 1, right, depth + 1);

  return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, vector<Point>& ans) {
  int x = P[T[v].location].x;
  int y = P[T[v].location].y;

  if (sx <= x && x <= tx && sy <= y && y <= ty) {
    ans.push_back(P[T[v].location]);
  }

  if (depth % 2 == 0) {
    if (T[v].left != NIL) {
      if (sx <= x) {
        find(T[v].left, sx, tx, sy, ty, depth + 1, ans);
      }
    }
    if (T[v].right != NIL) {
      if (x <= tx) {
        find(T[v].right, sx, tx, sy, ty, depth + 1, ans);
      }
    }
  } else {
    if (T[v].left != NIL) {
      if (sy <= y) {
        find(T[v].left, sx, tx, sy, ty, depth + 1, ans);
      }
    }
    if (T[v].right != NIL) {
      if (y <= ty) {
        find(T[v].right, sx, tx, sy, ty, depth + 1, ans);
      }
    }
  }
}

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

  int x, y;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d %d", &x, &y);
    P[i] = Point(i, x, y);
    T[i].left = T[i].right = T[i].parent = NIL;
  }

  np = 0;

  int root = makeKDTree(0, N, 0);

  int q;
  scanf("%d", &q);
  int sx, tx, sy, ty;
  vector<Point> ans;
  for (int i = 0; i < q; i++) {
    scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
    ans.clear();
    find(root, sx, tx, sy, ty, 0, ans);
    sort(ans.begin(), ans.end());
    for (int j = 0; j < ans.size(); j++) {
      ans[j].print();
    }
    printf("\n");
  }

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:100:3: error: 'cin' was not declared in this scope
  100 |   cin.tie(0);
      |   ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<algorithm>
  +++ |+#include <iostream>
    4 | 
a.cc:101:3: error: 'ios' has not been declared
  101 |   ios::sync_with_stdio(false);
      |   ^~~
Language: Java

package ????????????;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		int d = (int) Math.sqrt(n);
		int[] arr = new int[n];
		Arrays.fill(arr, (1 << 31) - 1);
		boolean[] edge = new boolean[(n + d - 1) / d];
		int[] rep = new int[(n + d - 1) / d];
		Arrays.fill(rep, (1 << 31) - 1);
		Arrays.fill(edge, false);
		while (q-- > 0) {
			int t = sc.nextInt();
			if (t == 1) {
				int i = sc.nextInt();
				if (!edge[i / d]) {
					System.out.println(rep[i / d]);
				} else {
					System.out.println(arr[i]);
				}
			} else {
				int src = sc.nextInt();
				int dst = sc.nextInt();
				int x = sc.nextInt();
				for (int i = src; i <= Math.min((src / d + 1) * d - 1, dst); ++i) {
					edge[i / d] = true;
					arr[i] = x;
				}
				for (int i = src / d + 1; i < dst / d; ++i) {
					edge[i] = false;
					rep[i] = x;
				}
				for (int i = dst / d * d; i <= dst; ++i) {
					edge[i / d] = true;
					arr[i] = x;
				}
			}
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Compiler output:
Main.java:1: error: <identifier> expected
package ????????????;
       ^
1 error
Language: Java

package ????????????;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		int d = (int) Math.sqrt(n);
		int[] arr = new int[n];
		Arrays.fill(arr, Integer.MAX_VALUE);
		boolean[] edge = new boolean[(n + d - 1) / d];
		int[] rep = new int[(n + d - 1) / d];
		Arrays.fill(rep, Integer.MAX_VALUE);
		Arrays.fill(edge, false);
		while (q-- > 0) {
			int t = sc.nextInt();
			if (t == 1) {
				int i = sc.nextInt();
				if (!edge[i / d]) {
					System.out.println(rep[i / d]);
				} else {
					System.out.println(arr[i]);
				}
			} else {
				int src = sc.nextInt();
				int dst = sc.nextInt();
				int x = sc.nextInt();
				for (int i = src; i <= Math.min((src / d + 1) * d - 1, dst); ++i) {
					edge[i / d] = true;
					arr[i] = x;
				}
				for (int i = src / d + 1; i < dst / d; ++i) {
					edge[i] = false;
					rep[i] = x;
				}
				for (int i = dst / d * d; i <= dst; ++i) {
					edge[i / d] = true;
					arr[i] = x;
				}
			}
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Compiler output:
Main.java:1: error: <identifier> expected
package ????????????;
       ^
1 error
Language: Java

package ????????????;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		int d = (int) Math.sqrt(n);
		int[] arr = new int[n];
		Arrays.fill(arr, Integer.MAX_VALUE);
		boolean[] edge = new boolean[(n + d - 1) / d];
		int[] rep = new int[(n + d - 1) / d];
		Arrays.fill(rep, Integer.MAX_VALUE);
		Arrays.fill(edge, true);
		while (q-- > 0) {
			int t = sc.nextInt();
			if (t == 1) {
				int i = sc.nextInt();
				if (!edge[i / d]) {
					System.out.println(rep[i / d]);
				} else {
					System.out.println(arr[i]);
				}
			} else {
				int src = sc.nextInt();
				int dst = sc.nextInt();
				int x = sc.nextInt();
				for (int i = src; i <= Math.min((src / d + 1) * d - 1, dst); ++i) {
					edge[i / d] = true;
					arr[i] = x;
				}
				for (int i = src / d + 1; i < dst / d; ++i) {
					edge[i] = false;
					rep[i] = x;
				}
				for (int i = dst / d * d; i <= dst; ++i) {
					edge[i / d] = true;
					arr[i] = x;
				}
			}
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Compiler output:
Main.java:1: error: <identifier> expected
package ????????????;
       ^
1 error
Language: Java

package ????????????;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		int d = (int) Math.sqrt(n);
		int[] arr = new int[n];
		Arrays.fill(arr, Integer.MAX_VALUE);
		boolean[] edge = new boolean[n / d + 1];
		int[] rep = new int[n / d + 1];
		Arrays.fill(rep, Integer.MAX_VALUE);
		Arrays.fill(edge, true);
		while (q-- > 0) {
			int t = sc.nextInt();
			if (t == 1) {
				int i = sc.nextInt();
				if (!edge[i / d]) {
					System.out.println(rep[i / d]);
				} else {
					System.out.println(arr[i]);
				}
			} else {
				int src = sc.nextInt();
				int dst = sc.nextInt();
				int x = sc.nextInt();
				for (int i = src; i <= Math.min((src / d + 1) * d - 1, dst); ++i) {
					edge[i / d] = true;
					arr[i] = x;
				}
				for (int i = src / d + 1; i <= (dst - 1) / d; ++i) {
					edge[i] = false;
					rep[i] = x;
				}
				for (int i = dst / d * d + 1; i <= dst; ++i) {
					edge[i / d] = true;
					arr[i] = x;
				}
			}
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Compiler output:
Main.java:1: error: <identifier> expected
package ????????????;
       ^
1 error
Language: Java

package ????????????;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	int[] arr;
	int[] rep;
	boolean[] edge;
	int d;

	int get(int i) {
		if (!edge[i / d]) {
			return rep[i / d];
		} else {
			return arr[i];
		}
	}

	void modify(int src, int dst, int x) {
		for (int i = src / d + 1; i <= dst / d - 1; ++i) {
			edge[i] = false;
			rep[i] = x;
		}
		if (!edge[src / d]) {
			for (int i = src / d * d; i < (src / d + 1) * d; ++i) {
				arr[i] = rep[src / d];
			}
		}
		if (!edge[dst / d]) {
			for (int i = dst / d * d; i < (dst / d + 1) * d; ++i) {
				arr[i] = rep[dst / d];
			}
		}
		edge[src / d] = true;
		edge[dst / d] = true;
		for (int i = src; i <= Math.min((src / d + 1) * d - 1, dst); ++i) {
			arr[i] = x;
		}
		for (int i = Math.max(src, dst / d * d); i <= dst; ++i) {
			arr[i] = x;
		}
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		d = (int) Math.sqrt(n);
		arr = new int[n];
		Arrays.fill(arr, Integer.MAX_VALUE);
		edge = new boolean[n / d + 1];
		rep = new int[n / d + 1];
		Arrays.fill(rep, Integer.MAX_VALUE);
		Arrays.fill(edge, true);
		while (q-- > 0) {
			int t = sc.nextInt();
			if (t == 1) {
				System.out.println(get(sc.nextInt()));
			} else {
				int src = sc.nextInt();
				int dst = sc.nextInt();
				int x = sc.nextInt();
				modify(src, dst, x);
			}
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Compiler output:
Main.java:1: error: <identifier> expected
package ????????????;
       ^
1 error
Language: Java

import java.util.Scanner;

public class RangeUpdateAizu {
    static int N = 100005;
    static int tree[];//start from 0, with all uncertain value
    //data structure: tree from 0
    //how to represent the tree node,
    //node: the segment of the
    public static void main(String[] args) {
        int n,m;
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        tree = new int[N];
        for(int i = 0; i<N; i++){
            tree[i] = 2147483647;
        }
        //make entir tree-> get the max n fir ti 2^n
        int nMax = 1;
        n = n-1;
        while(n>0){
            n = n/2;
            nMax = nMax<<1;
        }
        if(nMax==1) nMax = 2;
        //start from 0
        for(int i = 0; i<m; i++){
            int temp = 0;//decide the type of operation
            int x,y, val;
            temp = in.nextInt();
            if(temp==0){
                x = in.nextInt();
                y = in.nextInt();
                val = in.nextInt();
                update(x,y,val,0,nMax-1,0);
                /*for(int j = 0;j <=2*nMax-2;j++){
                    System.out.println(j+": "+tree[j]);
                }*/
            } else {
                x = in.nextInt();
                int res = find(x,x,0,nMax-1,0);
                System.out.println(res);
            }

        }
    }

    private static int find(int x,int y, int left, int right,int nodeId) {
        if(left>y || right<x) return -1;
        else if(left<=x && right>=y && tree[nodeId]>=0){//search range > than,could be -1
            return tree[nodeId];
        } else{
            int num1 = find(x,y,left,(left+right)/2,nodeId*2+1);
            int num2 = find(x,y,(left+right)/2+1,right,nodeId*2+2);
            return Math.max(num1,num2);
        }

    }
    //update the value
    //top down
    private static void update(int x, int y, int val, int left, int right,int nodeId) {
        //int mid = (left+right)/2;
        //when to stop: there is only one node
        //if(mid>right) return;
        if(x>right||y<left) return;//out of range
        //when to update
        //how to view this tree
        if(x<=left && y>=right){
            tree[nodeId] = val;
        }else{//update the tree//go left and right
            if(tree[nodeId] >=0){
                tree[nodeId*2+1] = tree[nodeId];
                tree[nodeId*2+2] = tree[nodeId];
                tree[nodeId] = -1;
            }
            update(x,y,val,left,(left+right)/2,nodeId*2+1);
            update(x,y,val,(left+right)/2+1,right,nodeId*2+2);
        }
    }
}



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

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <limits.h>
int n; //the sieze of the target array
int l; // the real size of tree;
int q; //number of querys
int *D; //segment tree, D[i] = min value in range node i
int s;
int t;
int x;
int com;
int INF;
int array2tree(int k){return k+n-1;}
int parent(int k){return (k-1)/2;}
int left_child(int k){return 2*k+1;}
int right_child(int k){return 2*k+2;}
int MIN(int ki){ if(D[left_child(ki)] > D[right_child(ki)]){return D[right_child(ki)];}else{return D[left_child(ki)];}    }
int min(int a, int b){if (a > b){return b;}else{return a;} }

void initRMQ();
void update_leaf();
void update(int ki, int ks, int kt);
int find(int ki);
void fetch();

int main(){
	scanf("%d %d",&n,&q);
	initRMQ();
	while(q>0){
		fetch();
		q--;
	}
}

void initRMQ(){
	INF = INT_MAX;
	int i = 1;
	while( i< n ){
		i *= 2;
	}
	if(i>1){
	l = 2*i-1-1;
	}else {l = 1;};
	D = new int[l];
	if(!D){printf("new a D array falied \n");return;}
	for(i = 0; i<l;i++){
		D[i] = INF;
	}

}// end of initRMQ

void fetch(){
	scanf("%d",&com);
	if(com){
		scanf("%d",&s);
		printf("%d\n",find(s));
	}else{
		scanf("%d %d %d",&s,&t,&x);
		t++;
		//update_leaf();
		update(0,0,l);
	}
}
int find(int ki){
	//check range
	//if(ks>kt || ks>t || kt<s){return INF;}
//
	//if(ks >= s && kt <= t){
	//	return D[ki];
	//}
	// start recursive
	//int mid = (ks+kt)/2;
	//return min(find(left_child(ki),ks, mid), find(right_child(ki), mid+1, kt));
	if(n > 1){
	return D[l - (n - ki)];}
	else{
		return D[0];
	}
}
void update_leaf(){
	int i;
	int ks = s+ n -1;
	int kt = t + n-1;
	for(i = ks; i <= kt; i++){
		D[i] = x;
	}
}
void update(int ki, int ks, int kt){
	int i;
	int mid = (ks+kt)/2;
	//check range
	if(kt <= s  || t <= ks ){return;}

	
	if(s <= ks && kt <= t){
		if(ki < l-n){
			update(left_child(ki),ks, mid);
			update(right_child(ki), mid, kt);
		}else {
		if(ks != kt){
			update(ki+1,ks+1,kt);
		}
		}

		D[ki] = x;
		return;
	}

	// start recursive
	if(ki < l-n){
	update(left_child(ki),ks, mid);
	update(right_child(ki), mid, kt);
	D[ki] = MIN(ki);
	}else {if(ks != kt){
		update(ki+1, ks+1, kt);
	}}

	
}// end of update





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

#include<stdio.h>
#include<math.h>
#include<limits.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MAX 100001

int a[MAX];
int lazy[MAX];
int b,n;

void update(int x){

	for(int i=x*b;i<=MIN(n-1,(x+1)*b-1);i++){
		a[i]=lazy[x];
	}
	lazy[x]=-1;
	
	return;
}

int main(){

	int q,i,j,com;
	int x,y,z;
	
	scanf("%d %d",&n,&q);
	
	b=sqrt(n);
	
	for(i=0;i<n;i++){
		a[i]=INT_MAX;
		lazy[i]=-1;
	}
	
	for(j=0;j<q;j++){
	
		scanf("%d",&com);
		
		if(com==1){/*find*/
			scanf("%d",&x);
			if(lazy[x/b]!=-1)update(x/b);
			printf("%d\n",a[x]);
		}
		
		else {/*update*/
			scanf("%d %d %d",&x,&y,&z);
			if(lazy[x/b]!=-1)update(x/b);
			for(i=x;i<=MIN(y,(x/b+1)*b-1);i++)a[i]=z;
			
			for(i=x/b+1;i<y/b;i++)lazy[i]=z;
			
			if(lazy[y/b]!=-1)update(y/b);
			for(i=MAX(x,y/b*b));i<=y;i++)a[i]=z;
		}
		
	}
	
	return 0;
	
}


Compiler output:
main.c:6:9: warning: "MAX" redefined
    6 | #define MAX 100001
      |         ^~~
main.c:5:9: note: this is the location of the previous definition
    5 | #define MAX(a, b) ((a) > (b) ? (a) : (b))
      |         ^~~
main.c: In function 'main':
main.c:6:13: error: called object is not a function or function pointer
    6 | #define MAX 100001
      |             ^~~~~~
main.c:54:31: note: in expansion of macro 'MAX'
   54 |                         for(i=MAX(x,y/b*b));i<=y;i++)a[i]=z;
      |                               ^~~
main.c:54:43: error: expected ';' before ')' token
   54 |                         for(i=MAX(x,y/b*b));i<=y;i++)a[i]=z;
      |                                           ^
      |                                           ;
main.c:54:43: error: expected expression before ')' token
main.c:54:53: error: expected ';' before ')' token
   54 |                         for(i=MAX(x,y/b*b));i<=y;i++)a[i]=z;
      |                                                     ^
      |                                                     ;
main.c:54:53: error: expected statement before ')' token
Language: C

#include<stdio.h>
#include<math.h>
#include<limits.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define LARGE 100001

int a[LARGE];
int lazy[LARGE];
int b,n;

void update(int x){

	for(int i=x*b;i<=MIN(n-1,(x+1)*b-1);i++){
		a[i]=lazy[x];
	}
	lazy[x]=-1;
	
	return;
}

int main(){

	int q,i,j,com;
	int x,y,z;
	
	scanf("%d %d",&n,&q);
	
	b=sqrt(n);
	
	for(i=0;i<n;i++){
		a[i]=INT_MAX;
		lazy[i]=-1;
	}
	
	for(j=0;j<q;j++){
	
		scanf("%d",&com);
		
		if(com==1){/*find*/
			scanf("%d",&x);
			if(lazy[x/b]!=-1)update(x/b);
			printf("%d\n",a[x]);
		}
		
		else {/*update*/
			scanf("%d %d %d",&x,&y,&z);
			if(lazy[x/b]!=-1)update(x/b);
			for(i=x;i<=MIN(y,(x/b+1)*b-1);i++)a[i]=z;
			
			for(i=x/b+1;i<y/b;i++)lazy[i]=z;
			
			if(lazy[y/b]!=-1)update(y/b);
			for(i=MAX(x,y/b*b));i<=y;i++)a[i]=z;
		}
		
	}
	
	return 0;
	
}


Compiler output:
main.c: In function 'main':
main.c:54:43: error: expected ';' before ')' token
   54 |                         for(i=MAX(x,y/b*b));i<=y;i++)a[i]=z;
      |                                           ^
main.c:54:43: error: expected expression before ')' token
main.c:54:53: error: expected ';' before ')' token
   54 |                         for(i=MAX(x,y/b*b));i<=y;i++)a[i]=z;
      |                                                     ^
      |                                                     ;
main.c:54:53: error: expected statement before ')' token
Language: C++

#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

template<class T>
class sg_tree : public vector<T>{
private:
    lli n;
    T default_value;
    void _query(lli a,lli b,T x,lli k,lli l,lli r){
        if(r <= a || b <= l) return;
        if(a <= l && r <= b) (*this)[k] = x;
        else {
            _query(a,b,x,k*2+1,l,(l+r)/2);
            _query(a,b,x,k*2+2,(l+r)/2,r);
            return;
        }
    }
public:
    sg_tree():vector<T>(){

    }
    sg_tree(lli n,T d = -1):vector<T>(n*4,d){
		this->n = 1;
        while(n > this->n) this->n <<= 1;
        this->default_value = d;
    }
    T update(lli i){
        i += n - 1;
        T ret = (*this)[i];
        while(i > 0){
            i = (i - 1) / 2;
            ret = max(ret,(*this)[i]);
        }
        return ret;
    }
    void query(lli a,lli b,lli x){
        _query(a,b,x,0,0,n);
    }
    T func(T a,T b){
        return min(a,b);
    }
};

lli n,q;
lli c,s,t,x;
lli k = 0;
vll b;

sg_tree<lli> sg;

int main(){
    cin >> n >> q;
    sg = sg_tree<lli> (n);
    for(lli i = 0;i < q;i++){
        cin >> c;
        if(c){
            cin >> x;
            lli t;
            if((t = sg.update(x)) < 0) cout << INT_MAX << endl;
            else cout << b[t] << endl;
        }else{
            cin >> s >> t >> x;
            b.push_back(x);
            sg.query(s,t+1,k);
            k++;
            
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:77:48: error: 'INT_MAX' was not declared in this scope
   77 |             if((t = sg.update(x)) < 0) cout << INT_MAX << endl;
      |                                                ^~~~~~~
a.cc:11:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include <cmath>
  +++ |+#include <climits>
   11 | #include <string>
Language: C++

#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<list>
#include<functional>
#define _USE_MATH_DEFINES

#include<math.h>
#include<map>

#define SENTINEL 1000000001

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

typedef pair<int, int> pii;

using namespace std;

struct SD
{
	int n;
	int lsize;
	int sn;
	vector<int> data;
	vector<int> lazyData;

	SD(int n) :n(n), lsize(sqrt(n)), sn(n / lsize + 1), data(n, 2147483647), lazyData(sn, -1){}

	void applyLazy(int k)
	{
		if (lazyData[k] == -1)
		{
			return;
		}
		for (int i = k*lsize; i < (min(n, (k + 1)*lsize)); i++)
		{
			data[i] = lazyData[k];
		}
		lazeData[k] = -1;
	}

	void update(int t, int s, int v)
	{
		for (int i = 0; i < sn; i++)
		{
			int l = i*lsize;
			int r = (i + 1)*lsize - 1;

			if (s < l || r < t)
			{
				continue;
			}

			if (t <= l&&r <= s)
			{
				lazyData[i] = v;
			}
			else
			{
				applyLazy(i);
				for (int j = t; j <= s; j++)
				{
					data[j] = v;
				}
			}
		}
	}

	int find(int index)
	{
		int k = index / lsize;
		applyLazy(k);
		return data[index];
	}
};

int main()
{
	int n, q;
	scanf("%d %d", &n, &q);

	SD sd(n);

	for (int i = 0; i < q; i++)
	{
		int c, s, t, v;
		scanf("%d", &c);

		switch (c)
		{
		case 0:
			scanf("%d %d %d", &s, &t, &v);
			sd.update(s, t, v);
			break;
		case 1:
			scanf("%d", &s);
			cout << sd.find(s) << endl;
			break;
		}
	}

	return 0;
}




Compiler output:
a.cc: In member function 'void SD::applyLazy(int)':
a.cc:50:17: error: 'lazeData' was not declared in this scope; did you mean 'lazyData'?
   50 |                 lazeData[k] = -1;
      |                 ^~~~~~~~
      |                 lazyData
Language: C++

#include<iostream>
#include<climits>    //INT_MAXを使うためのinclude
using namespace std;

int main(){
    int s[100000];
    int t[100000];
    int x[100000];
	int A[100000];
    int i, j, m, s_min, t_max, n, q, ask; 

    cin >> n >> q;
    s_min = n;
    t_max = 0;
    m = 0;
    for(i = 0; i < n; i++) A[i] = INT_MAX;
	while(q){
        q--;
        cin >> ask;
        if(ask){
            cin >> i;
            //if(i < s_min || i > t_max){
            //    A[i] = INT_MAX;
                cout << A[i] << endl;
            //}else{
            //    for(j = m; j >= 0; j--){
            //        if(s[j] <= i && t[j] >= i){
            //            A[i] = x[j];
            //            cout << A[i] << endl;
            //            break;
            //        }
            //    }
            }
        }else{
            cin >> s[m] >> t[m] >> x[m];
            if(s[m] < s_min) s_min = s[m];
            if(t[m] > t_max) t_max = t[m];
            for(i = s[m]; i <= t[m]; i++) A[i] = x[m];
            m++;
         }
    };
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:10: error: 'else' without a previous 'if'
   34 |         }else{
      |          ^~~~
a.cc: At global scope:
a.cc:42:5: error: expected unqualified-id before 'return'
   42 |     return 0;
      |     ^~~~~~
a.cc:43:1: error: expected declaration before '}' token
   43 | }
      | ^
Language: C++

#include<iostream>
#include<climits>    //INT_MAXを使うためのinclude
using namespace std;

int main(){
    int s[100000];
    int t[100000];
    int x[100000];
	int A[100000];
    int i, j, m, s_min, t_max, n, q, ask; 

    cin >> n >> q;
    s_min = n;
    t_max = 0;
    m = 0;
    for(i = 0; i < n; i++) A[i] = INT_MAX;
	while(q){
        q--;
        cin >> ask;
        if(ask){
            cin >> i;
            //if(i < s_min || i > t_max){
            //    A[i] = INT_MAX;
            cout << A[i] << endl;
            //}else{
            //    for(j = m; j >= 0; j--){
            //        if(s[j] <= i && t[j] >= i){
            //            A[i] = x[j];
            //            cout << A[i] << endl;
            //            break;
            //        }
            //    }
            }
        }else{
            cin >> s[m] >> t[m] >> x[m];
            if(s[m] < s_min) s_min = s[m];
            if(t[m] > t_max) t_max = t[m];
            for(i = s[m]; i <= t[m]; i++) A[i] = x[m];
            m++;
         }
    };
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:10: error: 'else' without a previous 'if'
   34 |         }else{
      |          ^~~~
a.cc: At global scope:
a.cc:42:5: error: expected unqualified-id before 'return'
   42 |     return 0;
      |     ^~~~~~
a.cc:43:1: error: expected declaration before '}' token
   43 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
class lazy_segtree {
    private:
        int size;
        vector<long long> node,lazy;
    public:
        lazy_segtree(int n_) {
            size=1;
            while (size<n_) size*=2;
            node.resize(2*size, 0);
            lazy.resize(2*size, 0);
        }
 
        void setlazy(int k,long long v,int l, int r) {
            lazy[k] += v;
            node[k] += v*(r-l);
        }
 
        void push(int k,int l,int r) {
            if (lazy[k] == 0) return ;
            setlazy(k*2+1,lazy[k],l,(r+l)/2);
            setlazy(k*2+2,lazy[k],(r+l)/2,r);
            lazy[k] = 0;
        }
 
        void merge(int k){
            node[k]=node[k*2+1]+node[k*2+2];
        }
 
        void range_add(int queryL,int queryR,int val,int k=0,int nodeL=0,int nodeR=-1) {
            if (nodeR==-1) nodeR=size;
            if (nodeR<=queryL || queryR<=nodeL) return ;
            if (queryL<=nodeL && nodeR<=queryR) {
                setlazy(k,val,nodeL,nodeR);
                return ;
            }
            else {
                push(k,nodeL,nodeR);
                int nodeM=(nodeL+nodeR)/2;
                range_add(queryL,queryR,val,k*2+1,nodeL,nodeM);
                range_add(queryL,queryR,val,k*2+2,nodeM,nodeR);
                merge(k);
                return ;
            }
        }
 
        long long get_node(int queryL,int queryR,int k=0,int nodeL=0,int nodeR=-1) {
            if (nodeR==-1) nodeR=size;
            if (nodeR<=queryL || queryR<=nodeL) return 0;
            if (queryL<=nodeL && nodeR<=queryR) return node[k];
            else {
                push(k,nodeL,nodeR);
                int nodeM=(nodeL+nodeR)/2;
                long long vl=get_node(queryL,queryR,k*2+1,nodeL,nodeM);
                long long vr=get_node(queryL,queryR,k*2+2,nodeM,nodeR);
                return vl+vr;
            }
        }
};
 
int n,q;
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> q;
    lazy_segtree ls(n);
    for (int i=0; i<q; i++) {
        int que,s,t,x,idx;
        cin >> que;
        if (que==0) {
            cin >> s >> t >> x;
            ls.range_add(s-1,t,x);
        }
        else {
            cin >> s;
            cout << ls.node(s-1,s) << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:24: error: 'std::vector<long long int> lazy_segtree::node' is private within this context
   79 |             cout << ls.node(s-1,s) << endl;
      |                        ^~~~
a.cc:7:27: note: declared private here
    7 |         vector<long long> node,lazy;
      |                           ^~~~
a.cc:79:28: error: no match for call to '(std::vector<long long int>) (int, int&)'
   79 |             cout << ls.node(s-1,s) << endl;
      |                     ~~~~~~~^~~~~~~