What's wrong with the code?

@siddharth9k9,
How will storing max of segments, help you in finding number of elements >=k …??

sir, can please send the link of correct code so that i can understand.

i have updated but still getting wrong answer https://ide.codingblocks.com/s/226550

@siddharth9k9,
Please use C++ STL lower_bound, this is already a complicated code, please don’t complicate it more.

i have updated the code but still getting wrong answer https://ide.codingblocks.com/s/226550