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

#include<cassert>
#include<functional>
#include<memory>

template<typename T>
class DynamicSegmentTree {
 public:
  explicit DynamicSegmentTree(int size, const T& init = 0, const std::function<T(T, T)>& op = std::plus<T>()) : SIZE(size), INIT(init), OP(op), ROOT(std::make_unique<Node>(init)) {}
  T find(int left, int right) const {assert(left<=right); assert(0<=left); assert(right<SIZE); return find(left, right + 1, ROOT, 0, SIZE);}
  void update(int index, const T& value) {assert(0<=index && index<SIZE); update(index, value, ROOT, 0, SIZE);}

 private:
  struct Node {
    T value;
    std::unique_ptr<Node> left_child, right_child;
    Node(const T& init) : value(init) {}
  };

  T find(int a, int b, const std::unique_ptr<Node>& n, int l, int r) const {
    if(b <= l || r <= a) return INIT;
    if(a <= l && r <= b) return n->value;
    T vl = INIT, vr = INIT;
    if(n->left_child) vl = find(a, b, n->left_child, l, (l + r) / 2);
    if(n->right_child) vr = find(a, b, n->right_child, (l + r) / 2, r);
    return OP(vl, vr);
  }
  T update(int i, const T& value, const std::unique_ptr<Node>& n, int l, int r) {
    if(i < l || r <= i) return n->value;
    if(l == i && r - 1 == i) return n->value = value;
    if(not n->left_child)  n->left_child  = std::make_unique<Node>(INIT);
    if(not n->right_child) n->right_child = std::make_unique<Node>(INIT);
    auto vl = update(i, value, n->left_child, l, (l + r) / 2);
    auto vr = update(i, value, n->right_child, (l + r) / 2, r);
    return n->value = OP(vl, vr);
  }

  const int SIZE;
  const T INIT;
  const std::function<T(T, T)> OP;
  const std::unique_ptr<Node> ROOT;
};

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

int main() {
  test();
  int n, q;
  cin >> n >> q;
  DynamicSegmentTree<long long> RSQ(n + 1);
  while(q--) {
    int com, x, y;
    cin >> com >> x >> y;
    if(com) cout << RSQ.find(x, y) << endl;
    else    RSQ.update(x, y);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:3: error: 'test' was not declared in this scope
   47 |   test();
      |   ^~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define INF 10000000
#define REP(i, n) for(int i = 0;i < (n);i++)
#define all(n) n.begin(),n.end()

using namespace std;

using ll = long long;
using PII = pair<int, int>

class BIT{
	vector<ll> bit;
	int n;
public:
	BIT(int n_){
		n = n_;
		REP(i, n){
			bit.push_back(0);
		}
	}

	void add(int i, int x){
		while(i <= n){
			bit[i] += x;
			i += i & -i;
		}
	}

	int getSum(int i){
		int s = 0;
		while(i > 0){
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}
};

int main(void){
	int n, q;
	BIT bit(n);
	REP(i, q){
		int com, x, y;
		cin >> com >> x >> y;
		if(com == 0){
			bit.add(x, y);
		}else{
			cout << bit.getSum(y)-bit.getSum(x-1) << endl;
		}
	}
}

Compiler output:
a.cc:18:13: error: two or more data types in declaration of 'type name'
   18 | using PII = pair<int, int>
      |             ^~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

class SegTree{
	int n;
	vector<ll> seg;
public:
	SegTree(int n_){
		n = 1;
		while(n < n_) n *= 2;

		REP(i, n*2-1){
			seg.push_back(0);
		}
	}

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

	int getSum(int s, int t){
		return getSum_solve(s, t, 0, 0, n);
	}
	
	int getSum_solve(int s, int t, int x, int l, int r){
		if(t <= l || r <= s) return 0;
		if(s <= l && r <= t) return seg[x];
		int res = 0;

		res += getSum_solve(s, t, x*2+1, l, (l+r)/2);
		res += getSum_solve(s, t, x*2+2, (l+r)/2, r);

		return res;
	}
};

class BIT{
	int n;
	vector<int> dat;
public:
	BIT(int _n){
		n = 1;
		while(n < _n) n = n << 1;
		REP(i, n){
			dat.push_back(0);
		}
	}

	int sum(int i){
		int s = 0;
		while(i){
			s += dat[i];
			i -= i & -i;
		}
	}

	void add(int i, int x){
		while(i <= n){
			dat[i] += x;
			i += i & -i;
		}
	}
}

int main(void){
	int n, q;
	cin >> n >> q;
	BIT sg(n);
	REP(i, q){
		int com, x, y;
		cin >> com >> x >> y;
		if(com == 0){
			sg.add(x, y);
		}else{
			cout << sg.sum(y)-sg.sum(x-1) << endl;
		}
	}
}

Compiler output:
a.cc:88:2: error: expected ';' after class definition
   88 | }
      |  ^
      |  ;
a.cc: In member function 'int BIT::sum(int)':
a.cc:80:9: warning: no return statement in function returning non-void [-Wreturn-type]
   80 |         }
      |         ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = LLONG_MAX;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1<<20)

int n, q;

