Since there's more items of first kind than needed, it should be easy to argue that the result is 57 * 81 (which is 4617). Is your reference solution incorrect?
I think you should make the requirements clearer for what you expect from empty tests - that there may be [[]] or in general that [] may appear as a valid input within an otherwise "normal" array.
D translation
Input from random tests:
[[93, 81]], 57
4617 should equal 2916
Since there's more items of first kind than needed, it should be easy to argue that the result is 57 * 81 (which is 4617). Is your reference solution incorrect?
This comment is hidden because it contains spoiler information about the solution
I think you should make the requirements clearer for what you expect from empty tests - that there may be
[[]]
or in general that[]
may appear as a valid input within an otherwise "normal" array.