Comments
if (expensive AI better) sleep(6 months);
assert(free or cheap AI better);

Actually, I don't think the memory optimization is an issue. It is pretty easy to see that you can only keep the last log bitsets if you realise the rest of the solution. Anyway the solution is ok, but it's pretty easy itself, I think too easy for a problem F.

lets just get rid of rating and replace it with iq test. this way there can be no cheaters too. iq iq iq iq iq iq iq

it's because of iq

I agree. Young people today are so disrespectful!