Problem link: https://mirror.codeforces.com/contest/1625/problem/D
Sorry for necroposting, but I didn't find any solution for this in comments or anywhere
In problem D, The editorial solution uses a trie. if you use trie. Then there are at most nlogA vertices. If we implement using pointers then its memory would be nlogA*32 (32 if because of pointer address size in 32 bit compiler) = 3*10^5*30*30 = 2.7*10^8 ~ 2 GB. But memory limit is just 256 MB. How to solve this issue?