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):
list=input()
list_n=[int(s) for s in list]
print(max(list_n)-min(list_n))

list=input()
list_n=[int(s) for s in list]
print(int(max(list_n))-int(min(list_n)))

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

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):
l = sorted([int(x) for x in input().split()])
print(min(l[2] - l[1] - l[0], l[2] - (l[1] - l[0])))

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)


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
answer = 0
for i in range(2):
    answer += A[i + 1] - A[i]

print(answer)


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

print(answer)


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=int(input())
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):
import fractions

N = int(input())
A = [int(n) for n in input().split()]

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

l = 1
for a in A:
  l = lcm(a, l)
B = [(l - 1) % a for a in A]
print(sum(B))

a = sorted([int(n) for n in input().split()])
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):
A1,A2,A3=map(int,input().split())

print(abs(A1-A2)+abs(A2-A3)+abs(A3-A1)-max(A1-A2,A2-A3,A3-A1))

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

if abs(A1-A2)==abs(A2-A3):
    print(abs(A1-A2)+abs(A2-A3)+abs(A3-A1)-abs(A1-A2))
elif abs(A2-A3)==abs(A3-A1):
    print(abs(A1-A2)+abs(A2-A3)+abs(A3-A1)-abs(A2-A3))
elif abs(A3-A1)==abs(A1-A2):
    print(abs(A1-A2)+abs(A2-A3)+abs(A3-A1)-abs(A3-A1))
else :
    print(abs(A1-A2)+abs(A2-A3)+abs(A3-A1)-max(A1-A2,A2-A3,A3-A1))

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

print(abs(A1-A2)+abs(A2-A3)+abs(A3-A1)-max(abs(A1-A2),abs(A2-A3),abs(A3-A1)))

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):
import math
n = int(input())
a = list(map(int, input().split()))

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

def lcm_list(numbers):
    a_0 = numbers.pop()
    for i in numbers:
        a_0 = lcm_base(a_0, i)
    return a_0

b = a.copy()
m = lcm_list(b)-1
sum = 0
for j in a:
    sum += m%j

print(sum)

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

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()))
l = [[0,1],[1,2],[0,3]
ll = []
for i,j in l:
	ll.append(abs(A[i]-A[j]))
print(min(ll))

A = list(map(int, input().split()))
l = [[0,1],[1,2],[0,3]
ll
for i,j in l:
	ll.append(abs(A[i]-A[j]))
print(min(ll))

A = list(map(int, input().split()))
l = []
for i in range(3):
	for j in range(-3, 0):
		l.append(abs(A[i]-A[j]))
print(min(l))

A = list(map(int, input().split()))
b = [[0, 1], [2, 1], [2, 0]]
l = 0
n = []
for i, j in b:
    l = l + abs(A[j]-A[i])
    n.append(abs(A[j]-A[i]))
l = l - max(n)
print(l)


Verdicts: Runtime Error

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):
li = [map(int, input().split())]
sli = sorted(li)

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

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

print((sli[1] - sli[0]) + (sli[2] - sli[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,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(M)]
AB.sort()

ans=0
while AB:
  a=AB[-1][0]
  AB=list(filter(lambda x:x[1]<=a,AB))
  ans+=1
  
print(ans)

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

a.sort()
b=[a[2]-a[1],a[1]-a[0],a[2]-a[0]]

print(b)

print(sum(b)-max(b))

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

a.sort()
b=[a[2]-a[1],a[1]-a[0],a[2]-a[0]]

print(b)

print(sum(b)-max(b))

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

a.sort()
b=[a[2]-a[1],a[1]-a[0],a[2]-a[0]]


print(sum(b)-max(b))

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

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

A = [int(i) for i in 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()))
A.sort()
m=abs(A1-A2)
n=abs(A2-A3)
print(m+n)

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

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();print(sum(int(a)-1for i in input().split()))

n,m=map(int,input().split());x=y=0
for(a,b)in sorted([list(map(int,input().split()))for i in range(m)],key=lambda x:x[1]):
 if a>x:
  x=b-1
  y+=1
print(y)

a,b,c=sorted(map(int,input().split()));print(c-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):
s=list(map(int,input())
s=s.sort()
print(s[1]-s[0])


s=list(int(input()))
s=s.sorted()
print(s[1]-s[0])

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


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


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


Verdicts: Runtime Error

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):
a1, a2, a3 = [int(x) for x in input().split()]
print(min(a1, a2, a3))

a1, a2, a3 = [int(x) for x in input().split()]
print(a3-a1)

a1, a2, a3 = [int(x) for x in input().split()]
a1, a2, a3 = sorted([a1, a2, a3])
print(a3-a1)

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()))
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):
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

