Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==27291==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffcfaf76670 at pc 0x55f2b230c852 bp 0x7ffcfaf74fc0 sp 0x7ffcfaf74fb0 READ of size 8 at 0x7ffcfaf76670 thread T0 #0 0x55f2b230c851 in taking_command(Stack<int>&, Queue<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >&, int*, bool) (/out/package/sam_mem+0x8851) #1 0x55f2b2306fa4 in main (/out/package/sam_mem+0x2fa4) #2 0x7fc2ac131b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #3 0x55f2b2307ad9 in _start (/out/package/sam_mem+0x3ad9) Address 0x7ffcfaf76670 is located in stack of thread T0 at offset 5600 in frame #0 0x55f2b230831f in taking_command(Stack<int>&, Queue<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >&, int*, bool) (/out/package/sam_mem+0x431f) This frame has 26 object(s): [32, 33) '<unknown>' [96, 97) '<unknown>' [160, 161) '<unknown>' [224,
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
IFZ 17
JOJ Answer
IFZ 17 65497387 68090939 14401102 96824012 41289437 4835457 56117097 24136017 47420903 22807055 69570787 62885835 57250385 74993225 41595224 13915356 73942021 42769129 85990319 521962 99845127 33369678 82969071 ADD POP POP NOR NOR PUSHI 5 STORE ADD POP PUSHI 5 STORE NOOP PUSHI 8 LOAD PUSHI 14 LOAD POP ADD PUSHI 909323973 PUSHI 5 STORE IFZ 24 IFZ 20 ADD PUSHI 13 STORE NOOP POP PUSHI 895499513 NOOP PUSHI 11 LOAD PUSHI 5 STORE IFZ 13 NOOP PUSHI 8 LOAD PUSHI 0 IFZ 15 HALT STORE POP ADD IFZ 11 ADD HALT LOAD HALT NOOP HALT STORE ADD NOR STORE PUSHI 0 IFZ 3 STORE IFZ 25 HALT NOOP PUSHI 13 STORE IFZ 14 ADD NOOP PUSHI 3 LOAD NOR ADD PUSHI 3 LOAD PUSHI 3 STORE NOR NOOP POP IFZ 7 PUSHI 2 LOAD ADD PUSHI 8 STORE POP PUSHI 12 LOAD ADD POP PUSHI 2 LOAD NOOP NOOP PUSHI 6 STORE NOOP PUSHI 1912752084 IFZ 7 PUSHI 7 LOAD PUSHI 1235035345 POP PUSHI 6 STORE PUSHI 1 LOAD PUSHI 4 STORE PUSHI 533965038 PUSHI 3 LOAD NOOP PUSHI 7 LOAD NOOP NOOP POP NOR POP NOOP NOOP NOOP PUSHI 7 LOAD PUSHI 13 STORE PUSHI 8 LOAD NOOP POP NOOP PUSHI 1