Problem 2916 · Hard
For every subarray, square its count of distinct values and add the results modulo 1000000007.
Open the interactive visualisation