BINFLIP - Editorial

#include <stdio.h>

int main(void) {
	int t,n,k,i,j,a;
    scanf("%d",&t);
    for(i=0;i<t;i++){
        scanf("%d %d",&n,&k);
        if(k==0){
            printf("YES\n0\n");
        }else{
            a=0;
            for(j=1;j<n;j++){
                if(pow(2,j)-1 == k){
                    printf("YES\n%d\n",j);
                    a=j;
                }
            }
            if(a == 0){
                printf("NO\n");
            }else{
                for(j=0;j<a;j++){
                    k=pow(2,j);
                    printf("%d\n",k);
                }
            }
        }
    }
	return 0;
}


I couldn’t get my mistake. I solved this problem but my code was always wrong. Anyone please help me

this is really helpful post for me thank you for sharing with us..