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:
# abc103_a.py
# https://atcoder.jp/contests/abc103/tasks/abc103_a

# A - Task Scheduling Problem /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 100点

# 問題文
# 3個のタスクがあり、あなたは全てのタスクを完了させなければなりません。
# はじめ、任意の 1個のタスクをコスト 0で完了できます。
# また、i番目のタスクを完了した直後にコスト |Aj−Ai| で j番目のタスクを完了できます。
# ここで |x|は xの絶対値を表します。
# 全てのタスクを完了するのに要する合計コストの最小値を求めてください。

# 制約
#     入力は全て整数である
#     1≤A1,A2,A3≤100

# 入力
# 入力は以下の形式で標準入力から与えられる。
# A1 A2 A3

# 出力
# 全てのタスクを完了するのに要する合計コストの最小値を出力せよ。

# 入力例 1
# 1 6 3

# 出力例 1
# 5

# 以下の順番でタスクを完了させたとき、合計コストは 5となり最小です。

#     1番目のタスクをコスト 0で完了させます
#     3番目のタスクをコスト 2で完了させます
#     2番目のタスクをコスト 3で完了させます

# 入力例 2
# 11 5 5

# 出力例 2
# 6

# 入力例 3
# 100 100 100

# 出力例 3
# 0


def calculation(lines):
    values = list(map(int, lines[0].split()))
    mi = min(values)
    ma = max(values)
    return [ma - mi]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['1 6 3']
        lines_export = [5]
    if pattern == 2:
        lines_input = ['11 5 5']
        lines_export = [6]
    if pattern == 3:
        lines_input = ['100 100 100']
        lines_export = [0]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')


# 起動処理
if __name__ == '__main__':
    main()

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 = sorted([int(i) for i in input().split()])
print(a[2] - a[0])

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()

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

Submission status: Accepted

Solution code:
a=list(map(int, input().split()))
a.sort()
ans=0
for i in range(1,3):
    ans+=abs(a[i]-a[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,b,c = map(int,input().split())
ans = min(abs(a-b)+abs(b-c),abs(a-c)+abs(b-c),abs(a-c)+abs(a-b))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

aa = tuple(sorted(map(int, input().split())))
ans = 10 ** 10
for a in itertools.permutations(aa, 3):
    ans = min(ans, abs(a[0] - a[1]) + abs(a[1] - a[2]))
print(ans)

Submission status: Accepted

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

orders = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]]
ans = []

for order in orders:
    cost = abs(A[order[0]] - A[order[1]]) + abs(A[order[1]] - A[order[2]])
    ans.append(cost)
    
print(min(ans))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a = sorted(map(int, readline().split()))
ans = (a[2]-a[1])+(a[1]-a[0])
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
a1, a2, a3 = map(int, input().split())
ans = 10 ** 9
for v in itertools.permutations([a1, a2, a3]):
    d = 0
    for i in range(1, 3):
        d += abs(v[i]-v[i-1])
    ans = min(ans, d)

print(ans)

Submission status: Accepted

Solution code:
ais = map(int, raw_input().split()) #1 6 3
ais.sort()
print sum([v-  u for u,v in zip(ais, ais[1:])])

Submission status: Accepted

Solution code:
aa = list(map(int, open(0).read().split()))

