Function to return the count of pairs which satisfy the given condition
static int solve ( int [ ] A , int [ ] B , int n ) { int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ )