409772: GYM103741 B Contest Preparation

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Contest Preparationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Walk_alone is anxious to prepare for a programming contest, and he has ideas for $$$n$$$ problems now. Preparing a problem from scratch requires two jobs: making and validating. He asked $$$m$$$ people to help him with these two jobs.

All these $$$m$$$ people are skilled at making and validating problems, and each person needs exactly $$$1$$$ hour to do one of these two jobs. A job should be done by only one person without interruption (but making and validating one problem can be done by two different people), and a problem must be made before validated. Now Walk_alone wants to know the minimum hours to prepare for the contest if he arranges everyone's job properly.

Input

The input contains multiple test cases.

The first line of the input contains an integer $$$T\ (1 \leq T \leq 10^5)$$$ indicating the number of test cases.

For each testcase, there will be only one line containing two integers $$$n\ (0 \leq n \leq 10^9)$$$ and $$$m\ (1 \leq m \leq 10^9)$$$, indicating the number of problems and the number of people.

Output

For each testcase, output a single integer indicating the minimum hours Walk_alone should wait before the contest is well prepared.

ExampleInput
3
0 2
2 2
4 3
Output
0
2
3

Source/Category

加入题单

算法标签: