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:
import sys, re
from math import ceil, floor, sqrt, pi, factorial#, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    num_list = i_list()

    num_list.sort()

    min = 0
    for i in range(1,3):
        min += num_list[i] - num_list[i-1]

    print(min)
     

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from itertools import combinations

def resolve():
	seq = list(map(int, input().split()))
	ans = 0
	cos = []
	comb = combinations(seq, 2)
	for el in comb:
		cos.append(abs(el[0]-el[1]))
	print(sum(cos) - max(cos))
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = max(a) - min(a)
print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

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

Submission status: Accepted

Solution code:
# 1番目はコスト0
# 2番目は |A2 - A1|
# 3番目は |A3 - A2|
a,b,c = sorted(map(int, input().split()))
print(abs(b-a)+ abs(c-b))

Submission status: Accepted

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

a = map(int, input().split())
ans = 1000000000000000
for p in itertools.permutations(a):

    cost = 0
    for i in range(1, len(p)):
        cost += abs(p[i] - p[i - 1])
    if ans >= cost:
        ans = cost

print(ans)

Submission status: Accepted

Solution code:
a,b,c = (int(x) for x in input().split())

list = []
list.append(abs(a-b)+abs(b-c))
list.append(abs(a-c)+abs(c-b))
list.append(abs(b-a)+abs(a-c))
print(min(list))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

A = LI()
ans = INF
for x, y, z in permutations(A, 3):
    ans = min(ans, abs(y-x)+abs(z-y))
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    A = list(map(int,input().split()))
    ret = abs(A[0] - A[1]) + abs(A[1] - A[2]) + abs(A[2] - A[0])
    ans = INF
    for i in range(3):
        ans = min(ans,ret - abs(A[i] - A[(i+1)%3]))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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()))
