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

Submission status: Accepted

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

# 差の絶対値が小さい2つを足す
diffs = [abs(a1-a2),abs(a2-a3),abs(a1-a3)]
print(sum(diffs) - max(diffs))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = input().split()
B = []
C = 0
for k in range(3):
  B.append(int(A[k]))
B.sort()
for i in range(2):
  C += int(B[i + 1]) - int(B[i])
print(C)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a1, a2, a3 = [int(x) for x in input().split()]
a1a2 = abs(a1 - a2)
a1a3 = abs(a1 - a3)
a2a3 = abs(a2 - a3)

print(sum(sorted([a1a2, a1a3, a2a3])[:2]))

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    *a, = map(int, input().split(' '))
    print(max(a) - min(a))

Submission status: Accepted

Solution code:
A1, A2, A3 = list(map(int,input().split()))
if A1 == A2 and A2 == A3:
    print(0)
else:
    print(max(A1,A2,A3)-min(A1,A2,A3))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
Tmp = []
Tmp = input().rstrip().split(' ')
 
Ans = []
 
for i in range(3):
  nTmp = int(Tmp[i])
  
  Ans.append(nTmp)
 
Ans.sort()
 
nAns = (Ans[1]-Ans[0])
nAns += Ans[2]-Ans[1]

print(nAns)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a1,a2,a3 = map(int,input().split())
task1 = abs(a2-a1)
task2 = abs(a3-a2)
task3 = abs(a1-a3)
maxtask = max([task1,task2,task3])
print(task1+task2+task3-maxtask)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [int(i) for i in input().split()]
m = []
for i in range(3):
    m.append(abs(l[i-1]-l[i]))
print(sum(m) - max(m))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
if a[0] == a[1] and a[1] == a[2]:
    print(0)
