TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
S = list(input())
T = list(input())
S.sort()
T.sort()
if S == T:
	print("Yes")
else:
	print("No")

a_l = [int(a_v) for a_v in input().split()]
a_l.sort()
print(abs(a_l[0]-a_l[1])+abs(a_l[1]-a_l[2]))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):

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

print(ans(a[3]-a[1]))



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

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c=map(int,input().split())
print(abs(a-b)+abs(b-c))

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A,B,C=map(int, input().split())
d = [0 0 0]
d[0] = abs(A-B)
d[1] = abs(A-C)
d[2] = abs(C-B)
d.sort()
print(d[0]+d[1])


A,B,C=map(int, input().split())
d = [0,0,0]
d[0] = abs(A-B)
d[1] = abs(A-C)
d[2] = abs(C-B)
d.sort()
print(d[0]+d[1])


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int,input()))
print(max(a)-min(a))

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A = list(input())
A.sort()
cost =0
for i in range(len(A)-1):
  cost += abs(A[i]+A[i+1])
print(cost)

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)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,M = map(int,input().split())
requests = []
for _ in range(M):
        a,b = map(int,input().split())
        requests.append([a,b])

ans = 1
requests = sorted(requests, key=lambda x:(x[1],x[0]))
b = min(requests, key=lambda x:x[1])[1]
for i in range(M):
        if requests[i][0] < b:
                continue
        else:
                ans += 1
                b = min(requests[i:], key=lambda x:x[1])[1]

print(ans)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
print(sum(list(map(int,input().split())))-N)

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

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

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int, input().split()))
count = 1000
num = 0


for i in a:
    for j in a:
        for k in a:
            num = abs(j-i)+abs(k-j)
            if count>num:
                count = num

print(num)

a = list(map(int, input().split()))
count = 1000
num = 0


for i in a:
    for j in a:
        for k in a:
            num = abs(j-i)+abs(k-j)
            if count>num:
                count = num

print(count)

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = [map(int,input().split())]
a.sort()
print(abs(a[0]-a[1])+abs(a[1]-a[2])

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
l=list(map(int,input().split()))
l.sort()
print(l[1]+abs(l[1]-l[2]))


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b, c = map(int,input().split())
A = []
A.append(a)
A.append(b)
A.append(c)
A.sort()
print(A)
print((A[1]-A[0])+(A[2]-A[1]))

a, b, c = map(int,input().split())
A = []
A.append(a)
A.append(b)
A.append(c)
A.sort()
print((A[1]-A[0])+(A[2]-A[1]))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A = list(map( int, input().split()))
A = sorted(A)

A1 = int(A[1]-A[0])
A2 = int(A[2]-A1)

print(A1+A2)



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

Verdicts: Wrong Answer

Accepted
Problem: 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.

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A = list(map(int, input().split()))
A.sort()

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

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

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

Verdicts: Runtime Error

Accepted
Problem: 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.

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

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-
A = map(int, input().split())
A = sorted(A)
print(A[1] - A[0] + A[2] - A[0])

# -*- coding: utf-8 -*-
A = map(int, input().split())
A = sorted(A)
print(A[1] - A[0] + A[2] - A[1])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = mlist(map(int,input().split()))
a.sort()
print(a[2] - a[0])

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
arr = map(int, input().split())
print(max(arr) - min(arr))

arr, =map(int, input().split())
print(max(arr) - min(arr))

arr = list(map(int, input().split()))
print(max(arr) - min(arr))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = [int(x) for x in input().split()]

a.sort(reverse=True)

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

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

a.sort(reverse=True)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int,input().split()))
s = sum(a)
ans = 1000
for i in range(3):
    for j in range(3):
        if i == j:
            continue
        b = abs(A[i]-A[j])+abs(A[j]-(a-(A[i]+A[j])))
        ans = min(ans,b)
print(ans)

A = list(map(int,input().split()))
s = sum(A)
ans = 1000
for i in range(3):
    for j in range(3):
        if i == j:
            continue
        b = abs(A[i]-A[j])+abs(A[j]-(s-(A[i]+A[j])))
        ans = min(ans,b)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
