In this problem we are given a list of bases and exponents and we are required to find the pair that produces the largest number. For example, if given the values 342345 and 831230 we need to find 342345 raised to the power of 831230 and then compare the result to the values we have obtained for all of the other base exponent pairs to see if it is larger.

The problem here is that it is not possible to actually find 342345^{831230}. Instead, we can use the laws of logarithms.

log_{10}(342345^{831230}) = 831230 × log_{10}(342345)

The right hand side of this equation is easier to work with and the problem can be solved in the following steps.

1. For each line, read in the base exponent pairs.

2. For each pair, find exponent × log_{10}(base)

3. For each of the values generated in step 2, find out which is the largest.

4. Output the number of the line in the original text file that has this largest value.

Everyone who has studied maths beyond GCSE level will know the properties of logarithms that we are using here. The (mildly) difficult bit is writing the code. As ever, my clumsy and artless approach to getting data from text file probably makes my solution less elegant than is necessary.