human
Check if X can give change to every person in the Queue | Function to check if every person will get the change from X.
To count the 5 $ and 10 & notes.
Serve the customer in order.
Increase the number of 5 $ note by one.
decrease the number of note 5 $ and increase 10 $ note by one.
decrease 5 $ and 10 $ note by one.
decrease 5 $ note by three.
queue of customers with available notes ..
Calling function"
Solution in Python:

=====
Can you provide a code to check if X can give change to every person in the Queue and the other steps required?
assistant
#Here is code to check if X can give change to every person in the Queue and the other steps required.
 def isChangeable ( notes , n ) :
	fiveCount = 0
	tenCount = 0
	for i in range ( n ) :
		if ( notes [ i ] == 5 ) :
			fiveCount += 1
		elif ( notes [ i ] == 10 ) :
			if ( fiveCount > 0 ) :
				fiveCount -= 1
				tenCount += 1
			else :
				return 0
		else :
			if ( fiveCount > 0 and tenCount > 0 ) :
				fiveCount -= 1
				tenCount -= 1
			elif ( fiveCount >= 3 ) :
				fiveCount -= 3
			else :
				return 0
	return 1
a = [ 5 , 5 , 5 , 10 , 20 ]
n = len ( a )
if ( isChangeable ( a , n ) ) :
	print ( " YES " )
else :
	print ( " NO " )