Hi everyone :) can anyone tell me why my code gives right answer for the first 4 test and it doesnt give the correct answer for the 5th one . i would really really appreciate your help :)
PS : i think my algorithm is correct thats why i dont want to read sb else's code :)
thanks :) http://codeforces.net/contest/415/submission/11136797
Watch out for modulo. In solution() you are doing res+=smth; instead of res+=smth, res%=mod. 11137094