l = list(map(int, input().split()))
print(sum(l)-max(l))


from functools import reduce
n = (int)(input())
a = (list)(map(int, input().split()))


def calcMod(a, m):
  return sum([m % v for v in a])


def mul(a, b):
  return a*b


#print(calcMod(a, reduce(mul, a)-1))
print(sum(a)-n)


# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

l = list(map(int, input().split()))
print(3*max(l)-sum(l))


# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

l = sorted(l, reverse=True)
print(sum(a-b for a, b in zip(l, l[1:])))


Verdicts: Wrong Answer

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

def B():
    s1 = input()
    s2 = input()
    
    YES = 'Yes'
    NO = 'No'
    
    result = NO
    for i in range(len(s1)):
        p = s1[i:] + s1[:i]
        if(p in s2):
            result = YES
    
    print(result)

if __name__ =='__main__':
    B()

def A():
    a = input().split()
    try:
        for x in a:
            x = int(x)
    except:
        exit(1)
    a.sort()
    a.inverse()
    
    a_i = a[0]
    sum = 0
    for x in a[1:]:
        sum += abs(a_i - x)
        a_i = x 
    
    print(sum)


if __name__ =='__main__':
    A()


def A():
    s = input().split()
    a = [int(n) for n in s]
    a.sort()
    a.reverse()
    
    a_i = a[0]
    sum = 0
    for x in a[1:]:
        sum += abs(a_i - x)
        a_i = x 
    
    print(sum)

if __name__ =='__main__':
    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):
from fractions import gcd

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

lcm = a[0]
for i in a:
    lcm = lcm * i // gcd(lcm, i)
ans = 0
for i in a:
    ans += (lcm-1) % i
print(ans)


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):
# A - Task Scheduling Problem
*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):
a = map(int,raw_input().split())
a.reverse()
for i in range(len(a)):
  if i == 0:
    res = 0
  else :
    res += a[i]-a[i-1]
print(res)

a = map(int,raw_input().split())
a.reverse()
for i in range(len(a)):
  if i == 0:
    res = 0
  else :
    res += a[i-1]-a[i]
print(res)

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

a = map(int,raw_input().split())
a.reverse()
for i in range(len(a)):
  if == 0:
    res = 0
  else :
    res += a[i]-a[i-1]
print(res)

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

Verdicts: Runtime Error

Runtime Error

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 = 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):
from itertools import permutations

a1, a2, a3 = map(int, input().split())
ans = 1e9
for a in permutations([a1, a2, a3]):
    print(a)
    tmp = abs(a[0] - a[1]) + abs(a[1] - a[2])
    ans = min(ans, tmp)
print(ans)


from itertools import permutations

a1, a2, a3 = map(int, input().split())
ans = 1e9
for a in permutations([a1, a2, a3]):
    tmp = abs(a[0] - a[1]) + abs(a[1] - a[2])
    ans = min(ans, tmp)
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=list(map(int, input().split()))
a.sort(reverse=True)
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):
# your code goes here
import numpy as np
l = input().split()
lnp = np.zeros(len(l))
for i in range(len(l)):
	lnp[i] = int(l[i])
lnp = np.sort(lnp)
print(lnp[-1]-lnp[0])

# your code goes here
import numpy as np
l = input().split()
lnp = np.zeros(len(l))
for i in range(len(l)):
	lnp[i] = int(l[i])
