I have been preparing for Codechef Advance level certification exam. I came across this problem VERYHARD. Link - VERYHARD.
I have applied 3 approches to solve this problem:
In 2nd and 3rd approach I made k trees (0,k-1) for each modulus value and stored the count. What approach should I use to get 100pts?