Problem 2845 · Medium
Track prefix counts modulo the given modulo and look up how many earlier prefixes share the needed residue.
Open the interactive visualisation