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

Submission status: Accepted

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

Submission status: Accepted

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

cost = a_L[1]-a_L[0] + a_L[2]-a_L[1]
print(cost)

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())
x=abs(a-b)
y=abs(a-c)
z=abs(b-c)
print(x+y+z-max(x,y,z))

Submission status: Accepted

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

Submission status: Accepted

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

ans = [abs(a-b),abs(a-c),abs(b-c)]

ans.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import itertools

A = list(map(int, input().split()))
Diff = [abs(A[0]-A[1]),abs(A[1]-A[2]), abs(A[0]-A[2])]
print(sum(Diff)-max(Diff))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
l = input().split(' ')
A = []
for i in l:
  A.append(int(i))

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
def examA():
    A = LI()
    ans = max(A)-min(A)
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Submission status: Accepted

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

Submission status: Accepted

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

ans = 10**5
for i in range(3):
    for j in range(3):
        for k in range(3):
            if i != j and j != k and i != k:
                cost = abs(a[j] - a[i]) + abs(a[k] - a[j])
                if ans > cost:
                    ans = cost
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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:
# ABC103a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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(" ")))
minc=200 # 最小コスト

As=sorted(A) # 昇順に並び替える
print(abs(As[1]-As[0])+abs(As[2]-As[1]))

Submission status: Accepted

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

Submission status: Accepted

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


def solve(A: "List[int]"):
    As = sorted(A, reverse=True)
    ans = 0
    for i in range(len(As) - 1):
            ans += abs(As[i] - As[i + 1])
    print(ans)
# Generated by 1.1.6 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():
    A = list(map(int, input().split()))
    solve(A)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

#入力
#S = str(input())
A1, A2, A3 = map(int, input().split())
#N = int(input())

list = []
list.append(A1)
list.append(A2)
list.append(A3)
list.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

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 itertools as i

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

Submission status: Accepted

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

A = abs(N[0]-N[1])
B = abs(N[1]-N[2])

print(A+B)

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

one, two, three = abs(a-b), abs(b-c), abs(c-a)
X = [one, two, three]
X = sorted(X)
ans = X[0] + X[1]
print(ans)

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

Submission status: Accepted

Solution code:
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
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A1, A2, A3 = MAP()

a = sorted([A1, A2, A3])
ans = 0
for i in range(1, 3):
	ans += a[i]-a[i-1]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

diff = [0]*len(a)

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

ret = sum(diff)-max(diff)

print(ret)

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 math

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

Submission status: Accepted

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

sum = 0
for i, num in enumerate(A_list):
  if i == 0:
    continue
  cost = num - A_list[i-1]
  sum += cost
print(sum)

Submission status: Accepted