print(max(aa) - min(aa))

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=sorted(map(int,input().split()))
    print(abs(a[1]-a[0]) + abs(a[2]-a[1]))
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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(max(a) - min(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

lists = [a,b,c]

x = max(lists)

lists.remove(x)

y = max(lists)

lists.remove(y)

print(int(abs(y-x)) + int(abs(lists[0] - y)))

Submission status: Accepted

Solution code:
from itertools import permutations
A = list(map(int, input().split()))
res = 10 ** 4
for perm in permutations(list(range(3))):
    tmp = 0
    for i in range(1, 3):
        tmp += abs(A[perm[i]] - A[perm[i-1]])
    res = min(res, tmp)
print(res)

Submission status: Accepted

Solution code:
A = sorted([int(X) for X in input().split()],reverse=True)
Cost = [0]+[A[X]-A[X+1] for X in range(0,len(A)-1)]
print(sum(Cost))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A.sort(reverse=True)
ans = 0
for i in range(1,len(A)):
    ans += abs(A[i-1]-A[i])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a_lst = list(map(abs, map(int, input().split(" "))))

a_lst.sort()

total = 0
previous = a_lst[0]
for i in a_lst[1:]:
    total += (i - previous)
    previous = i

print(total)

Submission status: Accepted

Solution code:
line = list(input().split())
line.sort()
if int(line[1]) - int(line[0]) > int(line[2]) - int(line[1]):
    print((int(line[2]) - int(line[1]) + (int(line[1]) - int(line[0]))))
else:
    print(abs((int(line[2]) - int(line[1]) + (int(line[1]) - int(line[0])))))

Submission status: Accepted

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

arr.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:

A = list(map(int,input().split()))
#[A1,A2,A3] = list(map(int,input().split()))
# print(A)

from itertools import permutations
Ls = list(permutations(A))

ans=100000000
for L in Ls:
    # print('L:',L)
    cost=0
    for i in range(1,3):
        cost+=abs(L[i]-L[i-1])
        # print('i,c:', i,cost)
    # print('cost:', cost)
    ans = min(ans,cost)

print(ans)

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 = map(int,input().split())
print(min(abs(a-b)+abs(b-c),abs(b-a)+abs(a-c),abs(a-c)+abs(c-b)))

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
A1,A2,A3 = map(int,input().split())
array_A = [A1,A2,A3]

if not (1 <= A1 <= 100 and 1 <= A2 <= 100 and 1 <= A3 <= 100):
    sys.exit()

print(max(array_A) - min(array_A))

Submission status: Accepted

Solution code:
import sys
rl = lambda: list(map(int, sys.stdin.readline().split()))

a = sorted(rl())
print(a[2] - a[0])

Submission status: Accepted

Solution code:
import sys
rl = lambda: list(map(int, sys.stdin.readline().split()))

a = sorted(rl())
print(a[-1] - a[0])

Submission status: Accepted

Solution code:
import sys
rl = lambda: list(map(int, sys.stdin.readline().split()))

a = rl()
print(max(a) - min(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


a12 = abs(a1 - a2)
a13 = abs(a1 - a3)
a23 = abs(a2 - a3)

max_num = max(a12,a13, a23)

print(a12 + a13 + a23 - max_num)

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(reverse=True)
ans=0
bef=l[0]
for i in l:
  ans+=abs(bef-i)
  bef=i
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

cost_a = a[1] - a[0]
cost_b = a[2] - a[1]
print(cost_a + cost_b)

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()))

A.sort()

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

print(ans)

Submission status: Accepted

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

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())))
ans = abs(A[0]-A[1]) + abs(A[1]-A[2])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# A - Task Scheduling Problem

A = list(int(a) for a in input().split())
A.sort()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A = [A1, A2, A3]

A.sort()

cst1 = A[2] - A[1]

cst2 = A[1] - A[0]

cst = cst1 + cst2

print(cst)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

a, b, c = map(int, input().split())
A = sorted([abs(a-b), abs(a-c), abs(b-c)])

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

Submission status: Accepted

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

print(max(As)-min(As))

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()))
A.sort()

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

Submission status: Accepted

Solution code:
def main():
    A, B, C = map(int, input().split())
    costs = [A, B, C]
    costs.sort()
    print((costs[1] - costs[0]) + (costs[2] - costs[1]))
main()

Submission status: Accepted

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

print(max(alist)-min(alist))

Submission status: Accepted

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

lis = sorted(lis)

ans = 0

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

Submission status: Accepted

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

a1 = abs(a[0] - a[1])
a2 = abs(a[1] - a[2])
a3 = abs(a[2] - a[0])

m = max(a1, a2, a3)
#print(m)
print(a1 + a2 + a3 - m)

Submission status: Accepted

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

res = 10000
val = 0
for i in range(2):
    val += A[i+1] - A[i]
res = min(res, val)
for i in range(2):
    val += abs(rA[i+1] - rA[i])
res = min(res, val)
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = sorted([int(n) for n in input().split()])
print(c-a)

Submission status: Accepted

