Help me in solving ICL1901 problem

My issue

I am unable to understand how the output is coming, explain the given testcase in detail

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here

}

Learning course: 1800 to 2000 difficulty problems
Problem Link: A Weird Device Practice Problem in 1800 to 2000 difficulty problems