Need help in a counting problem
https://codeforces.com/gym/101628/problem/GHow to solve it?
Codeforces Round 945 Solution Discussion (with myself)
Atcoder ABC #354 Solution Discussion