| Insomnia 2025 |
|---|
| Finished |
Given two integers $$$x$$$ and $$$y$$$, choose an integer $$$v \in [0, x]$$$ such that the size of a set $$$S$$$ of distinct non-negative integers is maximized.
Formally, determine the largest possible size of a set $$$$$$ S = \{ s_1, s_2, \dots, s_m \} $$$$$$ satisfying the following conditions:
Output the maximum possible value of $$$m$$$. If no valid set exists, output $$$-1$$$.
The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 10^4)$$$ — the number of test cases.
Each test case contains two integers $$$x$$$ and $$$y$$$ $$$(0 \leq x, y \leq 10^{18})$$$.
For each test case, print a single integer — the maximum possible size of the set $$$S$$$. If no such set can be formed, report $$$-1$$$.
2 2 2 3 0
2 4
| Name |
|---|


