namespace std{ inline int __lg(int n){//Precondition: n >= 0 int k=0; for(;n!=0;n>>=1)++k; return k?--k:1; } }