You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.
Here, |x| denotes the absolute value of x.
Find the minimum total cost required to complete all the task.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq A_1, A_2, A_3 \leq 100

-----Input-----
Input is given from Standard Input in the following format:
A_1 A_2 A_3

-----Output-----
Print the minimum total cost required to complete all the task.

-----Sample Input-----
1 6 3

-----Sample Output-----
5

When the tasks are completed in the following order, the total cost will be 5, which is the minimum:
 - Complete the first task at cost 0.
 - Complete the third task at cost 2.
 - Complete the second task at cost 3.

Difficulty: introductory

Starter code:

Solutions:
A=list(map(int,input().split()))

A.sort(reverse=True)

print((A[0]-A[2]))


lst = input().split()

costs = []

for a in [[0, 1], [0, 2], [1, 2]]:
   costs.append(abs(int(lst[a[0]]) - int(lst[a[1]])))

print(sum(costs) - max(costs))

a=list(sorted(map(int,input().split(" "))))
print(a[2]-a[0])

a = list(map(int, input().split()))
list_int = list(a)

min_num = min(list_int)
max_num = max(list_int)
mid_num = list_int.pop(1)

minimum_cost = abs(mid_num - min_num) + abs(max_num - mid_num)
print(minimum_cost)


a, b, c = map(int, input().split())

res = [abs(a-b), abs(a-c), abs(b-c)]

print(sum(res)-max(res))  

A, B, C = list(map(int, input().split()))
a = abs(A - B) + abs(B - C)
b = abs(B - C) + abs(C - A)
c = abs(C - A) + abs(A - B)
print((min(a,b,c)))


A = list(map(int, input().split()))
A.sort()
print((A[-1]-A[0]))


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

a = list(map(int, input().split()))
a.sort()
print(abs(a[1]-a[0]) + abs(a[2]-a[1]))

# -*- coding: utf-8 -*-

def get_input() -> list:
    """
    標準入力を取得する.

    Returns:\n
        list: 標準入力
    """
    A = list(map(int, input().split()))

    return A


def main(A: list) -> None:
    """
    メイン処理.

    Args:\n
        A (list): 整数列(1 <= A_i <= 100)
    """
    # 求解処理
    ans = max(A) - min(A)

    # 結果出力
    print(ans)


def __starting_point():
    # 標準入力を取得
    A = get_input()

    # メイン処理
    main(A)

__starting_point()

a, b, c = map(int, input().split())
list01 = [a, b, c]
list02 = sorted(list01)
print(list02[2] - list02[1] + list02[1] - list02[0])

list=input().split(" ")
list_n=[int(s) for s in list]
print(int(max(list_n))-int(min(list_n)))

l = sorted(list(map(int,input().split())))

ans=0
for i in range(len(l)-1):
    ans+=l[i+1]-l[i]

print(ans)


a=list(map(int,input().split()))
a.sort()
ans=0 if len(set(a))==1 else a[2]-a[0]
print(ans)  

from itertools import permutations
A = list(map(int,input().split()))

per_ls = list(permutations(A))

ans = float("inf")
for (a,b,c) in per_ls:
  tmp = 0 + abs(a - b) + abs(b - c)
  ans = min(ans, tmp)
  
print(ans)

li=a,b,c=list(map(int,input().split()))
lis=sorted(li)
print((lis[2]-lis[0]))


a = sorted(list(map(int, input().split())), reverse=True)
res = 0
for i in range(3 - 1):
    res += a[i] - a[i + 1]
print(res)

l = list(map(int,input().split()))
l.sort()

print(((l[2]-l[1])+(l[1]-l[0]))) 


l=sorted(map(int,input().split()))
print(l[2]-l[0])

al = list(map(int,input().split()))
s = []
for i in range(3):
  s.append(abs(al[-i]-al[1-i])+abs(al[1-i]-al[2-i]))
print(min(s))

v=list(map(int,input().split()))
v.sort()
print(v[2]-v[0])

a, b, c = sorted(map(int, input().split()))
print(c-a)

A = list(map(int, input().split()))
A.sort()

ans = 0
for i in range(2):
    ans += abs(A[i] - A[i+1])
print(ans)

a = [int(x) for x in input().split()]
a1 = abs(a[1] - a[0]) + abs(a[1] - a[2])
a2 = abs(a[2] - a[0]) + abs(a[2] - a[1])
a3 = abs(a[2] - a[0]) + abs(a[1] - a[0])
print(min(a1,a2,a3))

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

a = list(map(int, input().split()))
c = max(a) - min(a)
print(c)

a,b,c=sorted(map(int, input().split()))
print(c-a)

A = sorted(map(int,input().split()))
print(abs(A[0]-A[2]))

a=list(map(int,input().split()))
print(max(a)-min(a))

A=list(map(int,input().split()))
A.sort()
print((A[2]-A[0]))


a = list(map(int, input().split()))
a.sort()
print(a[-1] - a[0])

a, b, c = map(int, input().split())

min_n = min(a, b, c)
max_n = max(a, b, c)

cost_min = (max_n - min_n)
print(cost_min)

A = list(map(int, input().split()))
print((max(A) - min(A)))


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

