Runtime error when trying to solve MKIT

Hi all, I’ve been trying to solve MKIT (my code here) but I’m getting RTE. I’ve tried checking the bounds on my arrays, size of my arrays, etc, but I’m not sure why I still get RTE. I’ve modeled my solution after the tester’s code. Any help? Thanks!