Golden Trees - ZNEC Runtime error

Please help me find why I got ZNEC runtime error. When I compiled and ran it, it was fine, but when I submitted, it got an error. I spent several hours and did not find the bug

My code is here

//