Solutions to TopCoder SRM problems