a = list(map(int,input().split()))

a.sort()

print(((a[2] - a[1]) + (a[1] - a[0]))) 


X=list(map(int,input().split()))
print(max(X)-min(X))

A = list(map(int, input().split()))
A.sort()

print(A[-1]-A[0])

A = list(map(int, input().split()))
print(max(A) - min(A))

A123 = list(map(int, input().split()))
ans = 1000

for i, a in enumerate(A123):
    for j, b in enumerate(A123):
        for k, c in enumerate(A123):
            if i != j and j != k and k != i:
                tmp = abs(b - a) + abs(c - b)
                if tmp < ans:
                    ans = tmp

print(ans)

import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

tasks = inl()
tasks.sort()
ans = 0
for i in range(len(tasks)-1):
    ans += tasks[i+1] - tasks[i]

print(ans)

c=list(map(int,input().split()))
d=sorted(c)
a=0
a+=d[1]-d[0]
a+=d[2]-d[1]
print(a)

# -*- coding: utf-8 -*-
import sys
import itertools

# 標準入力を取得
A = list(map(int, input().split()))

# 求解処理
ans = sys.maxsize
for A_1, A_2, A_3 in itertools.permutations(A, r=3):
    ans = min(ans, abs(A_2 - A_1) + abs(A_3 - A_2))

# 結果出力
print(ans)


a = list(map(int, input().split()))
x = abs(a[0]-a[1])
y = abs(a[1]-a[2])
z = abs(a[2]-a[0])
m = max(x, y, z)
if m == x:
  print(y+z)
elif m == y:
  print(x+z)
else:
  print(x+y)

*a, = map(int,input().split())
print(max(a) - min(a))

tasks = list(map(int, input().split()))

max = tasks[0]
for i in range(1, 3, 1):
    if max < tasks[i]:
        max = tasks[i]
tasks.remove(max)

min = tasks[0]
if tasks[1] < min:
    min = tasks[1]
tasks.remove(min)

ans = max - min
print(ans)

A = list(map(int, input().split()))
A.sort(reverse=True)
cur = A.pop(0)
ans = 0
for a in A:
    ans += (cur - a)
    cur = a

print(ans)

a = list(map(int, input().split()))
a.sort()
print(abs(a[1]-a[0]) + abs(a[2]-a[1]))

# -*- coding: utf-8 -*-
# 標準入力を取得
A = list(map(int, input().split()))

# 求解処理
ans = max(A) - min(A)

# 結果出力
print(ans)


import itertools
a = list(map(int, input().split()))
res = sum(a)
for i in itertools.permutations(a):
    a1, a2, a3 = i
    tmp = abs(a1 - a2) + abs(a2 - a3)
    res = min(res, tmp)
print(res)

A1, A2, A3 = map(int, input().split())
ans = max(A1, A2, A3) - min(A1, A2, A3)

print(ans)


S=list(map(int,input().split()))
S.sort()
sum=0
sum += (S[2]-S[0])
print(sum)

A = list(map(int, input().split()))
A.sort()
ans =A[1]-A[0] +A[2]-A[1]
print(ans)

A = list(map(int, input().split()))

print(max(A)-min(A))

import numpy as np
N_List = np.array(list(map(int,input().split())))
N_List_a = np.sort(N_List)
print(sum(N_List_a[1:]-N_List_a[:-1]))

a = list(map(int, input().split()))
list_int = list(a)

list_int.sort()
min_num = min(list_int)
max_num = max(list_int)
mid_num = list_int.pop(1)

minimum_cost = abs(mid_num - min_num) + abs(max_num - mid_num)
print(minimum_cost)


import math
a=list(map(int, input().split()))
q=[]
for i in range(3):
  for j in range(3):
    if not i==j:
      q.append(abs(a[i]-a[j])+abs(a[j]-a[3-(i+j)]))
print(min(q))

A = list(map(int, input().split()))
print(max(A) - min(A))

A = list(map(int, input().split()))
line = [[0, 1, 2], [0, 2, 1], [1, 0, 2], 
        [1, 2, 0], [2, 0, 1], [2, 1, 0]]
ans = sum(A)

for i in range(len(line)):
  tmp = 0
  for j in range(1,3):
    tmp += abs(A[line[i][j]] - A[line[i][j-1]])
  ans = min(ans, tmp)
print(ans)


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

a,b,c=sorted(map(int,input().split()))
print(c-a)

a = list(map(int, input().split()))
a.sort()

ans = 0
for i in range(1, len(a)):
    ans += a[i] - a[i - 1]

print(ans)


alist=list(map(int, input().split()))
print(max(alist)-min(alist))

s = list(map(int, input().split()))

print(max(s) - min(s))

a = list(map(int,input().split()))
print(max(a)-min(a))

l=list(map(int,input().split()))
l.sort()
print(abs(l[1]-l[0])+abs(l[2]-l[1]))

#!/usr/bin/env python3

def main():
    *a, = list(map(int, input().split()))
    print((max(a) - min(a)))


def __starting_point():
    main()

__starting_point()

a = map(int, input().split())
a = sorted(a)
print(a[2] - a[0])

