The algorithm for sorting the input (from both python and Java has been changed to make sure they work correctly) After that both python and Java have produced the same results.
This is an assignment by Blah blah
I am not going to write too much here - (So people could google search and copy the results)
There are two Java source files
SortInput.java
and
FindOptimalCostPath.java (this one has main)
Python program is called test.py