Problem:
 Score : 100 points    Problem Statement 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 1 6 3      Sample Output 1 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 .        Sample Input 2 11 5 5      Sample Output 2 6       Sample Input 3 100 100 100      Sample Output 3 0

Solution (Python):
a=list(map(int, input().split(" ")))
print(max(a)-min(a))

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

Solution (Python):
As = list(map(int, input().split()))

As.sort()
print(As[2] - As[0])

Solution (Python):
A = input().split()

a = [int(A[i]) for i in range(3)]

print(max(a) - min(a))

Solution (Python):
num = list(map(int,input().split()))
num.sort()

ans = num[2]-num[0]

print(ans)

Solution (Python):

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

ans=[a,b,c]
ans.sort()

print(abs(ans[0]-ans[1])+abs(ans[1]-ans[2]))

Solution (Python):



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

A.sort()
T=0
for i in range(2):
    T = T+(A[i+1]-A[i])
print(T)

Solution (Python):
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [A1, A2, A3] =  [int(input_raw[0]), int(input_raw[1]), int(input_raw[2])]
    print   min(abs(A1 - A2) + abs(A2 - A3) ,abs(A1 - A3) + abs(A3 - A2),
                abs(A2 - A1) + abs(A1 - A3), abs(A2 - A3) + abs(A3 - A1),
                abs(A3 - A1) + abs(A1 - A2), abs(A3 - A2) + abs(A3 - A1))

if __name__ == '__main__':
    main()

Solution (Python):
lis=[int(i) for i in input().split()]
print(max(lis)-min(lis))

Solution (Python):
import math
a = list(map(int, input().split(" ")))


min_ = 99999999999999999

for i in range(3):
    for j in range(3):
        sum_ = None
        for k in range(3):
            if i != j != k and i != k:
                sum_ = abs(a[i]-a[j]) + abs(a[j]-a[k])

        if sum_ is not None:
	        min_ = min(min_, sum_)

print(min_)

Solution (Python):
li=list(map(int,input().split()))

print(max(li)-min(li))
print()

Solution (Python):
a=map(int,raw_input().split())

a.sort()
a.reverse()

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

print ans

Solution (Python):
a = sorted([int(i) for i in input().split()], reverse=True)

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

print(s)

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

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

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

Solution (Python):
a = [int(_) for _ in input().split(' ')]
print(max(a) - min(a))

Solution (Python):
def main():
    a, b, c = input().split()
    print (max(int(a),int(b),int(c)) - min(int(a),int(b),int(c)))

if __name__ == "__main__":
    main()

Solution (Python):
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

inp = Is()
lis = [abs(inp[0]-inp[1]),abs(inp[0]-inp[2]),abs(inp[1]-inp[2])]
print(sum(lis)-max(lis))

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

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

Solution (Python):
A = [int(i) for i in input().split()]

A.sort()

print(abs(A[0] - A[1]) + abs(A[1] - A[2]))

Solution (Python):
N = map(int, raw_input().split())

A=N[0]
B=N[1]
C=N[2]

Answerlist= [0 for i in range(3)]
Answerlist[0]=abs(A-B)
Answerlist[1]=abs(B-C)
Answerlist[2]=abs(C-A)

print(max(Answerlist))

Solution (Python):
a1, a2, a3 = map(int, input().split(' '))


c123 = abs(a3 - a2) + abs(a2 - a1)
c132 = abs(a2 - a3) + abs(a3 - a1)
c213 = abs(a3 - a1) + abs(a1 - a2)
c231 = abs(a1 - a3) + abs(a3 - a2)
c312 = abs(a2 - a1) + abs(a1 - a3)
c321 = abs(a1 - a2) + abs(a2 - a3)

print(min([c123, c132, c213, c231, c312, c321]))

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

x = max(a, b, c)
y = min(a, b, c)
print( abs(x-y) )

Solution (Python):
def main():
    A1, A2, A3 = sorted(map(int, raw_input().split()))

    if A1 == A2 and A2 == A3:
        print 0
    elif A2-A1 < A3-A2:
        print (A2-A1) + (A3-A2)
    elif A3-A2 < A2-A1:
        print (A2-A1) + (A3-A2)
    else:
        print 0


main()

Solution (Python):
A = [int(c) for c in raw_input().split()]
A.sort()

cost = 0
for i in range(1, len(A)):
    cost += (abs(A[i]-A[i-1]))
print cost

Solution (Python):
import sys

def main():
        run()