else:
    print(max(a[0],a[1],a[2]) - min(a[0],a[1],a[2]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

sorted_list = sorted(a_list, reverse=True)
x_list = []

for i, a1 in enumerate(sorted_list[:-1]):
    a2 = sorted_list[i+1]
    x = abs(a1-a2)
    x_list.append(x)

ans = sum(x_list)
print(ans)

Submission status: Accepted

Solution code:

import itertools

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

res = sum(xs)
for ys in itertools.permutations(xs):
    tmp = abs(ys[1] - ys[0]) + abs(ys[2] - ys[1])
    res = min(res, tmp)

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

li = [abs(a-b), abs(a-c), abs(b-c)]
li.sort()
print(li[0] + li[1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

# solve
A.sort()
ans = 0
for i in range(2):
    ans += abs(A[i + 1] - A[i])

# output
print(ans)

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

cost = []
cost.append(abs(A[0] - A[1]))
cost.append(abs(A[1] - A[2]))
cost.append(abs(A[2] - A[0]))
cost.remove(max(cost))

print(sum(cost))

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    a = list(int(_) for _ in input().split())
    a.sort()
    
    print(abs(a[0]-a[1]) + abs(a[1]-a[2]))
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A1,A2,A3 = map(int,input().split())
A12 = abs(A1-A2)
A23 = abs(A2-A3)
A31 = abs(A3-A1)

print(A12+A23+A31-max(A12,A23,A31))

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:
l = list(map(int,input().split()))
l.sort()
ans = []
for i in range(len(l)-1):
  ans.append(l[i+1] - l[i])
print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = list(map(int, input().split())) # 横に2個

A.sort()

ans = 0
pre = A[0]
for a in A:
    ans += a - pre
    pre = a

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

A.sort()

# print(A)

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

print((0) + (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])

Submission status: Accepted

Solution code:
# 16:07
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
# def LIST(): return list(map(str, input().split()))
# def LIST(): return list(input())

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

A = LIST()
per = list(permutations(A))
ans_l = []
for p in per:
    ans = 0
    for i in range(len(p)-1):
        ans += abs(p[i+1] - p[i])
    ans_l.append(ans)
print(min(ans_l))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# A1=a, A2=b, A3=c
a,b,c = [int(i) for i in input().split()]

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

#はじめに完了すべきタスク　A[2]
#二番目に完了すべきタスク　A[1]

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

Submission status: Accepted

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

Submission status: Accepted

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

print(max([x,y,z])-min([x,y,z]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = LI()
    ans = 10 ** 5
    ans = min(ans, abs(a - b) + abs(b - c))
    ans = min(ans, abs(a - c) + abs(b - c))
    ans = min(ans, abs(a - c) + abs(a - b))
    
    print(ans)
    

    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

Submission status: Accepted

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

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

Submission status: Accepted

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

A = sorted(A, reverse=True)

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

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:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    al = list(map(int, input().split()))

    print(max(al) - min(al))

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    al = list(map(int, input().split()))

    al.sort()

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

Submission status: Accepted

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

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

print(abs(a1-a2)+abs(a2-a3)+abs(a3-a1)-(max(a1,a2,a3)-min(a1, a2, a3)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

print(max(l) - min(l))

Submission status: Accepted

Solution code:
a1, a2, a3 = map(int, input().split())
ans = sum([abs(a1-a2), abs(a3-a2), abs(a1-a3)])
ans -= max([abs(a1-a2), abs(a3-a2), abs(a1-a3)])
print(ans)

Submission status: Accepted

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

A.sort()

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

Submission status: Accepted

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

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:
tasks = sorted([int(v) for v in input().split()])
print(tasks[-1]-tasks[0])

Submission status: Accepted

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

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

Submission status: Accepted

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

x2=sorted(x)

res=x2[2]-x2[0]

print(res)

Submission status: Accepted

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

count = 0

for i in range(len(temp_list)):
  if i == 0:
    continue
  count += abs(temp_list[i-1] - temp_list[i])
  
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
A=abs(a-b)
B=abs(b-c)
C=abs(a-c)
print((A+B+C)-max(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:
lst = [int(i) for i in input().split()]
lst_s = sorted(lst)
cost = lst_s[2]-lst_s[0]
print(cost)

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:
def main():
    A = list(map(int, input().split()))
    B = sorted(A, reverse=True)
    retval = 0
    for i in range(1, len(B)):
        retval += B[i-1] - B[i]
    print(retval)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
As = input().split()
result =  int(max(As)) - int(min(As))
print(-result if result<0 else result)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
X = abs(A-B)
Y = abs(B-C)
Z = abs(C-A)
lists = [X, Y, Z]
W = max(lists)
print(X + Y + Z - W)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

A1, A2, A3 = nl()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import permutations

a = list(map(int,input().split()))
permutation = list(permutations([0,1,2]))

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

print(min(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

lis.sort()

ans = 0

for i in range( len(lis) - 1 ):

    ans += lis[i + 1] - lis[i]

print (ans)

Submission status: Accepted

Solution code:
a1, a2, a3 = map(int, input().split())
dist = [abs(a1 - a2), abs(a2 - a3), abs(a1 - a3)]
dist.sort()
print(sum(dist[0:2]))

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(a-c))
l.sort()
print(l[0]+l[1])

Submission status: Accepted

Solution code:
c = list(map(int,input().split()))
x = max(c)
c.remove(x)
y = max(c)
c.remove(y)
z = max(c)
c.remove(z)

print(x - z)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
line = input()
words = line.split()

num_list = []
for elm in words:
    num_list.append(int(elm))

num_list.sort()
score = 0
for i, num in enumerate(num_list):
    if i < (len(num_list) - 1):
        score += (abs(num_list[i] - num_list[i+1]))
    else:
        break

print(score)

Submission status: Accepted

Solution code:
import numpy as np
a_list = list(map(int, input().split()))
sorted_list = sorted(a_list)
sorted_list[2] = sorted_list[2] - sorted_list[1]
sorted_list[1] = sorted_list[1] - sorted_list[0]
sorted_list[0] = 0
print(np.sum(sorted_list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
L=list(map(int, input().split()))
X=sorted([abs(L[2]-L[0]),abs(L[0]-L[1]),abs(L[1]-L[2])])
print(X[0]+X[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 = list(map(int, input().split()))
ans = max(a) - min(a)
print(ans)

Submission status: Accepted

Solution code:
a_s = [int(v) for v in input().split()]
a_s.sort()
c_s = [a_s[i] - a_s[i - 1] for i in range(1, 3)]
print(sum(c_s))

Submission status: Accepted

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


def solve(A: "List[int]"):
    print(max(A) - min(A))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = [ int(next(tokens)) for _ in range(3) ]  # type: "List[int]"
    solve(A)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = input().split()
a = [int(a[i]) for i in range(3)]
a.sort()
s = 0
for i in range(len(a)):
  if i > 0:
    s = s + a[i] - a[i-1]
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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:
import heapq

a = list(map(lambda x: int(x), input().split()))


a_heap = []
for a_item in a:
  heapq.heappush(a_heap, a_item)

prev = heapq.heappop(a_heap)

answer = 0
while(len(a_heap) > 0):
  next = heapq.heappop(a_heap)
  answer = answer + (next - prev)
  prev = next

print(answer)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def abc():
    a1, a2, a3 = map(int, input().rstrip().split())
    costs = list()
    costs.append(abs(a1 - a2))
    costs.append(abs(a1 - a3))
    costs.append(abs(a2 - a3))
    costs.sort()
    print(costs[0] + costs[1])


abc()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cost)

Submission status: Accepted

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

Submission status: Accepted

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

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:
A = list(map(int, input().split())) #[1,2,3]
A.sort()
print(A[1]-A[0]+A[2]-A[1])

Submission status: Accepted

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

reverse = True if abs(A[0] - A[1]) > abs(A[-2] - A[-1]) else False
prev = -1
sum = 0
for a in sorted(A, reverse=reverse):
    if prev == -1:
        prev = a
        continue
    sum += abs(prev - a)
    prev = a
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
As = list(map(int,input().split()))
perms = list(itertools.permutations(As))
min_val = 300
for i in perms:
  vals = abs(i[1] - i[0]) + abs(i[2] - i[1])
  if min_val > vals:
    min_val = vals
print(min_val)

Submission status: Accepted

Solution code:
Aa, Ab, Ac = map(int, input().split())

li = []

li.append(Aa)
li.append(Ab)
li.append(Ac)

li.sort()

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

Submission status: Accepted

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

a.sort(reverse=True)

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

Submission status: Accepted

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

A.sort(reverse=True)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np

def main():
	A, B, C = map(int, input().split(" "))
	
	tmp = []
	tmp.append(A)
	tmp.append(B)
	tmp.append(C)
	tmp.sort()
	
	a = abs(tmp[1] - tmp[0])
	b = abs(tmp[2] - tmp[1])
		
	print(a + b)
	
if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

L = [int(v) for v in input().split()]

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

l = [a,b,c]
l.sort(reverse=False)

ans = 0
ans = l[1]-l[0]
ans = ans + l[2]- l[1]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
task = sorted([ int(v) for v in input().split() ])

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

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

task=sorted(task)

cost=0

for i in range(len(task)-1):
    x=abs(task[i]-task[i+1])
    cost=cost+x


print(cost)

Submission status: Accepted

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

Submission status: Accepted

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

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

#A1 cost=0
A11 = abs(A2-A1) + abs(A3-A2)
A12 = abs(A3-A1) + abs(A2-A3)

#A2 cost=0
A21 = abs(A1-A2) + abs(A3-A1)
A22 = abs(A3-A2) + abs(A1-A3)

#A3 cost=0
A31 = abs(A1-A3) + abs(A2-A1)
A32 = abs(A2-A3) + abs(A1-A2)

print(min(A11,A12,A21,A22,A31,A32))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import itertools

def solve(A: "List[int]"):

    minc = float("inf")
    for al in itertools.permutations(A):
        c = 0
        for i in range(1,len(al)):
            c += abs(al[i]-al[i-1])
        minc = min(minc,c)
    print(minc)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = [ int(next(tokens)) for _ in range(3) ]  # type: "List[int]"
    solve(A)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
p = abs(a-b)
q = abs(b-c)
r = abs(c-a)
l = [p+q, q+r, r+p]
print(min(l))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
list_num = [int(num) for num in input().split()]
list_num.sort(reverse=True)

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

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a = f()
    x,y,z =abs(a[0]-a[1]), abs(a[0]-a[2]), abs(a[1]-a[2])
    print( x+y+z - max(x,y,z))

solve()

Submission status: Accepted

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