prog.cpp: In function 'void update(int, int)':
prog.cpp:2:32: error: 'Q' was not declared in this scope
int id = 1, ini = 1, fim = Q, mid, idx = 0;
^
prog.cpp:3:13: error: 'MAXN' was not declared in this scope
int ids[MAXN];
^
prog.cpp:5:9: error: 'mid' was not declared in this scope
mid = (ini + fim) / 2;
^
prog.cpp:6:9: error: 'ids' was not declared in this scope
ids[idx] = id;
^
prog.cpp:6:13: error: 'idx' was not declared in this scope
ids[idx] = id;
^
prog.cpp:16:5: error: 'tree' was not declared in this scope
tree[id] = val;
^
prog.cpp:17:5: error: 'idx' was not declared in this scope
idx--;
^
prog.cpp:19:14: error: 'ids' was not declared in this scope
id = ids[idx--];
^
prog.cpp:25:58: error: 'gcd' was not declared in this scope
tree[id] = gcd(tree[id * 2], tree[id * 2 + 1]);
^