i attempted it using bitset datatype, and it gave the right answer but somehow always preceded it by a 0. so i put an if statement in there and it worked for the sample test case though the rest of the testcases still dont pass. here is the code, please guide:
#include
#include
#include
using namespace std;
int main()
{ int n;
cin>>n;
string str;
for(int i=0;i<=n;++i)
{
getline(cin,str);
bitset<16> b(str);
if(i>0){
cout << b.to_ulong() << '\n'; }
}
}