A Idea and solution: flaviu2001
Think about addition in base two. Say a=10101 and b=1001. What your operation does is it modifies the bits in your numbers, so if the first bit in a is 1 and the first bit in b is 1 (as is the case above) you can make both 0 by making that bit 1 in x. This is actually the only way you can decrease the resulting sum, so x=1 is an answer above.
Noticing the hint above we now deduce x = a & b where & is bitwise and. So just printing (a^(a&b)) + (b^(a&b)) works, but there's an even nicer formula. We'll leave it up to you to prove that (a^(a&b)) + (b^(a&b)) = a ^ b :)
B Idea and solution: flaviu2001
It's hard to use the two valuable switches somewhere in the middle of the matrix, a much wiser choice would be to somehow block the S cell or the F cell. Perhaps you can set both neighbours of S to 1 to force Roger to pick 1.
If we pick the neighbours of S to be 1 we can make the neighbours of F 0 and there would be no way to go from S to F. But this in the worst case takes 4 switches, to get down to 2 switches we can consider the other way around, making the S neighbours 0 and F neighbours 1. There must be a solution of the two with at most two switches and you won't get from S to F since you're forced to pick 1 (or 0) and can't get past the neighbours of F which are opposite.
C Idea and solution: flaviu2001
You're not allowed to just pick the whole string and append its reversed result to the front, but what's the next best thing? We're very close to the answer if we take the whole string except for a letter (so for abcde we make dcbabcde).
The operation above which transformed abcde into dcbabcde is very close, if only we could've appended e to the left somehow. Turns out you can set that up, so from abcde first append d to the end, then you have abcded. Now apply the operation from the hint on this string and get edcbabcded. See why we added that d first? We can now append it to the front just like we wanted!. Do the operation L 2 and the job is finished. Yep, amazingly just printing
R n-1
L n
L 2
works!
D Idea: flaviu2001, solution: flaviu2001 and koala_bear00
Using too many edges in the solution feels wasteful, the solution surely has some neat line as straight as possible. Perhaps we can prove only two edges are required?
Indeed two edges are required in the solution, so one approach would be picking all combinations of edges and do linear algebra so see how many times each is required (or if it's impossible).
To prove that let's suppose our target is somewhere reachable by only taking C1 and C2 (the upper right sextant, a sixth division of the plane). C4 and C5 will never be used since they contribute in the wrong direction. We can now use C6, C1, C2 or C3 for our solution. If using C1 and C2 is not optimal we can choose C3 or C6, without loss of generality we choose C3. C6 cannot be used because it simply counters C3. Now we either use C1, C2 or C3, but we can further narrow down to just two edges. If we use all three this means we use C1+C3 which goes the same way as C2, and C2 also goes the same way as C1+C3. So we can just not use C2 if C1+C3 < C2, or use C2 instead of C1+C3 until either of C1 or C3 doesn't appear anymore on our solution.
E Idea and solution: flaviu2001