Solution code:
weight=[ w for w in list(map(int,input().split())) ]
list.sort(weight, reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

li = list(map(int,stdin.readline().rstrip().split()))

li.sort(reverse=True)

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

print(point)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A1,A2,A3 =(int(i) for i in input().split())

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

N = [x,y,z]
N.sort()
ans = N[0] + N[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,b,c=sorted(map(int,input().split()))
print(c-b+b-a)

Submission status: Accepted

Solution code:
l = [0]*3
l[0],l[1],l[2]=map(int,input().split())

l.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ls_cost = [abs(ls[0]-ls[1]), abs(ls[1]-ls[2]), abs(ls[2]-ls[0])]
ls_cost.sort()

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

Submission status: Accepted

Solution code:
#                         author:  kagemeka 
#                         created: 2019-11-08 15:54:47(JST)
### modules
## from standard library
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## from external libraries
# import scipy.special   # if use comb function on AtCoder, 
# import scipy.misc      # select scipy.misc.comb (old version)  

def main():
    *n, = (int(x) for x in sys.stdin.readline().split())
    n.sort()
    print(n[-1] - n[0])


if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Accepted

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

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

print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#abs-function
#A = [input().split() for i in range(2)]だめ
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 = list(map(int,input().split()))
A.sort()
print(A[2] - A[0])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
a,b,c=map(int,input().split())
ans=float('inf')
ans=min(ans,abs(c-b)+abs(b-a))
ans=min(ans,abs(b-c)+abs(c-a))
ans=min(ans,abs(c-a)+abs(a-b))
ans=min(ans,abs(a-c)+abs(c-b))
ans=min(ans,abs(b-a)+abs(a-c))
ans=min(ans,abs(a-b)+abs(b-c))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = list(map(int,input().split()))
Asub = [abs(A[i]-A[i+1]) if i != 2 else abs(A[i]-A[0]) for i in range(3)]
print(sum(Asub)-max(Asub))

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()
result = 0
for i in range(2):
    result += abs(a[i]-a[i+1])
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

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

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:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

answer = max(A) - min(A)
print(answer)

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

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

Submission status: Accepted

Solution code:
#103a
import itertools
a1,a2,a3 = map(int, input().split())

#任意の 1 個のタスクをコスト 0で完了できます。
#また、i番目のタスクを完了した直後にコスト |Aj−Ai| で j番目のタスクを完了できます。
#全てのタスクを完了するのに要する合計コストの最小値を求めてください。
seq = [a1,a2,a3]
ans = a1+a2+a3

for perm in list(itertools.permutations(seq)):
    cost = 0 + abs(perm[1]-perm[0]) + abs(perm[2]-perm[1])
    if cost < ans:
        ans = cost
        
print(ans)

Submission status: Accepted

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

ans = float("inf")
for a, b, c in permutations(l, 3):
    res = abs(b-a) + abs(c-b)
    ans = min(ans, res)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

abs_1=abs(n_sorted[0] - n_sorted[1])
abs_2 = abs(n_sorted[1]-n_sorted[2])
print(abs_1 + abs_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:
a=list(map(int,input().split()))
ans=max(a)-min(a)
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:
hoge = list(map(int, input().split()))

ans = 0
hoge.sort()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,C = (int(x) for x in input().split())
list = [A,B,C]
list.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

costs = [abs(A1 - A2), abs(A2 - A3), abs(A3 - A1)]
costs.sort()

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

Submission status: Accepted

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

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

if D>=E and D>=F:
  print(E+F)
elif E>=D and E>=F:
  print(D+F)
elif F>=D and F>=E:
  print(D+E)

Submission status: Accepted

Solution code:
*a,=map(int,input().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)
ca = abs(c-a)
print(ab+bc+ca-max(ab,bc,ca))

Submission status: Accepted

Solution code:
from itertools import permutations
A = list(map(int, input().split()))
ans = float('inf')
for p in permutations(A):
    ans = min(ans, abs(p[0]-p[1])+abs(p[1]-p[2]))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
if a >= b >= c:
  s1 = a
  s2 = b
  s3 = c
elif a >= c >= b:
  s1 = a
  s2 = c
  s3 = b
elif b >= a >= c:
  s1 = b
  s2 = a
  s3 = c
elif b >= c >= a:
  s1 = b
  s2 = c
  s3 = a
elif c >= a >= b:
  s1 = c
  s2 = a
  s3 = b
elif c >= b >= a:
  s1 = c
  s2 = b
  s3 = a

print(abs(s1-s2) + abs(s2-s3))

Submission status: Accepted

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

b = sorted(A)

c = b[2]-b[1] + b[1]-b[0]

print(c)

Submission status: Accepted

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

ans = float("inf")
for i in range(len(A)):
    for j in range(len(A)):
        for k in range(len(A)):
            if i == j or j == k or k == i:
                continue
            tmp = abs(A[j] - A[i]) + abs(A[k] - A[j])
            ans = min(ans, tmp)
print(ans)

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a = sorted(nl())

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

Submission status: Accepted

Solution code:
a = [int(_) for _ in input().split()]
a1 = abs(a[0]-a[1])
a2 = abs(a[1]-a[2])
a3 = abs(a[2]-a[0])
print((a1+a2+a3) - max(a1,a2,a3))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    A = [int(s) for s in input().split()]
    Cost_Ptn = []
    Zero2One = abs(A[0] - A[1])
    One2Two = abs(A[1] - A[2])
    Two2Zero = abs(A[2] - A[0])

    Cost_Ptn.append(Zero2One + One2Two)
    Cost_Ptn.append(Two2Zero + Zero2One)
    Cost_Ptn.append(Two2Zero + One2Two)

    reCost_Ptn = sorted(Cost_Ptn)
    print(reCost_Ptn[0])

if __name__ == "__main__":
    main()

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 = list(map(int, input().split()))
A_list = A_list + A_list # リストのインデックスが足りないから伸ばす

score_list = []
for i in range(3):
    score = 0
    score += abs(A_list[i] - A_list[i + 1]) +\
             abs(A_list[i + 1] - A_list[i + 2])
    score_list.append(score)

print(min(score_list))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    a = sorted(map(int, input().split()))
    print(sum(a[1:]) - sum(a[:2]))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
L = list(map(int, input().split()))
L.sort()
S = []
for i in range(1,3):
  S.append(L[i]-L[i-1])
print(sum(S))

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    a = list(map(int, input().rstrip('\n').split()))
    a.sort()
    t = 0
    for i in range(1, len(a)):
        t += abs(a[i] - a[i-1])
    print(t)


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(( A3 - A2 ) + ( A2 -A1 ))

Submission status: Accepted

Solution code:

def resolve():
  a, b, c = map(int, input().split())
  ans = 1000
  if ans > abs(b - a) + abs(c - b):
    ans = abs(b - a) + abs(c - b)

  if ans > abs(c - b) + abs(a - c):
    ans = abs(c - b) + abs(a - c)

  if ans > abs(a - c) + abs(b - a):
    ans = abs(a - c) + abs(b - a)

  print(ans)


if __name__ == "__main__":
  resolve()

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:
### 2019/09/26
a = map(int, input().split())
a = sorted(a)
print(0 + (a[1] - a[0]) + (a[2] - a[1]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a1,a2,a3 = input().split(" ")
a1 = int(a1)
a2 = int(a2)
a3 = int(a3)
l = [a1,a2,a3]
jl = []

for i in range(3):
  jl.append(abs(l[(i+1)%3]-l[i%3]) + abs(l[(i+1)%3]-l[(i+2)%3]))
  jl.append(abs(l[(i+2)%3]-l[i%3]) + abs(l[(i+1)%3]-l[(i+2)%3]))


print(min(jl))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(max(a_l)-min(a_l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A1,A2,A3=map(int,input().split())
A=[A1,A2,A3]
A.append(A1)
def A_(i):
    if A[i]-A[i+1]>=0:
        return A[i]-A[i+1]
    else:
        return A[i+1]-A[i]
B=[A_(i) for i in range(3)]
B.append(A_(0))
B.append(A_(1))
def sum(j):
    return B[j]+B[j+1]
C=[sum(j) for j in range(3)]
print(min(C))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a = list(map(int, input().split()))
cost = [abs(a[0]-a[1]), abs(a[1]-a[2]), abs(a[2]-a[0])]
print(sum(cost)-max(cost))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(c-a)