Maximum Element-Sum of a Complete Subset of Indices
Indices whose product is a perfect square share the same square-free part, so group values by that key and take the largest group sum.
Indices whose product is a perfect square share the same square-free part, so group values by that key and take the largest group sum.