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

Submission status: Accepted

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

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())
print(max(A, B, C) - min(A, B, C))

Submission status: Accepted

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

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

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(map(int, input().split()))
s = sorted(a, reverse=True)
ans = [s[i]-s[i+1] for i in range(2)]
print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
A.sort(reverse=True)
sum = 0

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=list(map(int,input().split()))
a=sorted(a)
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 = list(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 = sorted(map(int,input().split()))
print(c - b + b - a)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

print(a)

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:
A1, A2, A3 = list(map(int, input().split()))
h = [A1, A2, A3]
maxvalue = -1
minvalue = 101
for i in range(len(h)):
    if h[i] > maxvalue:
        maxvalue = h[i]
for i in range(len(h)):
    if h[i] < minvalue:
        minvalue = h[i]
print(maxvalue - minvalue)

Submission status: Accepted

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

print(abs(abs1+abs2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
tasks = [int(i) for i in input().split()]

taskes = sorted(tasks)

costs = 0

for i in range(2):
    costs += abs(taskes[i] - taskes[i+1])
print(costs)

Submission status: Accepted

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


def main():
    A1, A2, A3 = map(int, input().split())
    print(max(A1, A2, A3) - min(A1, A2, A3))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a1, a2, a3 = map(int, input().split())
list = [a1, a2, a3]
list.sort()
cost = 0
for id in range(3):
    if id == 0: continue
    cost += list[id] - list[id - 1]
print(cost)

Submission status: Accepted

Solution code:
import itertools
a=list(map(int,input().split()))
ans=999
l=[0,1,2]
for x in itertools.permutations(l,3):
  tmp=abs(a[x[0]]-a[x[1]])+abs(a[x[1]]-a[x[2]])
  if tmp <=ans:
    ans =tmp
print(ans)

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

Submission status: Accepted

Solution code:
a,b,c = input().split(' ')
A = abs(int(a)-int(b))
B = abs(int(b)-int(c))
C = abs(int(c)-int(a))
N = A + B + C -max(A, B, C)
print(N)

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

Submission status: Accepted

Solution code:
inp = input().split()
data = []
# 
for i in inp:
  data.append(int(i))
# 
result = 0

for j in sorted(data, reverse=True):
  if j == max(data):
    pass
  else:
    result += abs(j - i)
  i = j
print(result)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

a1 = a*0+abs(a-b)+abs(c-b)
a2 = a*0+abs(a-c)+abs(b-c)
b1 = b*0+abs(b-a)+abs(a-c)
b2 = b*0+abs(b-c)+abs(c-a)
c1 = c*0+abs(c-a)+abs(a-b)
c2 = c*0+abs(c-b)+abs(b-a)
ans = min(a1,a2,b1,b2,c1,c2)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A1,A2,A3=map(int,input().split())
l=[A1,A2,A3]
l.sort(reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=sorted(list(map(int,input().split())))
print(S[2]-S[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:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a = list(map(int,input().split()))
a.sort()
print(a[-1]-a[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((a[1]-a[0])+(a[2]-a[1]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 23, Jan, 2020
"""

import sys

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A = [int(x) for x in readline().split()]
print(max(A) - min(A))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(c-a)

Submission status: Accepted

Solution code:
# import numpy as np
# import scipy as sp
# print(ans,sep="")
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

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

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:
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)]))

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
A.sort()
n = []
for i in range(2):
    n.append(abs(A[1] - A[0]))
    A.remove(A[0])
print(sum(n))

Submission status: Accepted

Solution code:
from numpy import diff
print(sum(diff(sorted(list(map(int, input().split()))))))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    from sys import stdin, setrecursionlimit
    setrecursionlimit(10**6)
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = sorted((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[0] - a[2]))

Submission status: Accepted

Solution code:
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0):
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

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

if __name__=='__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

A = sorted(A)

print((A[2]-A[1]) + (A[1]-A[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=sorted(map(int, input().split()))

print(c-a)

Submission status: Accepted

Solution code:
import itertools
a = list(map(int,input().split()))
lst_a =  list(itertools.permutations(a))
array = []
for i in lst_a:
    array.append(abs(i[0]-i[1]) + abs(i[1]-i[2]))
print(min(array))

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

Submission status: Accepted

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

li = [abs(a-b),abs(a-c),abs(b-c)]
print(sum(li)-max(li))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
task = input().split()
t_i = [int(s) for s in task]
cost = 0

for i in range(2):
    for j in range(2):
        if(t_i[j] > t_i[j+1]):
            t_i[j], t_i[j+1] = t_i[j+1], t_i[j]
cost = t_i[1] - t_i[0] + t_i[2] - t_i[1]
print(cost)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ab = abs(a - b) 
ac = abs(a - c)
bc = abs(b - c)

l = [ab, ac, bc]

print(sum(l) - max(l))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

p = max(a, b, c)
q = min(a, b, c)
r = a + b + c - p - q

print(0 + r - q + p - r)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x = abs(A1 - A2)
y = abs(A2 - A3)
z = abs(A3 - A1)

ans = sum([x, y, z]) - max(x, y, z)
print(ans)

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(reverse=True)
ans = 0
for i in range(len(A)-1):
    ans = ans + abs(A[i] - A[i+1])

print(ans)

Submission status: Accepted

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

result = 0

for i in range(1,len(tSorted)):
  result += abs(tSorted[i-1]-tSorted[i])

print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
li = [int(i) for i in input().split()]
sum =0
li.sort()
for i in range(1,3) :
    sum += abs(li[i] - li[i-1])
print(sum)

Submission status: Accepted

Solution code:
import numpy as np
A = list(map(int, input().split()))

A = np.array(A)
A.sort()

print(np.diff(A).sum())

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
d=abs(a-b)
e=abs(b-c)
f=abs(c-a)
s1=d+e
s2=e+f
s3=f+d
l=[s1,s2,s3]
l.sort()
print(l[0])

Submission status: Accepted

Solution code:
# A
lst = list(map(int, input().split()))
sor = sorted(lst)
cost = 0
for i in range(len(sor)):
    if i == 0:
        continue
    else:
        cost += abs(sor[i]-sor[i-1])
print(cost)

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:
A1,A2,A3=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき

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

Submission status: Accepted

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

Submission status: Accepted

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

if abs(a - b) < abs(c - a):
  print(abs(a - b) + abs(b - c))
else:
  print(abs(a - c) + abs(b - c))

Submission status: Accepted

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

    diff = [abs(a1-a2),abs(a1-a3),abs(a2-a3)]
    maximum = max(diff)
    print(sum(diff) - maximum)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

A = list(map(int, sys.stdin.buffer.readline().split()))
A = np.array(A, dtype=int)

ans = A.max() - A.min()
print(ans)

Submission status: Accepted

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

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:
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:
x,y,z = sorted(map(int,input().split()))
print(-x+z)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
l = [a ,b, c]
l.sort()
ans = []
p = l.pop()
ans.append(abs(p-l[0]) + abs(l[0]-l[1]))
ans.append(abs(p-l[1]) + abs(l[1]-l[0]))
print(min(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:
a,b,c=map(int,input().split())
l=sorted([abs(c-a),abs(c-b),abs(b-a)])
print(l[0]+l[1])

Submission status: Accepted

Solution code:
import sys

*a, = map(int, sys.stdin.readline().split())

def main():
    return max(a) - min(a)

if __name__ == '__main__':
    ans = main()
    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(x+y+z-max(x,y,z))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
items=list(map(int, input().split()))
m=sum(items)-(max(items)+min(items))
print(abs(max(items)-m)+ abs(min(items)-m))

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
# print(A)
print(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])))

Submission status: Accepted

Solution code:
import itertools

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

L = itertools.permutations(A)

min = float('inf')

for l in L:
    temp = abs(l[1]-l[0])+abs(l[2]-l[1])
    if min > temp:
        min = temp
print(min)

Submission status: Accepted

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

s=sorted(a)

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

Submission status: Accepted

Solution code:
l=sorted(map(int, input().split()))
print(l[2]-l[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())

lst1 = [a,b,c]
lst1.sort(reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
import numpy as np
A = [int(x) for x in input().split()]
A1 = np.array(sorted(A))
A2 = np.array(sorted(A, reverse=True))
A1 = abs(np.diff(A1)).sum()
A2 = abs(np.diff(A2)).sum()
print(min(A1, A2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a=LIST()
    print(max(a)-min(a))
if __name__ == '__main__':
    do()

Submission status: Accepted

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

Submission status: Accepted

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

A.sort()

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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:
from itertools import permutations


def calc_cost(t1, t2, t3):
    cost = 0
    cost += abs(t2 - t1)
    cost += abs(t3 - t2)
    return cost


def main():
    A = [int(i) for i in input().split()]
    min_cost = 198
    for a, b, c in permutations(A):
        min_cost = min(min_cost, calc_cost(a, b, c))
    print(min_cost)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
li_A = list(map(int, input().split()))
li_abs = [0]*3
for i in range(3):
    li_abs[i] = abs(li_A[i] - li_A[(i+1)%3])
li_abs.sort()
print(li_abs[0]+li_abs[1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
List=list(map(int,input().split()))
List.sort()
ans=10000
for i in range(3):
    cou=0
    for j in range(3):
         cou+=abs(List[i]-List[j])
    ans=min([ans,cou])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
num = sorted(list(map(int, input().split())))
print(num[2]-num[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(list(map(int,input().split())))
print(c - a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

A = sorted([int(abs(a1-a2)), int(abs(a2-a3)), int(abs(a3-a1))])

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

Submission status: Accepted

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

ans = 1000
for p in permutations(a_list):
    cost = abs(p[1] - p[0]) + abs(p[2] - p[1])
    ans = min(cost, ans)

print(ans)

Submission status: Accepted

Solution code:
import sys 

l = list(map(int, sys.stdin.readline().split()))

l.sort()
m = l[1:]

sum = 0
for min, max in zip(l, m):
    sum += max - min

print(sum)

Submission status: Accepted

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

orders = (
    (a1, a2, a3),
    (a1, a3, a2),
    (a2, a1, a3),
    (a2, a3, a1),
    (a3, a1, a2),
    (a3, a1, a2)
)


def get_cost(i1, i2, i3):
    return abs(i2-i1) + abs(i3-i2)


costs = [get_cost(*order) for order in orders]
print(min(costs))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,C = list(map(int,input().split()))
srt = sorted([A,B,C])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a1, a2, a3 = [int(x) for x in input().split()]
a1, a2, a3 = sorted([a1, a2, a3])
print(a3-a1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,C=map(int, input().split())
a=abs(A-B)
b=abs(A-C)
c=abs(B-C)


saidai=max(a,b,c)
kotae=a+b+c-saidai
print(kotae)

Submission status: Accepted

Solution code:
import numpy as np
A = np.array(sorted(map(int, input().split())))
print((A[1:] - A[:-1]).sum())

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 = list(map(int, input().split()))
r = max(a)
a.remove(max(a))
ans = 0
ans += abs(r - max(a)) + abs(a[0] - a[1])
print(ans)

Submission status: Accepted

Solution code:


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

A.sort()

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

Submission status: Accepted

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

a.sort()

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
c1 = abs(a-b) + abs(b-c)
c2 = abs(a-c) + abs(c-b)
c3 = abs(b-a) + abs(a-c)
cs = [c1, c2, c3]
print(min(cs))