SRM 328 DIV 2 easy & mid

Shortening code is very important to me.