performance test the code for finding time taken to fill the disk space
You may be able to speed up the body of the loop using the sum function &amp; list comprehension:

mem = sum( timeTaken // v for v in proc_r )


But the real speed up won’t come until you realize you can compute a lower limit for timeTaken, and begin looping starting from that value, instead of from zero.