https://www.codechef.com/viewsolution/36067751 .

i don’t know which test case its not giving AC. or there is something wrong with my code???

@ascent_0 Your logic is wrong as you are doing (y=y-x) in line 12 …what if x>y, then y becomes negative and your logic fails.

Try running your code on this test case:

1

3 3 6 4

Your code gives 22 while the correct answer should be 20.

https://www.codechef.com/viewsolution/36084229 .

i made some changes for this case . but its still giving me a wrong answer

If y>2x then think about it