#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int LL; typedef pair P; typedef pair LP; const int INF=1<<30; const LL MAX=1e9+7; void array_show(int *array,int array_n,char middle=' '){ for(int i=0;i &vec_s,int vec_n=-1,char middle=' '){ if(vec_n==-1)vec_n=vec_s.size(); for(int i=0;i &vec_s,int vec_n=-1,char middle=' '){ if(vec_n==-1)vec_n=vec_s.size(); for(int i=0;i A,B; bitset C; LL n,m; bool check(){ LL i,j,k; LL a,b,c; LL mod=-1; C.reset(); if(m used(mod); for(i=n;i>n>>m; vector v1,va,vb; for(i=0;i>a; va.push_back(a); v1.push_back(a); } for(i=0;i>a; vb.push_back(a); v1.push_back(a); } sort(v1.begin(),v1.end()); LL z[3]={-1,v1.size()}; while(z[1]-z[0]>1){ z[2]=(z[0]+z[1])/2; a=v1[z[2]]; A.reset(),B.reset(); for(i=0;i=a)A.set(i,1); if(vb[i]>=a)B.set(i,1); } if(check())z[0]=z[2]; else z[1]=z[2]; } cout<