Welcome to the FOSS Section!
You are given two positive integers
For example, if
- The first line contains an integer
$t$ ($1 \le t \le 1000$ ) — the number of test cases. - Each of the next
$t$ lines contains two integers$n$ and$k$ ($2 \le n \le 10^{15}$ ,$1 \le k \le 10^{15}$ ).
For each test case, print the
Input:
4
3 7
4 12
2 1
10 26
Output:
10
15
1
28
There is a solution.cpp file already provided in this directory.
To complete this task:
- Verify if the provided solution is correct.
- Ensure it can pass our automated CI checks.
- Submit a Pull Request with the exact working version.
Note: If the current code fails the automated tests, remember that version control is a time machine! The optimal logic might already exist somewhere in the project's history.