Dairy Milk, KitKat & Snickers
Time: 2 s
Memory: 125 MB
Memory: 125 MB
At East West University there are an infinite number of boys and girls in number. You have \(a\) amount of dairy milk chocolates and \(b\) amount of KitKat chocolates. However, you've suddenly developed a craving for Snickers chocolates. Your goal is to distribute all the dairy milk chocolates and half of the Snickers to boys, while all the KitKats and half of the Snickers are reserved for girls.
Basically, a boy is happy:
Basically, a boy is happy:
- If he gets no chocolate.
- Or, the same amount of Dairy Milk as other boys who got Dairy Milk, and the same amount of Snickers as other boys who got Snickers.
- If she gets no chocolate.
- Or, the same amount of KitKats as other girls who got KitKats, and the same amount of Snickers as other girls who got Snickers.
Input
The first line contains a single integer \(t\) \((1 \leq t \leq 10^5)\) — the number of test cases.The first line of each test case contains two integers \(a, b\) \((1 \leq a, b \leq 10^9)\) — described in the statement.
Output
For each test case, print a single integer — described in the statement.
Examples
| Input | Output |
|---|---|
|
3
2 3 6 5 7 7 |
12
60 14 |
Problem Info
| Problem ID | 272 |
| Time Limit | 2000 ms |
| Memory Limit | 128000 KB |
| Moderators | amirhozaifa , fahimcp495 |
Statistics
Submit
You need to Login or Registration for submit your solution