lnp = np.sort(lnp)
print(int(lnp[-1]-lnp[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):
from sys import stdin
import fractions

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]

lcm_a = int(A[0] * A[1] / fractions.gcd(A[0], A[1]))

if len(A) > 2:
    for k in A[2:]:
        lcm_a = int(lcm_a * k / fractions.gcd(lcm_a, k))

modulo_sum = 0

for k in A:
    modulo_sum += (lcm_a - 1) % k

print(modulo_sum)

from sys import stdin

A = [int(x) for x in stdin.readline().rstrip().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,b,c=sorted(map(int,input().split())
print(c-a)

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

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

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

if int(a[0])<=int(a[1]) and int(a[0])<=int(a[2]):
  min = a[0]
  if int(a[1])<=int(a[2]):
    max = int(a[2])
  else:
    max = int(a[1])
elif int(a[1])<=int(a[2]) and int(a[1])<=int(a[0]):
  min = a[1]
  if int(a[0])<=int(a[2]):
    max = int(a[2])
  ele:
    max = int(a[0])
else:
  min = a[2]
  if int(a[0])<=int(a[1]):
    max = int(a[1])
  ele:
    max = int(a[0])

print(max-min)

a = input().split()

if int(a[0])<=int(a[1]) and int(a[0])<=int(a[2]):
  min = int(a[0])
  if int(a[1])<=int(a[2]):
    max = int(a[2])
  else:
    max = int(a[1])
elif int(a[1])<=int(a[2]) and int(a[1])<=int(a[0]):
  min = int(a[1])
  if int(a[0])<=int(a[2]):
    max = int(a[2])
  else:
    max = int(a[0])
else:
  min = int(a[2])
  if int(a[0])<=int(a[1]):
    max = int(a[1])
  else:
    max = int(a[0])

print(max-min)

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):
r=sorted(map(int,input().split()))[-1]

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

r=sorted(map(int,input().split()))[::-1]

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

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


S=input().split()
A=sorted(S)
print(int(S[2])-int(S[0]))

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

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

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):
import math
a = list(map(int, input().split(" ")))

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

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


min_ = 99999999999999999

for i in range(3):
    for j in range(3):
        sum_ = None
        for k in range(3):
            if i != j != k and i != k:
                sum_ = abs(a[i]-a[j]) + abs(a[j]-a[k])

        if sum_ is not None:
	        min_ = min(min_, sum_)

print(min_)

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

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

a =list(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):
import numpy as np

b = 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)


# ABC103A

import numpy as np

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


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)


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

cost = 0
for a, b in zip(As[:-1], As[1:]):
  cost = abs(a-b)
  
cost -= As[0]
print(cost)

As = sorted(list(map(int, input().split())), reverse=True)

cost = 0
for a, b in zip(As[:-1], As[1:]):
  cost += abs(a-b)

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):
a1,a2,a3=map(int,input().split())
k=[a1,a2,a3]
print( abs(max(k)-max(k)[1]) + abs(max(k)[1]-max(k)[2]))

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

a1,a2,a3=map(int,input().split())
k=sorted[a1,a2,a3]
print( abs(k[2]-k[1]) + abs(k[1]-k[2]))

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

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

Verdicts: Runtime Error

Runtime Error

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):
s = str(input())
t = str(input())
 
if s == t:
    print("Yes")
else:
    print("No")


import math
a = int(input())
b = int(input())
c = int(input())

lst = []
lst.append(a)
lst.append(b)
lst.append(c)
lst.sort()

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

s = str(input())
t = str(input())


s = str(input())
t = str(input())
s =  ''.join(sorted(s))
t = ''.join(sorted(t))

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

s = input()
t = input()
s =  ''.join(sorted(s))
t = ''.join(sorted(t))

print(s)
print(t)
if s == t:
    print("yes")
else:
    print("no")

s,t = map(str,input().split())
s =  ''.join(sorted(s))
t = ''.join(sorted(t))
 
print(s)
print(t)
if s == t:
    print("yes")
else:
    print("no")


import math

a,b,c = map(int,input().split())
lst = []
lst.append(a)
lst.append(b)
lst.append(c)
lst.sort()

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


Verdicts: Runtime Error

Runtime Error

Runtime Error

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):
S = [i for i in input()]
T = [j for j in input()] 

x = sorted(S)
y = sorted(T)
k = None

