Help me in solving SPYX problem

Problem statement

I’m not able to figure out how output is obtained. I hope somebody can help me out.

Note: Problem statements and inputs have some contradictions. Even if somebody understands it well, please share it.