left to the minimum water level in any bucket and right to the average water level across all buckets.left_over ratio as 1 - loss / 100.ok(val) that checks if a water level val is achievable:
cnt to 0.val, add the excess water times left_over to cnt.val, subtract the deficit from cnt.True if cnt is non-negative, indicating that the level is achievable.right - left is greater than the precision threshold:
mid as the average of left and right.ok(mid) returns True, update left to mid; otherwise, update right to mid.right as the maximum achievable water level.