When I submit my code here for Problem C to Codeforces Round 291, it gives me runtime error although I've tried my code both on my local compiler and on ideone.com, both of which give me correct outputs. Why is this happening? Any help would be appreciated.
You need to create an empty node constructor like this:
node() { child[0] = child[1] = child[2] = nullptr; }
If you do not do this neither of child[i] will be nullptr. (Kinda sad that I'm not good enough to prove what's wrong exactly here, I just know that this works, hope somebody will help you further if you will need more assistance)
P.S. Learn me how to use BB-code to write code samples properly, I still couldn't get any guide or anything that would help me with this case.
Thanks :)