Write a program to find the remainder when an integer A is divided by an integer B.

-----Input-----

The first line contains an integer T, the total number of test cases. Then T lines follow, each line contains two Integers A and B. 

-----Output-----
For each test case, find the remainder when A is divided by  B, and display it in a new line.

-----Constraints-----
- 1 ≤ T ≤ 1000
- 1 ≤ A,B ≤ 10000

-----Example-----
Input
3 
1 2
100 200
40 15

Output
1
100
10

Source: codechef | Difficulty: EASY
Tags: Mathematics

Complete search


Solutions:
x = int(input())
for i in range(x):
	(m, n) = map(int, input().split())
	print(m % n)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	print(a % b)


n = int(eval(input()))
for i in range(0, n):
	(a, b) = list(map(int, input().split()))
	r = a % b
	print(r)


number = int(input())
for i in range(number):
	x = list(map(int, input().split(' ')))
	print(x[0] % x[1])


t = int(input())
mod = []
for i in range(0, t):
	(a, b) = input().split()
	c = int(a) % int(b)
	mod.append(c)
for i in mod:
	print(i)


T = int(input())
for i in range(T):
	(A, B) = map(int, input().split())
	A = A % B
	print(A)


x = int(input())
for _ in range(x):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	z = a % b
	print(z)


t = int(input())
for i in range(0, t):
	(x, y) = map(int, input().split())
	c = x % y
	print(c)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	c = a % b
	print(c)


t = int(input())
for i in range(t):
	(A, B) = map(int, input().split())
	print(A % B)


n = int(input())
while n > 0:
	(x, y) = map(int, input().strip().split())
	print(x % y)
	n = n - 1


t = int(input())
for x in range(0, t):
	(a, b) = input().split()
	rem = int(a) % int(b)
	print(int(rem), '\n')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	print(n % m)


t = int(input())
for i in range(t):
	(c, d) = input().split()
	a = int(c)
	b = int(d)
	print(a % b)


t = int(input())
while t:
	t -= 1
	(n, m) = map(int, input().split())
	print(n % m)


for k in range(int(input())):
	(x, y) = [int(k) for k in input().split()]
	print(x % y)


n = int(input())
for _ in range(n):
	(a, b) = [int(x) for x in input().split()]
	print(a % b)


n = int(input())
mylist = []
while n > 0:
	(a, b) = list(map(int, input().split()))
	rem = a % b
	mylist.append(rem)
	n = n - 1
for i in mylist:
	print(i)


n = int(input())
while n != 0:
	(a, b) = map(int, input().split())
	print(a % b)
	n -= 1


n = int(input())
i = 1
while i <= n:
	(a, b) = [int(x) for x in input().split()]
	print(a % b)
	i += 1


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	ans = a % b
	print(ans)


N = int(input())
while N > 0:
	(a, b) = map(int, input().split())
	Remainder = a % b
	print(Remainder)
	N = N - 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	print(n % k)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	print(x % y)


T = int(input())
for x in range(T):
	(A, B) = map(int, input().split())
	print(A % B)