write memory efficient python code

welcome to shbcf.ru