I cannot figure out why this code is getting TLE'd despite of everything being under order and constraint. I knew those mod operations were costly so I optimized them but still no luck.
Problem : https://mirror.codeforces.com/contest/1466/problem/E
Code
Thanks!