Pranav and TLE

4.5

4 votes
Easy-Medium
Problem

Pranav just learned about Modulus(%) and trying to solve a problem on Modulus but he always get TLE. Your task is to help him. Problem is simple, you have been given two numbers A and M and you have to find A%M and print it.

Input Format

Firstline: T, where T is the number of test cases. Now T line followed, Where each line consist of A and M space separated.

Constraints :

1 <=T<=100

Number of digit in A<=5×10^5

1<=M<=10^9

Output Format

Print A%M in a new line.

Sample Input

2

12344 12

12 123

Sample Output

8

12

NOTE Only C/C++ is allowed for this challenge.

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?