Today I'm going to present a very interesting problem I found while searching for new problems for my students. Here you can observe how I used combinatorics and bitwise operations to reduce what seemed to be a very complicated problem to a solution which is only a couple of lines long.
Problem: https://cses.fi/problemset/task/2419/
Solution Code: https://cses.fi/paste/60b25a5e317e62f19115bc/
My Algorithms Templates: https://github.com/stefdasca/CompetitiveProgramming/tree/master/Algorithms
My website: https://stefdasca.ro/
Codeforces profile: https://codeforces.com/profile/stefdasca
Discord server: https://discord.gg/ZDfmQBKHkC
Facebook page: https://www.facebook.com/stefan.dascalescu.2013/
Linkedin: https://www.linkedin.com/in/stefdasca/
Instagram page: https://www.instagram.com/stefdasca/