Solution code:
import sys
from itertools import permutations
def input(): return sys.stdin.readline().strip()


def main():
    a, b, c = map(int, input().split())
    ans = 10 ** 10
    for p, q, r in list(permutations([a, b, c], 3)):
        ans = min(ans, abs(p-q) + abs(q-r))
    print(ans)



if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    lis = list(map(int, input().split()))
    lis.sort(reverse=True)
    count = 0

    for i in range(len(lis)-1):
        count += abs(lis[i] - lis[i+1])
    print(count)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A1,A2,A3 = map(int, input().split())
res = 100*3
A = [A1,A2,A3]
arr = [[0,1,2], [0,2,1], [1,0,2], [1,2,0],[2,0,1], [2,1,0] ]
for a in arr:
  m = abs(A[  a[0] ] - A[a[1]])
  n = abs(  A[ a[2] ] - A[a[1]])
  if res > m + n:
    res = m + n
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = sorted([int(i) for i in input().split()])

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
arr = list(map(int, input().split()))
print(max(arr) - min(arr))

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:
list = list(map(int, input().split()))

print(max(list)-min(list))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
a = sorted(list(map(int, input().split())))
c = 0
for i in range(1, 3):
    c += abs(a[i]-a[i-1]) 
print(c)

Submission status: Accepted

Solution code:
import itertools
a = [int(i) for i in  input().split()]

def cost(a):
    return abs(a[0]-a[1])+abs(a[1]-a[2])

ans = sum(a)
for i in itertools.permutations(a):
    c = cost(i)
    if c < ans:
        ans = c

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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[0] - a[1]) + abs(a[1] - a[2]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(x - y)

Submission status: Accepted

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

print(A3-A1)

Submission status: Accepted

Solution code:
def actual(a1, a2, a3):
    A = sorted([a1, a2, a3])

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

    return amount_cost

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

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())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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(x+y+z-max(x,y,z))

Submission status: Accepted

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

A=[A1,A2,A3]

B=sorted(A)

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

Submission status: Accepted

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

Submission status: Accepted

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

sorted_A = sorted(A)

print(-sorted_A[0] + sorted_A[2])

Submission status: Accepted

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

a.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

    A.sort(reverse=True)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

A, B, C = [int(x) for x in stdin.readline().rstrip().split()]

print(max(A,B,C)-min(A,B,C))

Submission status: Accepted

Solution code:
A_1, A_2, A_3 = (int(x) for x in input().split())
list = [A_1, A_2, A_3]
new_list = sorted(list)
print(new_list[2] - new_list[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a1,a2,a3=map(int,input().split())
a=[abs(a1-a2),abs(a1-a3),abs(a2-a3)]
a.sort()
result=0
for i in range(2):
    result+=a[i]
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
print(sum([abs(a-b), abs(b-c), abs(c-a)])-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:
a, b, c = map(int, input().split())
print(max(a, b, c) - min(a, b, c))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

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()
b = [a[i+1]-a[i] for i in range(len(a)-1)]

print(sum(b))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#n=int(input())
a1,a2,a3=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

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

l=[d1,d2,d3]

l.sort()

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

Submission status: Accepted

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

#check
A.sort()
cost = 0
for idx, a in enumerate(A):
    if idx == 0:
        continue
    else:
        cost += a - A[idx - 1]
print(cost)

Submission status: Accepted

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

Submission status: Accepted

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

x.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

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()))
a.sort()
cost=0
cost+=abs(a[0]-a[1])
cost+=abs(a[1]-a[2])
print(cost)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

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

cost1=abs(a2-a1)+abs(a3-a1)
cost2=abs(a1-a2)+abs(a3-a2)
cost3=abs(a1-a3)+abs(a2-a3)

ans = min(cost1,cost2,cost3)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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(max(A)-min(A))

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()))
X = abs(A[0]-A[1])
Y = abs(A[1]-A[2])
Z = abs(A[2]-A[0])
print(X+Y+Z-max(X,Y,Z))

Submission status: Accepted

Solution code:
x, y, z = map(int, input().split())
i = x + y + z
mid = i-min(x, y, z)-max(x, y, z)
print(mid - min(x, y, z) + max(x, y, z)-mid)