R is a set of integers. Assume R is not empty, otherwise X = empty. Let r be the smallest element of R. Assume r is even, otherwise subtract 1 from each element of R, find X, add 1/2 to each element of X.
Let x be the smallest element of x, then x = r/2 is an integer. Let y be another element of X, then since x+y is an element of R and therefore an integer, y is also an integer. Since y+y is element of R, and an integer, the only numbers that can be elements of X are the even elements of R, divided by 2. Let r’ be the largest element of R, then x’ = r’ / 2 is the largest element of X, therefore r’ must be even, otherwise there is no solution.
If R has one element only then obviously X = { x } is the solution. Otherwise, x + x’ must be an element of R, or there is no solution. If R has three elements, then X = { x, x’ } is the solution; R cannot have just two elements at this point, but has at least four.
We start now with X = { x, x’ } and try adding further elements that are half of an element of R, in increasing order. You only may add the next candidate y if x+y is in R for every x in X. After adding or not adding y all elements of R <= x + y must be the sum of two elements in X.