*a = map(int, input().split())
print(max(a) - min(a))

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
lst = list(map(int, input().split()))
sor = sorted(lst)
cost = 0
for i in range(len(sor)):
    if i == 0:
        continue
    else:
        cost = abs(sor[i]-sor[i-1])
print(cost)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
// B103.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//


#include <algorithm>

using namespace std;

int main()
{
	int a[3];
	cin >> a[2] >> a[1] >> a[0];
	sort(a, a + 3);
	cout << abs(a[0] - a[1]) + abs(a[1] - a[2]) << endl;

	return 0;
}


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

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c=map(int,input().split())
s=abs(a-b)+abs(b-c)+abs(c-a)
mn=max(abs(a-b)+abs(b-c)+abs(c-a))
print(s-mn)

a,b,c=map(int,input().split())
s=abs(a-b)+abs(b-c)+abs(c-a)
m=max(abs(a-b),abs(b-c),abs(c-a))
print(s-m)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c = map(int, input().split())
print(c-a)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from statistics import median

task=[0,0,0]

for i in range(3):
    a=input()
    task[i]=int(a)
    
b=median(task)
sum=0

for i in range(3):
    sum+=abs(b-task[i])
    
sum

from statistics import median

task=[int(i) for i in input().split()]
    
b=median(task)
sum=0

for i in range(3):
    sum+=abs(b-task[i])
    
sum

from statistics import median

task=[int(i) for i in input().split()]
    
b=median(task)
sum=0

for i in range(3):
    sum+=abs(b-task[i])
    
print(sum)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=0
bef=l[0]
for i in l:
  ans+=abs(bef-i)
print(ans)

l=list(map(int,input().split()))
l.sort(reverse=True)
ans=0
bef=l[0]
for i in l:
  ans+=abs(bef-i)
  bef=i
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A = [int(x) for x in input()split()]
A.sort()
print(A[2] - A[0])

A = [int(x) for x in input().split()]
A.sort()
print(A[2] - A[0])

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
*a = map(int, input().split())

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

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

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
inp = [input() for _ in range(2)]
s = inp[0]
t = inp[1]

s = list(s)
t = list(t)
check = []
for i in t:
    if i in s:
        s[s.index(i)] = 0
    check.append(0)

if s == check:
    print("Yes")
else:
    print("No")

task = input().split()
for i, j in enumerate(task):
    task[i] = int(j)
task.sort()
score = int(task[2])  - int(task[0])
print(score)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A = [ int(i) for i in input().split()]

X = [ abs(A[0] - A[1]),abs(A[1] - A[2]),abs(A[0] -A[2])]

X = X.sort()
ans = X[1] + X[2]
print(ans)

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)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
ns=list(map(int,input().split()))
ns.sort()
print(ns[2]-ns[1])


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int, input().split()))
a.sort
print(a[2]-a[0])

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b, c = map(int, input().split())

if a > max(b, c):
    print(a - max(b,c))
elif a < max(b, c):
    print(max(b, c))


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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A=[int(i) for i ininput().split()]
A.sort()
print(A[2]-A[0])

A=[int(i) for i input().split()]
A.sort()
print(A[2]-A[0])

A=[int(i) for i in input().split()]
A.sort()
print(A[2]-A[0])

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# -*- 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)


# -*- coding: utf-8 -*-

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

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

print(sum)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# coding: utf-8
n = input()
list = n.split(" ")
max = 0;
min = 0;
for x in list:
    x = int(x)
    if x > max:
        max = x
    elif x < min:
        min = x
    
print(max - min)

# coding: utf-8
n = input()
list = n.split(" ")
num = [int(x) for x in list ]

print(num.max - num.min)
    

# coding: utf-8
n = input()
list = n.split(" ")
num = [int(x) for x in list ]

print(max(num)-min(num))
    

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A = list(map(int(), input().split()))
print(max(A)-min(A))

