Chef bought car insurance. The policy of the insurance is:

The maximum rebatable amount for any damage is Rs X lakhs.
If the amount required for repairing the damage is ≤ X lakhs, that amount is rebated in full.

Chef's car meets an accident and required Rs Y lakhs for repairing.

Determine the amount that will be rebated by the insurance company.

------ Input Format ------ 

- The first line of input will contain a single integer T, denoting the number of test cases.
- The first and only line of each test case contains two space-separated integers X and Y.

------ Output Format ------ 

For each test case, output the amount (in lakhs) that will be rebated by the insurance company.

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ X, Y ≤ 30$

----- Sample Input 1 ------ 
4
5 3
5 8
4 4
15 12

----- Sample Output 1 ------ 
3
5
4
12

----- explanation 1 ------ 
Test case $1$: The damages require only Rs $3$ lakh which is below the upper cap, so the entire Rs $3$ lakh will be rebated.

Test case $2$: The damages require Rs $8$ lakh which is above the upper cap, so only Rs $5$ lakh will be rebated.

Test case $3$: The damages require only Rs $4$ lakh which is equal to the upper cap, so the whole Rs $4$ lakh will be rebated.

Test case $4$: The damages require Rs $15$ lakh which is above the upper cap, so only Rs $12$ lakh will be rebated.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	k = min(x, y)
	print(k)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	if x >= y:
		print(y)
	else:
		print(x)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a <= b:
		print(a)
	else:
		print(b)


a = int(input())
for i in range(a):
	(b, c) = [int(x) for x in input().split()]
	if b > c:
		print(c)
	else:
		print(b)


for t in range(int(input())):
	(s, k) = map(int, input().split())
	print(min(s, k))


for _ in range(int(input())):
	(x, y) = map(int, input().split(' '))
	if y < x:
		print(y)
	else:
		print(x)


a = int(input())
while a != 0:
	(x, y) = map(int, input().split())
	if x > y:
		print(y)
	elif x == y:
		print(x)
	else:
		print(x)
	a -= 1


T = int(input())
for i in range(T):
	(N, M) = map(int, input().split())
	if N >= M:
		print(M)
	else:
		print(N)


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


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	if x > y:
		print(y)
	elif x < y:
		print(x)
	elif x == y:
		print(y)


T = int(input())
for i in range(T):
	(X, Y) = map(int, input().split())
	if X >= Y:
		print(Y)
	else:
		print(X)


T = int(input())
for i in range(T):
	(X, Y) = map(int, input().split())
	print(min(X, Y))


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


t = int(input())
for i in range(t):
	(X, Y) = map(int, input().split())
	upper_cap = Y
	if X <= upper_cap:
		print(X)
	else:
		print(upper_cap)


test_cases = int(input())
for i in range(test_cases):
	insurance = list(map(int, input().split()))
	if insurance[-1] > insurance[0]:
		print(insurance[0])
	else:
		print(insurance[-1])


n = int(input())
for i in range(0, n):
	(a, b) = map(int, input().split(' '))
	if a >= b:
		print(b)
	else:
		print(a)


t = int(input())
for i in range(t):
	l = []
	l = list(map(int, input().split()))
	if l[-1] > l[0]:
		print(l[0])
	else:
		print(l[-1])


for _ in range(int(input())):
	a = list(map(int, input().split()))
	print(min(a))


def rebate(x, y):
	if y <= x:
		return y
	else:
		return x
t = int(input())
for i in range(1, t + 1):
	(x, y) = map(int, input().split())
	res = rebate(x, y)
	print(res)


t = int(input())
while t:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	print(min(a, b))
	t -= 1


T = int(input())
for i in range(0, T):
	(x, y) = map(int, input().split())
	if x > y:
		print(y)
	else:
		print(x)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(min(a, b))


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	print(min(x, y))


n = int(input())
for i in range(n):
	(x, y) = list(map(int, input().split()))
	if x <= y:
		print(x)
	else:
		print(y)


loop = int(input())
for i in range(loop):
	x = list(map(int, input().split()))
	if x[0] > x[1]:
		print(x[1])
	else:
		print(x[0])


for i in range(int(input())):
	n = list(map(int, input().split()))
	if n[1] >= n[0]:
		print(n[0])
	else:
		print(n[1])


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	if x > y:
		print(y)
	else:
		print(x)
	t = t - 1