a,b,c = map(int,input().split())
print(max(a,b,c)-min(a,b,c))

a, b, c = map(int, input().split())
i = abs(a - b)
j = abs(a - c)
k = abs(b - c)
lst = sorted([i, j, k])
print(lst[0] + lst[1])

a = list(map(int, input().split()))
a.sort()
print(a[2] - a[0])

A = list(map(int, input().split()))

A.sort(reverse=True)
print(((A[0]-A[1]) + (A[1]-A[2])))


A = list(map(int,input().rstrip().split()))
print(max(*A)-min(*A))

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    A = LI()

    print((max(A) - min(A)))

def __starting_point():
    resolve()

__starting_point()

a1, a2, a3 = list(map(int, input().split()))

d1 = abs(a2 - a1)
d2 = abs(a3 - a2)
d3 = abs(a1 - a3)

print(min(d1 + d2, d2 + d3, d3 + d1))

a = list(map(int, input().split()))
a.sort()

ans = 0
for i in range(1, len(a)):
    ans += a[i] - a[i - 1]

print(ans)


s = list(map(int,input().split()))
s.sort()
print(s[2]-s[0])

a = list(map(int,input().split()))
print(max(a)-min(a))

a = list(map(int, input().split()))
c = max(a[0], a[1], a[2]) - min(a[0], a[1], a[2])
print(c)

a,b,c = map(int,input().split())
print(max(a,b,c)-min(a,b,c))

li = list(map(int,input().split()))

li.sort()

n = (li[1] - li[0])+(li[2] - li[1])
print(n)


import itertools

a_lst = list(map(int, input().split()))

choice_lst = list(itertools.permutations(a_lst, 3))

cost_lst = []
for i in range(len(choice_lst)):
    cost = 0
    for j in range(3):
        tmp_cost = choice_lst[i][j]
        if j == 0:
            continue
        else:
            cost += abs(choice_lst[i][j] - choice_lst[i][j - 1])
    cost_lst.append(cost)

minimum = min(cost_lst)
print(minimum)

def mapt(fn, *args):
    return list(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    a, b, c = Input()
    x, y, _ = sorted([abs(a-b), abs(b-c), abs(a-c)])
    print(x + y)


main()

a,b,c = list(map(int,input().split()))
d = abs(a-b)
e = abs(b-c)
f = abs(c-a)
print((min(d+e,e+f,f+d)))



import sys

A = list(map(int, input().split()))

A.sort()
A.reverse()
ans = abs(A[1]-A[0])+abs(A[2]-A[1])

print(ans)

A = list(map(int, input().split()))
A = sorted(A)
ret = 0
for i in range(len(A) - 1):
  ret += abs(A[i] - A[i+1])

print(ret)

a = list(map(int, input().split()))
x = max(a) - min(a)
print(x)

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    A = LI()
    A = sorted(A)
    ans = 0
    ans += A[1] - A[0] + A[2] - A[1]
    print(ans)

main()



a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
ls=[a,b,c]
ls.sort()
print(ls[2]-ls[0])

b = sorted(map(int,input().split()))
print((abs(b[1]-b[0])+abs(b[2]-b[1])))


a,b,c=map(int, input().split())
#1ban
ans=abs(b-a)+abs(c-b)
ans2=abs(c-a)+abs(b-c)
if(ans2<ans):
    ans=ans2
#2ban
ans2=abs(a-b)+abs(c-a)
if(ans2<ans):
    ans=ans2
ans2=abs(c-b)+abs(a-c)
if(ans2<ans):
    ans=ans2
#3ban
ans2=abs(a-c)+abs(b-a)
if(ans2<ans):
    ans=ans2
ans2=abs(b-c)+abs(a-b)
if(ans2<ans):
    ans=ans2
print(ans)

A1, A2, A3 = map(int, input().split())
a = []
a.append(abs(A2 - A1) + abs(A3 - A2))
a.append(abs(A2 - A3) + abs(A1 - A2))
a.append(abs(A1 - A2) + abs(A3 - A1))
a.append(abs(A1 - A3) + abs(A2 - A1))
a.append(abs(A3 - A1) + abs(A2 - A3))
a.append(abs(A3 - A2) + abs(A1 - A3))
print(min(a))


L = list(map(int,input().split()))


print((max(L)-min(L)))



a = list(map(int,input().split()))
sort_a = sorted(a)
ans = 0
for i in range(len(sort_a)-1):
    ans += abs(sort_a[i]-sort_a[i+1])
print(ans)


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


#ABC103A
a = sorted(list(map(int,input().split())))
print((a[1]-a[0]) + (a[2]-a[1]))

a,b,c = map(int,input().split())
print(max(a,b,c)-min(a,b,c))

s = list(map(int, input().split()))

print((max(s) - min(s)))


a=[int(i) for i in input().split()]

a_list=[]

for i in range(3):
    for j in range(3):
        for k in range(3):
            if i!=j and j!=k and k!=i:
                a_list.append(abs(a[i]-a[j])+abs(a[k]-a[i]))
                
print(min(a_list))

a,b,c = sorted(map(int, input().split()))

print(abs(a-b) + abs(b-c))