Chef is given 3 integers A, B, and C such that A < B < C.

Chef needs to find the value of max(A, B, C) - min(A, B, C).

Here max(A, B, C) denotes the maximum value among A, B, C while min(A, B, C) denotes the minimum value among A, B, C.

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

- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of 3 integers A, B, C.

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

For each test case, output the value of max(A, B, C) - min(A, B, C).

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

$1 ≤ T ≤ 10$
$1 ≤ A < B < C ≤ 10$

----- Sample Input 1 ------ 
4
1 3 10
5 6 7
3 8 9
2 5 6

----- Sample Output 1 ------ 
9
2
6
4

----- explanation 1 ------ 
Test case $1$: Here, $max(1, 3, 10) = 10$ and $min(1, 3, 10) = 1$. Thus, the difference is $9$.

Test case $2$: Here, $max(5, 6, 7) = 7$ and $min(5, 6, 7) = 5$. Thus, the difference is $2$.

Test case $3$: Here, $max(3, 8, 9) = 9$ and $min(3, 8, 9) = 3$. Thus, the difference is $6$.

Test case $4$: Here, $max(2, 5, 6) = 6$ and $min(2, 5, 6) = 2$. Thus, the difference is $4$.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
c = int(input())
for i in range(c):
	(x, y, z) = map(int, input().split(' '))
	print(max(x, y, z) - min(x, y, z))


T = int(input())
for i in range(T):
	(x, y, z) = map(int, input().split())
	a = max(x, y, z)
	b = min(x, y, z)
	print(a - b)


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


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	d = max(a, b, c)
	e = min(a, b, c)
	print(d - e)


for t in range(int(input())):
	(i, j, k) = map(int, input().split(' '))
	print(max(i, j, k) - min(i, j, k))


t = int(input())
for i in range(0, t):
	(a, b, c) = map(int, input().split())
	list = [a, b, c]
	print(max(list) - min(list))


t = int(input())
for i in range(t):
	(A, B, C) = map(int, input().split())
	X = max(A, B, C)
	Y = min(A, B, C)
	print(X - Y)


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


n = int(input())
for i in range(0, n):
	(a, b, c) = list(map(int, input().split()))
	c = max(a, b, c)
	d = min(a, b, c)
	print(c - d)


t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	print(max(a) - min(a))


t = int(input())
for _ in range(t):
	a = [int(x) for x in input().split()]
	print(max(a) - min(a))


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


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	maximum = max(x, y, z)
	minimum = min(x, y, z)
	print(maximum - minimum)


for _ in range(int(input())):
	(x, y, z) = map(int, input().split())
	u1 = max(x, y, z)
	u2 = min(x, y, z)
	print(u1 - u2)


t = int(input())
for i in range(1, t + 1):
	lst = []
	(a, b, c) = map(int, input().split())
	lst.append(a)
	lst.append(b)
	lst.append(c)
	d1 = max(lst)
	d2 = min(lst)
	dif = d1 - d2
	print(dif)


test = int(input())
ans = []
while test:
	test = test - 1
	(A, B, C) = [int(x) for x in input().split()]
	ans.append(C - A)
for i in ans:
	print(i)


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


for _ in range(int(input())):
	(x, y, z) = list(map(int, input().split()))
	l = min(x, y, z)
	k = max(x, y, z)
	print(k - l)


t = int(input())
for i in range(t):
	(A, B, C) = map(int, input().split())
	if A < B < C:
		D = max(A, B, C)
		F = min(A, B, C)
		print(D - F)


T = int(input())
for CRICKETER in range(T):
	(A, B, C) = map(int, input().split())
	if (A, B, C):
		print(max(A, B, C) - min(A, B, C))


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


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


t = int(input())
while t:
	lst = list(map(int, input().split()))
	print(max(lst) - min(lst))
	t = t - 1


T = int(input())
for i in range(T):
	(a, b, c) = map(int, input().split())
	maximum = max(a, b, c)
	minimum = min(a, b, c)
	print(maximum - minimum)


a = int(input())
for i in range(a):
	(k, m, n) = map(int, input().split())
	print(n - k)


t = int(input())
for i in range(t):
	(A, B, C) = map(int, input().split())
	s = max(A, B, C)
	t = min(A, B, C)
	print(s - t)


T = int(input())
for i in range(T):
	a = list(map(int, input().split()))
	a.sort()
	print(max(a) - min(a))


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


for i in range(int(input())):
	(A, B, C) = map(int, input().split())
	D = [A, B, C]
	S = sorted(D)
	print(S[2] - S[0])


T = int(input())
for i in range(T):
	(A, B, C) = map(int, input().split(' '))
	value = max(A, B, C) - min(A, B, C)
	print(value)


for _ in range(int(input())):
	(A, B, C) = [int(i) for i in input().split()]
	print(max(A, B, C) - min(A, B, C))


t = int(input())
for i in range(t):
	(a, b, c) = [int(x) for x in input().split()]
	print(max(a, b, c) - min(a, b, c))


t = int(input())
while t > 0:
	(a, b, c) = map(int, input().split())
	m = max(a, b, c)
	s = min(a, b, c)
	print(m - s)
	t = t - 1


T = int(input())
for i in range(T):
	(N, M, L) = map(int, input().split())
	b = min(N, M, L)
	a = max(N, M, L)
	print(a - b)


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	print(z - x)


for t in range(int(input())):
	(a, b, c) = map(int, input().split())
	x = [a, b, c]
	print(sorted(x)[2] - sorted(x)[0])


n = int(input())
for i in range(n):
	l = []
	m = input().split()
	for k in m:
		l.append(int(k))
	print(max(l) - min(l))


n = int(input())
for i in range(0, n):
	(a, b, c) = map(int, input().split(' '))
	m = max(a, b, c)
	mi = min(a, b, c)
	print(m - mi)


n = int(input())
while n > 0:
	(a, b, c) = map(int, input().split())
	m = max(a, b, c)
	l = min(a, b, c)
	print(m - l)
	n -= 1


T = int(input())
for i in range(T):
	l = list(map(int, input().split()))
	print(max(l) - min(l))


n = int(input())
for i in range(0, n):
	l = list(map(int, input().strip().split()))
	print(max(l) - min(l))


T = int(input())
for t in range(T):
	(A, B, C) = map(int, input().split())
	a = max(A, B, C)
	b = min(A, B, C)
	c = a - b
	print(c)


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


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	if c > b and b > a:
		print(max(a, b, c) - min(a, b, c))


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


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


for i in range(int(input())):
	a = sorted(list(map(int, input().split())))
	print(a[2] - a[0])


t = int(input())
for i in range(0, t):
	l = list(map(int, input().split()))
	res1 = max(l)
	res2 = min(l)
	print(res1 - res2)


t = int(input())
for i in range(t):
	(A, B, C) = map(int, input().split())
	maximum = max(A, B, C)
	minimum = min(A, B, C)
	result = maximum - minimum
	print(result)


t = int(input())
for i in range(t):
	str = input()
	str = str.split()
	print(int(str[2]) - int(str[0]))


T = int(input())
for i in range(T):
	(A, B, C) = map(int, input().split())
	max_element = max(A, B, C)
	min_element = min(A, B, C)
	print(max_element - min_element)


t = int(input())
for ts in range(t):
	(x, y, z) = map(int, input().split(' '))
	print(max(x, y, z) - min(x, y, z))