I solved this problem: https://codeforces.net/contest/1328/problem/E with the following program: https://codeforces.net/contest/1328/submission/78374395. The time it takes is ok, but it takes up quite a lot of memory (180 mb), but that doesn't make sense in my opinion since the program stores at most about 15 million integers.
Integers are 4 bytes each 1.5 * 10^7 integers * 4 = 6*10^7
Your program took 1.8 * 10^5 KB = 1.8 * 10^8 bytes
less than two times of difference... seems reasonable maybe inputs/outputs are also counted