#K59187. Leftover Candies
Leftover Candies
Leftover Candies
You are given several test cases. For each test case, you are provided with two integers, N and M, where N represents the number of candies and M represents the number of children. The task is to determine the number of leftover candies after distributing them equally among the children.
The operation to determine the leftover candies is based on the modulo operation:
\( leftovers = N \bmod M \)
Please note that the input is provided via standard input (stdin) and the output should be printed to standard output (stdout). Each test case's result should be printed on a new line.
inputFormat
The first line of input contains an integer T representing the number of test cases.
Each of the following T lines contains two space-separated integers N and M where:
- N is the number of candies.
- M is the number of children.
outputFormat
For each test case, output the number of leftover candies on a new line.
## sample3
10 3
20 4
8 5
1
0
3
</p>