A list contains n distinct numbers from 0..n, so exactly one is missing. Implement missing_xor(nums) using XOR (O(n) time, O(1) space, no sorting, no sets).
Also implement missing_and_repeated(nums) for a list of length n containing 1..n where one number appears twice and one is missing; return (repeated, missing) using sums and sums of squares.