http://www.codechef.com/viewsolution/5155858 this is the link of my solution
Brother, it returns
You need to check
if( ((x%5)==0) && (y>=(x+0.5)) , for correct answer .
instead of if((double)x>(y+0.5)||x%5!=0) you should use if((double)x>(y+0.5)&& x%5!=0) as here you need follow both the conditions.