https://www.codechef.com/viewsolution/40912844

I’m sure I have implemented the logic properly as it works on all sample test cases but I’ve messed up in the modular arithmetic logic for it. Can I please have help with the modular arithmetic logic?

A wonderful guide to modular arithmetic

1 Like

Thank you so much this was a very stupid oversight on my part