def run():
        data = input()
        splited = [int(x) for x in data.split(" ")]

        sum_cost = 0
        prev_cost = 0
        while(splited):
                cost = max(splited)
                splited.remove(cost)
                if prev_cost != 0:
                        sum_cost += abs(prev_cost - cost)
                prev_cost = cost
        print(sum_cost)

if __name__ == "__main__":
        main()

Solution (Python):
a=[int(_) for (_) in input().split()]

a.sort(reverse=True)
cost = 0
for i in range(1,3):
    cost = cost + abs(a[i]-a[i-1])

print(cost)

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

x = abs(a-b)
y = abs(b-c)
z = abs(c-a)

print(x+y+z-max(x,y,z))

Solution (Python):
import itertools
A=map(int,input().split())
lt = list(itertools.permutations(A))
ans=[]

for ary in lt:
    tmp=0
    for i in range(1,len(ary)):
        tmp += abs(ary[i] - ary[i-1])
    ans.append(tmp)

print(min(ans))

Solution (Python):
A,B,C = map(int,input().split())
print(min(abs(A-B)+abs(B-C),abs(A-C)+abs(C-B),abs(B-C)+abs(C-A),abs(B-A)+abs(A-C),abs(C-A)+abs(A-B),abs(C-B)+abs(B-A)))

Solution (Python):
task = input()
task = task.split()
costs = []
for i in range(len(task)):
    costs.append(int(task[i]))
costs.sort()
cost = 0
for i in range(len(costs)-1):
    cost += costs[i+1]-costs[i]
    
print(cost)

Solution (Python):
a = list(map(int,input().split(" ")))
li = [abs(a[1]-a[2]),abs(a[2]-a[0]),abs(a[1]-a[0])]
ans = sum(li) - max(li)
print(ans)

Solution (Python):
import sys
a, b, c = map(int, sys.stdin.readline().split())
d, e, f = map(lambda t: abs(t[0] - t[1]), [(a, b), (b, c), (c, a)])
if d > e and d > f:
    print(e + f)
elif e > f:
    print(d + f)
else:
    print(d + e)

Solution (Python):
a = [i for i in input().split()]

b = sorted(map(int, list(set(a))))

if len(b) == 1:
    print(0)
elif len(b) == 2:
    print(int(b[1])-int(b[0]))
else:
    print(int(b[2]) - int(b[0]))

Solution (Python):
A = [int(i) for i in list(input().split())]
A.sort()
print(A[2]- A[0])

Solution (Python):
s = input()
arr = s.split()
a = [int(i) for i in arr]

a.sort()

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

Solution (Python):
A=map(int,raw_input().split())
print max(A)-min(A)

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

Solution (Python):
import sys
a = list (map(int, sys.stdin.readline().split()))

print (max(a) - min(a))

Solution (Python):
ip = input().split()
data = []
for i in ip:
    data.append(int(i))

maxob = max(data)
minob = min(data)

print(maxob - minob)

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

Solution (Python):
I = list(map(int, input().split()))

print(max(I)-min(I))

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

print(answer)

Solution (Python):
arr = map(int,raw_input().split())

arr.sort()

print abs(arr[1]- arr[0]) + abs(arr[2]- arr[1])

Solution (Python):
from sys import stdin

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

print(max(a) - min(a))

Solution (Python):
n = list(map(int,input().split()))

n.sort()


sum = 0
for i in range(2):
    sum += abs(n[i]-n[i+1])

print(sum)

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

a.sort()

ans = 0

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

print(ans)

Solution (Python):
A,B,C = map(int,input().split())

ans = min(abs(A-B)+abs(B-C), abs(A-C)+abs(C-B), abs(B-A) + abs(A-C))
print(ans)

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

print(ans)

Solution (Python):
a1,a2,a3 = map(int, input().split())
a = [a1,a2,a3]

b = [0,0,0,0,0,0]
b[0] = abs(a[1]-a[0]) + abs(a[2]-a[1])
b[1] = abs(a[2]-a[0]) + abs(a[1]-a[2])
b[2] = abs(a[0]-a[1]) + abs(a[2]-a[0])
b[3] = abs(a[2]-a[1]) + abs(a[0]-a[2])
b[4] = abs(a[0]-a[2]) + abs(a[1]-a[0])
b[5] = abs(a[1]-a[2]) + abs(a[0]-a[1])


print(int(min(b)))

Solution (Python):
from sys import stdin
a = map(int,stdin.readline().split())
print max(a) - min(a)

