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 =  [int (i) for i in input.split(" ")]
ans=5000
if abs(task[0]-task[1])+abs(task[2]-task[0]) < ans:
	ans = abs(task[0]-task[1])+abs(task[2]-task[0])
if abs(task[0]-task[2])+abs(task[1]-task[0]) < ans:
	ans = abs(task[0]-task[2])+abs(task[1]-task[0])
if abs(task[1]-task[0])+abs(task[2]-task[1]) < ans:
	ans = abs(task[1]-task[0])+abs(task[2]-task[1])
if abs(task[1]-task[2])+abs(task[0]-task[1]) < ans:
	ans = abs(task[1]-task[2])+abs(task[0]-task[1])
if abs(task[2]-task[0])+abs(task[1]-task[2]) < ans:
	ans = abs(task[2]-task[0])+abs(task[1]-task[2])
if abs(task[2]-task[1])+abs(task[0]-task[2]) < ans:
	ans = abs(task[2]-task[1])+abs(task[0]-task[2])
print(ans)

task =  [int (i) for i in "100 100 100".split(" ")]
ans=5000
if abs(task[0]-task[1])+abs(task[2]-task[0]) < ans:
	ans = abs(task[0]-task[1])+abs(task[2]-task[0])
if abs(task[0]-task[2])+abs(task[1]-task[0]) < ans:
	ans = abs(task[0]-task[2])+abs(task[1]-task[0])
if abs(task[1]-task[0])+abs(task[2]-task[1]) < ans:
	ans = abs(task[1]-task[0])+abs(task[2]-task[1])
if abs(task[1]-task[2])+abs(task[0]-task[1]) < ans:
	ans = abs(task[1]-task[2])+abs(task[0]-task[1])
if abs(task[2]-task[0])+abs(task[1]-task[2]) < ans:
	ans = abs(task[2]-task[0])+abs(task[1]-task[2])
if abs(task[2]-task[1])+abs(task[0]-task[2]) < ans:
	ans = abs(task[2]-task[1])+abs(task[0]-task[2])
print(ans)

Source code
Copy
task =  [int (i) for i in input.split(" ")]
ans=5000
if abs(task[0]-task[1])+abs(task[2]-task[0]) < ans:
	ans = abs(task[0]-task[1])+abs(task[2]-task[0])
if abs(task[0]-task[2])+abs(task[1]-task[0]) < ans:
	ans = abs(task[0]-task[2])+abs(task[1]-task[0])
if abs(task[1]-task[0])+abs(task[2]-task[1]) < ans:
	ans = abs(task[1]-task[0])+abs(task[2]-task[1])
if abs(task[1]-task[2])+abs(task[0]-task[1]) < ans:
	ans = abs(task[1]-task[2])+abs(task[0]-task[1])
if abs(task[2]-task[0])+abs(task[1]-task[2]) < ans:
	ans = abs(task[2]-task[0])+abs(task[1]-task[2])
if abs(task[2]-task[1])+abs(task[0]-task[2]) < ans:
	ans = abs(task[2]-task[1])+abs(task[0]-task[2])
print(ans)

task = input().split(" ")
ans = 5000
if abs ( int(task [ 0 ]) - int(task [ 1 ])) + abs ( int(task [ 2 ]) - int(task [ 0 ])) < ans : 
	ans = abs ( int(task [ 0 ]) - int(task [ 1 ])) + abs ( int(task [ 2 ]) - int(task [ 0 ]))
if abs ( int(task [ 0 ]) - int(task [ 2 ])) + abs ( int(task [ 1 ]) - int(task [ 0 ])) < ans : 
	ans = abs ( int(task [ 0 ]) - int(task [ 2 ])) + abs ( int(task [ 1 ]) - int(task [ 0 ]))
if abs ( int(task [ 1 ]) - int(task [ 0 ])) + abs ( int(task [ 2 ]) - int(task [ 1 ])) < ans : 
	ans = abs ( int(task [ 1 ]) - int(task [ 0 ])) + abs ( int(task [ 2 ]) - int(task [ 1 ]))
if abs ( int(task [ 1 ]) - int(task [ 2 ])) + abs ( int(task [ 0 ]) - int(task [ 1 ])) < ans : 
	ans = abs ( int(task [ 1 ]) - int(task [ 2 ])) + abs ( int(task [ 0 ]) - int(task [ 1 ]))
if abs ( int(task [ 2 ]) - int(task [ 0 ])) + abs ( int(task [ 1 ]) - int(task [ 2 ])) < ans : 
	ans = abs ( int(task [ 2 ]) - int(task [ 0 ])) + abs ( int(task [ 1 ]) - int(task [ 2 ]))
if abs ( int(task [ 2 ]) - int(task [ 1 ])) + abs ( int(task [ 0 ]) - int(task [ 2 ])) < ans : 
	ans = abs ( int(task [ 2 ]) - int(task [ 1 ])) + abs ( int(task [ 0 ]) - int(task [ 2 ]))
print ( ans )

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted