edit: fixed the problem. thanks for looking though. It really is that every time I post here no matter how long I've been trying on my own I figure it out right after. It's crazy.
I was like oh I changed my arrays to global but I'm still passing them, let me change that so I don't look like a coding noob and then boom it works. with 1 minor kink of not correctly switching if sums are the same but have different differences (tiebreaker)