結果 : how to avoid time limit exceeded error in python