https://ide.codingblocks.com/#/s/24408 https://hack.codingblocks.com/contests/c/457/493
https://ide.codingblocks.com/#/s/24658
Refer to this solution