Getting SIGSEGV in FCTRE - PyPy 3.5

I have used Mo’s algorithm for trees and LCA. Memory usage for my code is 785M. Then also I am getting SIGSEGV for 3 tasks of last sub-task.
There are accepted solutions in C++ which uses over 3366M of memory.
It would be nice if you can help me with these questions.

  1. What is the maximum allowed memory usage for PyPy 3.5? @admin
  2. How I can modify my solution (CodeChef: Practical coding for everyone) so that it gets accepted considering memory constraints?

P.S. Got it. I was using too much memory to store factors smaller than 1000.