Solution (Python):
data = list(map(int, input().split()))

data.sort()

total = 0

total = (data[1] - data[0]) + (data[2] - data[1])

print(total)

Solution (Python):
a, b, c = (int(i) for i in input().split())

r1 = abs(b-a) + abs(c-b)
r2 = abs(c-a) + abs(b-c)

r3 = abs(a-b) + abs(c-a)
r4 = abs(c-b) + abs(a-c)

r5 = abs(a-c) + abs(b-a)
r6 = abs(b-c) + abs(a-b)

print(min([r1, r2, r3, r4, r5, r6]))

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

Solution (Python):


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

Solution (Python):
X = sorted(map(int, input().split()))
print(abs(X[1]-X[0])+abs(X[2]-X[1]))

Solution (Python):
input_s = str(input())
ary = input_s.split(" ")
ary.sort()
task = 0
tmp1 = 0
tmp2 = 0
for i in ary:
    if tmp1 == 0:
        tmp1 = int(i)
    else:
        tmp2 = int(i)
        if tmp1 < tmp2:
            task += tmp2 - tmp1
        else:
            task += tmp1 - tmp2
        tmp1 = tmp2
print(task)

Solution (Python):
one,two,three = map(int,input().split())
lis = [one,two,three]
sort = sorted(lis)
print((sort[1]-sort[0])+(sort[2]-sort[1]))

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

Solution (Python):
abc = list(map(int, input().split()))

print(abs(max(abc) - min(abc)))

Solution (Python):
a = [int(i) for i in input().split()]
print(max(a)-min(a))

Solution (Python):
import sys

line = sys.stdin.readline()
a = [ i for i in map(int, line.strip().split()) ]
b = abs(a[0] - a[1])
c = abs(a[1] - a[2])
d = abs(a[0] - a[2])
e = b + c
f = c + d
g = d + b
print(min(e,f,g))

Solution (Python):




def main():
    a1, a2, a3 = map(int, input().split())

    c1 = abs(a2-a1) + abs(a3-a1)
    c2 = abs(a1-a2) + abs(a3-a2)
    c3 = abs(a1-a3) + abs(a2-a3)

    print(min(c1, c2, c3))


if __name__ == '__main__':
    main()

Solution (Python):
A=[None]*3
A=list(map(int,input().split()))
A.sort()
print((A[2]-A[1])+(A[1]-A[0]))

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

Solution (Python):


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

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

print(max-min)

Solution (Python):
A = list(map(int,input().split()))
def abs_A(A1,A2,A3):
    return abs(A1-A2)+abs(A2-A3)
minA = min(abs_A(A[0],A[1],A[2]),abs_A(A[0],A[2],A[1]),abs_A(A[1],A[0],A[2]),abs_A(A[1],A[2],A[0]),abs_A(A[2],A[0],A[1]),abs_A(A[2],A[1],A[0]))
print(minA)

Solution (Python):
a = list(map(int, input().split()))

a.sort(reverse=True)

sum = a[0] - a[1]
sum += a[1] - a[2]

print(sum)

Solution (Python):
a1,a2,a3 = map(int,input().split())

b = [0] * 3
b[0] = abs(a1 - a2)
b[1] = abs(a2 - a3)
b[2] = abs(a3 - a1)


maxindex = b.index(max(b))
ret = 0
for i in range(len(b)):
    if i != maxindex:
        ret += b[i]

print(ret)

Solution (Python):
a = list(map(int, input().split()))
a = sorted(a)
ans = 0

b = [abs(a[i+1] - a[i]) for i in range(len(a)-1)]
print(sum(b))

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

a = abs(A[0] - A[1]) + abs(A[1] - A[2])
b = abs(A[0] - A[1]) + abs(A[0] - A[2])
c = abs(A[0] - A[2]) + abs(A[1] - A[2])

print(min(a, b, c))

Solution (Python):

from itertools import permutations

ary = map(int, input().split())

min_val = float('inf')
for vals in permutations(ary):
    tmp_val = 0
    for i, val in enumerate(vals):
        if i > 0:
            tmp_val += abs(val - vals[i - 1])

    if min_val > tmp_val:
        min_val = tmp_val

print(min_val)

Solution (Python):
a,b,c=list(map(int,input().split()))

max=max([a,b,c])
min=min([a,b,c])

print(max-min)

Solution (Python):


