Python Simple Solution
\nclass Solution:\n    def maximumRows(self, mat: List[List[int]], cols: int) -> int:\n        n,m = len(mat),len(mat[0])\n        ans = 0\n\n        def check(
```\nclass Solution:\n    def maximumRows(self, mat: List[List[int]], cols: int) -> int:\n        n,m = len(mat),len(mat[0])\n        ans = 0\n\n        def check(state,row,rowIncludedCount):\n            nonlocal ans\n            if row==n:\n                if sum(state)<=cols:\n                    ans = max(ans,rowIncludedCount)\n                return\n            \n            check(state[::],row+1,rowIncludedCount)\n            for j in range(m):\n                if mat[row][j]==1:\n                    state[j] = 1\n            check(state,row+1,rowIncludedCount+1)\n        \n        check([0]*m,0,0)\n        return ans\n```
['Python', 'Python3']