human
Given an array A [ ] and a number x , check for pair in A [ ] with sum as x | Function to print pairs.
Initializing the rem values with 0 's..
Perform the remainder operation only if the element is x , as numbers greater than x can 't  be used to get a sum x.Updating  the count of remainders..
Traversing the remainder list from start to middle to find pairs.
The elements with remainders i and x - i will result to a sum of x . Once we get two elements which add up to x , we print x and break ..
Once we reach middle of remainder array , we have to do operations based on x ..
If x is even and we have more than 1 elements with remainder x / 2 , then we will have two distinct elements which add up to x . if we dont have than 1 element , print " No " ..
When x is odd we continue the same process which we did in previous loop ..
Driver Code.
Function calling"
Solution in Python:
assistant
#Here is code to given an array A [ ] and a number x , check for pair in A [ ] with sum as x and the other steps required.
 def printPairs ( a , n , x ) :
	rem = [ ]
	for i in range ( x ) :
		rem . append ( 0 )
	for i in range ( n ) :
		if ( a [ i ] < x ) :
			rem [ a [ i ] % x ] += 1
	for i in range ( 1 , x // 2 ) :
		if ( rem [ i ] > 0 and rem [ x - i ] > 0 ) :
			print ( " Yes " )
			break
	if ( i >= x // 2 ) :
		if ( x % 2 == 0 ) :
			if ( rem [ x // 2 ] > 1 ) :
				print ( " Yes " )
			else :
				print ( " No " )
		else :
			if ( rem [ x // 2 ] > 0 and rem [ x - x // 2 ] > 0 ) :
				print ( " Yes " )
			else :
				print ( " No " )
A = [ 1 , 4 , 45 , 6 , 10 , 8 ]
n = 16
arr_size = len ( A )
printPairs ( A , arr_size , n )