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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
if a>=b>=c:
    print(a-c)
elif a>=c>=b:
    print(a-b)
elif b>=a>=c:
    print(b-c)
elif b>=c>=a:
    print(b-a)
elif c>=a>=b:
    print(c-b)
else:
    print(c-a)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a = nl()

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

Submission status: Accepted

Solution code:
icase=103
if icase==103:
    a1,a2,a3=map(int,input().split())
    a=min(abs(a2-a1)+abs(a3-a2),abs(a3-a2)+abs(a1-a3),abs(a1-a3)+abs(a2-a1))
    print(a)

Submission status: Accepted

Solution code:
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    a,b,c = sorted(MII())
    cst = b-a + c-b
    print(cst)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

b = sorted(a)

print(abs(b[2]-b[1]) + abs(b[1]-b[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:
x, y, z = map(int,input().split())
l = []

l.append(abs(x-y))
l.append(abs(z-y))
l.append(abs(x-z))

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

Submission status: Accepted

Solution code:
import math
import collections
import sys
 
#input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
 
AS=LI()
AS=sorted(AS)
ans=AS[2]-AS[0]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

l = [a1, a2, a3]
l.sort()

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

Submission status: Accepted

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

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(a1-a3),abs(a3-a1)+abs(a1-a2),abs(a3-a2)+abs(a2-a1)))

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:
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=sorted(a)
x=0
for i in range(len(a)-1):
    x+=abs(a[i]-a[i+1])
print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import io
import math

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

Submission status: Accepted

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

print(abs(a-c))

Submission status: Accepted

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

A_max = max(A)
A_min = min(A)

print(A_max - A_min)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for ii in range(2):
  a=min(b)
  for i in range(len(b)):
    if min(b)==b[i]:
      del b[i]
      break
  b=[abs(x-a) for x in b]
  cost+=min(b)
print(cost)

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 = [int(x) for x in input().split()]

a.sort()
ans = 0

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

Submission status: Accepted

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

if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

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(a - c) + abs(c - b), abs(b - a) + abs(a - c), abs(b - c) + abs(c - a), abs(c - b) + abs(b - a), abs(c - a) + abs(a - b)))

Submission status: Accepted

Solution code:
a,b,c= input().split()
x,y,z=(int(a),int(b),int(c))
sample_list = [x,y,z]
abs_list = [abs(x-y),abs(x-z),abs(y-z)]
abs_max = max(abs_list)
abs_min = min(abs_list)
print(abs_max)

Submission status: Accepted

Solution code:
Alist = list(map(int,input().split()))
p = [0,0,0,0,0,0]
p[0] = abs(Alist[0] - Alist[1]) + abs(Alist[1] - Alist[2])
p[1] = abs(Alist[0] - Alist[2])+ abs(Alist[1] - Alist[2])
p[2] = abs(Alist[1] - Alist[2])+ abs(Alist[0] - Alist[2])
p[3] = abs(Alist[1] - Alist[0])+ abs(Alist[0] - Alist[2])
p[4] = abs(Alist[0] - Alist[2])+ abs(Alist[1] - Alist[0])
p[5] = abs(Alist[2] - Alist[1])+ abs(Alist[1] - Alist[0])
print(min(p))

Submission status: Accepted

Solution code:
import itertools

A = list(itertools.permutations(map(int, input().split())))
ans = 1000
for a in A:
  cost = 0 + abs(a[0]-a[1]) + abs(a[1]-a[2])
  ans = min(ans, cost)

print(ans)

Submission status: Accepted

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

# lines = list(map(int, "1 6 3".split()))
lines.sort()

cnt =0
for i in range(len(lines)):
    cnt += lines[2-i]

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

Submission status: Accepted

Solution code:
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  a = list(map(int, readline().split()))
  a.sort(reverse=True)
  ans = 0
  for i in range(len(a)-1):
    ans += a[i]-a[i+1]
  print(ans)
  
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
# ABC 103: A – Task Scheduling Problem
a = [int(s) for s in input().split()]
a.sort()
print(abs(a[2] - a[1]) + (abs(a[1] - a[0])))

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a = LI()
a.sort(reverse=1)
ans = a[0] - a[2]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
d = [abs(a-b),abs(b-c),abs(c-a)]
ans = 100000
for i in range(2):
    for j in range(i+1,3):
        ans = min(ans,d[i]+d[j])
