Code giving wrong ans after compiling and test, but giving right ans for the costume inputs

In Von Neuman Loves Binary I have written my code mostly using bit manipulation, rather general arithmetic. Getting right ans for custom inputs, but when I am compiling and testing it, I am getting all ans as zeroes.

please help!

My code:

#include
using namespace std;

int main() {
int N;
cin>>N;

while(N--)
{
	int b_no;
	cin>>b_no;

	int p = 1;
	int ans = 0;
	while(b_no > 0)
	{
		int digit = (b_no & 1);
		if(digit == 1)
			ans = ans + p;
		p <<= 1;
		b_no /= 10;
	}

	cout<<ans<<"\n";
}
return 0;

}

hey! @aman212yadav
I didn’t get you. Sorry
for input
2
01
00
my output:
1
0

this ans is correct, right? What’s your point?

hey sorry bro.
ignore my previous comment.

use long long and then try

Constraints:
N<=1000 Digits in binary representation

can’t understand the constraints

16 digits will not fit in int .

still getting the same problem.

save ur code here ->

and share the link with me

code link

make p long long . . . . .

let me know what verdict u r getting

after making the data type of p as long long int, getting:

runguard: warning: timelimit exceeded (wall time): aborting command
runguard: warning: command terminated with signal 15

have u given input , before running?

ur code ->

No, I am not. I am doing the compile the test option in . Does it need input from me?

yeah…

btw ur code is working now
image

Ohh! thanks! worked for me.

just last question. the compile and test option in Code Editor of Coding Blocks test against which inputs? Are there any defaults inputs for each question? And what is custom input section for?

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.