...
call
QUICKSORT N
S = ""; do I = 1 to N; S = S A.I; end; say S "|" X
I = 1; J = N
do until J <= I
select
when A.I + A.J < X then I = I + 1
when A.I + A.J > X then J = J - 1
otherwise
say "("A.I"," A.J") and ("A.J"," A.I")"
I = I + 1; J = J - 1
end
end
if J = I & 2 * A.I = X then say "("A.I"," A.I")"
exit
...