Help me in codeforces problem

i try to solve by java but i can’t

https://codeforces.com/gym/102263/problem/C

can anyone help me please ?