human
Find if a binary matrix exists with given row and column sums | Function to check if matrix exists.
Store sum of rowsums , max of row sum number of non zero row sums.
Store sum of column sums , max of column sum number of non zero column sums.
Check condition 1 , 2 , 3.
Driver Code"
Solution in Python:

=====
Can you provide a code to find if a binary matrix exists with given row and column sums and the other steps required?
assistant
#Here is code to find if a binary matrix exists with given row and column sums and the other steps required.
 def matrix_exist ( row , column , r , c ) :
	row_sum = 0
	column_sum = 0
	row_max = - 1
	column_max = - 1
	row_non_zero = 0
	column_non_zero = 0
	for i in range ( r ) :
		row_sum += row [ i ]
		row_max = max ( row_max , row [ i ] )
		if ( row [ i ] ) :
			row_non_zero = row_non_zero + 1
	for i in range ( c ) :
		column_sum = column_sum + column [ i ]
		column_max = max ( column_max , column [ i ] )
		if ( column [ i ] ) :
			column_non_zero = column_non_zero + 1
	if ( ( row_sum != column_sum ) or ( row_max > column_non_zero ) or ( column_max > row_non_zero ) ) :
		return False
	return True
if __name__ == ' _ _ main _ _ ' :
	row = [ 2 , 2 , 2 , 2 , 2 ]
	column = [ 5 , 5 , 0 , 0 ]
	r = len ( row )
	c = len ( column )
	if matrix_exist ( row , column , r , c ) :
		print ( " YES " )
	else :
		print ( " NO " )