Problem A.
This problem is solved by simple emulation. After 2n jumps flea returns to initial position, because 1 + 2 + 3 + ... + 2n = n(2n + 1) is divisible by n. Moreover, after that, jumps would be the same as in the beginning, because 2n is divisible by n. So it is just enough to emulate first 2n jumps.
In fact one may see that it is enough to emulate first n jumps and moreover answer is "YES" exactly when n is power of two. Last gives alternative solution. For example: printf("%s", n&(n-1) : "NO" ? "YES");
If n isn't a power of two, then n is divisible by some odd prime p. Let's look at hassocks not mod n, but mod p. We will see that not all residues (mod p) will be visited. Indeed after p jumps flea returns to initial residue mod p, because is divisible by p. And after that jumps would be the same as in the beginning (mod p), because p is divisible by p. Moreover, even after p - 1 jumps flea returns to initial residue mod p. So there are p - 1 different residues as maximum. Thus not all hassocks will be visited.