Range Minimum Query - Segment Tree

The following code is giving wrong answer in the hackerearth problem.

code - https://ide.codingblocks.com/s/36703
problem- https://www.hackerearth.com/practice/data-structures/advanced-data-structures/segment-trees/tutorial/

Edit: Was a pretty silly error. Have solved it now.