def aa(m,seg,vv): while m>1: m//=2 seg[m]=vv(seg[m*2],seg[m*2+1]) def bb(l,r,seg,vv,res): while l