Upper and lower bound (binary search)

PLEASE COMMENT AND CORRECT MY CODE
my code
https://ide.codingblocks.com/s/40978

question link
https://hack.codingblocks.com/contests/c/512/675

Hey Jai, there were just some small mistakes which you have done in the code, I have corrected them and commented the changes in your code .