struct RSQ
{
	int N;
	ll gt;
	ll a[N_SIZE];
	ll seg[N_SIZE * 2];
	void init(int n){
		N = n;
		REP(i, 30) {
			if ((1 << i) >= N) {
				gt = (1 << i) - 1;
				break;
			}
		}
		REP(i, N) {
			//cin >> a[i];
			a[i] = 0;
		}
		REP(i, N_SIZE * 2)seg[i] = 0;
		REP(i, N) {
			seg[i + gt] = a[i];
		}
	}
	void update(int k, int x) {
		k += gt;
		seg[k] += x;
		while (k) {
			k = (k - 1) / 2;//???????????????
			seg[k] += x;
		}
	}
	ll query(int a, int b, int k, int l, int r) {
		if (r < a || b < l)return 0;
		else if (a <= l&&r <= b)return seg[k];
		else return query(a, b, k * 2 + 1, l, (l + r) / 2)
			+ query(a, b, k * 2 + 2, (l + r) / 2 + 1, r);
	}
	void print() {
		REP(i, 2 * (gt + 1)) {
			cout << i << " " << seg[i] << endl;
		}
	}
};

RSQ rsq;

int main() {
	cin >> n >> q;
	rsq.init(n);
	REP(i, q) {
		ll x, y;
		bool f;
		cin >> f >> x >> y;
		if (!f) {
			rsq.update(x, y);
		}
		else {
			cout << rsq.query(x, y, 0, 0, rsq.gt) << endl;
		}
		//rsq.print();
	}
}

Compiler output:
a.cc:29:16: error: 'LLONG_MAX' was not declared in this scope
   29 | const ll INF = LLONG_MAX;
      |                ^~~~~~~~~
a.cc:18:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   17 | #include <bitset>
  +++ |+#include <climits>
   18 | #include <time.h>
Language: C++

// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while(true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using pii   = std::pair<int, int>;
using vi    = std::vector<int>;
using vd    = std::vector<double>;
using vc    = std::vector<char>;
using vb    = std::vector<bool>;
using vs    = std::vector<std::string>;
using vpii  = std::vector<pii>;
using vvi   = std::vector<vi>;
using vvb   = std::vector<vb>;
using vvpii = std::vector<vpii>;
template<typename A> using fn = std::function<A>;
constexpr int INF   = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD   = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
using namespace std;
// clang-format on

template<typename T>
struct Monoid {
  T id;
  std::function<T(T, T)> op;
  Monoid(T e, std::function<T(T, T)> f)
    : id(e), op(f) {
  }
};

template<typename T>
class SegTree {
private:
  vector<T> data;
  Monoid<T> monoid;
  int size = 1;

public:
  SegTree(const int &n, const Monoid<T> &m)
    : monoid(m) {
    while (size < n) size *= 2;
    data = vector<T>(2 * size, monoid.id);
  }

  void update(int i, const T &x) {
    i += size;
    data[i]                = x;
    while (i /= 2) data[i] = monoid.op(data[i * 2], data[i * 2 + 1]);
  }

  // fold [a, b) by monoid.op
  T fold(const int &a, const int &b, const int &k = 1, const int &l = 0, int r = -1) {
    if (r == -1) r = size;
    if (r <= a || b <= l) return monoid.id;
    if (a <= l && r <= b) return data[k];
    return monoid.op(fold(a, b, k * 2, l, (l + r) / 2),
                     fold(a, b, k * 2 + 1, (l + r) / 2, r));
  }

  const T &operator[](const int &i) const {
    return data[i + size];
  }
};

Monoid<int> sumMonoid = {0, plus<int>()};

main {
  int n, q;
  cin >> n >> q;
  SegT<int> t(n, sumMonoid);
  while (q--) {
    int com, x, y;
    cin >> com >> x >> y;
    x--;
    if (com) {
      cout << t.fold(x, y) << endl;
    } else {
      t.update(x, t[x] + y);
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:83:3: error: 'SegT' was not declared in this scope
   83 |   SegT<int> t(n, sumMonoid);
      |   ^~~~
a.cc:3:13: error: expected primary-expression before 'long'
    3 | #define int long long
      |             ^~~~
a.cc:83:8: note: in expansion of macro 'int'
   83 |   SegT<int> t(n, sumMonoid);
      |        ^~~
a.cc:89:15: error: 't' was not declared in this scope
   89 |       cout << t.fold(x, y) << endl;
      |               ^
a.cc:91:7: error: 't' was not declared in this scope
   91 |       t.update(x, t[x] + y);
      |       ^
Language: C++

#include <iostream>
using namespace std;

int bit[200005];
void add(int i, int x){
  while(i<n){
    bit[i]+=x;
    i+=i&-i;
  }
}
int sum(int i){
  int ret=0;
  while(i){
    ret+=sum[i];
    i-=i&-i;
  }
  return ret;
}

int main(){
  int n, q;
  scanf("%d%d", &n, &q);
  for(int i=0; i<q; i++){
    int t, x, y;
    scanf("%d%d%d", &t, &x, &y);
    if(t) printf("%d\n", sum(y)-sum(x-1));
    else add(x, y);
  }
}

Compiler output:
a.cc: In function 'void add(int, int)':
a.cc:6:11: error: 'n' was not declared in this scope
    6 |   while(i<n){
      |           ^
a.cc: In function 'int sum(int)':
a.cc:14:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |     ret+=sum[i];
      |               ^
a.cc:14:8: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |     ret+=sum[i];
      |     ~~~^~~~~~~~
a.cc:14:8: error: invalid conversion from 'int (*)(int)' to 'int' [-fpermissive]
   14 |     ret+=sum[i];
      |     ~~~^~~~~~~~
      |        |
      |        int (*)(int)
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'M' was not declared in this scope
   18 |       printf("%d\n",M);
      |                     ^
Language: C++

#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0;}
template<class T>bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0;}

using ll = long long;
using R = long double;
const R EPS = 1e-9; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max<R>(x, 0.0));}

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

// Problem Specific Parameter:
template <int depth>  struct Segment_tree {
	const static int h = depth;
	const static int n = 1 << h;

	using T = long long;
	T data[2 * n];
	const T out = 0LL;

	inline T vmerge(T l, T r) {return l + r;}

	void init() {
		fill_n(data, 2 * n, out);
	}

	void update(int p, T x) { // set value at position p
		data[p += n] += x
		for (; p > 1; p >>= 1) {
			data[p >> 1] = vmerge(data[p], data[p ^ 1]);
		}
	}

	T query(int l, int r) {  // sum on interval [l, r)
		T resl = out, resr = out;
		for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
			if (l & 1) resl = vmerge(data[l++], resl);
			if (r & 1) resr = vmerge(resr, data[--r]);
		}
		return vmerge(resl, resr);
	}
};

