pair element of A and B
if Ap [ i ] [ 0 ] > Bp [ j ] [ 0 ] : NEW_LINE INDENT ans [ Bp [ j ] [ 1 ] ] = Ap [ i ] [ 0 ] NEW_LINE i += 1 NEW_LINE j += 1 NEW_LINE DEDENT else : NEW_LINE INDENT remain . append ( i ) NEW_LINE i += 1 NEW_LINE DEDENT