Problem
I tested a bunch of code to see the memory consumption and found that CodeChef’s memory calculation is different and way too weird.
Sample Code
import sys
# A string variable of size approximately 488 + MB
ran_str = " " * 512000000
# Print the size
print(sys.getsizeof(ran_str) /1024 / 1024 ) # getsizeof() returns size on bytes.
This code shows memory consumption in KB(s), which has blown my mind as to how in the world it can be as the variable itself is defined to consume MB(s).
Output