Improve the function

in 12 minutes and 6 seconds, using 0 compute credits, and was queued for 6 seconds
latest