if x == y:
  for i in range(len(S)):
    O = S.copy()
    S.pop()
    S.insert(0,O[-1])
    if S == T:
      print("Yes")
      break
  else:
    print("NO")
else:
  print("No")



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

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

a,b,c=sorted(map(int,input().split()))
print(c-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):
N = int(input())
L = [int(i) for i in input().split()]
print(sum(L - N) )

L = list(map(int,input().split()))
ans = 0
min_L = min(L)
L.remove(min_L)
cnt = min_L
sorted_L = sorted(L)
for i in sorted_L:
    ans += abs(i - cnt )
    cnt = i
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 = int(input())
a = list(map(int,input().split()))
print(sum(a)-n)


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

a.sort()

print((a[2]-a[1])+(a[1]-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):
from sys import stderr
from functools import reduce
from operator import add
def f(): return [int(i) for i in input().split()]
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(repr(item))
        stderr.write(sep)
    stderr.write(end)

a1,a2,a3 = f()

a = abs(a1-a2)
b = abs(a2-a3)
c = abs(a3-a1)
print(min(a,b,c))

from sys import stderr
from functools import reduce
from operator import add
def f(): return [int(i) for i in input().split()]
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(repr(item))
        stderr.write(sep)
    stderr.write(end)

a1,a2,a3 = f()

a = abs(a1-a2)
b = abs(a2-a3)
c = abs(a3-a1)
print(min(a+b,b+c,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):
task=list(map(int,intput().split()))
task.sort()
cost=0
for i in range(1,3):
    cost+=task[i]-task[i-1]

print(cost)


task=list(map(int,input().split()))
print(sorted(task)[2]-sorted(task)[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(min(abs(b-a)+abs(c-b),abs(c-a)+abs(b-c),abs(a-b)+abs(c-a),abs(c-b)+abs(a-c),abs(a-c)+abs(b-a),abc(b-c)+abs(a-b)))

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

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

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

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

print(x.max() - x.min())

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

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())
tasks=[A1,A2,A3]
costs=[]
def cost(start):
    for i in range(3):
        if i!=start:
            cost_1st=abs(tasks[i]-tasks[start])
            for l in range(3):
                if l != i and l != start:
                    total_cost=cost_1st+abs(tasks[i]-tasks[l])
                    costs.append(total_cost)
                else:
                    continue
        else:
            continue
for i in range(3):
    cost(i)
print(costs)
ans=min(costs)

print(ans)


[A1,A2,A3]=map(int,input().split())
tasks=[A1,A2,A3]
costs=[]
def cost(start):
    for i in range(3):
        if i!=start:
            cost_1st=abs(tasks[i]-tasks[start])
            for l in range(3):
                if l != i and l != start:
                    total_cost=cost_1st+abs(tasks[i]-tasks[l])
                    costs.append(total_cost)
                else:
                    continue
        else:
            continue
for i in range(3):
    cost(i)

ans=min(costs)

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()
b=input()
for i in range(0,len(a)):
  if a==b[i:]+b[:i] : 
    print("Yes")
    exit(0)
print("No")

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

lis=[int(i) for i in input().split()]
print(max(lis)-min(lis))

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 = list(map(int, input().split()))
s = sorted(a).reverse
ans = [s[i+1]-s[i] for i in range(2)]
print(sum(ans))

a = list(map(int, input().split()))
s = sorted(a, reverse=True)
ans = [s[i]-s[i+1] for i in range(2)]
print(sum(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):
L = list(map(int, raw_input().split()))
MAX=max(L)
MIN=min(L)
print(MAX-MIN)

L = list(map(int, input().split()))
MAX=max(L)
MIN=min(L)
print(MAX-MIN)

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


L = sorted(map(int, input().split()))
ans = max(L) - min(L)
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):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

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

def f(m, input):
  r = 0
  for i in input:
    r += m % i
  return r

N = map(int, input())
a_n = list(map(int, input().split(" ")))
a_n = sorted(a_n)

max = 0
for x in a_n:
  max += x
 
# result = []
# for m in range(max):
  # out = f(m, a_n)
  # result.append(out)

#print(re[-1])
#print(max) #994 518 941 851 647 2 581 -> 4534
print(max - len(a_n))

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

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

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


a,b,c = map(int,input().split())
l=sorted([a,b,c])
print(l[2]-l[1]+l[1]-l[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):
#103
A =[int(j) for j in input().split()]
print(abs(A[2]-A[0]))

#103
A =[int(j) for j in input().split()]
A.sort()
print(abs(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):
def Task(al):

    al.sort

    return (al[-1] - al[-2]) + (al[-2] - al[0])

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

if __name__ == '__main__':
    main()

def Task(al):

    return max(al) - min(al)

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

if __name__ == '__main__':
    main()

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):
class Need(object):
    def __init__(self,arg1,arg2):
        self.island1=int(arg1)
        self.island2=int(arg2)
        self.bridge=[]
        for i in range(arg1,arg2):
            self.bridge.append(i)
    def GETbridge(self):
        return self.bridge
deadbridges=0
islands,needsnum=map(int,input().split())
bridge=[0 for _ in range(islands-1)]
box = []
for i in range(needsnum):
    arg1,arg2=map(int,input().split())
    box.append(Need(arg1,arg2))

while(len(box)!=1):
    bridge = [0 for _ in range(islands - 1)]
    for need in box:
        list=need.GETbridge()
        for ing in list:
            bridge[ing-1]=bridge[ing-1]+1
    
    maxi=0
    for i in range(len(bridge)):
        if(bridge[i]>bridge[maxi]):
            maxi=i
    
    deadbridges=deadbridges+1
    
    kill=False
    for i in range(len(box)):
        try:
            s=box[i].GETbridge()
        except:
            break
        for k in s:
            if(k==bridge[maxi]):
                kill=True
                break
        if(kill):
            box.pop(i)
            i=i-1
print(deadbridges)

class Need(object):
    def __init__(self,arg1,arg2):
        self.island1=int(arg1)
        self.island2=int(arg2)
        self.bridge=[]
        for i in range(arg1,arg2):
            self.bridge.append(i)
    def GETbridge(self):
        return self.bridge
deadbridges=0
islands,needsnum=map(int,input().split())
bridge=[0 for _ in range(islands-1)]
box = []
for i in range(needsnum):
    arg1,arg2=map(int,input().split())
    box.append(Need(arg1,arg2))

while(len(box)!=1):
    bridge = [0 for _ in range(islands - 1)]
    for need in box:
        list=need.GETbridge()
        for ing in list:
            bridge[ing-1]=bridge[ing-1]+1
    
    maxi=0
    for i in range(len(bridge)):
        if(bridge[i]>bridge[maxi]):
            maxi=i
    
    deadbridges=deadbridges+1
    
    kill=False
    for i in range(len(box)):
        try:
            s=box[i].GETbridge()
        except:
            break
        for k in s:
            if(k==bridge[maxi]):
                kill=True
                break
        if(kill):
            box.pop(i)
            i=i-1
print(deadbridges)

list=input().split()
for i in list:
    i=int(i)
list.sort()
sumcosts=0
costs=0
first=True
mae=0
for i in list:
    i = int(i)
    if(first):
        first=False
        mae=i
    else:
        sumcosts=sumcosts+abs((i-mae))
        mae=i
print(sumcosts)



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

min = float('inf')

for i in range(3):
	for j in range(3):
		if i==j:
          break
        min = min(abs(A[i]-A[j]), min)

print(min)

import itertools

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

L = itertools.permutations(A)

min = float('inf')

for l in L:
    temp = abs(l[1]-l[0])+abs(l[2]-l[1])
    if min > temp:
        min = temp
print(min)

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 -*-

import functools

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a if a > 0 else 1

max_under_lcm = functools.reduce(lambda x, y: int((x * y) / gcd(x,y)), numbers) - 1
answer = sum([ max_under_lcm % n for n in numbers])

print(answer)

import functools
import fractions

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

max_under_lcm = functools.reduce(lambda x, y: int((x * y) / fractions.gcd(x,y)), numbers) - 1
answer = sum([max_under_lcm % n for n in numbers])

print(answer)

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

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

Verdicts: Runtime Error

Runtime Error

Accepted