human
Count pairs from two sorted arrays whose sum is equal to a given value x | function to search ' value ' in the given array ' arr [ ] ' it uses binary search technique as ' arr [ ] ' is sorted.
value found.
value not found.
function to count all pairs from both the sorted arrays whose sum is equal to a given value.
for each arr1 [ i ].
check if the ' value ' is present in 'arr2[]  .
required count of pairs.
Driver Code"
Solution in Python:
assistant
#Here is code to count pairs from two sorted arrays whose sum is equal to a given value x and the other steps required.
 def isPresent ( arr , low , high , value ) :
	while ( low <= high ) :
		mid = ( low + high ) // 2
		if ( arr [ mid ] == value ) :
			return True
		elif ( arr [ mid ] > value ) :
			high = mid - 1
		else :
			low = mid + 1
	return False
def countPairs ( arr1 , arr2 , m , n , x ) :
	count = 0
	for i in range ( m ) :
		value = x - arr1 [ i ]
		if ( isPresent ( arr2 , 0 , n - 1 , value ) ) :
			count += 1
	return count
if __name__ == " _ _ main _ _ " :
	arr1 = [ 1 , 3 , 5 , 7 ]
	arr2 = [ 2 , 3 , 5 , 8 ]
	m = len ( arr1 )
	n = len ( arr2 )
	x = 10
	print ( " Count ▁ = ▁ " , countPairs ( arr1 , arr2 , m , n , x ) )