if __name__ == '__main__':
    A = list(map(int, input().split()))
    min_costs = 99999
    for i in range(len(A)):
        if i+1 >= 3:
            j = abs(3 - (i+1))
        else:
            j = i+1
        if i+2 >= 3:
            k = abs(3 - (i+2))
        else:
            k = i+2
        costs = abs(A[j] - A[i]) + abs(A[k] - A[i])
        if costs < min_costs:
            min_costs = costs
    print(min_costs)

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

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

Solution (Python):
task_list = list(map(int, input().split()))

task_list.sort()

prev = task_list[0]
total_cost = 0

for i, task in enumerate(task_list):
  if i == 0:
    continue

  total_cost += abs(task - prev)
  prev = task

print(total_cost)

Solution (Python):
from itertools import permutations


def calc_value(permutation):
    a, b, c = permutation
    return abs(b-a) + abs(c-b)


def solve(a, b, c):
    min_value = float("inf")
    for p in permutations([a, b, c], 3):
        value = calc_value(p)
        if value < min_value:
            min_value = value
    return min_value


a, b, c = map(int, raw_input().split())
print solve(a,b,c)

Solution (Python):
a, b, c = map(int, input() .split())
A = abs(b - a) + abs(c - b)
B = abs(a - b) + abs(b - c)
C = abs(a - b) + abs(c - a)
D = abs(c - b) + abs(a - c)
E = abs(a - c) + abs(b - a)
F = abs(b - c) + abs(a - b)
print(min(A, B, C, D, E, F))

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

score1 = abs(b - a) + abs(c - b)
score2 = abs(c - a) + abs(b - c)
score3 = abs(a - b) + abs(c - a)
score4 = abs(c - b) + abs(a - c)
score5 = abs(a - c) + abs(b - a)
score6 = abs(b - c) + abs(a - b)

print(min([score1, score2, score3, score4, score5, score6]))

Solution (Python):
xs = map(int, input().split(" "))
xs = sorted(xs)

cost = list()
for i in range(len(xs) - 1):
	cost.append(abs(xs[i] - xs[i+1]))

print(sum(cost))

Solution (Python):
l = sorted([int(c) for c in input().split()])
 
print(l[2] - l[0])

Solution (Python):
A1,A2,A3 = map(int,input().split())

a12 = abs(A1-A2)
a23 = abs(A2-A3)
a31 = abs(A3-A1)

ans = a12 + a23 + a31 - max(a12,a23,a31)
print(ans)

Solution (Python):


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

b=abs(a[1]-a[0])+abs(a[2]-a[1])
c=abs(a[2]-a[0])+abs(a[1]-a[2])
d=abs(a[0]-a[1])+abs(a[2]-a[0])

print(min(b,c,d))

Solution (Python):
arr = [int(i) for i in input().split()]
arr.sort()
arr.reverse()

result = (arr[0] - arr[1]) + (arr[1] - arr[2])
print(result)

Solution (Python):
import math
a_tmp = input().split()
a = []
for i in range(3):
    a.append(int(a_tmp[i]))
cost = [0 for i in range(3)]
for i in range(3):
    for j in range(3):
        cost[i] = cost[i] + math.fabs(a[i] - a[j])
print(int(min(cost)))

Solution (Python):
A=[int(i) for i in input().split()]
a=abs(A[0]-A[1])
b=abs(A[1]-A[2])
c=abs(A[0]-A[2])
t=min(a+b,b+c,c+a)
print(t)

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

Solution (Python):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
a=i2()
b=[]
a.sort()
print(abs(a[0]-a[1])+abs(a[2]-a[1]))

Solution (Python):
arr=list(map(int,input().split()))
arr.sort(reverse=True)
ans=0
for i in range(1,len(arr)):
    ans+=abs(arr[i]-arr[i-1])
print(ans)

Solution (Python):


t1, t2, t3 = map(int, input().split())
a = [t1, t2, t3]

print(max(a) - min(a))

Solution (Python):
l = list(map(int, input().split()))
print(max(l) - min(l))

Solution (Python):
a = list(map(int, input().split()))

print(max(a) - min(a))

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

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

Solution (Python):
a1, a2, a3 = map(int, input().split())
c1 = abs(a1 - a2) + abs(a2 - a3)
c2 = abs(a1 - a3) + abs(a3 - a2)
c3 = abs(a2 - a1) + abs(a1 - a3)
c4 = abs(a2 - a3) + abs(a3 - a1)
c5 = abs(a3 - a1) + abs(a1 - a2)
c6 = abs(a3 - a2) + abs(a2 - a1)
print(min([c1, c2, c3, c4, c5, c6]))

