Memory Limit Exceeded in Codefoces #764(Div 3) Problem E

Code: https://codeforces.com/contest/1624/submission/142576365.

I can’t figure out why this is giving MLE. According to my calculation this code should be using less than 128KB and the memory limit is 256 MB. Still I tried to reduce the memory usage but I’m still getting MLE. Please help

Consider the test input:

1

8 8
91588807
91555348
86706894
92117806
97595796
86160540
23003942
15505576
34801779

(I believe it’s valid).

Be careful about running in on your own PC at it will gobble up all your RAM!

Thank you! So problem is with my hash function. Got it!