Are they same(divide and conquer)

I’m getting WA after submission but for the given cases it is working fine.
Please tell me what is wrong with this code.
code link: https://ide.codingblocks.com/s/233481

@SWIFTY https://ide.codingblocks.com/s/233487 try this code

Not working.Still getting WA

@SWIFTY https://ide.codingblocks.com/s/233496

It worked!!! But what was the wrong with my code?

@SWIFTY i am not sure myself, but you can cross reference this code to see if you missed any corner cases!