Quantum entanglement with Debug.Log()

This may seem strange, but there is no other way to describe it.

My code doesn’t work without Debug.Log(). If it’s in the code, everything works fine, but without it I get the “Index was out of range” error, and I don’t change the index calculation. I would ignore it, but Debug.Log is called 4096 times to 16777216 times depending on the settings, and my editor is dying

There is a code and a console: