#pragma GCC optimize("Ofast") #pragma GCC target("avx2") char*mmap(); #define RD(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} #define WTHI(v) {long _z=v,_n=0,_d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(long*)wp=_d;wp+=_n;} #define WTLO(v) {long _z=v,_n=8,_d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(long*)wp=_d;wp+=8;} #define WT(v) if(v>=100000000){WTHI(v/100000000);WTLO(v);}else{WTHI(v);} void radix_sort_aux(unsigned*a,unsigned*b,int n,int d){ int c[256]; for(int i=0;i<256;++i){ c[i]=0; } for(int i=0;i>d&255]; } int t=0; for(int i=0;i<256;++i){ int u=c[i]; c[i]=t; t+=u; } for(int i=0;i>d&255]++]=a[i]; } } void radix_sort(unsigned*a,int n){ radix_sort_aux(a,a+n,n,0); radix_sort_aux(a+n,a,n,8); radix_sort_aux(a,a+n,n,16); radix_sort_aux(a+n,a,n,24); } unsigned as[400000]; main(){ char*rp=mmap(0l,11l*200003,1,2,0,0ll); RD(n); RD(k); for(int i=0;i>1)-p)*d; if(s>=k) break; p=a>>1; d+=a&1?:-1; } long z=(as[i]>>1)-(s-k)/d-1; char wbuf[16],*wp=wbuf; WT(z); write(1,wbuf,wp-wbuf); _exit(0); }