This problem is in Contest(s) below:
Contest 1017:NOIP模拟
Contest 1100:2022小学市夏令营练习-枚举