foo.cpp:1:1: error: 'include' does not name a type
include <cstdio> include <cstring> include <algorithm> define mid (l + r) / 2 define ls pos << 1, l, mid define rs pos << 1 | 1, mid + 1, r
^
foo.cpp: In function 'void Update(int, int, int)':
foo.cpp:18:28: error: 'max' was not declared in this scope
x1.val = max(x2.val, x3.val);
^
foo.cpp:22:19: error: 'mid' was not declared in this scope
if (x2.val == mid - l + 1){
^
foo.cpp:25:23: error: 'mid' was not declared in this scope
if (x3.val == r - mid){
^
foo.cpp: In function 'void Build_Tree(int, int, int)':
foo.cpp:36:12: error: 'ls' was not declared in this scope
Build_Tree(ls);
^
foo.cpp:37:12: error: 'rs' was not declared in this scope
Build_Tree(rs);
^
foo.cpp: In function 'void Query(int, int, int, int)':
foo.cpp:44:10: error: 'mid' was not declared in this scope
if (x <= mid){
^
foo.cpp:45:7: error: 'ls' was not declared in this scope
Query(ls, x);
^
foo.cpp:47:9: error: 'mid' was not declared in this scope
if (x > mid){
^
foo.cpp:48:7: error: 'rs' was not declared in this scope
Query(rs, x);
^
foo.cpp: In function 'int main()':
foo.cpp:54:22: error: 'scanf' was not declared in this scope
scanf("%d %d", &N, &Q);
^
foo.cpp:60:28: error: 'printf' was not declared in this scope
printf("%d\n", T[1].val);
^