A = list(map(int, input().split()))
print(max(A)-min(A))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a1, a2, a3 = map(int,input().split())
print(min(abs(a1 - a2), abs(a2 - a3), abs(a3 - a1)))

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#!/usr/bin/env python3
import sys


def solve(A: "List[int]"):
    print(abs(A[0] - A[1] + abs(A[1] - A[2]))
    return


# Generated by 1.1.4 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():
    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()


#!/usr/bin/env python3
import sys
 
 
def solve(A: "List[int]"):
    print(abs(A[0] - A[1]) + abs(A[1] - A[2]))
    return
 
 
# Generated by 1.1.4 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():
    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()

#!/usr/bin/env python3
import sys


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


# Generated by 1.1.4 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():
    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()


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int, input().split()))
a = sorted(a)
print(abs(a[3] - a[1]))

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a=list(map(int,input().split()));a.sort()
print(a[2]-a[1]*2-a[0])

a=list(map(int,input().split()));a.sort()
print(max(a[2]-a[1]*2-a[0],0))

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a,b,c = map(int,input().split())

out = 0

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

print(out)

l = list(map(int, input().split()))
l.sort()
out = 0

out += abs(l[1] - l[0]) + abs(l[2] - l[1])

print(out)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
list=[int(i) for i in input().split()]
list.sort()
print(list[2]-list[1])


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

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

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

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

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

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

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

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

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

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)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A = map(int, input().split())
print(max(A)-min(A))

A = list(map(int, input().split()))
print(max(A)-min(A))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a=list(map(int,input().split()))
b=a.sorted
print(b[1]-b[0]+b[2]-b[1])

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
*a = map(int, input().split())
print(max(a) - min(a))

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

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

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int, input().split()))
a.sort()
print(0+abs(a[2]-a[1])+abs(a[3]-a[2]))

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A = list(map(int, input().split()))
A.sort()
ans = abs(A[2]+A[1])+abs(A[1]+A[0])
print(ans)

S = list(input())
S.sort()
if S[0] == "a" and S[1] == "b" and S[2] == "c":
    print("Yes")
else:
    print("No")

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


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
*a=map(int,input().split())
print(max(a)-max(b))

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys

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

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

if __name__ == '__main__':
    ans = main()
    print(ans)

import sys

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

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

if __name__ ==  '__main__':
    main()

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
input_x = str(input())
input_y = str(input())
tmp = input_y
ary = list(input_y)
mongon = "Yes"
for c in input_x:
    idx = tmp.find(c)
    if idx == -1:
        mongon = "No"
        break
    else:
        ary.pop(idx)
        tmp = "".join(ary)


print(mongon)


input_s = str(input())
ary = input_s.split(" ")
ary.sort()
task = 0
tmp1 = 0
tmp2 = 0
for i in ary:
    if tmp1 == 0:
        tmp1 = int(i)
    else:
        tmp2 = int(i)
        if tmp1 < tmp2:
            task += tmp2 - tmp1
        else:
            task += tmp1 - tmp2
        tmp1 = tmp2
print(task)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
def main():
    task_str = input().split()
    print(task_str)
    task_list = []
    task_list = [int(s, 10) for s in task_str]
    task_list.sort()
    print(task_list)
    result = task_list[2] - task_list[0]
    print(result)

if __name__=='__main__':
    main()

def main():
    task_str = input().split()
    print(task_str)
    task_list = []
    task_list = [int(s, 10) for s in task_str]
    task_list.sort()
    print(task_list)
    result = int(task_list[2]) - int(task_list[0])
    print(result)

if __name__=='__main__':
    main()

def main():
    task_str = input().split()
    task_list = []
    task_list = [int(s, 10) for s in task_str]
    task_list.sort()
    result = task_list[2] - task_list[0]
    print(result)

if __name__=='__main__':
    main()

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int, input().split()))
a.sort()
print(a[1] - a[0])

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
p,q,r=map(int,input().split())
print(max([abs(p-q)+abs(q-r),abs(q-r)+abs(r-p),abs(p-q)+abs(p-r)]))

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
参りました

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)



