Максимовских Анастасия, 2539

Good resolution and much faster now.
Sorry, I really thought it worked fast enough(((((
no 1-line ifs, please