So let's try to understand why it so happens.

First of all, the maximum size of a data set is the maximum size of a sequence for

this problem, in our case, it is roughly 10 to the 5.

So what is the number of operations performed by our algorithm on such

a sequence?

So recall that in our algorithm we just go through all possible pairs

of input numbers.

So this is roughly n squared.

So when n is equal to 10 to the 5, this is 10 to the 10.

And this is more than one billion.

And one billion is roughly the number of basic operations that modern computers can

perform in one second.

So we conclude that we need a faster algorithm to solve this problem.

In particular, we realize that we need to find the maximum pairwise product,

without actually going through all possible pairs of numbers.

So in search of an inspiration, let's take a look at the problem page.

In particular let's review the second sample case.

In this case, our input consists of ten integers,

and the output in this case, is 140.

And why is that? Well,

this is just because in our sequence there are two numbers, 14 and 10.

These two numbers are two maximal numbers actually.

So for any other two numbers, their product are less than 140.

So this gives us an idea: that to find the maximum product of two numbers from

our sequence, it is actually enough to find two maximal numbers in our sequence.

This is because all of our integers in this sequence are non-negative.

So let's just implement this idea in our C++ file.

So this is already implemented, and it looks as follows.

So the new function is called MaxPairwiseProductFast.

So it already uses the long.long type for

storing the result and we do the following.

Just by scanning the input array two times, we find two maximal numbers.

So in the first block, we find the first maximum and

we store its index in the max_index variable, and

in the second block, we find the second maximal element.

So the difference in the second block is that we also need to skip

the first maximal element