sort subset2
sort ( subset2 . begin ( ) , subset2 . end ( ) ) ; long long count = 0 ; for ( int i = 0 ; i < subset1 . size ( ) ; i ++ ) count += upper_bound ( subset2 . begin ( ) , subset2 . end ( ) , ( k / subset1 [ i ] ) ) - subset2 . begin ( ) ;