Help me in solving CHESS_PAIR problem

My issue

i cant able to understand the problem and what should i have to find from the chess pairing and how ?
can anyone plzz help this poor little guy(me)… :slight_smile:

My code

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
	}
}

Problem Link: CHESS_PAIR Problem - CodeChef

@gowtham2k2
U have to find the minimum number of pairs that have an rated opponent.

plzz refer the following solution 
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner (System.in);
		int t = sc.nextInt();
		for (int i=0; i<t; i++)
		{
		    int n = sc.nextInt();
		    int x = sc.nextInt();
		    
		    if ((n-x) >= 0){
		        System.out.println(0);
		    }
		    else{
		        System.out.println(Math.abs(x-n)*2);
		    }
		}
	}
}