For the problem 567E - President and Roads
I think I finally got the idea what is the "modulo based hacking" is about (thread http://mirror.codeforces.com/blog/entry/19590?#comment-244040)
When counting number of ways in a graph within the given ranges we can easily get out of bounds of long long data type. Therefore we need some way to be able to count and compare numbers larger than ll. Ideally we need a full stack BigInt support, but what if we can find something simpler than that. The naive approach here is to pick some large prime number M and perform all operations modulo M. Unfortunately this approach is not working for all possible inputs and leads to collisions, since the two different numbers may still match and the solution can be exploited — i.e. modulo based hacking.
Here is the list of less exploitable approaches: