sails.cpp: In function 'void upd(int, int)':
sails.cpp:9:42: error: 'i' was not declared in this scope
9 | for(; idx < N; idx += (idx & -idx)) BIT[i] += v;
| ^
sails.cpp:9:48: error: 'v' was not declared in this scope
9 | for(; idx < N; idx += (idx & -idx)) BIT[i] += v;
| ^
sails.cpp: In function 'int qry(int)':
sails.cpp:14:45: error: 'i' was not declared in this scope
14 | for(; idx; idx -= (idx & -idx)) ans += BIT[i];
| ^
sails.cpp: In function 'int main()':
sails.cpp:32:11: error: 'lowerBound' was not declared in this scope; did you mean 'lround'?
32 | int l = lowerBound(v), r = lowerBound(v + 1) - 1;
| ^~~~~~~~~~
| lround
sails.cpp:37:7: error: 'r' was not declared in this scope
37 | upd(r - (k - max(0, l - (N - h))) + 1, 1);
| ^