bool sum(int B){
float x=(-1+sqrt(1+8*B))/2;
if(ceil(x)==floor(x))
return true;
else
return false;
}
int maxIndex(int steps, int badIndex){
long long int max = ((steps)*(steps+1))/2;
bool t = sum(badIndex);
if(t){
return max - 1;
}
else{
return max;
}
}