Please Tell Why this code is giving Wrong Answer on Submission on CodeChef.

Problem Statement:

Recently Chef bought a bunch of robot-waiters. And now he needs to know how much to pay for the electricity that robots use for their work. All waiters serve food from the kitchen (which is in the point (0, 0)) and carry it to some table (which is in some point (x, y)) in a shortest way. But this is a beta version of robots and they can only do the next moves: turn right and make a step forward or turn left and make a step forward. Initially they look in direction of X-axis. Your task is to calculate for each query the number of moves they’ll do to reach corresponding table.

Input

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. For each test case there is a sing line containing two space-separated integers - x and y.
Output

For each test case, output a single line containing number of moves that robot will make to reach point (x, y)
Constraints

1 ≤ T ≤ 105
-109 ≤ x, y ≤ 109

Example

Input:
2
3 3
3 4

Output:
6
7


My Code {In JAVA}

import java.util.Scanner;

class Main {

public static void main(String args[])
{
	int t;
	int coordinates[];
	int i = 0,j = 0,k;
	int pos=0;
	int result[];
	int xpos,ypos;
	
	try
	{
		Scanner sc = new Scanner(System.in);
		
		t=sc.nextInt();
		coordinates = new int[2*t];
		result = new int[t];
		
		while(i<t)
		{
			for(k=0;k<2;k++)
			{
			coordinates[pos] = sc.nextInt();
			pos++;
			}
			i++;
		}
		
		
		
		i=0;j=0;k=0;
		
		
		
		while(i<t)
		{
			xpos = i*2;
			ypos = xpos+1;
			
			if(coordinates[xpos]>=0 && coordinates[ypos]>=0)
			{
				result[i]= coordinates[xpos] + coordinates[ypos];
			}
			
			else if(coordinates[xpos]<=0 && coordinates[ypos]>=0)
			{
				coordinates[xpos] = -1*coordinates[xpos];
				result[i]= coordinates[xpos] + coordinates[ypos];
			}
			
			else if(coordinates[xpos]<=0 && coordinates[ypos]<=0)
			{
				coordinates[xpos] = -1*coordinates[xpos];
				coordinates[ypos] = -1*coordinates[ypos];
				result[i]= coordinates[xpos] + coordinates[ypos];
			}
			
			else if(coordinates[xpos]>=0 && coordinates[ypos]<=0)
			{
				coordinates[ypos] = -1*coordinates[ypos];
				result[i]= coordinates[xpos] + coordinates[ypos];
			}
			
			i++;
		}
		
		for(i=0;i<result.length;i++)
		{
			System.out.println(result[i]);
		}
	}
	
	catch(Exception e)
	{
		e.printStackTrace();
	}
	
	
}

}


Please tell what is the problem in the code. Because in my IDE its working fine and giving correct output. But when I submit it on codechef its giving “WRONG ANSWER” as result.

Please delete the post.Its an ongoing contest.Please do not discuss strategy, suggestions or tips in the forum during a live contest.