what is wrong in my code why the test case is not being passed but when I unlocked the test case and run on the other compiler I am getting the preferred output.
#include
using namespace std;
int main() {
int Q,a,b;
cin>>Q;
while(Q--){
cin>>a>>b;
int ans=0;
for(int i=a;i<=b;i++){
int n=i;
while(n>0){
int last_bit=n&1;
n=n>>1;
ans+=last_bit;
}
}
cout<<ans;
}
return 0;
}