Fixed Krasnoyarsk task G and added solutions from contest