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("%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");
	}

????????????delete[] kDTree;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:102:1: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      | ^
a.cc:102:2: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      |  ^
a.cc:102:3: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      |   ^
a.cc:102:4: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      |    ^
a.cc:102:5: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      |     ^
a.cc:102:6: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      |      ^
a.cc:102:7: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      |       ^
a.cc:102:8: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      |        ^
a.cc:102:9: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      |         ^
a.cc:102:10: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      |          ^
a.cc:102:11: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      |           ^
a.cc:102:12: error: expected primary-expression before '?' token
  102 | ????????????delete[] kDTree;
      |            ^
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token
a.cc:102:28: error: expected ':' before ';' token
  102 | ????????????delete[] kDTree;
      |                            ^
      |                            :
a.cc:102:28: error: expected primary-expression before ';' token