#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- template class SegTree_max { public: vector val; static V const def=0; V comp(V l,V r){ return max(l,r);}; SegTree_max(){val=vector(NV*2,def);}; V getval(int x,int y,int l=0,int r=NV,int k=1) { // x<=i1) entry>>=1, val[entry]=comp(val[entry*2],val[entry*2+1]); } }; template class SegTree_min { public: vector val; static V const def=1<<30; V comp(V l,V r){ return min(l,r);}; SegTree_min(){val=vector(NV*2,def);}; V getval(int x,int y,int l=0,int r=NV,int k=1) { // x<=i1) entry>>=1, val[entry]=comp(val[entry*2],val[entry*2+1]); } }; template class SegTree_or { public: vector val; static V const def=0; V comp(V l,V r){ return l | r;}; SegTree_or(){val=vector(NV*2,def);}; V getval(int x,int y,int l=0,int r=NV,int k=1) { // x<=i1) entry>>=1, val[entry]=comp(val[entry*2],val[entry*2+1]); } }; template class SegTree_and { public: vector val; static V const def=0x7FFFFFFF; V comp(V l,V r){ return l & r;}; SegTree_and(){val=vector(NV*2,def);}; V getval(int x,int y,int l=0,int r=NV,int k=1) { // x<=i1) entry>>=1, val[entry]=comp(val[entry*2],val[entry*2+1]); } }; int N,K; int A[101010]; SegTree_max stma; SegTree_min stmi; SegTree_or stor; SegTree_and stand; int nex[31][2]; int ret[101010]; vector add[101010],del[101010]; set cand[101010]; void solve() { int i,j,k,l,r,x,y; string s; MINUS(ret); cin>>N>>K; FOR(i,N) { cin>>A[i]; stma.update(i,A[i]); stmi.update(i,A[i]); stor.update(i,A[i]); stand.update(i,A[i]); } FOR(i,30) nex[i][0]=nex[i][1]=N; for(i=N-1;i>=0;i--) { FOR(j,30) { if(A[i]&(1<=K) { y=x; } } if(y==-1) continue; for(j=19;j>=0;j--) { if(y+(1<=N) continue; y+=(1< MP; MP[-1]=1; FOR(i,N) { FORR(e,add[i]) MP[e]++; FORR(e,del[i]) { MP[e]--; if(MP[e]==0) MP.erase(e); } cout<first<