Solution (Python):
from sys import stdin
data = [int(i) for i in input().split()]
print(max(data) - min(data))

Solution (Python):
l = [int(x) for x in raw_input().split()]
print max(l) - min(l)

Solution (Python):


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

An.sort()
i = 0
Ai = An[0]
sum = 0
for j,Aj in enumerate(An):
    i = Aj - Ai
    sum += i
    Ai = Aj

print(sum)

Solution (Python):
from itertools import permutations
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    A = tuple(map(int, input().split()))

    cost = float('inf')
    for i, j, k in permutations(A, 3):
        n = abs(i - j)
        n += abs(j - k)
        cost = min(cost, n)
    print(cost)

main()

Solution (Python):
largeA = []
largeA = list(map(int,input().split()))
a = abs(largeA[0]-largeA[1])+abs(largeA[1]-largeA[2])
b = abs(largeA[0]-largeA[1])+abs(largeA[2]-largeA[0])
c = abs(largeA[2]-largeA[0])+abs(largeA[1]-largeA[0])
d = abs(largeA[2]-largeA[0])+abs(largeA[1]-largeA[2])
e = abs(largeA[2]-largeA[1])+abs(largeA[1]-largeA[0])
f = abs(largeA[2]-largeA[1])+abs(largeA[2]-largeA[0])
print(min(a,b,c,d,e,f))

Solution (Python):



l = map(int, raw_input().split())
l.sort()
print l[-1]-l[0]

Solution (Python):


 
def main():
	A = list(map(int, input().split()))
	A.sort()
	print((A[1]-A[0])+(A[2]-A[1]))
 
if __name__ == '__main__':
	main()

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

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

A.sort()
ANS=0

for i in range(len(A)-2,-1,-1):
    ANS+=A[i+1]-A[i]

print(ANS)

Solution (Python):
A = [int(i) for i in input().split()]
A.sort()
print(A[2]-A[0])

Solution (Python):
a = list(map(int, input().split()))

ans = 10**9

ans = min(ans, abs(a[1]-a[2]) + abs(a[0]-a[1]))
ans = min(ans, abs(a[0]-a[2]) + abs(a[0]-a[1]))
ans = min(ans, abs(a[0]-a[1]) + abs(a[0]-a[2]))
ans = min(ans, abs(a[2]-a[1]) + abs(a[0]-a[2]))
ans = min(ans, abs(a[1]-a[0]) + abs(a[1]-a[2]))
ans = min(ans, abs(a[2]-a[0]) + abs(a[1]-a[2]))
print(ans)

Solution (Python):
A = [int(i) for i in input().split()]

A_ = sorted(A)
print(A_[-1] - A_[0])

Solution (Python):
l1 = list(map(int, input().split()))
l1 = sorted(l1)

if l1[1] - l1[0] < l1[2] - l1[1]:
    print((l1[1] - l1[0]) + (l1[2] - l1[1]))
else:
    print((l1[1] - l1[0]) + (l1[2] - l1[1]))

Solution (Python):
a = list(map(int,input().split()))
ti = min(a)
da = max(a)
print(int(da-ti))

Solution (Python):
a = [ int(_) for _ in input().split()]
a.sort()

result = 0
for i in range(len(a)-1):
  result += abs(a[i] - a[i+1])
print(result)

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

Solution (Python):

from itertools import permutations

def solve():
    a,b,c = map(int, input().split())
    d = min([abs(x-y) + abs(y-z) for x,y,z in permutations([a,b,c])])

    return str(d)

if __name__ == '__main__':
    print(solve())

Solution (Python):
import numpy
As=list(map(int,input().split(' ')))
As.sort()
print(As[2]-As[0])

Solution (Python):
a = list(map(int, input().split()))

ans = float('inf')
for i in range(3):
    for j in range(3):
        if i != j:
            for k in range(3):
                if i != k and j != k:
                    ans = min(ans, abs(a[j] - a[i]) + abs(a[k] - a[j]) )
print(ans)

Solution (Python):
P = list(map(int, input().split()))
P.sort()
ans = 0
for i in range(1, 3):
    ans += abs(P[i] - P[i-1])
print(ans)

Solution (Python):
a, b, c = map(int, input().split())
aa = abs(b-c)
bb = abs(a-c)
cc = abs(a-b)
print(min(min(aa+bb, aa+cc), bb+cc))

