





def 	_a						(   UpperCAmelCase					)    ->    int:







   """simple docstring"""
   lowerCamelCase__       :						List[Any]        =							len(UpperCAmelCase					)
   lowerCamelCase__       :						Optional[int]        =							len(matrix[0]					)
   lowerCamelCase__       :						str        =							min(UpperCAmelCase      ,  UpperCAmelCase					)

   for row in range(UpperCAmelCase					):
      # Check if diagonal element is not zero
      if matrix[row][row] != 0:
         # Eliminate all the elements below the diagonal
         for col in range(row + 1      ,  UpperCAmelCase					):
            lowerCamelCase__       :						int        =							matrix[col][row] / matrix[row][row]
            for i in range(UpperCAmelCase      ,  UpperCAmelCase					):
               matrix[col][i] -= multiplier * matrix[row][i]
      else:
         # Find a non-zero diagonal element to swap rows
         lowerCamelCase__       :						Any        =							True
         for i in range(row + 1      ,  UpperCAmelCase					):
            if matrix[i][row] != 0:
               lowerCamelCase__       ,							lowerCamelCase__       :						Optional[int]        =							matrix[i], matrix[row]
               lowerCamelCase__       :						Optional[Any]        =							False
               break
         if reduce:
            rank -= 1
            for i in range(UpperCAmelCase					):
               lowerCamelCase__       :						Optional[int]        =							matrix[i][rank]

            # Reduce the row pointer by one to stay on the same row
         row -= 1

   return rank


if __name__ == "__main__":
       import doctest

       doctest.testmod()










def 	_a						(   UpperCAmelCase					)    ->    int:







   """simple docstring"""
   if not isinstance(UpperCAmelCase      ,  UpperCAmelCase					) or number < 0:
      raise ValueError('''Input must be a non-negative integer'''					)

   lowerCamelCase__       :						List[str]        =							0
   while number:
      # This way we arrive at next set bit (next 1) instead of looping
      # through each bit and checking for 1s hence the
      # loop won't run 32 times it will only run the number of `1` times
      number &= number - 1
      count += 1
   return count


if __name__ == "__main__":
       import doctest

       doctest.testmod()