Segment_tree<17> rsq;

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

	rsq.init();

	rep(loop, q) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com)
			cout << rsq.query(x, y + 1) << endl;
		else
			rsq.update(x, y);
	}
	return 0;
}

Compiler output:
a.cc: In member function 'void Segment_tree<depth>::update(int, T)':
a.cc:50:17: error: expected ';' before 'for'
   50 |                 for (; p > 1; p >>= 1) {
      |                 ^~~
a.cc:50:38: error: expected ';' before ')' token
   50 |                 for (; p > 1; p >>= 1) {
      |                                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
template<typename T> 
struct BIT{
  int n;
  vector<T> bit;
  //1-indexed
  BIT():n(-1){}
  BIT(int n_,T d):n(n_),bit(n_+1,d){}
  
  T sum(int i){
    T s=0;
    for(int x=i;x>0;x-=(x&-x))
      s+=bit[x];
    return s;
  }
  void add(int i,T a){
    if(i==0) return;
    for(int x=i;x<=n;x+=(x&-x))
      bit[x]+=a;
  }
  
  int lower_bound(int w){
    if(w<=0) return 0;
    int x=0,r=1;
    while(r<n) r<<=1;
    for(int k=r;k>0;k>>=1){
      if(x+k<=n&&bit[x+k]<w){
	w-=bit[x+k];
	x+=k;
      }
    }
    return x+1;
  }
  
  T sum0(int i){
    return sum(i+1);
  }
  void add0(int i,T a){
    add(i+1,a);
  }
};
//END CUT HERE

signed AOJ_DSL2B(){
  int n,q;
  cin>>n>>q;
  BIT<Int> bit(n+100,0);
  for(int i=0;i<q;i++){
    int c,x,y;
    cin>>c>>x>>y;
    if(c) cout<<bit.sum(y)-bit.sum(x-1)<<endl;
    else bit.add(x,y);
  }
  return 0;
}
/*
  verified on 2017/12/31
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
*/

// lower_bound
signed ARC033_C(){
  int q;
  cin>>q;
  BIT<int> bit(2e5,0);
  while(q--){
    int t,x;
    cin>>t>>x;
    if(t==1) bit.add(x,1);
    if(t==2){
      int k=bit.lower_bound(x);
      bit.add(k,-1);
      cout<<k<<endl;
    }
  }
  return 0;
}
/*
  verified on 2017/12/31
  https://beta.atcoder.jp/contests/arc033/tasks/arc033_3
*/

signed main(){
  AOJ_DSL2B()();
  //ARC033_C();
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:87:14: error: expression cannot be used as a function
   87 |   AOJ_DSL2B()();
      |   ~~~~~~~~~~~^~
Language: C++

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

// semi-open   Range minimum query

struct RSQ{
  int n=(1<<17),data[(1<<18)];
  RSQ(){
    memset(data,0,sizeof(data));
  }
  void add(int i,int v){
    while(i<=n){
      data[i]+=v;
      i+=i&-i;
    }
  }
  int sum(int i){
    int res=0;
    while(i>0){
      res+=data[i];
      i-=i&-i;
    }
    return res;
  }
};


int main(){
  RSQ a;
  int c,x,y,n,q;
  cin>>n>>q;
  for(int i=0;i<q;i++){
    scanf("%d%d%d",&c,&x,&y);
    if(c)cout<<a.find(x,y+1)<<endl;
    else a.update(x,y);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:18: error: 'struct RSQ' has no member named 'find'
   34 |     if(c)cout<<a.find(x,y+1)<<endl;
      |                  ^~~~
a.cc:35:12: error: 'struct RSQ' has no member named 'update'
   35 |     else a.update(x,y);
      |            ^~~~~~
Language: C++


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

struct BIT{
	vector<LL>seg;
	int width;
	BIT(int x):width(1){
		while(width<x)width*=2;
		seg.push_back(width+1);
	}
	void add(int x,LL val){
		x++;
		while(x<=width){
			seg[x]+=val;
			x+=(x&-x);
		}
	}
	LL query(int x){
		LL res=0;
		while(x>0){
			res+=seg[x];
			x-=(x&-x);
		}
		return res;
	}
}

int n,q;

int main(){
	cin>>n>>q;
	BIT bit(n);
	for(int i=0;i<q;++i){
		int com,x,y;
		cin>>com>>x>>y;
		if(com){
			bit.add(x,y);
		}else{
			LL ans=bit.query(y)-bit.query(x-1);
			cout<<ans<<endl;
		}
	}
	return 0;
}




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

#include <cassert>
#include <cstdint>
#include <functional>
#include <vector>

template <typename Abelian> class FenwickTree {
	using uint32 = std::uint_fast32_t;
	using const_reference = const Abelian &;
	using F = std::function<Abelian(const_reference, const_reference)>;
	const Abelian neutral_;
	const F p, m;
	std::vector<Abelian> tree;

public:
	FenwickTree(const uint32 size, const_reference neutral = Abelian(),
		const F &p = std::plus<Abelian>(),
		const F &m = std::minus<Abelian>())
		: neutral_(neutral), p(p), m(m), tree(size + 1, neutral_) {}
	FenwickTree(const uint32 size, const_reference neutral, const F &p,
		const std::function<Abelian(const_reference)> &n)
		: neutral_(neutral), p(p),
		m([&p](const_reference l, const_reference r) { return p(l, n(r)); }),
		tree(size + 1, neutral_) {}
	void update(uint32 index, const std::function<void(Abelian)> &g) {
		assert(index < tree.size() - 1);
		++index;
		const Abelian a = tree[index];
		g(tree[index]);
		const_reference b = tree[index];
		while ((index += index & ~index + 1) < tree.size())
			tree[index] = p(m(tree[index], a), b);
	}
	void update(uint32 index, const_reference data) {
		update(index, [&data](Abelian &d) { d = data; });
	}
	void add(uint32 index, const_reference diff) {
		assert(index < tree.size() - 1);
		++index;
		do
			tree[index] = p(tree[index], diff);
		while ((index += index & ~index + 1) < tree.size());
	}
	Abelian range(uint32 end) const {
		assert(end < tree.size());
		Abelian ret = neutral_;
		do
			ret = p(tree[end], ret);
		while (end &= end - 1);
		return ret;
	}
	Abelian range(uint32 begin, uint32 end) const {
		assert(begin <= end);
		return m(range(end), range(begin));
	}
	Abelian operator[](uint32 index) const {
		assert(index < tree.size() - 1);
		return range(index, index + 1);
	}
};

#include <iostream>
int main(void) {
	int n, q;
	std::cin >> n >> q;
	FenwickTree<int> T(n, 0);
	while (q--) {
		int c, x, y;
		std::cin >> c >> x >> y;
		if (c) {
			std::cout << T.range(x - 1, y) << "\n";
		}
		else {
			T.add(x-1,y);
		}
	}
	return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:22:76: error: 'n' is not captured
   22 |                 m([&p](const_reference l, const_reference r) { return p(l, n(r)); }),
      |                                                                            ^
a.cc:22:22: note: the lambda has no capture-default
   22 |                 m([&p](const_reference l, const_reference r) { return p(l, n(r)); }),
      |                      ^
a.cc:20:64: note: 'const std::function<Abelian(const Abelian&)>& n' declared here
   20 |                 const std::function<Abelian(const_reference)> &n)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Language: C++

#include <bits/stdc++.h>

using namespace std;

template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

int main() {
  int N, Q;
  scanf("%d %d", &N, &Q);
  BinaryIndexedTree< int > bit(N);
  while(Q--) {
    int T, X, Y;
    scanf("%d %d %d", &T, &X, &Y);
    --Y, --Z;
    if(T == 0) bit.add(X, Y);
    else printf("%d\n", bit.sum(Y) - bit.sum(X - 1));
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:12: error: 'Z' was not declared in this scope
   31 |     --Y, --Z;
      |            ^
Language: C++

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

const int MAX_N=1<<17;
int n,bit[MAX_N+1];
 

int main(void){
 
  int q,com,a,b;
 
  cin >> n >> q;
  n++;
  while(q--){
    cin >> com >> a >> b;
    if(com)cout << sum(b+1)-sum(a) << endl;
    else add(a+1,b);
  }
}

int sum(int i){
  int s=0;
  while(i>0){
    s+=bit[i];
    i-=i&-i;
  }
  return s;
}
 
void add(int i,int x){
  while(i<=n){
    bit[i]+=x;
    i+=i&-i;
  }
}
 


Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: 'sum' was not declared in this scope
   16 |     if(com)cout << sum(b+1)-sum(a) << endl;
      |                    ^~~
a.cc:17:10: error: 'add' was not declared in this scope; did you mean 'std::filesystem::perm_options::add'?
   17 |     else add(a+1,b);
      |          ^~~
      |          std::filesystem::perm_options::add
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:219:7: note: 'std::filesystem::perm_options::add' declared here
  219 |       add       = 0x2,
      |       ^~~
Language: C++

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

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

struct Data {
  int num;
  Data() : num(0) {}
  Data(int n) : num(n) {}
};

inline Data Merge(Data left, Data right) {
  return Data(left.num + right.num);
}

struct SegmentTree {
  static const int STsize = 1 << 18;
  Data data[STsize]; int n;
  SegmentTree(void) : n(STsize / 2) {}
  void update (int pos, Data value) {
    data[pos] += value;
    while (pos < 2*n-1) {
      int l = pos, r = pos^1;
      pos = pos / 2 + n;
      data[pos] = Merge(data[l], data[r]);
    }
  }
  Data sub(int fr, int to, int node, int la, int ra) {
    if (ra<=fr || to<=la) return Data();
    if (fr<=la && ra<=to) return data[node];
    Data vl = sub(fr, to, (node-n)*2+0, la, (la+ra)/2);
    Data vr = sub(fr, to, (node-n)*2+1, (la+ra)/2, ra);
    return Merge(vl, vr);
  }
  Data query(int fr, int to) { return sub(fr, to, 2*n-2, 0, n); }
};

int main() {
  SegmentTree sgt;
  int n,q;
  cin >> n >> q;
  REP(i,n) {
    sgt.update(i, 0);
  }
  REP(i,q) {
    int c, x, y;
    cin >> c >> x >> y;
    if(c == 0) {
      sgt.update(x, y);
    } else {
      cout << sgt.query(x, y+1).num << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In member function 'void SegmentTree::update(int, Data)':
a.cc:22:15: error: no match for 'operator+=' (operand types are 'Data' and 'Data')
   22 |     data[pos] += value;
      |     ~~~~~~~~~~^~~~~~~~
Language: C

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

#define all(c) (c).begin(),(c).end()
#define MAX_N 500000

using namespace std;

struct point{
  int x,y;
  point(){}
  point(int x,int y):x(x),y(y){}

  bool operator < (const point &p) const {
    if(p.x != x)return p.x<x;
    return p.y < y;
  }

  bool operator > (const point &p) const {
    if(p.y != y)return p.y<y;
    return p.x < x;
  }
};

struct tree_node{
  int id;
  point location;
  tree_node(){}
};

typedef pair<point,int>ppi;

int N,K; //点の数、次元数
ppi pointList[MAX_N];
tree_node *tree[MAX_N*2];

//点のリスト、リストのサイズ、現在の深さ,medianのid
void kdtree(ppi *pList,int n,int depth,int i){
  //深さに応じて軸を選択し、軸が順次選択されるようにする
  int axis = depth % K;
  int mid = n/2;
  
  if(n<=0)return;
  if(axis==0)sort(pList,pList+n);
  if(axis==1)sort(pList,pList+n,greater<ppi>());

  tree[i]=new tree_node;
  tree[i]->id=pList[mid].second;
  tree[i]->location=pList[mid].first;
  //cout << pList[mid].first.x << " " << pList[mid].first.y << endl;
  if(n==1)return;

  kdtree(pList,mid,depth+1,i*2+1);
  kdtree(pList+mid+1,n-mid-1,depth+1,i*2+2);
}

/*
左下、右上、現在のノード、深さ
長方形領域に含まれる点のidを列挙する
*/
void kdtree_search(int x1,int y1,int x2,int y2,int i,int depth,vector<int> &res){
 
  if(!tree[i])return;

  int axis = depth % K;

  bool fgleft=false,fgright=false;

  if(axis==0){
    if(tree[i]->location.x<=x2)fgleft=true;
    if(tree[i]->location.x>=x1)fgright=true;
  }
  else {
    if(tree[i]->location.y<=y2)fgleft=true;
    if(tree[i]->location.y>=y1)fgright=true; 
  }

  if(fgleft)kdtree_search(x1,y1,x2,y2,i*2+1,depth+1,res);
  if(fgright)kdtree_search(x1,y1,x2,y2,i*2+2,depth+1,res);
  //  cout << tree[i]->location.x << " " << tree[i]->location.y << endl;
  if(tree[i]->location.x<x1 || x2<tree[i]->location.x)return;
  if(tree[i]->location.y<y1 || y2<tree[i]->location.y)return;
  res.push_back(tree[i]->id);

}


int main(void){

  fill(tree,tree+MAX_N,(tree_node *)0);

  K=2;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> pointList[i].first.x >> pointList[i].first.y;
    pointList[i].second=i;
  }

  sort(pointList,pointList+N);
  sort(pointList,pointList+N,greater<ppi>());

  kdtree(pointList,N,0,0);
  int q;
  cin >> q;
  for(int i=0;i<q;i++){
    int x1,y1,x2,y2;
    cin >> x1 >> x2 >> y1 >> y2;
    vector<int>res;
    kdtree_search(x1,y1,x2,y2,0,0,res);
    sort(all(res));
    for(int j=0;j<res.size();j++){
      cout << res[j] << endl;
    }
    cout << 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<vector>
#include<algorithm>
std::vector<bool> answer;
// ???
struct Vertex {
  int label;
  double x, y;
  Vertex(int label = 0, double x = 0, double y = 0) : label(label), x(x), y(y) {}
};
// ?????????
class KDTree {
public:
  explicit KDTree(std::vector<Vertex> vertex);
  void search(int sx, int sy, int tx, int ty) const;
private:
  static const int NIL = -1;
  class Compare {
  public:
    Compare(int d) : d(d) {}
    bool operator()(const Vertex& lhs, const Vertex& rhs) const {return d & 1 ? lhs.y < rhs.y : lhs.x < rhs.x;}
  private:
    int d;
  };
  struct Node {
    Vertex vertex;
    int left_child, right_child;
    Node(const Vertex& v = Vertex(), int l = NIL, int r = NIL) : vertex(v), left_child(l), right_child(r) {}
  };
  int build(std::vector<Vertex>& vertex, int low, int high, int depth);
  void search(int index, int sx, int sy, int tx, int ty, int depth) const;
  std::vector<Node> node_;
  int root_;
};
// ?????????????????????
KDTree::KDTree(std::vector<Vertex> vertex) : node_(vertex.size()) {root_ = build(vertex, 0, vertex.size(), 0);}
// ?§????
int KDTree::build(std::vector<Vertex>& vertex, int low, int high, int depth) {
  if(!(low < high)) return NIL;
  std::sort(begin(vertex) + low, begin(vertex) + high, Compare(depth));
  int middle = (low + high) / 2;
  node_[middle].vertex = vertex[middle];
  node_[middle].left_child = build(vertex, low, middle, depth ^ 1);
  node_[middle].right_child = build(vertex, middle + 1, high, depth ^ 1);
  return middle;
}
// ?????¢?????????????????°?????????????????°??¨???????????¢???????????§?¨????????????§?¨??????????
void KDTree::search(int sx, int sy, int tx, int ty) const {search(root_, sx, sy, tx, ty, 0);}
void KDTree::search(int index, int sx, int sy, int tx, int ty, int depth) const {
  if(index == NIL) return;
  if(sx <= node_[index].vertex.x && node_[index].vertex.x <= tx && sy <= node_[index].vertex.y && node_[index].vertex.y <= ty) answer[node_[index].vertex.label] = true;
  if(depth & 1) {
    if(sy <= node_[index].vertex.y) search(node_[index].left_child, sx, sy, tx, ty, depth ^ 1);
    if(node_[index].vertex.y <= ty) search(node_[index].right_child, sx, sy, tx, ty, depth ^ 1);
  } else {
    if(sx <= node_[index].vertex.x) search(node_[index].left_child, sx, sy, tx, ty, depth ^ 1);
    if(node_[index].vertex.x <= tx) search(node_[index].right_child, sx, sy, tx, ty, depth ^ 1);
  }
}

#include<iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<Vertex> vertex;
  for(int i = 0; i < n; ++i) {
    double x, y;
    cin >> x >> y;
    vertex.push_back({i, x, y});
  }
  KDTree t(vertex);
  int q;
  cin >> q;
  for(int i = 0; i < q; ++i) {
    double sx, tx, sy, ty;
    cin >> sx >> tx >> sy >> ty;
    answer.asign(n, false);
    t.search(sx, sy, tx, ty);
    for(int a = 0; a < n; ++a) if(answer[a]) cout << a << endl;
    cout<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:12: error: 'class std::vector<bool>' has no member named 'asign'; did you mean 'assign'?
   78 |     answer.asign(n, false);
      |            ^~~~~
      |            assign
Language: C++

#include<iostream>
#include<cstdio>

#define scanf scanf_s
#define MAX 500000

struct Point {
	int x, y;
};

Point p[MAX];

int main() {
	int i, j, n, q, sx, sy, tx, ty, cnt;

	scanf("%d", &n);
	for (i = 0; i < n; i++)scanf("%d %d", &p[i].x, &p[i].y);

	scanf("%d", &q);
	for (i = 0; i < q; i++) {
		scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
		for (j = 0; j < n; j++) {
			if (sx <= p[j].x && p[j].x <= tx && sy <= p[j].y && p[j].y <= ty)printf("%d\n", j);
		}
		printf(" \n");
	}
	return 0;
}

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

#include<cstdio>
#include<algorithm>
#include<vector>
#define scanf scanf_s
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.y;
}

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; j < ans.size(); j++) {
			ans[j].print();
		}
		printf("\n");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:15: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    4 | #define scanf scanf_s
      |               ^~~~~~~
a.cc:87:9: note: in expansion of macro 'scanf'
   87 |         scanf("%d", &N);
      |         ^~~~~
Language: C++

#if 1
#include<stdio.h>
#include<iostream>
#include<fstream>
#include<string>
#include<math.h>
#include <array>
using namespace std;


template <class T>
struct _Point{
	T x;
	T y;
};

typedef int R;
typedef _Point<R> Point;

array< Point, 500000> A;

int main(){
	std::istream & c_in = cin;

	int n;
	c_in >> n;
	for (int i = 0; i < n; ++i)
	{
		Point &p = A[i];
		c_in >> p.x >> p.y;
	}
	int q;
	c_in >> q;
	for (int j = 0; j < q; ++j)
	{
		R sx, tx, sy, ty;
		c_in >> sx >> tx >> sy >> ty;

		for (int i = 0; i < n; ++i)
		{
			Point &p = A[i];
			int x = p.x, y = p.y;
			if (sx <= x && x <= tx && sy <= y && y <= ty)
			{
				cout << i << endl;
			}
		}
		cout << endl;
	}
}

Compiler output:
a.cc:1: error: unterminated #if
    1 | #if 1
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
 
inline int next(void) {
    register int ret = 0;
    register int neg = false;
    register int bit = getchar();
    for (; bit < '0'; bit = getchar())
        if (bit == '-')neg ^= true;
    for (; bit >= '0'; bit = getchar())
        ret = ret * 10 + bit - '0';
    return neg ? -ret : ret;
}
 
int n, m;
 
int root;
int cmpk;
 
struct node {
    int id;
    int pos[2];
    int son[2];
    int min[2];
    int max[2];
    inline friend bool operator < 
        (const node &a, const node &b) {
            return a.pos[cmpk] < b.pos[cmpk];
    }
}tree[500005];
 
inline void update(int t) {
    for (int k = 0; k < 2; ++k) {
        tree[t].min[k] = tree[t].max[k] = tree[t].pos[k];
        for (int i = 0, s; i < 2; ++i)if (s = tree[t].son[i]) {
            if (tree[t].min[k] > tree[s].min[k])
                tree[t].min[k] = tree[s].min[k];
            if (tree[t].max[k] < tree[s].max[k])
                tree[t].max[k] = tree[s].max[k];
        }
    }
}
 
int build(int l, int r, int k) {
    int d = (l + r) / 2; cmpk = k;
    nth_element(tree + l, tree + d, tree + r + 1);
    tree[d].son[0] = l == d ? 0 : build(l, d - 1, k ^ 1);
    tree[d].son[1] = r == d ? 0 : build(d + 1, r, k ^ 1);
    return update(d), d;
}
 
inline void build(void) {
    for (int i = 1; i <= n; ++i) {
        tree[i].id = i - 1;
        tree[i].pos[0] = next();
        tree[i].pos[1] = next();
    }
    root = build(1, n, 0);
}
 
int st[2], ed[2], ans[500005], tot = 0;
 
inline bool judge(const node &t) {
    return t.pos[0] >= st[0]
        && t.pos[0] <= ed[0]
        && t.pos[1] >= st[1]
        && t.pos[1] <= ed[1];
}
 
inline bool check(const node &t) {
    return t.min[0] <= ed[0]
        && t.max[0] >= st[0]
        && t.min[1] <= ed[1]
        && t.max[1] >= st[1];
}
 
void query(int t) {
    if (judge(tree[t]))ans[tot++] = tree[t].id;
    if (tree[t].son[0] && check(tree[tree[t].son[0]]))query(tree[t].son[0]);
    if (tree[t].son[1] && check(tree[tree[t].son[1]]))query(tree[t].son[1]);
}
 
inline void query(void) {
    for (int i = 0; i < m; ++i, tot = 0) {
        st[0] = next();
        ed[0] = next();
        st[1] = next();
        ed[1] = next();
        tot = 0;
        query(root);
        sort(ans, ans + tot);
        for (int j = 0; j < tot; ++j)
            printf("%d\n", ans[j]);
        puts("");
    }
}

Compiler output:
a.cc: In function 'int next()':
a.cc:7:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    7 |     register int ret = 0;
      |                  ^~~
a.cc:8:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    8 |     register int neg = false;
      |                  ^~~
a.cc:9:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    9 |     register int bit = getchar();
      |                  ^~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

using namespace std;

const int MAX = 500000;
const int NIL = -1;

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

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;
}
Point P[MAX];
Node T[MAX];
int np = 0;
int makeKdTree(int l, int r, int depth) {
	if (!(l < r))
		return NIL;
	if (depth % 2 == 0) {
		sort(P + l, P + r, lessX);
	} else {
		sort(P + l, P + r, lessY);
	}
	int mid = (l + r) / 2;
	int t = np++;
	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 && sx <= x)
			find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
		if (T[v].r != NIL && x <= tx)
			find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
	} else {
		if (T[v].l != NIL && sy <= y)
			find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
		if (T[v].r != NIL && y <= ty)
			find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
	}
}

int main() {

	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		int x, y;
		scanf("%d %d", &x, &y);
		P[i] = Point(i, x, y);
		T[i].location = T[i].l = T[i].r = NIL;
	}
	int root = makeKdTree(0, n, 0);

	int q;
	scanf("%d", &q);
	vector<Point> ans;
	for (int i = 0; i < q; ++i) {
		int sx, tx, sy, ty;
		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 i = 0; i < ans.size(); ++i) {
			ans[i].print()
		}
		printf("\n");
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:98:39: error: expected ';' before '}' token
   98 |                         ans[i].print()
      |                                       ^
      |                                       ;
   99 |                 }
      |                 ~
Language: C++

#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;

struct Point {
	long long x, y;
	int i;
};

struct Node {
	Point p;
	int left;
	int right;
};

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

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

int makeTree(Node kDTree[],int& i, vector<Point>& points, int begin, int end,int depth) {
	if (begin >= end)return -1;
	if (depth & 1)sort(points.begin() + begin, points.begin() + end, cmp_x);
	else sort(points.begin() + begin, points.begin() + end, cmp_y);

	depth++;

	int mid = (begin + end) / 2;
	int j = i; i++;

	kDTree[j].p = points[mid];
	
	kDTree[j].left = makeTree(kDTree, i, points, begin, mid, depth);
	kDTree[j].right = makeTree(kDTree, i, points, mid + 1, end, depth);

	return j;
}

void searchTree(Node kDTree[], int i, Point p1, Point p2, int depth,vector<int>& ans) {
	Point p = kDTree[i].p;
	if (p.x >= p1.x && p.x <= p2.x && p.y >= p1.y && p.y <= p2.y) {
		ans.push_back(p.i);
	}

	if (depth & 1) {
		if (kDTree[i].left != -1 && p.x >= p1.x) {
			searchTree(kDTree, kDTree[i].left, p1, p2, depth + 1, ans);
		}
		if (kDTree[i].right != -1 && p.x <= p2.x) {
			searchTree(kDTree, kDTree[i].right, p1, p2, depth + 1, ans);
		}
	}
	else {
		if (kDTree[i].left != -1 && p.y >= p1.y) {
			searchTree(kDTree, kDTree[i].left, p1, p2, depth + 1, ans);
		}
		if (kDTree[i].right != -1 && p.y <= p2.y) {
			searchTree(kDTree, kDTree[i].right, p1, p2, depth + 1, ans);
		}
	}
}

const int MAX = 500000;

int main() {
	int n, q;
	vector<Point> points;
	Node* kDTree;

	kDTree = new Node[MAX];

	scanf_s("%d", &n);
	for (int i = 0; i < n; i++) {
		Point p;
		scanf_s("%d%d", &p.x, &p.y);
		p.i = i;
		points.push_back(p);
	}

	int index = 0;
	makeTree(kDTree,index, points, 0, n, 0);

	scanf_s("%d", &q);
	for (int i = 0; i < q; i++) {
		Point p1, p2;
		vector<int> ans;

		scanf_s("%d%d%d%d", &p1.x, &p2.x, &p1.y, &p2.y);
		searchTree(kDTree, 0, p1, p2, 0, ans);
		sort(ans.begin(), ans.end());

		for (int i = 0; i < ans.size(); i++) {
			printf("%d\n", ans[i]);
		}
		printf("\n");
	}
	return 0;
}

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

#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;

struct Point {
	long long x, y;
	int i;
};

struct Node {
	Point p;
	int left;
	int right;
};

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

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

int makeTree(Node kDTree[],int& i, vector<Point>& points, int begin, int end,int depth) {
	if (begin >= end)return -1;
	if (depth & 1)sort(points.begin() + begin, points.begin() + end, cmp_x);
	else sort(points.begin() + begin, points.begin() + end, cmp_y);

	depth++;

	int mid = (begin + end) / 2;
	int j = i; i++;

	kDTree[j].p = points[mid];
	
	kDTree[j].left = makeTree(kDTree, i, points, begin, mid, depth);
	kDTree[j].right = makeTree(kDTree, i, points, mid + 1, end, depth);

	return j;
}

void searchTree(Node kDTree[], int i, Point p1, Point p2, int depth,vector<int>& ans) {
	Point p = kDTree[i].p;
	if (p.x >= p1.x && p.x <= p2.x && p.y >= p1.y && p.y <= p2.y) {
		ans.push_back(p.i);
	}

	if (depth & 1) {
		if (kDTree[i].left != -1 && p.x >= p1.x) {
			searchTree(kDTree, kDTree[i].left, p1, p2, depth + 1, ans);
		}
		if (kDTree[i].right != -1 && p.x <= p2.x) {
			searchTree(kDTree, kDTree[i].right, p1, p2, depth + 1, ans);
		}
	}
	else {
		if (kDTree[i].left != -1 && p.y >= p1.y) {
			searchTree(kDTree, kDTree[i].left, p1, p2, depth + 1, ans);
		}
		if (kDTree[i].right != -1 && p.y <= p2.y) {
			searchTree(kDTree, kDTree[i].right, p1, p2, depth + 1, ans);
		}
	}
}

const int MAX = 500000;

int main() {
	int n, q;
	vector<Point> points;
	Node kDTree[MAX];

	kDTree = new Node[MAX];

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		Point p;
		scanf("%d%d", &p.x, &p.y);
		p.i = i;
		points.push_back(p);
	}

	int index = 0;
	makeTree(kDTree,index, points, 0, n, 0);

	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		Point p1, p2;
		vector<int> ans;

		scanf("%d%d%d%d", &p1.x, &p2.x, &p1.y, &p2.y);
		searchTree(kDTree, 0, p1, p2, 0, ans);
		sort(ans.begin(), ans.end());

		for (int i = 0; i < ans.size(); i++) {
			printf("%d\n", ans[i]);
		}
		printf("\n");
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:16: error: incompatible types in assignment of 'Node*' to 'Node [500000]'
   74 |         kDTree = new Node[MAX];
      |         ~~~~~~~^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#inclde <cstdio>
#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=0;

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 makeTree(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 = makeTree(l,mid,depth+1);
	T[t].r = makeTree(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 = makeTree(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:3:2: error: invalid preprocessing directive #inclde; did you mean #include?
    3 | #inclde <cstdio>
      |  ^~~~~~
      |  include
Language: C++

#include <bits/stdc++.h>
#include "../../printer.hpp"
using namespace std;
typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 60);
typedef pair<ll,ll> pii;
#define PB push_back

struct KDTree{
  vector<pii> tree;
  void add(ll x,ll y){tree.PB({x,y});}
  void construct(){construct(0,tree.size(),0);}
  void construct(ll l,ll r,ll d){
    if(l+1>=r) return;
    if(d%2==0) sort(tree.begin()+l,tree.begin()+r,[](pii a,pii b){return a.first<b.first;});
    else sort(tree.begin()+l,tree.begin()+r,[](pii a,pii b){return a.second<b.second;});
    ll mid=(l+r)/2;
    construct(l,mid,d+1);
    construct(mid+1,r,d+1);
  }
  vector<pii> get(ll sx,ll tx,ll sy,ll ty){return get(sx,tx,sy,ty,0,tree.size(),0);}
  vector<pii> get(ll sx,ll tx,ll sy,ll ty,ll l,ll r,ll d){
    if(l>=r) return vector<pii>();
    ll mid=(l+r)/2; pii p=tree[mid];
    vector<pii> ret;
    if(sx<=p.first&&p.first<=tx&&sy<=p.second&&p.second<=ty) ret.PB(p);
    if(l+1==r) return ret;
    if(d%2==0){
      if(tx<=p.first){for(pii i:get(sx,tx,sy,ty,l,mid,d+1)) ret.PB(i); return ret;}
      if(p.first<=sx){for(pii i:get(sx,tx,sy,ty,mid+1,r,d+1)) ret.PB(i); return ret;}
      for(pii i:get(sx,tx,sy,ty,l,mid,d+1)) ret.PB(i);
      for(pii i:get(sx,tx,sy,ty,mid+1,r,d+1)) ret.PB(i);
      return ret;
    }else{
      if(ty<=p.second){for(pii i:get(sx,tx,sy,ty,l,mid,d+1)) ret.PB(i); return ret;}
      if(p.second<=sy){for(pii i:get(sx,tx,sy,ty,mid+1,r,d+1)) ret.PB(i); return ret;}
      for(pii i:get(sx,tx,sy,ty,l,mid,d+1)) ret.PB(i);
      for(pii i:get(sx,tx,sy,ty,mid+1,r,d+1)) ret.PB(i);
      return ret;
    }
  }
};

int main(){
  ll n; cin>>n;
  vi x(n),y(n); REP(i,n) cin>>x[i]>>y[i];
  KDTree tree;
  REP(i,n) tree.add(x[i],y[i]);
  tree.construct();
  unordered_map<string,vector<ll>> ptoi;
  REP(i,n) ptoi[to_string(x[i])+"/"+to_string(y[i])].push_back(i);
  ll q; cin>>q;
  REP(i,q){
    ll sx,tx,sy,ty; cin>>sx>>tx>>sy>>ty;
    vi ans;
    for(pii p:tree.get(sx,tx,sy,ty)){
      for(ll j:ptoi[to_string(p.first)+"/"+to_string(p.second)]) ans.PB(j);
    }
    sort(ans.begin(),ans.end());
    for(ll j:ans) cout<<j<<endl;
    cout<<endl;
  }
}

Compiler output:
a.cc:2:10: fatal error: ../../printer.hpp: No such file or directory
    2 | #include "../../printer.hpp"
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.