template<typename T> class ST{ public: vector<vector<T> > st; int sz; function<T(T,T)> op;//op can be max,min,gcd,lcm,&,|,etc. ST(vector<T>&x,function<T(T,T)> f) : op(std::move(f)){ sz=x.size(); int K=log2(sz); st.resize(sz,vector<T>(K+1)); for(int i...