Compare https://www.acmicpc.net/problem/23679 and https://codeforces.me/contest/1710/problem/E, and you can find that there are crazy similarities in all of the legend, the input, the output, and the sample. Can the authors Rhodoks and zxyoi explain it?