There seems to be an error with the way your algorithm is calculating the completion times of the processes.