{"ScriptPreparationCode":"/*your preparation JavaScript code goes here\r\nTo execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/\r\nasync function globalMeasureThatScriptPrepareFunction() {\r\n // This function is optional, feel free to remove it.\r\n // await someThing();\r\n}","TestCases":[{"Name":"Me","Code":"const arr = [8, 9, 3, 9, 6, 5, 1, 7, 3, 9, 4, 1, 7, 2, 8, 3, 2, 1, 4, 7];\r\n\r\nconst small5 = [arr[0]];\r\nconst big5 = [arr[0]];\r\n\r\nfor (const n of arr.slice(1)) {\r\n if (n \u003C small5[4] || small5.length \u003C 5) {\r\n for (let i = 0; i \u003C 5; \u002B\u002Bi) {\r\n if (n \u003C small5[i] || i === small5.length - 1) {\r\n small5.splice(i, 0, n);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (n \u003E big5[4] || big5.length \u003C 5) {\r\n for (let i = 0; i \u003C 5; \u002B\u002Bi) {\r\n if (n \u003E big5[i]) {\r\n big5.splice(i, 0, n);\r\n break;\r\n } else if (i === big5.length - 1) {\r\n big5.push(n);\r\n break;\r\n }\r\n }\r\n }\r\n}\r\n\r\nlet total = 0;\r\n\r\nfor (let i = 0; i \u003C 5; \u002B\u002Bi) {\r\n total \u002B= small5[i] \u002B big5[i];\r\n}","IsDeferred":false},{"Name":"Chatgpt","Code":"const arr = [8, 9, 3, 9, 6, 5, 1, 7, 3, 9, 4, 1, 7, 2, 8, 3, 2, 1, 4, 7];\r\nconst small5 = [];\r\nconst big5 = [];\r\n\r\nfor (const n of arr) {\r\n // Maintain 5 smallest numbers\r\n if (small5.length \u003C 5 || n \u003C small5[4]) {\r\n small5.push(n);\r\n small5.sort((a, b) =\u003E a - b); // Ensure the smallest numbers are sorted\r\n if (small5.length \u003E 5) small5.pop(); // Keep only the smallest 5\r\n }\r\n\r\n // Maintain 5 largest numbers\r\n if (big5.length \u003C 5 || n \u003E big5[4]) {\r\n big5.push(n);\r\n big5.sort((a, b) =\u003E b - a); // Ensure the largest numbers are sorted\r\n if (big5.length \u003E 5) big5.pop(); // Keep only the largest 5\r\n }\r\n}\r\n\r\n// Calculate the total sum\r\nconst total = small5.reduce((sum, num) =\u003E sum \u002B num, 0) \u002B\r\n big5.reduce((sum, num) =\u003E sum \u002B num, 0);","IsDeferred":false}]}