sob.cpp: In function 'int32_t main()':
sob.cpp:23:40: error: 'tok' was not declared in this scope
if (((n-1) & i) == (n-1)) {tok = i+1-n; break;}
^~~
sob.cpp:27:34: error: 'tok' was not declared in this scope
cout << i << " " << (tok+i < m ? tok+i+n : tok+i) << "\n";
^~~
sob.cpp:41:42: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
p += (1 << (int)__lg(v[now]) + 1);
~~~~~~~~~~~~~~~~~~^~~
sob.cpp:50:15: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z
for (auto [L, R] : ans) cout << L << " " << R << "\n";
^