This is because some of the test cases are made to mess with the python hashing function.
Wrap your ints in this class before hashing to fix it:
from random import getrandbits
class Wrp(int):
RANDOM = getrandbits(32)
def __init__(self, x):
int.__init__(x)
def __hash__(self):
return super(Wrp, self).__hash__() ^ self.RANDOM
This is because some of the test cases are made to mess with the python hashing function.
Wrap your ints in this class before hashing to fix it:
If you want to learn more read this article: https://codeforces.com/blog/entry/101817
thanks bro