Solutions to SPhere Online Judge problems in Python