Cleaner solution to round 1B problem B (too slow)

Improved the solution by generating valid values of k (as is done for a
and b), rather than iterating over all values of k. However this is
still way too slow on the large problem set.