Within Ocean Network, if your algorithm is faulty and breaks mid-job, you will only be billed for the time it actually ran.
For each node, however, there is a minimum billing period, set by the node owner. That means that even short-lived jobs will be charged if there is a failure of any kind before reaching >= that min job duration. Check the algorithm logs to see what failed and where.