Welcome again challenger!!

Our Young Mario was dreaming about Xors when he was struck with a question. Help him solve his question.

139.59.28.4:1352

Let’s connect to the server and see what’s going on.

So, we need to find the total numbers of p such that (p xor x) > x where 1 <= p < x for all test cases. Also, there is a time limit which means that we need to be fast. Therefore, we need a good algorithm to calculate the result.

Let x be 11011010. We can find a number 111XXXXX where X’s can be either 0 or 1 and for all of them are greater than x. There exists 2^5=32 numbers for this scenerio. We can also find a numbers such that 110111XX and we have 2^2=4 numbers that are again greater than original x.

What I’m doing here is to find a bit whose value is 0 and change it to 1. Then, all the bits rightside of it can either be 1 or 0 and we can get these numbers with XOR operation.

Here is my script to solve the challenge.

Notice that the number of testcases are random. So, we will try a few times until we get lucky and small amount of tests.

Let’s execute the script.

We got the flag xiomara{link_lists_are_cool_btw}.