Recursion depth exceeding in a python function for counting reverse pairs

visit shbcf.ru