Decreasing Srrnmieeda October Cook off challenge Solution | Easy Explain Decreasing Srrmieeda-
You are given two integers and . Find the smallest non-negative integer such that
Here, is the modulo operator, so is the remainder of after division by . For example, .
- The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first and only line of each test case contains two space-separated integers and .
For each test case, print a single line containing one integer ― the smallest possible