Gets 98 on kattis but is shit.