Solution (Python):



def main():
    N = sorted([int(x) for x in input().strip().split()])
    result = 0
    result = (N[1] - N[0]) + (N[2] - N[1])
    print(result)


if __name__ == '__main__':
    main()

Solution (Python):
A=list(map(int,input().split()))
candidate=[]

candidate.append(abs(A[1]-A[0])+abs(A[2]-A[1]))
candidate.append(abs(A[2]-A[1])+abs(A[0]-A[2]))
candidate.append(abs(A[0]-A[2])+abs(A[1]-A[0]))

candidate.append(abs(A[0]-A[1])+abs(A[2]-A[0]))
candidate.append(abs(A[1]-A[2])+abs(A[0]-A[1]))
candidate.append(abs(A[2]-A[0])+abs(A[1]-A[2]))
print(min(candidate))

Solution (Python):


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

aN.sort(reverse=True)

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

Solution (Python):
A = list(map(int, input().split()))
B = sorted(A)
cost = 0
for i in range(1,3):
    cost += abs(B[i] - B[i-1])
print(cost)

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

Solution (Python):
T = [int(i) for i in input().split()]
a, b, c = sorted(T, reverse=True)
ans = abs(b - a) + abs(c - b)
print(ans)

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

def func(A, ind):
    return abs(A[ind[2]] - A[ind[1]]) + abs(A[ind[1]] - A[ind[0]])


indices = [(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)]

m = float("inf")
for ind in indices:
    tmp = func(A, ind)
    if tmp <= m:
        m = tmp

print(m)

Solution (Python):
A = [int(t) for t in input().split()]
assert len(A) == 3

A.sort()
print(sum(A[i] - A[i-1] for i in range(1, len(A))))

Solution (Python):
n = list(map(int, input().split()))
n.sort()
sum = 0
tmp = 0
for index,i in enumerate(n):
    if index == 0:
        pass
    else:
        sum += abs(i - tmp)
    tmp = i
print(sum)

Solution (Python):
a = list(map(int,input().split()))

a.sort()

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

Solution (Python):
a,b,c = map(int,input().split())
num = 0
n = []
n.append(a)
n.append(b)
n.append(c)
n.sort()
mini = min(n)
n.remove(min(n))
num += (n[0] -mini)
num += (n[1] - n[0])
print(num)

Solution (Python):
l = list(map(int, input().split()))
l.sort()
out = 0

out += abs(l[1] - l[0]) + abs(l[2] - l[1])

print(out)

Solution (Python):
a=[int(i) for i in input().split()]
ans=100000
for i in range(3):
    for j in range(3):
        for k in range(3):
            if i==j or i==k or j==k: continue
            ans=min(ans,abs(a[i]-a[j])+abs(a[j]-a[k]))
print(ans)

Solution (Python):
a,b,c = list(map(int,input().split()))
ans = min(abs(a-b)+abs(b-c),abs(a-c)+abs(b-c),abs(a-b)+abs(a-c))
print(ans)

Solution (Python):
A = list(map(int,input().strip().split(' ')))
import itertools
import sys

m = sys.maxsize
for l in itertools.permutations(A):
    tmp = abs(l[1]-l[0]) + abs(l[2]-l[1])
    m = min(m,tmp)
print(m)

Solution (Python):
A1,A2,A3 = map(int, input().split(' '))

ls = [0 + abs(A2 - A1) + abs(A1 - A3), 0 + abs(A2 - A3) + abs(A3 - A1)
, 0 + abs(A3 - A1) + abs(A1 - A2), 0 + abs(A3 - A2) + abs(A2 - A1)
      ,0+abs(A1-A2)+abs(A2-A3), 0+abs(A1-A3)+abs(A3-A2)]

print(min(ls))

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

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

print(cost)

Solution (Python):
A = list(map(int, input().split(" ")))

Aso = sorted(A)

cost = 0

for i in range(len(Aso)):
  if i == 0:
    cost = 0
  else:
    cost += Aso[i] - Aso[i-1]

print(cost)

Solution (Python):



n = map(int,input().split())

n = sorted(n)

ans = 0

k = n[0]

for i in n[1:]:
    ans += i-k
    k = i

print(ans)

Solution (Python):
import itertools
a_values=list(map(int,input().split()))
print(min(abs(a-b)+abs(b-c) for a,b,c in list(itertools.permutations(a_values))))

Solution (Python):
a = list(map(int, input().split()))

