**Group Assignment solution codechef** – Chef’s professor is planning to give his class a group assignment. There are 2N2N students in the class, with distinct roll numbers ranging from 11 to 2N2N. Chef’s roll number is XX.

# Group Assignment solution codechef

The professor decided to create NN groups of 22 students each. The groups were created as follows: the first group consists of roll numbers 11 and 2N2N, the second group of roll numbers 22 and 2N−12N−1, and so on, with the final group consisting of roll numbers NN and N+1N+1.

Chef wonders who his partner will be. Can you help Chef by telling him the roll number of his partner?

**Input Format**

- The first line of input will contain an integer TT— the number of test cases. The description of TT test cases follows.
- The first and only line of each test case contains two integers NNand XX, denoting the number of groups that will be formed, and Chef’s roll number.

**Output Format**

For each test case, output the roll number of the student that will be Chef’s partner.

## Group Assignment solution codechef

- 1≤T≤1031≤T≤103
- 1≤N≤1081≤N≤108
- 1≤X≤2N1≤X≤2N

**Sample Input 1 **

3 2 2 3 1 3 4

**Sample Output 1 **

3 6 3

## Group Assignment solution codechef

**Test case **11: The groups will be {(1,4),(2,3)}{(1,4),(2,3)}. Chef’s roll number is 22, so his partner’s roll number will be 33.

**Test case **22: The groups will be {(1,6),(2,5),(3,4)}{(1,6),(2,5),(3,4)}. Chef’s roll number is 11, so his partner’s roll number will be 66.

**Test case **33: The groups will be {(1,6),(2,5),(3,4)}{(1,6),(2,5),(3,4)}. Chef’s roll number is 44, so his partner’s roll number will be 33.