for(int i=1;i<=n;i++){ ch=getchar(); for(int j=1;j<=m;j++){ ch=getchar(); if(ch=='0')b[i][j]=false; else b[i][j]=true; } }