Convex Hull Optimization bug

Been trying to solve Machine Works WORLD FINALS 2011 with convex hull optimization. But my


(https://www.ideone.com/9jrdsI) goes into infinite loop in the input section. This happens from 47'th test case onwards. 

Also the answer is incorrect for test case 15. Can someone help. You can find the input/output date [HERE](https://icpc.baylor.edu/download/worldfinals/problems/icpc2011data.zip)