temp = sorted(map(int, input().split()))
a=temp[0]
b=temp[1]
c=temp[2]

if a==b==c:
    print(0)
elif a==b!=c: 
    print(abs(a-b))
elif a!=b==c :
    print(abs(c-a))
elif a==c!=b:
    print(abs(a-b))
elif abs(a-b)<=abs(b-c):
    print(abs(b-c))
else:
    print(abs(a-b))
    


temp = sorted(map(int, input().split()))
a=temp[0]
b=temp[1]
c=temp[2]

if a==b==c:
    print(0)
elif a==b!=c: 
    print(abs(a-c))
elif a!=b==c :
    print(abs(c-a))
elif a==c!=b:
    print(abs(a-b))
elif abs(a-b)<=abs(b-c):
    print(abs(b-c))
else:
    print(abs(a-b))
    


#103a
a=list(map(int,input().split()))
print(max(a)-min(a))

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a, b, c = map(int, input().split())
print(c-a)


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int, input().split()))
print(max(a))
print(min(a))
ans = (int(max(a))) - (int(min(a)))
print(ans)


a = list(map(int, input().split()))
ans = (int(max(a))) - (int(min(a)))
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = input(int()).split()
sort_a = sorted(a)
ans = int(sort_a[-1])-int(sort_a[0])
print(ans)

a = input(int()).split()
sort_a = sorted(a)
ans = sort_a[-1]-sort_a[0]

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = sorted(list(map(int,input()split())))
print(a[2] - a[0])

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A,B,C=map(int,input().split())
print(max(A,B,C)-min(A,B,C)

A,B,C=map(int,input().split())
print(max(A,B,C)-min(A,B,C))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s = "11 5 5"
list = list(map(int, input().split()))

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


s = "11 5 5"
list = list(map(int, s.split()))

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


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

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

s = "11 5 5"
list = list(map(int, input().split()))

a = abs(list[1]-list[0])
b = abs(list[1]-list[2])
c = abs(list[2]-list[0])
l = a+b
m = b + c
n = a+c
if (l < m):
	if (l < n)
		print(l)
	else :
		print(n)
else :
	if (m < n)
		print(m)
	else :
		print(n)


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

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# coding: utf-8
A = sorted(list(map(int, input().split())))
print(A[2] - A[1] - A[0])

# coding: utf-8
A = sorted(list(map(int, input().split())))
print(A[2] - A[0])


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
A=input().split().sort()
print(A)


A=map(int,input().split())
A=list(A)
print(max(A)-min(A))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)


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

b = sorted(map(int, list(set(a))))

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a , b , c = map(int,input().split())
print(min(abs(a-b)+abs(b-c),abs(b-a)+abs(a-c),abs(a-c)+abs(c-b))

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
t = input()
cnt = 1
for _ in range(len(s)):
    a = s[len(s)-1]
    b = [s[i] for i in range(len(s)-1)]
    bb = "".join(b)
    s = a+bb
    if s == t:
        cnt *= 0

print("No") if cnt else print("Yes")

s = input()
t = input()
for _ in range(len(s)):
    s = s[len(s)-1]+"".join([s[i] for i in range(len(s)-1)])
    if s == t:
        print("Yes")
        exit()
        
print("No")

s = input()
t = input()
for _ in range(len(s)):
    a = s[len(s)-1]
    b = [s[i] for i in range(len(s)-1)]
    bb = "".join(b)
    s = a+bb
    if s == t:
        print("Yes")
        exit()
print("No")

data = sorted(list(map(int, input().split())))

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
lines = map(int, input().split())
lines.sort()

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

print(cnt)



lines = map(int, input().split())


lines.sort()

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

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



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


lines.sort()

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

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



Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
A = sorted(map(int, input().split()))

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


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

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

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

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

print(cost)

Verdicts: Runtime Error

Runtime Error

Accepted