maxa = max(A)
A.remove(maxa)
maxa2 = max(A)
cost = maxa - maxa2
A.remove(maxa2)
cost += maxa2 - A[0]
print(cost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
a, b, c = map(int, input().split())
V = itertools.permutations([a, b, c])
s = a+b+c
for v in V:
    S = abs(v[1]-v[0])+abs(v[2]-v[1])
    if S < s:
        s = S
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import fabs

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

def func(a,b,c):
    cost = 0
    cost += fabs(A_num[b]-A_num[a])
    cost += fabs(A_num[c]-A_num[b])

    return cost

print(int(min(func(0,1,2),func(0,2,1),func(1,0,2),func(1,2,0),func(2,0,1),func(2,1,0))))

Submission status: Accepted

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

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:
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 16:37:43 2020

@author: shinba
"""

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

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

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:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

A = inputIL()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def main():
    A = list(map(int, input().split()))
    B = []
    for i in range(3):
        for j in range(3):
            for k in range(3):
                if j != i and k != i and k != j:
                    val = abs(A[j] - A[i]) + abs(A[k] - A[j])
                    B.append(val)
    print(min(B))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import permutations

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

ans = sum(a_list)
for temp in list(permutations(a_list)):
    temp_ans = abs(temp[1] - temp[0]) + abs(temp[2] - temp[1])
    if temp_ans < ans:
        ans = temp_ans
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

    cost1 = 0 + abs(A2-A3) + abs(A3-A1)
    cost2 = 0 + abs(A2-A1) + abs(A3-A2)
    cost3 = abs(A1-A2) + 0 + abs(A3-A1)
    cost4 = abs(A1-A3) + 0 + abs(A3-A2)
    cost5 = abs(A1-A3) + abs(A2-A1) + 0
    cost6 = abs(A1-A2) + abs(A2-A3) + 0

    print(min(cost1,cost2,cost3,cost4,cost5,cost6))

if __name__ == '__main__':

    ABC_103_A()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
cost = 0
dif_1to2 = abs(A[0]-A[1])
dif_1to3 = abs(A[0]-A[2])
dif_2to3 = abs(A[1]-A[2])
dif = [dif_1to2,dif_1to3,dif_2to3]
print(sum(dif)-max(dif))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    cost_1 = abs(A[1] - A[0]) + abs(A[2] - A[1])
    cost_2 = abs(A[2] - A[0]) + abs(A[1] - A[2])
    cost_3 = abs(A[0] - A[1]) + abs(A[2] - A[0])
    cost_4 = abs(A[2] - A[1]) + abs(A[0] - A[2])
    cost_5 = abs(A[0] - A[2]) + abs(A[1] - A[0])
    cost_6 = abs(A[1] - A[2]) + abs(A[0] - A[1])

    ans = min(cost_1, cost_2, cost_3, cost_4, cost_5, cost_6)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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( A[2] - A[0] )

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import permutations 
a = [int(i) for i in input().split()]
p = permutations(a,3)
mn = 10**10
for i in p:
    cost = 0
    cost += abs(i[0]-i[1])
    cost += abs(i[1]-i[2])
    mn = min(mn,cost)
print(mn)

Submission status: Accepted

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

print( c - a)

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

A1, A2, A3 = sorted(map(int, input().split()))

print(A3-A1)

Submission status: Accepted

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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    a, b, c = mi()
    L = [a, b, c]
    L.sort()
    print(L[-1] - L[0])


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
a1 = abs(b-a)+abs(c-b)
a2 = abs(c-a) + abs(b-c)
b1 = abs(a-b) + abs(c-a)
b2 = abs(b-c) + abs(a-c)
c1 = abs(c-a) + abs(b-a)
c2 = abs(c-b) + abs(a-b)
print(min(a1,a2,b1,b2,c1,c2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans=max(a,b,c)-min(a,b,c)
print(str(ans)+"\n")

Submission status: Accepted

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

costs.sort()
diff = [(costs[i + 1] - costs[i]) for i in range(len(costs) - 1)]

ans = sum(diff)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

# https://atcoder.jp/contests/abc103
# 11:25-


def main():
    A = list(map(int, input().split()))
    tasks = [[0, 1, 2], [0, 2, 1], [1, 2, 0], [1, 0, 2], [2, 0, 1], [2, 1, 0]]

    ans = 10000000
    for task in tasks:
        cand = abs(A[task[1]]-A[task[0]]) + abs(A[task[2]]-A[task[1]])
        if cand < ans:
            ans = cand
    
    return ans


print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

a.sort()
cnt = 0

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

Submission status: Accepted

Solution code:
#template
def inputlist(): return [int(k) for k in input().split()]
#template
A = inputlist()
A.sort(reverse=True)
ans = 0
for i in range(1,3):
    ans += A[i-1]-A[i]
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

a = sorted([int(x) for x in stdin.readline().rstrip().split()])
print(abs(a[0] - a[1]) + abs(a[1] - a[2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

a = list(map(int, input().split()))
def task(b):
    return abs(b[1] - b[0]) + abs(b[2] - b[1])
a = np.array(a)
p = np.array([[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]) - 1
Min = np.inf
for i in range(6):
    Min = min(Min, task(a[p[i,:]]))
print(Min)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
A = list(map(int, input().split()))
print(max(A) - min(A))

Submission status: Accepted

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

ans = 0

a0 = min(a_list)
a_list.remove(a0)
a1 = min(a_list)
a_list.remove(a1)
ans += abs(a1 - a0)
a2 = min(a_list)
ans += abs(a2 - a1)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

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

p = list(itertools.permutations(range(3) ) )     

cst=sum(A)
for i in range(3):
  c=abs(A[p[i][1]]-A[p[i][0]])+abs(A[p[i][2]]-A[p[i][1]])
  if c<=cst:
    cst=c
print(cst)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cost = max(a) - min(a)
print(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:
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())
list = [a1,a2,a3]
list.sort()

x = list[0]
y = list[1]
z = list[2]

print(- x + z)

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

Submission status: Accepted

Solution code:
a,b,c = map(int, input().split())
ans1 = abs(a-b)+abs(b-c)
ans2 = abs(b-c)+abs(c-a)
ans3 = abs(c-a)+abs(a-b)

print(min(ans1, ans2, ans3))

Submission status: Accepted

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

Submission status: Accepted

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

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,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:
x = sorted(input().split(), reverse=True)
a = (int(x[0])-int(x[1])) + (int(x[1])-int(x[2]))
if a < 0:
  a = a*-1
print(a)

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:
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = [int(next(tokens)) for _ in range(3)]  # type: "List[int]"
    solve(A)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A = LIST()
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 accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A = LIST()
A.sort(reverse=True)
print(min(abs(A[0]-A[1])+abs(A[1]-A[2]), abs(A[0]-A[2])+abs(A[2]-A[1])))

Submission status: Accepted

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

Submission status: Accepted

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

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

sm = 0
num1 = A.pop(A.index(min(A)))
num2 = A.pop(A.index(min(A)))
num3 = A.pop(A.index(min(A)))

sm += abs(num2 - num1)
sm += abs(num3 - num2)

print(sm)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math
import functools

a = list(map(int,input().split()))
li = []
for i in range(len(a)):
    for j in range(i+1,len(a)):
        cost = abs(a[i]-a[j])
        li.append(cost)
li.sort()
li[-1] = 0
print(sum(li))

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

Submission status: Accepted

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

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:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    A, B, C = map(int, input().split())
    Task = sorted([A, B, C])
    print(Task[-1]-Task[0])
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a1, a2, a3 = map(int, input().split())
elem1 = abs(a2 - a1) + abs(a3 - a2) 
elem2 = abs(a3 - a1) + abs(a2 - a3)
elem3 = abs(a1 - a2) + abs(a3 - a1)
elem4 = abs(a3 - a2) + abs(a1 - a3)
elem5 = abs(a1 - a3) + abs(a2 - a1)
elem6 = abs(a2 - a3) + abs(a1 - a2)
lst = [elem1, elem2, elem3, elem4, elem5, elem6]

print(min(lst))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a1, a2, a3 = map(int, input().split())
ans = []
#1 2 3
mini = 0
mini += abs(a2-a1)
mini += abs(a3-a2)
ans.append(mini)

#1 3 2
mini = 0
mini += abs(a3-a1)
mini += abs(a2-a3)
ans.append(mini)

#2 1 3
mini = 0
mini += abs(a1-a2)
mini += abs(a3-a1)
ans.append(mini)

print(min(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

li_2 = [li[2] - li[1],li[1] - li[0]]

print(sum(li_2))

Submission status: Accepted

Solution code:
from itertools import permutations , combinations
a  = list(map(int , input().split()))
p = permutations(a,3)
ans = 999999999
for i in p:
    cost = 0
    for idx in range(1,3):
        cost += abs(i[idx] - i[idx-1])
    ans = min(cost , ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

    return
            



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()
ans = 0

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

print(ans)