print(ans)

Submission status: Accepted

Solution code:
import itertools
import fractions
def main():
  A = list(map(int,input().split()))
  A_ = sorted(A)
  dp = [0]*3
  dp[0] = 0
  for i in range(2):
    dp[i + 1] = dp[i] + (A_[i+1]-A_[i])
  print(dp[2])
if __name__ == '__main__':
  main()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Task(al):

    return max(al) - min(al)

def main():
    al = list(map(int , input().split()))
    print(Task(al))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

def main():
    print(a[-1] - a[0])

if __name__ ==  '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    a.sort()
    
    print(abs(a[0]-a[1])+abs(a[1]-a[2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a,b,c = iim()
ab = abs(a-b)
bc = abs(c-b)
ca = abs(a-c)
print(ab+bc+ca-max(ab,bc,ca))

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()
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)
 
if x + y <= y + z and x + y <= z + x:
	print(x + y )
elif y + z <= x + y and  y + z <= z + x:
	print(y + z )
else:
	print(z + x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
A = list(map(int, input().split()))
# print(A)
A.sort()
# print(A)
ans = abs(A[1] - A[0]) + abs(A[2] - A[1])
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:
a1, a2, a3 = map(int, input().split())
b = [abs(a1-a2), abs(a2-a3), abs(a3-a1)]
print(sum(sorted(b)[:2]))

Submission status: Accepted

Solution code:
k=list(map(int,input().split()))
k.sort() #デフォルトは昇順
print( abs(k[0]-k[1]) + abs(k[1]-k[2]))

Submission status: Accepted

Solution code:
import math

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

print(c-a)

Submission status: Accepted

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

A.sort()
ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


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


# Solve
if __name__ == "__main__":
    solve()

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:
from itertools import (
    accumulate,  # 累積和のイテレータ
    groupby,  # 値をkey,同じ値の集まりをgroup
    permutations,  # 順列
    combinations,  # 組み合わせ
    product,  # 重複あり順列（直積）
)
A = list(map(int, input().split()))

ans = float('inf')
for a1, a2, a3 in permutations(A, 3):
    tmp = abs(a2-a1)+abs(a3-a2)
    ans = min(ans, tmp)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = map(int, input().split())
A = sorted(A)
v1 = 0
for i in range(len(A) - 1):
    v1 += abs(A[i + 1] - A[i])
A = sorted(A, reverse=True)
v2 = 0
for i in range(len(A) - 1):
    v2 += abs(A[i + 1] - A[i])
ans = min(v1, v2)
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 = 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(max(A,B,C)-min(A,B,C))

Submission status: Accepted

Solution code:
A1,A2,A3 = map(int, input().split())
t1 = abs(A1-A2)
t2 = abs(A2-A3)
t3 = abs(A3-A1)

print(min((t1+t2),(t2+t3),(t3+t1)))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
Max = max(a, b, c)
Min = min(a, b, c)
Mid = a + b + c - Max - Min

d = abs(Max -Mid) + abs(Mid - Min)
e = abs(Mid - Min) + abs(Min - Max)
print(min(d, e))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

D = abs(A-B)
E = abs(A-C)
F = abs(B-C)

print(D+E+F-max(D,E,F))

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

Submission status: Accepted

Solution code:
def LI():
	return [ int(s) for s in input().split() ]
 
A = LI()
 
A12 = abs(A[0]-A[1])
A23 = abs(A[1]-A[2])
A31 = abs(A[2]-A[0])
 
print(min(A12+A23,A23+A31,A31+A12))

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

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=0

if a[0]==a[1]==a[2]:
  print(0)
else:
  ans=sorted(a)[-2]-min(a)
  ans+=max(a)-sorted(a)[-2]
  print(ans)

Submission status: Accepted

Solution code:
from itertools import permutations as per


def main():
    a1, a2, a3 = map(int, input().split())
    As = list(per([a1, a2, a3], 3))
    ans = float("inf")
    for A in As:
        ans = min(ans, abs(A[0] - A[1])+abs(A[1] - A[2]))

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y,z = sorted(map(int, input().split()))
print((y-x)+(z-y))

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

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

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

Solution code:
#abc103 a
a=list(map(int,input().split()))
a.sort()
ans=abs(a[0]-a[1])+abs(a[1]-a[2])
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 = list(map(int,input().split()))
a.sort()

d1 = a[0]-a[1];d2 = a[1]-a[2]

if d1 < 0:
    d1 = -d1
if d2 < 0:
    d2 = -d2
    
print(d1+d2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Wed Mar 11 15:25:13 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

a = na()
ans = inf
for i in range(3):
    b = i
    c = inf
    for j in range(3):
        if j != i:
            d = abs(a[i] - a[j])
            if c > d:
                c = d
                b = j
    ans = min(ans, c + abs(a[((i + 1) ^ (b + 1)) - 1] - a[b]))

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 = list(map(int,input().split()))
A.sort()
c = 0

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

print(c)

Submission status: Accepted

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

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:
import itertools
A=list(map(int,input().split()))
ans=6373532642
for l in itertools.permutations(A):
  ans=min(ans,abs(l[0]-l[1])+abs(l[1]-l[2]))
print(ans)

Submission status: Accepted

Solution code:
# A - Task Scheduling Problem
a1,a2,a3=list(map(int,input().split()))
b=[]
b.append(abs(a1-a2))
b.append(abs(a2-a3))
b.append(abs(a1-a3))
m=max(b)
b.remove(m)
print(sum(b))

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())
l = [abs(a-b), abs(b-c), abs(c-a)]
l.sort()
print(sum(l[:2]))

Submission status: Accepted

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

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

Submission status: Accepted

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

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-b + b-a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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()
ans = min(a[2]-a[0],(a[0]-a[2])*(-1))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os


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

    *a, = map(int, sys.stdin.readline().split())
    print(max(a) - min(a))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import os


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
anser_list = []
anser_list.append(abs(b-a) + abs(c-b))
anser_list.append(abs(c-a) + abs(b-c))
anser_list.append(abs(a-b) + abs(c-a))
anser_list.append(abs(c-b) + abs(a-c))
anser_list.append(abs(a-c) + abs(b-a))
anser_list.append(abs(b-c) + abs(a-b))

print(min(anser_list))

Submission status: Accepted

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

ans = []

ans.append(abs(x-y))
ans.append(abs(y-z))
ans.append(abs(x-z))

ans.sort()
ans.pop(-1)

print(sum(ans))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import permutations
from functools import reduce
l=list(map(int,input().split()))
permutations_list=list(permutations(l))
ans=900
for i in permutations_list:
  ss=0
  for j in range(1,len(i)):
    ss+=abs(i[j]-i[j-1])
  ans=min(ans,ss)
print(ans)

Submission status: Accepted

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

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

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

s = [0]*3
for i in range(1, 3):
    s[i] = a[i] - a[i-1]
    
print(sum(s))

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

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

Submission status: Accepted

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

#----------
A_list = list(map(int, input().rstrip().split()))
#----------

A_list.sort()

min_cost=A_list[-1]*A_list[-1]
for i,i_v in enumerate(A_list):
    A_list_i = A_list[:]
    del A_list_i[i]
    for j,j_v in  enumerate(A_list_i):
        A_list_j = A_list_i[:]
        del A_list_j[j]
        for k,k_v in  enumerate(A_list_j):
            cost = abs(j_v - i_v) + abs(k_v - j_v)
            if cost < min_cost:
                min_cost = cost

print(min_cost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S,M,L=sorted(map(int,input().split()))
print(L-S)

Submission status: Accepted

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

mn = min(A1, A2, A3)
mx = max(A1, A2, A3)
mi = A1 + A2 + A3 - mn -mx

result = abs(mn - mi) + abs(mi - mx)
print(result)

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