Function for K = 2
def func4 ( L , R , K ) : NEW_LINE INDENT if ( R - L >= 4 ) : NEW_LINE INDENT return 0 NEW_LINE DEDENT minval = L ^ ( L + 1 ) ^ ( L + 2 ) ^ ( L + 3 ) NEW_LINE return min ( minval , func3 ( L , R , K ) ) NEW_LINE DEDENT