Notes
This function is in beta test. Please help improve it in the issues
here.
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Memory Exceeded. And the exit code of your program is -9, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
4 3 3 1 4 7867441 4 3 1 4 708824 7867441 3 1 4 708824 7713371 7867441 2594475 -200 3 1 4 708824 7713371 4424144 7867441 2594475 -200 -200 -200 -200 3 1 4 708824 7713371 507644 4424144 7867441 2594475 2594475 -200 3 1 4 708824 2461619 7713371 9982645 507644 4424144 7867441 2594475 -200 -200 3 1 4 708824 2461619 7713371 9982645 507644 4424144 7867441 2594475 9982645 9982645 -200 -200 3 1 4 708824 2461619 7713371 3472282 9982645 507644 4424144 7867441 2594475 -200 3 1 4 708824 2461619 7713371 3472282 9982645 507644 4424144 7867441 2594475 -200 -200 3 1 4 708824 2461619 7713371 3472282 9982645 507644 4424144 7867441 2594475 9982645 -200 -200 3 1 4 708824 2461619 7713371 3472282 9982645 507644 4424144 774457 7867441 2594475 -200 -200 -200 -200 3 1 4 708824 2461619 7713371 3472282 9982645 507644 4424144 774457 7867441 2594475 -200 -200 9982645 -200 3 1 4 708824 2461619 7713371 3472282 9982645 507644 4424144 774457 7867441 2594475 -200 9982645 2594475 9982645 -200 3 1 4 708824 2461619 5379087 7713371 3472282 9982645
JOJ Answer
4 3 3 2 4 7867441 4 3 2 4 708824 7867441 3 2 4 708824 7713371 7867441 2594475 -200 3 2 4 708824 7713371 4424144 7867441 2594475 -200 -200 -200 -200 3 2 4 708824 7713371 507644 4424144 7867441 2594475 2594475 -200 3 2 4 708824 2461619 7713371 9982645 507644 4424144 7867441 2594475 -200 -200 3 2 4 708824 2461619 7713371 9982645 507644 4424144 7867441 2594475 9982645 9982645 -200 -200 3 2 4 708824 2461619 7713371 3472282 9982645 507644 4424144 7867441 2594475 -200 3 2 4 708824 2461619 7713371 3472282 9982645 507644 4424144 7867441 2594475 -200 -200 3 2 4 708824 2461619 7713371 3472282 9982645 507644 4424144 7867441 2594475 9982645 -200 -200 3 2 4 708824 2461619 7713371 3472282 9982645 507644 4424144 774457 7867441 2594475 -200 -200 -200 -200 3 2 4 708824 2461619 7713371 3472282 9982645 507644 4424144 774457 7867441 2594475 -200 -200 9982645 -200 3 2 4 708824 2461619 7713371 3472282 9982645 507644 4424144 774457 7867441 2594475 -200 9982645 2594475 9982645 -200 3 2 4 708824 2461619 5379087 7713371 3472282 9982645