using System.Collections.Generic;
public static void Main()
Random rand = new Random();
int[] arr = new int[]{6, 4, 8, 4, 84, 25, 64, 24, 77, 25, 14, 7, 4};
int[] bigArr = new int[20000];
for(int x = 0; x < 20000; x++){
for(int x = 0; x < 1; x++){
result = SlepicMaxPairProduct(bigArr);
public static int MaxPairProduct(int[] input)
HashSet<int> hashSet = new HashSet<int>();
for (int i = input.Length - 1; i > 0; i--)
for (int j = i - 1; j >= 0; j--)
if (factor != 0 && product % factor == 0 && hashSet.Contains(product / factor))
private static int NextDistinctElementIndex(int[] input, int i)
while (i < input.Length && input[i] == value);
public static int SlepicMaxPairProduct(int[] input)
throw new ArgumentException("Input cannot contain negative numbers.");
imin = NextDistinctElementIndex(input, 0);
if (imin < input.Length - 1 && input[imin] == 1)
return input[input.Length - 1];
for (int pi = input.Length - 1; pi > imin; --pi)
for (int ai = imin; ai < bmax; ++ai)
int expectedB = product / a;
int bi = (bmin / 2 + bmax / 2) + ((bmin % 2) & (bmax % 2));