L = [0] * 3
L[0] = abs(a[0] - a[1])
L[1] = abs(a[0] - a[2])  
L[2] = abs(a[1] - a[2])

L = sorted(L)
re = L[0] + L[1]
print(re)

Solution (Python):


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

d1 = abs(a[2] - a[0])
d2 = abs(a[0] - a[1])
d3 = abs(a[1] - a[2])

print(d1 + d2 + d3 - max(d1, d2, d3))

Solution (Python):

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

c1 = abs(a1 - a2)
c2 = abs(a2 - a3)
c3 = abs(a3 - a1)

min_c1_c2 = 0
max_c1_c2 = 0

if c1 < c2:
  min_c1_c2 = c1
  max_c1_c2 = c2
else:
  min_c1_c2 = c2
  max_c1_c2 = c1

if c3 < min_c1_c2:
  print(c3 + min_c1_c2)
elif c3 < max_c1_c2:
  print(c3 + min_c1_c2)
else:
  print(min_c1_c2 + max_c1_c2)

Solution (Python):

"""
Created on Sat Jul 21 19:17:59 2018
ABC103A
@author: maezawa
"""

a, b, c = list(map(int, input().split()))
w = [a, b, c]
w.sort(reverse = True)
cost = 0

cost = w[0]-w[1]+w[1]-w[2]
print(cost)

Solution (Python):
import sys

A = sorted(map(int, sys.stdin.readline().split()))

cost = 0
for i in range(1, len(A)):
    cost += A[i] - A[i - 1]
print(cost)

Solution (Python):
from sys import stdin


def main():
    A = [int(x) for x in stdin.readline().rstrip().split()]
    spam = [(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)]
    result = []
    for x in spam:
        f, s, t = x
        result.append(abs(A[s] - A[f]) + abs(A[t] - A[s]))
    print(min(result))


if __name__ == '__main__':
    main()

Solution (Python):
L=list(map(int,input().split()))
L.sort()
print(L[2]-L[0])

Solution (Python):
a1, a2, a3 = list(map(int, input().split()))
v1 = abs(a1 - a2) + abs(a2 - a3)
v2 = abs(a1 - a3) + abs(a2 - a3)
v3 = abs(a2 - a1) + abs(a1 - a3)
v4 = abs(a2 - a3) + abs(a3 - a1)
v5 = abs(a3 - a1) + abs(a1 - a2)
v6 = abs(a3 - a2) + abs(a2 - a1)
print(min(v1, v2, v3, v4, v5, v6))

Solution (Python):
a,b,c=map(int,input().split())
L=[]
L.append(a)
L.append(b)
L.append(c)
L = sorted(L)
print(L[2]-L[0])

Solution (Python):
a=map(int, raw_input().split())

a.sort()
num = len(a)

numsum =0

for i in range(num-1):
    numsum = numsum + a[i+1]-a[i]

print numsum

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

print(res)

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

count = 0
cost = 0

A = sorted(A)

for index, i in enumerate(A):
    if index:
        cost += i - A[index-1]

print(cost)

Solution (Python):


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

A.sort()

cost = 0
pre = A[0]
for i in A:
    cost += i - pre
    pre = i

print(cost)

Solution (Python):


def main():
    a_list = list(map(int, input().split()))

    task = []
    task.append(abs(a_list[1] - a_list[0]) + abs(a_list[2] - a_list[1]))
    task.append(abs(a_list[2] - a_list[0]) + abs(a_list[1] - a_list[2]))
    task.append(abs(a_list[2] - a_list[1]) + abs(a_list[1] - a_list[0]))
    task.append(abs(a_list[0] - a_list[1]) + abs(a_list[0] - a_list[2]))
    task.append(abs(a_list[1] - a_list[2]) + abs(a_list[0] - a_list[1]))
    task.append(abs(a_list[0] - a_list[2]) + abs(a_list[1] - a_list[0]))
    print(min(task))

    
if __name__ == '__main__':
    main()

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

Solution (Python):
x,y,z = map(int,input().split(' '))
s = []
s.append(abs(y-x)+abs(z-y))
s.append(abs(z-x)+abs(z-y))
s.append(abs(y-x)+abs(z-x))
s.append(abs(z-x)+abs(y-z))
s.append(abs(x-z)+abs(y-x))
s.append(abs(y-z)+abs(x-y))
print(min(s))

Solution (Python):
import sys
As = list(map(int, sys.stdin.readline().split()))
As.sort()
print(sum(map(lambda a_b: a_b[1] - a_b[0], zip(As, As[1:]))))

