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



Sample input:
1 6 3


Sample output:
5

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A1,A2,A3=map(int,input().split())
c=[A1,A2,A3]
S=max(c)
Z=min(c)
print(S-Z)

Submission status: Accepted

Solution code:
import math
A = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
l = sorted([abs(a - b), abs(b - c), abs(c - a)])
print(l[0] + l[1])

Submission status: Accepted

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

Submission status: Accepted

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

res = float("inf")
for a,b,c in permutations(A):
    res = min(res, abs(a-b) + abs(b-c))
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# ABC0103 A - Task Scheduling Problem
a = list(map(int,input().split()))
print(max(a)-min(a))

Submission status: Accepted

Solution code:
# ABC103A - Task Scheduling Problem
def main():
    A = sorted(map(int, input().split()))
    ans = A[2] - A[0]
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
arr = [int(x) for x in input().split()]
sorted_arr = sorted(arr)
print(sorted_arr[2]-sorted_arr[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:




def main():

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




if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(max(a,b,c)-min(a,b,c))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
def formula(x, y, z):
    return abs(x-y)+abs(y-z)

kumi = [ [a,b,c], [b,a,c], [c, a, b], [a,c,b], [b,c,a], [c,b,a]]
print(min([formula(i, j, k) for i,j,k in kumi]))

Submission status: Accepted

Solution code:
import itertools

ls = list(map(int, input().split()))
res = []
for a0, a1, a2 in itertools.permutations(ls):
    res.append(abs(a0 - a1) + abs(a1 - a2))
print(min(res))

Submission status: Accepted

Solution code:
x = list(map(int, input().split()))

x.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
a_b = abs(b-a)
a_c = abs(c-a)
b_c = abs(b-c)
print(a_b + a_c + b_c - max(a_b, a_c, b_c))

Submission status: Accepted

Solution code:
a1, a2, a3 = map(int, input().split())
case1 = abs(a1 - a2) + abs(a2 - a3)
case2 = abs(a1 - a3) + abs(a3 - a2)
case3 = abs(a2 - a1) + abs(a1 - a3)
print(min(case1, case2, case3))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
*lis, = map(int, input().split())
print(max(lis) - min(lis))

Submission status: Accepted

Solution code:
task = list(map(int,input().split()))
task.sort(reverse = True)
print(task[0]-task[2])

Submission status: Accepted

Solution code:
s=list(input().split())
s.sort()
total=abs(int(s[2])-int(s[0]))

print(total)

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
l=list(map(int,input().split()))

ls=sorted(l)

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

Submission status: Accepted

Solution code:
A_list = list(map(int, input().split()))
A_list_sorted = sorted(A_list)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a1,a2,a3 = map(int,input().split())
print(abs(a1-a2)+abs(a2-a3)+abs(a3-a1)-max(abs(a1-a2),abs(a2-a3),abs(a3-a1)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = sorted([ int(i) for i in input().split() ])
print((num[2] - num[1]) + (num[1] - num[0]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
box=list(map(int,input().split()))
box=sorted(box)
count=0
for i in range(len(box)-1):
    count +=abs(box[i+1]-box[i])
print(count)

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split())
l = [abs(a-b),abs(b-c), abs(c-a)]
l.sort()
print(l[0] + l[1])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
k = [int(x) for x in input().split()]
print(max(k)-min(k))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
L = sorted(map(int, input().split()))
print(L[2] - L[0])

Submission status: Accepted

Solution code:
L = sorted(map(int, input().split()), reverse=True)
print((L[0] - L[1]) + (L[1] - L[2]))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a_list = sorted(map(int, input().split()))
print(a_list[2]-a_list[0])

Submission status: Accepted

Solution code:
a1, a2, a3 = map(int, input().split())
a_list = sorted([a1,a2,a3])
print(a_list[2]-a_list[0])

Submission status: Accepted

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

min_cost = abs(A1-A2)
if (min_cost < abs(A2-A3)) :
    min_cost = abs(A2-A3)

if (min_cost < abs(A1-A3)) :
    min_cost = abs(A1-A3)

print(min_cost)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]

def code():
    a,b,c = map(int,input().split(' '))
    M = max(a,b,c)
    m = min(a,b,c)
    print(abs(M-m))

if __name__=='__main__':
    code()

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split(' '))
M = max(a,b,c)
m = min(a,b,c)
print(abs(M-m))

Submission status: Accepted

Solution code:
def code():
    a,b,c = map(int,input().split(' '))
    M = max(a,b,c)
    m = min(a,b,c)
    print(abs(M-m))

if __name__=='__main__':
    code()

Submission status: Accepted

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

a.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a1,a2,a3 = map(int,input().split())
list = [a1,a2,a3]
list.sort(reverse=True)
print((list[0] - list[1]) + (list[1] - list[2]))

Submission status: Accepted

Solution code:
A1, A2, A3 = map(int, input().split())
r = min(abs(A2-A1)+abs(A3-A2), abs(A3-A1)+abs(A2-A3), abs(A1-A2)+abs(A3-A1))
print(r)

Submission status: Accepted

Solution code:
def main(a: list):
    a = sorted(a)

    cost = 0

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

    return cost


if __name__ == '__main__':
    print(main(list(map(int, input().split(' ')))))

Submission status: Accepted

Solution code:
r=sorted(map(int,input().split()))[::-1]

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split(" "))
l = list(map(abs, [a-b, a-c, b- c]))
print(sum(l) - max(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
tmp = [abs(a-b), abs(b-c), abs(c-a)]
print(sum(tmp) - max(tmp))

Submission status: Accepted

Solution code:
b = [int(_) for _ in input().split()]
if len(b) == 3:
    if 1 <= b[0] <= 100 and 1 <= b[1] <= 100 and 1 <= b[2] <= 100:
        b.sort()
        print(b[2]-b[0])
    else:
        print('hoge!')
else:
    print('hoge!')

Submission status: Accepted

Solution code:
num = input().split()
num = sorted([int(i) for i in num])
ans = 0
for i in range(1, 3):
  ans += num[i]-num[i-1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = sorted(list(map(int,input().split())))
print(abs(a[2]- a[0] ))

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

li = na()
li.sort()
print(li[2] - li[0])

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

li = na()
li.sort()
print(li[2] - li[1] + li[1] - li[0])

Submission status: Accepted

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

Submission status: Accepted

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

print(max(abs(a-b), abs(b-c), abs(c-a)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
list = list(map(int,input().split()))
list.sort()
cost = [0]*3
for i in range(3):
	if i==0:
		cost[0] = 0
	else:
		cost[i] = list[i]-list[i-1]

print(sum(cost))

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
order = [[0,1,2],[0,2,1],[1,0,2],[1,2,0],[2,0,1],[2,1,0]]
ans = 10000000
for i in range(len(order)):
    cost = abs(a[order[i][1]] - a[order[i][0]]) + abs(a[order[i][2]] - a[order[i][1]])
    if(ans > cost):
        ans = cost
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a = list(map(int, input().split()))
print(max(a)-min(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A1,A2,A3 = sorted(list(map(int,input().split())))
print(A3-A1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a1,a2,a3=map(int,input().split())
print(abs(a1-a2)+abs(a2-a3)+abs(a3-a1)-max(abs(a1-a2),abs(a2-a3),abs(a3-a1)))

Submission status: Accepted

Solution code:
def task_schedule(tasks):
    out = 0
    tasks = sorted(tasks)
    idx = tasks[0]
    for i in tasks[1:]:
        out += abs(i - idx)
        idx = i
    return out

tasks = list((int(x) for x in raw_input().split()))
print task_schedule(tasks)

Submission status: Accepted

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

a01 = abs(a[0] - a[1])
a02 = abs(a[0] - a[2])
a12 = abs(a[1] - a[2])

cost = sorted([a01, a02, a12])

print(cost[0] + cost[1])

Submission status: Accepted

Solution code:
# Task Scheduling Problem
A = list(map(int, input().split()))

# Aの最大-最小を出力したい

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

Submission status: Accepted

Solution code:
Ai = list(map(int, input().split()))

a_list = []
a_list.append(abs(Ai[0] - Ai[1]) + abs(Ai[1] - Ai[2]))
a_list.append(abs(Ai[0] - Ai[2]) + abs(Ai[2] - Ai[1]))
a_list.append(abs(Ai[1] - Ai[0]) + abs(Ai[0] - Ai[2]))
a_list.append(abs(Ai[1] - Ai[2]) + abs(Ai[2] - Ai[0]))
a_list.append(abs(Ai[2] - Ai[1]) + abs(Ai[1] - Ai[0]))
a_list.append(abs(Ai[2] - Ai[0]) + abs(Ai[0] - Ai[1]))

print(min(a_list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A1,A2,A3 = sorted(list(map(int,input().split())))
print(A3-A1)

Submission status: Accepted

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

print(c - a)

Submission status: Accepted

Solution code:
A = sorted([int(x) for x in input().split()])
a=0
for i in range(len(A)-1):
  a+=abs(A[i+1]-A[i])
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

mod = 1000000007

"""
# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    L = list(map(int, sys.stdin.readline().split()))
    L.sort()
    print((L[2] - L[1]) + (L[1] - L[0]))

Submission status: Accepted

Solution code:
#coding:utf-8
a = list(map(int, input().split()))
a = sorted(a)
#コストが低い順にこなすと全体コストが最小値になる
print((a[1] - a[0]) + (a[2] - a[1]))

Submission status: Accepted

Solution code:
A1, A2, A3 = map(int, input().split())
a = abs(A2-A3)
b = abs(A3-A1)
c = abs(A1-A2)
print(a+b+c-max(a,b,c))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    A1, A2, A3 = map(int, input().split())
    cand = [abs(A1-A2) + abs(A2-A3), abs(A1-A3)+abs(A3-A2), abs(A2-A1)+abs(A1-A3)]
    return min(cand)

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

Submission status: Accepted

Solution code:
lst = sorted(map(int, input().split()))
print(lst[2]-lst[0])

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
cost=[a,b,c]
cost.sort()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import sys


if __name__ == '__main__':
    a = list(map(int,input().split()))
    a = sorted(a)

    answer = sys.maxsize
    for e in list(itertools.permutations(a)):
        a1, a2, a3 = e
        answer = min(answer, abs(a2-a1) + abs(a3-a2))
    print(answer)

Submission status: Accepted

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

print(int(max([a, b, c]) - min([a, b, c])))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum(ans))

Submission status: Accepted

Solution code:
a = sorted(input().split())
s = 0
for i in range(1,len(a)):
    s += abs(int(a[i]) - int(a[i-1]))

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [int(i) for i in input().split()]
a12 = abs(a[0] - a[1])
a23 = abs(a[1] - a[2])
a31 = abs(a[2] - a[0])
print(min(a12+a23,a12+a31,a23+a31))

Submission status: Accepted

Solution code:
s = sorted(list(map(int, input().split())))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

ans = 10 ** 5
for i in range(3):
    for j in range(3):
        if i != j:
            k = 3 - i - j
            cost = abs(A[i] - A[j]) + abs(A[j] - A[k])
            ans = min(cost, ans)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
x = abs(a - b)
y = abs(b - c)
z = abs(c - a)
print(sum(sorted([x, y, z])[:2]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    abc = sorted(list(map(int, input().split())))
    return abc[2] - abc[0]


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

Submission status: Accepted

Solution code:
A = sorted([int(x) for x in input().split()])
print(A[2]-A[0])

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
import bisect
 
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

num = na()
num.sort()

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

Submission status: Accepted

Solution code:
*a ,= map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
As = sorted(list(map(int, input().split())), reverse=True)

cost = 0
for a, b in zip(As[:-1], As[1:]):
  cost += abs(a-b)

print(cost)

Submission status: Accepted

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

d = abs(a-b)
e = abs(a-c)
f = abs(b-c)
g = [d,e,f]
h = sorted(g)
print(h[0]+h[1])

Submission status: Accepted

Solution code:
#A-Task Scheduling Problem(ABC103)
A=list(map(int, input().split()))
A.sort()
print(A[2]-A[1]+A[1]-A[0])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    A = list(map(int, input().split()))

    sort_A = sorted(A)
    print(sort_A[2] - sort_A[0])

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
x=abs(a-b)
y=abs(b-c)
z=abs(a-c)
print(min(x+y,y+z,z+x))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = sorted([int(element) for element in input().split()])
print(A[2] - A[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
list = [int(a) for a in input().split()]
list.sort()
print ((list[2] - list[1]) + (list[1] - list[0]))

Submission status: Accepted

Solution code:
import os, sys, re, math

lines = sys.stdin.readlines()

a = [int(n) for n in lines[0].split()]

costs = []
s = sum(a)
for i in range(3):
    for j in range(3):
        if i != j:
            costs.append(abs(a[j] - a[i]) + abs((s - a[i] - a[j]) - a[j]))
print (min(costs))

Submission status: Accepted

Solution code:
line = raw_input()
a = [int(s) for s in line.split(' ')]
a = sorted(a)
prev = a[0]
ret = 0
for i in a:
    ret += i - prev
    prev = i
print ret

Submission status: Accepted

Solution code:
nums = sorted(list(map(int, input().split(' '))))
print(sum([abs(nums[i+1] - nums[i]) for i in range(len(nums) - 1)]))

Submission status: Accepted

Solution code:
abc = list(sorted(map(int, input().split())))
print(abc[2] - abc[0])

Submission status: Accepted

Solution code:
def test():
    a = list(map(int,input().split()))
    b = 0
    c = max(a)
    a.remove(max(a))
    for i in range(2):
        c = abs(c-max(a))
        b += c
        c = max(a)
        a.remove(max(a))
    print(b)


if __name__ == "__main__":
    test()

Submission status: Accepted

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

print(abs(A1-A2)+abs(A2-A3)+abs(A3-A1)-max(abs(A1-A2),abs(A2-A3),abs(A3-A1)))

Submission status: Accepted

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

if abs(A1-A2)==abs(A2-A3):
    print(abs(A1-A2)+abs(A2-A3)+abs(A3-A1)-abs(A1-A2))
elif abs(A2-A3)==abs(A3-A1):
    print(abs(A1-A2)+abs(A2-A3)+abs(A3-A1)-abs(A2-A3))
elif abs(A3-A1)==abs(A1-A2):
    print(abs(A1-A2)+abs(A2-A3)+abs(A3-A1)-abs(A3-A1))
else :
    print(abs(A1-A2)+abs(A2-A3)+abs(A3-A1)-max(abs(A1-A2),abs(A2-A3),abs(A3-A1)))

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
l=[]
l.append(abs(a-b))
l.append(abs(b-c))
l.append(abs(c-a))
print(sum(l)-max(l))

Submission status: Accepted

Solution code:
a1, a2, a3 = map(int,input().split())
print(max(a1,a2,a3) - min(a1,a2,a3))

Submission status: Accepted

Solution code:
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

inputa = [int(n) for n in inputa]
inputa.sort()

a = int(inputa[0])
b = int(inputa[1])
c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

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

Submission status: Accepted

Solution code:
s=[int(i) for i in input().split()]
s_s=sorted(s)
print(s_s[2]-s_s[0])

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
sorted_a = sorted(a)
cost = 0
cost += sorted_a[1] - sorted_a[0] 
cost += sorted_a[2] - sorted_a[1] 
print(cost)

Submission status: Accepted

Solution code:
a, b, c =sorted(map(int, input().split()), reverse=True)
print((a-b)+(b-c))

Submission status: Accepted

Solution code:
s=[int(x) for x in input().split()]
print(min(abs(s[0]-s[1])+abs(s[1]-s[2]),
         abs(s[0]-s[2])+abs(s[2]-s[1]),
         abs(s[1]-s[0])+abs(s[0]-s[2]),
         abs(s[1]-s[2])+abs(s[2]-s[0]),
         abs(s[2]-s[0])+abs(s[0]-s[1]),
         abs(s[2]-s[1])+abs(s[1]-s[0]),
         )
     )

Submission status: Accepted

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

Submission status: Accepted

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

print(b-a+c-b)

Submission status: Accepted

Solution code:
a,b,c=sorted(map(int, input().split()))
num=abs(b-c)+abs(a-b)
print(num)

Submission status: Accepted

Solution code:
arr=sorted(map(int,input().split()))
print(arr[-1]-arr[0])

Submission status: Accepted

Solution code:
arr=sorted(map(int,input().split()))
print(sum([b-a for a,b in zip(arr, arr[1:])]))

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
A = sorted(map(int,input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
*a, = map(int, input().split())

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
lst = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
a,b,c = sorted(list(map(int,input().split())))
print(str((c-b)+(b-a)))

Submission status: Accepted

Solution code:
x =list(map(int,input().split()))

x.sort()
print((x[1]-x[0])+(x[2]-x[1]))

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
A=abs(a-b)
B=abs(a-c)
C=abs(b-c)
l=[A,B,C]
L=sorted(l)
print(L[0]+L[1])

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
a=abs(A[0]-A[1])
b=abs(A[1]-A[2])
c=abs(A[2]-A[0])
print(a+b+c-max(a,b,c))

Submission status: Accepted

Solution code:
A = [int(x) for x in input().split()]

def cost(A, i, j, k):
    return abs(A[i] - A[j])+ abs(A[j] - A[k])

print(min(
    cost(A, 0, 1, 2),
    cost(A, 0, 2, 1),
    cost(A, 1, 0, 2),
    cost(A, 1, 2, 0),
    cost(A, 2, 1, 0),
    cost(A, 2, 0, 1)
))

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
print(int(max(A,B,C)-min(A,B,C)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
A = [a,b,c]
A.sort()
print(A[2]-A[0])

Submission status: Accepted

Solution code:
#coding-utf-8
a,b,c=map(int,input().split())
ans=a+b+c
ans=min(ans,abs(b-a)+abs(b-c))
ans=min(ans,abs(c-a)+abs(b-c))
ans=min(ans,abs(a-b)+abs(a-c))
ans=min(ans,abs(c-b)+abs(a-c))
ans=min(ans,abs(c-a)+abs(b-a))
ans=min(ans,abs(c-b)+abs(b-a))
print(ans)

Submission status: Accepted

Solution code:
task = sorted(list(map(int, input().rstrip().split(" "))))
print(max(task) - min(task))

Submission status: Accepted

Solution code:
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    a = LIST()
    min_cost = INF

    for i in range(3):
        for j in range(3):
            for k in range(3):
                if not i == j and not j == k and not k == i:
                    cost = abs(a[j]-a[i]) + abs(a[k]-a[j])
                    if cost < min_cost:
                        min_cost = cost

    print(min_cost)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

A.sort()

S = (A[2]-A[1]) + (A[1]-A[0])

print(S)

Submission status: Accepted

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

a.sort()

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

print(cost)

Submission status: Accepted

Solution code:
#103

A1, A2, A3 = map(int, input().rstrip().split())

print(max(A1, A2, A3)-min(A1, A2, A3))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#22:32
a = list(map(int,input().split()))
print( max(a) - min(a) )

Submission status: Accepted

Solution code:
# coding:utf-8
def main():
    l = list(map(int, input().split()))
    l = sorted(l)

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


if __name__ == '__main__' :
    main()