check if modulo is equal to K
if ( arr1 [ i ] % arr2 [ j ] == K ) s . insert ( make_pair ( arr1 [ i ] , arr2 [ j ] ) ) ; } else { if ( arr2 [ j ] % arr1 [ i ] == K ) s . insert ( make_pair ( arr2 [ j ] , arr1 [ i ] ) ) ; } } }