Solution (Python):


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

Solution (Python):
ABC=input()
ABC=ABC.rstrip().split(" ")
A=int(ABC[0])
B=int(ABC[1])
C=int(ABC[2])

a1=abs(A-B)+abs(B-C)
a2=abs(A-C)+abs(C-B)
a3=abs(B-A)+abs(A-C)
a4=abs(B-C)+abs(C-A)
a5=abs(C-A)+abs(A-B)
a6=abs(C-B)+abs(B-A)

list1=[a1,a2,a3,a4,a5,a6]
list1.sort()
print(list1[0])

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

Solution (Python):
a = [int(i) for i in input().split()]
a = sorted(a)

cost = 1000000
print(a[2]-a[0])

Solution (Python):
a, b, c = map(int, input().split())
d = 0 + abs(b - a) + abs(c - b)
e = 0 + abs(c - a) + abs(b - c)
f = 0 + abs(a - b) + abs(c - a)
g = 0 + abs(c - b) + abs(a - c)
h = 0 + abs(a - c) + abs(b - a)
i = 0 + abs(b - c) + abs(a - b)
print(min(d, e, f, g, h, i))

Solution (Python):
a,b,c = map(int,input().split())
l = []
l.append(abs(a-b)+abs(b-c))
l.append(abs(a-c)+abs(b-c))
l.append(abs(b-a)+abs(a-c))
l.append(abs(b-c)+abs(a-c))
l.append(abs(c-a)+abs(b-a))
l.append(abs(c-b)+abs(b-a))
print(min(l))

Solution (Python):
l = list(map(int,input().split()))

ll=[]
for i in range(-1,2):
    ll.append(abs(l[i]-l[i+1]))

print(sum(ll)-max(ll))

Solution (Python):
a=[int(i) for i in input().split()]
a.sort(reverse=True)
c=0
for i in range(1,len(a)):
    c+=abs(a[i]-a[i-1])
print(c)

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

min_cost = sum(A)
for i in range(3):
    for j in range(3):
        for k in range(3):
            if i != j and i != k and j != k:
                cost = abs(A[j]-A[i])+abs(A[k]-A[j])
                min_cost = min(min_cost, cost)
print(min_cost)

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

Solution (Python):
T = list(map(int,input().split()))



a = [[0,1,2],[0,2,1],[1,2,0],[2,1,0],[1,0,2],[2,0,1]]
A = sum(T)
for i in a:
    A = min(A,abs(T[i[2]] - T[i[1]]) + abs(T[i[1]]-T[i[0]]))

print(A)

Solution (Python):
A = [0, 0, 0]

A[0], A[1], A[2] = map(int, input().split())

A = sorted(A)

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

Solution (Python):
def main(num):
	
	c1 = abs(num[0]-num[1])
	c2 = abs(num[2]-num[1])
	c3 = abs(num[0]-num[2])
	
	cost = min(c1+c2, c1+c3, c2+c3)
	
	return cost



num = input().split(" ")
num = [int(c) for c in num]
print(main(num))

Solution (Python):
a = list(map(int, input().split()))

a.sort()

counter = 0

counter += abs(a[0] - a[1]) + abs(a[1] - a[2])
print(counter)

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

Solution (Python):
L = list(map(int, input().split()))
MAX=max(L)
MIN=min(L)
print(MAX-MIN)

Solution (Python):
a=list(map(int,input().split()))
a.sort()
ans1=abs(a[1]-a[0])+abs(a[2]-a[1])
ans2=abs(a[1]-a[2])+abs(a[0]-a[1])
print(min(ans1,ans2))

Solution (Python):
tasks = list(map(int, input().rstrip().split(' ')))


tasks.sort()

prev_task = tasks[0]
cost = 0
for task in tasks:
    cost += task - prev_task
    prev_task = task
    
print(cost)

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

Solution (Python):
a = list(map(int, input().split()))
sum = max(a)-min(a)
print(sum)

Solution (Python):
a, b, c = map(int, input().split())
p = abs(a - b) + abs(c - b)
q = abs(a - c) + abs(c - b)
b1 = abs(b - a) + abs(a - c)
b2 = abs(b - c) + abs(c - a)
c1 = abs(a - c) + abs(b - a)
c2 = abs(b - c) + abs(b - a)
rec = min(p, q)
rec = min(rec, min(b1, b2))
rec = min(rec, min(c1, c2))
print(rec)