Do indices matter in case of sub-sequences in the problem?
Suppose “1 1 1 1 2” is a sequence then, only “1 1 2” is not an AP. But is it counted only once or all the combinations of the same sub-sequence need to be counted in answer?
not only 1 1 2 but 1 1 1 2 and 1 1 1 1 2 are also not APs, and yes, the repeated cases count too.