Hello, everyone. I have spent quite some time to solve this problem, "Modulo Equality" ( https://www.codechef.com/problems/EQUALMOD ). I did this by finding the minimum of all the elements in B. After that, I loop through 0 to minimum and check how many operations I have to do to get every number in A so that remainder is that number (the number in the loop, i.e., from 0 to min). This approach gets me TLE. I saw solutions of fellow mates and came across these suffixes and prefixes they calculate. I did not understand what is going on. Can anyone please explain it to me? asked 24 Oct '18, 14:56

This is a question from ICPC 2017, so its editorial can be found here: https://discuss.codechef.com/questions/122233/equalmodeditorial. Please search a bit before posting in the future. answered 24 Oct '18, 18:38
