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: Wrong Answer

Solution code:
import sys

w1 = sys.stdin.readline().strip()
w2 = sys.stdin.readline().strip()

for i in range(len(w1)):
    if w1 == w2:
        print("Yes")
        exit(0)
    w1 = w1[1:] + w1[0]

print("No")

Submission status: Wrong Answer

Solution code:
lista = input().split()
print(int(max(lista)) - int(min(lista)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
task = input()
task = task.split()
costs = []
for i in range(len(task)):
    costs.append(int(task[i]))
task.sort()
cost = 0
for i in range(len(costs)-1):
    cost += costs[i+1]-costs[i]
    
print(cost)

Submission status: Wrong Answer

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

count=0
for i in range(1, len(array)):
    count += array[i] - array[i-1]
print(count)

Submission status: Wrong Answer

Solution code:
task = "1 6 3".split(" ")
task.sort()
result = int(task[2])-int(task[0])
if result < 0:
	result=result*-1
print(result)

Submission status: Wrong Answer

Solution code:
task = input().split()
task.sort()
score = int(task[2])  - int(task[0])
print(score)

Submission status: Wrong Answer

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

ans = min(abs(A-B)+abs(B-C), abs(A-C)+abs(C-B))
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

a_list = [int(a) for a in input().split()]

n_dic = defaultdict(lambda: 0)
for a in a_list:
    n_dic[a] += 1

if len(n_dic) == 3:
    aa_list = sorted(a_list)
    sumv = 0
    for i in range(1, len(aa_list)-1):
        sumv += abs(a_list[i] - a_list[i-1])
elif len(n_dic) == 2:
    minv = min(a_list)
    maxv = max(a_list)
    sumv = maxv - minv
else:
    sumv = 0

print(sumv)

Submission status: Wrong Answer

Solution code:
n = input().split(" ")
a = sorted([int(n[1]),int(n[0]),int(n[2])])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input().split(" ")

a = sorted([int(n[1]),int(n[0]),int(n[2])])

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

Submission status: Wrong Answer

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

print(min(abs(a[0]-a[1]), abs(a[1]-a[2])))

Submission status: Wrong Answer

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

b = sorted(list(set(a)))
if len(b) == 1:
    print(0)
elif len(b) == 2:
    print(int(b[0])-int(b[1]))
else:
    print(int(b[2]) - int(b[0]))

Submission status: Wrong Answer

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

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

An.sort()

print(An)

i = 0
Ai = An[0]
sum = 0
for j,Aj in enumerate(An):
    i = Aj - Ai
    sum += i
    Ai = Aj

print(sum)

Submission status: Wrong Answer

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

if abs(a[0]-a[1])<=abs(a[1]-a[2]):
    b=abs(a[1]-a[2])
else:
    b=abs(a[0]-a[1])
print(b)

Submission status: Wrong Answer

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

b = sorted(list(set(a)))
if len(b) == 1:
    print(0)
elif len(b) == 2:
    print(int(b[0])-int(b[1]))
else:
    print(int(b[2]) - int(b[0]))


print(b)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans1 = abs(a1 - a2) + abs(a2 - a3)
ans2 = abs(a1 - a3) + abs(a3 - a2)

print(min(ans1, ans2))

Submission status: Wrong Answer

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

print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A = list(map(int,input().strip().split(' ')))
import itertools
m = 2 ^ 23
for l in itertools.permutations(A):
    tmp = abs(l[1]-l[0]) + abs(l[2]-l[1])
    m = min(m,tmp)
print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a1, a2, a3 = list(map(int, input().split()))
v1 = abs(a1 - a2) + abs(a2 - a3)
v2 = abs(a1 - a3) + abs(a2 - a3)
if v1 < v2:
    print(v1)
else:
    print(v2)

Submission status: Wrong Answer

Solution code:
#coding:utf-8
a=[int(i) for i in input().split()]
count=0
for i in range(1,2):
  count+=a[i+1]-a[i]
print(count)

Submission status: Wrong Answer

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

out = 0

out += abs(b-a)+abs(c-b)

print(out)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(max(abs(a[0]-a[1]), abs(a[1]-a[2])))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    A = LI()
    A = sorted(A)
    ans = 0
    ans += A[1] - A[0] + A[2] - A[1]
    print(ans)

main()

Submission status: Accepted

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

Submission status: Accepted

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

min_n = min(a, b, c)
max_n = max(a, b, c)

cost_min = (max_n - min_n)
print(cost_min)

Submission status: Accepted

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

def get_input() -> list:
    """
    標準入力を取得する.

    Returns:\n
        list: 標準入力
    """
    A = list(map(int, input().split()))

    return A


def main(A: list) -> None:
    """
    メイン処理.

    Args:\n
        A (list): 整数列(1 <= A_i <= 100)
    """
    # 求解処理
    ans = max(A) - min(A)

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    A = get_input()

    # メイン処理
    main(A)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 標準入力を取得
A = list(map(int, input().split()))

# 求解処理
ans = max(A) - min(A)

# 結果出力
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
a=list(map(int, input().split()))
q=[]
for i in range(3):
  for j in range(3):
    if not i==j:
      q.append(abs(a[i]-a[j])+abs(a[j]-a[3-(i+j)]))
print(min(q))

Submission status: Accepted

Solution code:
import numpy as np
N_List = np.array(list(map(int,input().split())))
N_List_a = np.sort(N_List)
print(sum(N_List_a[1:]-N_List_a[:-1]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import itertools

# 標準入力を取得
A = list(map(int, input().split()))

# 求解処理
ans = sys.maxsize
for A_1, A_2, A_3 in itertools.permutations(A, r=3):
    ans = min(ans, abs(A_2 - A_1) + abs(A_3 - A_2))

# 結果出力
print(ans)

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:
#!/usr/bin/env python3

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def mapt(fn, *args):
    return list(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    a, b, c = Input()
    x, y, _ = sorted([abs(a-b), abs(b-c), abs(a-c)])
    print(x + y)


main()

Submission status: Accepted

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

li.sort()

n = (li[1] - li[0])+(li[2] - li[1])
print(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(max(s) - min(s))

Submission status: Accepted

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

print(max(s) - min(s))

Submission status: Accepted

Solution code:
al = list(map(int,input().split()))
s = []
for i in range(3):
  s.append(abs(al[-i]-al[1-i])+abs(al[1-i]-al[2-i]))
print(min(s))

Submission status: Accepted

Solution code:
import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

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

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

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

Submission status: Accepted

Solution code:
a=list(sorted(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:
#ABC103A
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()
ans =A[1]-A[0] +A[2]-A[1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
line = [[0, 1, 2], [0, 2, 1], [1, 0, 2], 
        [1, 2, 0], [2, 0, 1], [2, 1, 0]]
ans = sum(A)

for i in range(len(line)):
  tmp = 0
  for j in range(1,3):
    tmp += abs(A[line[i][j]] - A[line[i][j-1]])
  ans = min(ans, tmp)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
A.sort(reverse=True)
cur = A.pop(0)
ans = 0
for a in A:
    ans += (cur - a)
    cur = a

print(ans)

Submission status: Accepted

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

print(ret)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

list_int.sort()
min_num = min(list_int)
max_num = max(list_int)
mid_num = list_int.pop(1)

minimum_cost = abs(mid_num - min_num) + abs(max_num - mid_num)
print(minimum_cost)

Submission status: Accepted

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

min_num = min(list_int)
max_num = max(list_int)
mid_num = list_int.pop(1)

minimum_cost = abs(mid_num - min_num) + abs(max_num - mid_num)
print(minimum_cost)

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    A = LI()

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

per_ls = list(permutations(A))

ans = float("inf")
for (a,b,c) in per_ls:
  tmp = 0 + abs(a - b) + abs(b - c)
  ans = min(ans, tmp)
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

    print(min(d + e, e + f, f + d))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from itertools import permutations
A = list(map(int, input().split()))
p = permutations([0, 1, 2])
ans = 10**9
for pi in p:
    t0 = pi[0]
    t1 = pi[1]
    t2 = pi[2]
    tmp = abs(A[t1] - A[t0]) + abs(A[t2] - A[t1])
    ans = min(ans, tmp)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b,c=map(int, input().split())
#1ban
ans=abs(b-a)+abs(c-b)
ans2=abs(c-a)+abs(b-c)
if(ans2<ans):
    ans=ans2
#2ban
ans2=abs(a-b)+abs(c-a)
if(ans2<ans):
    ans=ans2
ans2=abs(c-b)+abs(a-c)
if(ans2<ans):
    ans=ans2
#3ban
ans2=abs(a-c)+abs(b-a)
if(ans2<ans):
    ans=ans2
ans2=abs(b-c)+abs(a-b)
if(ans2<ans):
    ans=ans2
print(ans)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    X = list(map(int, readline().split()))

    print(max(X) - min(X))


if __name__ == '__main__':
    main()

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

for i, a in enumerate(A123):
    for j, b in enumerate(A123):
        for k, c in enumerate(A123):
            if i != j and j != k and k != i:
                tmp = abs(b - a) + abs(c - b)
                if tmp < ans:
                    ans = tmp

print(ans)

Submission status: Accepted

Solution code:

S=list(map(int,input().split()))
S.sort()
sum=0
sum += (S[2]-S[0])
print(sum)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

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

L = sorted([x, y, z])

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

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()))
a.sort()
ans=0 if len(set(a))==1 else a[2]-a[0]
print(ans)

Submission status: Accepted

Solution code:
from itertools import permutations
res = float("inf")
for a, b, c in permutations(map(int, input().split()),3):
    res = min(abs(b-a) + abs(c-b),res)
print(res)

Submission status: Accepted

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

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

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

choice_lst = list(itertools.permutations(a_lst, 3))

cost_lst = []
for i in range(len(choice_lst)):
    cost = 0
    for j in range(3):
        tmp_cost = choice_lst[i][j]
        if j == 0:
            continue
        else:
            cost += abs(choice_lst[i][j] - choice_lst[i][j - 1])
    cost_lst.append(cost)

minimum = min(cost_lst)
print(minimum)

Submission status: Accepted

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

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

print(min(d1 + d2, d2 + d3, d3 + d1))

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())
i = abs(a - b)
j = abs(a - c)
k = abs(b - c)
lst = sorted([i, j, k])
print(lst[0] + lst[1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum(res)-max(res))

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()))
res = sum(a)
for i in itertools.permutations(a):
    a1, a2, a3 = i
    tmp = abs(a1 - a2) + abs(a2 - a3)
    res = min(res, tmp)
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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())
a = abs(A - B) + abs(B - C)
b = abs(B - C) + abs(C - A)
c = abs(C - A) + abs(A - B)
print(min(a,b,c))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
L = [int (x) for x in input().split()]
list.sort (L)
print ((L[2]-L[1])+(L[1]-L[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 = map(int, input().split())
d = abs(a-b)
e = abs(b-c)
f = abs(c-a)
print(min(d+e,e+f,f+d))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    A = sorted(nl())
    D = [A[i + 1] - A[i] for i in range(2)]
    print(sum(D))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
a = sorted(a)
ans = 0
for i in range(1, 3):
    ans += a[i]-a[i-1]
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:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A = list(map(int, readline().split()))
    A.sort()

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

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

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

c1 = abs(a-b)
c2 = abs(a-c)
c3 = abs(c-b)

print(c1+c2+c3-max(c1,c2,c3))

Submission status: Accepted

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

l = []

s = 0
s += abs(b - a)
s += abs(c - b)
l.append(s)

s = 0
s += abs(c - a)
s += abs(b - c)
l.append(s)

s = 0
s += abs(a - b)
s += abs(c - a)
l.append(s)

s = 0
s += abs(c - b)
s += abs(a - c)
l.append(s)

s = 0
s += abs(a - c)
s += abs(b - a)
l.append(s)

s = 0
s += abs(b - c)
s += abs(a - b)
l.append(s)

print(min(l))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a,b,c = sorted(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())
if (a1 <= a2 and a2 <= a3) or (a3 <= a2 and a2 <= a1):
    print(abs(a2 - a1) + abs(a3 - a2))
elif (a2 <= a1 and a1 <= a3) or (a3 <= a1 and a1 <= a2):
    print(abs(a1 - a2) + abs(a3 - a1))
else:
    print(abs(a3 - a1) + abs(a2 - a3))

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 = sorted(a,reverse = True)
print(abs(A[1]-A[0]) + abs(A[2] - A[1]))

Submission status: Accepted

Solution code:
n=list(map(int,input().split()));print(sum(sorted([abs(n[i]-n[j]) for i in range(3) for j in range(i+1,3)])[:2]))

Submission status: Accepted

Solution code:
ar = [int(i) for i in input().strip().split(" ")]
ar.sort()
s = 0
for i in range(1, len(ar)):
    s += (ar[i] - ar[i - 1])
print(s)

Submission status: Accepted

Solution code:
ar=[int(i) for i in input().strip().split(" ")]
ar.sort()
s=0
for i in range(1,len(ar)):
    s+=(ar[i]-ar[i-1])
print(s)

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, b, c=map(int, input().split())
saidai = max(a, b, c)
mini = min(a, b, c)

print(saidai - mini)

Submission status: Accepted

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

Submission status: Accepted

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

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

a.sort(reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
x = abs(b-a) + abs(c-b)
y = abs(c-a) + abs(b-c)
z = abs(a-b) + abs(c-a)
l = abs(c-b) + abs(a-c)
m = abs(a-c) + abs(b-a)
n = abs(b-c) + abs(a-b)
print(min(x, y, z, l, m, n))

Submission status: Accepted

Solution code:
a = [int(s) for s in input().split()]
max_id = a.index(max(a[0], a[1], a[2]))
min_id = a.index(min(a[0], a[1], a[2]))
sum = 0
sum += abs(a[0] - a[1])
sum += abs(a[1] - a[2])
sum += abs(a[2] - a[0])
sum -= abs(a[max_id] - a[min_id])
print(sum)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

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

print(ans)

Submission status: Accepted

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