Help me in solving LBJ208A problem

My issue

I’m not able to understand the code

My code





Learning course: Beginner DSA in Java
Problem Link: CodeChef: Practical coding for everyone

@ankit988370
The logic is if N>M then answer is M + (N-M)*2;
else answer would be N;