The sequence is increasing, but there are bits that are unset, so there is no possible sequence. To make sure no bits are unset, use a[i-1]&a[i] == a[i-1]. This makes sure there are no bits that are one in a[i-1] but 0 in a[i]. It also checks whether a[i-1]<=a[i] because a&b is always less than or equal to both a and b, so if a[i-1] is greater, it cannot be equal to a[i-1].

Why is answer 0 if n==1? If n=1, means there is one answer, the number itself.

If n==1 its my mistake it should be 1
i initialize ans with 0 so if i multiply any number it will always showl 0 so if c>=1 means we have possible sequence and hence im initailizing ans=1;
and this is only one time process because another condition is ans==0;

Is it? I think itâ€™s 1.
The sequence A={0,1} satisfies the given B.
Assuming c>=1 is risky, since 0 has no set bits.
Instead you can start with ans=1, and set it to 0 only when you see an impossible case.

you are rightâ€¦
It should be 1 but then why i get AC
please check test case
And i want to know that how can i ignore some input because im breaking in mid way. SO i think it is creating a problem

cin.ignore() To ignore the rest of the input in the line. Remeber you only go to the next line when you attempt to read from an empty line, NOT when there is no more input in the line.
The testcases were horrendously weak for this question.