By AshToady, history, 4 months ago, here's my code to the most annoying problem i've ever encountered(its a recent one, so you probably know it),

i'm getting 2147483647 runtime error.

Having submitted over 15/20 codes over a period of a week, and researching on it, i'm sure my algorithm is correct, have checked it innumerable times.

To simplify the logic-> its grouping numbers with matching largest bits and feeding it to calc function for further recursion till required.

what is this error 2147483647? i've faced it many times, but never really understood it, it always magically somehow gets resolved, except this time.

need help!

and if you can spot the mistake, kindly let me know. Comments (2)
•  » » i hope its better now #include #define ll long long #define fi first #define se second using namespace std; vector ans;ll kpos,k,n; void calc(vector>v,ll pos) { for(ll i=pos;i>kpos;i--) { vector>v2; for(ll j=0;j>pp,pp1; for(ll j=0;j-1&&stat;i--) { ll x; if(pp[i].fi!=0) x=(pp[i].fi>>kpos<-1;j--) { if((k&(1ll<>n>>k; ll a[n]; ll y=k;kpos=0; vector>v(n); while(y>0&&y!=1) y>>=1ll,kpos++; for(ll i=0;i>v[i].fi; v[i].se=i+1; } if(k) { calc(v,30); if(ans.size()>1) { cout<