diff --git "a/pseudo_to_code_2k.jsonl" "b/pseudo_to_code_2k.jsonl" new file mode 100644--- /dev/null +++ "b/pseudo_to_code_2k.jsonl" @@ -0,0 +1,200 @@ +{"instance_id":"pseudo_to_code_2k_0","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmod = static integer = 1e9 + 7\ndefine the main function\n n, m are integers, row, col are integer arrays both of size 105, table is an integer array of sizes 105 and 105, minn and flag are integers\n while read n, m\n tmp = integer = 0\n call memset with row, 0, call sizeof with row\n call memset with col, 0, call sizeof with col\n for i = 1 to n inclusive\n for j = 1 to m inclusive, read table[i][j]\n end of the block\n if m is at least n\n for i = 1 to n inclusive\n set min to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set row[i] to minn\n for j = 1 to m inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n else\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set row[i] to minn\n iterate m times, subtract minn from table[i][j]\n end of the block\n end of the block\n end of the block\n set flag to 1\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if table[i][j]\n set flag to 0\n break\n end of the block\n if flag\n print tmp\n for i = 1 to n inclusive\n for k = 1 to row[i] inclusive, print \"row \", i\n end of the block\n for j = 1 to m inclusive\n for j = 1 to col[j] inclusive, print \"col \", j\n end of the block\n else\n print -1\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"static int mod = 1e9 + 7;\nint main() {\n int n, m, row[105], col[105], table[105][105], minn, flag;\n while (cin >> n >> m) {\n int tmp = 0;\n memset(row, 0, sizeof(row));\n memset(col, 0, sizeof(col));\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) cin >> table[i][j];\n }\n if (m >= n) {\n for (int i = 1; i <= n; i++) {\n minn = 0x3f3f3f3f;\n for (int j = 1; j <= m; j++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n tmp += minn;\n row[i] = minn;\n for (int j = 1; j <= m; j++) table[i][j] -= minn;\n }\n }\n for (int j = 1; j <= m; j++) {\n minn = 0x3f3f3f3f;\n for (int i = 1; i <= n; i++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n tmp += minn;\n col[j] = minn;\n for (int i = 1; i <= n; i++) table[i][j] -= minn;\n }\n }\n } else {\n for (int j = 1; j <= m; j++) {\n minn = 0x3f3f3f3f;\n for (int i = 1; i <= n; i++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n tmp += minn;\n col[j] = minn;\n for (int i = 1; i <= n; i++) table[i][j] -= minn;\n }\n }\n for (int i = 1; i <= n; i++) {\n minn = 0x3f3f3f3f;\n for (int j = 1; j <= m; j++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n tmp += minn;\n row[i] = minn;\n for (int j = 1; j <= m; j++) table[i][j] -= minn;\n }\n }\n }\n flag = 1;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= m; j++)\n if (table[i][j]) {\n flag = 0;\n break;\n }\n if (flag) {\n cout << tmp << '\\n';\n for (int i = 1; i <= n; i++) {\n for (int k = 1; k <= row[i]; k++) cout << \"row \" << i << '\\n';\n }\n for (int j = 1; j <= m; j++) {\n for (int k = 1; k <= col[j]; k++) cout << \"col \" << j << '\\n';\n }\n } else\n cout << \"-1\\n\";\n }\n return 0;\n}","item":{"problem_id":"815A","pseudocode":"mod = static integer = 1e9 + 7\ndefine the main function\n n, m are integers, row, col are integer arrays both of size 105, table is an integer array of sizes 105 and 105, minn and flag are integers\n while read n, m\n tmp = integer = 0\n call memset with row, 0, call sizeof with row\n call memset with col, 0, call sizeof with col\n for i = 1 to n inclusive\n for j = 1 to m inclusive, read table[i][j]\n end of the block\n if m is at least n\n for i = 1 to n inclusive\n set min to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set row[i] to minn\n for j = 1 to m inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n else\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set row[i] to minn\n iterate m times, subtract minn from table[i][j]\n end of the block\n end of the block\n end of the block\n set flag to 1\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if table[i][j]\n set flag to 0\n break\n end of the block\n if flag\n print tmp\n for i = 1 to n inclusive\n for k = 1 to row[i] inclusive, print \"row \", i\n end of the block\n for j = 1 to m inclusive\n for j = 1 to col[j] inclusive, print \"col \", j\n end of the block\n else\n print -1\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3 5","2 2 2 3 2","0 0 0 1 0","1 1 1 2 1"],["4","row 1","row 1","row 3","col 4"]],[["3 3","0 0 0","0 1 0","0 0 0"],["-1"]],[["3 3","1 1 1","1 1 1","1 1 1"],["3","row 1","row 2","row 3"]],[["3 5","2 4 2 2 3","0 2 0 0 1","1 3 1 1 2"],["6","row 1","row 1","row 3","col 2","col 2","col 5"]],[["3 5","0 0 0 0 0","0 0 0 0 0","0 0 0 0 1"],["-1"]],[["1 1","0"],["0"]],[["10 10","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","0 0 0 0 0 0 0 0 0 0","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1"],["9","row 1","row 2","row 3","row 4","row 6","row 7","row 8","row 9","row 10"]],[["10 10","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1"],["9","col 1","col 2","col 3","col 4","col 5","col 6","col 8","col 9","col 10"]],[["5 3","2 2 2","2 2 2","2 2 2","1 1 1","2 2 2"],["7","row 1","row 2","row 3","row 5","col 1","col 2","col 3"]],[["3 5","2 2 2 1 2","2 2 2 1 2","2 2 2 1 2"],["7","row 1","row 2","row 3","col 1","col 2","col 3","col 5"]],[["1 100","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"],["0"]],[["100 1","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0"]],[["1 100","1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"],["1","row 1"]],[["100 1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["2 1","1","1"],["1","col 1"]],[["4 3","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["2 1","2","2"],["2","col 1","col 1"]],[["3 2","1 1","1 1","1 1"],["2","col 1","col 2"]],[["2 1","1","2"],["2","row 2","col 1"]],[["2 3","1 1 1","1 1 1"],["2","row 1","row 2"]],[["1 2","1 1"],["1","row 1"]],[["5 1","1","1","1","1","1"],["1","col 1"]],[["2 1","10","10"],["10","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["4 3","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 1","1","1","1"],["1","col 1"]],[["8 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","2 2"],["2","row 1","row 1"]],[["3 2","2 3","2 3","2 3"],["5","col 1","col 1","col 2","col 2","col 2"]],[["2 1","3","3"],["3","col 1","col 1","col 1"]],[["6 2","1 1","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["4 1","1","1","1","1"],["1","col 1"]],[["2 5","1 1 1 1 1","1 1 1 1 1"],["2","row 1","row 2"]],[["5 2","1 1","2 2","2 2","2 2","2 2"],["6","row 2","row 3","row 4","row 5","col 1","col 2"]],[["4 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["5 2","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["1 4","1 1 1 1"],["1","row 1"]],[["3 1","2","3","2"],["3","row 2","col 1","col 1"]],[["1 5","1 1 1 1 1"],["1","row 1"]],[["2 4","3 1 1 1","3 1 1 1"],["4","row 1","row 2","col 1","col 1"]],[["3 3","1 1 1","0 1 0","0 0 0"],["-1"]],[["3 2","2 2","1 1","2 2"],["4","row 1","row 3","col 1","col 2"]],[["2 1","9","9"],["9","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["1 7","3 3 3 3 3 3 3"],["3","row 1","row 1","row 1"]],[["5 2","3 3","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["7 1","1","1","1","1","1","1","1"],["1","col 1"]],[["5 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["5 3","3 3 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["2 1","4","5"],["5","row 2","col 1","col 1","col 1","col 1"]],[["4 2","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["6 3","2 2 2","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["5 1","1","2","3","4","5"],["11","row 2","row 3","row 3","row 4","row 4","row 4","row 5","row 5","row 5","row 5","col 1"]],[["2 1","1","3"],["3","row 2","row 2","col 1"]],[["10 1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["6 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 5","1 1 1 1 1","1 1 1 1 1","1 1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 3","2 1 2","2 1 2"],["4","row 1","row 2","col 1","col 3"]],[["5 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","1 3"],["3","row 1","col 2","col 2"]],[["4 3","2 2 2","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["3 2","1 1","2 2","3 3"],["5","row 2","row 3","row 3","col 1","col 2"]],[["4 2","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["3 4","1 1 1 1","1 1 1 1","1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 1","2","3"],["3","row 2","col 1","col 1"]],[["5 3","2 2 2","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 2","1 0","2 1","2 1"],["3","row 2","row 3","col 1"]],[["3 2","1 2","2 3","3 4"],["6","row 2","row 3","row 3","col 1","col 2","col 2"]],[["3 3","1 1 1","1 2 1","1 1 1"],["-1"]],[["4 3","2 1 1","2 1 1","2 1 1","2 1 1"],["4","col 1","col 1","col 2","col 3"]],[["4 1","3","3","3","3"],["3","col 1","col 1","col 1"]],[["1 3","2 3 2"],["3","row 1","row 1","col 2"]],[["1 2","1 2"],["2","row 1","col 2"]],[["3 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 3","1 1 1"],["1","row 1"]],[["6 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["3 1","2","2","2"],["2","col 1","col 1"]],[["3 1","3","3","3"],["3","col 1","col 1","col 1"]],[["3 2","2 2","1 1","1 1"],["3","row 1","col 1","col 2"]],[["5 3","1 1 2","1 1 2","1 1 2","1 1 2","1 1 2"],["4","col 1","col 2","col 3","col 3"]],[["1 2","2 3"],["3","row 1","row 1","col 2"]],[["5 1","2","2","2","2","2"],["2","col 1","col 1"]],[["3 2","1 1","2 2","2 2"],["4","row 2","row 3","col 1","col 2"]],[["3 3","1 1 1","2 3 3","4 4 4"],["-1"]],[["2 1","5","2"],["5","row 1","row 1","row 1","col 1","col 1"]],[["4 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 2","5 10","5 10","5 10"],["15","col 1","col 1","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2"]],[["4 3","3 4 3","5 6 5","3 4 3","3 4 3"],["12","row 2","row 2","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 3","col 3","col 3"]],[["4 2","1 1","1 1","1 1","2 2"],["3","row 4","col 1","col 2"]],[["4 1","4","4","4","4"],["4","col 1","col 1","col 1","col 1"]],[["3 2","1 1","1 1","2 2"],["3","row 3","col 1","col 2"]],[["2 3","2 2 2","2 2 2"],["4","row 1","row 1","row 2","row 2"]],[["3 2","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["2 3","10 10 10","5 5 5"],["15","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 2","row 2","row 2","row 2","row 2"]],[["5 2","1 2","1 2","1 2","1 2","1 2"],["3","col 1","col 2","col 2"]],[["2 1","5","5"],["5","col 1","col 1","col 1","col 1","col 1"]]]}} +{"instance_id":"pseudo_to_code_2k_1","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlen=1005\nmod=998244353\nseed=131\nr,c=array of len int\ndd=array of len by len int\nnum,n,m\nflag=int\nfunction solve1 (no args, no return value)\n for i=1 to n inclusive\n minx=10^9\n for j=1 to m inclusive minx=min(minx,dd[i][j])\n r[i]=minx\n if r[i] is not 0 add minx to num\n for j=1 to m inclusive subtract minx from dd[i][j]\n end of the block\n for j=1 to m inclusive\n minx=10^9\n for i=1 to n inclusive minx=min(minx,dd[i][j])\n c[j]=minx\n if minx is not 0 add minx to num\n for i=1 to n inclusive\n subtract minx from dd[i][j]\n if dd[i][j] flag=1\n end of the block\n end of the block\nend of the block\nfunction solve1 (no args, no return value)\n for j=1 to m inclusive\n minx=10^9\n for i=1 to n inclusive minx=min(minx,dd[i][j])\n c[j]=minx\n if minx is not 0 add minx to num\n for i=1 to n inclusive subtract minx from dd[i][j]\n end of the block\n for i=1 to n inclusive\n minx=10^9\n for j=1 to m inclusive minx=min(minx,dd[i][j])\n r[i]=minx\n if r[i] is not 0 add minx to num\n for j=1 to m inclusive\n subtract minx from dd[i][j]\n if dd[i][j] flag=1\n end of the block\n end of the block\nend of the block\ndefine the main function\n read n,m\n for i=1 to n inclusive\n for j=1 to m inclusive read dd[i][j]\n if n<=m\n solve1()\n else\n solve2()\n if flag print -1 and return 0\n print num\n for i=1 to n inclusive\n for j=0 to r[i] exclusive print \"row \", i\n end of the block\n for i=1 to m inclusive\n for j=0 to c[i] exclusive print \"col \", i\nend of the block\n\n[CODE]:","reference_output":"const int len = 1e3 + 5;\nconst long long mod = 998244353;\nconst ulong long seed = 131;\nint r[len], c[len];\nint dd[len][len];\nint num, n, m;\nint flag;\nvoid solve1() {\n for (int i = 1; i <= n; ++i) {\n int minx = 1e9;\n for (int j = 1; j <= m; ++j) minx = min(minx, dd[i][j]);\n r[i] = minx;\n if (r[i] != 0) num += minx;\n for (int j = 1; j <= m; ++j) dd[i][j] -= minx;\n }\n for (int j = 1; j <= m; ++j) {\n int minx = 1e9;\n for (int i = 1; i <= n; ++i) minx = min(minx, dd[i][j]);\n c[j] = minx;\n if (minx != 0) num += minx;\n for (int i = 1; i <= n; ++i) {\n dd[i][j] -= minx;\n if (dd[i][j]) flag = 1;\n }\n }\n}\nvoid solve2() {\n for (int j = 1; j <= m; ++j) {\n int minx = 1e9;\n for (int i = 1; i <= n; ++i) minx = min(minx, dd[i][j]);\n c[j] = minx;\n if (minx != 0) num += minx;\n for (int i = 1; i <= n; ++i) dd[i][j] -= minx;\n }\n for (int i = 1; i <= n; ++i) {\n int minx = 1e9;\n for (int j = 1; j <= m; ++j) minx = min(minx, dd[i][j]);\n r[i] = minx;\n if (r[i] != 0) num += minx;\n for (int j = 1; j <= m; ++j) {\n dd[i][j] -= minx;\n if (dd[i][j]) flag = 1;\n }\n }\n}\nint main() {\n cin >> n >> m;\n for (int i = 1; i <= n; ++i)\n for (int j = 1; j <= m; ++j) cin >> dd[i][j];\n if (n <= m)\n solve1();\n else\n solve2();\n if (flag) return puts(\"-1\"), 0;\n cout << num << endl;\n for (int i = 1; i <= n; ++i) {\n for (int j = 0; j < r[i]; ++j) cout << \"row \" << i << endl;\n }\n for (int i = 1; i <= m; ++i)\n for (int j = 0; j < c[i]; ++j) cout << \"col \" << i << endl;\n}","item":{"problem_id":"815A","pseudocode":"len=1005\nmod=998244353\nseed=131\nr,c=array of len int\ndd=array of len by len int\nnum,n,m\nflag=int\nfunction solve1 (no args, no return value)\n for i=1 to n inclusive\n minx=10^9\n for j=1 to m inclusive minx=min(minx,dd[i][j])\n r[i]=minx\n if r[i] is not 0 add minx to num\n for j=1 to m inclusive subtract minx from dd[i][j]\n end of the block\n for j=1 to m inclusive\n minx=10^9\n for i=1 to n inclusive minx=min(minx,dd[i][j])\n c[j]=minx\n if minx is not 0 add minx to num\n for i=1 to n inclusive\n subtract minx from dd[i][j]\n if dd[i][j] flag=1\n end of the block\n end of the block\nend of the block\nfunction solve1 (no args, no return value)\n for j=1 to m inclusive\n minx=10^9\n for i=1 to n inclusive minx=min(minx,dd[i][j])\n c[j]=minx\n if minx is not 0 add minx to num\n for i=1 to n inclusive subtract minx from dd[i][j]\n end of the block\n for i=1 to n inclusive\n minx=10^9\n for j=1 to m inclusive minx=min(minx,dd[i][j])\n r[i]=minx\n if r[i] is not 0 add minx to num\n for j=1 to m inclusive\n subtract minx from dd[i][j]\n if dd[i][j] flag=1\n end of the block\n end of the block\nend of the block\ndefine the main function\n read n,m\n for i=1 to n inclusive\n for j=1 to m inclusive read dd[i][j]\n if n<=m\n solve1()\n else\n solve2()\n if flag print -1 and return 0\n print num\n for i=1 to n inclusive\n for j=0 to r[i] exclusive print \"row \", i\n end of the block\n for i=1 to m inclusive\n for j=0 to c[i] exclusive print \"col \", i\nend of the block","testcases":[[["3 5","2 2 2 3 2","0 0 0 1 0","1 1 1 2 1"],["4","row 1","row 1","row 3","col 4"]],[["3 3","0 0 0","0 1 0","0 0 0"],["-1"]],[["3 3","1 1 1","1 1 1","1 1 1"],["3","row 1","row 2","row 3"]],[["3 5","2 4 2 2 3","0 2 0 0 1","1 3 1 1 2"],["6","row 1","row 1","row 3","col 2","col 2","col 5"]],[["3 5","0 0 0 0 0","0 0 0 0 0","0 0 0 0 1"],["-1"]],[["1 1","0"],["0"]],[["10 10","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","0 0 0 0 0 0 0 0 0 0","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1"],["9","row 1","row 2","row 3","row 4","row 6","row 7","row 8","row 9","row 10"]],[["10 10","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1"],["9","col 1","col 2","col 3","col 4","col 5","col 6","col 8","col 9","col 10"]],[["5 3","2 2 2","2 2 2","2 2 2","1 1 1","2 2 2"],["7","row 1","row 2","row 3","row 5","col 1","col 2","col 3"]],[["3 5","2 2 2 1 2","2 2 2 1 2","2 2 2 1 2"],["7","row 1","row 2","row 3","col 1","col 2","col 3","col 5"]],[["1 100","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"],["0"]],[["100 1","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0"]],[["1 100","1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"],["1","row 1"]],[["100 1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["2 1","1","1"],["1","col 1"]],[["4 3","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["2 1","2","2"],["2","col 1","col 1"]],[["3 2","1 1","1 1","1 1"],["2","col 1","col 2"]],[["2 1","1","2"],["2","row 2","col 1"]],[["2 3","1 1 1","1 1 1"],["2","row 1","row 2"]],[["1 2","1 1"],["1","row 1"]],[["5 1","1","1","1","1","1"],["1","col 1"]],[["2 1","10","10"],["10","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["4 3","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 1","1","1","1"],["1","col 1"]],[["8 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","2 2"],["2","row 1","row 1"]],[["3 2","2 3","2 3","2 3"],["5","col 1","col 1","col 2","col 2","col 2"]],[["2 1","3","3"],["3","col 1","col 1","col 1"]],[["6 2","1 1","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["4 1","1","1","1","1"],["1","col 1"]],[["2 5","1 1 1 1 1","1 1 1 1 1"],["2","row 1","row 2"]],[["5 2","1 1","2 2","2 2","2 2","2 2"],["6","row 2","row 3","row 4","row 5","col 1","col 2"]],[["4 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["5 2","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["1 4","1 1 1 1"],["1","row 1"]],[["3 1","2","3","2"],["3","row 2","col 1","col 1"]],[["1 5","1 1 1 1 1"],["1","row 1"]],[["2 4","3 1 1 1","3 1 1 1"],["4","row 1","row 2","col 1","col 1"]],[["3 3","1 1 1","0 1 0","0 0 0"],["-1"]],[["3 2","2 2","1 1","2 2"],["4","row 1","row 3","col 1","col 2"]],[["2 1","9","9"],["9","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["1 7","3 3 3 3 3 3 3"],["3","row 1","row 1","row 1"]],[["5 2","3 3","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["7 1","1","1","1","1","1","1","1"],["1","col 1"]],[["5 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["5 3","3 3 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["2 1","4","5"],["5","row 2","col 1","col 1","col 1","col 1"]],[["4 2","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["6 3","2 2 2","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["5 1","1","2","3","4","5"],["11","row 2","row 3","row 3","row 4","row 4","row 4","row 5","row 5","row 5","row 5","col 1"]],[["2 1","1","3"],["3","row 2","row 2","col 1"]],[["10 1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["6 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 5","1 1 1 1 1","1 1 1 1 1","1 1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 3","2 1 2","2 1 2"],["4","row 1","row 2","col 1","col 3"]],[["5 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","1 3"],["3","row 1","col 2","col 2"]],[["4 3","2 2 2","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["3 2","1 1","2 2","3 3"],["5","row 2","row 3","row 3","col 1","col 2"]],[["4 2","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["3 4","1 1 1 1","1 1 1 1","1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 1","2","3"],["3","row 2","col 1","col 1"]],[["5 3","2 2 2","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 2","1 0","2 1","2 1"],["3","row 2","row 3","col 1"]],[["3 2","1 2","2 3","3 4"],["6","row 2","row 3","row 3","col 1","col 2","col 2"]],[["3 3","1 1 1","1 2 1","1 1 1"],["-1"]],[["4 3","2 1 1","2 1 1","2 1 1","2 1 1"],["4","col 1","col 1","col 2","col 3"]],[["4 1","3","3","3","3"],["3","col 1","col 1","col 1"]],[["1 3","2 3 2"],["3","row 1","row 1","col 2"]],[["1 2","1 2"],["2","row 1","col 2"]],[["3 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 3","1 1 1"],["1","row 1"]],[["6 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["3 1","2","2","2"],["2","col 1","col 1"]],[["3 1","3","3","3"],["3","col 1","col 1","col 1"]],[["3 2","2 2","1 1","1 1"],["3","row 1","col 1","col 2"]],[["5 3","1 1 2","1 1 2","1 1 2","1 1 2","1 1 2"],["4","col 1","col 2","col 3","col 3"]],[["1 2","2 3"],["3","row 1","row 1","col 2"]],[["5 1","2","2","2","2","2"],["2","col 1","col 1"]],[["3 2","1 1","2 2","2 2"],["4","row 2","row 3","col 1","col 2"]],[["3 3","1 1 1","2 3 3","4 4 4"],["-1"]],[["2 1","5","2"],["5","row 1","row 1","row 1","col 1","col 1"]],[["4 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 2","5 10","5 10","5 10"],["15","col 1","col 1","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2"]],[["4 3","3 4 3","5 6 5","3 4 3","3 4 3"],["12","row 2","row 2","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 3","col 3","col 3"]],[["4 2","1 1","1 1","1 1","2 2"],["3","row 4","col 1","col 2"]],[["4 1","4","4","4","4"],["4","col 1","col 1","col 1","col 1"]],[["3 2","1 1","1 1","2 2"],["3","row 3","col 1","col 2"]],[["2 3","2 2 2","2 2 2"],["4","row 1","row 1","row 2","row 2"]],[["3 2","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["2 3","10 10 10","5 5 5"],["15","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 2","row 2","row 2","row 2","row 2"]],[["5 2","1 2","1 2","1 2","1 2","1 2"],["3","col 1","col 2","col 2"]],[["2 1","5","5"],["5","col 1","col 1","col 1","col 1","col 1"]]]}} +{"instance_id":"pseudo_to_code_2k_2","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmake static int mod = 1e9 + 7\ndefine the main function\n make int n, m, array row of size 105, array col of size 105, multidimensional array table of size 105x105, minn, and flag\n while read n and m\n set flag to 0\n set row elements to 0\n set col elements to 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive, read table[i][j]\n end of the block\n if m greater than or equal to n\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] less than minn, set minn to table[i][j]\n end of the block\n if minn\n set row[i] to minn\n for j = 1 to m inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] less than minn, set minn to table[i]j]\n end of the block\n if minn\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n else\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] less than minn, set minn to table[i][j]\n end of the block\n if minn\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n set row[i] to minn\n for j = 1 to m inclusive, decrease table[i][j] by minn\n end of the block\n end of the block\n end of the block\n set flag to 1\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if table[i][j]\n set flag to 0\n break\n end of the block\n end of the block\n if flag\n make int tmp = 0\n for i = 1 to n inclusive, increase tmp by row[i]\n for j = 1 to m inclusive, increase tmp by col[j]\n print tmp\n for i = 1 to n inclusive\n for k = 1 to row[i] inclusive, print \"row \" i\n end of the block\n for j = 1 to m inclusive\n for k = 1 to col[j] inclusive, print \"col \" j\n end of the block\n else\n print \"-1\\n\"\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"static int mod = 1e9 + 7;\nint main() {\n int n, m, row[105], col[105], table[105][105], minn, flag;\n while (cin >> n >> m) {\n flag = 0;\n memset(row, 0, sizeof(row));\n memset(col, 0, sizeof(col));\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) cin >> table[i][j];\n }\n if (m >= n) {\n for (int i = 1; i <= n; i++) {\n minn = 0x3f3f3f3f;\n for (int j = 1; j <= m; j++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n row[i] = minn;\n for (int j = 1; j <= m; j++) table[i][j] -= minn;\n }\n }\n for (int j = 1; j <= m; j++) {\n minn = 0x3f3f3f3f;\n for (int i = 1; i <= n; i++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n col[j] = minn;\n for (int i = 1; i <= n; i++) table[i][j] -= minn;\n }\n }\n } else {\n for (int j = 1; j <= m; j++) {\n minn = 0x3f3f3f3f;\n for (int i = 1; i <= n; i++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n col[j] = minn;\n for (int i = 1; i <= n; i++) table[i][j] -= minn;\n }\n }\n for (int i = 1; i <= n; i++) {\n minn = 0x3f3f3f3f;\n for (int j = 1; j <= m; j++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n row[i] = minn;\n for (int j = 1; j <= m; j++) table[i][j] -= minn;\n }\n }\n }\n flag = 1;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= m; j++) {\n if (table[i][j]) {\n flag = 0;\n break;\n }\n }\n if (flag) {\n int tmp = 0;\n for (int i = 1; i <= n; i++) { tmp += row[i]; }\n for (int j = 1; j <= m; j++) { tmp += col[j]; }\n cout << tmp << '\\n';\n for (int i = 1; i <= n; i++) {\n for (int k = 1; k <= row[i]; k++) cout << \"row \" << i << '\\n';\n }\n for (int j = 1; j <= m; j++) {\n for (int k = 1; k <= col[j]; k++) cout << \"col \" << j << '\\n';\n }\n } else\n cout << \"-1\\n\";\n }\n return 0;\n}","item":{"problem_id":"815A","pseudocode":"make static int mod = 1e9 + 7\ndefine the main function\n make int n, m, array row of size 105, array col of size 105, multidimensional array table of size 105x105, minn, and flag\n while read n and m\n set flag to 0\n set row elements to 0\n set col elements to 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive, read table[i][j]\n end of the block\n if m greater than or equal to n\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] less than minn, set minn to table[i][j]\n end of the block\n if minn\n set row[i] to minn\n for j = 1 to m inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] less than minn, set minn to table[i]j]\n end of the block\n if minn\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n else\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] less than minn, set minn to table[i][j]\n end of the block\n if minn\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n set row[i] to minn\n for j = 1 to m inclusive, decrease table[i][j] by minn\n end of the block\n end of the block\n end of the block\n set flag to 1\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if table[i][j]\n set flag to 0\n break\n end of the block\n end of the block\n if flag\n make int tmp = 0\n for i = 1 to n inclusive, increase tmp by row[i]\n for j = 1 to m inclusive, increase tmp by col[j]\n print tmp\n for i = 1 to n inclusive\n for k = 1 to row[i] inclusive, print \"row \" i\n end of the block\n for j = 1 to m inclusive\n for k = 1 to col[j] inclusive, print \"col \" j\n end of the block\n else\n print \"-1\\n\"\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3 5","2 2 2 3 2","0 0 0 1 0","1 1 1 2 1"],["4","row 1","row 1","row 3","col 4"]],[["3 3","0 0 0","0 1 0","0 0 0"],["-1"]],[["3 3","1 1 1","1 1 1","1 1 1"],["3","row 1","row 2","row 3"]],[["3 5","2 4 2 2 3","0 2 0 0 1","1 3 1 1 2"],["6","row 1","row 1","row 3","col 2","col 2","col 5"]],[["3 5","0 0 0 0 0","0 0 0 0 0","0 0 0 0 1"],["-1"]],[["1 1","0"],["0"]],[["10 10","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","0 0 0 0 0 0 0 0 0 0","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1"],["9","row 1","row 2","row 3","row 4","row 6","row 7","row 8","row 9","row 10"]],[["10 10","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1"],["9","col 1","col 2","col 3","col 4","col 5","col 6","col 8","col 9","col 10"]],[["5 3","2 2 2","2 2 2","2 2 2","1 1 1","2 2 2"],["7","row 1","row 2","row 3","row 5","col 1","col 2","col 3"]],[["3 5","2 2 2 1 2","2 2 2 1 2","2 2 2 1 2"],["7","row 1","row 2","row 3","col 1","col 2","col 3","col 5"]],[["1 100","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"],["0"]],[["100 1","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0"]],[["1 100","1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"],["1","row 1"]],[["100 1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["2 1","1","1"],["1","col 1"]],[["4 3","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["2 1","2","2"],["2","col 1","col 1"]],[["3 2","1 1","1 1","1 1"],["2","col 1","col 2"]],[["2 1","1","2"],["2","row 2","col 1"]],[["2 3","1 1 1","1 1 1"],["2","row 1","row 2"]],[["1 2","1 1"],["1","row 1"]],[["5 1","1","1","1","1","1"],["1","col 1"]],[["2 1","10","10"],["10","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["4 3","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 1","1","1","1"],["1","col 1"]],[["8 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","2 2"],["2","row 1","row 1"]],[["3 2","2 3","2 3","2 3"],["5","col 1","col 1","col 2","col 2","col 2"]],[["2 1","3","3"],["3","col 1","col 1","col 1"]],[["6 2","1 1","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["4 1","1","1","1","1"],["1","col 1"]],[["2 5","1 1 1 1 1","1 1 1 1 1"],["2","row 1","row 2"]],[["5 2","1 1","2 2","2 2","2 2","2 2"],["6","row 2","row 3","row 4","row 5","col 1","col 2"]],[["4 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["5 2","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["1 4","1 1 1 1"],["1","row 1"]],[["3 1","2","3","2"],["3","row 2","col 1","col 1"]],[["1 5","1 1 1 1 1"],["1","row 1"]],[["2 4","3 1 1 1","3 1 1 1"],["4","row 1","row 2","col 1","col 1"]],[["3 3","1 1 1","0 1 0","0 0 0"],["-1"]],[["3 2","2 2","1 1","2 2"],["4","row 1","row 3","col 1","col 2"]],[["2 1","9","9"],["9","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["1 7","3 3 3 3 3 3 3"],["3","row 1","row 1","row 1"]],[["5 2","3 3","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["7 1","1","1","1","1","1","1","1"],["1","col 1"]],[["5 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["5 3","3 3 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["2 1","4","5"],["5","row 2","col 1","col 1","col 1","col 1"]],[["4 2","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["6 3","2 2 2","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["5 1","1","2","3","4","5"],["11","row 2","row 3","row 3","row 4","row 4","row 4","row 5","row 5","row 5","row 5","col 1"]],[["2 1","1","3"],["3","row 2","row 2","col 1"]],[["10 1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["6 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 5","1 1 1 1 1","1 1 1 1 1","1 1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 3","2 1 2","2 1 2"],["4","row 1","row 2","col 1","col 3"]],[["5 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","1 3"],["3","row 1","col 2","col 2"]],[["4 3","2 2 2","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["3 2","1 1","2 2","3 3"],["5","row 2","row 3","row 3","col 1","col 2"]],[["4 2","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["3 4","1 1 1 1","1 1 1 1","1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 1","2","3"],["3","row 2","col 1","col 1"]],[["5 3","2 2 2","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 2","1 0","2 1","2 1"],["3","row 2","row 3","col 1"]],[["3 2","1 2","2 3","3 4"],["6","row 2","row 3","row 3","col 1","col 2","col 2"]],[["3 3","1 1 1","1 2 1","1 1 1"],["-1"]],[["4 3","2 1 1","2 1 1","2 1 1","2 1 1"],["4","col 1","col 1","col 2","col 3"]],[["4 1","3","3","3","3"],["3","col 1","col 1","col 1"]],[["1 3","2 3 2"],["3","row 1","row 1","col 2"]],[["1 2","1 2"],["2","row 1","col 2"]],[["3 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 3","1 1 1"],["1","row 1"]],[["6 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["3 1","2","2","2"],["2","col 1","col 1"]],[["3 1","3","3","3"],["3","col 1","col 1","col 1"]],[["3 2","2 2","1 1","1 1"],["3","row 1","col 1","col 2"]],[["5 3","1 1 2","1 1 2","1 1 2","1 1 2","1 1 2"],["4","col 1","col 2","col 3","col 3"]],[["1 2","2 3"],["3","row 1","row 1","col 2"]],[["5 1","2","2","2","2","2"],["2","col 1","col 1"]],[["3 2","1 1","2 2","2 2"],["4","row 2","row 3","col 1","col 2"]],[["3 3","1 1 1","2 3 3","4 4 4"],["-1"]],[["2 1","5","2"],["5","row 1","row 1","row 1","col 1","col 1"]],[["4 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 2","5 10","5 10","5 10"],["15","col 1","col 1","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2"]],[["4 3","3 4 3","5 6 5","3 4 3","3 4 3"],["12","row 2","row 2","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 3","col 3","col 3"]],[["4 2","1 1","1 1","1 1","2 2"],["3","row 4","col 1","col 2"]],[["4 1","4","4","4","4"],["4","col 1","col 1","col 1","col 1"]],[["3 2","1 1","1 1","2 2"],["3","row 3","col 1","col 2"]],[["2 3","2 2 2","2 2 2"],["4","row 1","row 1","row 2","row 2"]],[["3 2","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["2 3","10 10 10","5 5 5"],["15","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 2","row 2","row 2","row 2","row 2"]],[["5 2","1 2","1 2","1 2","1 2","1 2"],["3","col 1","col 2","col 2"]],[["2 1","5","5"],["5","col 1","col 1","col 1","col 1","col 1"]]]}} +{"instance_id":"pseudo_to_code_2k_3","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet INF be const integer with INF = 0x3f3f3f3f\ndefine the main function\n let n, m be integers\n read n, m\n let ans, ar be array of size 105 by 105 with ans = ar = {0}\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n read ans[i][j]\n set ar[i][j] to ans[i][j]\n end of the block\n let mins, sum be integers with mins = INF and sum = 0\n let temp be integer array of size 6 by 200 with temp = {0}\n for i = 1 to n inclusive\n set mins to INF\n for j = 1 to m inclusive, set mins to min of mins, ans[i][j]\n set temp[1][i] to mins\n for j = 1 to m inclusive, set ans[i][j] to ans[i][j] - mins\n end of the block\n for j = 1 to m inclusive\n set mins to INF\n for i = 1 to n inclusive, set mins to min of mins, ans[i][j]\n set temp[2][j] to mins\n for i = 1 to n inclusive, decrement ans[i][j] by mins\n end of the block\n for j = 1 to m inclusive\n set mins to INF\n for i = 1 to n inclusive, set mins to min of mins, ar[i][j]\n set temp[3][j] to mins\n for i = 1 to n inclusive, set ar[i][j] to ar[i][j] - mins\n end of the block\n for i = 1 to n inclusive\n set mins to iNF\n for j = 1 to m inclusive, mins = min of mins, ar[i][j]\n temp[4][i] = mins\n for j = 1 to m inclusive, decrement ar[i][j] by mins\n end of the block\n let flag1, flag2 be integers with flag1 = flag2 = 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if ans[i][j] != 0\n set flag1 to 1\n break\n end of the block\n end of the block\n end of the block\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if ar[i][j] != 0\n set flag2 to 0\n break\n end of the block\n end of the block\n end of the block\n if flag1 == 1 and flag2 == 1\n print -1\n else if flag1 == 0 and flag2 == 0\n sum1 = sum2 = integer = 0\n for i = 1 to n inclusive\n increment sum1 by temp[1][i]\n increment sum2 by temp[4][i]\n end of the block\n for j = 1 to m inclusive\n increment sum1 by temp[2][j]\n increment sum2 by temp[3][j]\n end of the block\n if sum1 > sum2\n print sum2\n for i = 1 to n inclusive\n for j = 1 to temp[4][i], print row, i\n for j = 1 to m inclusive\n for i = 1 to temp[3][j] inclusive, print col, j\n else\n print sum1\n for i = 1 to n inclusive\n for j = 1 to temp[1][i], print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[2][j] inclusive, print \"col \", j\n end of the block\n else if flag1 == 1\n let sum2 be integer with sum2 = 0\n for i = 1 to n inclusive, increment sum2 by temp[4][i]\n for j = 1 to n inclusive, increment sum2 by temp[3][j]\n print sum2\n for i = 1 to n inclusive\n for j = 1 to temp[4][i] inclusive, print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[3][j] inclusive, print \"col \", j\n else if flag2 == 1\n sum1 = int = 0\n for i = 1 to n inclusive, increment sum1 by temp[4][i]\n for j = 1 to n inclusive, increment sum1 by temp[3][j]\n print sum1\n for i = 1 to n inclusive\n for j = 1 to temp[1][i] inclusive, print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[2][j] inclusive, print \"col \", j\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int INF = 0x3f3f3f3f;\nint main() {\n int n, m;\n cin >> n >> m;\n int ans[105][105] = {0}, ar[105][105] = {0};\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= m; j++) {\n cin >> ans[i][j];\n ar[i][j] = ans[i][j];\n }\n int mins = INF, sum = 0;\n int temp[6][200] = {0};\n for (int i = 1; i <= n; i++) {\n mins = INF;\n for (int j = 1; j <= m; j++) mins = min(mins, ans[i][j]);\n temp[1][i] = mins;\n for (int j = 1; j <= m; j++) ans[i][j] -= mins;\n }\n for (int j = 1; j <= m; j++) {\n mins = INF;\n for (int i = 1; i <= n; i++) mins = min(mins, ans[i][j]);\n temp[2][j] = mins;\n for (int i = 1; i <= n; i++) ans[i][j] -= mins;\n }\n for (int j = 1; j <= m; j++) {\n mins = INF;\n for (int i = 1; i <= n; i++) mins = min(mins, ar[i][j]);\n temp[3][j] = mins;\n for (int i = 1; i <= n; i++) ar[i][j] -= mins;\n }\n for (int i = 1; i <= n; i++) {\n mins = INF;\n for (int j = 1; j <= m; j++) mins = min(mins, ar[i][j]);\n temp[4][i] = mins;\n for (int j = 1; j <= m; j++) ar[i][j] -= mins;\n }\n int flag1 = 0, flag2 = 0;\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n if (ans[i][j] != 0) {\n flag1 = 1;\n break;\n }\n }\n }\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n if (ar[i][j] != 0) {\n flag2 = 1;\n break;\n }\n }\n }\n if (flag1 == 1 && flag2 == 1)\n cout << -1 << endl;\n else if (flag1 == 0 && flag2 == 0) {\n int sum1 = 0, sum2 = 0;\n for (int i = 1; i <= n; i++) {\n sum1 += temp[1][i];\n sum2 += temp[4][i];\n }\n for (int j = 1; j <= m; j++) {\n sum1 += temp[2][j];\n sum2 += temp[3][j];\n }\n if (sum1 > sum2) {\n cout << sum2 << endl;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= temp[4][i]; j++) cout << \"row \" << i << endl;\n for (int j = 1; j <= m; j++)\n for (int i = 1; i <= temp[3][j]; i++) cout << \"col \" << j << endl;\n } else {\n cout << sum1 << endl;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= temp[1][i]; j++) cout << \"row \" << i << endl;\n for (int j = 1; j <= m; j++)\n for (int i = 1; i <= temp[2][j]; i++) cout << \"col \" << j << endl;\n }\n } else if (flag1 == 1) {\n int sum2 = 0;\n for (int i = 1; i <= n; i++) { sum2 += temp[4][i]; }\n for (int j = 1; j <= m; j++) { sum2 += temp[3][j]; }\n cout << sum2 << endl;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= temp[4][i]; j++) cout << \"row \" << i << endl;\n for (int j = 1; j <= m; j++)\n for (int i = 1; i <= temp[3][j]; i++) cout << \"col \" << j << endl;\n } else if (flag2 == 1) {\n int sum1 = 0;\n for (int i = 1; i <= n; i++) { sum1 += temp[4][i]; }\n for (int j = 1; j <= m; j++) { sum1 += temp[3][j]; }\n cout << sum1 << endl;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= temp[1][i]; j++) cout << \"row \" << i << endl;\n for (int j = 1; j <= m; j++)\n for (int i = 1; i <= temp[2][j]; i++) cout << \"col \" << j << endl;\n }\n return 0;\n}","item":{"problem_id":"815A","pseudocode":"let INF be const integer with INF = 0x3f3f3f3f\ndefine the main function\n let n, m be integers\n read n, m\n let ans, ar be array of size 105 by 105 with ans = ar = {0}\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n read ans[i][j]\n set ar[i][j] to ans[i][j]\n end of the block\n let mins, sum be integers with mins = INF and sum = 0\n let temp be integer array of size 6 by 200 with temp = {0}\n for i = 1 to n inclusive\n set mins to INF\n for j = 1 to m inclusive, set mins to min of mins, ans[i][j]\n set temp[1][i] to mins\n for j = 1 to m inclusive, set ans[i][j] to ans[i][j] - mins\n end of the block\n for j = 1 to m inclusive\n set mins to INF\n for i = 1 to n inclusive, set mins to min of mins, ans[i][j]\n set temp[2][j] to mins\n for i = 1 to n inclusive, decrement ans[i][j] by mins\n end of the block\n for j = 1 to m inclusive\n set mins to INF\n for i = 1 to n inclusive, set mins to min of mins, ar[i][j]\n set temp[3][j] to mins\n for i = 1 to n inclusive, set ar[i][j] to ar[i][j] - mins\n end of the block\n for i = 1 to n inclusive\n set mins to iNF\n for j = 1 to m inclusive, mins = min of mins, ar[i][j]\n temp[4][i] = mins\n for j = 1 to m inclusive, decrement ar[i][j] by mins\n end of the block\n let flag1, flag2 be integers with flag1 = flag2 = 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if ans[i][j] != 0\n set flag1 to 1\n break\n end of the block\n end of the block\n end of the block\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if ar[i][j] != 0\n set flag2 to 0\n break\n end of the block\n end of the block\n end of the block\n if flag1 == 1 and flag2 == 1\n print -1\n else if flag1 == 0 and flag2 == 0\n sum1 = sum2 = integer = 0\n for i = 1 to n inclusive\n increment sum1 by temp[1][i]\n increment sum2 by temp[4][i]\n end of the block\n for j = 1 to m inclusive\n increment sum1 by temp[2][j]\n increment sum2 by temp[3][j]\n end of the block\n if sum1 > sum2\n print sum2\n for i = 1 to n inclusive\n for j = 1 to temp[4][i], print row, i\n for j = 1 to m inclusive\n for i = 1 to temp[3][j] inclusive, print col, j\n else\n print sum1\n for i = 1 to n inclusive\n for j = 1 to temp[1][i], print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[2][j] inclusive, print \"col \", j\n end of the block\n else if flag1 == 1\n let sum2 be integer with sum2 = 0\n for i = 1 to n inclusive, increment sum2 by temp[4][i]\n for j = 1 to n inclusive, increment sum2 by temp[3][j]\n print sum2\n for i = 1 to n inclusive\n for j = 1 to temp[4][i] inclusive, print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[3][j] inclusive, print \"col \", j\n else if flag2 == 1\n sum1 = int = 0\n for i = 1 to n inclusive, increment sum1 by temp[4][i]\n for j = 1 to n inclusive, increment sum1 by temp[3][j]\n print sum1\n for i = 1 to n inclusive\n for j = 1 to temp[1][i] inclusive, print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[2][j] inclusive, print \"col \", j\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3 5","2 2 2 3 2","0 0 0 1 0","1 1 1 2 1"],["4","row 1","row 1","row 3","col 4"]],[["3 3","0 0 0","0 1 0","0 0 0"],["-1"]],[["3 3","1 1 1","1 1 1","1 1 1"],["3","row 1","row 2","row 3"]],[["3 5","2 4 2 2 3","0 2 0 0 1","1 3 1 1 2"],["6","row 1","row 1","row 3","col 2","col 2","col 5"]],[["3 5","0 0 0 0 0","0 0 0 0 0","0 0 0 0 1"],["-1"]],[["1 1","0"],["0"]],[["10 10","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","0 0 0 0 0 0 0 0 0 0","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1"],["9","row 1","row 2","row 3","row 4","row 6","row 7","row 8","row 9","row 10"]],[["10 10","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1"],["9","col 1","col 2","col 3","col 4","col 5","col 6","col 8","col 9","col 10"]],[["5 3","2 2 2","2 2 2","2 2 2","1 1 1","2 2 2"],["7","row 1","row 2","row 3","row 5","col 1","col 2","col 3"]],[["3 5","2 2 2 1 2","2 2 2 1 2","2 2 2 1 2"],["7","row 1","row 2","row 3","col 1","col 2","col 3","col 5"]],[["1 100","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"],["0"]],[["100 1","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0"]],[["1 100","1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"],["1","row 1"]],[["100 1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["2 1","1","1"],["1","col 1"]],[["4 3","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["2 1","2","2"],["2","col 1","col 1"]],[["3 2","1 1","1 1","1 1"],["2","col 1","col 2"]],[["2 1","1","2"],["2","row 2","col 1"]],[["2 3","1 1 1","1 1 1"],["2","row 1","row 2"]],[["1 2","1 1"],["1","row 1"]],[["5 1","1","1","1","1","1"],["1","col 1"]],[["2 1","10","10"],["10","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["4 3","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 1","1","1","1"],["1","col 1"]],[["8 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","2 2"],["2","row 1","row 1"]],[["3 2","2 3","2 3","2 3"],["5","col 1","col 1","col 2","col 2","col 2"]],[["2 1","3","3"],["3","col 1","col 1","col 1"]],[["6 2","1 1","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["4 1","1","1","1","1"],["1","col 1"]],[["2 5","1 1 1 1 1","1 1 1 1 1"],["2","row 1","row 2"]],[["5 2","1 1","2 2","2 2","2 2","2 2"],["6","row 2","row 3","row 4","row 5","col 1","col 2"]],[["4 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["5 2","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["1 4","1 1 1 1"],["1","row 1"]],[["3 1","2","3","2"],["3","row 2","col 1","col 1"]],[["1 5","1 1 1 1 1"],["1","row 1"]],[["2 4","3 1 1 1","3 1 1 1"],["4","row 1","row 2","col 1","col 1"]],[["3 3","1 1 1","0 1 0","0 0 0"],["-1"]],[["3 2","2 2","1 1","2 2"],["4","row 1","row 3","col 1","col 2"]],[["2 1","9","9"],["9","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["1 7","3 3 3 3 3 3 3"],["3","row 1","row 1","row 1"]],[["5 2","3 3","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["7 1","1","1","1","1","1","1","1"],["1","col 1"]],[["5 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["5 3","3 3 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["2 1","4","5"],["5","row 2","col 1","col 1","col 1","col 1"]],[["4 2","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["6 3","2 2 2","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["5 1","1","2","3","4","5"],["11","row 2","row 3","row 3","row 4","row 4","row 4","row 5","row 5","row 5","row 5","col 1"]],[["2 1","1","3"],["3","row 2","row 2","col 1"]],[["10 1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["6 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 5","1 1 1 1 1","1 1 1 1 1","1 1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 3","2 1 2","2 1 2"],["4","row 1","row 2","col 1","col 3"]],[["5 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","1 3"],["3","row 1","col 2","col 2"]],[["4 3","2 2 2","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["3 2","1 1","2 2","3 3"],["5","row 2","row 3","row 3","col 1","col 2"]],[["4 2","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["3 4","1 1 1 1","1 1 1 1","1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 1","2","3"],["3","row 2","col 1","col 1"]],[["5 3","2 2 2","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 2","1 0","2 1","2 1"],["3","row 2","row 3","col 1"]],[["3 2","1 2","2 3","3 4"],["6","row 2","row 3","row 3","col 1","col 2","col 2"]],[["3 3","1 1 1","1 2 1","1 1 1"],["-1"]],[["4 3","2 1 1","2 1 1","2 1 1","2 1 1"],["4","col 1","col 1","col 2","col 3"]],[["4 1","3","3","3","3"],["3","col 1","col 1","col 1"]],[["1 3","2 3 2"],["3","row 1","row 1","col 2"]],[["1 2","1 2"],["2","row 1","col 2"]],[["3 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 3","1 1 1"],["1","row 1"]],[["6 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["3 1","2","2","2"],["2","col 1","col 1"]],[["3 1","3","3","3"],["3","col 1","col 1","col 1"]],[["3 2","2 2","1 1","1 1"],["3","row 1","col 1","col 2"]],[["5 3","1 1 2","1 1 2","1 1 2","1 1 2","1 1 2"],["4","col 1","col 2","col 3","col 3"]],[["1 2","2 3"],["3","row 1","row 1","col 2"]],[["5 1","2","2","2","2","2"],["2","col 1","col 1"]],[["3 2","1 1","2 2","2 2"],["4","row 2","row 3","col 1","col 2"]],[["3 3","1 1 1","2 3 3","4 4 4"],["-1"]],[["2 1","5","2"],["5","row 1","row 1","row 1","col 1","col 1"]],[["4 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 2","5 10","5 10","5 10"],["15","col 1","col 1","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2"]],[["4 3","3 4 3","5 6 5","3 4 3","3 4 3"],["12","row 2","row 2","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 3","col 3","col 3"]],[["4 2","1 1","1 1","1 1","2 2"],["3","row 4","col 1","col 2"]],[["4 1","4","4","4","4"],["4","col 1","col 1","col 1","col 1"]],[["3 2","1 1","1 1","2 2"],["3","row 3","col 1","col 2"]],[["2 3","2 2 2","2 2 2"],["4","row 1","row 1","row 2","row 2"]],[["3 2","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["2 3","10 10 10","5 5 5"],["15","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 2","row 2","row 2","row 2","row 2"]],[["5 2","1 2","1 2","1 2","1 2","1 2"],["3","col 1","col 2","col 2"]],[["2 1","5","5"],["5","col 1","col 1","col 1","col 1","col 1"]]]}} +{"instance_id":"pseudo_to_code_2k_4","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmake static int mod = 1e9 + 7\ndefine the main function\n make int n, m, array row of size 105, array col of size 105, multidimensional array table of size 105x105, minn, and flag\n while read n and m\n set flag to 0\n set row elements to 0\n set col elements to 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive, read table[i][j]\n end of the block\n if m greater than or equal to n\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] less than minn, set minn to table[i][j]\n end of the block\n if minn\n set row[i] to minn\n for j = 1 to m inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] less than minn, set minn to table[i]j]\n end of the block\n if minn\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n else\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] less than minn, set minn to table[i][j]\n end of the block\n if minn\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n set row[i] to minn\n for j = 1 to m inclusive, decrease table[i][j] by minn\n end of the block\n end of the block\n end of the block\n set flag to 1\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if table[i][j]\n set flag to 0\n break\n end of the block\n end of the block\n if flag\n make int tmp = 0\n for i = 1 to n inclusive, increase tmp by row[i]\n for j = 1 to m inclusive, increase tmp by col[j]\n print tmp\n for i = 1 to n inclusive\n for k = 1 to row[i] inclusive, print \"row \" i\n end of the block\n for j = 1 to m inclusive\n for k = 1 to col[j] inclusive, print \"col \" j\n end of the block\n else\n print \"-1\\n\"\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"static int mod = 1e9 + 7;\nint main() {\n int n, m, row[105], col[105], table[105][105], minn, flag;\n while (cin >> n >> m) {\n flag = 0;\n memset(row, 0, sizeof(row));\n memset(col, 0, sizeof(col));\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) cin >> table[i][j];\n }\n if (m >= n) {\n for (int i = 1; i <= n; i++) {\n minn = 0x3f3f3f3f;\n for (int j = 1; j <= m; j++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n row[i] = minn;\n for (int j = 1; j <= m; j++) table[i][j] -= minn;\n }\n }\n for (int j = 1; j <= m; j++) {\n minn = 0x3f3f3f3f;\n for (int i = 1; i <= n; i++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n col[j] = minn;\n for (int i = 1; i <= n; i++) table[i][j] -= minn;\n }\n }\n } else {\n for (int j = 1; j <= m; j++) {\n minn = 0x3f3f3f3f;\n for (int i = 1; i <= n; i++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n col[j] = minn;\n for (int i = 1; i <= n; i++) table[i][j] -= minn;\n }\n }\n for (int i = 1; i <= n; i++) {\n minn = 0x3f3f3f3f;\n for (int j = 1; j <= m; j++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n row[i] = minn;\n for (int j = 1; j <= m; j++) table[i][j] -= minn;\n }\n }\n }\n flag = 1;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= m; j++) {\n if (table[i][j]) {\n flag = 0;\n break;\n }\n }\n if (flag) {\n int tmp = 0;\n for (int i = 1; i <= n; i++) { tmp += row[i]; }\n for (int j = 1; j <= m; j++) { tmp += col[j]; }\n cout << tmp << '\\n';\n for (int i = 1; i <= n; i++) {\n for (int k = 1; k <= row[i]; k++) cout << \"row \" << i << '\\n';\n }\n for (int j = 1; j <= m; j++) {\n for (int k = 1; k <= col[j]; k++) cout << \"col \" << j << '\\n';\n }\n } else\n cout << \"-1\\n\";\n }\n return 0;\n}","item":{"problem_id":"815A","pseudocode":"make static int mod = 1e9 + 7\ndefine the main function\n make int n, m, array row of size 105, array col of size 105, multidimensional array table of size 105x105, minn, and flag\n while read n and m\n set flag to 0\n set row elements to 0\n set col elements to 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive, read table[i][j]\n end of the block\n if m greater than or equal to n\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] less than minn, set minn to table[i][j]\n end of the block\n if minn\n set row[i] to minn\n for j = 1 to m inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] less than minn, set minn to table[i]j]\n end of the block\n if minn\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n else\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] less than minn, set minn to table[i][j]\n end of the block\n if minn\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n set row[i] to minn\n for j = 1 to m inclusive, decrease table[i][j] by minn\n end of the block\n end of the block\n end of the block\n set flag to 1\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if table[i][j]\n set flag to 0\n break\n end of the block\n end of the block\n if flag\n make int tmp = 0\n for i = 1 to n inclusive, increase tmp by row[i]\n for j = 1 to m inclusive, increase tmp by col[j]\n print tmp\n for i = 1 to n inclusive\n for k = 1 to row[i] inclusive, print \"row \" i\n end of the block\n for j = 1 to m inclusive\n for k = 1 to col[j] inclusive, print \"col \" j\n end of the block\n else\n print \"-1\\n\"\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3 5","2 2 2 3 2","0 0 0 1 0","1 1 1 2 1"],["4","row 1","row 1","row 3","col 4"]],[["3 3","0 0 0","0 1 0","0 0 0"],["-1"]],[["3 3","1 1 1","1 1 1","1 1 1"],["3","row 1","row 2","row 3"]],[["3 5","2 4 2 2 3","0 2 0 0 1","1 3 1 1 2"],["6","row 1","row 1","row 3","col 2","col 2","col 5"]],[["3 5","0 0 0 0 0","0 0 0 0 0","0 0 0 0 1"],["-1"]],[["1 1","0"],["0"]],[["10 10","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","0 0 0 0 0 0 0 0 0 0","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1"],["9","row 1","row 2","row 3","row 4","row 6","row 7","row 8","row 9","row 10"]],[["10 10","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1"],["9","col 1","col 2","col 3","col 4","col 5","col 6","col 8","col 9","col 10"]],[["5 3","2 2 2","2 2 2","2 2 2","1 1 1","2 2 2"],["7","row 1","row 2","row 3","row 5","col 1","col 2","col 3"]],[["3 5","2 2 2 1 2","2 2 2 1 2","2 2 2 1 2"],["7","row 1","row 2","row 3","col 1","col 2","col 3","col 5"]],[["1 100","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"],["0"]],[["100 1","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0"]],[["1 100","1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"],["1","row 1"]],[["100 1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["2 1","1","1"],["1","col 1"]],[["4 3","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["2 1","2","2"],["2","col 1","col 1"]],[["3 2","1 1","1 1","1 1"],["2","col 1","col 2"]],[["2 1","1","2"],["2","row 2","col 1"]],[["2 3","1 1 1","1 1 1"],["2","row 1","row 2"]],[["1 2","1 1"],["1","row 1"]],[["5 1","1","1","1","1","1"],["1","col 1"]],[["2 1","10","10"],["10","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["4 3","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 1","1","1","1"],["1","col 1"]],[["8 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","2 2"],["2","row 1","row 1"]],[["3 2","2 3","2 3","2 3"],["5","col 1","col 1","col 2","col 2","col 2"]],[["2 1","3","3"],["3","col 1","col 1","col 1"]],[["6 2","1 1","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["4 1","1","1","1","1"],["1","col 1"]],[["2 5","1 1 1 1 1","1 1 1 1 1"],["2","row 1","row 2"]],[["5 2","1 1","2 2","2 2","2 2","2 2"],["6","row 2","row 3","row 4","row 5","col 1","col 2"]],[["4 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["5 2","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["1 4","1 1 1 1"],["1","row 1"]],[["3 1","2","3","2"],["3","row 2","col 1","col 1"]],[["1 5","1 1 1 1 1"],["1","row 1"]],[["2 4","3 1 1 1","3 1 1 1"],["4","row 1","row 2","col 1","col 1"]],[["3 3","1 1 1","0 1 0","0 0 0"],["-1"]],[["3 2","2 2","1 1","2 2"],["4","row 1","row 3","col 1","col 2"]],[["2 1","9","9"],["9","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["1 7","3 3 3 3 3 3 3"],["3","row 1","row 1","row 1"]],[["5 2","3 3","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["7 1","1","1","1","1","1","1","1"],["1","col 1"]],[["5 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["5 3","3 3 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["2 1","4","5"],["5","row 2","col 1","col 1","col 1","col 1"]],[["4 2","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["6 3","2 2 2","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["5 1","1","2","3","4","5"],["11","row 2","row 3","row 3","row 4","row 4","row 4","row 5","row 5","row 5","row 5","col 1"]],[["2 1","1","3"],["3","row 2","row 2","col 1"]],[["10 1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["6 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 5","1 1 1 1 1","1 1 1 1 1","1 1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 3","2 1 2","2 1 2"],["4","row 1","row 2","col 1","col 3"]],[["5 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","1 3"],["3","row 1","col 2","col 2"]],[["4 3","2 2 2","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["3 2","1 1","2 2","3 3"],["5","row 2","row 3","row 3","col 1","col 2"]],[["4 2","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["3 4","1 1 1 1","1 1 1 1","1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 1","2","3"],["3","row 2","col 1","col 1"]],[["5 3","2 2 2","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 2","1 0","2 1","2 1"],["3","row 2","row 3","col 1"]],[["3 2","1 2","2 3","3 4"],["6","row 2","row 3","row 3","col 1","col 2","col 2"]],[["3 3","1 1 1","1 2 1","1 1 1"],["-1"]],[["4 3","2 1 1","2 1 1","2 1 1","2 1 1"],["4","col 1","col 1","col 2","col 3"]],[["4 1","3","3","3","3"],["3","col 1","col 1","col 1"]],[["1 3","2 3 2"],["3","row 1","row 1","col 2"]],[["1 2","1 2"],["2","row 1","col 2"]],[["3 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 3","1 1 1"],["1","row 1"]],[["6 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["3 1","2","2","2"],["2","col 1","col 1"]],[["3 1","3","3","3"],["3","col 1","col 1","col 1"]],[["3 2","2 2","1 1","1 1"],["3","row 1","col 1","col 2"]],[["5 3","1 1 2","1 1 2","1 1 2","1 1 2","1 1 2"],["4","col 1","col 2","col 3","col 3"]],[["1 2","2 3"],["3","row 1","row 1","col 2"]],[["5 1","2","2","2","2","2"],["2","col 1","col 1"]],[["3 2","1 1","2 2","2 2"],["4","row 2","row 3","col 1","col 2"]],[["3 3","1 1 1","2 3 3","4 4 4"],["-1"]],[["2 1","5","2"],["5","row 1","row 1","row 1","col 1","col 1"]],[["4 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 2","5 10","5 10","5 10"],["15","col 1","col 1","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2"]],[["4 3","3 4 3","5 6 5","3 4 3","3 4 3"],["12","row 2","row 2","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 3","col 3","col 3"]],[["4 2","1 1","1 1","1 1","2 2"],["3","row 4","col 1","col 2"]],[["4 1","4","4","4","4"],["4","col 1","col 1","col 1","col 1"]],[["3 2","1 1","1 1","2 2"],["3","row 3","col 1","col 2"]],[["2 3","2 2 2","2 2 2"],["4","row 1","row 1","row 2","row 2"]],[["3 2","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["2 3","10 10 10","5 5 5"],["15","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 2","row 2","row 2","row 2","row 2"]],[["5 2","1 2","1 2","1 2","1 2","1 2"],["3","col 1","col 2","col 2"]],[["2 1","5","5"],["5","col 1","col 1","col 1","col 1","col 1"]]]}} +{"instance_id":"pseudo_to_code_2k_5","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare constant integer M = 2e5 + 5\ndeclare integer arrays G size 200 by 200, T size 200 by 200\ndefine the main function\n declare integers n, m, i, j\n read n, m\n declare boolean f = 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n read G[i][j]\n let T[i][j] be G[i][j]\n end of the block\n declare integer vectors r,, c\n for i = 1 to n inclusive\n declare integer mn = 1000\n for j = 1 to m inclusive, let mn be minimum of ( mn and G[i][j] )\n for j = 1 to m inclusive, decrement G[i][j] by mn\n for j = 1 to mn inclusive, add i to end of r\n end of the block\n for i = 1 to m inclusive\n declare integer mn = 1000\n for j = 1 to n inclusive, let mn be minimum of ( mn and G[j][i] )\n for j = 1 to n inclusive, decrement G[j][i] by mn\n for j = 1 to mn inclusive, add i to end of c\n end of the block\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if G[i][j] is true\n print \"-1\\n\"\n return to indicate successful execution\n end of the block\n let G[i][j] be T[i][j]\n end of the block\n declare integer vectors r1, c1\n for i = 1 to m inclusive\n declare integer mn = 1000\n for j = 1 to n inclusive, let mn be minimum of ( mn and G[j][i] )\n for j = 1 to n inclusive, decrement G[j][i] by mn\n for j = 1 to mn inclusive, add i to end of c1\n end of the block\n for i = 1 to n inclusive\n declare integer mn = 1000\n for j = 1 to n inclusive, let mn be minimum of ( mn and G[j][i] )\n for j = 1 to n inclusive, decrement G[j][i] by mn\n for j = 1 to mn inclusive, add i to end of r1\n end of the block\n if size of r + size of c is greater than size of r1 + size of c1\n let r be r1\n let c be c1\n end of the block\n print size of r + size of c, \"\\n\"\n for i = 0 to size of r exclusive\n print \"row \"\n print r[i], \"\\n\"\n end of the block\n for i = 0 to size of c exclusive\n print \"col \"\n print c[i], \"\\n\"\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int M = 2e5 + 5;\nint G[200][200], T[200][200];\nint main() {\n int n, m, i, j;\n cin >> n >> m;\n bool f = 0;\n for (i = 1; i <= n; i++)\n for (j = 1; j <= m; j++) {\n cin >> G[i][j];\n T[i][j] = G[i][j];\n }\n vector r, c;\n for (i = 1; i <= n; i++) {\n int mn = 1000;\n for (j = 1; j <= m; j++) mn = min(mn, G[i][j]);\n for (j = 1; j <= m; j++) G[i][j] -= mn;\n for (j = 1; j <= mn; j++) r.push_back(i);\n }\n for (i = 1; i <= m; i++) {\n int mn = 1000;\n for (j = 1; j <= n; j++) mn = min(mn, G[j][i]);\n for (j = 1; j <= n; j++) G[j][i] -= mn;\n for (j = 1; j <= mn; j++) c.push_back(i);\n }\n for (i = 1; i <= n; i++)\n for (j = 1; j <= m; j++) {\n if (G[i][j]) {\n cout << \"-1\\n\";\n return 0;\n }\n G[i][j] = T[i][j];\n }\n vector r1, c1;\n for (i = 1; i <= m; i++) {\n int mn = 1000;\n for (j = 1; j <= n; j++) mn = min(mn, G[j][i]);\n for (j = 1; j <= n; j++) G[j][i] -= mn;\n for (j = 1; j <= mn; j++) c1.push_back(i);\n }\n for (i = 1; i <= n; i++) {\n int mn = 1000;\n for (j = 1; j <= m; j++) mn = min(mn, G[i][j]);\n for (j = 1; j <= m; j++) G[i][j] -= mn;\n for (j = 1; j <= mn; j++) r1.push_back(i);\n }\n if (r.size() + c.size() > r1.size() + c1.size()) {\n r = r1;\n c = c1;\n }\n cout << r.size() + c.size() << \"\\n\";\n for (i = 0; i < r.size(); i++) {\n cout << \"row \";\n cout << r[i] << \"\\n\";\n }\n for (i = 0; i < c.size(); i++) {\n cout << \"col \";\n cout << c[i] << \"\\n\";\n }\n return 0;\n}","item":{"problem_id":"815A","pseudocode":"declare constant integer M = 2e5 + 5\ndeclare integer arrays G size 200 by 200, T size 200 by 200\ndefine the main function\n declare integers n, m, i, j\n read n, m\n declare boolean f = 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n read G[i][j]\n let T[i][j] be G[i][j]\n end of the block\n declare integer vectors r,, c\n for i = 1 to n inclusive\n declare integer mn = 1000\n for j = 1 to m inclusive, let mn be minimum of ( mn and G[i][j] )\n for j = 1 to m inclusive, decrement G[i][j] by mn\n for j = 1 to mn inclusive, add i to end of r\n end of the block\n for i = 1 to m inclusive\n declare integer mn = 1000\n for j = 1 to n inclusive, let mn be minimum of ( mn and G[j][i] )\n for j = 1 to n inclusive, decrement G[j][i] by mn\n for j = 1 to mn inclusive, add i to end of c\n end of the block\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if G[i][j] is true\n print \"-1\\n\"\n return to indicate successful execution\n end of the block\n let G[i][j] be T[i][j]\n end of the block\n declare integer vectors r1, c1\n for i = 1 to m inclusive\n declare integer mn = 1000\n for j = 1 to n inclusive, let mn be minimum of ( mn and G[j][i] )\n for j = 1 to n inclusive, decrement G[j][i] by mn\n for j = 1 to mn inclusive, add i to end of c1\n end of the block\n for i = 1 to n inclusive\n declare integer mn = 1000\n for j = 1 to n inclusive, let mn be minimum of ( mn and G[j][i] )\n for j = 1 to n inclusive, decrement G[j][i] by mn\n for j = 1 to mn inclusive, add i to end of r1\n end of the block\n if size of r + size of c is greater than size of r1 + size of c1\n let r be r1\n let c be c1\n end of the block\n print size of r + size of c, \"\\n\"\n for i = 0 to size of r exclusive\n print \"row \"\n print r[i], \"\\n\"\n end of the block\n for i = 0 to size of c exclusive\n print \"col \"\n print c[i], \"\\n\"\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3 5","2 2 2 3 2","0 0 0 1 0","1 1 1 2 1"],["4","row 1","row 1","row 3","col 4"]],[["3 3","0 0 0","0 1 0","0 0 0"],["-1"]],[["3 3","1 1 1","1 1 1","1 1 1"],["3","row 1","row 2","row 3"]],[["3 5","2 4 2 2 3","0 2 0 0 1","1 3 1 1 2"],["6","row 1","row 1","row 3","col 2","col 2","col 5"]],[["3 5","0 0 0 0 0","0 0 0 0 0","0 0 0 0 1"],["-1"]],[["1 1","0"],["0"]],[["10 10","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","0 0 0 0 0 0 0 0 0 0","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1"],["9","row 1","row 2","row 3","row 4","row 6","row 7","row 8","row 9","row 10"]],[["10 10","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1"],["9","col 1","col 2","col 3","col 4","col 5","col 6","col 8","col 9","col 10"]],[["5 3","2 2 2","2 2 2","2 2 2","1 1 1","2 2 2"],["7","row 1","row 2","row 3","row 5","col 1","col 2","col 3"]],[["3 5","2 2 2 1 2","2 2 2 1 2","2 2 2 1 2"],["7","row 1","row 2","row 3","col 1","col 2","col 3","col 5"]],[["1 100","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"],["0"]],[["100 1","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0"]],[["1 100","1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"],["1","row 1"]],[["100 1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["2 1","1","1"],["1","col 1"]],[["4 3","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["2 1","2","2"],["2","col 1","col 1"]],[["3 2","1 1","1 1","1 1"],["2","col 1","col 2"]],[["2 1","1","2"],["2","row 2","col 1"]],[["2 3","1 1 1","1 1 1"],["2","row 1","row 2"]],[["1 2","1 1"],["1","row 1"]],[["5 1","1","1","1","1","1"],["1","col 1"]],[["2 1","10","10"],["10","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["4 3","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 1","1","1","1"],["1","col 1"]],[["8 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","2 2"],["2","row 1","row 1"]],[["3 2","2 3","2 3","2 3"],["5","col 1","col 1","col 2","col 2","col 2"]],[["2 1","3","3"],["3","col 1","col 1","col 1"]],[["6 2","1 1","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["4 1","1","1","1","1"],["1","col 1"]],[["2 5","1 1 1 1 1","1 1 1 1 1"],["2","row 1","row 2"]],[["5 2","1 1","2 2","2 2","2 2","2 2"],["6","row 2","row 3","row 4","row 5","col 1","col 2"]],[["4 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["5 2","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["1 4","1 1 1 1"],["1","row 1"]],[["3 1","2","3","2"],["3","row 2","col 1","col 1"]],[["1 5","1 1 1 1 1"],["1","row 1"]],[["2 4","3 1 1 1","3 1 1 1"],["4","row 1","row 2","col 1","col 1"]],[["3 3","1 1 1","0 1 0","0 0 0"],["-1"]],[["3 2","2 2","1 1","2 2"],["4","row 1","row 3","col 1","col 2"]],[["2 1","9","9"],["9","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["1 7","3 3 3 3 3 3 3"],["3","row 1","row 1","row 1"]],[["5 2","3 3","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["7 1","1","1","1","1","1","1","1"],["1","col 1"]],[["5 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["5 3","3 3 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["2 1","4","5"],["5","row 2","col 1","col 1","col 1","col 1"]],[["4 2","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["6 3","2 2 2","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["5 1","1","2","3","4","5"],["11","row 2","row 3","row 3","row 4","row 4","row 4","row 5","row 5","row 5","row 5","col 1"]],[["2 1","1","3"],["3","row 2","row 2","col 1"]],[["10 1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["6 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 5","1 1 1 1 1","1 1 1 1 1","1 1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 3","2 1 2","2 1 2"],["4","row 1","row 2","col 1","col 3"]],[["5 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","1 3"],["3","row 1","col 2","col 2"]],[["4 3","2 2 2","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["3 2","1 1","2 2","3 3"],["5","row 2","row 3","row 3","col 1","col 2"]],[["4 2","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["3 4","1 1 1 1","1 1 1 1","1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 1","2","3"],["3","row 2","col 1","col 1"]],[["5 3","2 2 2","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 2","1 0","2 1","2 1"],["3","row 2","row 3","col 1"]],[["3 2","1 2","2 3","3 4"],["6","row 2","row 3","row 3","col 1","col 2","col 2"]],[["3 3","1 1 1","1 2 1","1 1 1"],["-1"]],[["4 3","2 1 1","2 1 1","2 1 1","2 1 1"],["4","col 1","col 1","col 2","col 3"]],[["4 1","3","3","3","3"],["3","col 1","col 1","col 1"]],[["1 3","2 3 2"],["3","row 1","row 1","col 2"]],[["1 2","1 2"],["2","row 1","col 2"]],[["3 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 3","1 1 1"],["1","row 1"]],[["6 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["3 1","2","2","2"],["2","col 1","col 1"]],[["3 1","3","3","3"],["3","col 1","col 1","col 1"]],[["3 2","2 2","1 1","1 1"],["3","row 1","col 1","col 2"]],[["5 3","1 1 2","1 1 2","1 1 2","1 1 2","1 1 2"],["4","col 1","col 2","col 3","col 3"]],[["1 2","2 3"],["3","row 1","row 1","col 2"]],[["5 1","2","2","2","2","2"],["2","col 1","col 1"]],[["3 2","1 1","2 2","2 2"],["4","row 2","row 3","col 1","col 2"]],[["3 3","1 1 1","2 3 3","4 4 4"],["-1"]],[["2 1","5","2"],["5","row 1","row 1","row 1","col 1","col 1"]],[["4 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 2","5 10","5 10","5 10"],["15","col 1","col 1","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2"]],[["4 3","3 4 3","5 6 5","3 4 3","3 4 3"],["12","row 2","row 2","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 3","col 3","col 3"]],[["4 2","1 1","1 1","1 1","2 2"],["3","row 4","col 1","col 2"]],[["4 1","4","4","4","4"],["4","col 1","col 1","col 1","col 1"]],[["3 2","1 1","1 1","2 2"],["3","row 3","col 1","col 2"]],[["2 3","2 2 2","2 2 2"],["4","row 1","row 1","row 2","row 2"]],[["3 2","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["2 3","10 10 10","5 5 5"],["15","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 2","row 2","row 2","row 2","row 2"]],[["5 2","1 2","1 2","1 2","1 2","1 2"],["3","col 1","col 2","col 2"]],[["2 1","5","5"],["5","col 1","col 1","col 1","col 1","col 1"]]]}} +{"instance_id":"pseudo_to_code_2k_6","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet INF be const integer with INF = 0x3f3f3f3f\ndefine the main function\n let n, m be integers\n read n, m\n let ans, ar be array of size 105 by 105 with ans = ar = {0}\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n read ans[i][j]\n set ar[i][j] to ans[i][j]\n end of the block\n let mins, sum be integers with mins = INF and sum = 0\n let temp be integer array of size 6 by 200 with temp = {0}\n for i = 1 to n inclusive\n set mins to INF\n for j = 1 to m inclusive, set mins to min of mins, ans[i][j]\n set temp[1][i] to mins\n for j = 1 to m inclusive, set ans[i][j] to ans[i][j] - mins\n end of the block\n for j = 1 to m inclusive\n set mins to INF\n for i = 1 to n inclusive, set mins to min of mins, ans[i][j]\n set temp[2][j] to mins\n for i = 1 to n inclusive, decrement ans[i][j] by mins\n end of the block\n for j = 1 to m inclusive\n set mins to INF\n for i = 1 to n inclusive, set mins to min of mins, ar[i][j]\n set temp[3][j] to mins\n for i = 1 to n inclusive, set ar[i][j] to ar[i][j] - mins\n end of the block\n for i = 1 to n inclusive\n set mins to iNF\n for j = 1 to m inclusive, mins = min of mins, ar[i][j]\n temp[4][i] = mins\n for j = 1 to m inclusive, decrement ar[i][j] by mins\n end of the block\n let flag1, flag2 be integers with flag1 = flag2 = 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if ans[i][j] != 0\n set flag1 to 1\n break\n end of the block\n end of the block\n end of the block\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if ar[i][j] != 0\n set flag2 to 0\n break\n end of the block\n end of the block\n end of the block\n if flag1 == 1 and flag2 == 1\n print -1\n else if flag1 == 0 and flag2 == 0\n sum1 = sum2 = integer = 0\n for i = 1 to n inclusive\n increment sum1 by temp[1][i]\n increment sum2 by temp[4][i]\n end of the block\n for j = 1 to m inclusive\n increment sum1 by temp[2][j]\n increment sum2 by temp[3][j]\n end of the block\n if sum1 > sum2\n print sum2\n for i = 1 to n inclusive\n for j = 1 to temp[4][i], print row, i\n for j = 1 to m inclusive\n for i = 1 to temp[3][j] inclusive, print col, j\n else\n print sum1\n for i = 1 to n inclusive\n for j = 1 to temp[1][i], print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[2][j] inclusive, print \"col \", j\n end of the block\n else if flag1 == 1\n let sum2 be integer with sum2 = 0\n for i = 1 to n inclusive, increment sum2 by temp[4][i]\n for j = 1 to n inclusive, increment sum2 by temp[3][j]\n print sum2\n for i = 1 to n inclusive\n for j = 1 to temp[4][i] inclusive, print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[3][j] inclusive, print \"col \", j\n else if flag2 == 1\n sum1 = int = 0\n for i = 1 to n inclusive, increment sum1 by temp[4][i]\n for j = 1 to n inclusive, increment sum1 by temp[3][j]\n print sum1\n for i = 1 to n inclusive\n for j = 1 to temp[1][i] inclusive, print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[2][j] inclusive, print \"col \", j\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int INF = 0x3f3f3f3f;\nint main() {\n int n, m;\n cin >> n >> m;\n int ans[105][105] = {0}, ar[105][105] = {0};\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= m; j++) {\n cin >> ans[i][j];\n ar[i][j] = ans[i][j];\n }\n int mins = INF, sum = 0;\n int temp[6][200] = {0};\n for (int i = 1; i <= n; i++) {\n mins = INF;\n for (int j = 1; j <= m; j++) mins = min(mins, ans[i][j]);\n temp[1][i] = mins;\n for (int j = 1; j <= m; j++) ans[i][j] -= mins;\n }\n for (int j = 1; j <= m; j++) {\n mins = INF;\n for (int i = 1; i <= n; i++) mins = min(mins, ans[i][j]);\n temp[2][j] = mins;\n for (int i = 1; i <= n; i++) ans[i][j] -= mins;\n }\n for (int j = 1; j <= m; j++) {\n mins = INF;\n for (int i = 1; i <= n; i++) mins = min(mins, ar[i][j]);\n temp[3][j] = mins;\n for (int i = 1; i <= n; i++) ar[i][j] -= mins;\n }\n for (int i = 1; i <= n; i++) {\n mins = INF;\n for (int j = 1; j <= m; j++) mins = min(mins, ar[i][j]);\n temp[4][i] = mins;\n for (int j = 1; j <= m; j++) ar[i][j] -= mins;\n }\n int flag1 = 0, flag2 = 0;\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n if (ans[i][j] != 0) {\n flag1 = 1;\n break;\n }\n }\n }\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n if (ar[i][j] != 0) {\n flag2 = 1;\n break;\n }\n }\n }\n if (flag1 == 1 && flag2 == 1)\n cout << -1 << endl;\n else if (flag1 == 0 && flag2 == 0) {\n int sum1 = 0, sum2 = 0;\n for (int i = 1; i <= n; i++) {\n sum1 += temp[1][i];\n sum2 += temp[4][i];\n }\n for (int j = 1; j <= m; j++) {\n sum1 += temp[2][j];\n sum2 += temp[3][j];\n }\n if (sum1 > sum2) {\n cout << sum2 << endl;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= temp[4][i]; j++) cout << \"row \" << i << endl;\n for (int j = 1; j <= m; j++)\n for (int i = 1; i <= temp[3][j]; i++) cout << \"col \" << j << endl;\n } else {\n cout << sum1 << endl;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= temp[1][i]; j++) cout << \"row \" << i << endl;\n for (int j = 1; j <= m; j++)\n for (int i = 1; i <= temp[2][j]; i++) cout << \"col \" << j << endl;\n }\n } else if (flag1 == 1) {\n int sum2 = 0;\n for (int i = 1; i <= n; i++) { sum2 += temp[4][i]; }\n for (int j = 1; j <= m; j++) { sum2 += temp[3][j]; }\n cout << sum2 << endl;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= temp[4][i]; j++) cout << \"row \" << i << endl;\n for (int j = 1; j <= m; j++)\n for (int i = 1; i <= temp[3][j]; i++) cout << \"col \" << j << endl;\n } else if (flag2 == 1) {\n int sum1 = 0;\n for (int i = 1; i <= n; i++) { sum1 += temp[4][i]; }\n for (int j = 1; j <= m; j++) { sum1 += temp[3][j]; }\n cout << sum1 << endl;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= temp[1][i]; j++) cout << \"row \" << i << endl;\n for (int j = 1; j <= m; j++)\n for (int i = 1; i <= temp[2][j]; i++) cout << \"col \" << j << endl;\n }\n return 0;\n}","item":{"problem_id":"815A","pseudocode":"let INF be const integer with INF = 0x3f3f3f3f\ndefine the main function\n let n, m be integers\n read n, m\n let ans, ar be array of size 105 by 105 with ans = ar = {0}\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n read ans[i][j]\n set ar[i][j] to ans[i][j]\n end of the block\n let mins, sum be integers with mins = INF and sum = 0\n let temp be integer array of size 6 by 200 with temp = {0}\n for i = 1 to n inclusive\n set mins to INF\n for j = 1 to m inclusive, set mins to min of mins, ans[i][j]\n set temp[1][i] to mins\n for j = 1 to m inclusive, set ans[i][j] to ans[i][j] - mins\n end of the block\n for j = 1 to m inclusive\n set mins to INF\n for i = 1 to n inclusive, set mins to min of mins, ans[i][j]\n set temp[2][j] to mins\n for i = 1 to n inclusive, decrement ans[i][j] by mins\n end of the block\n for j = 1 to m inclusive\n set mins to INF\n for i = 1 to n inclusive, set mins to min of mins, ar[i][j]\n set temp[3][j] to mins\n for i = 1 to n inclusive, set ar[i][j] to ar[i][j] - mins\n end of the block\n for i = 1 to n inclusive\n set mins to iNF\n for j = 1 to m inclusive, mins = min of mins, ar[i][j]\n temp[4][i] = mins\n for j = 1 to m inclusive, decrement ar[i][j] by mins\n end of the block\n let flag1, flag2 be integers with flag1 = flag2 = 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if ans[i][j] != 0\n set flag1 to 1\n break\n end of the block\n end of the block\n end of the block\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if ar[i][j] != 0\n set flag2 to 0\n break\n end of the block\n end of the block\n end of the block\n if flag1 == 1 and flag2 == 1\n print -1\n else if flag1 == 0 and flag2 == 0\n sum1 = sum2 = integer = 0\n for i = 1 to n inclusive\n increment sum1 by temp[1][i]\n increment sum2 by temp[4][i]\n end of the block\n for j = 1 to m inclusive\n increment sum1 by temp[2][j]\n increment sum2 by temp[3][j]\n end of the block\n if sum1 > sum2\n print sum2\n for i = 1 to n inclusive\n for j = 1 to temp[4][i], print row, i\n for j = 1 to m inclusive\n for i = 1 to temp[3][j] inclusive, print col, j\n else\n print sum1\n for i = 1 to n inclusive\n for j = 1 to temp[1][i], print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[2][j] inclusive, print \"col \", j\n end of the block\n else if flag1 == 1\n let sum2 be integer with sum2 = 0\n for i = 1 to n inclusive, increment sum2 by temp[4][i]\n for j = 1 to n inclusive, increment sum2 by temp[3][j]\n print sum2\n for i = 1 to n inclusive\n for j = 1 to temp[4][i] inclusive, print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[3][j] inclusive, print \"col \", j\n else if flag2 == 1\n sum1 = int = 0\n for i = 1 to n inclusive, increment sum1 by temp[4][i]\n for j = 1 to n inclusive, increment sum1 by temp[3][j]\n print sum1\n for i = 1 to n inclusive\n for j = 1 to temp[1][i] inclusive, print \"row \", i\n for j = 1 to m inclusive\n for i = 1 to temp[2][j] inclusive, print \"col \", j\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3 5","2 2 2 3 2","0 0 0 1 0","1 1 1 2 1"],["4","row 1","row 1","row 3","col 4"]],[["3 3","0 0 0","0 1 0","0 0 0"],["-1"]],[["3 3","1 1 1","1 1 1","1 1 1"],["3","row 1","row 2","row 3"]],[["3 5","2 4 2 2 3","0 2 0 0 1","1 3 1 1 2"],["6","row 1","row 1","row 3","col 2","col 2","col 5"]],[["3 5","0 0 0 0 0","0 0 0 0 0","0 0 0 0 1"],["-1"]],[["1 1","0"],["0"]],[["10 10","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","0 0 0 0 0 0 0 0 0 0","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1"],["9","row 1","row 2","row 3","row 4","row 6","row 7","row 8","row 9","row 10"]],[["10 10","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1"],["9","col 1","col 2","col 3","col 4","col 5","col 6","col 8","col 9","col 10"]],[["5 3","2 2 2","2 2 2","2 2 2","1 1 1","2 2 2"],["7","row 1","row 2","row 3","row 5","col 1","col 2","col 3"]],[["3 5","2 2 2 1 2","2 2 2 1 2","2 2 2 1 2"],["7","row 1","row 2","row 3","col 1","col 2","col 3","col 5"]],[["1 100","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"],["0"]],[["100 1","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0"]],[["1 100","1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"],["1","row 1"]],[["100 1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["2 1","1","1"],["1","col 1"]],[["4 3","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["2 1","2","2"],["2","col 1","col 1"]],[["3 2","1 1","1 1","1 1"],["2","col 1","col 2"]],[["2 1","1","2"],["2","row 2","col 1"]],[["2 3","1 1 1","1 1 1"],["2","row 1","row 2"]],[["1 2","1 1"],["1","row 1"]],[["5 1","1","1","1","1","1"],["1","col 1"]],[["2 1","10","10"],["10","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["4 3","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 1","1","1","1"],["1","col 1"]],[["8 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","2 2"],["2","row 1","row 1"]],[["3 2","2 3","2 3","2 3"],["5","col 1","col 1","col 2","col 2","col 2"]],[["2 1","3","3"],["3","col 1","col 1","col 1"]],[["6 2","1 1","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["4 1","1","1","1","1"],["1","col 1"]],[["2 5","1 1 1 1 1","1 1 1 1 1"],["2","row 1","row 2"]],[["5 2","1 1","2 2","2 2","2 2","2 2"],["6","row 2","row 3","row 4","row 5","col 1","col 2"]],[["4 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["5 2","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["1 4","1 1 1 1"],["1","row 1"]],[["3 1","2","3","2"],["3","row 2","col 1","col 1"]],[["1 5","1 1 1 1 1"],["1","row 1"]],[["2 4","3 1 1 1","3 1 1 1"],["4","row 1","row 2","col 1","col 1"]],[["3 3","1 1 1","0 1 0","0 0 0"],["-1"]],[["3 2","2 2","1 1","2 2"],["4","row 1","row 3","col 1","col 2"]],[["2 1","9","9"],["9","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["1 7","3 3 3 3 3 3 3"],["3","row 1","row 1","row 1"]],[["5 2","3 3","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["7 1","1","1","1","1","1","1","1"],["1","col 1"]],[["5 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["5 3","3 3 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["2 1","4","5"],["5","row 2","col 1","col 1","col 1","col 1"]],[["4 2","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["6 3","2 2 2","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["5 1","1","2","3","4","5"],["11","row 2","row 3","row 3","row 4","row 4","row 4","row 5","row 5","row 5","row 5","col 1"]],[["2 1","1","3"],["3","row 2","row 2","col 1"]],[["10 1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["6 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 5","1 1 1 1 1","1 1 1 1 1","1 1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 3","2 1 2","2 1 2"],["4","row 1","row 2","col 1","col 3"]],[["5 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","1 3"],["3","row 1","col 2","col 2"]],[["4 3","2 2 2","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["3 2","1 1","2 2","3 3"],["5","row 2","row 3","row 3","col 1","col 2"]],[["4 2","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["3 4","1 1 1 1","1 1 1 1","1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 1","2","3"],["3","row 2","col 1","col 1"]],[["5 3","2 2 2","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 2","1 0","2 1","2 1"],["3","row 2","row 3","col 1"]],[["3 2","1 2","2 3","3 4"],["6","row 2","row 3","row 3","col 1","col 2","col 2"]],[["3 3","1 1 1","1 2 1","1 1 1"],["-1"]],[["4 3","2 1 1","2 1 1","2 1 1","2 1 1"],["4","col 1","col 1","col 2","col 3"]],[["4 1","3","3","3","3"],["3","col 1","col 1","col 1"]],[["1 3","2 3 2"],["3","row 1","row 1","col 2"]],[["1 2","1 2"],["2","row 1","col 2"]],[["3 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 3","1 1 1"],["1","row 1"]],[["6 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["3 1","2","2","2"],["2","col 1","col 1"]],[["3 1","3","3","3"],["3","col 1","col 1","col 1"]],[["3 2","2 2","1 1","1 1"],["3","row 1","col 1","col 2"]],[["5 3","1 1 2","1 1 2","1 1 2","1 1 2","1 1 2"],["4","col 1","col 2","col 3","col 3"]],[["1 2","2 3"],["3","row 1","row 1","col 2"]],[["5 1","2","2","2","2","2"],["2","col 1","col 1"]],[["3 2","1 1","2 2","2 2"],["4","row 2","row 3","col 1","col 2"]],[["3 3","1 1 1","2 3 3","4 4 4"],["-1"]],[["2 1","5","2"],["5","row 1","row 1","row 1","col 1","col 1"]],[["4 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 2","5 10","5 10","5 10"],["15","col 1","col 1","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2"]],[["4 3","3 4 3","5 6 5","3 4 3","3 4 3"],["12","row 2","row 2","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 3","col 3","col 3"]],[["4 2","1 1","1 1","1 1","2 2"],["3","row 4","col 1","col 2"]],[["4 1","4","4","4","4"],["4","col 1","col 1","col 1","col 1"]],[["3 2","1 1","1 1","2 2"],["3","row 3","col 1","col 2"]],[["2 3","2 2 2","2 2 2"],["4","row 1","row 1","row 2","row 2"]],[["3 2","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["2 3","10 10 10","5 5 5"],["15","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 2","row 2","row 2","row 2","row 2"]],[["5 2","1 2","1 2","1 2","1 2","1 2"],["3","col 1","col 2","col 2"]],[["2 1","5","5"],["5","col 1","col 1","col 1","col 1","col 1"]]]}} +{"instance_id":"pseudo_to_code_2k_7","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmod = static integer = 1e9 + 7\ndefine the main function\n n, m are integers, row, col are integer arrays both of size 105, table is an integer array of sizes 105 and 105, minn and flag are integers\n while read n, m\n tmp = integer = 0\n call memset with row, 0, call sizeof with row\n call memset with col, 0, call sizeof with col\n for i = 1 to n inclusive\n for j = 1 to m inclusive, read table[i][j]\n end of the block\n if m is at least n\n for i = 1 to n inclusive\n set min to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set row[i] to minn\n for j = 1 to m inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n else\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set row[i] to minn\n iterate m times, subtract minn from table[i][j]\n end of the block\n end of the block\n end of the block\n set flag to 1\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if table[i][j]\n set flag to 0\n break\n end of the block\n if flag\n print tmp\n for i = 1 to n inclusive\n for k = 1 to row[i] inclusive, print \"row \", i\n end of the block\n for j = 1 to m inclusive\n for j = 1 to col[j] inclusive, print \"col \", j\n end of the block\n else\n print -1\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"static int mod = 1e9 + 7;\nint main() {\n int n, m, row[105], col[105], table[105][105], minn, flag;\n while (cin >> n >> m) {\n int tmp = 0;\n memset(row, 0, sizeof(row));\n memset(col, 0, sizeof(col));\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) cin >> table[i][j];\n }\n if (m >= n) {\n for (int i = 1; i <= n; i++) {\n minn = 0x3f3f3f3f;\n for (int j = 1; j <= m; j++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n tmp += minn;\n row[i] = minn;\n for (int j = 1; j <= m; j++) table[i][j] -= minn;\n }\n }\n for (int j = 1; j <= m; j++) {\n minn = 0x3f3f3f3f;\n for (int i = 1; i <= n; i++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n tmp += minn;\n col[j] = minn;\n for (int i = 1; i <= n; i++) table[i][j] -= minn;\n }\n }\n } else {\n for (int j = 1; j <= m; j++) {\n minn = 0x3f3f3f3f;\n for (int i = 1; i <= n; i++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n tmp += minn;\n col[j] = minn;\n for (int i = 1; i <= n; i++) table[i][j] -= minn;\n }\n }\n for (int i = 1; i <= n; i++) {\n minn = 0x3f3f3f3f;\n for (int j = 1; j <= m; j++) {\n if (table[i][j] < minn) minn = table[i][j];\n }\n if (minn) {\n tmp += minn;\n row[i] = minn;\n for (int j = 1; j <= m; j++) table[i][j] -= minn;\n }\n }\n }\n flag = 1;\n for (int i = 1; i <= n; i++)\n for (int j = 1; j <= m; j++)\n if (table[i][j]) {\n flag = 0;\n break;\n }\n if (flag) {\n cout << tmp << '\\n';\n for (int i = 1; i <= n; i++) {\n for (int k = 1; k <= row[i]; k++) cout << \"row \" << i << '\\n';\n }\n for (int j = 1; j <= m; j++) {\n for (int k = 1; k <= col[j]; k++) cout << \"col \" << j << '\\n';\n }\n } else\n cout << \"-1\\n\";\n }\n return 0;\n}","item":{"problem_id":"815A","pseudocode":"mod = static integer = 1e9 + 7\ndefine the main function\n n, m are integers, row, col are integer arrays both of size 105, table is an integer array of sizes 105 and 105, minn and flag are integers\n while read n, m\n tmp = integer = 0\n call memset with row, 0, call sizeof with row\n call memset with col, 0, call sizeof with col\n for i = 1 to n inclusive\n for j = 1 to m inclusive, read table[i][j]\n end of the block\n if m is at least n\n for i = 1 to n inclusive\n set min to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set row[i] to minn\n for j = 1 to m inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n else\n for j = 1 to m inclusive\n set minn to 0x3f3f3f3f\n for i = 1 to n inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set col[j] to minn\n for i = 1 to n inclusive, subtract minn from table[i][j]\n end of the block\n end of the block\n for i = 1 to n inclusive\n set minn to 0x3f3f3f3f\n for j = 1 to m inclusive\n if table[i][j] is less than minn, set minn to table[i][j]\n end of the block\n if minn\n add minn to tmp\n set row[i] to minn\n iterate m times, subtract minn from table[i][j]\n end of the block\n end of the block\n end of the block\n set flag to 1\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if table[i][j]\n set flag to 0\n break\n end of the block\n if flag\n print tmp\n for i = 1 to n inclusive\n for k = 1 to row[i] inclusive, print \"row \", i\n end of the block\n for j = 1 to m inclusive\n for j = 1 to col[j] inclusive, print \"col \", j\n end of the block\n else\n print -1\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3 5","2 2 2 3 2","0 0 0 1 0","1 1 1 2 1"],["4","row 1","row 1","row 3","col 4"]],[["3 3","0 0 0","0 1 0","0 0 0"],["-1"]],[["3 3","1 1 1","1 1 1","1 1 1"],["3","row 1","row 2","row 3"]],[["3 5","2 4 2 2 3","0 2 0 0 1","1 3 1 1 2"],["6","row 1","row 1","row 3","col 2","col 2","col 5"]],[["3 5","0 0 0 0 0","0 0 0 0 0","0 0 0 0 1"],["-1"]],[["1 1","0"],["0"]],[["10 10","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","0 0 0 0 0 0 0 0 0 0","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1","1 1 1 1 1 1 1 1 1 1"],["9","row 1","row 2","row 3","row 4","row 6","row 7","row 8","row 9","row 10"]],[["10 10","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1","1 1 1 1 1 1 0 1 1 1"],["9","col 1","col 2","col 3","col 4","col 5","col 6","col 8","col 9","col 10"]],[["5 3","2 2 2","2 2 2","2 2 2","1 1 1","2 2 2"],["7","row 1","row 2","row 3","row 5","col 1","col 2","col 3"]],[["3 5","2 2 2 1 2","2 2 2 1 2","2 2 2 1 2"],["7","row 1","row 2","row 3","col 1","col 2","col 3","col 5"]],[["1 100","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"],["0"]],[["100 1","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0"]],[["1 100","1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"],["1","row 1"]],[["100 1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["2 1","1","1"],["1","col 1"]],[["4 3","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["2 1","2","2"],["2","col 1","col 1"]],[["3 2","1 1","1 1","1 1"],["2","col 1","col 2"]],[["2 1","1","2"],["2","row 2","col 1"]],[["2 3","1 1 1","1 1 1"],["2","row 1","row 2"]],[["1 2","1 1"],["1","row 1"]],[["5 1","1","1","1","1","1"],["1","col 1"]],[["2 1","10","10"],["10","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["4 3","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 1","1","1","1"],["1","col 1"]],[["8 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","2 2"],["2","row 1","row 1"]],[["3 2","2 3","2 3","2 3"],["5","col 1","col 1","col 2","col 2","col 2"]],[["2 1","3","3"],["3","col 1","col 1","col 1"]],[["6 2","1 1","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["4 1","1","1","1","1"],["1","col 1"]],[["2 5","1 1 1 1 1","1 1 1 1 1"],["2","row 1","row 2"]],[["5 2","1 1","2 2","2 2","2 2","2 2"],["6","row 2","row 3","row 4","row 5","col 1","col 2"]],[["4 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["5 2","1 1","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["1 4","1 1 1 1"],["1","row 1"]],[["3 1","2","3","2"],["3","row 2","col 1","col 1"]],[["1 5","1 1 1 1 1"],["1","row 1"]],[["2 4","3 1 1 1","3 1 1 1"],["4","row 1","row 2","col 1","col 1"]],[["3 3","1 1 1","0 1 0","0 0 0"],["-1"]],[["3 2","2 2","1 1","2 2"],["4","row 1","row 3","col 1","col 2"]],[["2 1","9","9"],["9","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1","col 1"]],[["1 7","3 3 3 3 3 3 3"],["3","row 1","row 1","row 1"]],[["5 2","3 3","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["7 1","1","1","1","1","1","1","1"],["1","col 1"]],[["5 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["5 3","3 3 3","3 3 3","3 3 3","3 3 3","3 3 3"],["9","col 1","col 1","col 1","col 2","col 2","col 2","col 3","col 3","col 3"]],[["2 1","4","5"],["5","row 2","col 1","col 1","col 1","col 1"]],[["4 2","3 3","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["6 3","2 2 2","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["5 1","1","2","3","4","5"],["11","row 2","row 3","row 3","row 4","row 4","row 4","row 5","row 5","row 5","row 5","col 1"]],[["2 1","1","3"],["3","row 2","row 2","col 1"]],[["10 1","1","1","1","1","1","1","1","1","1","1"],["1","col 1"]],[["6 2","2 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 5","1 1 1 1 1","1 1 1 1 1","1 1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 3","2 1 2","2 1 2"],["4","row 1","row 2","col 1","col 3"]],[["5 2","2 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 2","1 3"],["3","row 1","col 2","col 2"]],[["4 3","2 2 2","1 1 1","1 1 1","1 1 1"],["4","row 1","col 1","col 2","col 3"]],[["3 2","1 1","2 2","3 3"],["5","row 2","row 3","row 3","col 1","col 2"]],[["4 2","1 1","1 1","1 1","1 1"],["2","col 1","col 2"]],[["3 4","1 1 1 1","1 1 1 1","1 1 1 1"],["3","row 1","row 2","row 3"]],[["2 1","2","3"],["3","row 2","col 1","col 1"]],[["5 3","2 2 2","2 2 2","2 2 2","2 2 2","2 2 2"],["6","col 1","col 1","col 2","col 2","col 3","col 3"]],[["3 2","1 0","2 1","2 1"],["3","row 2","row 3","col 1"]],[["3 2","1 2","2 3","3 4"],["6","row 2","row 3","row 3","col 1","col 2","col 2"]],[["3 3","1 1 1","1 2 1","1 1 1"],["-1"]],[["4 3","2 1 1","2 1 1","2 1 1","2 1 1"],["4","col 1","col 1","col 2","col 3"]],[["4 1","3","3","3","3"],["3","col 1","col 1","col 1"]],[["1 3","2 3 2"],["3","row 1","row 1","col 2"]],[["1 2","1 2"],["2","row 1","col 2"]],[["3 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["1 3","1 1 1"],["1","row 1"]],[["6 3","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1","1 1 1"],["3","col 1","col 2","col 3"]],[["3 1","2","2","2"],["2","col 1","col 1"]],[["3 1","3","3","3"],["3","col 1","col 1","col 1"]],[["3 2","2 2","1 1","1 1"],["3","row 1","col 1","col 2"]],[["5 3","1 1 2","1 1 2","1 1 2","1 1 2","1 1 2"],["4","col 1","col 2","col 3","col 3"]],[["1 2","2 3"],["3","row 1","row 1","col 2"]],[["5 1","2","2","2","2","2"],["2","col 1","col 1"]],[["3 2","1 1","2 2","2 2"],["4","row 2","row 3","col 1","col 2"]],[["3 3","1 1 1","2 3 3","4 4 4"],["-1"]],[["2 1","5","2"],["5","row 1","row 1","row 1","col 1","col 1"]],[["4 2","2 2","2 2","2 2","2 2"],["4","col 1","col 1","col 2","col 2"]],[["3 2","5 10","5 10","5 10"],["15","col 1","col 1","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2","col 2"]],[["4 3","3 4 3","5 6 5","3 4 3","3 4 3"],["12","row 2","row 2","col 1","col 1","col 1","col 2","col 2","col 2","col 2","col 3","col 3","col 3"]],[["4 2","1 1","1 1","1 1","2 2"],["3","row 4","col 1","col 2"]],[["4 1","4","4","4","4"],["4","col 1","col 1","col 1","col 1"]],[["3 2","1 1","1 1","2 2"],["3","row 3","col 1","col 2"]],[["2 3","2 2 2","2 2 2"],["4","row 1","row 1","row 2","row 2"]],[["3 2","3 3","3 3","3 3"],["6","col 1","col 1","col 1","col 2","col 2","col 2"]],[["2 3","10 10 10","5 5 5"],["15","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 1","row 2","row 2","row 2","row 2","row 2"]],[["5 2","1 2","1 2","1 2","1 2","1 2"],["3","col 1","col 2","col 2"]],[["2 1","5","5"],["5","col 1","col 1","col 1","col 1","col 1"]]]}} +{"instance_id":"pseudo_to_code_2k_8","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate pair of integer, integer array par with size 10001\ncreate string set str\ndefine the main function\n create string s\n create integers n, i\n read n read s\n if n is 8\n print \"vaporeon\" print newline\n else if n is 6\n print \"espeon\" print newline\n else if n is 7\n if s[0] is '.'\n if s[1] is 'o'\n print \"jolteon\" print newline\n return to indicate successful execution\n end of the block\n if s[1] is 'm'\n print \"umbreon\" print newline\n return to indicate successful execution\n end of the block\n if s[1] is 'e'\n print \"leafeon\" print newline\n return to indicate successful execution\n end of the block\n if s[1] is 'y'\n print \"sylveon\" print newline\n return to indicate successful execution\n end of the block\n if s[1] is 'l'\n if s[3] is 'r'\n print \"flareon\" print newline\n return to indicate successful execution\n else\n print \"glaceon\" print newline\n return to indicate successful execution\n end of the block\n end of the block\n if s[1] is '.'\n if s[2] is 'b'\n print \"umbreon\" print newline\n return to indicate successful execution\n end of the block\n if s[2] is 'l'\n if s[3] is 't'\n print \"jolteon\" print newline\n return to indicate successful execution\n else\n print \"sylveon\" print newline\n return to indicate successful execution\n end of the block\n end of the block\n if s[2] is 'a'\n if s[3] is 'r'\n print \"flareon\" print newline\n return to indicate successful execution\n end of the block\n if s[3] is 'c'\n print \"glaceon\" print newline\n return to indicate successful execution\n else\n print \"leafeon\" print newline\n return to indicate successful execution\n end of the block\n end of the block\n if s[2] is '.'\n if s[3] is 'r'\n print \"flareon\" print newline\n return to indicate successful execution\n end of the block\n if s[3] is 'c'\n print \"glaceon\" print newline\n return to indicate successful execution\n end of the block\n if s[3] is 'f'\n print \"leafeon\" print newline\n return to indicate successful execution\n end of the block\n if s[3] is 't'\n print \"jolteon\" print newline\n return to indicate successful execution\n end of the block\n if s[3] is 'v'\n print \"sylveon\" print newline\n return to indicate successful execution\n else\n print \"umbreon\" print newline\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n end of the block\n if s[0] is 'j'\n print \"jolteon\" print newline\n return to indicate successful execution\n end of the block\n if s[0] is 'f'\n print 'flareon\" print newline\n return to indicate successful execution\n end of the block\n if s[0] is 'u'\n print \"umbreon\" print newline\n return to indicate successful execution\n end of the block\n if s[0] is 'l'\n print \"leafeon\" print newline\n return to indicate successful execution\n end of the block\n if s[0] is 'g'\n print \"glaceon\" print newline\n return to indicate successful execution\n end of the block\n if s[0] is 's'\n print \"sylveon\" print newline\n return to indicate successful execution\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"pair par[10001];\nset str;\nint main() {\n string s;\n int n, i;\n cin >> n >> s;\n if (n == 8)\n cout << \"vaporeon\" << endl;\n else if (n == 6)\n cout << \"espeon\" << endl;\n else if (n == 7) {\n if (s[0] == '.') {\n if (s[1] == 'o') {\n cout << \"jolteon\" << endl;\n return 0;\n }\n if (s[1] == 'm') {\n cout << \"umbreon\" << endl;\n return 0;\n }\n if (s[1] == 'e') {\n cout << \"leafeon\" << endl;\n return 0;\n }\n if (s[1] == 'y') {\n cout << \"sylveon\" << endl;\n return 0;\n }\n if (s[1] == 'l') {\n if (s[3] == 'r') {\n cout << \"flareon\" << endl;\n return 0;\n } else {\n cout << \"glaceon\" << endl;\n return 0;\n }\n }\n if (s[1] == '.') {\n if (s[2] == 'b') {\n cout << \"umbreon\" << endl;\n return 0;\n }\n if (s[2] == 'l') {\n if (s[3] == 't') {\n cout << \"jolteon\" << endl;\n return 0;\n } else {\n cout << \"sylveon\" << endl;\n return 0;\n }\n }\n if (s[2] == 'a') {\n if (s[3] == 'r') {\n cout << \"flareon\" << endl;\n return 0;\n }\n if (s[3] == 'c') {\n cout << \"glaceon\" << endl;\n return 0;\n } else {\n cout << \"leafeon\" << endl;\n return 0;\n }\n }\n if (s[2] == '.') {\n if (s[3] == 'r') {\n cout << \"flareon\" << endl;\n return 0;\n }\n if (s[3] == 'c') {\n cout << \"glaceon\" << endl;\n return 0;\n }\n if (s[3] == 'f') {\n cout << \"leafeon\" << endl;\n return 0;\n }\n if (s[3] == 't') {\n cout << \"jolteon\" << endl;\n return 0;\n }\n if (s[3] == 'v') {\n cout << \"sylveon\" << endl;\n return 0;\n } else {\n cout << \"umbreon\" << endl;\n return 0;\n }\n }\n }\n }\n if (s[0] == 'j') {\n cout << \"jolteon\" << endl;\n return 0;\n }\n if (s[0] == 'f') {\n cout << \"flareon\" << endl;\n return 0;\n }\n if (s[0] == 'u') {\n cout << \"umbreon\" << endl;\n return 0;\n }\n if (s[0] == 'l') {\n cout << \"leafeon\" << endl;\n return 0;\n }\n if (s[0] == 'g') {\n cout << \"glaceon\" << endl;\n return 0;\n }\n if (s[0] == 's') {\n cout << \"sylveon\" << endl;\n return 0;\n }\n }\n return 0;\n}","item":{"problem_id":"452A","pseudocode":"create pair of integer, integer array par with size 10001\ncreate string set str\ndefine the main function\n create string s\n create integers n, i\n read n read s\n if n is 8\n print \"vaporeon\" print newline\n else if n is 6\n print \"espeon\" print newline\n else if n is 7\n if s[0] is '.'\n if s[1] is 'o'\n print \"jolteon\" print newline\n return to indicate successful execution\n end of the block\n if s[1] is 'm'\n print \"umbreon\" print newline\n return to indicate successful execution\n end of the block\n if s[1] is 'e'\n print \"leafeon\" print newline\n return to indicate successful execution\n end of the block\n if s[1] is 'y'\n print \"sylveon\" print newline\n return to indicate successful execution\n end of the block\n if s[1] is 'l'\n if s[3] is 'r'\n print \"flareon\" print newline\n return to indicate successful execution\n else\n print \"glaceon\" print newline\n return to indicate successful execution\n end of the block\n end of the block\n if s[1] is '.'\n if s[2] is 'b'\n print \"umbreon\" print newline\n return to indicate successful execution\n end of the block\n if s[2] is 'l'\n if s[3] is 't'\n print \"jolteon\" print newline\n return to indicate successful execution\n else\n print \"sylveon\" print newline\n return to indicate successful execution\n end of the block\n end of the block\n if s[2] is 'a'\n if s[3] is 'r'\n print \"flareon\" print newline\n return to indicate successful execution\n end of the block\n if s[3] is 'c'\n print \"glaceon\" print newline\n return to indicate successful execution\n else\n print \"leafeon\" print newline\n return to indicate successful execution\n end of the block\n end of the block\n if s[2] is '.'\n if s[3] is 'r'\n print \"flareon\" print newline\n return to indicate successful execution\n end of the block\n if s[3] is 'c'\n print \"glaceon\" print newline\n return to indicate successful execution\n end of the block\n if s[3] is 'f'\n print \"leafeon\" print newline\n return to indicate successful execution\n end of the block\n if s[3] is 't'\n print \"jolteon\" print newline\n return to indicate successful execution\n end of the block\n if s[3] is 'v'\n print \"sylveon\" print newline\n return to indicate successful execution\n else\n print \"umbreon\" print newline\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n end of the block\n if s[0] is 'j'\n print \"jolteon\" print newline\n return to indicate successful execution\n end of the block\n if s[0] is 'f'\n print 'flareon\" print newline\n return to indicate successful execution\n end of the block\n if s[0] is 'u'\n print \"umbreon\" print newline\n return to indicate successful execution\n end of the block\n if s[0] is 'l'\n print \"leafeon\" print newline\n return to indicate successful execution\n end of the block\n if s[0] is 'g'\n print \"glaceon\" print newline\n return to indicate successful execution\n end of the block\n if s[0] is 's'\n print \"sylveon\" print newline\n return to indicate successful execution\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["7","...feon"],["leafeon"]],[["7",".l.r.o."],["flareon"]],[["6",".s..o."],["espeon"]],[["7","glaceon"],["glaceon"]],[["8",".a.o.e.n"],["vaporeon"]],[["7",".laceon"],["glaceon"]],[["7","..lveon"],["sylveon"]],[["7",".l.ceon"],["glaceon"]],[["7","..areon"],["flareon"]]]}} +{"instance_id":"pseudo_to_code_2k_9","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n str = string array of size 12\n n, i, j, ck = int\n read n then str[0]\n set str[1] to \"vaporeon\"\n set str[2] to \"jolteon\"\n set str[3] to \"flareon\"\n set str[4] to \"espeon\"\n set str[5] to \"umbreon\"\n set str[6] to \"leafeon\"\n set str[7] to \"glaceon\"\n set str[8] to \"sylveon\"\n for i = 1 to 8 inclusive\n if size of str[i] is n\n set ck to 1\n for j = 0 to n\n if str[0][j] >= 'a' and str[0][j] <= 'z'\n if str[0][j] is not str[i][j]\n set ck to 0\n break\n end of the block\n end of the block\n end of the block\n if ck is 1\n print str[i]\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n print newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n string str[12];\n int n, i, j, ck;\n cin >> n >> str[0];\n str[1] = \"vaporeon\";\n str[2] = \"jolteon\";\n str[3] = \"flareon\";\n str[4] = \"espeon\";\n str[5] = \"umbreon\";\n str[6] = \"leafeon\";\n str[7] = \"glaceon\";\n str[8] = \"sylveon\";\n for (i = 1; i <= 8; i++) {\n if (str[i].size() == n) {\n ck = 1;\n for (j = 0; j < n; j++) {\n if (str[0][j] >= 'a' && str[0][j] <= 'z') {\n if (str[0][j] != str[i][j]) {\n ck = 0;\n break;\n }\n }\n }\n if (ck == 1) {\n cout << str[i] << endl;\n return 0;\n }\n }\n }\n cout << endl;\n return 0;\n}","item":{"problem_id":"452A","pseudocode":"define the main function\n str = string array of size 12\n n, i, j, ck = int\n read n then str[0]\n set str[1] to \"vaporeon\"\n set str[2] to \"jolteon\"\n set str[3] to \"flareon\"\n set str[4] to \"espeon\"\n set str[5] to \"umbreon\"\n set str[6] to \"leafeon\"\n set str[7] to \"glaceon\"\n set str[8] to \"sylveon\"\n for i = 1 to 8 inclusive\n if size of str[i] is n\n set ck to 1\n for j = 0 to n\n if str[0][j] >= 'a' and str[0][j] <= 'z'\n if str[0][j] is not str[i][j]\n set ck to 0\n break\n end of the block\n end of the block\n end of the block\n if ck is 1\n print str[i]\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n print newline\n return to indicate successful execution\nend of the block","testcases":[[["7","...feon"],["leafeon"]],[["7",".l.r.o."],["flareon"]],[["6",".s..o."],["espeon"]],[["7","glaceon"],["glaceon"]],[["8",".a.o.e.n"],["vaporeon"]],[["7",".laceon"],["glaceon"]],[["7","..lveon"],["sylveon"]],[["7",".l.ceon"],["glaceon"]],[["7","..areon"],["flareon"]]]}} +{"instance_id":"pseudo_to_code_2k_10","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create integer N\n create string jolteon with jolteon = \"jolteaon\"\n create integer jol with jol = 0\n create string flareon with flareon = \"flareon\"\n create integer fla with fla = 0\n create string umbreon with umbreon = \"umbreon\"\n create integer umb with umb = 0\n create string leafeon with leafeon = \"leafeon\"\n create integer leaf with leaf = 0\n create string glaceon with glaceon = \"glaceon\"\n create integer gla with gla = 0\n create string sylveon with sylveon = \"sylveon\"\n create integer syl with syl = 0\n create string eevee\n read N\n read eevee\n if N is 8\n print \"vaporeon\\n\"\n else if N is 6\n print \"espeon\\n\"\n else\n for x = 0 to N exclusive\n if eevee[x] is not '.'\n iif eevee[x] is flareon[x] and fla is 0\n if x is not 2, set leaf to 1\n set jol to 1\n set syl to 1\n set umb to 1\n if x is not 1 and x is not 2, set gla to 1\n end of the block\n if eevee[x] is glaceon[x] and gla is 0\n if x is not 2, set leaf to 1\n set jol to 1\n set syl to 1\n set umb to 1\n if x is not 1 and x is not 2, set fla to 1\n end of the block\n if eevee[x] is leafeon[x] and leaf is 0\n if x is not 2\n set fla to 1\n set gla to 1\n end of the block\n set jol to 1\n set syl to 1\n set umb to 1\n end of the block\n if eevee[x] is jolteon[x] and jol is 0\n set leaf to 1\n set fla to 1\n if x is not 2, set syl to 1\n set umb to 1\n set gla to 1\n end of the block\n if eevee[x] is umbreon[x] and umb is 0\n set leaf to 1\n set jol to 1\n set syl to 1\n set fla to 1\n set gla to 1\n end of the block\n if eevee[x] is sylveon[x] and syl is 0\n set leaf to 1\n set fla to 1\n if x is not 2, set jol to 1\n set umb to 1\n set gla to 1\n end of the block\n if syl + leaf + jol + umb + gla + fla is 5\n if syl is 0, print sylveon print \"\\n\"\n if gla is 0, print glaceon print \"\\n\"\n if fla is 0, print flareon print \"\\n\"\n if jol is 0, print jolteon print \"\\n\"\n if umb is 0 print umbreon print \"\\n\"\n if leaf is 0 print leafon print \"\\n\"\n break loop\n end of the block\n end of the block\n end of the block\n end of the block\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int N;\n string jolteon = \"jolteon\";\n int jol = 0;\n string flareon = \"flareon\";\n int fla = 0;\n string umbreon = \"umbreon\";\n int umb = 0;\n string leafeon = \"leafeon\";\n int leaf = 0;\n string glaceon = \"glaceon\";\n int gla = 0;\n string sylveon = \"sylveon\";\n int syl = 0;\n string eevee;\n cin >> N;\n cin >> eevee;\n if (N == 8) {\n cout << \"vaporeon\\n\";\n } else if (N == 6) {\n cout << \"espeon\\n\";\n } else {\n for (int x = 0; x < N; x++) {\n if (eevee[x] != '.') {\n if (eevee[x] == flareon[x] && fla == 0) {\n if (x != 2) { leaf = 1; }\n jol = 1;\n syl = 1;\n umb = 1;\n if (x != 1 && x != 2) { gla = 1; }\n }\n if (eevee[x] == glaceon[x] && gla == 0) {\n if (x != 2) { leaf = 1; }\n jol = 1;\n syl = 1;\n umb = 1;\n if (x != 1 && x != 2) { fla = 1; }\n }\n if (eevee[x] == leafeon[x] && leaf == 0) {\n if (x != 2) {\n fla = 1;\n gla = 1;\n }\n jol = 1;\n syl = 1;\n umb = 1;\n }\n if (eevee[x] == jolteon[x] && jol == 0) {\n leaf = 1;\n fla = 1;\n if (x != 2) { syl = 1; }\n umb = 1;\n gla = 1;\n }\n if (eevee[x] == umbreon[x] && umb == 0) {\n leaf = 1;\n jol = 1;\n syl = 1;\n fla = 1;\n gla = 1;\n }\n if (eevee[x] == sylveon[x] && syl == 0) {\n leaf = 1;\n fla = 1;\n if (x != 2) { jol = 1; }\n umb = 1;\n gla = 1;\n }\n if (syl + leaf + jol + umb + gla + fla == 5) {\n if (syl == 0) { cout << sylveon << \"\\n\"; }\n if (gla == 0) { cout << glaceon << \"\\n\"; }\n if (fla == 0) { cout << flareon << \"\\n\"; }\n if (jol == 0) { cout << jolteon << \"\\n\"; }\n if (umb == 0) { cout << umbreon << \"\\n\"; }\n if (leaf == 0) { cout << leafeon << \"\\n\"; }\n break;\n }\n }\n }\n }\n}","item":{"problem_id":"452A","pseudocode":"define the main function\n create integer N\n create string jolteon with jolteon = \"jolteaon\"\n create integer jol with jol = 0\n create string flareon with flareon = \"flareon\"\n create integer fla with fla = 0\n create string umbreon with umbreon = \"umbreon\"\n create integer umb with umb = 0\n create string leafeon with leafeon = \"leafeon\"\n create integer leaf with leaf = 0\n create string glaceon with glaceon = \"glaceon\"\n create integer gla with gla = 0\n create string sylveon with sylveon = \"sylveon\"\n create integer syl with syl = 0\n create string eevee\n read N\n read eevee\n if N is 8\n print \"vaporeon\\n\"\n else if N is 6\n print \"espeon\\n\"\n else\n for x = 0 to N exclusive\n if eevee[x] is not '.'\n iif eevee[x] is flareon[x] and fla is 0\n if x is not 2, set leaf to 1\n set jol to 1\n set syl to 1\n set umb to 1\n if x is not 1 and x is not 2, set gla to 1\n end of the block\n if eevee[x] is glaceon[x] and gla is 0\n if x is not 2, set leaf to 1\n set jol to 1\n set syl to 1\n set umb to 1\n if x is not 1 and x is not 2, set fla to 1\n end of the block\n if eevee[x] is leafeon[x] and leaf is 0\n if x is not 2\n set fla to 1\n set gla to 1\n end of the block\n set jol to 1\n set syl to 1\n set umb to 1\n end of the block\n if eevee[x] is jolteon[x] and jol is 0\n set leaf to 1\n set fla to 1\n if x is not 2, set syl to 1\n set umb to 1\n set gla to 1\n end of the block\n if eevee[x] is umbreon[x] and umb is 0\n set leaf to 1\n set jol to 1\n set syl to 1\n set fla to 1\n set gla to 1\n end of the block\n if eevee[x] is sylveon[x] and syl is 0\n set leaf to 1\n set fla to 1\n if x is not 2, set jol to 1\n set umb to 1\n set gla to 1\n end of the block\n if syl + leaf + jol + umb + gla + fla is 5\n if syl is 0, print sylveon print \"\\n\"\n if gla is 0, print glaceon print \"\\n\"\n if fla is 0, print flareon print \"\\n\"\n if jol is 0, print jolteon print \"\\n\"\n if umb is 0 print umbreon print \"\\n\"\n if leaf is 0 print leafon print \"\\n\"\n break loop\n end of the block\n end of the block\n end of the block\n end of the block\nend of the block","testcases":[[["7","...feon"],["leafeon"]],[["7",".l.r.o."],["flareon"]],[["6",".s..o."],["espeon"]],[["7","glaceon"],["glaceon"]],[["8",".a.o.e.n"],["vaporeon"]],[["7",".laceon"],["glaceon"]],[["7","..lveon"],["sylveon"]],[["7",".l.ceon"],["glaceon"]],[["7","..areon"],["flareon"]]]}} +{"instance_id":"pseudo_to_code_2k_11","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n a,n,b,c=int\n s=array of 8 char\n w=array of 8 char filled with \"jolteon\", q=array of 8 char filled with \"flareon\"\n v=array of 8 char filled with \"umbreon\", z=array of 8 char filled with \"leafeon\", l=array of 8 char filled with \"glaceeon\", m=array of 8 char filled with \"sylveon\"\n read n\n read s\n if n is 8\n print \"vaporeon\"\n else if n is 6\n print \"espeon\"\n else\n a=0\n b=0\n c=0\n d=0\n e=0\n f=0\n for i=0 to 8 exclusive\n if s[i] is w[i] increment a\n end of the block\n for i=0 to 8 exclusive\n if s[i] is q[i] increment b\n end of the block\n for i=0 to 8 exclusive\n if s[i] is v[i] increment c\n end of the block\n for i=0 to 8 exclusive\n if s[i] is z[i] increment d\n end of the block\n for i=0 to 8 exclusive\n if s[i] is l[i] increment e\n end of the block\n for i=0 to 8 exclusive\n if s[i] is m[i] increment f\n end of the block\n if a>b and a>c and a>d and a>e and a>f\n print \"jolteon\"\n if b>a and b>c and b>d and b>e and b>f\n print \"flareon\"\n if c>a and c>b and c>d and c>e and c>f\n print \"umbreon\"\n if d>a and d>b and d>c and d>e and d>f\n print \"leafeon\"\n if e>a and e>b and e>c and e>d and e>f\n print \"glaceon\"\n if f>a and f>b and f>c and f>d and f>e\n print \"sylveon\"\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int a, n, b, c;\n char s[8];\n char w[8] = \"jolteon\", q[8] = \"flareon\";\n char v[8] = \"umbreon\", z[8] = \"leafeon\", l[8] = \"glaceon\", m[8] = \"sylveon\";\n cin >> n;\n cin >> s;\n if (n == 8) {\n cout << \"vaporeon\" << endl;\n } else if (n == 6) {\n cout << \"espeon\" << endl;\n } else {\n a = 0;\n b = 0;\n c = 0;\n int d = 0;\n int e = 0;\n int f = 0;\n for (int i = 0; i < 8; i++) {\n if (s[i] == w[i]) { a++; }\n }\n for (int i = 0; i < 8; i++) {\n if (s[i] == q[i]) { b++; }\n }\n for (int i = 0; i < 8; i++) {\n if (s[i] == v[i]) { c++; }\n }\n for (int i = 0; i < 8; i++) {\n if (s[i] == z[i]) { d++; }\n }\n for (int i = 0; i < 8; i++) {\n if (s[i] == l[i]) { e++; }\n }\n for (int i = 0; i < 8; i++) {\n if (s[i] == m[i]) { f++; }\n }\n if (a > b && a > c && a > d && a > e && a > f) {\n cout << \"jolteon\" << endl;\n } else if (b > a && b > c && b > d && b > e && b > f) {\n cout << \"flareon\" << endl;\n } else if (c > a && c > b && c > d && c > e && c > f) {\n cout << \"umbreon\" << endl;\n } else if (d > a && d > c && d > b && d > e && d > f) {\n cout << \"leafeon\" << endl;\n } else if (e > a && e > c && e > d && e > b && e > f) {\n cout << \"glaceon\" << endl;\n } else if (f > a && f > c && f > d && f > e && f > b) {\n cout << \"sylveon\" << endl;\n }\n }\n return 0;\n}","item":{"problem_id":"452A","pseudocode":"define the main function\n a,n,b,c=int\n s=array of 8 char\n w=array of 8 char filled with \"jolteon\", q=array of 8 char filled with \"flareon\"\n v=array of 8 char filled with \"umbreon\", z=array of 8 char filled with \"leafeon\", l=array of 8 char filled with \"glaceeon\", m=array of 8 char filled with \"sylveon\"\n read n\n read s\n if n is 8\n print \"vaporeon\"\n else if n is 6\n print \"espeon\"\n else\n a=0\n b=0\n c=0\n d=0\n e=0\n f=0\n for i=0 to 8 exclusive\n if s[i] is w[i] increment a\n end of the block\n for i=0 to 8 exclusive\n if s[i] is q[i] increment b\n end of the block\n for i=0 to 8 exclusive\n if s[i] is v[i] increment c\n end of the block\n for i=0 to 8 exclusive\n if s[i] is z[i] increment d\n end of the block\n for i=0 to 8 exclusive\n if s[i] is l[i] increment e\n end of the block\n for i=0 to 8 exclusive\n if s[i] is m[i] increment f\n end of the block\n if a>b and a>c and a>d and a>e and a>f\n print \"jolteon\"\n if b>a and b>c and b>d and b>e and b>f\n print \"flareon\"\n if c>a and c>b and c>d and c>e and c>f\n print \"umbreon\"\n if d>a and d>b and d>c and d>e and d>f\n print \"leafeon\"\n if e>a and e>b and e>c and e>d and e>f\n print \"glaceon\"\n if f>a and f>b and f>c and f>d and f>e\n print \"sylveon\"\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["7","...feon"],["leafeon"]],[["7",".l.r.o."],["flareon"]],[["6",".s..o."],["espeon"]],[["7","glaceon"],["glaceon"]],[["8",".a.o.e.n"],["vaporeon"]],[["7",".laceon"],["glaceon"]],[["7","..lveon"],["sylveon"]],[["7",".l.ceon"],["glaceon"]],[["7","..areon"],["flareon"]]]}} +{"instance_id":"pseudo_to_code_2k_12","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate long long integers x and y\ndeclare exgcd taking in long long integers a and returning long longand b\n if b is equal to 0\n set x to 1\n set y to 0\n return a\n end of the block\n create long long d = exgcd(b, a % b)\n create long long t = x\n set x to y\n set y to the result of t - a \/ b * y\n return d\nend of the block\ndefine the main function\n create long long integers m, h1, al, x1, y1, h2, a2, x2, y2\n create long long integers p1, p2, q1, q2\n while cin >> m >> h1 >> a1 >> x1 >> y1 >> h2 >> a2 >> x2 >> y2 is truthy\n set p1, p2, q1, and q1 to 0\n for i = 1 to 2 * m\n set h1 to (h1 * x1 + y1) % m\n if h1 is equal to a1\n if p1 is equal to 0\n set p1 to i\n else if q1 is equal to 0\n set q1 to the result of i - p1\n break loop\n end of the block\n end of the block\n end of the block\n for i = 1 to 2 * m\n set h2 to the result of (h2 * x2 + y2) % m\n if h2 is equal to a2\n if p2 is equal to 0\n set p2 to i\n else if q2 is equal to 0\n set q2 to the result of i - p2\n break loop\n end of the block\n end of the block\n end of the block\n create long long d = exgcd(q1, -q2)\n create long long c = p2 - p1\n if d is equal to 0\n print \"-1\"\n continue to next loop iteration\n end of the block\n if c modulo d is truthy\n print \"-1\"\n continue to next loop iteration\n end of the block\n if d is less than 0, set d to -d\n if p1 is equal to 0 or p2 is equal to 0\n print \"-1\"\n continue to next loop iteration\n end of the block\n if q2 is equal to 0 and q1 is equal to 0 and p1 is not equal to p2\n print \"-1\"\n continue to next loop iteration\n end of the block\n if q2 is equal to 0 and p2 - p1 is less than 0 or q1 is equal to 0 and p1 - p2 is less than 0\n print \"-1\"\n continue to next loop iteration\n end of the block\n create long long k = c \/ d\n if the return value of exgcd(q1, -q2) is less than 0, set x to -x and set y to -y\n set x to the result of x * k\n set y to the result of y * k\n if x is less than 0 or y is less than 0\n while 1 is truthy\n set x to the result of x + q2 \/ d\n set y to the result of y + q1 \/ d\n if x is greater than or equal to 0 and y is greater than or equal to 0, break loop\n end of the block\n end of the block\n if x is greater than 0 and y is greater then 0\n while 1 is truthy\n set x to the result of x - q2 \/ d\n set y to the result of y - q1 \/ d\n if x is less than 0 or y is less than 0, break loop\n end of the block\n set x to the result of x + q2 \/ d\n set y to the result of y + q1 \/ d\n end of the block\n create long long ans = x * q1 + p1\n print ans\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long x, y;\nlong long exgcd(long long a, long long b) {\n if (b == 0) {\n x = 1;\n y = 0;\n return a;\n }\n long long d = exgcd(b, a % b);\n long long t = x;\n x = y;\n y = t - a \/ b * y;\n return d;\n}\nint main() {\n long long m, h1, a1, x1, y1, h2, a2, x2, y2;\n long long p1, p2, q1, q2;\n while (cin >> m >> h1 >> a1 >> x1 >> y1 >> h2 >> a2 >> x2 >> y2) {\n p1 = p2 = q1 = q2 = 0;\n for (long long i = 1; i <= 2 * m; i++) {\n h1 = (h1 * x1 + y1) % m;\n if (h1 == a1) {\n if (p1 == 0)\n p1 = i;\n else if (q1 == 0) {\n q1 = i - p1;\n break;\n }\n }\n }\n for (long long i = 1; i <= 2 * m; i++) {\n h2 = (h2 * x2 + y2) % m;\n if (h2 == a2) {\n if (p2 == 0)\n p2 = i;\n else if (q2 == 0) {\n q2 = i - p2;\n break;\n }\n }\n }\n long long d = exgcd(q1, -q2);\n long long c = p2 - p1;\n if (d == 0) {\n puts(\"-1\");\n continue;\n }\n if (c % d) {\n puts(\"-1\");\n continue;\n }\n if (d < 0) d = -d;\n if (p1 == 0 || p2 == 0) {\n puts(\"-1\");\n continue;\n }\n if (q2 == 0 && q1 == 0 && p1 != p2) {\n puts(\"-1\");\n continue;\n }\n if ((q2 == 0 && p2 - p1 < 0) || (q1 == 0 && p1 - p2 < 0)) {\n puts(\"-1\");\n continue;\n }\n long long k = c \/ d;\n if (exgcd(q1, -q2) < 0) x = -x, y = -y;\n x *= k;\n y *= k;\n if (x < 0 || y < 0) {\n while (1) {\n x += q2 \/ d;\n y += q1 \/ d;\n if (x >= 0 && y >= 0) break;\n }\n }\n if (x > 0 && y > 0) {\n while (1) {\n x -= q2 \/ d;\n y -= q1 \/ d;\n if (x < 0 || y < 0) break;\n }\n x += q2 \/ d;\n y += q1 \/ d;\n }\n long long ans = x * q1 + p1;\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"547A","pseudocode":"create long long integers x and y\ndeclare exgcd taking in long long integers a and returning long longand b\n if b is equal to 0\n set x to 1\n set y to 0\n return a\n end of the block\n create long long d = exgcd(b, a % b)\n create long long t = x\n set x to y\n set y to the result of t - a \/ b * y\n return d\nend of the block\ndefine the main function\n create long long integers m, h1, al, x1, y1, h2, a2, x2, y2\n create long long integers p1, p2, q1, q2\n while cin >> m >> h1 >> a1 >> x1 >> y1 >> h2 >> a2 >> x2 >> y2 is truthy\n set p1, p2, q1, and q1 to 0\n for i = 1 to 2 * m\n set h1 to (h1 * x1 + y1) % m\n if h1 is equal to a1\n if p1 is equal to 0\n set p1 to i\n else if q1 is equal to 0\n set q1 to the result of i - p1\n break loop\n end of the block\n end of the block\n end of the block\n for i = 1 to 2 * m\n set h2 to the result of (h2 * x2 + y2) % m\n if h2 is equal to a2\n if p2 is equal to 0\n set p2 to i\n else if q2 is equal to 0\n set q2 to the result of i - p2\n break loop\n end of the block\n end of the block\n end of the block\n create long long d = exgcd(q1, -q2)\n create long long c = p2 - p1\n if d is equal to 0\n print \"-1\"\n continue to next loop iteration\n end of the block\n if c modulo d is truthy\n print \"-1\"\n continue to next loop iteration\n end of the block\n if d is less than 0, set d to -d\n if p1 is equal to 0 or p2 is equal to 0\n print \"-1\"\n continue to next loop iteration\n end of the block\n if q2 is equal to 0 and q1 is equal to 0 and p1 is not equal to p2\n print \"-1\"\n continue to next loop iteration\n end of the block\n if q2 is equal to 0 and p2 - p1 is less than 0 or q1 is equal to 0 and p1 - p2 is less than 0\n print \"-1\"\n continue to next loop iteration\n end of the block\n create long long k = c \/ d\n if the return value of exgcd(q1, -q2) is less than 0, set x to -x and set y to -y\n set x to the result of x * k\n set y to the result of y * k\n if x is less than 0 or y is less than 0\n while 1 is truthy\n set x to the result of x + q2 \/ d\n set y to the result of y + q1 \/ d\n if x is greater than or equal to 0 and y is greater than or equal to 0, break loop\n end of the block\n end of the block\n if x is greater than 0 and y is greater then 0\n while 1 is truthy\n set x to the result of x - q2 \/ d\n set y to the result of y - q1 \/ d\n if x is less than 0 or y is less than 0, break loop\n end of the block\n set x to the result of x + q2 \/ d\n set y to the result of y + q1 \/ d\n end of the block\n create long long ans = x * q1 + p1\n print ans\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["5","4 2","1 1","0 1","2 3"],["3"]],[["1023","1 2","1 0","1 2","1 1"],["-1"]],[["1023","1 2","1 2","1 2","1 2"],["512"]],[["2","0 1","1 0","1 0","0 1"],["-1"]],[["17","15 12","15 12","12 14","1 11"],["-1"]],[["29","4 0","1 1","25 20","16 0"],["170"]],[["91","9 64","75 32","60 81","35 46"],["5"]],[["91","38 74","66 10","40 76","17 13"],["-1"]],[["100","11 20","99 31","60 44","45 64"],["3"]],[["9999","4879 6224","63 7313","4279 6583","438 1627"],["4"]],[["10000","8681 4319","9740 5980","24 137","462 7971"],["-1"]],[["100000","76036 94415","34870 43365","56647 26095","88580 30995"],["5"]],[["100000","90861 77058","96282 30306","45940 25601","17117 48287"],["-1"]],[["1000000","220036 846131","698020 485511","656298 242999","766802 905433"],["5297"]],[["1000000","536586 435396","748740 34356","135075 790803","547356 534911"],["9958"]],[["1000000","661647 690400","864868 326304","581148 452012","327910 197092"],["1021"]],[["1000000","233404 949288","893747 751429","692094 57207","674400 583468"],["-1"]],[["1000000","358465 242431","977171 267570","170871 616951","711850 180241"],["-1"]],[["1000000","707719 502871","60595 816414","649648 143990","525107 66615"],["-1"]],[["999983","192005 690428","971158 641039","974183 1882","127579 312317"],["470479"]],[["999983","420528 808305","387096 497121","596163 353326","47177 758204"],["548500"]],[["999983","651224 992349","803017 393514","258455 402487","888310 244420"],["126531"]],[["999983","151890 906425","851007 9094","696594 968184","867017 157783"],["-1"]],[["999983","380412 325756","266945 907644","318575 83081","786616 603671"],["-1"]],[["999983","570797 704759","723177 763726","978676 238272","708387 89886"],["-1"]],[["999983","408725 408721","1 1","378562 294895","984270 0"],["499981500166"]],[["999983","639420 639416","1 1","507684 954997","466316 0"],["499981500166"]],[["999983","867942 867939","1 1","963840 536667","899441 0"],["999964000320"]],[["999961","664221 931770","530542 936292","885122 515424","868560 472225"],["-1"]],[["999961","744938 661980","845908 76370","237399 381935","418010 938769"],["203332"]],[["999961","89288 89284","1 1","764559 727291","999322 0"],["999920001595"]],[["1000000","661703 661699","1 1","425192 823944","854093 0"],["-1"]],[["100019","98811 98807","1 1","91322 14787","72253 0"],["10003600319"]],[["524288","199980 199978","1 1","236260 325076","81773 0"],["-1"]],[["524288","47283 489031","305624 183135","141146 335913","519614 150715"],["19"]],[["524288","83398 33987","158854 211502","36433 18758","218812 517001"],["-1"]],[["912488","681639 518634","168348 212018","255428 4970","31726 664998"],["34838"]],[["129081","128454 36771","116353 2940","95311 22200","579 118683"],["68409"]],[["129081","45717 106320","121816 69841","5161 4872","102076 100020"],["-1"]],[["4","1 2","1 1","0 1","2 0"],["-1"]],[["3","1 0","1 1","1 2","2 0"],["5"]],[["3","0 2","1 0","2 0","2 1"],["-1"]],[["2","0 1","0 1","0 1","0 1"],["1"]],[["2","0 1","1 0","0 1","1 0"],["-1"]],[["2","0 1","1 1","0 1","1 1"],["1"]],[["2","0 1","1 1","0 1","1 0"],["-1"]],[["2","0 1","1 0","0 1","1 1"],["-1"]],[["1000000","1 0","1 1","1 0","1 1"],["999999"]],[["1000000","2 1","1 1","2 0","1 2"],["999999"]],[["6","1 2","3 5","0 2","4 2"],["1"]],[["545","26 40","477 97","454 394","15 264"],["90"]],[["3","1 0","0 1","0 2","1 0"],["-1"]],[["1376","1227 1349","313 193","1113 361","1314 23"],["338"]],[["1376","1322 1320","1 1","776 495","38 0"],["-1"]],[["1376","152 405","1083 1328","76 856","49 629"],["-1"]],[["1392","1060 796","512 242","1386 1346","1310 1199"],["-1"]],[["100000","5827 41281","41285 70821","99199 42807","65667 94952"],["13770"]],[["100000","51157 27741","40564 90740","45270 52367","31585 92150"],["-1"]],[["100000","70525 70522","1 1","89465 30265","33279 0"],["-1"]],[["10","1 6","7 9","1 4","4 0"],["1"]],[["10","9 6","0 8","3 0","2 7"],["-1"]],[["10","4 2","1 1","7 3","9 0"],["-1"]],[["6","5 1","1 1","3 1","3 0"],["-1"]],[["999983","3 1","1 1","8 1","2 0"],["499981500168"]],[["18","3 9","3 0","1 3","3 0"],["1"]],[["18","1 3","3 0","3 9","3 0"],["1"]],[["16","1 0","2 0","1 2","2 0"],["-1"]],[["16","8 0","2 0","1 4","2 0"],["2"]],[["999983","2 1","2 0","1 0","1 1"],["499982500152"]],[["324","2 54","3 0","27 108","2 0"],["-1"]],[["999993","499997 1","2 3","1 4","1 1"],["39325724721"]],[["999983","1 37827","1 1","2 192083","3 0"],["404303164556"]],[["41222","30759 26408","31332 39118","5026 25812","1 9030"],["58900566"]],[["100007","2 1","2 0","3 1","1 1"],["434330399"]],[["8","0 4","4 4","1 4","2 0"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_13","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nvis1 = array of long integers of length 1000005\nvis2 = array of long integers of length 1000005\ndefine the main function\n let m be a long integer\n let h1, a1 be long integers\n let x1, y1 be long integers\n let h2, a2 be long integers\n let x2, y2 be long integers\n read m, h1, a1, x1, y1, h2, a2, x2, y2\n memset of vis1, 0, size of vis1\n memset of vis2, 0, size of vis2\n let t1, t2 be long integers with t1 = -1, t2 = -1\n let c1, c2 be long integers with c1 = -1, c2 = -1\n let q1, q2 be long integers with q1 = -1, q2 = -1\n let f1, f2 be long integers with f1 = -1, f2 = -1\n set boolean value flag to true\n set boolean value fuck to false\n for long integer i = 1 to 2 * m inclusive\n the value of h1 = h1 * x1\n the value of h1 = h1 modulo m\n the value of h1 = h1 + y1\n the value of h1 = h1 modulo m\n the value of h2 = h2 * x2\n the value of h2 = h2 modulo m\n the value of h2 = h2 + y2\n the value of h2 = h2 modulo m\n if h1 is equal to a1 and a2 is equal to h2\n set fuck to true\n print i and newline\n stop\n end of the block\n if vis1[a1] is equal to 0 and h1 is equal to a1, f1 is equal to i\n if vis2[a2] is equal to 0 and h2 is equal to a2, f2 is equal to i\n if h1 is equal to a1 and t1 is equal to -1, c1 is equal to i\n if h2 is equal to a2 and t2 is equal to -1, c2 is equal to i\n if vis1[h1] is not equal to 0 and q1 is equal to -1\n the value of q1 is equal to vis1[h1]\n the value of t1 is equal to i - q1\n if c1 is less than q1\n set flag to false\n stop\n else do the following\n decrement c1 by q1\n end of the block\n end of the block\n if vis2[h2] is not equal to 0 and q2 is equal to -1\n the value of q2 is equal to vis2[h2]\n the value of t2 is equal to i - q2\n if c2 is less than q2\n set flag to false\n stop\n else do the following\n decrement c2 by q2\n end of the block\n end of the block\n if t1 is not equal to -1 and t2 is not equal to -1, stop\n if vis1[h1] is equal to 0, vis1[h1] is equal to i\n if vis2[h2] is equal to 0, vis2[h2] is equal to i\n end of the block\n if fuck is true\n else if not flag\n if f1 is not equal to f2 or f1 is equal to -1 or f2 is equal to -1\n print -1 and newline\n else do the following\n print f1 + 1 and newline\n else do the following\n if f1 is equal to f2 and f1 is not equal to -1 and f2 is not equal to -2\n print f1 and newline\n else if t1 is equal to t2 and (c1 is equal to c2 and f1 is not equal to f2) or c1 is not equal to c2\n print -1 and newline\n end of the block\n else do the following\n let x be a long integer with x = 0\n while x * t1 + c1 + q1 - c2 - q2 modulo t2 is not equal to 0\n increment x by 1\n if x is greater than 1000000, stop\n end of the block\n if x is greater than 1000000\n print -1 and newline\n else do the following\n print x * t1 + c1 + q1 and newline\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long vis1[1000005];\nlong long vis2[1000005];\nint main() {\n long long m;\n long long h1, a1;\n long long x1, y1;\n long long h2, a2;\n long long x2, y2;\n cin >> m >> h1 >> a1 >> x1 >> y1 >> h2 >> a2 >> x2 >> y2;\n memset(vis1, 0, sizeof(vis1));\n memset(vis2, 0, sizeof(vis2));\n long long t1 = -1, t2 = -1;\n long long c1 = -1, c2 = -1;\n long long q1 = -1, q2 = -1;\n long long f1 = -1, f2 = -1;\n bool flag = true;\n bool fuck = false;\n for (long long i = 1; i <= 2 * m; i++) {\n h1 *= x1;\n h1 %= m;\n h1 += y1;\n h1 %= m;\n h2 *= x2;\n h2 %= m;\n h2 += y2;\n h2 %= m;\n if (h1 == a1 && a2 == h2) {\n fuck = true;\n cout << i << endl;\n break;\n }\n if (vis1[a1] == 0 && h1 == a1) { f1 = i; }\n if (vis2[a2] == 0 && h2 == a2) { f2 = i; }\n if (h1 == a1 && t1 == -1) { c1 = i; }\n if (h2 == a2 && t2 == -1) { c2 = i; }\n if (vis1[h1] != 0 && q1 == -1) {\n q1 = vis1[h1];\n t1 = i - q1;\n if (c1 < q1) {\n flag = false;\n break;\n } else {\n c1 = c1 - q1;\n }\n }\n if (vis2[h2] != 0 && q2 == -1) {\n q2 = vis2[h2];\n t2 = i - q2;\n if (c2 < q2) {\n flag = false;\n break;\n } else {\n c2 = c2 - q2;\n }\n }\n if (t1 != -1 && t2 != -1) { break; }\n if (vis1[h1] == 0) vis1[h1] = i;\n if (vis2[h2] == 0) vis2[h2] = i;\n }\n if (fuck) {\n } else if (!flag) {\n if (f1 != f2 || f1 == -1 || f2 == -1)\n cout << \"-1\\n\";\n else\n cout << f1 + 1 << \"\\n\";\n } else {\n if (f1 == f2 && f1 != -1 && f2 != -2) {\n cout << f1 << \"\\n\";\n } else if (t1 == t2 && ((c1 == c2 && f1 != f2) || c1 != c2)) {\n cout << \"-1\\n\";\n }\n else {\n long long x = 0;\n while ((x * t1 + c1 + q1 - c2 - q2) % t2 != 0) {\n x++;\n if (x > 1000000) { break; }\n }\n if (x > 1000000) {\n cout << \"-1\" << endl;\n } else\n cout << x * t1 + c1 + q1 << \"\\n\";\n }\n }\n return 0;\n}","item":{"problem_id":"547A","pseudocode":"vis1 = array of long integers of length 1000005\nvis2 = array of long integers of length 1000005\ndefine the main function\n let m be a long integer\n let h1, a1 be long integers\n let x1, y1 be long integers\n let h2, a2 be long integers\n let x2, y2 be long integers\n read m, h1, a1, x1, y1, h2, a2, x2, y2\n memset of vis1, 0, size of vis1\n memset of vis2, 0, size of vis2\n let t1, t2 be long integers with t1 = -1, t2 = -1\n let c1, c2 be long integers with c1 = -1, c2 = -1\n let q1, q2 be long integers with q1 = -1, q2 = -1\n let f1, f2 be long integers with f1 = -1, f2 = -1\n set boolean value flag to true\n set boolean value fuck to false\n for long integer i = 1 to 2 * m inclusive\n the value of h1 = h1 * x1\n the value of h1 = h1 modulo m\n the value of h1 = h1 + y1\n the value of h1 = h1 modulo m\n the value of h2 = h2 * x2\n the value of h2 = h2 modulo m\n the value of h2 = h2 + y2\n the value of h2 = h2 modulo m\n if h1 is equal to a1 and a2 is equal to h2\n set fuck to true\n print i and newline\n stop\n end of the block\n if vis1[a1] is equal to 0 and h1 is equal to a1, f1 is equal to i\n if vis2[a2] is equal to 0 and h2 is equal to a2, f2 is equal to i\n if h1 is equal to a1 and t1 is equal to -1, c1 is equal to i\n if h2 is equal to a2 and t2 is equal to -1, c2 is equal to i\n if vis1[h1] is not equal to 0 and q1 is equal to -1\n the value of q1 is equal to vis1[h1]\n the value of t1 is equal to i - q1\n if c1 is less than q1\n set flag to false\n stop\n else do the following\n decrement c1 by q1\n end of the block\n end of the block\n if vis2[h2] is not equal to 0 and q2 is equal to -1\n the value of q2 is equal to vis2[h2]\n the value of t2 is equal to i - q2\n if c2 is less than q2\n set flag to false\n stop\n else do the following\n decrement c2 by q2\n end of the block\n end of the block\n if t1 is not equal to -1 and t2 is not equal to -1, stop\n if vis1[h1] is equal to 0, vis1[h1] is equal to i\n if vis2[h2] is equal to 0, vis2[h2] is equal to i\n end of the block\n if fuck is true\n else if not flag\n if f1 is not equal to f2 or f1 is equal to -1 or f2 is equal to -1\n print -1 and newline\n else do the following\n print f1 + 1 and newline\n else do the following\n if f1 is equal to f2 and f1 is not equal to -1 and f2 is not equal to -2\n print f1 and newline\n else if t1 is equal to t2 and (c1 is equal to c2 and f1 is not equal to f2) or c1 is not equal to c2\n print -1 and newline\n end of the block\n else do the following\n let x be a long integer with x = 0\n while x * t1 + c1 + q1 - c2 - q2 modulo t2 is not equal to 0\n increment x by 1\n if x is greater than 1000000, stop\n end of the block\n if x is greater than 1000000\n print -1 and newline\n else do the following\n print x * t1 + c1 + q1 and newline\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["5","4 2","1 1","0 1","2 3"],["3"]],[["1023","1 2","1 0","1 2","1 1"],["-1"]],[["1023","1 2","1 2","1 2","1 2"],["512"]],[["2","0 1","1 0","1 0","0 1"],["-1"]],[["17","15 12","15 12","12 14","1 11"],["-1"]],[["29","4 0","1 1","25 20","16 0"],["170"]],[["91","9 64","75 32","60 81","35 46"],["5"]],[["91","38 74","66 10","40 76","17 13"],["-1"]],[["100","11 20","99 31","60 44","45 64"],["3"]],[["9999","4879 6224","63 7313","4279 6583","438 1627"],["4"]],[["10000","8681 4319","9740 5980","24 137","462 7971"],["-1"]],[["100000","76036 94415","34870 43365","56647 26095","88580 30995"],["5"]],[["100000","90861 77058","96282 30306","45940 25601","17117 48287"],["-1"]],[["1000000","220036 846131","698020 485511","656298 242999","766802 905433"],["5297"]],[["1000000","536586 435396","748740 34356","135075 790803","547356 534911"],["9958"]],[["1000000","661647 690400","864868 326304","581148 452012","327910 197092"],["1021"]],[["1000000","233404 949288","893747 751429","692094 57207","674400 583468"],["-1"]],[["1000000","358465 242431","977171 267570","170871 616951","711850 180241"],["-1"]],[["1000000","707719 502871","60595 816414","649648 143990","525107 66615"],["-1"]],[["999983","192005 690428","971158 641039","974183 1882","127579 312317"],["470479"]],[["999983","420528 808305","387096 497121","596163 353326","47177 758204"],["548500"]],[["999983","651224 992349","803017 393514","258455 402487","888310 244420"],["126531"]],[["999983","151890 906425","851007 9094","696594 968184","867017 157783"],["-1"]],[["999983","380412 325756","266945 907644","318575 83081","786616 603671"],["-1"]],[["999983","570797 704759","723177 763726","978676 238272","708387 89886"],["-1"]],[["999983","408725 408721","1 1","378562 294895","984270 0"],["499981500166"]],[["999983","639420 639416","1 1","507684 954997","466316 0"],["499981500166"]],[["999983","867942 867939","1 1","963840 536667","899441 0"],["999964000320"]],[["999961","664221 931770","530542 936292","885122 515424","868560 472225"],["-1"]],[["999961","744938 661980","845908 76370","237399 381935","418010 938769"],["203332"]],[["999961","89288 89284","1 1","764559 727291","999322 0"],["999920001595"]],[["1000000","661703 661699","1 1","425192 823944","854093 0"],["-1"]],[["100019","98811 98807","1 1","91322 14787","72253 0"],["10003600319"]],[["524288","199980 199978","1 1","236260 325076","81773 0"],["-1"]],[["524288","47283 489031","305624 183135","141146 335913","519614 150715"],["19"]],[["524288","83398 33987","158854 211502","36433 18758","218812 517001"],["-1"]],[["912488","681639 518634","168348 212018","255428 4970","31726 664998"],["34838"]],[["129081","128454 36771","116353 2940","95311 22200","579 118683"],["68409"]],[["129081","45717 106320","121816 69841","5161 4872","102076 100020"],["-1"]],[["4","1 2","1 1","0 1","2 0"],["-1"]],[["3","1 0","1 1","1 2","2 0"],["5"]],[["3","0 2","1 0","2 0","2 1"],["-1"]],[["2","0 1","0 1","0 1","0 1"],["1"]],[["2","0 1","1 0","0 1","1 0"],["-1"]],[["2","0 1","1 1","0 1","1 1"],["1"]],[["2","0 1","1 1","0 1","1 0"],["-1"]],[["2","0 1","1 0","0 1","1 1"],["-1"]],[["1000000","1 0","1 1","1 0","1 1"],["999999"]],[["1000000","2 1","1 1","2 0","1 2"],["999999"]],[["6","1 2","3 5","0 2","4 2"],["1"]],[["545","26 40","477 97","454 394","15 264"],["90"]],[["3","1 0","0 1","0 2","1 0"],["-1"]],[["1376","1227 1349","313 193","1113 361","1314 23"],["338"]],[["1376","1322 1320","1 1","776 495","38 0"],["-1"]],[["1376","152 405","1083 1328","76 856","49 629"],["-1"]],[["1392","1060 796","512 242","1386 1346","1310 1199"],["-1"]],[["100000","5827 41281","41285 70821","99199 42807","65667 94952"],["13770"]],[["100000","51157 27741","40564 90740","45270 52367","31585 92150"],["-1"]],[["100000","70525 70522","1 1","89465 30265","33279 0"],["-1"]],[["10","1 6","7 9","1 4","4 0"],["1"]],[["10","9 6","0 8","3 0","2 7"],["-1"]],[["10","4 2","1 1","7 3","9 0"],["-1"]],[["6","5 1","1 1","3 1","3 0"],["-1"]],[["999983","3 1","1 1","8 1","2 0"],["499981500168"]],[["18","3 9","3 0","1 3","3 0"],["1"]],[["18","1 3","3 0","3 9","3 0"],["1"]],[["16","1 0","2 0","1 2","2 0"],["-1"]],[["16","8 0","2 0","1 4","2 0"],["2"]],[["999983","2 1","2 0","1 0","1 1"],["499982500152"]],[["324","2 54","3 0","27 108","2 0"],["-1"]],[["999993","499997 1","2 3","1 4","1 1"],["39325724721"]],[["999983","1 37827","1 1","2 192083","3 0"],["404303164556"]],[["41222","30759 26408","31332 39118","5026 25812","1 9030"],["58900566"]],[["100007","2 1","2 0","3 1","1 1"],["434330399"]],[["8","0 4","4 4","1 4","2 0"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_14","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integers m, h, h2, a, a2, x, x2, y, y2\ndeclare get with integers s, e as arguments, returning integer\n for i = 0 to m exclusive\n set s to (1ll * s * x + y ) % m\n if s is e, return i + 1\n end of the block\n return -1 from function\nend of the block\ndeclare get2 with integers s, e as arguments, returning integer\n for i = 0 to m exclusive\n set s to (1ll * s * x2 + y2 ) % m\n if s is e, return i + 1 from function\n end of the block\n return -1 from function\nend of the block\ndefine the main function\n read m read h read a read x read y read h2 read a2 read x2 read y2\n create integers t, t2 with t = result of run get with h, a as arguments, t2 = result of run get2 with h2, a2 as arguments\n if t is -1 or t2 is -1, return print \"-1\\n\", 0 from function\n if t is t2, return print t print '\\n', 0 from function\n create integers l, l2 with l = result of run get with a, a as arguments, l2 = result of run get2 with a2, a2, as arguments\n if bitwise not l and t - t2 is greater than or equal to 0 and not ( (t-t2)%l2), return print t print '\\n', 0 from function\n if bitwise not l2 and t - t2 is greater than or equal to 0 and not ( (t-t2) % l2 ), return print t print '\\n', 0 from function\n if l is -1 or l2 is -1, return print \"-1\\n\", 0\n create integer val with val = t2 - t\n for i =1, lim = m bitshift left 1 to i is less than or equal to lim, incrementing i\n if (val + 1ll * i * l2 is greater than or equal to 0 and not ((val + 1ll * i * l2) % l)) return print 1ll * i * l2 + t2 print '\\n', 0 from function\n print \"-1\\n\"\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int m, h, h2, a, a2, x, x2, y, y2;\nint get(int s, int e) {\n for (int i = 0; i < m; ++i) {\n s = (1ll * s * x + y) % m;\n if (s == e) return i + 1;\n }\n return -1;\n}\nint get2(int s, int e) {\n for (int i = 0; i < m; ++i) {\n s = (1ll * s * x2 + y2) % m;\n if (s == e) return i + 1;\n }\n return -1;\n}\nint main() {\n cin >> m >> h >> a >> x >> y >> h2 >> a2 >> x2 >> y2;\n int t = get(h, a), t2 = get2(h2, a2);\n if (t == -1 || t2 == -1) return cout << \"-1\\n\", 0;\n if (t == t2) return cout << t << '\\n', 0;\n int l = get(a, a), l2 = get2(a2, a2);\n if (~l && t2 - t >= 0 && !((t2 - t) % l)) return cout << t2 << '\\n', 0;\n if (~l2 && t - t2 >= 0 && !((t - t2) % l2)) return cout << t << '\\n', 0;\n if (l == -1 || l2 == -1) return cout << \"-1\\n\", 0;\n int val = t2 - t;\n for (int i = 1, lim = m << 1; i <= lim; ++i)\n if (val + 1ll * i * l2 >= 0 && !((val + 1ll * i * l2) % l)) return cout << 1ll * i * l2 + t2 << '\\n', 0;\n cout << \"-1\\n\";\n return 0;\n}","item":{"problem_id":"547A","pseudocode":"create integers m, h, h2, a, a2, x, x2, y, y2\ndeclare get with integers s, e as arguments, returning integer\n for i = 0 to m exclusive\n set s to (1ll * s * x + y ) % m\n if s is e, return i + 1\n end of the block\n return -1 from function\nend of the block\ndeclare get2 with integers s, e as arguments, returning integer\n for i = 0 to m exclusive\n set s to (1ll * s * x2 + y2 ) % m\n if s is e, return i + 1 from function\n end of the block\n return -1 from function\nend of the block\ndefine the main function\n read m read h read a read x read y read h2 read a2 read x2 read y2\n create integers t, t2 with t = result of run get with h, a as arguments, t2 = result of run get2 with h2, a2 as arguments\n if t is -1 or t2 is -1, return print \"-1\\n\", 0 from function\n if t is t2, return print t print '\\n', 0 from function\n create integers l, l2 with l = result of run get with a, a as arguments, l2 = result of run get2 with a2, a2, as arguments\n if bitwise not l and t - t2 is greater than or equal to 0 and not ( (t-t2)%l2), return print t print '\\n', 0 from function\n if bitwise not l2 and t - t2 is greater than or equal to 0 and not ( (t-t2) % l2 ), return print t print '\\n', 0 from function\n if l is -1 or l2 is -1, return print \"-1\\n\", 0\n create integer val with val = t2 - t\n for i =1, lim = m bitshift left 1 to i is less than or equal to lim, incrementing i\n if (val + 1ll * i * l2 is greater than or equal to 0 and not ((val + 1ll * i * l2) % l)) return print 1ll * i * l2 + t2 print '\\n', 0 from function\n print \"-1\\n\"\n return to indicate successful execution\nend of the block","testcases":[[["5","4 2","1 1","0 1","2 3"],["3"]],[["1023","1 2","1 0","1 2","1 1"],["-1"]],[["1023","1 2","1 2","1 2","1 2"],["512"]],[["2","0 1","1 0","1 0","0 1"],["-1"]],[["17","15 12","15 12","12 14","1 11"],["-1"]],[["29","4 0","1 1","25 20","16 0"],["170"]],[["91","9 64","75 32","60 81","35 46"],["5"]],[["91","38 74","66 10","40 76","17 13"],["-1"]],[["100","11 20","99 31","60 44","45 64"],["3"]],[["9999","4879 6224","63 7313","4279 6583","438 1627"],["4"]],[["10000","8681 4319","9740 5980","24 137","462 7971"],["-1"]],[["100000","76036 94415","34870 43365","56647 26095","88580 30995"],["5"]],[["100000","90861 77058","96282 30306","45940 25601","17117 48287"],["-1"]],[["1000000","220036 846131","698020 485511","656298 242999","766802 905433"],["5297"]],[["1000000","536586 435396","748740 34356","135075 790803","547356 534911"],["9958"]],[["1000000","661647 690400","864868 326304","581148 452012","327910 197092"],["1021"]],[["1000000","233404 949288","893747 751429","692094 57207","674400 583468"],["-1"]],[["1000000","358465 242431","977171 267570","170871 616951","711850 180241"],["-1"]],[["1000000","707719 502871","60595 816414","649648 143990","525107 66615"],["-1"]],[["999983","192005 690428","971158 641039","974183 1882","127579 312317"],["470479"]],[["999983","420528 808305","387096 497121","596163 353326","47177 758204"],["548500"]],[["999983","651224 992349","803017 393514","258455 402487","888310 244420"],["126531"]],[["999983","151890 906425","851007 9094","696594 968184","867017 157783"],["-1"]],[["999983","380412 325756","266945 907644","318575 83081","786616 603671"],["-1"]],[["999983","570797 704759","723177 763726","978676 238272","708387 89886"],["-1"]],[["999983","408725 408721","1 1","378562 294895","984270 0"],["499981500166"]],[["999983","639420 639416","1 1","507684 954997","466316 0"],["499981500166"]],[["999983","867942 867939","1 1","963840 536667","899441 0"],["999964000320"]],[["999961","664221 931770","530542 936292","885122 515424","868560 472225"],["-1"]],[["999961","744938 661980","845908 76370","237399 381935","418010 938769"],["203332"]],[["999961","89288 89284","1 1","764559 727291","999322 0"],["999920001595"]],[["1000000","661703 661699","1 1","425192 823944","854093 0"],["-1"]],[["100019","98811 98807","1 1","91322 14787","72253 0"],["10003600319"]],[["524288","199980 199978","1 1","236260 325076","81773 0"],["-1"]],[["524288","47283 489031","305624 183135","141146 335913","519614 150715"],["19"]],[["524288","83398 33987","158854 211502","36433 18758","218812 517001"],["-1"]],[["912488","681639 518634","168348 212018","255428 4970","31726 664998"],["34838"]],[["129081","128454 36771","116353 2940","95311 22200","579 118683"],["68409"]],[["129081","45717 106320","121816 69841","5161 4872","102076 100020"],["-1"]],[["4","1 2","1 1","0 1","2 0"],["-1"]],[["3","1 0","1 1","1 2","2 0"],["5"]],[["3","0 2","1 0","2 0","2 1"],["-1"]],[["2","0 1","0 1","0 1","0 1"],["1"]],[["2","0 1","1 0","0 1","1 0"],["-1"]],[["2","0 1","1 1","0 1","1 1"],["1"]],[["2","0 1","1 1","0 1","1 0"],["-1"]],[["2","0 1","1 0","0 1","1 1"],["-1"]],[["1000000","1 0","1 1","1 0","1 1"],["999999"]],[["1000000","2 1","1 1","2 0","1 2"],["999999"]],[["6","1 2","3 5","0 2","4 2"],["1"]],[["545","26 40","477 97","454 394","15 264"],["90"]],[["3","1 0","0 1","0 2","1 0"],["-1"]],[["1376","1227 1349","313 193","1113 361","1314 23"],["338"]],[["1376","1322 1320","1 1","776 495","38 0"],["-1"]],[["1376","152 405","1083 1328","76 856","49 629"],["-1"]],[["1392","1060 796","512 242","1386 1346","1310 1199"],["-1"]],[["100000","5827 41281","41285 70821","99199 42807","65667 94952"],["13770"]],[["100000","51157 27741","40564 90740","45270 52367","31585 92150"],["-1"]],[["100000","70525 70522","1 1","89465 30265","33279 0"],["-1"]],[["10","1 6","7 9","1 4","4 0"],["1"]],[["10","9 6","0 8","3 0","2 7"],["-1"]],[["10","4 2","1 1","7 3","9 0"],["-1"]],[["6","5 1","1 1","3 1","3 0"],["-1"]],[["999983","3 1","1 1","8 1","2 0"],["499981500168"]],[["18","3 9","3 0","1 3","3 0"],["1"]],[["18","1 3","3 0","3 9","3 0"],["1"]],[["16","1 0","2 0","1 2","2 0"],["-1"]],[["16","8 0","2 0","1 4","2 0"],["2"]],[["999983","2 1","2 0","1 0","1 1"],["499982500152"]],[["324","2 54","3 0","27 108","2 0"],["-1"]],[["999993","499997 1","2 3","1 4","1 1"],["39325724721"]],[["999983","1 37827","1 1","2 192083","3 0"],["404303164556"]],[["41222","30759 26408","31332 39118","5026 25812","1 9030"],["58900566"]],[["100007","2 1","2 0","3 1","1 1"],["434330399"]],[["8","0 4","4 4","1 4","2 0"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_15","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate long longs x, y\ndeclare exgcd with long longs a, b as arguments returning long long\n if b is 0\n set x to 1\n set y to 0\n return a from function\n end of the block\n crate long long d with d = result of run exgcd with b, a % b as arguments\n create long long t with t = x\n set x to y\n set y to t - a \/ b * y\n return d from function\nend of the block\ndefine the main function\n create long longs m, h1, a1, x1, y1, h2, a2, x2, y2\n create long longs p1, p2, q1, q2\n while read m read h1 read a1 read x1 read y1 read h2 read a2 read x2 read y2 is true\n set p1 to p2 to q1 to q2 to 0\n for i = 1 to 2 * m inclusive\n set h1 to (h1 * x1 + y1) % m\n if h1 is a1\n if p1 is 0\n set p1 to i\n else if q1 is 0\n set q1 to i - p1\n break loop\n end of the block\n end of the block\n end of the block\n for i = 1 to 2 * m inclusive\n set h2 to (h2 * x2 + y2) % m\n if h2 is a2\n if p2 is 0\n set p2 to i\n else if q2 is 0\n set q2 to i - p2\n break loop\n end of the block\n end of the block\n end of the block\n create long long d with d = result of run exgcd with q1, -q2 as arguments\n create long long c with c = p2 - p1\n if d is 0\n print \"-1\"\n break current loop iteration\n end of the block\n if c % d\n print \"-1\"\n break current loop iteration\n end of the block\n if p1 is 0 or p2 is 0\n print \"-1\"\n break current loop iteration\n end of the block\n if q2 is 0 and q1 is 0 and p1 is not p2\n print \"-1\"\n break current loop iteration\n end of the block\n if ( q2 is 0 and p2 - p1 is less than 0 ) or ( q2 is 0 and p1 - p2 is less than 0 )\n print \"-1\"\n break current loop iteration\n end of the block\n create long long k with k = c \/ d\n set x to x * k\n set y to y * k\n if d is less than 0, set d to -d\n if x is less than 0 or y is less than 0\n while 1 is true\n increment x by q2 \/ d\n increment y by q1 \/ d\n if x is greater than or equal to 0 and y is greater than or equal to 0, break loop\n end of the block\n end of the block\n if x is greater than 0 and y is greater than 0\n while 1 is true\n decrement x by q2 \/ d\n decrement y by q1 \/ d\n if x is less than 0 or y is less than 0, break loop\n end of the block\n increment x by q2 \/ d\n increment y by q1 \/ d\n end of the block\n create long long ans with ans = x * q1 + p1\n print ans print newline\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long x, y;\nlong long exgcd(long long a, long long b) {\n if (b == 0) {\n x = 1;\n y = 0;\n return a;\n }\n long long d = exgcd(b, a % b);\n long long t = x;\n x = y;\n y = t - a \/ b * y;\n return d;\n}\nint main() {\n long long m, h1, a1, x1, y1, h2, a2, x2, y2;\n long long p1, p2, q1, q2;\n while (cin >> m >> h1 >> a1 >> x1 >> y1 >> h2 >> a2 >> x2 >> y2) {\n p1 = p2 = q1 = q2 = 0;\n for (long long i = 1; i <= 2 * m; i++) {\n h1 = (h1 * x1 + y1) % m;\n if (h1 == a1) {\n if (p1 == 0)\n p1 = i;\n else if (q1 == 0) {\n q1 = i - p1;\n break;\n }\n }\n }\n for (long long i = 1; i <= 2 * m; i++) {\n h2 = (h2 * x2 + y2) % m;\n if (h2 == a2) {\n if (p2 == 0)\n p2 = i;\n else if (q2 == 0) {\n q2 = i - p2;\n break;\n }\n }\n }\n long long d = exgcd(q1, -q2);\n long long c = p2 - p1;\n if (d == 0) {\n puts(\"-1\");\n continue;\n }\n if (c % d) {\n puts(\"-1\");\n continue;\n }\n if (p1 == 0 || p2 == 0) {\n puts(\"-1\");\n continue;\n }\n if (q2 == 0 && q1 == 0 && p1 != p2) {\n puts(\"-1\");\n continue;\n }\n if ((q2 == 0 && p2 - p1 < 0) || (q1 == 0 && p1 - p2 < 0)) {\n puts(\"-1\");\n continue;\n }\n long long k = c \/ d;\n x *= k;\n y *= k;\n if (d < 0) d = -d;\n if (x < 0 || y < 0) {\n while (1) {\n x += q2 \/ d;\n y += q1 \/ d;\n if (x >= 0 && y >= 0) break;\n }\n }\n if (x > 0 && y > 0) {\n while (1) {\n x -= q2 \/ d;\n y -= q1 \/ d;\n if (x < 0 || y < 0) break;\n }\n x += q2 \/ d;\n y += q1 \/ d;\n }\n long long ans = x * q1 + p1;\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"547A","pseudocode":"create long longs x, y\ndeclare exgcd with long longs a, b as arguments returning long long\n if b is 0\n set x to 1\n set y to 0\n return a from function\n end of the block\n crate long long d with d = result of run exgcd with b, a % b as arguments\n create long long t with t = x\n set x to y\n set y to t - a \/ b * y\n return d from function\nend of the block\ndefine the main function\n create long longs m, h1, a1, x1, y1, h2, a2, x2, y2\n create long longs p1, p2, q1, q2\n while read m read h1 read a1 read x1 read y1 read h2 read a2 read x2 read y2 is true\n set p1 to p2 to q1 to q2 to 0\n for i = 1 to 2 * m inclusive\n set h1 to (h1 * x1 + y1) % m\n if h1 is a1\n if p1 is 0\n set p1 to i\n else if q1 is 0\n set q1 to i - p1\n break loop\n end of the block\n end of the block\n end of the block\n for i = 1 to 2 * m inclusive\n set h2 to (h2 * x2 + y2) % m\n if h2 is a2\n if p2 is 0\n set p2 to i\n else if q2 is 0\n set q2 to i - p2\n break loop\n end of the block\n end of the block\n end of the block\n create long long d with d = result of run exgcd with q1, -q2 as arguments\n create long long c with c = p2 - p1\n if d is 0\n print \"-1\"\n break current loop iteration\n end of the block\n if c % d\n print \"-1\"\n break current loop iteration\n end of the block\n if p1 is 0 or p2 is 0\n print \"-1\"\n break current loop iteration\n end of the block\n if q2 is 0 and q1 is 0 and p1 is not p2\n print \"-1\"\n break current loop iteration\n end of the block\n if ( q2 is 0 and p2 - p1 is less than 0 ) or ( q2 is 0 and p1 - p2 is less than 0 )\n print \"-1\"\n break current loop iteration\n end of the block\n create long long k with k = c \/ d\n set x to x * k\n set y to y * k\n if d is less than 0, set d to -d\n if x is less than 0 or y is less than 0\n while 1 is true\n increment x by q2 \/ d\n increment y by q1 \/ d\n if x is greater than or equal to 0 and y is greater than or equal to 0, break loop\n end of the block\n end of the block\n if x is greater than 0 and y is greater than 0\n while 1 is true\n decrement x by q2 \/ d\n decrement y by q1 \/ d\n if x is less than 0 or y is less than 0, break loop\n end of the block\n increment x by q2 \/ d\n increment y by q1 \/ d\n end of the block\n create long long ans with ans = x * q1 + p1\n print ans print newline\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["5","4 2","1 1","0 1","2 3"],["3"]],[["1023","1 2","1 0","1 2","1 1"],["-1"]],[["1023","1 2","1 2","1 2","1 2"],["512"]],[["2","0 1","1 0","1 0","0 1"],["-1"]],[["17","15 12","15 12","12 14","1 11"],["-1"]],[["29","4 0","1 1","25 20","16 0"],["170"]],[["91","9 64","75 32","60 81","35 46"],["5"]],[["91","38 74","66 10","40 76","17 13"],["-1"]],[["100","11 20","99 31","60 44","45 64"],["3"]],[["9999","4879 6224","63 7313","4279 6583","438 1627"],["4"]],[["10000","8681 4319","9740 5980","24 137","462 7971"],["-1"]],[["100000","76036 94415","34870 43365","56647 26095","88580 30995"],["5"]],[["100000","90861 77058","96282 30306","45940 25601","17117 48287"],["-1"]],[["1000000","220036 846131","698020 485511","656298 242999","766802 905433"],["5297"]],[["1000000","536586 435396","748740 34356","135075 790803","547356 534911"],["9958"]],[["1000000","661647 690400","864868 326304","581148 452012","327910 197092"],["1021"]],[["1000000","233404 949288","893747 751429","692094 57207","674400 583468"],["-1"]],[["1000000","358465 242431","977171 267570","170871 616951","711850 180241"],["-1"]],[["1000000","707719 502871","60595 816414","649648 143990","525107 66615"],["-1"]],[["999983","192005 690428","971158 641039","974183 1882","127579 312317"],["470479"]],[["999983","420528 808305","387096 497121","596163 353326","47177 758204"],["548500"]],[["999983","651224 992349","803017 393514","258455 402487","888310 244420"],["126531"]],[["999983","151890 906425","851007 9094","696594 968184","867017 157783"],["-1"]],[["999983","380412 325756","266945 907644","318575 83081","786616 603671"],["-1"]],[["999983","570797 704759","723177 763726","978676 238272","708387 89886"],["-1"]],[["999983","408725 408721","1 1","378562 294895","984270 0"],["499981500166"]],[["999983","639420 639416","1 1","507684 954997","466316 0"],["499981500166"]],[["999983","867942 867939","1 1","963840 536667","899441 0"],["999964000320"]],[["999961","664221 931770","530542 936292","885122 515424","868560 472225"],["-1"]],[["999961","744938 661980","845908 76370","237399 381935","418010 938769"],["203332"]],[["999961","89288 89284","1 1","764559 727291","999322 0"],["999920001595"]],[["1000000","661703 661699","1 1","425192 823944","854093 0"],["-1"]],[["100019","98811 98807","1 1","91322 14787","72253 0"],["10003600319"]],[["524288","199980 199978","1 1","236260 325076","81773 0"],["-1"]],[["524288","47283 489031","305624 183135","141146 335913","519614 150715"],["19"]],[["524288","83398 33987","158854 211502","36433 18758","218812 517001"],["-1"]],[["912488","681639 518634","168348 212018","255428 4970","31726 664998"],["34838"]],[["129081","128454 36771","116353 2940","95311 22200","579 118683"],["68409"]],[["129081","45717 106320","121816 69841","5161 4872","102076 100020"],["-1"]],[["4","1 2","1 1","0 1","2 0"],["-1"]],[["3","1 0","1 1","1 2","2 0"],["5"]],[["3","0 2","1 0","2 0","2 1"],["-1"]],[["2","0 1","0 1","0 1","0 1"],["1"]],[["2","0 1","1 0","0 1","1 0"],["-1"]],[["2","0 1","1 1","0 1","1 1"],["1"]],[["2","0 1","1 1","0 1","1 0"],["-1"]],[["2","0 1","1 0","0 1","1 1"],["-1"]],[["1000000","1 0","1 1","1 0","1 1"],["999999"]],[["1000000","2 1","1 1","2 0","1 2"],["999999"]],[["6","1 2","3 5","0 2","4 2"],["1"]],[["545","26 40","477 97","454 394","15 264"],["90"]],[["3","1 0","0 1","0 2","1 0"],["-1"]],[["1376","1227 1349","313 193","1113 361","1314 23"],["338"]],[["1376","1322 1320","1 1","776 495","38 0"],["-1"]],[["1376","152 405","1083 1328","76 856","49 629"],["-1"]],[["1392","1060 796","512 242","1386 1346","1310 1199"],["-1"]],[["100000","5827 41281","41285 70821","99199 42807","65667 94952"],["13770"]],[["100000","51157 27741","40564 90740","45270 52367","31585 92150"],["-1"]],[["100000","70525 70522","1 1","89465 30265","33279 0"],["-1"]],[["10","1 6","7 9","1 4","4 0"],["1"]],[["10","9 6","0 8","3 0","2 7"],["-1"]],[["10","4 2","1 1","7 3","9 0"],["-1"]],[["6","5 1","1 1","3 1","3 0"],["-1"]],[["999983","3 1","1 1","8 1","2 0"],["499981500168"]],[["18","3 9","3 0","1 3","3 0"],["1"]],[["18","1 3","3 0","3 9","3 0"],["1"]],[["16","1 0","2 0","1 2","2 0"],["-1"]],[["16","8 0","2 0","1 4","2 0"],["2"]],[["999983","2 1","2 0","1 0","1 1"],["499982500152"]],[["324","2 54","3 0","27 108","2 0"],["-1"]],[["999993","499997 1","2 3","1 4","1 1"],["39325724721"]],[["999983","1 37827","1 1","2 192083","3 0"],["404303164556"]],[["41222","30759 26408","31332 39118","5026 25812","1 9030"],["58900566"]],[["100007","2 1","2 0","3 1","1 1"],["434330399"]],[["8","0 4","4 4","1 4","2 0"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_16","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create long long integers m, x1, x2, y1, y2, h1, h2, a1, and a2\n read m\n read h1 and a1\n read x1 and y1\n read h2 and a2\n read x2 and y2\n create integer vector ans1\n create integer vector ans2\n create long long integer total = 0\n while total is less than 2 * m\n if h1 is equal to a1, append total to ans1\n if h2 is equal to a2, append total to ans2\n increment total\n set h1 to the result of (h1 * x1 + y1) % m\n set h2 to the result of (h2 * x2 + y2) % m;\n end of the block\n if ans1.empty() is truthy or ans2.empty() is truthy\n print \"-1\"\n return to indicate successful execution\n end of the block\n create long long integers t1 = ans1[0] and t2 = ans2[0]\n create long long integer s1 = ans1[1] - ans1[0]\n create long long integer s2 = ans2[1] - ans2[0]\n for i = 0 to 5e6\n if t1 is equal to t2\n print t1\n return to indicate successful execution\n end of the block\n if t1 is less than t2\n set t1 to t1 + s1\n else\n set t2 to t2 + s2\n end of the block\n end of the block\n print \"-1\"\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n long long m, x1, x2, y1, y2, h1, h2, a1, a2;\n cin >> m;\n cin >> h1 >> a1;\n cin >> x1 >> y1;\n cin >> h2 >> a2;\n cin >> x2 >> y2;\n vector ans1;\n vector ans2;\n long long total = 0;\n while (total < 2 * m) {\n if (h1 == a1) { ans1.push_back(total); }\n if (h2 == a2) { ans2.push_back(total); }\n total++;\n h1 = (h1 * x1 + y1) % m;\n h2 = (h2 * x2 + y2) % m;\n }\n if (ans1.empty() || ans2.empty()) {\n cout << \"-1\" << endl;\n return 0;\n }\n long long t1 = ans1[0], t2 = ans2[0];\n long long s1 = ans1[1] - ans1[0];\n long long s2 = ans2[1] - ans2[0];\n for (int i = 0; i <= 5e6; i++) {\n if (t1 == t2) {\n cout << t1 << endl;\n return 0;\n }\n if (t1 < t2) {\n t1 += s1;\n } else {\n t2 += s2;\n }\n }\n cout << \"-1\" << endl;\n return 0;\n}","item":{"problem_id":"547A","pseudocode":"define the main function\n create long long integers m, x1, x2, y1, y2, h1, h2, a1, and a2\n read m\n read h1 and a1\n read x1 and y1\n read h2 and a2\n read x2 and y2\n create integer vector ans1\n create integer vector ans2\n create long long integer total = 0\n while total is less than 2 * m\n if h1 is equal to a1, append total to ans1\n if h2 is equal to a2, append total to ans2\n increment total\n set h1 to the result of (h1 * x1 + y1) % m\n set h2 to the result of (h2 * x2 + y2) % m;\n end of the block\n if ans1.empty() is truthy or ans2.empty() is truthy\n print \"-1\"\n return to indicate successful execution\n end of the block\n create long long integers t1 = ans1[0] and t2 = ans2[0]\n create long long integer s1 = ans1[1] - ans1[0]\n create long long integer s2 = ans2[1] - ans2[0]\n for i = 0 to 5e6\n if t1 is equal to t2\n print t1\n return to indicate successful execution\n end of the block\n if t1 is less than t2\n set t1 to t1 + s1\n else\n set t2 to t2 + s2\n end of the block\n end of the block\n print \"-1\"\n return to indicate successful execution\nend of the block","testcases":[[["5","4 2","1 1","0 1","2 3"],["3"]],[["1023","1 2","1 0","1 2","1 1"],["-1"]],[["1023","1 2","1 2","1 2","1 2"],["512"]],[["2","0 1","1 0","1 0","0 1"],["-1"]],[["17","15 12","15 12","12 14","1 11"],["-1"]],[["29","4 0","1 1","25 20","16 0"],["170"]],[["91","9 64","75 32","60 81","35 46"],["5"]],[["91","38 74","66 10","40 76","17 13"],["-1"]],[["100","11 20","99 31","60 44","45 64"],["3"]],[["9999","4879 6224","63 7313","4279 6583","438 1627"],["4"]],[["10000","8681 4319","9740 5980","24 137","462 7971"],["-1"]],[["100000","76036 94415","34870 43365","56647 26095","88580 30995"],["5"]],[["100000","90861 77058","96282 30306","45940 25601","17117 48287"],["-1"]],[["1000000","220036 846131","698020 485511","656298 242999","766802 905433"],["5297"]],[["1000000","536586 435396","748740 34356","135075 790803","547356 534911"],["9958"]],[["1000000","661647 690400","864868 326304","581148 452012","327910 197092"],["1021"]],[["1000000","233404 949288","893747 751429","692094 57207","674400 583468"],["-1"]],[["1000000","358465 242431","977171 267570","170871 616951","711850 180241"],["-1"]],[["1000000","707719 502871","60595 816414","649648 143990","525107 66615"],["-1"]],[["999983","192005 690428","971158 641039","974183 1882","127579 312317"],["470479"]],[["999983","420528 808305","387096 497121","596163 353326","47177 758204"],["548500"]],[["999983","651224 992349","803017 393514","258455 402487","888310 244420"],["126531"]],[["999983","151890 906425","851007 9094","696594 968184","867017 157783"],["-1"]],[["999983","380412 325756","266945 907644","318575 83081","786616 603671"],["-1"]],[["999983","570797 704759","723177 763726","978676 238272","708387 89886"],["-1"]],[["999983","408725 408721","1 1","378562 294895","984270 0"],["499981500166"]],[["999983","639420 639416","1 1","507684 954997","466316 0"],["499981500166"]],[["999983","867942 867939","1 1","963840 536667","899441 0"],["999964000320"]],[["999961","664221 931770","530542 936292","885122 515424","868560 472225"],["-1"]],[["999961","744938 661980","845908 76370","237399 381935","418010 938769"],["203332"]],[["999961","89288 89284","1 1","764559 727291","999322 0"],["999920001595"]],[["1000000","661703 661699","1 1","425192 823944","854093 0"],["-1"]],[["100019","98811 98807","1 1","91322 14787","72253 0"],["10003600319"]],[["524288","199980 199978","1 1","236260 325076","81773 0"],["-1"]],[["524288","47283 489031","305624 183135","141146 335913","519614 150715"],["19"]],[["524288","83398 33987","158854 211502","36433 18758","218812 517001"],["-1"]],[["912488","681639 518634","168348 212018","255428 4970","31726 664998"],["34838"]],[["129081","128454 36771","116353 2940","95311 22200","579 118683"],["68409"]],[["129081","45717 106320","121816 69841","5161 4872","102076 100020"],["-1"]],[["4","1 2","1 1","0 1","2 0"],["-1"]],[["3","1 0","1 1","1 2","2 0"],["5"]],[["3","0 2","1 0","2 0","2 1"],["-1"]],[["2","0 1","0 1","0 1","0 1"],["1"]],[["2","0 1","1 0","0 1","1 0"],["-1"]],[["2","0 1","1 1","0 1","1 1"],["1"]],[["2","0 1","1 1","0 1","1 0"],["-1"]],[["2","0 1","1 0","0 1","1 1"],["-1"]],[["1000000","1 0","1 1","1 0","1 1"],["999999"]],[["1000000","2 1","1 1","2 0","1 2"],["999999"]],[["6","1 2","3 5","0 2","4 2"],["1"]],[["545","26 40","477 97","454 394","15 264"],["90"]],[["3","1 0","0 1","0 2","1 0"],["-1"]],[["1376","1227 1349","313 193","1113 361","1314 23"],["338"]],[["1376","1322 1320","1 1","776 495","38 0"],["-1"]],[["1376","152 405","1083 1328","76 856","49 629"],["-1"]],[["1392","1060 796","512 242","1386 1346","1310 1199"],["-1"]],[["100000","5827 41281","41285 70821","99199 42807","65667 94952"],["13770"]],[["100000","51157 27741","40564 90740","45270 52367","31585 92150"],["-1"]],[["100000","70525 70522","1 1","89465 30265","33279 0"],["-1"]],[["10","1 6","7 9","1 4","4 0"],["1"]],[["10","9 6","0 8","3 0","2 7"],["-1"]],[["10","4 2","1 1","7 3","9 0"],["-1"]],[["6","5 1","1 1","3 1","3 0"],["-1"]],[["999983","3 1","1 1","8 1","2 0"],["499981500168"]],[["18","3 9","3 0","1 3","3 0"],["1"]],[["18","1 3","3 0","3 9","3 0"],["1"]],[["16","1 0","2 0","1 2","2 0"],["-1"]],[["16","8 0","2 0","1 4","2 0"],["2"]],[["999983","2 1","2 0","1 0","1 1"],["499982500152"]],[["324","2 54","3 0","27 108","2 0"],["-1"]],[["999993","499997 1","2 3","1 4","1 1"],["39325724721"]],[["999983","1 37827","1 1","2 192083","3 0"],["404303164556"]],[["41222","30759 26408","31332 39118","5026 25812","1 9030"],["58900566"]],[["100007","2 1","2 0","3 1","1 1"],["434330399"]],[["8","0 4","4 4","1 4","2 0"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_17","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare long long variables x and y\nexgcd is a long long function with long long arguments a and b\n if b = 0\n assign 1 to x\n assign 0 to y\n return a\n end of the block\n declare long long d = exgcd(b, a % b)\n declare long long variable t = x\n change x to y\n set y to t - a \/ b * y\n return d\nend of the block\ndefine the main function\n create long longs m, h1, a1, x1, y1, h2, a2, x2 and y2\n declare long longs p1, p2, q1 and q2\n loop, reading m, h1, a1, x1, y1, h2, a2, x2 and y2 from the input\n change p1, p2, q1 and q2 to 0\n change i from 1 to 2 * m inclusive in a loop\n set h1 to (h1 * x1 + y1) % m\n if h1 is equal to a1\n if p1 = 0\n assign i to p1\n else if q1 is equal to 0\n assign i - p1 to q1\n break the loop\n end of the block\n end of the block\n end of the block\n for i = 1 to 2 * m inclusive\n set h2 to (h2 * x2 + y2) % m\n if h2 = a2\n if p2 = 0\n set p2 to i\n else if q2 = 0\n assign i - p2 to q2\n stop the loop\n end of the block\n end of the block\n end of the block\n declare long long d = exgcd(q1, -q2)\n create long long c = p2 - p1\n if d = 0\n print \"-1\" to stdout\n go to the start of the loop\n end of the block\n if c % d != 0\n print \"-1\" to stdout\n skip the rest of the loop\n end of the block\n if p1 = 0 or p2 is equal to 0\n print \"-1\" to stdout\n skip the rest of the loop\n end of the block\n if q2 = 0 and q1 = 0 and p1 != p2\n print \"-1\" to stdout\n skip the rest of the loop\n end of the block\n if (q2 = 0 and p2 - p1 < 0) is true or (q1 = 0 and p1 - p2 < 0) is true\n print \"-1\" to standard output\n skip the rest of the loop\n end of the block\n declare long long variable k = c \/ d\n multiply x by k\n multiply y by k\n if d is less than 0, invert the sign of d\n if x < 0 or y < 0\n start infinite loop\n add q2 \/ d to x\n add q1 \/ d to y\n if x >= 0 and y >= 0, stop the loop\n end of the block\n end of the block\n if x > 0 and y > 0\n start infinite loop\n subtract q2 \/ d from x\n decrease y by q1 \/ d\n if x < 0 or y < 0\n add q2 \/ d to x\n add q1 \/ d to y\n break\n end of the block\n end of the block\n end of the block\n create long long ans = x * q1 + p1\n print ans\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long x, y;\nlong long exgcd(long long a, long long b) {\n if (b == 0) {\n x = 1;\n y = 0;\n return a;\n }\n long long d = exgcd(b, a % b);\n long long t = x;\n x = y;\n y = t - a \/ b * y;\n return d;\n}\nint main() {\n long long m, h1, a1, x1, y1, h2, a2, x2, y2;\n long long p1, p2, q1, q2;\n while (cin >> m >> h1 >> a1 >> x1 >> y1 >> h2 >> a2 >> x2 >> y2) {\n p1 = p2 = q1 = q2 = 0;\n for (long long i = 1; i <= 2 * m; i++) {\n h1 = (h1 * x1 + y1) % m;\n if (h1 == a1) {\n if (p1 == 0)\n p1 = i;\n else if (q1 == 0) {\n q1 = i - p1;\n break;\n }\n }\n }\n for (long long i = 1; i <= 2 * m; i++) {\n h2 = (h2 * x2 + y2) % m;\n if (h2 == a2) {\n if (p2 == 0)\n p2 = i;\n else if (q2 == 0) {\n q2 = i - p2;\n break;\n }\n }\n }\n long long d = exgcd(q1, -q2);\n long long c = p2 - p1;\n if (d == 0) {\n puts(\"-1\");\n continue;\n }\n if (c % d) {\n puts(\"-1\");\n continue;\n }\n if (p1 == 0 || p2 == 0) {\n puts(\"-1\");\n continue;\n }\n if (q2 == 0 && q1 == 0 && p1 != p2) {\n puts(\"-1\");\n continue;\n }\n if ((q2 == 0 && p2 - p1 < 0) || (q1 == 0 && p1 - p2 < 0)) {\n puts(\"-1\");\n continue;\n }\n long long k = c \/ d;\n x *= k;\n y *= k;\n if (d < 0) d = -d;\n if (x < 0 || y < 0) {\n while (1) {\n x += q2 \/ d;\n y += q1 \/ d;\n if (x >= 0 && y >= 0) break;\n }\n }\n if (x > 0 && y > 0) {\n while (1) {\n x -= q2 \/ d;\n y -= q1 \/ d;\n if (x < 0 || y < 0) {\n x += q2 \/ d;\n y += q1 \/ d;\n break;\n }\n }\n }\n long long ans = x * q1 + p1;\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"547A","pseudocode":"declare long long variables x and y\nexgcd is a long long function with long long arguments a and b\n if b = 0\n assign 1 to x\n assign 0 to y\n return a\n end of the block\n declare long long d = exgcd(b, a % b)\n declare long long variable t = x\n change x to y\n set y to t - a \/ b * y\n return d\nend of the block\ndefine the main function\n create long longs m, h1, a1, x1, y1, h2, a2, x2 and y2\n declare long longs p1, p2, q1 and q2\n loop, reading m, h1, a1, x1, y1, h2, a2, x2 and y2 from the input\n change p1, p2, q1 and q2 to 0\n change i from 1 to 2 * m inclusive in a loop\n set h1 to (h1 * x1 + y1) % m\n if h1 is equal to a1\n if p1 = 0\n assign i to p1\n else if q1 is equal to 0\n assign i - p1 to q1\n break the loop\n end of the block\n end of the block\n end of the block\n for i = 1 to 2 * m inclusive\n set h2 to (h2 * x2 + y2) % m\n if h2 = a2\n if p2 = 0\n set p2 to i\n else if q2 = 0\n assign i - p2 to q2\n stop the loop\n end of the block\n end of the block\n end of the block\n declare long long d = exgcd(q1, -q2)\n create long long c = p2 - p1\n if d = 0\n print \"-1\" to stdout\n go to the start of the loop\n end of the block\n if c % d != 0\n print \"-1\" to stdout\n skip the rest of the loop\n end of the block\n if p1 = 0 or p2 is equal to 0\n print \"-1\" to stdout\n skip the rest of the loop\n end of the block\n if q2 = 0 and q1 = 0 and p1 != p2\n print \"-1\" to stdout\n skip the rest of the loop\n end of the block\n if (q2 = 0 and p2 - p1 < 0) is true or (q1 = 0 and p1 - p2 < 0) is true\n print \"-1\" to standard output\n skip the rest of the loop\n end of the block\n declare long long variable k = c \/ d\n multiply x by k\n multiply y by k\n if d is less than 0, invert the sign of d\n if x < 0 or y < 0\n start infinite loop\n add q2 \/ d to x\n add q1 \/ d to y\n if x >= 0 and y >= 0, stop the loop\n end of the block\n end of the block\n if x > 0 and y > 0\n start infinite loop\n subtract q2 \/ d from x\n decrease y by q1 \/ d\n if x < 0 or y < 0\n add q2 \/ d to x\n add q1 \/ d to y\n break\n end of the block\n end of the block\n end of the block\n create long long ans = x * q1 + p1\n print ans\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["5","4 2","1 1","0 1","2 3"],["3"]],[["1023","1 2","1 0","1 2","1 1"],["-1"]],[["1023","1 2","1 2","1 2","1 2"],["512"]],[["2","0 1","1 0","1 0","0 1"],["-1"]],[["17","15 12","15 12","12 14","1 11"],["-1"]],[["29","4 0","1 1","25 20","16 0"],["170"]],[["91","9 64","75 32","60 81","35 46"],["5"]],[["91","38 74","66 10","40 76","17 13"],["-1"]],[["100","11 20","99 31","60 44","45 64"],["3"]],[["9999","4879 6224","63 7313","4279 6583","438 1627"],["4"]],[["10000","8681 4319","9740 5980","24 137","462 7971"],["-1"]],[["100000","76036 94415","34870 43365","56647 26095","88580 30995"],["5"]],[["100000","90861 77058","96282 30306","45940 25601","17117 48287"],["-1"]],[["1000000","220036 846131","698020 485511","656298 242999","766802 905433"],["5297"]],[["1000000","536586 435396","748740 34356","135075 790803","547356 534911"],["9958"]],[["1000000","661647 690400","864868 326304","581148 452012","327910 197092"],["1021"]],[["1000000","233404 949288","893747 751429","692094 57207","674400 583468"],["-1"]],[["1000000","358465 242431","977171 267570","170871 616951","711850 180241"],["-1"]],[["1000000","707719 502871","60595 816414","649648 143990","525107 66615"],["-1"]],[["999983","192005 690428","971158 641039","974183 1882","127579 312317"],["470479"]],[["999983","420528 808305","387096 497121","596163 353326","47177 758204"],["548500"]],[["999983","651224 992349","803017 393514","258455 402487","888310 244420"],["126531"]],[["999983","151890 906425","851007 9094","696594 968184","867017 157783"],["-1"]],[["999983","380412 325756","266945 907644","318575 83081","786616 603671"],["-1"]],[["999983","570797 704759","723177 763726","978676 238272","708387 89886"],["-1"]],[["999983","408725 408721","1 1","378562 294895","984270 0"],["499981500166"]],[["999983","639420 639416","1 1","507684 954997","466316 0"],["499981500166"]],[["999983","867942 867939","1 1","963840 536667","899441 0"],["999964000320"]],[["999961","664221 931770","530542 936292","885122 515424","868560 472225"],["-1"]],[["999961","744938 661980","845908 76370","237399 381935","418010 938769"],["203332"]],[["999961","89288 89284","1 1","764559 727291","999322 0"],["999920001595"]],[["1000000","661703 661699","1 1","425192 823944","854093 0"],["-1"]],[["100019","98811 98807","1 1","91322 14787","72253 0"],["10003600319"]],[["524288","199980 199978","1 1","236260 325076","81773 0"],["-1"]],[["524288","47283 489031","305624 183135","141146 335913","519614 150715"],["19"]],[["524288","83398 33987","158854 211502","36433 18758","218812 517001"],["-1"]],[["912488","681639 518634","168348 212018","255428 4970","31726 664998"],["34838"]],[["129081","128454 36771","116353 2940","95311 22200","579 118683"],["68409"]],[["129081","45717 106320","121816 69841","5161 4872","102076 100020"],["-1"]],[["4","1 2","1 1","0 1","2 0"],["-1"]],[["3","1 0","1 1","1 2","2 0"],["5"]],[["3","0 2","1 0","2 0","2 1"],["-1"]],[["2","0 1","0 1","0 1","0 1"],["1"]],[["2","0 1","1 0","0 1","1 0"],["-1"]],[["2","0 1","1 1","0 1","1 1"],["1"]],[["2","0 1","1 1","0 1","1 0"],["-1"]],[["2","0 1","1 0","0 1","1 1"],["-1"]],[["1000000","1 0","1 1","1 0","1 1"],["999999"]],[["1000000","2 1","1 1","2 0","1 2"],["999999"]],[["6","1 2","3 5","0 2","4 2"],["1"]],[["545","26 40","477 97","454 394","15 264"],["90"]],[["3","1 0","0 1","0 2","1 0"],["-1"]],[["1376","1227 1349","313 193","1113 361","1314 23"],["338"]],[["1376","1322 1320","1 1","776 495","38 0"],["-1"]],[["1376","152 405","1083 1328","76 856","49 629"],["-1"]],[["1392","1060 796","512 242","1386 1346","1310 1199"],["-1"]],[["100000","5827 41281","41285 70821","99199 42807","65667 94952"],["13770"]],[["100000","51157 27741","40564 90740","45270 52367","31585 92150"],["-1"]],[["100000","70525 70522","1 1","89465 30265","33279 0"],["-1"]],[["10","1 6","7 9","1 4","4 0"],["1"]],[["10","9 6","0 8","3 0","2 7"],["-1"]],[["10","4 2","1 1","7 3","9 0"],["-1"]],[["6","5 1","1 1","3 1","3 0"],["-1"]],[["999983","3 1","1 1","8 1","2 0"],["499981500168"]],[["18","3 9","3 0","1 3","3 0"],["1"]],[["18","1 3","3 0","3 9","3 0"],["1"]],[["16","1 0","2 0","1 2","2 0"],["-1"]],[["16","8 0","2 0","1 4","2 0"],["2"]],[["999983","2 1","2 0","1 0","1 1"],["499982500152"]],[["324","2 54","3 0","27 108","2 0"],["-1"]],[["999993","499997 1","2 3","1 4","1 1"],["39325724721"]],[["999983","1 37827","1 1","2 192083","3 0"],["404303164556"]],[["41222","30759 26408","31332 39118","5026 25812","1 9030"],["58900566"]],[["100007","2 1","2 0","3 1","1 1"],["434330399"]],[["8","0 4","4 4","1 4","2 0"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_18","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nx, y = long long integers\ndeclare exgcd that takes two arguments, long long integers a and b\n if b is 0\n set x to 1\n set y to 0\n return a\n end of the block\n d = long long integer set to exgcd of b and a modulo b\n t = long long integer set to x\n set x to y\n set y to t - a \/ b * y\n return d\nend of the block\ndefine the main function\n m, h1, a1, x1, y1, h2, a2, x2, y2 = long long integers\n p1, p2, q1, q2 = long long integers\n while reading m, h1, a1, x1, y1, h2, a2, x2, and y2\n set p1, p2, q1, q2 to 0\n for i = 1 to 2 * m inclusive\n set h1 to h1 * x1 + y1 modulo m\n if h1 is a1\n if p1 is 0\n set p1 to i\n else if q1 is 0\n set q1 to i - p1\n break\n end of the block\n end of the block\n end of the block\n for i =1 to 2 * m inclusive\n set h2 to h2 * x2 + y2 modulo m\n if h2 is a2\n if p2 is 0\n set p2 to i\n else if q2 is 0\n set q2 to i - p2\n break\n end of the block\n end of the block\n end of the block\n d = long long integer set to exgcd of q1 and -q2\n c = long long integer set to p2 - p1\n if d is 0\n puts \"-1\"\n continue\n end of the block\n if c modulo d\n puts \"-1\"\n continue\n end of the block\n if p1 is 0 or p2 is 0\n puts \"-1\"\n continue\n end of the block\n if q2 is 0 and q1 is 0 and p1 != p2\n puts \"-1\"\n continue\n end of the block\n if q2 is 0 and p2 - p1 < 0 or q1 is 0 and p1 - p2 < 0\n puts \"-1\"\n continue\n end of the block\n k = long long integer set to c \/ d\n multiply x by k\n multiply y by k\n if d < 0, set d to -d\n if x < 0 or y < 0\n while 1 exists\n add q2 \/ d to x\n add q1 \/ d to y\n if x >= 0 and y >= 0, break\n end of the block\n end of the block\n if x > 0 and y > 0\n while 1 exists\n subtract q2 \/ d from x\n subtract q1 \/ d from y\n if x < 0 or y < 0\n add q2 \/ d to x\n add q1 \/ d to y\n break\n end of the block\n end of the block\n end of the block\n ans = long long integer set to x * q1 + p1\n print ans\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long x, y;\nlong long exgcd(long long a, long long b) {\n if (b == 0) {\n x = 1;\n y = 0;\n return a;\n }\n long long d = exgcd(b, a % b);\n long long t = x;\n x = y;\n y = t - a \/ b * y;\n return d;\n}\nint main() {\n long long m, h1, a1, x1, y1, h2, a2, x2, y2;\n long long p1, p2, q1, q2;\n while (cin >> m >> h1 >> a1 >> x1 >> y1 >> h2 >> a2 >> x2 >> y2) {\n p1 = p2 = q1 = q2 = 0;\n for (long long i = 1; i <= 2 * m; i++) {\n h1 = (h1 * x1 + y1) % m;\n if (h1 == a1) {\n if (p1 == 0)\n p1 = i;\n else if (q1 == 0) {\n q1 = i - p1;\n break;\n }\n }\n }\n for (long long i = 1; i <= 2 * m; i++) {\n h2 = (h2 * x2 + y2) % m;\n if (h2 == a2) {\n if (p2 == 0)\n p2 = i;\n else if (q2 == 0) {\n q2 = i - p2;\n break;\n }\n }\n }\n long long d = exgcd(q1, -q2);\n long long c = p2 - p1;\n if (d == 0) {\n puts(\"-1\");\n continue;\n }\n if (c % d) {\n puts(\"-1\");\n continue;\n }\n if (p1 == 0 || p2 == 0) {\n puts(\"-1\");\n continue;\n }\n if (q2 == 0 && q1 == 0 && p1 != p2) {\n puts(\"-1\");\n continue;\n }\n if ((q2 == 0 && p2 - p1 < 0) || (q1 == 0 && p1 - p2 < 0)) {\n puts(\"-1\");\n continue;\n }\n long long k = c \/ d;\n x *= k;\n y *= k;\n if (d < 0) d = -d;\n if (x < 0 || y < 0) {\n while (1) {\n x += q2 \/ d;\n y += q1 \/ d;\n if (x >= 0 && y >= 0) break;\n }\n }\n if (x > 0 && y > 0) {\n while (1) {\n x -= q2 \/ d;\n y -= q1 \/ d;\n if (x < 0 || y < 0) {\n x += q2 \/ d;\n y += q1 \/ d;\n break;\n }\n }\n }\n long long ans = x * q1 + p1;\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"547A","pseudocode":"x, y = long long integers\ndeclare exgcd that takes two arguments, long long integers a and b\n if b is 0\n set x to 1\n set y to 0\n return a\n end of the block\n d = long long integer set to exgcd of b and a modulo b\n t = long long integer set to x\n set x to y\n set y to t - a \/ b * y\n return d\nend of the block\ndefine the main function\n m, h1, a1, x1, y1, h2, a2, x2, y2 = long long integers\n p1, p2, q1, q2 = long long integers\n while reading m, h1, a1, x1, y1, h2, a2, x2, and y2\n set p1, p2, q1, q2 to 0\n for i = 1 to 2 * m inclusive\n set h1 to h1 * x1 + y1 modulo m\n if h1 is a1\n if p1 is 0\n set p1 to i\n else if q1 is 0\n set q1 to i - p1\n break\n end of the block\n end of the block\n end of the block\n for i =1 to 2 * m inclusive\n set h2 to h2 * x2 + y2 modulo m\n if h2 is a2\n if p2 is 0\n set p2 to i\n else if q2 is 0\n set q2 to i - p2\n break\n end of the block\n end of the block\n end of the block\n d = long long integer set to exgcd of q1 and -q2\n c = long long integer set to p2 - p1\n if d is 0\n puts \"-1\"\n continue\n end of the block\n if c modulo d\n puts \"-1\"\n continue\n end of the block\n if p1 is 0 or p2 is 0\n puts \"-1\"\n continue\n end of the block\n if q2 is 0 and q1 is 0 and p1 != p2\n puts \"-1\"\n continue\n end of the block\n if q2 is 0 and p2 - p1 < 0 or q1 is 0 and p1 - p2 < 0\n puts \"-1\"\n continue\n end of the block\n k = long long integer set to c \/ d\n multiply x by k\n multiply y by k\n if d < 0, set d to -d\n if x < 0 or y < 0\n while 1 exists\n add q2 \/ d to x\n add q1 \/ d to y\n if x >= 0 and y >= 0, break\n end of the block\n end of the block\n if x > 0 and y > 0\n while 1 exists\n subtract q2 \/ d from x\n subtract q1 \/ d from y\n if x < 0 or y < 0\n add q2 \/ d to x\n add q1 \/ d to y\n break\n end of the block\n end of the block\n end of the block\n ans = long long integer set to x * q1 + p1\n print ans\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["5","4 2","1 1","0 1","2 3"],["3"]],[["1023","1 2","1 0","1 2","1 1"],["-1"]],[["1023","1 2","1 2","1 2","1 2"],["512"]],[["2","0 1","1 0","1 0","0 1"],["-1"]],[["17","15 12","15 12","12 14","1 11"],["-1"]],[["29","4 0","1 1","25 20","16 0"],["170"]],[["91","9 64","75 32","60 81","35 46"],["5"]],[["91","38 74","66 10","40 76","17 13"],["-1"]],[["100","11 20","99 31","60 44","45 64"],["3"]],[["9999","4879 6224","63 7313","4279 6583","438 1627"],["4"]],[["10000","8681 4319","9740 5980","24 137","462 7971"],["-1"]],[["100000","76036 94415","34870 43365","56647 26095","88580 30995"],["5"]],[["100000","90861 77058","96282 30306","45940 25601","17117 48287"],["-1"]],[["1000000","220036 846131","698020 485511","656298 242999","766802 905433"],["5297"]],[["1000000","536586 435396","748740 34356","135075 790803","547356 534911"],["9958"]],[["1000000","661647 690400","864868 326304","581148 452012","327910 197092"],["1021"]],[["1000000","233404 949288","893747 751429","692094 57207","674400 583468"],["-1"]],[["1000000","358465 242431","977171 267570","170871 616951","711850 180241"],["-1"]],[["1000000","707719 502871","60595 816414","649648 143990","525107 66615"],["-1"]],[["999983","192005 690428","971158 641039","974183 1882","127579 312317"],["470479"]],[["999983","420528 808305","387096 497121","596163 353326","47177 758204"],["548500"]],[["999983","651224 992349","803017 393514","258455 402487","888310 244420"],["126531"]],[["999983","151890 906425","851007 9094","696594 968184","867017 157783"],["-1"]],[["999983","380412 325756","266945 907644","318575 83081","786616 603671"],["-1"]],[["999983","570797 704759","723177 763726","978676 238272","708387 89886"],["-1"]],[["999983","408725 408721","1 1","378562 294895","984270 0"],["499981500166"]],[["999983","639420 639416","1 1","507684 954997","466316 0"],["499981500166"]],[["999983","867942 867939","1 1","963840 536667","899441 0"],["999964000320"]],[["999961","664221 931770","530542 936292","885122 515424","868560 472225"],["-1"]],[["999961","744938 661980","845908 76370","237399 381935","418010 938769"],["203332"]],[["999961","89288 89284","1 1","764559 727291","999322 0"],["999920001595"]],[["1000000","661703 661699","1 1","425192 823944","854093 0"],["-1"]],[["100019","98811 98807","1 1","91322 14787","72253 0"],["10003600319"]],[["524288","199980 199978","1 1","236260 325076","81773 0"],["-1"]],[["524288","47283 489031","305624 183135","141146 335913","519614 150715"],["19"]],[["524288","83398 33987","158854 211502","36433 18758","218812 517001"],["-1"]],[["912488","681639 518634","168348 212018","255428 4970","31726 664998"],["34838"]],[["129081","128454 36771","116353 2940","95311 22200","579 118683"],["68409"]],[["129081","45717 106320","121816 69841","5161 4872","102076 100020"],["-1"]],[["4","1 2","1 1","0 1","2 0"],["-1"]],[["3","1 0","1 1","1 2","2 0"],["5"]],[["3","0 2","1 0","2 0","2 1"],["-1"]],[["2","0 1","0 1","0 1","0 1"],["1"]],[["2","0 1","1 0","0 1","1 0"],["-1"]],[["2","0 1","1 1","0 1","1 1"],["1"]],[["2","0 1","1 1","0 1","1 0"],["-1"]],[["2","0 1","1 0","0 1","1 1"],["-1"]],[["1000000","1 0","1 1","1 0","1 1"],["999999"]],[["1000000","2 1","1 1","2 0","1 2"],["999999"]],[["6","1 2","3 5","0 2","4 2"],["1"]],[["545","26 40","477 97","454 394","15 264"],["90"]],[["3","1 0","0 1","0 2","1 0"],["-1"]],[["1376","1227 1349","313 193","1113 361","1314 23"],["338"]],[["1376","1322 1320","1 1","776 495","38 0"],["-1"]],[["1376","152 405","1083 1328","76 856","49 629"],["-1"]],[["1392","1060 796","512 242","1386 1346","1310 1199"],["-1"]],[["100000","5827 41281","41285 70821","99199 42807","65667 94952"],["13770"]],[["100000","51157 27741","40564 90740","45270 52367","31585 92150"],["-1"]],[["100000","70525 70522","1 1","89465 30265","33279 0"],["-1"]],[["10","1 6","7 9","1 4","4 0"],["1"]],[["10","9 6","0 8","3 0","2 7"],["-1"]],[["10","4 2","1 1","7 3","9 0"],["-1"]],[["6","5 1","1 1","3 1","3 0"],["-1"]],[["999983","3 1","1 1","8 1","2 0"],["499981500168"]],[["18","3 9","3 0","1 3","3 0"],["1"]],[["18","1 3","3 0","3 9","3 0"],["1"]],[["16","1 0","2 0","1 2","2 0"],["-1"]],[["16","8 0","2 0","1 4","2 0"],["2"]],[["999983","2 1","2 0","1 0","1 1"],["499982500152"]],[["324","2 54","3 0","27 108","2 0"],["-1"]],[["999993","499997 1","2 3","1 4","1 1"],["39325724721"]],[["999983","1 37827","1 1","2 192083","3 0"],["404303164556"]],[["41222","30759 26408","31332 39118","5026 25812","1 9030"],["58900566"]],[["100007","2 1","2 0","3 1","1 1"],["434330399"]],[["8","0 4","4 4","1 4","2 0"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_19","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nn = long long and h, a, x, y = long long array of size 2 each\nvis = two dimensional long long array of sizes 1000001 and 2\nb = long long vector array of size 2\nans = two dimensional long long array of sizes 2 and 2\nval = two dimensional long long array of sizes 1000001 and 2\nin function pass taking a long long i and returning a long long\n set vis[h[i]][i] to 1\n set val[h[i]][i] to 1\n va = long long with va = 2\n append h[i] to b[i]\n loop while vis[h[i]][i] is 1\n set h[i] to (x[i] * h[i] + y[i]) mod m\n append h[i] to b[i]\n if vis[h[i]][i] is 0\n increment vis[h[i]][i]\n set val[h[i]][i] to va\n increment va\n else\n set ans[i][0] to val[h[i]][i] - 1\n set ans[i][1] to va - val[h[i]][i]\n return to indicate successful execution\n end of the block\n end of the block\nend of the block\ndefine the main function\n read m then h[0] then a[0] then x[0] then y[0] then h[1] then a[1] then x[1] then y[1]\n call pass of 0\n call pass of 1\n if vis[a[0]][0] or vis[a[1]][1] is 0\n print -1\n return to indicate successful execution\n end of the block\n va1, va2 = long long with va1 = val[a[0]][0] and va2 = val[a[1]][1]\n cy1, cy2 = long long with cy1 = ans[0][1] and cy2 = ans[1][1]\n if val[a[0]][0] is val[a[1]][1]\n print val[a[0]][0] - 1\n return to indicate successful execution\n end of the block\n if val[a[0]][0] is less or equal to ans[0][0] and val[a[1]][1] is less or equal to ans[1][0]\n print -1\n return to indicate successful execution\n else if val[a[0]][0] is less or equal to ans[0][0] or val[a[1]][1] is less or equal to ans[1][0]\n mo = long long with mo = absolute of val[a[1]][1] - val[a[0]][0]\n if val[a[0]][0] is greater than val[a[1]][1] and val[a[0]][0] is less or equal to ans[0][0]\n if mo is a multiple of ans[1][1]\n print val[a[0]][0] - 1\n else\n print -1\n else if val[a[0]][0] is less than val[a[1]][1] and val[a[1]][1] is less or equal to ans[1][0]\n if mo is a multiple of ans[0][1]\n print val[a[1]][1] - 1\n else\n print -1\n else\n print -1\n end of the block\n return to indicate successful execution\n end of the block\n if absolute of va1 - va2 mod __gcd of cy1 and cy2 is not 0\n print -1\n return to indicate successful execution\n end of the block\n for i = 0 to 1000001\n va = long long with va = va1 - va2 + i * cy1\n if va is a multiple of cy2 and va is greater or equal to 0\n print va1 + i * cy1 - 1\n return to indicate successful execution\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long m, h[2], a[2], x[2], y[2];\nlong long vis[1000001][2];\nvector b[2];\nlong long ans[2][2];\nlong long val[1000001][2];\nlong long pass(long long i) {\n vis[h[i]][i] = 1;\n val[h[i]][i] = 1;\n long long va = 2;\n b[i].push_back(h[i]);\n while (vis[h[i]][i] == 1) {\n h[i] = (x[i] * h[i] + y[i]) % m;\n b[i].push_back(h[i]);\n if (vis[h[i]][i] == 0) {\n vis[h[i]][i]++;\n val[h[i]][i] = va;\n va++;\n } else {\n ans[i][0] = val[h[i]][i] - 1;\n ans[i][1] = va - val[h[i]][i];\n return 0;\n }\n }\n}\nint main() {\n cin >> m >> h[0] >> a[0] >> x[0] >> y[0] >> h[1] >> a[1] >> x[1] >> y[1];\n pass(0);\n pass(1);\n if (vis[a[0]][0] == 0 || vis[a[1]][1] == 0) {\n cout << -1 << endl;\n return 0;\n }\n long long va1 = val[a[0]][0], va2 = val[a[1]][1];\n long long cy1 = ans[0][1], cy2 = ans[1][1];\n if (val[a[0]][0] == val[a[1]][1]) {\n cout << val[a[0]][0] - 1 << endl;\n return 0;\n }\n if (val[a[0]][0] <= ans[0][0] && val[a[1]][1] <= ans[1][0]) {\n cout << -1 << endl;\n return 0;\n } else if (val[a[0]][0] <= ans[0][0] || val[a[1]][1] <= ans[1][0]) {\n long long mo = abs(val[a[1]][1] - val[a[0]][0]);\n if (val[a[0]][0] > val[a[1]][1] && val[a[0]][0] <= ans[0][0]) {\n if (mo % ans[1][1] == 0)\n cout << val[a[0]][0] - 1 << endl;\n else\n cout << -1 << endl;\n } else if (val[a[0]][0] < val[a[1]][1] && val[a[1]][1] <= ans[1][0]) {\n if (mo % ans[0][1] == 0)\n cout << val[a[1]][1] - 1 << endl;\n else\n cout << -1 << endl;\n } else {\n cout << -1 << endl;\n }\n return 0;\n }\n if (abs(va1 - va2) % __gcd(cy1, cy2) != 0) {\n cout << -1 << endl;\n return 0;\n }\n for (long long i = 0; i < 1000001; i++) {\n long long va = va1 - va2 + i * cy1;\n if (va % cy2 == 0 && va >= 0) {\n cout << va1 + i * cy1 - 1 << endl;\n return 0;\n }\n }\n return 0;\n}","item":{"problem_id":"547A","pseudocode":"n = long long and h, a, x, y = long long array of size 2 each\nvis = two dimensional long long array of sizes 1000001 and 2\nb = long long vector array of size 2\nans = two dimensional long long array of sizes 2 and 2\nval = two dimensional long long array of sizes 1000001 and 2\nin function pass taking a long long i and returning a long long\n set vis[h[i]][i] to 1\n set val[h[i]][i] to 1\n va = long long with va = 2\n append h[i] to b[i]\n loop while vis[h[i]][i] is 1\n set h[i] to (x[i] * h[i] + y[i]) mod m\n append h[i] to b[i]\n if vis[h[i]][i] is 0\n increment vis[h[i]][i]\n set val[h[i]][i] to va\n increment va\n else\n set ans[i][0] to val[h[i]][i] - 1\n set ans[i][1] to va - val[h[i]][i]\n return to indicate successful execution\n end of the block\n end of the block\nend of the block\ndefine the main function\n read m then h[0] then a[0] then x[0] then y[0] then h[1] then a[1] then x[1] then y[1]\n call pass of 0\n call pass of 1\n if vis[a[0]][0] or vis[a[1]][1] is 0\n print -1\n return to indicate successful execution\n end of the block\n va1, va2 = long long with va1 = val[a[0]][0] and va2 = val[a[1]][1]\n cy1, cy2 = long long with cy1 = ans[0][1] and cy2 = ans[1][1]\n if val[a[0]][0] is val[a[1]][1]\n print val[a[0]][0] - 1\n return to indicate successful execution\n end of the block\n if val[a[0]][0] is less or equal to ans[0][0] and val[a[1]][1] is less or equal to ans[1][0]\n print -1\n return to indicate successful execution\n else if val[a[0]][0] is less or equal to ans[0][0] or val[a[1]][1] is less or equal to ans[1][0]\n mo = long long with mo = absolute of val[a[1]][1] - val[a[0]][0]\n if val[a[0]][0] is greater than val[a[1]][1] and val[a[0]][0] is less or equal to ans[0][0]\n if mo is a multiple of ans[1][1]\n print val[a[0]][0] - 1\n else\n print -1\n else if val[a[0]][0] is less than val[a[1]][1] and val[a[1]][1] is less or equal to ans[1][0]\n if mo is a multiple of ans[0][1]\n print val[a[1]][1] - 1\n else\n print -1\n else\n print -1\n end of the block\n return to indicate successful execution\n end of the block\n if absolute of va1 - va2 mod __gcd of cy1 and cy2 is not 0\n print -1\n return to indicate successful execution\n end of the block\n for i = 0 to 1000001\n va = long long with va = va1 - va2 + i * cy1\n if va is a multiple of cy2 and va is greater or equal to 0\n print va1 + i * cy1 - 1\n return to indicate successful execution\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["5","4 2","1 1","0 1","2 3"],["3"]],[["1023","1 2","1 0","1 2","1 1"],["-1"]],[["1023","1 2","1 2","1 2","1 2"],["512"]],[["2","0 1","1 0","1 0","0 1"],["-1"]],[["17","15 12","15 12","12 14","1 11"],["-1"]],[["29","4 0","1 1","25 20","16 0"],["170"]],[["91","9 64","75 32","60 81","35 46"],["5"]],[["91","38 74","66 10","40 76","17 13"],["-1"]],[["100","11 20","99 31","60 44","45 64"],["3"]],[["9999","4879 6224","63 7313","4279 6583","438 1627"],["4"]],[["10000","8681 4319","9740 5980","24 137","462 7971"],["-1"]],[["100000","76036 94415","34870 43365","56647 26095","88580 30995"],["5"]],[["100000","90861 77058","96282 30306","45940 25601","17117 48287"],["-1"]],[["1000000","220036 846131","698020 485511","656298 242999","766802 905433"],["5297"]],[["1000000","536586 435396","748740 34356","135075 790803","547356 534911"],["9958"]],[["1000000","661647 690400","864868 326304","581148 452012","327910 197092"],["1021"]],[["1000000","233404 949288","893747 751429","692094 57207","674400 583468"],["-1"]],[["1000000","358465 242431","977171 267570","170871 616951","711850 180241"],["-1"]],[["1000000","707719 502871","60595 816414","649648 143990","525107 66615"],["-1"]],[["999983","192005 690428","971158 641039","974183 1882","127579 312317"],["470479"]],[["999983","420528 808305","387096 497121","596163 353326","47177 758204"],["548500"]],[["999983","651224 992349","803017 393514","258455 402487","888310 244420"],["126531"]],[["999983","151890 906425","851007 9094","696594 968184","867017 157783"],["-1"]],[["999983","380412 325756","266945 907644","318575 83081","786616 603671"],["-1"]],[["999983","570797 704759","723177 763726","978676 238272","708387 89886"],["-1"]],[["999983","408725 408721","1 1","378562 294895","984270 0"],["499981500166"]],[["999983","639420 639416","1 1","507684 954997","466316 0"],["499981500166"]],[["999983","867942 867939","1 1","963840 536667","899441 0"],["999964000320"]],[["999961","664221 931770","530542 936292","885122 515424","868560 472225"],["-1"]],[["999961","744938 661980","845908 76370","237399 381935","418010 938769"],["203332"]],[["999961","89288 89284","1 1","764559 727291","999322 0"],["999920001595"]],[["1000000","661703 661699","1 1","425192 823944","854093 0"],["-1"]],[["100019","98811 98807","1 1","91322 14787","72253 0"],["10003600319"]],[["524288","199980 199978","1 1","236260 325076","81773 0"],["-1"]],[["524288","47283 489031","305624 183135","141146 335913","519614 150715"],["19"]],[["524288","83398 33987","158854 211502","36433 18758","218812 517001"],["-1"]],[["912488","681639 518634","168348 212018","255428 4970","31726 664998"],["34838"]],[["129081","128454 36771","116353 2940","95311 22200","579 118683"],["68409"]],[["129081","45717 106320","121816 69841","5161 4872","102076 100020"],["-1"]],[["4","1 2","1 1","0 1","2 0"],["-1"]],[["3","1 0","1 1","1 2","2 0"],["5"]],[["3","0 2","1 0","2 0","2 1"],["-1"]],[["2","0 1","0 1","0 1","0 1"],["1"]],[["2","0 1","1 0","0 1","1 0"],["-1"]],[["2","0 1","1 1","0 1","1 1"],["1"]],[["2","0 1","1 1","0 1","1 0"],["-1"]],[["2","0 1","1 0","0 1","1 1"],["-1"]],[["1000000","1 0","1 1","1 0","1 1"],["999999"]],[["1000000","2 1","1 1","2 0","1 2"],["999999"]],[["6","1 2","3 5","0 2","4 2"],["1"]],[["545","26 40","477 97","454 394","15 264"],["90"]],[["3","1 0","0 1","0 2","1 0"],["-1"]],[["1376","1227 1349","313 193","1113 361","1314 23"],["338"]],[["1376","1322 1320","1 1","776 495","38 0"],["-1"]],[["1376","152 405","1083 1328","76 856","49 629"],["-1"]],[["1392","1060 796","512 242","1386 1346","1310 1199"],["-1"]],[["100000","5827 41281","41285 70821","99199 42807","65667 94952"],["13770"]],[["100000","51157 27741","40564 90740","45270 52367","31585 92150"],["-1"]],[["100000","70525 70522","1 1","89465 30265","33279 0"],["-1"]],[["10","1 6","7 9","1 4","4 0"],["1"]],[["10","9 6","0 8","3 0","2 7"],["-1"]],[["10","4 2","1 1","7 3","9 0"],["-1"]],[["6","5 1","1 1","3 1","3 0"],["-1"]],[["999983","3 1","1 1","8 1","2 0"],["499981500168"]],[["18","3 9","3 0","1 3","3 0"],["1"]],[["18","1 3","3 0","3 9","3 0"],["1"]],[["16","1 0","2 0","1 2","2 0"],["-1"]],[["16","8 0","2 0","1 4","2 0"],["2"]],[["999983","2 1","2 0","1 0","1 1"],["499982500152"]],[["324","2 54","3 0","27 108","2 0"],["-1"]],[["999993","499997 1","2 3","1 4","1 1"],["39325724721"]],[["999983","1 37827","1 1","2 192083","3 0"],["404303164556"]],[["41222","30759 26408","31332 39118","5026 25812","1 9030"],["58900566"]],[["100007","2 1","2 0","3 1","1 1"],["434330399"]],[["8","0 4","4 4","1 4","2 0"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_20","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nx, y = long long integers\ndeclare exgcd that takes two arguments, long long integers a and b\n if b is 0\n set x to 1\n set y to 0\n return a\n end of the block\n d = long long integer set to exgcd of b and a modulo b\n t = long long integer set to x\n set x to y\n set y to t - a \/ b * y\n return d\nend of the block\ndefine the main function\n m, h1, a1, x1, y1, h2, a2, x2, y2 = long long integers\n p1, p2, q1, q2 = long long integers\n while reading m, h1, a1, x1, y1, h2, a2, x2, and y2\n set p1, p2, q1, q2 to 0\n for i = 1 to 2 * m inclusive\n set h1 to h1 * x1 + y1 modulo m\n if h1 is a1\n if p1 is 0\n set p1 to i\n else if q1 is 0\n set q1 to i - p1\n break\n end of the block\n end of the block\n end of the block\n for i =1 to 2 * m inclusive\n set h2 to h2 * x2 + y2 modulo m\n if h2 is a2\n if p2 is 0\n set p2 to i\n else if q2 is 0\n set q2 to i - p2\n break\n end of the block\n end of the block\n end of the block\n d = long long integer set to exgcd of q1 and -q2\n c = long long integer set to p2 - p1\n if d is 0\n puts \"-1\"\n continue\n end of the block\n if c modulo d\n puts \"-1\"\n continue\n end of the block\n if p1 is 0 or p2 is 0\n puts \"-1\"\n continue\n end of the block\n if q2 is 0 and q1 is 0 and p1 != p2\n puts \"-1\"\n continue\n end of the block\n if q2 is 0 and p2 - p1 < 0 or q1 is 0 and p1 - p2 < 0\n puts \"-1\"\n continue\n end of the block\n k = long long integer set to c \/ d\n multiply x by k\n multiply y by k\n if d < 0, set d to -d\n if x < 0 or y < 0\n while 1 exists\n add q2 \/ d to x\n add q1 \/ d to y\n if x >= 0 and y >= 0, break\n end of the block\n end of the block\n if x > 0 and y > 0\n while 1 exists\n subtract q2 \/ d from x\n subtract q1 \/ d from y\n if x < 0 or y < 0\n add q2 \/ d to x\n add q1 \/ d to y\n break\n end of the block\n end of the block\n end of the block\n ans = long long integer set to x * q1 + p1\n print ans\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long x, y;\nlong long exgcd(long long a, long long b) {\n if (b == 0) {\n x = 1;\n y = 0;\n return a;\n }\n long long d = exgcd(b, a % b);\n long long t = x;\n x = y;\n y = t - a \/ b * y;\n return d;\n}\nint main() {\n long long m, h1, a1, x1, y1, h2, a2, x2, y2;\n long long p1, p2, q1, q2;\n while (cin >> m >> h1 >> a1 >> x1 >> y1 >> h2 >> a2 >> x2 >> y2) {\n p1 = p2 = q1 = q2 = 0;\n for (long long i = 1; i <= 2 * m; i++) {\n h1 = (h1 * x1 + y1) % m;\n if (h1 == a1) {\n if (p1 == 0)\n p1 = i;\n else if (q1 == 0) {\n q1 = i - p1;\n break;\n }\n }\n }\n for (long long i = 1; i <= 2 * m; i++) {\n h2 = (h2 * x2 + y2) % m;\n if (h2 == a2) {\n if (p2 == 0)\n p2 = i;\n else if (q2 == 0) {\n q2 = i - p2;\n break;\n }\n }\n }\n long long d = exgcd(q1, -q2);\n long long c = p2 - p1;\n if (d == 0) {\n puts(\"-1\");\n continue;\n }\n if (c % d) {\n puts(\"-1\");\n continue;\n }\n if (p1 == 0 || p2 == 0) {\n puts(\"-1\");\n continue;\n }\n if (q2 == 0 && q1 == 0 && p1 != p2) {\n puts(\"-1\");\n continue;\n }\n if ((q2 == 0 && p2 - p1 < 0) || (q1 == 0 && p1 - p2 < 0)) {\n puts(\"-1\");\n continue;\n }\n long long k = c \/ d;\n x *= k;\n y *= k;\n if (d < 0) d = -d;\n if (x < 0 || y < 0) {\n while (1) {\n x += q2 \/ d;\n y += q1 \/ d;\n if (x >= 0 && y >= 0) break;\n }\n }\n if (x > 0 && y > 0) {\n while (1) {\n x -= q2 \/ d;\n y -= q1 \/ d;\n if (x < 0 || y < 0) {\n x += q2 \/ d;\n y += q1 \/ d;\n break;\n }\n }\n }\n long long ans = x * q1 + p1;\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"547A","pseudocode":"x, y = long long integers\ndeclare exgcd that takes two arguments, long long integers a and b\n if b is 0\n set x to 1\n set y to 0\n return a\n end of the block\n d = long long integer set to exgcd of b and a modulo b\n t = long long integer set to x\n set x to y\n set y to t - a \/ b * y\n return d\nend of the block\ndefine the main function\n m, h1, a1, x1, y1, h2, a2, x2, y2 = long long integers\n p1, p2, q1, q2 = long long integers\n while reading m, h1, a1, x1, y1, h2, a2, x2, and y2\n set p1, p2, q1, q2 to 0\n for i = 1 to 2 * m inclusive\n set h1 to h1 * x1 + y1 modulo m\n if h1 is a1\n if p1 is 0\n set p1 to i\n else if q1 is 0\n set q1 to i - p1\n break\n end of the block\n end of the block\n end of the block\n for i =1 to 2 * m inclusive\n set h2 to h2 * x2 + y2 modulo m\n if h2 is a2\n if p2 is 0\n set p2 to i\n else if q2 is 0\n set q2 to i - p2\n break\n end of the block\n end of the block\n end of the block\n d = long long integer set to exgcd of q1 and -q2\n c = long long integer set to p2 - p1\n if d is 0\n puts \"-1\"\n continue\n end of the block\n if c modulo d\n puts \"-1\"\n continue\n end of the block\n if p1 is 0 or p2 is 0\n puts \"-1\"\n continue\n end of the block\n if q2 is 0 and q1 is 0 and p1 != p2\n puts \"-1\"\n continue\n end of the block\n if q2 is 0 and p2 - p1 < 0 or q1 is 0 and p1 - p2 < 0\n puts \"-1\"\n continue\n end of the block\n k = long long integer set to c \/ d\n multiply x by k\n multiply y by k\n if d < 0, set d to -d\n if x < 0 or y < 0\n while 1 exists\n add q2 \/ d to x\n add q1 \/ d to y\n if x >= 0 and y >= 0, break\n end of the block\n end of the block\n if x > 0 and y > 0\n while 1 exists\n subtract q2 \/ d from x\n subtract q1 \/ d from y\n if x < 0 or y < 0\n add q2 \/ d to x\n add q1 \/ d to y\n break\n end of the block\n end of the block\n end of the block\n ans = long long integer set to x * q1 + p1\n print ans\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["5","4 2","1 1","0 1","2 3"],["3"]],[["1023","1 2","1 0","1 2","1 1"],["-1"]],[["1023","1 2","1 2","1 2","1 2"],["512"]],[["2","0 1","1 0","1 0","0 1"],["-1"]],[["17","15 12","15 12","12 14","1 11"],["-1"]],[["29","4 0","1 1","25 20","16 0"],["170"]],[["91","9 64","75 32","60 81","35 46"],["5"]],[["91","38 74","66 10","40 76","17 13"],["-1"]],[["100","11 20","99 31","60 44","45 64"],["3"]],[["9999","4879 6224","63 7313","4279 6583","438 1627"],["4"]],[["10000","8681 4319","9740 5980","24 137","462 7971"],["-1"]],[["100000","76036 94415","34870 43365","56647 26095","88580 30995"],["5"]],[["100000","90861 77058","96282 30306","45940 25601","17117 48287"],["-1"]],[["1000000","220036 846131","698020 485511","656298 242999","766802 905433"],["5297"]],[["1000000","536586 435396","748740 34356","135075 790803","547356 534911"],["9958"]],[["1000000","661647 690400","864868 326304","581148 452012","327910 197092"],["1021"]],[["1000000","233404 949288","893747 751429","692094 57207","674400 583468"],["-1"]],[["1000000","358465 242431","977171 267570","170871 616951","711850 180241"],["-1"]],[["1000000","707719 502871","60595 816414","649648 143990","525107 66615"],["-1"]],[["999983","192005 690428","971158 641039","974183 1882","127579 312317"],["470479"]],[["999983","420528 808305","387096 497121","596163 353326","47177 758204"],["548500"]],[["999983","651224 992349","803017 393514","258455 402487","888310 244420"],["126531"]],[["999983","151890 906425","851007 9094","696594 968184","867017 157783"],["-1"]],[["999983","380412 325756","266945 907644","318575 83081","786616 603671"],["-1"]],[["999983","570797 704759","723177 763726","978676 238272","708387 89886"],["-1"]],[["999983","408725 408721","1 1","378562 294895","984270 0"],["499981500166"]],[["999983","639420 639416","1 1","507684 954997","466316 0"],["499981500166"]],[["999983","867942 867939","1 1","963840 536667","899441 0"],["999964000320"]],[["999961","664221 931770","530542 936292","885122 515424","868560 472225"],["-1"]],[["999961","744938 661980","845908 76370","237399 381935","418010 938769"],["203332"]],[["999961","89288 89284","1 1","764559 727291","999322 0"],["999920001595"]],[["1000000","661703 661699","1 1","425192 823944","854093 0"],["-1"]],[["100019","98811 98807","1 1","91322 14787","72253 0"],["10003600319"]],[["524288","199980 199978","1 1","236260 325076","81773 0"],["-1"]],[["524288","47283 489031","305624 183135","141146 335913","519614 150715"],["19"]],[["524288","83398 33987","158854 211502","36433 18758","218812 517001"],["-1"]],[["912488","681639 518634","168348 212018","255428 4970","31726 664998"],["34838"]],[["129081","128454 36771","116353 2940","95311 22200","579 118683"],["68409"]],[["129081","45717 106320","121816 69841","5161 4872","102076 100020"],["-1"]],[["4","1 2","1 1","0 1","2 0"],["-1"]],[["3","1 0","1 1","1 2","2 0"],["5"]],[["3","0 2","1 0","2 0","2 1"],["-1"]],[["2","0 1","0 1","0 1","0 1"],["1"]],[["2","0 1","1 0","0 1","1 0"],["-1"]],[["2","0 1","1 1","0 1","1 1"],["1"]],[["2","0 1","1 1","0 1","1 0"],["-1"]],[["2","0 1","1 0","0 1","1 1"],["-1"]],[["1000000","1 0","1 1","1 0","1 1"],["999999"]],[["1000000","2 1","1 1","2 0","1 2"],["999999"]],[["6","1 2","3 5","0 2","4 2"],["1"]],[["545","26 40","477 97","454 394","15 264"],["90"]],[["3","1 0","0 1","0 2","1 0"],["-1"]],[["1376","1227 1349","313 193","1113 361","1314 23"],["338"]],[["1376","1322 1320","1 1","776 495","38 0"],["-1"]],[["1376","152 405","1083 1328","76 856","49 629"],["-1"]],[["1392","1060 796","512 242","1386 1346","1310 1199"],["-1"]],[["100000","5827 41281","41285 70821","99199 42807","65667 94952"],["13770"]],[["100000","51157 27741","40564 90740","45270 52367","31585 92150"],["-1"]],[["100000","70525 70522","1 1","89465 30265","33279 0"],["-1"]],[["10","1 6","7 9","1 4","4 0"],["1"]],[["10","9 6","0 8","3 0","2 7"],["-1"]],[["10","4 2","1 1","7 3","9 0"],["-1"]],[["6","5 1","1 1","3 1","3 0"],["-1"]],[["999983","3 1","1 1","8 1","2 0"],["499981500168"]],[["18","3 9","3 0","1 3","3 0"],["1"]],[["18","1 3","3 0","3 9","3 0"],["1"]],[["16","1 0","2 0","1 2","2 0"],["-1"]],[["16","8 0","2 0","1 4","2 0"],["2"]],[["999983","2 1","2 0","1 0","1 1"],["499982500152"]],[["324","2 54","3 0","27 108","2 0"],["-1"]],[["999993","499997 1","2 3","1 4","1 1"],["39325724721"]],[["999983","1 37827","1 1","2 192083","3 0"],["404303164556"]],[["41222","30759 26408","31332 39118","5026 25812","1 9030"],["58900566"]],[["100007","2 1","2 0","3 1","1 1"],["434330399"]],[["8","0 4","4 4","1 4","2 0"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_21","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate long long variables m, h1, a1, x1, h2, a2, x2, y2, y, p1, p2, t1 and t2\ndefine the main function\n read input to m, h1, a1, x1, y, h2, a2, x2 and y2\n for i from 1 to 1e7 inclusive\n declare long long ans1 = (((h1 * x1 * 1LL) + y) % m)\n declare long long ans2 = (((h2 * x2 * 1LL) + y2) % m)\n change h1 to ans1 and h2 to ans2\n if a1 is equal to ans1\n if p1 = 0\n assign i to p1\n else if t1 = 0\n change t1 to i - p1\n end of the block\n if a2 is equal to ans2\n if p2 is false\n change p2 to i\n else if t2 = 0\n change t2 to i - p2\n end of the block\n end of the block\n if p1 is false or p2 is false, return !(cout<< -1 << endl)\n for i from 1 to 1e7 inclusive\n if p1 is equal to p2, return !(cout << p1 << endl)\n if p1 is less than p2\n increase p1 by t1\n else\n add t2 to p2\n end of the block\n print -1\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long m, h1, a1, x1, h2, a2, x2, y2, y, p1, p2, t1, t2;\nint main() {\n cin >> m >> h1 >> a1 >> x1 >> y >> h2 >> a2 >> x2 >> y2;\n for (int i = 1; i <= 1e7; i++) {\n long long ans1 = (((h1 * x1 * 1LL) + y) % m);\n long long ans2 = (((h2 * x2 * 1LL) + y2) % m);\n h1 = ans1, h2 = ans2;\n if (a1 == ans1) {\n if (!p1)\n p1 = i;\n else if (!t1)\n t1 = i - p1;\n }\n if (a2 == ans2) {\n if (!p2)\n p2 = i;\n else if (!t2)\n t2 = i - p2;\n }\n }\n if (!p1 || !p2) return !(cout << -1 << endl);\n for (int i = 1; i <= 1e7; i++) {\n if (p1 == p2) return !(cout << p1 << endl);\n if (p1 < p2)\n p1 += t1;\n else\n p2 += t2;\n }\n cout << -1 << endl;\n return 0;\n}","item":{"problem_id":"547A","pseudocode":"create long long variables m, h1, a1, x1, h2, a2, x2, y2, y, p1, p2, t1 and t2\ndefine the main function\n read input to m, h1, a1, x1, y, h2, a2, x2 and y2\n for i from 1 to 1e7 inclusive\n declare long long ans1 = (((h1 * x1 * 1LL) + y) % m)\n declare long long ans2 = (((h2 * x2 * 1LL) + y2) % m)\n change h1 to ans1 and h2 to ans2\n if a1 is equal to ans1\n if p1 = 0\n assign i to p1\n else if t1 = 0\n change t1 to i - p1\n end of the block\n if a2 is equal to ans2\n if p2 is false\n change p2 to i\n else if t2 = 0\n change t2 to i - p2\n end of the block\n end of the block\n if p1 is false or p2 is false, return !(cout<< -1 << endl)\n for i from 1 to 1e7 inclusive\n if p1 is equal to p2, return !(cout << p1 << endl)\n if p1 is less than p2\n increase p1 by t1\n else\n add t2 to p2\n end of the block\n print -1\n return to indicate successful execution\nend of the block","testcases":[[["5","4 2","1 1","0 1","2 3"],["3"]],[["1023","1 2","1 0","1 2","1 1"],["-1"]],[["1023","1 2","1 2","1 2","1 2"],["512"]],[["2","0 1","1 0","1 0","0 1"],["-1"]],[["17","15 12","15 12","12 14","1 11"],["-1"]],[["29","4 0","1 1","25 20","16 0"],["170"]],[["91","9 64","75 32","60 81","35 46"],["5"]],[["91","38 74","66 10","40 76","17 13"],["-1"]],[["100","11 20","99 31","60 44","45 64"],["3"]],[["9999","4879 6224","63 7313","4279 6583","438 1627"],["4"]],[["10000","8681 4319","9740 5980","24 137","462 7971"],["-1"]],[["100000","76036 94415","34870 43365","56647 26095","88580 30995"],["5"]],[["100000","90861 77058","96282 30306","45940 25601","17117 48287"],["-1"]],[["1000000","220036 846131","698020 485511","656298 242999","766802 905433"],["5297"]],[["1000000","536586 435396","748740 34356","135075 790803","547356 534911"],["9958"]],[["1000000","661647 690400","864868 326304","581148 452012","327910 197092"],["1021"]],[["1000000","233404 949288","893747 751429","692094 57207","674400 583468"],["-1"]],[["1000000","358465 242431","977171 267570","170871 616951","711850 180241"],["-1"]],[["1000000","707719 502871","60595 816414","649648 143990","525107 66615"],["-1"]],[["999983","192005 690428","971158 641039","974183 1882","127579 312317"],["470479"]],[["999983","420528 808305","387096 497121","596163 353326","47177 758204"],["548500"]],[["999983","651224 992349","803017 393514","258455 402487","888310 244420"],["126531"]],[["999983","151890 906425","851007 9094","696594 968184","867017 157783"],["-1"]],[["999983","380412 325756","266945 907644","318575 83081","786616 603671"],["-1"]],[["999983","570797 704759","723177 763726","978676 238272","708387 89886"],["-1"]],[["999983","408725 408721","1 1","378562 294895","984270 0"],["499981500166"]],[["999983","639420 639416","1 1","507684 954997","466316 0"],["499981500166"]],[["999983","867942 867939","1 1","963840 536667","899441 0"],["999964000320"]],[["999961","664221 931770","530542 936292","885122 515424","868560 472225"],["-1"]],[["999961","744938 661980","845908 76370","237399 381935","418010 938769"],["203332"]],[["999961","89288 89284","1 1","764559 727291","999322 0"],["999920001595"]],[["1000000","661703 661699","1 1","425192 823944","854093 0"],["-1"]],[["100019","98811 98807","1 1","91322 14787","72253 0"],["10003600319"]],[["524288","199980 199978","1 1","236260 325076","81773 0"],["-1"]],[["524288","47283 489031","305624 183135","141146 335913","519614 150715"],["19"]],[["524288","83398 33987","158854 211502","36433 18758","218812 517001"],["-1"]],[["912488","681639 518634","168348 212018","255428 4970","31726 664998"],["34838"]],[["129081","128454 36771","116353 2940","95311 22200","579 118683"],["68409"]],[["129081","45717 106320","121816 69841","5161 4872","102076 100020"],["-1"]],[["4","1 2","1 1","0 1","2 0"],["-1"]],[["3","1 0","1 1","1 2","2 0"],["5"]],[["3","0 2","1 0","2 0","2 1"],["-1"]],[["2","0 1","0 1","0 1","0 1"],["1"]],[["2","0 1","1 0","0 1","1 0"],["-1"]],[["2","0 1","1 1","0 1","1 1"],["1"]],[["2","0 1","1 1","0 1","1 0"],["-1"]],[["2","0 1","1 0","0 1","1 1"],["-1"]],[["1000000","1 0","1 1","1 0","1 1"],["999999"]],[["1000000","2 1","1 1","2 0","1 2"],["999999"]],[["6","1 2","3 5","0 2","4 2"],["1"]],[["545","26 40","477 97","454 394","15 264"],["90"]],[["3","1 0","0 1","0 2","1 0"],["-1"]],[["1376","1227 1349","313 193","1113 361","1314 23"],["338"]],[["1376","1322 1320","1 1","776 495","38 0"],["-1"]],[["1376","152 405","1083 1328","76 856","49 629"],["-1"]],[["1392","1060 796","512 242","1386 1346","1310 1199"],["-1"]],[["100000","5827 41281","41285 70821","99199 42807","65667 94952"],["13770"]],[["100000","51157 27741","40564 90740","45270 52367","31585 92150"],["-1"]],[["100000","70525 70522","1 1","89465 30265","33279 0"],["-1"]],[["10","1 6","7 9","1 4","4 0"],["1"]],[["10","9 6","0 8","3 0","2 7"],["-1"]],[["10","4 2","1 1","7 3","9 0"],["-1"]],[["6","5 1","1 1","3 1","3 0"],["-1"]],[["999983","3 1","1 1","8 1","2 0"],["499981500168"]],[["18","3 9","3 0","1 3","3 0"],["1"]],[["18","1 3","3 0","3 9","3 0"],["1"]],[["16","1 0","2 0","1 2","2 0"],["-1"]],[["16","8 0","2 0","1 4","2 0"],["2"]],[["999983","2 1","2 0","1 0","1 1"],["499982500152"]],[["324","2 54","3 0","27 108","2 0"],["-1"]],[["999993","499997 1","2 3","1 4","1 1"],["39325724721"]],[["999983","1 37827","1 1","2 192083","3 0"],["404303164556"]],[["41222","30759 26408","31332 39118","5026 25812","1 9030"],["58900566"]],[["100007","2 1","2 0","3 1","1 1"],["434330399"]],[["8","0 4","4 4","1 4","2 0"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_22","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integer k\ndefine the main function\n read k\n print \"+------------------------+\\n\"\n print \"|\"\n for i = 0 to 11 exclusive\n if i is 0\n if i + 1 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n else\n if i * 3 + 2 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n end of the block\n end of the block\n print \"|D|)\\n\"\n print \"|\"\n for i = 0 to 11 exclusive\n if i is 0\n if i + 2 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n else\n if i * 3 + 3 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n end of the block\n end of the block\n print \"|.|\\n\"\n print \"|\"\n for i = 0 to 11 exclusive\n if 3 is less than or equal to k and i is 0\n print \"O.\"\n else if i is 0\n print \"#.\"\n else\n print \"..\"\n end of the block\n print \"..|\\n\"\n print \"|\"\n for i = 0 to 11 exclusive\n if i is 0\n if i + 4 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n else\n if i * 3 + 4 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n end of the block\n end of the block\n print \"|.|)\\n\"\n print \"+------------------------+\\n\"\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int k;\nint main() {\n cin >> k;\n cout << \"+------------------------+\\n\";\n cout << \"|\";\n for (int i = 0; i < 11; i++) {\n if (i == 0) {\n if (i + 1 <= k)\n cout << \"O.\";\n else\n cout << \"#.\";\n } else {\n if ((i)*3 + 2 <= k)\n cout << \"O.\";\n else\n cout << \"#.\";\n }\n }\n cout << \"|D|)\\n\";\n cout << \"|\";\n for (int i = 0; i < 11; i++) {\n if (i == 0) {\n if (i + 2 <= k)\n cout << \"O.\";\n else\n cout << \"#.\";\n } else {\n if ((i)*3 + 3 <= k)\n cout << \"O.\";\n else\n cout << \"#.\";\n }\n }\n cout << \"|.|\\n\";\n cout << \"|\";\n for (int i = 0; i < 11; i++) {\n if (3 <= k && i == 0)\n cout << \"O.\";\n else if (i == 0)\n cout << \"#.\";\n else\n cout << \"..\";\n }\n cout << \"..|\\n\";\n cout << \"|\";\n for (int i = 0; i < 11; i++) {\n if (i == 0) {\n if (i + 4 <= k)\n cout << \"O.\";\n else\n cout << \"#.\";\n } else {\n if ((i)*3 + 4 <= k)\n cout << \"O.\";\n else\n cout << \"#.\";\n }\n }\n cout << \"|.|)\\n\";\n cout << \"+------------------------+\\n\";\n return 0;\n}","item":{"problem_id":"475A","pseudocode":"create integer k\ndefine the main function\n read k\n print \"+------------------------+\\n\"\n print \"|\"\n for i = 0 to 11 exclusive\n if i is 0\n if i + 1 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n else\n if i * 3 + 2 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n end of the block\n end of the block\n print \"|D|)\\n\"\n print \"|\"\n for i = 0 to 11 exclusive\n if i is 0\n if i + 2 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n else\n if i * 3 + 3 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n end of the block\n end of the block\n print \"|.|\\n\"\n print \"|\"\n for i = 0 to 11 exclusive\n if 3 is less than or equal to k and i is 0\n print \"O.\"\n else if i is 0\n print \"#.\"\n else\n print \"..\"\n end of the block\n print \"..|\\n\"\n print \"|\"\n for i = 0 to 11 exclusive\n if i is 0\n if i + 4 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n else\n if i * 3 + 4 is less than or equal to k\n print \"O.\"\n else\n print \"#.\"\n end of the block\n end of the block\n print \"|.|)\\n\"\n print \"+------------------------+\\n\"\n return to indicate successful execution\nend of the block","testcases":[[["9"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["20"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["30"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["5"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["0"],["+------------------------+","|#.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["1"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["2"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["3"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["4"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["6"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["7"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["8"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["10"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["11"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["12"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["13"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["14"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["15"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["16"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["17"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["18"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["19"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["21"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["22"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["23"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["24"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["25"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["26"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["27"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["28"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["29"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["31"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["32"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["33"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["34"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.O.|.|)","+------------------------+"]]]}} +{"instance_id":"pseudo_to_code_2k_23","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet Pi be a constant double with value is equal to arc cosine of (-1.0)\ndefine the main function\n let k be a integer\n read k\n print +------------------------+ and newline\n print |\n if (k is greater than 0)\n print O.\n else do the following\n print #.\n let c be a integer with value c is equal to (k - 4) \/ 3\n if ((k - 4) modulus 3 is greater than 0), increase c by 1\n for ( i =0 to 10 exclusive )\n if (i is less than c)\n print O.\n else do the following\n print #.\n end of the block\n print |D| and newline\n print |\n if (k is greater than 1)\n print O.\n else do the following\n print #.\n let the value of c is equal to (k - 4) \/ 3\n if ((k - 4) modulus 3 is greater than 1), increase c value by 1\n for ( i = 0 to 10 exclusive )\n if (i is less than c)\n print O.\n else, do the following\n print #.\n end of the block\n print |.| and newline\n print |\n if (k is greater than 2)\n print O\n else do the following\n print #\n print .......................| and newline\n print |\n if (k is greater than 3)\n print O.\n else do the following\n print #.\n let the value of c is equal to (k - 4) \/ 3\n for ( i =0 to 10 exclusive )\n if (i is less than c)\n print O.\n else do the following\n print #.\n end of the block\n print |.| and newline\n print +------------------------+ and newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const double Pi = acos(-1.0);\nint main() {\n int k;\n cin >> k;\n cout << \"+------------------------+\\n\";\n cout << \"|\";\n if (k > 0)\n cout << \"O.\";\n else\n cout << \"#.\";\n int c = (k - 4) \/ 3;\n if ((k - 4) % 3 > 0) c++;\n for (int i = 0; i < 10; i++) {\n if (i < c)\n cout << \"O.\";\n else\n cout << \"#.\";\n }\n cout << \"|D|)\\n\";\n cout << \"|\";\n if (k > 1)\n cout << \"O.\";\n else\n cout << \"#.\";\n c = (k - 4) \/ 3;\n if ((k - 4) % 3 > 1) c++;\n for (int i = 0; i < 10; i++) {\n if (i < c)\n cout << \"O.\";\n else\n cout << \"#.\";\n }\n cout << \"|.|\\n\";\n cout << \"|\";\n if (k > 2)\n cout << \"O\";\n else\n cout << \"#\";\n cout << \".......................|\\n\";\n cout << \"|\";\n if (k > 3)\n cout << \"O.\";\n else\n cout << \"#.\";\n c = (k - 4) \/ 3;\n for (int i = 0; i < 10; i++) {\n if (i < c)\n cout << \"O.\";\n else\n cout << \"#.\";\n }\n cout << \"|.|)\\n\";\n cout << \"+------------------------+\\n\";\n return 0;\n}","item":{"problem_id":"475A","pseudocode":"let Pi be a constant double with value is equal to arc cosine of (-1.0)\ndefine the main function\n let k be a integer\n read k\n print +------------------------+ and newline\n print |\n if (k is greater than 0)\n print O.\n else do the following\n print #.\n let c be a integer with value c is equal to (k - 4) \/ 3\n if ((k - 4) modulus 3 is greater than 0), increase c by 1\n for ( i =0 to 10 exclusive )\n if (i is less than c)\n print O.\n else do the following\n print #.\n end of the block\n print |D| and newline\n print |\n if (k is greater than 1)\n print O.\n else do the following\n print #.\n let the value of c is equal to (k - 4) \/ 3\n if ((k - 4) modulus 3 is greater than 1), increase c value by 1\n for ( i = 0 to 10 exclusive )\n if (i is less than c)\n print O.\n else, do the following\n print #.\n end of the block\n print |.| and newline\n print |\n if (k is greater than 2)\n print O\n else do the following\n print #\n print .......................| and newline\n print |\n if (k is greater than 3)\n print O.\n else do the following\n print #.\n let the value of c is equal to (k - 4) \/ 3\n for ( i =0 to 10 exclusive )\n if (i is less than c)\n print O.\n else do the following\n print #.\n end of the block\n print |.| and newline\n print +------------------------+ and newline\n return to indicate successful execution\nend of the block","testcases":[[["9"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["20"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["30"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["5"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["0"],["+------------------------+","|#.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["1"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["2"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["3"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["4"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["6"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["7"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["8"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["10"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["11"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["12"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["13"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["14"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["15"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["16"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["17"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["18"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["19"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["21"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["22"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["23"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["24"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["25"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["26"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["27"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["28"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["29"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["31"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["32"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["33"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["34"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.O.|.|)","+------------------------+"]]]}} +{"instance_id":"pseudo_to_code_2k_24","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create int n\n read n\n print +------------------------+\n print |\n if n >= 1\n print O.\n else\n print #.\n for a=1 to 10 inclusive\n if n >= 3* a +2\n print O.\n else\n print #.\n print |D| and a newline\n print |\n if n >= 2\n print O.\n otherwise\n print #.\n for a=1 to 10 inclusive\n if n >= 3 * a + 3\n print O.\n otherwise\n print #.\n print |.| and a newline\n print |\n if n >= 3\n print O.\n else\n print #.\n print ......................| and a newline\n print |\n if n >= 4\n print O.\n else\n print #.\n for a=1 to 10 inclusive\n if n >= 3*a+4\n print O.\n else\n print #.\n print |.|) and a newline\n print +------------------------+ and a newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int n;\n cin >> n;\n cout << \"+------------------------+\" << endl;\n cout << \"|\";\n if (n >= 1)\n cout << \"O.\";\n else\n cout << \"#.\";\n for (int a = 1; a <= 10; a++)\n if (n >= 3 * a + 2)\n cout << \"O.\";\n else\n cout << \"#.\";\n cout << \"|D|)\" << endl;\n cout << \"|\";\n if (n >= 2)\n cout << \"O.\";\n else\n cout << \"#.\";\n for (int a = 1; a <= 10; a++)\n if (n >= 3 * a + 3)\n cout << \"O.\";\n else\n cout << \"#.\";\n cout << \"|.|\" << endl;\n cout << \"|\";\n if (n >= 3)\n cout << \"O.\";\n else\n cout << \"#.\";\n cout << \"......................|\" << endl;\n cout << \"|\";\n if (n >= 4)\n cout << \"O.\";\n else\n cout << \"#.\";\n for (int a = 1; a <= 10; a++)\n if (n >= 3 * a + 4)\n cout << \"O.\";\n else\n cout << \"#.\";\n cout << \"|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n return 0;\n}","item":{"problem_id":"475A","pseudocode":"define the main function\n create int n\n read n\n print +------------------------+\n print |\n if n >= 1\n print O.\n else\n print #.\n for a=1 to 10 inclusive\n if n >= 3* a +2\n print O.\n else\n print #.\n print |D| and a newline\n print |\n if n >= 2\n print O.\n otherwise\n print #.\n for a=1 to 10 inclusive\n if n >= 3 * a + 3\n print O.\n otherwise\n print #.\n print |.| and a newline\n print |\n if n >= 3\n print O.\n else\n print #.\n print ......................| and a newline\n print |\n if n >= 4\n print O.\n else\n print #.\n for a=1 to 10 inclusive\n if n >= 3*a+4\n print O.\n else\n print #.\n print |.|) and a newline\n print +------------------------+ and a newline\n return to indicate successful execution\nend of the block","testcases":[[["9"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["20"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["30"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["5"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["0"],["+------------------------+","|#.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["1"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["2"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["3"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["4"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["6"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["7"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["8"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["10"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["11"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["12"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["13"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["14"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["15"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["16"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["17"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["18"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["19"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["21"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["22"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["23"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["24"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["25"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["26"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["27"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["28"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["29"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["31"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["32"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["33"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["34"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.O.|.|)","+------------------------+"]]]}} +{"instance_id":"pseudo_to_code_2k_25","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n let p be an int\n read p\n if p is equal to 0\n print +------------------------+\n print |#.#.#.#.#.#.#.#.#.#.#.|D|)\n print |#.#.#.#.#.#.#.#.#.#.#.|.|\n print |#.......................|\n print |#.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 1\n print +------------------------+ and a newline\n print |O.#.#.#.#.#.#.#.#.#.#.|D|) and a newline\n print |#.#.#.#.#.#.#.#.#.#.#.|.| and a newline\n print |#.......................|\n print |#.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 2\n print +------------------------+\n print |O.#.#.#.#.#.#.#.#.#.#.|D|) and a newline\n print |O.#.#.#.#.#.#.#.#.#.#.|.|\n print |#.......................|\n print |#.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+ and a newline\n end of the block\n if p is equal to 3\n print +------------------------+\n print |O.#.#.#.#.#.#.#.#.#.#.|D|)\n print |O.#.#.#.#.#.#.#.#.#.#.|.| and a newline\n print |O.......................| and a newline\n print |#.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 4\n print +------------------------+\n print |O.#.#.#.#.#.#.#.#.#.#.|D|)\n print |O.#.#.#.#.#.#.#.#.#.#.|.| and a newline\n print |O.......................|\n print |O.#.#.#.#.#.#.#.#.#.#.|.|) and a newline\n print +------------------------+\n end of the block\n if p is equal to 5\n print +------------------------+\n print |O.O.#.#.#.#.#.#.#.#.#.|D|)\n print |O.#.#.#.#.#.#.#.#.#.#.|.|\n print |O.......................| and a newline\n print |O.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+ and a newline\n end of the block\n if p is 6\n print +------------------------+\n print |O.O.#.#.#.#.#.#.#.#.#.|D|)\n print |O.O.#.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 7\n print +------------------------+\n print |O.O.#.#.#.#.#.#.#.#.#.|D|)\n print |O.O.#.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 8\n print +------------------------+\n print |O.O.O.#.#.#.#.#.#.#.#.|D|)\n print |O.O.#.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 9\n print +------------------------+\n print |O.O.O.#.#.#.#.#.#.#.#.|D|)\n print |O.O.O.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 10\n print +------------------------+\n print |O.O.O.#.#.#.#.#.#.#.#.|D|)\n print |O.O.O.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 11\n print +------------------------+\n print |O.O.O.O.#.#.#.#.#.#.#.|D|)\n print |O.O.O.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.#.#.#.#.#.#.#.#.|.|) and a newline\n print +------------------------+\n end of the block\n if p is 12\n print +------------------------+\n print |O.O.O.O.#.#.#.#.#.#.#.|D|)\n print |O.O.O.O.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+ and a newline\n end of the block\n if p is 13\n print +------------------------+\n print |O.O.O.O.#.#.#.#.#.#.#.|D|)\n print |O.O.O.O.#.#.#.#.#.#.#.|.| and a newline\n print |O.......................|\n print |O.O.O.O.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 14\n print +------------------------+\n print |O.O.O.O.O.#.#.#.#.#.#.|D|)\n print |O.O.O.O.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 15\n print +------------------------+ and a newline\n print |O.O.O.O.O.#.#.#.#.#.#.|D|)\n print |O.O.O.O.O.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 16\n print +------------------------+\n print |O.O.O.O.O.#.#.#.#.#.#.|D|)\n print |O.O.O.O.O.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 17\n print +------------------------+ and a newline\n print |O.O.O.O.O.O.#.#.#.#.#.|D|)\n print |O.O.O.O.O.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 18\n print +------------------------+\n print |O.O.O.O.O.O.#.#.#.#.#.|D|)\n print |O.O.O.O.O.O.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 19\n print +------------------------+\n print |O.O.O.O.O.O.#.#.#.#.#.|D|)\n print |O.O.O.O.O.O.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 20\n print +------------------------+\n print |O.O.O.O.O.O.O.#.#.#.#.|D|)\n print |O.O.O.O.O.O.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 21\n print +------------------------+\n print |O.O.O.O.O.O.O.#.#.#.#.|D|)\n print |O.O.O.O.O.O.O.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 22\n print +------------------------+\n print |O.O.O.O.O.O.O.#.#.#.#.|D|)\n print |O.O.O.O.O.O.O.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 23\n print +------------------------+\n print |O.O.O.O.O.O.O.O.#.#.#.|D|)\n print |O.O.O.O.O.O.O.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 24\n print +------------------------+\n print |O.O.O.O.O.O.O.O.#.#.#.|D|)\n print |O.O.O.O.O.O.O.O.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 25\n print +------------------------+\n print |O.O.O.O.O.O.O.O.#.#.#.|D|)\n print |O.O.O.O.O.O.O.O.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 26\n print +------------------------+ and a newline\n print |O.O.O.O.O.O.O.O.O.#.#.|D|)\n print |O.O.O.O.O.O.O.O.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 27\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.#.#.|D|)\n print |O.O.O.O.O.O.O.O.O.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 28\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.#.#.|D|)\n print |O.O.O.O.O.O.O.O.O.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 29\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.#.|D|)\n print |O.O.O.O.O.O.O.O.O.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 30\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.#.|D|)\n print |O.O.O.O.O.O.O.O.O.O.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 31\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.#.|D|)\n print |O.O.O.O.O.O.O.O.O.O.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.O.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 32\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.O.|D|)\n print |O.O.O.O.O.O.O.O.O.O.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.O.#.|.|)\n print +------------------------+\n end of the block\n if p is 33\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.O.|D|)\n print |O.O.O.O.O.O.O.O.O.O.O.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.O.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 34\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.O.|D|)\n print |O.O.O.O.O.O.O.O.O.O.O.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.O.O.|.|)\n print +------------------------+\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int p;\n cin >> p;\n if (p == 0) {\n cout << \"+------------------------+\" << endl;\n cout << \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|#.#.#.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|#.......................|\" << endl;\n cout << \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 1) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.#.#.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|#.#.#.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|#.......................|\" << endl;\n cout << \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 2) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.#.#.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.#.#.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|#.......................|\" << endl;\n cout << \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 3) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.#.#.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.#.#.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 4) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.#.#.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.#.#.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.#.#.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 5) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.#.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.#.#.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.#.#.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 6) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.#.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.#.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.#.#.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 7) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.#.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.#.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.#.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 8) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.#.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.#.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 9) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.#.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 10) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 11) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 12) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.#.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 13) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 14) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 15) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.#.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 16) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.#.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 17) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 18) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.#.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 19) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.#.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 20) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.#.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 21) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.#.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 22) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.#.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 23) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.#.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 24) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.#.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 25) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.#.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 26) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.#.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 27) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.#.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 28) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.#.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 29) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.#.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 30) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.#.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 31) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.#.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 32) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.O.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.#.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 33) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.O.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.O.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.#.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n if (p == 34) {\n cout << \"+------------------------+\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.O.|D|)\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.O.|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << \"|O.O.O.O.O.O.O.O.O.O.O.|.|)\" << endl;\n cout << \"+------------------------+\" << endl;\n }\n return 0;\n}","item":{"problem_id":"475A","pseudocode":"define the main function\n let p be an int\n read p\n if p is equal to 0\n print +------------------------+\n print |#.#.#.#.#.#.#.#.#.#.#.|D|)\n print |#.#.#.#.#.#.#.#.#.#.#.|.|\n print |#.......................|\n print |#.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 1\n print +------------------------+ and a newline\n print |O.#.#.#.#.#.#.#.#.#.#.|D|) and a newline\n print |#.#.#.#.#.#.#.#.#.#.#.|.| and a newline\n print |#.......................|\n print |#.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 2\n print +------------------------+\n print |O.#.#.#.#.#.#.#.#.#.#.|D|) and a newline\n print |O.#.#.#.#.#.#.#.#.#.#.|.|\n print |#.......................|\n print |#.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+ and a newline\n end of the block\n if p is equal to 3\n print +------------------------+\n print |O.#.#.#.#.#.#.#.#.#.#.|D|)\n print |O.#.#.#.#.#.#.#.#.#.#.|.| and a newline\n print |O.......................| and a newline\n print |#.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 4\n print +------------------------+\n print |O.#.#.#.#.#.#.#.#.#.#.|D|)\n print |O.#.#.#.#.#.#.#.#.#.#.|.| and a newline\n print |O.......................|\n print |O.#.#.#.#.#.#.#.#.#.#.|.|) and a newline\n print +------------------------+\n end of the block\n if p is equal to 5\n print +------------------------+\n print |O.O.#.#.#.#.#.#.#.#.#.|D|)\n print |O.#.#.#.#.#.#.#.#.#.#.|.|\n print |O.......................| and a newline\n print |O.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+ and a newline\n end of the block\n if p is 6\n print +------------------------+\n print |O.O.#.#.#.#.#.#.#.#.#.|D|)\n print |O.O.#.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.#.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 7\n print +------------------------+\n print |O.O.#.#.#.#.#.#.#.#.#.|D|)\n print |O.O.#.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 8\n print +------------------------+\n print |O.O.O.#.#.#.#.#.#.#.#.|D|)\n print |O.O.#.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 9\n print +------------------------+\n print |O.O.O.#.#.#.#.#.#.#.#.|D|)\n print |O.O.O.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.#.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 10\n print +------------------------+\n print |O.O.O.#.#.#.#.#.#.#.#.|D|)\n print |O.O.O.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 11\n print +------------------------+\n print |O.O.O.O.#.#.#.#.#.#.#.|D|)\n print |O.O.O.#.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.#.#.#.#.#.#.#.#.|.|) and a newline\n print +------------------------+\n end of the block\n if p is 12\n print +------------------------+\n print |O.O.O.O.#.#.#.#.#.#.#.|D|)\n print |O.O.O.O.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.#.#.#.#.#.#.#.#.|.|)\n print +------------------------+ and a newline\n end of the block\n if p is 13\n print +------------------------+\n print |O.O.O.O.#.#.#.#.#.#.#.|D|)\n print |O.O.O.O.#.#.#.#.#.#.#.|.| and a newline\n print |O.......................|\n print |O.O.O.O.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 14\n print +------------------------+\n print |O.O.O.O.O.#.#.#.#.#.#.|D|)\n print |O.O.O.O.#.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 15\n print +------------------------+ and a newline\n print |O.O.O.O.O.#.#.#.#.#.#.|D|)\n print |O.O.O.O.O.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.#.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 16\n print +------------------------+\n print |O.O.O.O.O.#.#.#.#.#.#.|D|)\n print |O.O.O.O.O.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 17\n print +------------------------+ and a newline\n print |O.O.O.O.O.O.#.#.#.#.#.|D|)\n print |O.O.O.O.O.#.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 18\n print +------------------------+\n print |O.O.O.O.O.O.#.#.#.#.#.|D|)\n print |O.O.O.O.O.O.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.#.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 19\n print +------------------------+\n print |O.O.O.O.O.O.#.#.#.#.#.|D|)\n print |O.O.O.O.O.O.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 20\n print +------------------------+\n print |O.O.O.O.O.O.O.#.#.#.#.|D|)\n print |O.O.O.O.O.O.#.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 21\n print +------------------------+\n print |O.O.O.O.O.O.O.#.#.#.#.|D|)\n print |O.O.O.O.O.O.O.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.#.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 22\n print +------------------------+\n print |O.O.O.O.O.O.O.#.#.#.#.|D|)\n print |O.O.O.O.O.O.O.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 23\n print +------------------------+\n print |O.O.O.O.O.O.O.O.#.#.#.|D|)\n print |O.O.O.O.O.O.O.#.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 24\n print +------------------------+\n print |O.O.O.O.O.O.O.O.#.#.#.|D|)\n print |O.O.O.O.O.O.O.O.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.#.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 25\n print +------------------------+\n print |O.O.O.O.O.O.O.O.#.#.#.|D|)\n print |O.O.O.O.O.O.O.O.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 26\n print +------------------------+ and a newline\n print |O.O.O.O.O.O.O.O.O.#.#.|D|)\n print |O.O.O.O.O.O.O.O.#.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 27\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.#.#.|D|)\n print |O.O.O.O.O.O.O.O.O.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.#.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 28\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.#.#.|D|)\n print |O.O.O.O.O.O.O.O.O.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 29\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.#.|D|)\n print |O.O.O.O.O.O.O.O.O.#.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.#.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 30\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.#.|D|)\n print |O.O.O.O.O.O.O.O.O.O.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.#.#.|.|)\n print +------------------------+\n end of the block\n if p is 31\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.#.|D|)\n print |O.O.O.O.O.O.O.O.O.O.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.O.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 32\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.O.|D|)\n print |O.O.O.O.O.O.O.O.O.O.#.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.O.#.|.|)\n print +------------------------+\n end of the block\n if p is 33\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.O.|D|)\n print |O.O.O.O.O.O.O.O.O.O.O.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.O.#.|.|)\n print +------------------------+\n end of the block\n if p is equal to 34\n print +------------------------+\n print |O.O.O.O.O.O.O.O.O.O.O.|D|)\n print |O.O.O.O.O.O.O.O.O.O.O.|.|\n print |O.......................|\n print |O.O.O.O.O.O.O.O.O.O.O.|.|)\n print +------------------------+\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["9"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["20"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["30"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["5"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["0"],["+------------------------+","|#.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["1"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["2"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["3"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["4"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["6"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["7"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["8"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["10"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["11"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["12"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["13"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["14"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["15"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["16"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["17"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["18"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["19"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["21"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["22"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["23"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["24"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["25"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["26"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["27"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["28"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["29"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["31"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["32"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["33"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["34"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.O.|.|)","+------------------------+"]]]}} +{"instance_id":"pseudo_to_code_2k_26","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n declare integer variable n\n read n\n print \"+------------------------+\\n\"\n create 2d character array arr 4 by 11 elements\n for i = 0 to 4 exclusive\n for integer j = 0 to 11 exclusive set arr[i][j] to '#'\n for integer j = 0 to 11 exclusive\n for integer i = 0 to 4 exclusive\n if i = 2 && j is greater than 0\n set arr[i][j] to '.'\n else if n\n set arr[i][j] to 'O'\n decrease n\n end of the block\n end of the block\n end of the block\n for i = 0 to 4 exclusive\n print \"|\"\n for integer j = 0 to 11 exclusive print arr[i][j] and '.'\n if i = 0\n print \"|D|)\\n\"\n else if i = 1\n print \"|.|\\n\"\n else if i = 2\n print \"..|\\n\"\n else\n print \"|.|)\\n\"\n end of the block\n print \"+------------------------+\\n\"\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int n;\n cin >> n;\n cout << \"+------------------------+\\n\";\n char arr[4][11];\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 11; j++) arr[i][j] = '#';\n for (int j = 0; j < 11; j++) {\n for (int i = 0; i < 4; i++) {\n if (i == 2 && j > 0)\n arr[i][j] = '.';\n else if (n) {\n arr[i][j] = 'O';\n n--;\n }\n }\n }\n for (int i = 0; i < 4; i++) {\n cout << \"|\";\n for (int j = 0; j < 11; j++) { cout << arr[i][j] << \".\"; }\n if (i == 0)\n cout << \"|D|)\\n\";\n else if (i == 1)\n cout << \"|.|\\n\";\n else if (i == 2)\n cout << \"..|\\n\";\n else\n cout << \"|.|)\\n\";\n }\n cout << \"+------------------------+\\n\";\n return 0;\n}","item":{"problem_id":"475A","pseudocode":"define the main function\n declare integer variable n\n read n\n print \"+------------------------+\\n\"\n create 2d character array arr 4 by 11 elements\n for i = 0 to 4 exclusive\n for integer j = 0 to 11 exclusive set arr[i][j] to '#'\n for integer j = 0 to 11 exclusive\n for integer i = 0 to 4 exclusive\n if i = 2 && j is greater than 0\n set arr[i][j] to '.'\n else if n\n set arr[i][j] to 'O'\n decrease n\n end of the block\n end of the block\n end of the block\n for i = 0 to 4 exclusive\n print \"|\"\n for integer j = 0 to 11 exclusive print arr[i][j] and '.'\n if i = 0\n print \"|D|)\\n\"\n else if i = 1\n print \"|.|\\n\"\n else if i = 2\n print \"..|\\n\"\n else\n print \"|.|)\\n\"\n end of the block\n print \"+------------------------+\\n\"\n return to indicate successful execution\nend of the block","testcases":[[["9"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["20"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["30"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["5"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["0"],["+------------------------+","|#.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["1"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["2"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["3"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["4"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["6"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["7"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["8"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["10"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["11"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["12"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["13"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["14"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["15"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["16"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["17"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["18"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["19"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["21"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["22"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["23"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["24"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["25"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["26"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["27"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["28"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["29"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["31"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["32"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["33"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["34"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.O.|.|)","+------------------------+"]]]}} +{"instance_id":"pseudo_to_code_2k_27","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create integer k\n read k\n create string array s with length 6\n set s[0] to \"+------------------------+\"\n set s[1] to \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\"\n set s[2] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|\"\n set s[3] to \"|#.......................|\"\n set s[4] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n set s[5] to \"+------------------------+\"\n create integer idx to 0\n while k\n for i=0 to 6 exclusive\n if s[i][idx] is equal to '#'\n decrement k\n set s[i][idx] to 'O'\n if not k break\n end of the block\n increment idx\n end of the block\n for i=0 to 6 exclusive print s[i]\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int k;\n cin >> k;\n string s[6];\n s[0] = \"+------------------------+\";\n s[1] = \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\";\n s[2] = \"|#.#.#.#.#.#.#.#.#.#.#.|.|\";\n s[3] = \"|#.......................|\";\n s[4] = \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n s[5] = \"+------------------------+\";\n int idx = 0;\n while (k) {\n for (int i = 0; i < 6; i++)\n if (s[i][idx] == '#') {\n k--;\n s[i][idx] = 'O';\n if (!k) break;\n }\n idx++;\n }\n for (int i = 0; i < 6; i++) cout << s[i] << endl;\n}","item":{"problem_id":"475A","pseudocode":"define the main function\n create integer k\n read k\n create string array s with length 6\n set s[0] to \"+------------------------+\"\n set s[1] to \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\"\n set s[2] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|\"\n set s[3] to \"|#.......................|\"\n set s[4] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n set s[5] to \"+------------------------+\"\n create integer idx to 0\n while k\n for i=0 to 6 exclusive\n if s[i][idx] is equal to '#'\n decrement k\n set s[i][idx] to 'O'\n if not k break\n end of the block\n increment idx\n end of the block\n for i=0 to 6 exclusive print s[i]\nend of the block","testcases":[[["9"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["20"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["30"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["5"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["0"],["+------------------------+","|#.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["1"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["2"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["3"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["4"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["6"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["7"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["8"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["10"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["11"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["12"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["13"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["14"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["15"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["16"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["17"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["18"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["19"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["21"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["22"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["23"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["24"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["25"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["26"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["27"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["28"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["29"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["31"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["32"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["33"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["34"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.O.|.|)","+------------------------+"]]]}} +{"instance_id":"pseudo_to_code_2k_28","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create integer k\n read k\n create string array str with size 6\n set str[0] to \"+------------------------+\"\n set str[1] to \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\"\n set str[2] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|\"\n set str[3] to \"|#.......................|\"\n set str[4] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n set str[5] to \"+------------------------+\"\n for j = 1 to 23 exclusive, increment j by 2\n for i = 1 to 5 exclusive\n if k is greater than 0\n if i is 3 and j is not 1, break current loop iteration\n set str[i][j] to 'O', decrement k\n end of the block\n end of the block\n end of the block\n for i = 0 to 6 exclusive, print str[i] print newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int k;\n cin >> k;\n string str[6];\n str[0] = \"+------------------------+\";\n str[1] = \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\";\n str[2] = \"|#.#.#.#.#.#.#.#.#.#.#.|.|\";\n str[3] = \"|#.......................|\";\n str[4] = \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n str[5] = \"+------------------------+\";\n for (int j = 1; j < 23; j += 2) {\n for (int i = 1; i < 5; i++) {\n if (k > 0) {\n if (i == 3 && j != 1) continue;\n str[i][j] = 'O', k--;\n }\n }\n }\n for (int i = 0; i < 6; i++) { cout << str[i] << endl; }\n return 0;\n}","item":{"problem_id":"475A","pseudocode":"define the main function\n create integer k\n read k\n create string array str with size 6\n set str[0] to \"+------------------------+\"\n set str[1] to \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\"\n set str[2] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|\"\n set str[3] to \"|#.......................|\"\n set str[4] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n set str[5] to \"+------------------------+\"\n for j = 1 to 23 exclusive, increment j by 2\n for i = 1 to 5 exclusive\n if k is greater than 0\n if i is 3 and j is not 1, break current loop iteration\n set str[i][j] to 'O', decrement k\n end of the block\n end of the block\n end of the block\n for i = 0 to 6 exclusive, print str[i] print newline\n return to indicate successful execution\nend of the block","testcases":[[["9"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["20"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["30"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["5"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["0"],["+------------------------+","|#.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["1"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["2"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["3"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["4"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["6"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["7"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["8"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["10"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["11"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["12"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["13"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["14"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["15"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["16"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["17"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["18"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["19"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["21"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["22"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["23"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["24"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["25"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["26"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["27"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["28"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["29"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["31"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["32"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["33"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["34"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.O.|.|)","+------------------------+"]]]}} +{"instance_id":"pseudo_to_code_2k_29","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nn, i, j, ans = long long with ans = 9999999999999 and a,db = two dimensional arrays of long longs with the sizes 201 and 201 each\ndefine the main function\n read n\n print \"+------------------------+\"\n if n is greater than 2\n decrement n\n print '|'\n for i = 1 to 11 inclusive\n if (n + 2) \/ 3 is greater or equal to i\n print \"O.\"\n else\n print \"#.\"\n end of the block\n print \"|D|)\"\n print '|'\n for i = 1 to 11 inclusive\n if (n + 1) \/ 3 is greater or equal to i\n print \"O.\"\n else\n print \"#.\"\n end of the block\n print \"|.|\"\n print \"|O.......................|\"\n print '|'\n for i = 1 to 11 inclusive\n if n \/ 3 is greater or equal to i\n print \"O.\"\n else\n print \"#.\"\n end of the block\n print \"|.|)\"\n else\n print '|'\n if n is greater than 0\n print \"O.\"\n else\n print \"#.\"\n print \"#.#.#.#.#.#.#.#.#.#.|D|)\"\n print '|'\n if n is greater than 1\n print \"O.\"\n else\n print \"#.\"\n print \"#.#.#.#.#.#.#.#.#.#.|.|\"\n print \"|#.......................|\"\n print \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n end of the block\n print \"+------------------------+\"\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long n, a[201][201], i, j, dp[201][201], ans = 9999999999999;\nint main() {\n cin >> n;\n cout << \"+------------------------+\" << endl;\n if (n >= 3) {\n n -= 1;\n cout << '|';\n for (i = 1; i <= 11; i++) {\n if ((n + 2) \/ 3 >= i)\n cout << \"O.\";\n else\n cout << \"#.\";\n }\n cout << \"|D|)\" << endl;\n cout << '|';\n for (i = 1; i <= 11; i++) {\n if ((n + 1) \/ 3 >= i)\n cout << \"O.\";\n else\n cout << \"#.\";\n }\n cout << \"|.|\" << endl;\n cout << \"|O.......................|\" << endl;\n cout << '|';\n for (i = 1; i <= 11; i++) {\n if (n \/ 3 >= i)\n cout << \"O.\";\n else\n cout << \"#.\";\n }\n cout << \"|.|)\" << endl;\n } else {\n cout << '|';\n if (n >= 1)\n cout << \"O.\";\n else\n cout << \"#.\";\n cout << \"#.#.#.#.#.#.#.#.#.#.|D|)\" << endl;\n cout << '|';\n if (n >= 2)\n cout << \"O.\";\n else\n cout << \"#.\";\n cout << \"#.#.#.#.#.#.#.#.#.#.|.|\" << endl;\n cout << \"|#.......................|\" << endl;\n cout << \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\" << endl;\n }\n cout << \"+------------------------+\" << endl;\n return 0;\n}","item":{"problem_id":"475A","pseudocode":"n, i, j, ans = long long with ans = 9999999999999 and a,db = two dimensional arrays of long longs with the sizes 201 and 201 each\ndefine the main function\n read n\n print \"+------------------------+\"\n if n is greater than 2\n decrement n\n print '|'\n for i = 1 to 11 inclusive\n if (n + 2) \/ 3 is greater or equal to i\n print \"O.\"\n else\n print \"#.\"\n end of the block\n print \"|D|)\"\n print '|'\n for i = 1 to 11 inclusive\n if (n + 1) \/ 3 is greater or equal to i\n print \"O.\"\n else\n print \"#.\"\n end of the block\n print \"|.|\"\n print \"|O.......................|\"\n print '|'\n for i = 1 to 11 inclusive\n if n \/ 3 is greater or equal to i\n print \"O.\"\n else\n print \"#.\"\n end of the block\n print \"|.|)\"\n else\n print '|'\n if n is greater than 0\n print \"O.\"\n else\n print \"#.\"\n print \"#.#.#.#.#.#.#.#.#.#.|D|)\"\n print '|'\n if n is greater than 1\n print \"O.\"\n else\n print \"#.\"\n print \"#.#.#.#.#.#.#.#.#.#.|.|\"\n print \"|#.......................|\"\n print \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n end of the block\n print \"+------------------------+\"\n return to indicate successful execution\nend of the block","testcases":[[["9"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["20"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["30"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["5"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["0"],["+------------------------+","|#.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["1"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["2"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["3"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["4"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["6"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["7"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["8"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["10"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["11"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["12"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["13"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["14"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["15"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["16"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["17"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["18"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["19"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["21"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["22"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["23"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["24"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["25"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["26"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["27"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["28"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["29"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["31"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["32"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["33"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["34"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.O.|.|)","+------------------------+"]]]}} +{"instance_id":"pseudo_to_code_2k_30","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare long long variable k\ncreate string array s with 8 elements\ndefine the main function\n set s[1] to \"+------------------------+\"\n set s[2] to \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\"\n set s[3] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|\"\n set s[4] to \"|#.......................|\"\n set s[5] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n change s[6] to \" +------------------------+\"\n read k\n loop j from 1 to 25 inclusive\n loop i from 2 to 5 inclusive\n break if k = 0\n if s[i][j] is '#', change s[i][j] to 'O' and decrement k by one\n end of the block\n break if k = 0\n end of the block\n for i from 1 to 6 inclusive, print s[i] and \"\\n\"\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long k;\nstring s[8];\nint main() {\n s[1] = \"+------------------------+\";\n s[2] = \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\";\n s[3] = \"|#.#.#.#.#.#.#.#.#.#.#.|.|\";\n s[4] = \"|#.......................|\";\n s[5] = \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\";\n s[6] = \"+------------------------+\";\n cin >> k;\n for (long long j = 1; j <= 25; j++) {\n for (long long i = 2; i <= 5; i++) {\n if (k == 0) break;\n if (s[i][j] == '#') s[i][j] = 'O', k--;\n }\n if (k == 0) break;\n }\n for (long long i = 1; i <= 6; i++) cout << s[i] << \"\\n\";\n return 0;\n}","item":{"problem_id":"475A","pseudocode":"declare long long variable k\ncreate string array s with 8 elements\ndefine the main function\n set s[1] to \"+------------------------+\"\n set s[2] to \"|#.#.#.#.#.#.#.#.#.#.#.|D|)\"\n set s[3] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|\"\n set s[4] to \"|#.......................|\"\n set s[5] to \"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n change s[6] to \" +------------------------+\"\n read k\n loop j from 1 to 25 inclusive\n loop i from 2 to 5 inclusive\n break if k = 0\n if s[i][j] is '#', change s[i][j] to 'O' and decrement k by one\n end of the block\n break if k = 0\n end of the block\n for i from 1 to 6 inclusive, print s[i] and \"\\n\"\n return to indicate successful execution\nend of the block","testcases":[[["9"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["20"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["30"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["5"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["0"],["+------------------------+","|#.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["1"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["2"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["3"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["4"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["6"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["7"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["8"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["10"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["11"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["12"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["13"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["14"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["15"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["16"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["17"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["18"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["19"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["21"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["22"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["23"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["24"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["25"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["26"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["27"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["28"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["29"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["31"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["32"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["33"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["34"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.O.|.|)","+------------------------+"]]]}} +{"instance_id":"pseudo_to_code_2k_31","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate int k\ncreate char matrix s of dimensions 4x11\ndefine the main function\n for i = 0 to 4 exclusive\n for j = 0 to 11 exclusive set s[i][j] to #\n set the elements of the second row of s to .\n read k\n for j=0 to 11 exclusive\n for i=0 to 4 exclusive\n if k is true and s[i][j] is #\n set s[i][j] to character O\n decrease k by 1\n end of the block\n print +------------------------+ and move to newline\n for i = 0 to 4 exclusive\n print |\n for j = 0 to 11 exclusive print s[i][j] and .\n if i is 0\n print |D|) and move to newline\n else if i is equal to 1\n print |.| and move to newline\n else if i is 2\n print ..| and move to newline\n else do the following\n print |.|) and move to newline\n end of the block\n print +------------------------+\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int k;\nchar s[4][11];\nint main() {\n for (int i = 0; i < 4; i++)\n for (int j = 0; j < 11; j++) s[i][j] = '#';\n for (int i = 1; i < 11; i++) s[2][i] = '.';\n cin >> k;\n for (int j = 0; j < 11; j++)\n for (int i = 0; i < 4; i++)\n if (k && s[i][j] == '#') {\n s[i][j] = 'O';\n k--;\n }\n cout << \"+------------------------+\\n\";\n for (int i = 0; i < 4; i++) {\n cout << '|';\n for (int j = 0; j < 11; j++) cout << s[i][j] << '.';\n if (i == 0)\n cout << \"|D|)\\n\";\n else if (i == 1)\n cout << \"|.|\\n\";\n else if (i == 2)\n cout << \"..|\\n\";\n else\n cout << \"|.|)\\n\";\n }\n cout << \"+------------------------+\\n\";\n return 0;\n}","item":{"problem_id":"475A","pseudocode":"create int k\ncreate char matrix s of dimensions 4x11\ndefine the main function\n for i = 0 to 4 exclusive\n for j = 0 to 11 exclusive set s[i][j] to #\n set the elements of the second row of s to .\n read k\n for j=0 to 11 exclusive\n for i=0 to 4 exclusive\n if k is true and s[i][j] is #\n set s[i][j] to character O\n decrease k by 1\n end of the block\n print +------------------------+ and move to newline\n for i = 0 to 4 exclusive\n print |\n for j = 0 to 11 exclusive print s[i][j] and .\n if i is 0\n print |D|) and move to newline\n else if i is equal to 1\n print |.| and move to newline\n else if i is 2\n print ..| and move to newline\n else do the following\n print |.|) and move to newline\n end of the block\n print +------------------------+\n return to indicate successful execution\nend of the block","testcases":[[["9"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["20"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["30"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["5"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["0"],["+------------------------+","|#.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["1"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|#.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["2"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|#.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["3"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|#.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["4"],["+------------------------+","|O.#.#.#.#.#.#.#.#.#.#.|D|)","|O.#.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["6"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.#.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["7"],["+------------------------+","|O.O.#.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["8"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.#.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.#.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["10"],["+------------------------+","|O.O.O.#.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["11"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.#.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["12"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.#.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["13"],["+------------------------+","|O.O.O.O.#.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["14"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.#.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["15"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.#.#.#.#.#.#.#.|.|)","+------------------------+"]],[["16"],["+------------------------+","|O.O.O.O.O.#.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["17"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.#.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["18"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.#.#.#.#.#.#.|.|)","+------------------------+"]],[["19"],["+------------------------+","|O.O.O.O.O.O.#.#.#.#.#.|D|)","|O.O.O.O.O.O.#.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["21"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.#.#.#.#.#.|.|)","+------------------------+"]],[["22"],["+------------------------+","|O.O.O.O.O.O.O.#.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["23"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.#.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["24"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.#.#.#.#.|.|)","+------------------------+"]],[["25"],["+------------------------+","|O.O.O.O.O.O.O.O.#.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["26"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.#.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["27"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.#.#.#.|.|)","+------------------------+"]],[["28"],["+------------------------+","|O.O.O.O.O.O.O.O.O.#.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["29"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.#.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.#.#.|.|)","+------------------------+"]],[["31"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.#.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["32"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.#.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["33"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.#.|.|)","+------------------------+"]],[["34"],["+------------------------+","|O.O.O.O.O.O.O.O.O.O.O.|D|)","|O.O.O.O.O.O.O.O.O.O.O.|.|","|O.......................|","|O.O.O.O.O.O.O.O.O.O.O.|.|)","+------------------------+"]]]}} +{"instance_id":"pseudo_to_code_2k_32","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nGrades = char array of size 200005\ndefine the main function\n let lfp, zp, n, i, t, last be integers with lfp = -1\n let carryFlag, pf be boolean with carryFlag = false, pf = false\n read n, t, Grades[1]\n for i = 1 to n inclusive\n if Grades[i] == '.'\n increment i\n break out of for loop\n end of the block\n end of the block\n while Grades[i] and t > 0\n if Grades[i] is greater than or equal to '5'\n set lfp to i\n break\n end of the block\n increment i\n end of the block\n while (-lfp) is not zero and t > 0 and pf is false\n if Grades[lfp - 1] == '.'\n set Grades[lfp - 1] to 0\n increment Grades[lfp - 2]\n update last to lfp - 2\n set pf to true\n else\n update Grades[lfp] to 0\n increment Grades[lfp - 1]\n update last to lfp - 1\n end of the block\n set lfp to -1\n decrement t\n if Grades[last] > '9'\n let c be integer with c = 1\n set Grades[last] to '0'\n decrement last\n while c is not zero\n set c to 0\n if Grades[last] == '.'\n set Grades[last] to '\\0'\n increment Grades[last - 1]\n decrement last by 2\n set pf to true\n else if last == '\\0'\n set carryFlag to true\n set Grades[0] to '1'\n break\n else\n increment Grades[last]\n end of the block\n if Grades[last] > '9'\n if not pf\n set Grades[last] to '\\0'\n else\n set Grades[last] to '0'\n decrement last\n set c to 1\n end of the block\n if Grades[last] >= '5', set lfp to last\n end of the block\n else if Grades[last] >= '5'\n set lfp to last\n end of the block\n end of the block\n if carryFlag is true\n print out first element of Grades\n else\n print out second element of Grades\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"char Grades[200005];\nint main() {\n int lfp = -1, zp, n, i, t, last;\n bool carryFlag = false, pf = false;\n cin >> n >> t >> (Grades + 1);\n for (i = 1; i <= n; ++i) {\n if (Grades[i] == '.') {\n ++i;\n break;\n }\n }\n while (Grades[i] && t > 0) {\n if (Grades[i] >= '5') {\n lfp = i;\n break;\n }\n ++i;\n }\n while ((~lfp) && t > 0 && !pf) {\n if (Grades[lfp - 1] == '.') {\n Grades[lfp - 1] = 0;\n Grades[lfp - 2]++;\n last = lfp - 2;\n pf = true;\n } else {\n Grades[lfp] = 0;\n Grades[lfp - 1]++;\n last = lfp - 1;\n }\n lfp = -1;\n t--;\n if (Grades[last] > '9') {\n int c = 1;\n Grades[last] = '0';\n last--;\n while (c) {\n c = 0;\n if (Grades[last] == '.') {\n Grades[last] = '\\0';\n Grades[last - 1]++;\n last -= 2;\n pf = true;\n } else if (last == '\\0') {\n carryFlag = true;\n Grades[0] = '1';\n break;\n } else {\n Grades[last]++;\n }\n if (Grades[last] > '9') {\n if (!pf)\n Grades[last] = '\\0';\n else\n Grades[last] = '0';\n last--;\n c = 1;\n }\n if (Grades[last] >= '5') lfp = last;\n }\n } else if (Grades[last] >= '5') {\n lfp = last;\n }\n }\n if (carryFlag)\n cout << Grades << endl;\n else\n cout << (Grades + 1) << endl;\n return 0;\n}","item":{"problem_id":"718A","pseudocode":"Grades = char array of size 200005\ndefine the main function\n let lfp, zp, n, i, t, last be integers with lfp = -1\n let carryFlag, pf be boolean with carryFlag = false, pf = false\n read n, t, Grades[1]\n for i = 1 to n inclusive\n if Grades[i] == '.'\n increment i\n break out of for loop\n end of the block\n end of the block\n while Grades[i] and t > 0\n if Grades[i] is greater than or equal to '5'\n set lfp to i\n break\n end of the block\n increment i\n end of the block\n while (-lfp) is not zero and t > 0 and pf is false\n if Grades[lfp - 1] == '.'\n set Grades[lfp - 1] to 0\n increment Grades[lfp - 2]\n update last to lfp - 2\n set pf to true\n else\n update Grades[lfp] to 0\n increment Grades[lfp - 1]\n update last to lfp - 1\n end of the block\n set lfp to -1\n decrement t\n if Grades[last] > '9'\n let c be integer with c = 1\n set Grades[last] to '0'\n decrement last\n while c is not zero\n set c to 0\n if Grades[last] == '.'\n set Grades[last] to '\\0'\n increment Grades[last - 1]\n decrement last by 2\n set pf to true\n else if last == '\\0'\n set carryFlag to true\n set Grades[0] to '1'\n break\n else\n increment Grades[last]\n end of the block\n if Grades[last] > '9'\n if not pf\n set Grades[last] to '\\0'\n else\n set Grades[last] to '0'\n decrement last\n set c to 1\n end of the block\n if Grades[last] >= '5', set lfp to last\n end of the block\n else if Grades[last] >= '5'\n set lfp to last\n end of the block\n end of the block\n if carryFlag is true\n print out first element of Grades\n else\n print out second element of Grades\n return to indicate successful execution\nend of the block","testcases":[[["6 1","10.245"],["10.25"]],[["6 2","10.245"],["10.3"]],[["3 100","9.2"],["9.2"]],[["12 5","872.04488525"],["872.1"]],[["35 8","984227318.2031144444444444494637612"],["984227318.2031144445"]],[["320 142","2704701300865535.432223312233434114130011113220102420131323010344144201124303144444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447444444444444444444444444444444615444444482101673308979557675074444444444444446867245414595534444693160202254444449544495367"],["2704701300865535.4322233122334341141300111132201024201313230103441442011243032"]],[["5 10","1.555"],["2"]],[["6 1","0.9454"],["1"]],[["7 1000000000","239.923"],["240"]],[["7 235562","999.999"],["1000"]],[["9 2","23999.448"],["23999.5"]],[["9 3","23999.448"],["24000"]],[["13 1","761.044449428"],["761.04445"]],[["3 1","0.1"],["0.1"]],[["3 1","9.9"],["10"]],[["3 1","0.9"],["1"]],[["31 15","2707786.24030444444444444724166"],["2707786.24031"]],[["4 100","99.9"],["100"]],[["3 10","9.9"],["10"]],[["22 100","11111111111111111111.5"],["11111111111111111112"]],[["3 1","9.5"],["10"]],[["8 100","9.444445"],["10"]],[["6 2","999.45"],["1000"]],[["3 100","9.9"],["10"]],[["18 100","9.4444444444454444"],["10"]],[["16 999","9595959.95959595"],["9595960"]],[["4 100","99.5"],["100"]],[["5 1","999.9"],["1000"]],[["4 1","5.59"],["6"]],[["4 1","99.5"],["100"]],[["4 1","99.9"],["100"]],[["18 6","102345678999.44449"],["102345679000"]],[["3 3","9.9"],["10"]],[["5 1","99.99"],["100"]],[["7 1","99999.9"],["100000"]],[["3 121","9.9"],["10"]],[["8 6","9.444445"],["10"]],[["3 100","8.9"],["9"]],[["10 1","999.999999"],["1000"]],[["5 100","6.666"],["7"]],[["4 100","9.99"],["10"]],[["6 1","9.9999"],["10"]],[["4 10","99.9"],["100"]],[["5 1","9.999"],["10"]],[["3 1231","9.9"],["10"]],[["5 2","999.9"],["1000"]],[["5 100","144.5"],["145"]],[["5 100","99.45"],["100"]],[["10 1","0.50444445"],["1"]],[["7 1","1.51111"],["2"]],[["5 1","199.9"],["200"]],[["3 100","9.5"],["10"]],[["7 1000","409.659"],["410"]],[["4 10","99.5"],["100"]],[["4 10","10.9"],["11"]],[["4 1","19.5"],["20"]]]}} +{"instance_id":"pseudo_to_code_2k_33","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nGrades = char array of size 200005\ndefine the main function\n let lfp, zp, n, i, t, last be integers with lfp = -1\n let carryFlag, pf be boolean with carryFlag = false, pf = false\n read n, t, Grades[1]\n for i = 1 to n inclusive\n if Grades[i] == '.'\n increment i\n break out of for loop\n end of the block\n end of the block\n while Grades[i] and t > 0\n if Grades[i] is greater than or equal to '5'\n set lfp to i\n break\n end of the block\n increment i\n end of the block\n while (-lfp) is not zero and t > 0 and pf is false\n if Grades[lfp - 1] == '.'\n set Grades[lfp - 1] to 0\n increment Grades[lfp - 2]\n update last to lfp - 2\n set pf to true\n else\n update Grades[lfp] to 0\n increment Grades[lfp - 1]\n update last to lfp - 1\n end of the block\n set lfp to -1\n decrement t\n if Grades[last] > '9'\n let c be integer with c = 1\n set Grades[last] to '0'\n decrement last\n while c is not zero\n set c to 0\n if Grades[last] == '.'\n set Grades[last] to '\\0'\n increment Grades[last - 1]\n decrement last by 2\n set pf to true\n else if last == '\\0'\n set carryFlag to true\n set Grades[0] to '1'\n break\n else\n increment Grades[last]\n end of the block\n if Grades[last] > '9'\n if not pf\n set Grades[last] to '\\0'\n else\n set Grades[last] to '0'\n decrement last\n set c to 1\n end of the block\n if Grades[last] >= '5', set lfp to last\n end of the block\n else if Grades[last] >= '5'\n set lfp to last\n end of the block\n end of the block\n if carryFlag is true\n print out first element of Grades\n else\n print out second element of Grades\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"char Grades[200005];\nint main() {\n int lfp = -1, zp, n, i, t, last;\n bool carryFlag = false, pf = false;\n cin >> n >> t >> (Grades + 1);\n for (i = 1; i <= n; ++i) {\n if (Grades[i] == '.') {\n ++i;\n break;\n }\n }\n while (Grades[i] && t > 0) {\n if (Grades[i] >= '5') {\n lfp = i;\n break;\n }\n ++i;\n }\n while ((~lfp) && t > 0 && !pf) {\n if (Grades[lfp - 1] == '.') {\n Grades[lfp - 1] = 0;\n Grades[lfp - 2]++;\n last = lfp - 2;\n pf = true;\n } else {\n Grades[lfp] = 0;\n Grades[lfp - 1]++;\n last = lfp - 1;\n }\n lfp = -1;\n t--;\n if (Grades[last] > '9') {\n int c = 1;\n Grades[last] = '0';\n last--;\n while (c) {\n c = 0;\n if (Grades[last] == '.') {\n Grades[last] = '\\0';\n Grades[last - 1]++;\n last -= 2;\n pf = true;\n } else if (last == '\\0') {\n carryFlag = true;\n Grades[0] = '1';\n break;\n } else {\n Grades[last]++;\n }\n if (Grades[last] > '9') {\n if (!pf)\n Grades[last] = '\\0';\n else\n Grades[last] = '0';\n last--;\n c = 1;\n }\n if (Grades[last] >= '5') lfp = last;\n }\n } else if (Grades[last] >= '5') {\n lfp = last;\n }\n }\n if (carryFlag)\n cout << Grades << endl;\n else\n cout << (Grades + 1) << endl;\n return 0;\n}","item":{"problem_id":"718A","pseudocode":"Grades = char array of size 200005\ndefine the main function\n let lfp, zp, n, i, t, last be integers with lfp = -1\n let carryFlag, pf be boolean with carryFlag = false, pf = false\n read n, t, Grades[1]\n for i = 1 to n inclusive\n if Grades[i] == '.'\n increment i\n break out of for loop\n end of the block\n end of the block\n while Grades[i] and t > 0\n if Grades[i] is greater than or equal to '5'\n set lfp to i\n break\n end of the block\n increment i\n end of the block\n while (-lfp) is not zero and t > 0 and pf is false\n if Grades[lfp - 1] == '.'\n set Grades[lfp - 1] to 0\n increment Grades[lfp - 2]\n update last to lfp - 2\n set pf to true\n else\n update Grades[lfp] to 0\n increment Grades[lfp - 1]\n update last to lfp - 1\n end of the block\n set lfp to -1\n decrement t\n if Grades[last] > '9'\n let c be integer with c = 1\n set Grades[last] to '0'\n decrement last\n while c is not zero\n set c to 0\n if Grades[last] == '.'\n set Grades[last] to '\\0'\n increment Grades[last - 1]\n decrement last by 2\n set pf to true\n else if last == '\\0'\n set carryFlag to true\n set Grades[0] to '1'\n break\n else\n increment Grades[last]\n end of the block\n if Grades[last] > '9'\n if not pf\n set Grades[last] to '\\0'\n else\n set Grades[last] to '0'\n decrement last\n set c to 1\n end of the block\n if Grades[last] >= '5', set lfp to last\n end of the block\n else if Grades[last] >= '5'\n set lfp to last\n end of the block\n end of the block\n if carryFlag is true\n print out first element of Grades\n else\n print out second element of Grades\n return to indicate successful execution\nend of the block","testcases":[[["6 1","10.245"],["10.25"]],[["6 2","10.245"],["10.3"]],[["3 100","9.2"],["9.2"]],[["12 5","872.04488525"],["872.1"]],[["35 8","984227318.2031144444444444494637612"],["984227318.2031144445"]],[["320 142","2704701300865535.432223312233434114130011113220102420131323010344144201124303144444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447444444444444444444444444444444615444444482101673308979557675074444444444444446867245414595534444693160202254444449544495367"],["2704701300865535.4322233122334341141300111132201024201313230103441442011243032"]],[["5 10","1.555"],["2"]],[["6 1","0.9454"],["1"]],[["7 1000000000","239.923"],["240"]],[["7 235562","999.999"],["1000"]],[["9 2","23999.448"],["23999.5"]],[["9 3","23999.448"],["24000"]],[["13 1","761.044449428"],["761.04445"]],[["3 1","0.1"],["0.1"]],[["3 1","9.9"],["10"]],[["3 1","0.9"],["1"]],[["31 15","2707786.24030444444444444724166"],["2707786.24031"]],[["4 100","99.9"],["100"]],[["3 10","9.9"],["10"]],[["22 100","11111111111111111111.5"],["11111111111111111112"]],[["3 1","9.5"],["10"]],[["8 100","9.444445"],["10"]],[["6 2","999.45"],["1000"]],[["3 100","9.9"],["10"]],[["18 100","9.4444444444454444"],["10"]],[["16 999","9595959.95959595"],["9595960"]],[["4 100","99.5"],["100"]],[["5 1","999.9"],["1000"]],[["4 1","5.59"],["6"]],[["4 1","99.5"],["100"]],[["4 1","99.9"],["100"]],[["18 6","102345678999.44449"],["102345679000"]],[["3 3","9.9"],["10"]],[["5 1","99.99"],["100"]],[["7 1","99999.9"],["100000"]],[["3 121","9.9"],["10"]],[["8 6","9.444445"],["10"]],[["3 100","8.9"],["9"]],[["10 1","999.999999"],["1000"]],[["5 100","6.666"],["7"]],[["4 100","9.99"],["10"]],[["6 1","9.9999"],["10"]],[["4 10","99.9"],["100"]],[["5 1","9.999"],["10"]],[["3 1231","9.9"],["10"]],[["5 2","999.9"],["1000"]],[["5 100","144.5"],["145"]],[["5 100","99.45"],["100"]],[["10 1","0.50444445"],["1"]],[["7 1","1.51111"],["2"]],[["5 1","199.9"],["200"]],[["3 100","9.5"],["10"]],[["7 1000","409.659"],["410"]],[["4 10","99.5"],["100"]],[["4 10","10.9"],["11"]],[["4 1","19.5"],["20"]]]}} +{"instance_id":"pseudo_to_code_2k_34","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n declare ints n and t\n read user input to n and t\n new string variable s\n read variable s from the input\n define new integer called pointPos = -1\n declare integer variable with name start = -1\n start for loop from i = 0 to length of s exclusive incrementing i\n if pointPos != -1 and s[i] - '0' >= 5\n set start to i\n break\n end of the block\n if s[i] is equal to '.', set the value of pointPos to i\n end of the block\n if start != - 1\n define new boolean called next with value true\n while start > pointPos and next and t > 0\n if start - pointPos is equal to 1\n create integer variable nextVal = s[start - 2] - '0' + 1\n if nextVal is equal to 10\n set the value of s[start - 2] to '0'\n else\n assign nextVal + '0' to s[start - 2]\n set the value of next to false\n end of the block\n else\n create integer variable nextVal with value s[start-1] - '0' + 1\n if nextVal < 5 or t - 1 = 0, assign false to next\n assign the new value = nextVal + '0' to s[start - 1]\n end of the block\n decrement start\n decrement t\n end of the block\n remove elements from the start + 1 to the end of s\n if *(--s.end()) == '.', remove last element of s\n change start to pointPos - 1\n while next and start >= 0\n if start is equal to 0\n insert '0' to the start of s\n set start to 1\n end of the block\n declare integer variable with name nextVal and value s[start-1] - '0' + 1\n if nextVal is equal to 10\n assign '0' to s[start - 1]\n else\n assign the new value = nextVal + '0' to s[start - 1]\n set next to false\n end of the block\n decrement start\n end of the block\n end of the block\n print s to the standard output\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int n, t;\n cin >> n >> t;\n string s;\n cin >> s;\n int pointPos = -1;\n int start = -1;\n for (int i = 0; i < s.size(); i++) {\n if (pointPos != -1 && s[i] - '0' >= 5) {\n start = i;\n break;\n };\n if (s[i] == '.') pointPos = i;\n }\n if (start != -1) {\n bool next = true;\n while (start > pointPos && next && t > 0) {\n if (start - pointPos == 1) {\n int nextVal = s[start - 2] - '0' + 1;\n if (nextVal == 10)\n s[start - 2] = '0';\n else {\n s[start - 2] = nextVal + '0';\n next = false;\n }\n } else {\n int nextVal = s[start - 1] - '0' + 1;\n if (nextVal < 5 || t - 1 == 0) next = false;\n s[start - 1] = nextVal + '0';\n }\n --start;\n --t;\n }\n s.erase(s.begin() + start + 1, s.end());\n if (*(--s.end()) == '.') s.erase(--s.end());\n start = pointPos - 1;\n while (next && start >= 0) {\n if (start == 0) {\n s.insert(s.begin(), '0');\n start = 1;\n }\n int nextVal = s[start - 1] - '0' + 1;\n if (nextVal == 10)\n s[start - 1] = '0';\n else {\n s[start - 1] = nextVal + '0';\n next = false;\n }\n --start;\n }\n }\n cout << s << endl;\n return 0;\n}","item":{"problem_id":"718A","pseudocode":"define the main function\n declare ints n and t\n read user input to n and t\n new string variable s\n read variable s from the input\n define new integer called pointPos = -1\n declare integer variable with name start = -1\n start for loop from i = 0 to length of s exclusive incrementing i\n if pointPos != -1 and s[i] - '0' >= 5\n set start to i\n break\n end of the block\n if s[i] is equal to '.', set the value of pointPos to i\n end of the block\n if start != - 1\n define new boolean called next with value true\n while start > pointPos and next and t > 0\n if start - pointPos is equal to 1\n create integer variable nextVal = s[start - 2] - '0' + 1\n if nextVal is equal to 10\n set the value of s[start - 2] to '0'\n else\n assign nextVal + '0' to s[start - 2]\n set the value of next to false\n end of the block\n else\n create integer variable nextVal with value s[start-1] - '0' + 1\n if nextVal < 5 or t - 1 = 0, assign false to next\n assign the new value = nextVal + '0' to s[start - 1]\n end of the block\n decrement start\n decrement t\n end of the block\n remove elements from the start + 1 to the end of s\n if *(--s.end()) == '.', remove last element of s\n change start to pointPos - 1\n while next and start >= 0\n if start is equal to 0\n insert '0' to the start of s\n set start to 1\n end of the block\n declare integer variable with name nextVal and value s[start-1] - '0' + 1\n if nextVal is equal to 10\n assign '0' to s[start - 1]\n else\n assign the new value = nextVal + '0' to s[start - 1]\n set next to false\n end of the block\n decrement start\n end of the block\n end of the block\n print s to the standard output\n return to indicate successful execution\nend of the block","testcases":[[["6 1","10.245"],["10.25"]],[["6 2","10.245"],["10.3"]],[["3 100","9.2"],["9.2"]],[["12 5","872.04488525"],["872.1"]],[["35 8","984227318.2031144444444444494637612"],["984227318.2031144445"]],[["320 142","2704701300865535.432223312233434114130011113220102420131323010344144201124303144444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447444444444444444444444444444444615444444482101673308979557675074444444444444446867245414595534444693160202254444449544495367"],["2704701300865535.4322233122334341141300111132201024201313230103441442011243032"]],[["5 10","1.555"],["2"]],[["6 1","0.9454"],["1"]],[["7 1000000000","239.923"],["240"]],[["7 235562","999.999"],["1000"]],[["9 2","23999.448"],["23999.5"]],[["9 3","23999.448"],["24000"]],[["13 1","761.044449428"],["761.04445"]],[["3 1","0.1"],["0.1"]],[["3 1","9.9"],["10"]],[["3 1","0.9"],["1"]],[["31 15","2707786.24030444444444444724166"],["2707786.24031"]],[["4 100","99.9"],["100"]],[["3 10","9.9"],["10"]],[["22 100","11111111111111111111.5"],["11111111111111111112"]],[["3 1","9.5"],["10"]],[["8 100","9.444445"],["10"]],[["6 2","999.45"],["1000"]],[["3 100","9.9"],["10"]],[["18 100","9.4444444444454444"],["10"]],[["16 999","9595959.95959595"],["9595960"]],[["4 100","99.5"],["100"]],[["5 1","999.9"],["1000"]],[["4 1","5.59"],["6"]],[["4 1","99.5"],["100"]],[["4 1","99.9"],["100"]],[["18 6","102345678999.44449"],["102345679000"]],[["3 3","9.9"],["10"]],[["5 1","99.99"],["100"]],[["7 1","99999.9"],["100000"]],[["3 121","9.9"],["10"]],[["8 6","9.444445"],["10"]],[["3 100","8.9"],["9"]],[["10 1","999.999999"],["1000"]],[["5 100","6.666"],["7"]],[["4 100","9.99"],["10"]],[["6 1","9.9999"],["10"]],[["4 10","99.9"],["100"]],[["5 1","9.999"],["10"]],[["3 1231","9.9"],["10"]],[["5 2","999.9"],["1000"]],[["5 100","144.5"],["145"]],[["5 100","99.45"],["100"]],[["10 1","0.50444445"],["1"]],[["7 1","1.51111"],["2"]],[["5 1","199.9"],["200"]],[["3 100","9.5"],["10"]],[["7 1000","409.659"],["410"]],[["4 10","99.5"],["100"]],[["4 10","10.9"],["11"]],[["4 1","19.5"],["20"]]]}} +{"instance_id":"pseudo_to_code_2k_35","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n make ints n and t\n read n and t\n create string s\n read s\n make integer i = 0\n while i is less than n and s[i] is not equal to '.', increment i\n if i is not equal to n and t is greater than 0\n make integer p = i\n increment i\n while i is less than n and s[i] is less than '5', add 1 to i\n if i is not equal to n\n set s to s.substr(0, i)\n subtract 1 from i\n add 1 to s[i]\n take away 1 from t\n decrease i by 1\n while i is greater than p, s[i + 1] is more than '4', and t is greater than 0\n increment s[i]\n set s[i + 1] to '0'\n decrease t by 1\n decrease i by 1\n end of the block\n if s[i + 1] is equal to '\/'\n set s to s.substr(0, i + 1)\n while i is greater than or equal to 0 and s[i] is equal to '9'\n set s[i] to '0'\n decrease i by 1\n end of the block\n if i is not equal to -1\n increment s[i]\n else\n output 1\n end of the block\n else if i is equal to p, s[p + 1] is greater than '4', and t is greater than 0\n take away 1 from t\n set s to s.substr(0, i)\n decrease i by 1\n while i is greater than or equal to 0 and s[i] is equal to '9'\n set s[i] to '0'\n reduce i by 1\n end of the block\n if i not equal to -1\n increment s[i] by 1\n else do\n print 1\n end of the block\n otherwise\n set s to s.substr(0, i + 2)\n end of the block\n end of the block\n end of the block\n print s\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int n, t;\n cin >> n >> t;\n string s;\n cin >> s;\n int i = 0;\n while (i < n && s[i] != '.') { i++; }\n if (i != n && t > 0) {\n int p = i;\n i++;\n while (i < n && s[i] < '5') { i++; }\n if (i != n) {\n s = s.substr(0, i);\n i--;\n s[i]++;\n t--;\n i--;\n while (i > p && s[i + 1] > '4' && t > 0) {\n s[i]++;\n s[i + 1] = '0';\n t--;\n i--;\n }\n if (s[i + 1] == '\/') {\n s = s.substr(0, i + 1);\n while (i >= 0 && s[i] == '9') {\n s[i] = '0';\n i--;\n }\n if (i != -1) {\n s[i]++;\n } else {\n cout << 1;\n }\n } else if (i == p && s[p + 1] > '4' && t > 0) {\n t--;\n s = s.substr(0, i);\n i--;\n while (i >= 0 && s[i] == '9') {\n s[i] = '0';\n i--;\n }\n if (i != -1) {\n s[i]++;\n } else {\n cout << 1;\n }\n } else {\n s = s.substr(0, i + 2);\n }\n }\n }\n cout << s << '\\n';\n}","item":{"problem_id":"718A","pseudocode":"define the main function\n make ints n and t\n read n and t\n create string s\n read s\n make integer i = 0\n while i is less than n and s[i] is not equal to '.', increment i\n if i is not equal to n and t is greater than 0\n make integer p = i\n increment i\n while i is less than n and s[i] is less than '5', add 1 to i\n if i is not equal to n\n set s to s.substr(0, i)\n subtract 1 from i\n add 1 to s[i]\n take away 1 from t\n decrease i by 1\n while i is greater than p, s[i + 1] is more than '4', and t is greater than 0\n increment s[i]\n set s[i + 1] to '0'\n decrease t by 1\n decrease i by 1\n end of the block\n if s[i + 1] is equal to '\/'\n set s to s.substr(0, i + 1)\n while i is greater than or equal to 0 and s[i] is equal to '9'\n set s[i] to '0'\n decrease i by 1\n end of the block\n if i is not equal to -1\n increment s[i]\n else\n output 1\n end of the block\n else if i is equal to p, s[p + 1] is greater than '4', and t is greater than 0\n take away 1 from t\n set s to s.substr(0, i)\n decrease i by 1\n while i is greater than or equal to 0 and s[i] is equal to '9'\n set s[i] to '0'\n reduce i by 1\n end of the block\n if i not equal to -1\n increment s[i] by 1\n else do\n print 1\n end of the block\n otherwise\n set s to s.substr(0, i + 2)\n end of the block\n end of the block\n end of the block\n print s\nend of the block","testcases":[[["6 1","10.245"],["10.25"]],[["6 2","10.245"],["10.3"]],[["3 100","9.2"],["9.2"]],[["12 5","872.04488525"],["872.1"]],[["35 8","984227318.2031144444444444494637612"],["984227318.2031144445"]],[["320 142","2704701300865535.432223312233434114130011113220102420131323010344144201124303144444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447444444444444444444444444444444615444444482101673308979557675074444444444444446867245414595534444693160202254444449544495367"],["2704701300865535.4322233122334341141300111132201024201313230103441442011243032"]],[["5 10","1.555"],["2"]],[["6 1","0.9454"],["1"]],[["7 1000000000","239.923"],["240"]],[["7 235562","999.999"],["1000"]],[["9 2","23999.448"],["23999.5"]],[["9 3","23999.448"],["24000"]],[["13 1","761.044449428"],["761.04445"]],[["3 1","0.1"],["0.1"]],[["3 1","9.9"],["10"]],[["3 1","0.9"],["1"]],[["31 15","2707786.24030444444444444724166"],["2707786.24031"]],[["4 100","99.9"],["100"]],[["3 10","9.9"],["10"]],[["22 100","11111111111111111111.5"],["11111111111111111112"]],[["3 1","9.5"],["10"]],[["8 100","9.444445"],["10"]],[["6 2","999.45"],["1000"]],[["3 100","9.9"],["10"]],[["18 100","9.4444444444454444"],["10"]],[["16 999","9595959.95959595"],["9595960"]],[["4 100","99.5"],["100"]],[["5 1","999.9"],["1000"]],[["4 1","5.59"],["6"]],[["4 1","99.5"],["100"]],[["4 1","99.9"],["100"]],[["18 6","102345678999.44449"],["102345679000"]],[["3 3","9.9"],["10"]],[["5 1","99.99"],["100"]],[["7 1","99999.9"],["100000"]],[["3 121","9.9"],["10"]],[["8 6","9.444445"],["10"]],[["3 100","8.9"],["9"]],[["10 1","999.999999"],["1000"]],[["5 100","6.666"],["7"]],[["4 100","9.99"],["10"]],[["6 1","9.9999"],["10"]],[["4 10","99.9"],["100"]],[["5 1","9.999"],["10"]],[["3 1231","9.9"],["10"]],[["5 2","999.9"],["1000"]],[["5 100","144.5"],["145"]],[["5 100","99.45"],["100"]],[["10 1","0.50444445"],["1"]],[["7 1","1.51111"],["2"]],[["5 1","199.9"],["200"]],[["3 100","9.5"],["10"]],[["7 1000","409.659"],["410"]],[["4 10","99.5"],["100"]],[["4 10","10.9"],["11"]],[["4 1","19.5"],["20"]]]}} +{"instance_id":"pseudo_to_code_2k_36","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare integer array tab size 55 by 55\ndeclare integer array vis size 55 by 55\ndeclare integers n, m\ndeclare czysc with no arguments, returning void\n for i = 1 to n inclusive\n for j = 1 to m inclusive, let vis[i][j] be 0\n end of the block\n return from function\nend of the block\ndeclare dfs with integers i, j as arguments, returning void\n let vis[i][j] be 1\n if tab[i+1][j] is 1 and vis[i+1][j] is 0, run dfs(i+1 and j)\n if tab[i-1][j] is 1 and vis[i-1][j] is 0, run dfs(i-1, j)\n if tab[i][j+1] is 1 and vis[i][j+1] is 0, run dfs with i, j + 1 as arguments\n if tab[i][j-1] is 1 and vis[i][j-1] is 0, run dfs(i,j-1)\n return from function\nend of the block\ndefine the main function\n declare character c\n read n, m\n declare integers licz = 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n read c\n if c is '#'\n let tab[i][j] be 1\n increment licz\n end of the block\n end of the block\n end of the block\n if licz is less than 3\n print \"-1\" and newline\n return to indicate successful execution\n end of the block\n declare integers wynik = 5\n declare integer akt\n declare integer odw\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if tab[i][j] is 1\n let akt be 0\n let akt be tab[i + 1][j] + tab[i - 1][j] + tab[i][j + 1] + tab[i][j - 1]\n if akt is 1\n print \"1\" and newline\n return to indicate successful execution\n else\n run czysc\n let tab[i][j] be 0\n if tab[i+1][j] is 1\n run dfs with i + 1, j as arguments\n else\n if tab[i-1][j] is 1\n run dfs(i-1,j)\n else\n run dfs(i,j+1)\n end of the block\n end of the block\n let tab[i][j] be 1\n end of the block\n let odw be vis[i + 1][j] + vis[i - 1][j] + vis[i][j + 1] + vis[i][j - 1]\n if odw is less than akt\n print \"1\" and newline\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n end of the block\n print \"2\" and newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int tab[55][55];\nint vis[55][55];\nint n, m;\nvoid czysc() {\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) { vis[i][j] = 0; }\n }\n return;\n}\nvoid dfs(int i, int j) {\n vis[i][j] = 1;\n if (tab[i + 1][j] == 1 && vis[i + 1][j] == 0) { dfs(i + 1, j); }\n if (tab[i - 1][j] == 1 && vis[i - 1][j] == 0) { dfs(i - 1, j); }\n if (tab[i][j + 1] == 1 && vis[i][j + 1] == 0) { dfs(i, j + 1); }\n if (tab[i][j - 1] == 1 && vis[i][j - 1] == 0) { dfs(i, j - 1); }\n return;\n}\nint main() {\n char c;\n cin >> n >> m;\n int licz = 0;\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n cin >> c;\n if (c == '#') {\n tab[i][j] = 1;\n licz++;\n }\n }\n }\n if (licz < 3) {\n cout << \"-1\" << endl;\n return 0;\n }\n int wynik = 5;\n int akt;\n int odw;\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n if (tab[i][j] == 1) {\n akt = 0;\n akt = tab[i + 1][j] + tab[i - 1][j] + tab[i][j + 1] + tab[i][j - 1];\n if (akt == 1) {\n cout << \"1\" << endl;\n return 0;\n } else {\n czysc();\n tab[i][j] = 0;\n if (tab[i + 1][j] == 1) {\n dfs(i + 1, j);\n } else {\n if (tab[i - 1][j] == 1) {\n dfs(i - 1, j);\n } else {\n dfs(i, j + 1);\n }\n }\n tab[i][j] = 1;\n }\n odw = vis[i + 1][j] + vis[i - 1][j] + vis[i][j + 1] + vis[i][j - 1];\n if (odw < akt) {\n cout << \"1\" << endl;\n return 0;\n }\n }\n }\n }\n cout << \"2\" << endl;\n return 0;\n}","item":{"problem_id":"193A","pseudocode":"declare integer array tab size 55 by 55\ndeclare integer array vis size 55 by 55\ndeclare integers n, m\ndeclare czysc with no arguments, returning void\n for i = 1 to n inclusive\n for j = 1 to m inclusive, let vis[i][j] be 0\n end of the block\n return from function\nend of the block\ndeclare dfs with integers i, j as arguments, returning void\n let vis[i][j] be 1\n if tab[i+1][j] is 1 and vis[i+1][j] is 0, run dfs(i+1 and j)\n if tab[i-1][j] is 1 and vis[i-1][j] is 0, run dfs(i-1, j)\n if tab[i][j+1] is 1 and vis[i][j+1] is 0, run dfs with i, j + 1 as arguments\n if tab[i][j-1] is 1 and vis[i][j-1] is 0, run dfs(i,j-1)\n return from function\nend of the block\ndefine the main function\n declare character c\n read n, m\n declare integers licz = 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n read c\n if c is '#'\n let tab[i][j] be 1\n increment licz\n end of the block\n end of the block\n end of the block\n if licz is less than 3\n print \"-1\" and newline\n return to indicate successful execution\n end of the block\n declare integers wynik = 5\n declare integer akt\n declare integer odw\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if tab[i][j] is 1\n let akt be 0\n let akt be tab[i + 1][j] + tab[i - 1][j] + tab[i][j + 1] + tab[i][j - 1]\n if akt is 1\n print \"1\" and newline\n return to indicate successful execution\n else\n run czysc\n let tab[i][j] be 0\n if tab[i+1][j] is 1\n run dfs with i + 1, j as arguments\n else\n if tab[i-1][j] is 1\n run dfs(i-1,j)\n else\n run dfs(i,j+1)\n end of the block\n end of the block\n let tab[i][j] be 1\n end of the block\n let odw be vis[i + 1][j] + vis[i - 1][j] + vis[i][j + 1] + vis[i][j - 1]\n if odw is less than akt\n print \"1\" and newline\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n end of the block\n print \"2\" and newline\n return to indicate successful execution\nend of the block","testcases":[[["5 4","####","#..#","#..#","#..#","####"],["2"]],[["5 5","#####","#...#","#####","#...#","#####"],["2"]],[["1 10",".########."],["1"]],[["1 1","#"],["-1"]],[["3 3",".#.","###",".#."],["1"]],[["1 2","##"],["-1"]],[["2 1","#","#"],["-1"]],[["3 3","###","#.#","###"],["2"]],[["2 2","##","#."],["1"]],[["2 2","##","##"],["2"]],[["2 2",".#","##"],["1"]],[["2 2",".#",".#"],["-1"]],[["9 9","#########","#.......#","#.#####.#","#.#.#.#.#","#.#.#.#.#","#.#.#.#.#","#.#####.#","#...#...#","#########"],["1"]],[["50 1","#","#","#","#",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".","."],["1"]],[["3 50","....##############################################","....#.......#...#..#....#..............#.........#","....##############################################"],["2"]],[["2 2","##",".."],["-1"]],[["5 5","#####","#####","#....","#####","#####"],["1"]],[["3 5","##.##","#####","##.##"],["1"]],[["4 4","####","####","####","####"],["2"]],[["5 7",".#####.",".#...#.","###.###","#.#.#.#","###.###"],["1"]],[["2 5","#####","##.##"],["1"]],[["6 2","##","##","#.","##","##","##"],["1"]],[["2 5","##.##","#####"],["1"]],[["5 5","#####","#####","##.##","##.##","##.##"],["2"]],[["5 3","###","###",".#.","###","###"],["1"]],[["5 5","###..","###..","#..##","#####","#####"],["1"]]]}} +{"instance_id":"pseudo_to_code_2k_37","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndata=array of 51 by 51 char\nvisited=array of 51 by 51 bool\ndr=array of 4 int filled with 0,0,1,-1\ndc=array of 4 int filled with 1,-1,0,0\nfunction Counter (get int i and j, return int)\n if visited[i][j] return 0\n visited[i][j]=true\n ans=0\n if data[i][j] is '#'\n increment ans\n for x=0 to 4 exclusive add Counter(i+dr[x],j+dc[x]) to ans\n end of the block\n return ans\nend of the block\ndefine the main function\n n,m=int\n read n,m\n Total=0\n start=pair of int, int\n for i=0 to n exclusive\n for j=o to m exclusive\n read data[i][j]\n if data[i][j] is '#' increment Total, start=i,j\n end of the block\n end of the block\n fill visited with false\n t=Counter(first item of start, second item of start)\n if t < Total\n print 0\n return to indicate successful execution\n else if Total < 3\n print -1\n return to indicate successful execution\n else\n ans=0\n for i=0 to n exclusive\n for j=0 to m exclusive\n if data[i][j] is '#'\n if i is 6 and j is 5 r=1\n fill visited with false\n visited[i][j]=true\n x,y=int\n for k=0 to 4 exclusive\n if data[i+dr[k]][j+dc[k]] is '#'\n x=i+dr[k]\n y=j+dc[k]\n break\n end of the block\n end of the block\n t=Counter(x,y)\n if t> n >> m;\n int Total = 0;\n pair start;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n cin >> data[i][j];\n if (data[i][j] == '#') Total++, start = pair(i, j);\n }\n }\n memset(visited, false, sizeof visited);\n int t = Counter(start.first, start.second);\n if (t < Total) {\n cout << 0 << endl;\n return 0;\n } else if (Total < 3) {\n cout << -1 << endl;\n return 0;\n } else {\n int ans = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if (data[i][j] == '#') {\n if (i == 6 && j == 5) { int r = 1; }\n memset(visited, false, sizeof visited);\n visited[i][j] = true;\n int x, y;\n for (int k = 0; k < 4; k++) {\n if (data[i + dr[k]][j + dc[k]] == '#') {\n x = i + dr[k];\n y = j + dc[k];\n break;\n }\n }\n int t = Counter(x, y);\n if (t < Total - 1) {\n cout << \"1\" << endl;\n return 0;\n }\n }\n }\n }\n }\n cout << 2 << endl;\n return 0;\n}","item":{"problem_id":"193A","pseudocode":"data=array of 51 by 51 char\nvisited=array of 51 by 51 bool\ndr=array of 4 int filled with 0,0,1,-1\ndc=array of 4 int filled with 1,-1,0,0\nfunction Counter (get int i and j, return int)\n if visited[i][j] return 0\n visited[i][j]=true\n ans=0\n if data[i][j] is '#'\n increment ans\n for x=0 to 4 exclusive add Counter(i+dr[x],j+dc[x]) to ans\n end of the block\n return ans\nend of the block\ndefine the main function\n n,m=int\n read n,m\n Total=0\n start=pair of int, int\n for i=0 to n exclusive\n for j=o to m exclusive\n read data[i][j]\n if data[i][j] is '#' increment Total, start=i,j\n end of the block\n end of the block\n fill visited with false\n t=Counter(first item of start, second item of start)\n if t < Total\n print 0\n return to indicate successful execution\n else if Total < 3\n print -1\n return to indicate successful execution\n else\n ans=0\n for i=0 to n exclusive\n for j=0 to m exclusive\n if data[i][j] is '#'\n if i is 6 and j is 5 r=1\n fill visited with false\n visited[i][j]=true\n x,y=int\n for k=0 to 4 exclusive\n if data[i+dr[k]][j+dc[k]] is '#'\n x=i+dr[k]\n y=j+dc[k]\n break\n end of the block\n end of the block\n t=Counter(x,y)\n if t\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate constant integer MAXN = 55\nlet char array mp of size MAXN with array of size MAXN\nmake bool vis of size MAXN with array of size MAXN\ncreate constant integer array go of size 4 with array of size 2 containing {0, 1, 0, -1, -1, 0, 1, 0}\nmake ints n, m, and all = 0\ndeclare dfs taking in ints x and y and returning integer\n create int ans = 1\n for i = 0 to 4 exclusive\n create ints xx = x + go [i][0] and yy = y + go[i][1]\n if mp[xx][yy] is equal to '#' and vis[xx][yy] is falsy\n set vis[xx][yy] to true\n set ans to ans + dfs(x + go[i][0], y + go[i][1])\n end of the block\n end of the block\n return ans\nend of the block\ndeclare solve\n if all is less than or equal to 2, return -1\n for i = 1 to n\n for j = 1 to m\n if mp[i][j] is equal to '#'\n set mp[i][j] to '.'\n create integer t = 0\n for k = 0 to 4 exclusive\n make ints xx = i + go[k][0] and yy = j + go[k][1]\n if mp[xx][yy] is equal to '#'\n set all contents of vis to 0\n set vis[xx][yy] to true\n set t to dfs(xx, yy)\n break loop\n end of the block\n end of the block\n set mp[i][j] to '#'\n if t is 0, return -1\n if t is not all - 1, return 1\n end of the block\n end of the block\n end of the block\n return 2\nend of the block\ndefine the main function\n read n and m\n set all contents of mp to '.'\n for i = 1 to n\n for j = 1 to m\n read mp[i][j]\n if mp[i][j] is equal to '#', increment all\n end of the block\n end of the block\n print result of solve()\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int MAXN = 55;\nchar mp[MAXN][MAXN];\nbool vis[MAXN][MAXN];\nconst int go[4][2] = {0, 1, 0, -1, -1, 0, 1, 0};\nint n, m, all = 0;\nint dfs(int x, int y) {\n int ans = 1;\n for (int i = 0; i < 4; i++) {\n int xx = x + go[i][0], yy = y + go[i][1];\n if (mp[xx][yy] == '#' && !vis[xx][yy]) {\n vis[xx][yy] = true;\n ans += dfs(x + go[i][0], y + go[i][1]);\n }\n }\n return ans;\n}\nint solve() {\n if (all <= 2) return -1;\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n if (mp[i][j] == '#') {\n mp[i][j] = '.';\n int t = 0;\n for (int k = 0; k < 4; k++) {\n int xx = i + go[k][0], yy = j + go[k][1];\n if (mp[xx][yy] == '#') {\n memset(vis, 0, sizeof(vis));\n vis[xx][yy] = true;\n t = dfs(xx, yy);\n break;\n }\n }\n mp[i][j] = '#';\n if (t == 0) return -1;\n if (t != all - 1) { return 1; }\n }\n }\n }\n return 2;\n}\nint main() {\n cin >> n >> m;\n memset(mp, '.', sizeof(mp));\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n cin >> mp[i][j];\n if (mp[i][j] == '#') ++all;\n }\n }\n cout << solve() << endl;\n return 0;\n}","item":{"problem_id":"193A","pseudocode":"create constant integer MAXN = 55\nlet char array mp of size MAXN with array of size MAXN\nmake bool vis of size MAXN with array of size MAXN\ncreate constant integer array go of size 4 with array of size 2 containing {0, 1, 0, -1, -1, 0, 1, 0}\nmake ints n, m, and all = 0\ndeclare dfs taking in ints x and y and returning integer\n create int ans = 1\n for i = 0 to 4 exclusive\n create ints xx = x + go [i][0] and yy = y + go[i][1]\n if mp[xx][yy] is equal to '#' and vis[xx][yy] is falsy\n set vis[xx][yy] to true\n set ans to ans + dfs(x + go[i][0], y + go[i][1])\n end of the block\n end of the block\n return ans\nend of the block\ndeclare solve\n if all is less than or equal to 2, return -1\n for i = 1 to n\n for j = 1 to m\n if mp[i][j] is equal to '#'\n set mp[i][j] to '.'\n create integer t = 0\n for k = 0 to 4 exclusive\n make ints xx = i + go[k][0] and yy = j + go[k][1]\n if mp[xx][yy] is equal to '#'\n set all contents of vis to 0\n set vis[xx][yy] to true\n set t to dfs(xx, yy)\n break loop\n end of the block\n end of the block\n set mp[i][j] to '#'\n if t is 0, return -1\n if t is not all - 1, return 1\n end of the block\n end of the block\n end of the block\n return 2\nend of the block\ndefine the main function\n read n and m\n set all contents of mp to '.'\n for i = 1 to n\n for j = 1 to m\n read mp[i][j]\n if mp[i][j] is equal to '#', increment all\n end of the block\n end of the block\n print result of solve()\n return to indicate successful execution\nend of the block","testcases":[[["5 4","####","#..#","#..#","#..#","####"],["2"]],[["5 5","#####","#...#","#####","#...#","#####"],["2"]],[["1 10",".########."],["1"]],[["1 1","#"],["-1"]],[["3 3",".#.","###",".#."],["1"]],[["1 2","##"],["-1"]],[["2 1","#","#"],["-1"]],[["3 3","###","#.#","###"],["2"]],[["2 2","##","#."],["1"]],[["2 2","##","##"],["2"]],[["2 2",".#","##"],["1"]],[["2 2",".#",".#"],["-1"]],[["9 9","#########","#.......#","#.#####.#","#.#.#.#.#","#.#.#.#.#","#.#.#.#.#","#.#####.#","#...#...#","#########"],["1"]],[["50 1","#","#","#","#",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".","."],["1"]],[["3 50","....##############################################","....#.......#...#..#....#..............#.........#","....##############################################"],["2"]],[["2 2","##",".."],["-1"]],[["5 5","#####","#####","#....","#####","#####"],["1"]],[["3 5","##.##","#####","##.##"],["1"]],[["4 4","####","####","####","####"],["2"]],[["5 7",".#####.",".#...#.","###.###","#.#.#.#","###.###"],["1"]],[["2 5","#####","##.##"],["1"]],[["6 2","##","##","#.","##","##","##"],["1"]],[["2 5","##.##","#####"],["1"]],[["5 5","#####","#####","##.##","##.##","##.##"],["2"]],[["5 3","###","###",".#.","###","###"],["1"]],[["5 5","###..","###..","#..##","#####","#####"],["1"]]]}} +{"instance_id":"pseudo_to_code_2k_39","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmnx=8000009\nmod=1000000007\ndx=array of 4 long long filled with -1, 0, 0, 1\ndy=array of 4 long long filled with 0, -1, 1, 0\nn,m=long long\ns=array of 111 by 111 char\nu=array of 111 by 111 bool\nfunction check (get long long x and y, return bool)\n return 0 < x and x < n+1 and 0 < y and y < m+1\nend of the block\nfunction dfs (get long long x and y, return nothing)\n if u[x][y] return\n u[x][y]=true\n for i=0 to 4 exclusive\n if check(x+dx[i], y+dy[i]) and s[x+dx[i]][y+dy[i]] is '#' dfs(x+dx[i], y+dy[i])\n end of the block\nend of the block\ndefine the main function\n read n,m\n for i=1 to n inclusive\n for j=1 to m inclusive read s[i][j]\n end of the block\n qwe=0\n for i=1 to n inclusive\n for j=1 to m inclusive\n if s[i][j] is '#' increment qwe\n end of the block\n end of the block\n res=11111111111111\n for i=1 to n inclusive\n for j=1 to m inclusive\n if s[i][j] is '#'\n q=0\n for k=0 to 4 exclusive\n if check(i+dx[k], j+dy[k]) and s[i+dx[k]][j+dy[k]] is '#' increment q\n end of the block\n if q+1 < qwe res=min(res, q)\n if qwe>1\n s[i][j]='0'\n for k=1 to n inclusive\n for l=1 to m inclusive u[k][l]=false\n end of the block\n cnt=0\n for k=1 to n inclusive\n for l=1 to m inclusive\n if s[k][l] is '#' and not u[k][l]\n dfs(k,l)\n increment cnt\n end of the block\n end of the block\n end of the block\n if cnt>1 res=min(res, 1)\n s[i][j]='#'\n end of the block\n end of the block\n end of the block\n end of the block\n if res is 11111111111111 subtract 11111111111112 from res\n print res\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const long long mnx = 8e6 + 9;\nconst long long mod = 1e9 + 7;\nconst long long dx[4] = {-1, 0, 0, 1};\nconst long long dy[4] = {0, -1, 1, 0};\nlong long n, m;\nchar s[111][111];\nbool u[111][111];\nbool check(long long x, long long y) {\n return 0 < x && x < n + 1 && 0 < y && y < m + 1;\n}\nvoid dfs(long long x, long long y) {\n if (u[x][y]) { return; }\n u[x][y] = true;\n for (long long i = 0; i < 4; i++) {\n if (check(x + dx[i], y + dy[i]) && s[x + dx[i]][y + dy[i]] == '#') { dfs(x + dx[i], y + dy[i]); }\n }\n}\nint main() {\n cin >> n >> m;\n for (long long i = 1; i <= n; i++) {\n for (long long j = 1; j <= m; j++) { cin >> s[i][j]; }\n }\n long long qwe = 0;\n for (long long i = 1; i <= n; i++) {\n for (long long j = 1; j <= m; j++) {\n if (s[i][j] == '#') { qwe++; }\n }\n }\n long long res = 11111111111111;\n for (long long i = 1; i <= n; i++) {\n for (long long j = 1; j <= m; j++) {\n if (s[i][j] == '#') {\n long long q = 0;\n for (long long k = 0; k < 4; k++) {\n if (check(i + dx[k], j + dy[k]) && s[i + dx[k]][j + dy[k]] == '#') q++;\n }\n if (q + 1 < qwe) { res = min(res, q); }\n if (qwe > 1) {\n s[i][j] = '0';\n for (long long k = 1; k <= n; k++) {\n for (long long l = 1; l <= m; l++) { u[k][l] = false; }\n }\n long long cnt = 0;\n for (long long k = 1; k <= n; k++) {\n for (long long l = 1; l <= m; l++) {\n if (s[k][l] == '#' && !u[k][l]) {\n dfs(k, l);\n cnt++;\n }\n }\n }\n if (cnt > 1) { res = min(res, 1LL); }\n s[i][j] = '#';\n }\n }\n }\n }\n if (res == 11111111111111) res -= 11111111111112;\n cout << res << '\\n';\n return 0;\n}","item":{"problem_id":"193A","pseudocode":"mnx=8000009\nmod=1000000007\ndx=array of 4 long long filled with -1, 0, 0, 1\ndy=array of 4 long long filled with 0, -1, 1, 0\nn,m=long long\ns=array of 111 by 111 char\nu=array of 111 by 111 bool\nfunction check (get long long x and y, return bool)\n return 0 < x and x < n+1 and 0 < y and y < m+1\nend of the block\nfunction dfs (get long long x and y, return nothing)\n if u[x][y] return\n u[x][y]=true\n for i=0 to 4 exclusive\n if check(x+dx[i], y+dy[i]) and s[x+dx[i]][y+dy[i]] is '#' dfs(x+dx[i], y+dy[i])\n end of the block\nend of the block\ndefine the main function\n read n,m\n for i=1 to n inclusive\n for j=1 to m inclusive read s[i][j]\n end of the block\n qwe=0\n for i=1 to n inclusive\n for j=1 to m inclusive\n if s[i][j] is '#' increment qwe\n end of the block\n end of the block\n res=11111111111111\n for i=1 to n inclusive\n for j=1 to m inclusive\n if s[i][j] is '#'\n q=0\n for k=0 to 4 exclusive\n if check(i+dx[k], j+dy[k]) and s[i+dx[k]][j+dy[k]] is '#' increment q\n end of the block\n if q+1 < qwe res=min(res, q)\n if qwe>1\n s[i][j]='0'\n for k=1 to n inclusive\n for l=1 to m inclusive u[k][l]=false\n end of the block\n cnt=0\n for k=1 to n inclusive\n for l=1 to m inclusive\n if s[k][l] is '#' and not u[k][l]\n dfs(k,l)\n increment cnt\n end of the block\n end of the block\n end of the block\n if cnt>1 res=min(res, 1)\n s[i][j]='#'\n end of the block\n end of the block\n end of the block\n end of the block\n if res is 11111111111111 subtract 11111111111112 from res\n print res\n return to indicate successful execution\nend of the block","testcases":[[["5 4","####","#..#","#..#","#..#","####"],["2"]],[["5 5","#####","#...#","#####","#...#","#####"],["2"]],[["1 10",".########."],["1"]],[["1 1","#"],["-1"]],[["3 3",".#.","###",".#."],["1"]],[["1 2","##"],["-1"]],[["2 1","#","#"],["-1"]],[["3 3","###","#.#","###"],["2"]],[["2 2","##","#."],["1"]],[["2 2","##","##"],["2"]],[["2 2",".#","##"],["1"]],[["2 2",".#",".#"],["-1"]],[["9 9","#########","#.......#","#.#####.#","#.#.#.#.#","#.#.#.#.#","#.#.#.#.#","#.#####.#","#...#...#","#########"],["1"]],[["50 1","#","#","#","#",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".","."],["1"]],[["3 50","....##############################################","....#.......#...#..#....#..............#.........#","....##############################################"],["2"]],[["2 2","##",".."],["-1"]],[["5 5","#####","#####","#....","#####","#####"],["1"]],[["3 5","##.##","#####","##.##"],["1"]],[["4 4","####","####","####","####"],["2"]],[["5 7",".#####.",".#...#.","###.###","#.#.#.#","###.###"],["1"]],[["2 5","#####","##.##"],["1"]],[["6 2","##","##","#.","##","##","##"],["1"]],[["2 5","##.##","#####"],["1"]],[["5 5","#####","#####","##.##","##.##","##.##"],["2"]],[["5 3","###","###",".#.","###","###"],["1"]],[["5 5","###..","###..","#..##","#####","#####"],["1"]]]}} +{"instance_id":"pseudo_to_code_2k_40","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare constant integer MAXN = 55\ndeclare integers n, m, area\ndeclare integer array dx = {-1, 0, 1, 0}\ndeclare integer array dy = {0, 1, 0, -1}\ndeclare integer array bio size MAXN by MAXN\ndeclare character array grid size MAXN by MAXN\ndeclare valid with integers x, y as arguments, returning boolean\n if x is less than 0 or x is greater than or equal to n, return false from function\n if y is less than 0 or y is greater than or equal to m, return false from function\n return true from function\nend of the block\ndeclare dfs with integers x, y as arguments, returning void\n let bio[x][y] be 1\n for i = 0 to 4 exclusive\n declare integer xx = x + dx[i]\n declare integer yy = y + dy[i]\n if result of run valid(xx,yy) and grid[xx][yy] is '#' and not bio[xx][yy], run dfs(xx,yy)\n end of the block\nend of the block\ndeclare nc with no arguments, returning integer\n for i = 0 to n exclusive\n for j = 0 to m exclusive, let bio[i][j] be 0\n end of the block\n declare integer bk = 0\n for i = 0 to n exclusive\n for j = 0 to m exclusive\n if grid[i][j] is '.', end current loop iteration\n if bio[i][j], end current loop iteration\n run dfs(i,j)\n increment bk\n end of the block\n end of the block\n return bk\nend of the block\ndefine the main function\n read n and m\n for i = 0 to n exclusive, read grid[i]\n for i = 0 to n exclusive\n for j = 0 to m exclusive\n if grid[i][j] is '#', increment area\n end of the block\n end of the block\n if area is less than 3\n print \"-1\\n\"\n return to indicate successful execution\n else if area is 3\n print \"1\\n\"\n return to indicate successful execution\n else\n for i = 0 to n exclusive\n for j = 0 to m exclusive\n if grid[i][j] is '.', end current loop iteration\n let gird[i][j] be '.'\n if result of run nc is greater than 1\n print \"1\\n\"\n return to indicate successful execution\n end of the block\n let grid[i][j] be '#'\n end of the block\n end of the block\n print \"2\\n\"\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int MAXN = 55;\nint n, m, area;\nint dx[] = {-1, 0, 1, 0};\nint dy[] = {0, 1, 0, -1};\nint bio[MAXN][MAXN];\nchar grid[MAXN][MAXN];\nbool valid(int x, int y) {\n if (x < 0 || x >= n) return false;\n if (y < 0 || y >= m) return false;\n return true;\n}\nvoid dfs(int x, int y) {\n bio[x][y] = 1;\n for (int i = 0; i < 4; i++) {\n int xx = x + dx[i];\n int yy = y + dy[i];\n if (valid(xx, yy) && grid[xx][yy] == '#' && !bio[xx][yy]) { dfs(xx, yy); }\n }\n}\nint nc() {\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) { bio[i][j] = 0; }\n }\n int bk = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if (grid[i][j] == '.') continue;\n if (bio[i][j]) continue;\n dfs(i, j);\n bk++;\n }\n }\n return bk;\n}\nint main() {\n cin >> n >> m;\n for (int i = 0; i < n; i++) { cin >> grid[i]; }\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if (grid[i][j] == '#') area++;\n }\n }\n if (area < 3) {\n cout << \"-1\\n\";\n return 0;\n } else if (area == 3) {\n cout << \"1\\n\";\n return 0;\n } else {\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if (grid[i][j] == '.') continue;\n grid[i][j] = '.';\n if (nc() > 1) {\n cout << \"1\\n\";\n return 0;\n }\n grid[i][j] = '#';\n }\n }\n cout << \"2\\n\";\n }\n return 0;\n}","item":{"problem_id":"193A","pseudocode":"declare constant integer MAXN = 55\ndeclare integers n, m, area\ndeclare integer array dx = {-1, 0, 1, 0}\ndeclare integer array dy = {0, 1, 0, -1}\ndeclare integer array bio size MAXN by MAXN\ndeclare character array grid size MAXN by MAXN\ndeclare valid with integers x, y as arguments, returning boolean\n if x is less than 0 or x is greater than or equal to n, return false from function\n if y is less than 0 or y is greater than or equal to m, return false from function\n return true from function\nend of the block\ndeclare dfs with integers x, y as arguments, returning void\n let bio[x][y] be 1\n for i = 0 to 4 exclusive\n declare integer xx = x + dx[i]\n declare integer yy = y + dy[i]\n if result of run valid(xx,yy) and grid[xx][yy] is '#' and not bio[xx][yy], run dfs(xx,yy)\n end of the block\nend of the block\ndeclare nc with no arguments, returning integer\n for i = 0 to n exclusive\n for j = 0 to m exclusive, let bio[i][j] be 0\n end of the block\n declare integer bk = 0\n for i = 0 to n exclusive\n for j = 0 to m exclusive\n if grid[i][j] is '.', end current loop iteration\n if bio[i][j], end current loop iteration\n run dfs(i,j)\n increment bk\n end of the block\n end of the block\n return bk\nend of the block\ndefine the main function\n read n and m\n for i = 0 to n exclusive, read grid[i]\n for i = 0 to n exclusive\n for j = 0 to m exclusive\n if grid[i][j] is '#', increment area\n end of the block\n end of the block\n if area is less than 3\n print \"-1\\n\"\n return to indicate successful execution\n else if area is 3\n print \"1\\n\"\n return to indicate successful execution\n else\n for i = 0 to n exclusive\n for j = 0 to m exclusive\n if grid[i][j] is '.', end current loop iteration\n let gird[i][j] be '.'\n if result of run nc is greater than 1\n print \"1\\n\"\n return to indicate successful execution\n end of the block\n let grid[i][j] be '#'\n end of the block\n end of the block\n print \"2\\n\"\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["5 4","####","#..#","#..#","#..#","####"],["2"]],[["5 5","#####","#...#","#####","#...#","#####"],["2"]],[["1 10",".########."],["1"]],[["1 1","#"],["-1"]],[["3 3",".#.","###",".#."],["1"]],[["1 2","##"],["-1"]],[["2 1","#","#"],["-1"]],[["3 3","###","#.#","###"],["2"]],[["2 2","##","#."],["1"]],[["2 2","##","##"],["2"]],[["2 2",".#","##"],["1"]],[["2 2",".#",".#"],["-1"]],[["9 9","#########","#.......#","#.#####.#","#.#.#.#.#","#.#.#.#.#","#.#.#.#.#","#.#####.#","#...#...#","#########"],["1"]],[["50 1","#","#","#","#",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".","."],["1"]],[["3 50","....##############################################","....#.......#...#..#....#..............#.........#","....##############################################"],["2"]],[["2 2","##",".."],["-1"]],[["5 5","#####","#####","#....","#####","#####"],["1"]],[["3 5","##.##","#####","##.##"],["1"]],[["4 4","####","####","####","####"],["2"]],[["5 7",".#####.",".#...#.","###.###","#.#.#.#","###.###"],["1"]],[["2 5","#####","##.##"],["1"]],[["6 2","##","##","#.","##","##","##"],["1"]],[["2 5","##.##","#####"],["1"]],[["5 5","#####","#####","##.##","##.##","##.##"],["2"]],[["5 3","###","###",".#.","###","###"],["1"]],[["5 5","###..","###..","#..##","#####","#####"],["1"]]]}} +{"instance_id":"pseudo_to_code_2k_41","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integer array A of size 100 X 100\ncreate integer array B of size 26000\ncreate vector integer array NEB of size 27000\nlet yy be integer with yy=0\ncreate integer arrays vis,low,malow,tim,F of sizes 27000 each\ncreate integer t=1\ncreate integer uu=0\ncreate integer vector check\nin the function dfs which takes a integer s\n set low[s] = t\n set vis[s] = 1\n set tim[s] =t\n add 1 to t\n create integer pp=0\n for i=0 to NEB[s].size exclusive\n create integer l = NEB[s][i]\n if F[s] is not equal to 1\n if vis[l] is equal to 1\n set low[s] to minimum of low[s] and tim[l]\n else do the following\n add 1 to pp\n set F[l] =s\n call dfs with argument l\n create integer u=s\n set low[u] = minimum of low[u] and low[l]\n set malow[w] to maximum of malow[u] and low[l]\n end of the block\n end of the block\n end of the block\n create integer u = s\n is s=yy and pp>1\n set uu=1\n add s to the end of check\n else if ss is not equal to yy and malow[u] >= tim[u]\n set uu to 1\n add s to end of check\n end of the block\nend of the block\ndefine the main function\n n,m = integers\n read n and m\n create integer no=0\n for i=1 to n inclusive\n for j=1 to m inclusive\n c= char\n read c\n if c is equal to #\n increment no\n set A[i][j] to 1\n set B[(m + 1) * i + j] = 1\n set yy = (m + 1) * i + j\n end of the block\n end of the block\n end of the block\n create integer array of size 4 P = {-1, 1, (0 - m - 1), m + 1}{-1, 1, (0 - m - 1), m + 1}\n for i=1 to 2700 exclusive\n for j=0 to 4 exclusive\n if i + P[j] >= 0 and B[i + P[j]] = 1 then add i+P[j] to the end of NEB[i]\n end of the block\n end of the block\n call dfs on yy\n if no<3\n then print -1\n else do the following\n if uu is 1\n print 1 and new line\n else do the following\n print 2\n end of the block\nend of the block\n\n[CODE]:","reference_output":"int A[100][100];\nint B[26000];\nvector NEB[27000];\nint yy = 0;\nint vis[27000], low[27000], malow[27000], tim[27000], F[27000];\nint t = 1;\nint uu = 0;\nvector check;\nvoid dfs(int s) {\n low[s] = t;\n vis[s] = 1;\n tim[s] = t;\n t++;\n int pp = 0;\n for (int i = 0; i < NEB[s].size(); i++) {\n int l = NEB[s][i];\n if (F[s] != l) {\n if (vis[l] == 1) {\n low[s] = min(low[s], tim[l]);\n } else {\n pp++;\n F[l] = s;\n dfs(l);\n int u = s;\n low[u] = min(low[u], low[l]);\n malow[u] = max(malow[u], low[l]);\n }\n }\n }\n int u = s;\n if (s == yy && pp > 1) {\n uu = 1;\n check.push_back(s);\n } else if (s != yy && malow[u] >= tim[u]) {\n uu = 1;\n check.push_back(s);\n }\n}\nint main() {\n int n, m;\n cin >> n >> m;\n int no = 0;\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n char c;\n cin >> c;\n if (c == '#') {\n no++;\n A[i][j] = 1;\n B[(m + 1) * i + j] = 1;\n yy = (m + 1) * i + j;\n }\n }\n }\n int P[4] = {-1, 1, (0 - m - 1), m + 1};\n for (int i = 1; i < 2700; i++) {\n for (int j = 0; j < 4; j++) {\n if (i + P[j] >= 0 && B[i + P[j]] == 1) NEB[i].push_back(i + P[j]);\n }\n }\n dfs(yy);\n if (no < 3)\n cout << -1 << endl;\n else {\n if (uu == 1)\n cout << 1 << endl;\n else\n cout << 2 << endl;\n }\n}","item":{"problem_id":"193A","pseudocode":"create integer array A of size 100 X 100\ncreate integer array B of size 26000\ncreate vector integer array NEB of size 27000\nlet yy be integer with yy=0\ncreate integer arrays vis,low,malow,tim,F of sizes 27000 each\ncreate integer t=1\ncreate integer uu=0\ncreate integer vector check\nin the function dfs which takes a integer s\n set low[s] = t\n set vis[s] = 1\n set tim[s] =t\n add 1 to t\n create integer pp=0\n for i=0 to NEB[s].size exclusive\n create integer l = NEB[s][i]\n if F[s] is not equal to 1\n if vis[l] is equal to 1\n set low[s] to minimum of low[s] and tim[l]\n else do the following\n add 1 to pp\n set F[l] =s\n call dfs with argument l\n create integer u=s\n set low[u] = minimum of low[u] and low[l]\n set malow[w] to maximum of malow[u] and low[l]\n end of the block\n end of the block\n end of the block\n create integer u = s\n is s=yy and pp>1\n set uu=1\n add s to the end of check\n else if ss is not equal to yy and malow[u] >= tim[u]\n set uu to 1\n add s to end of check\n end of the block\nend of the block\ndefine the main function\n n,m = integers\n read n and m\n create integer no=0\n for i=1 to n inclusive\n for j=1 to m inclusive\n c= char\n read c\n if c is equal to #\n increment no\n set A[i][j] to 1\n set B[(m + 1) * i + j] = 1\n set yy = (m + 1) * i + j\n end of the block\n end of the block\n end of the block\n create integer array of size 4 P = {-1, 1, (0 - m - 1), m + 1}{-1, 1, (0 - m - 1), m + 1}\n for i=1 to 2700 exclusive\n for j=0 to 4 exclusive\n if i + P[j] >= 0 and B[i + P[j]] = 1 then add i+P[j] to the end of NEB[i]\n end of the block\n end of the block\n call dfs on yy\n if no<3\n then print -1\n else do the following\n if uu is 1\n print 1 and new line\n else do the following\n print 2\n end of the block\nend of the block","testcases":[[["5 4","####","#..#","#..#","#..#","####"],["2"]],[["5 5","#####","#...#","#####","#...#","#####"],["2"]],[["1 10",".########."],["1"]],[["1 1","#"],["-1"]],[["3 3",".#.","###",".#."],["1"]],[["1 2","##"],["-1"]],[["2 1","#","#"],["-1"]],[["3 3","###","#.#","###"],["2"]],[["2 2","##","#."],["1"]],[["2 2","##","##"],["2"]],[["2 2",".#","##"],["1"]],[["2 2",".#",".#"],["-1"]],[["9 9","#########","#.......#","#.#####.#","#.#.#.#.#","#.#.#.#.#","#.#.#.#.#","#.#####.#","#...#...#","#########"],["1"]],[["50 1","#","#","#","#",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".","."],["1"]],[["3 50","....##############################################","....#.......#...#..#....#..............#.........#","....##############################################"],["2"]],[["2 2","##",".."],["-1"]],[["5 5","#####","#####","#....","#####","#####"],["1"]],[["3 5","##.##","#####","##.##"],["1"]],[["4 4","####","####","####","####"],["2"]],[["5 7",".#####.",".#...#.","###.###","#.#.#.#","###.###"],["1"]],[["2 5","#####","##.##"],["1"]],[["6 2","##","##","#.","##","##","##"],["1"]],[["2 5","##.##","#####"],["1"]],[["5 5","#####","#####","##.##","##.##","##.##"],["2"]],[["5 3","###","###",".#.","###","###"],["1"]],[["5 5","###..","###..","#..##","#####","#####"],["1"]]]}} +{"instance_id":"pseudo_to_code_2k_42","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate new constant integer MAX_N = 50\nnew integer constant MAX_M with value 50\ndefine new 2d array of integers v with size MAX_N by MAX_M\ndefine new 2d array of integers u MAX_N by MAX_M elements\ndefine new integers n and m\nvoid function dfs with int arguments x, y and first\n if first is false, assign the new value = 1 to u[y][x]\n if x > 0 and v[y][x - 1] is true and u[y][x - 1] is false, call dfs(x - 1, y)\n call dfs(x + 1, y) if x < m - 1 and v[y][x + 1] is true and u[y][x + 1] is false\n if y > 0 and v[y - 1][x] is true and u[y - 1][x] is false, run function dfs(x, y - 1)\n if y < n - 1 and v[y + 1][x] is true and u[y + 1][x] is false, call method dfs(x, y + 1)\nend of the block\ndefine the main function\n read n and m from the user input\n create new integer called k = 0\n for i from 0 to n exclusive\n new string variable s\n read variable s from the input\n start for loop from j = 0 to m exclusive\n assign the new value = (true if s[j]='#' or false otherwise), to v[i][j]\n add v[i][j] to k\n end of the block\n end of the block\n if k <= 2\n print - 1\n return to indicate successful execution\n end of the block\n define boolean f = false\n start for loop from i = 0 to n exclusive\n increment j in a loop from 0 to m exclusive\n if v[i][j] is false, skip the rest of the loop\n set first MAX_N * MAX_M *sizeof(int) bytes at the pointer u to 0\n assign 0 to v[i][j]\n create boolean variable with name f = false\n for integer ii = 0 to n exclusive incrementing ii, while f is false\n in a for loop, change jj from 0 to m exclusive, while f is false\n if v[ii][jj] != 0\n call dfs(jj, ii)\n assign true to f\n end of the block\n end of the block\n end of the block\n start for loop from ii = 0 to n exclusive\n loop through jj from 0 to m exclusive incrementing by 1\n if i = ii and j = jj, go to the start of the loop\n if v[ii][jj] != u[ii][jj]\n print 1 and a new line\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n change the value of v[i][j] to 1\n end of the block\n end of the block\n print 2\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int MAX_N = 50;\nconst int MAX_M = 50;\nint v[MAX_N][MAX_M];\nint u[MAX_N][MAX_M];\nint n, m;\nvoid dfs(int x, int y, int first = 0) {\n if (!first) u[y][x] = 1;\n if (x > 0 && v[y][x - 1] && !u[y][x - 1]) dfs(x - 1, y);\n if (x < m - 1 && v[y][x + 1] && !u[y][x + 1]) dfs(x + 1, y);\n if (y > 0 && v[y - 1][x] && !u[y - 1][x]) dfs(x, y - 1);\n if (y < n - 1 && v[y + 1][x] && !u[y + 1][x]) dfs(x, y + 1);\n}\nint main() {\n cin >> n >> m;\n int k = 0;\n for (int i = 0; i < n; ++i) {\n string s;\n cin >> s;\n for (int j = 0; j < m; ++j) {\n v[i][j] = (s[j] == '#');\n k += v[i][j];\n }\n }\n if (k <= 2) {\n cout << -1 << endl;\n return 0;\n }\n bool f = false;\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < m; ++j) {\n if (!v[i][j]) continue;\n memset(u, 0, MAX_N * MAX_M * sizeof(int));\n v[i][j] = 0;\n bool f = false;\n for (int ii = 0; ii < n && !f; ++ii) {\n for (int jj = 0; jj < m && !f; ++jj) {\n if (v[ii][jj] != 0) {\n dfs(jj, ii);\n f = true;\n }\n }\n }\n for (int ii = 0; ii < n; ++ii) {\n for (int jj = 0; jj < m; ++jj) {\n if (i == ii && j == jj) continue;\n if (v[ii][jj] != u[ii][jj]) {\n cout << 1 << endl;\n return 0;\n }\n }\n }\n v[i][j] = 1;\n }\n }\n cout << 2 << endl;\n return 0;\n}","item":{"problem_id":"193A","pseudocode":"create new constant integer MAX_N = 50\nnew integer constant MAX_M with value 50\ndefine new 2d array of integers v with size MAX_N by MAX_M\ndefine new 2d array of integers u MAX_N by MAX_M elements\ndefine new integers n and m\nvoid function dfs with int arguments x, y and first\n if first is false, assign the new value = 1 to u[y][x]\n if x > 0 and v[y][x - 1] is true and u[y][x - 1] is false, call dfs(x - 1, y)\n call dfs(x + 1, y) if x < m - 1 and v[y][x + 1] is true and u[y][x + 1] is false\n if y > 0 and v[y - 1][x] is true and u[y - 1][x] is false, run function dfs(x, y - 1)\n if y < n - 1 and v[y + 1][x] is true and u[y + 1][x] is false, call method dfs(x, y + 1)\nend of the block\ndefine the main function\n read n and m from the user input\n create new integer called k = 0\n for i from 0 to n exclusive\n new string variable s\n read variable s from the input\n start for loop from j = 0 to m exclusive\n assign the new value = (true if s[j]='#' or false otherwise), to v[i][j]\n add v[i][j] to k\n end of the block\n end of the block\n if k <= 2\n print - 1\n return to indicate successful execution\n end of the block\n define boolean f = false\n start for loop from i = 0 to n exclusive\n increment j in a loop from 0 to m exclusive\n if v[i][j] is false, skip the rest of the loop\n set first MAX_N * MAX_M *sizeof(int) bytes at the pointer u to 0\n assign 0 to v[i][j]\n create boolean variable with name f = false\n for integer ii = 0 to n exclusive incrementing ii, while f is false\n in a for loop, change jj from 0 to m exclusive, while f is false\n if v[ii][jj] != 0\n call dfs(jj, ii)\n assign true to f\n end of the block\n end of the block\n end of the block\n start for loop from ii = 0 to n exclusive\n loop through jj from 0 to m exclusive incrementing by 1\n if i = ii and j = jj, go to the start of the loop\n if v[ii][jj] != u[ii][jj]\n print 1 and a new line\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n change the value of v[i][j] to 1\n end of the block\n end of the block\n print 2\n return to indicate successful execution\nend of the block","testcases":[[["5 4","####","#..#","#..#","#..#","####"],["2"]],[["5 5","#####","#...#","#####","#...#","#####"],["2"]],[["1 10",".########."],["1"]],[["1 1","#"],["-1"]],[["3 3",".#.","###",".#."],["1"]],[["1 2","##"],["-1"]],[["2 1","#","#"],["-1"]],[["3 3","###","#.#","###"],["2"]],[["2 2","##","#."],["1"]],[["2 2","##","##"],["2"]],[["2 2",".#","##"],["1"]],[["2 2",".#",".#"],["-1"]],[["9 9","#########","#.......#","#.#####.#","#.#.#.#.#","#.#.#.#.#","#.#.#.#.#","#.#####.#","#...#...#","#########"],["1"]],[["50 1","#","#","#","#",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".","."],["1"]],[["3 50","....##############################################","....#.......#...#..#....#..............#.........#","....##############################################"],["2"]],[["2 2","##",".."],["-1"]],[["5 5","#####","#####","#....","#####","#####"],["1"]],[["3 5","##.##","#####","##.##"],["1"]],[["4 4","####","####","####","####"],["2"]],[["5 7",".#####.",".#...#.","###.###","#.#.#.#","###.###"],["1"]],[["2 5","#####","##.##"],["1"]],[["6 2","##","##","#.","##","##","##"],["1"]],[["2 5","##.##","#####"],["1"]],[["5 5","#####","#####","##.##","##.##","##.##"],["2"]],[["5 3","###","###",".#.","###","###"],["1"]],[["5 5","###..","###..","#..##","#####","#####"],["1"]]]}} +{"instance_id":"pseudo_to_code_2k_43","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integer array A of size 100 X 100\ncreate integer array B of size 26000\ncreate vector integer array NEB of size 27000\nlet yy be integer with yy=0\ncreate integer arrays vis,low,malow,tim,F of sizes 27000 each\ncreate integer t=1\ncreate integer uu=0\ncreate integer vector check\nin the function dfs which takes a integer s\n set low[s] = t\n set vis[s] = 1\n set tim[s] =t\n add 1 to t\n create integer pp=0\n for i=0 to NEB[s].size exclusive\n create integer l = NEB[s][i]\n if F[s] is not equal to 1\n if vis[l] is equal to 1\n set low[s] to minimum of low[s] and tim[l]\n else do the following\n add 1 to pp\n set F[l] =s\n call dfs with argument l\n create integer u=s\n set low[u] = minimum of low[u] and low[l]\n set malow[w] to maximum of malow[u] and low[l]\n end of the block\n end of the block\n end of the block\n create integer u = s\n is s=yy and pp>1\n set uu=1\n add s to the end of check\n else if ss is not equal to yy and malow[u] >= tim[u]\n set uu to 1\n add s to end of check\n end of the block\nend of the block\ndefine the main function\n n,m = integers\n read n and m\n create integer no=0\n for i=1 to n inclusive\n for j=1 to m inclusive\n c= char\n read c\n if c is equal to #\n increment no\n set A[i][j] to 1\n set B[(m + 1) * i + j] = 1\n set yy = (m + 1) * i + j\n end of the block\n end of the block\n end of the block\n create integer array of size 4 P = {-1, 1, (0 - m - 1), m + 1}{-1, 1, (0 - m - 1), m + 1}\n for i=1 to 2700 exclusive\n for j=0 to 4 exclusive\n if i + P[j] >= 0 and B[i + P[j]] = 1 then add i+P[j] to the end of NEB[i]\n end of the block\n end of the block\n call dfs on yy\n if no<3\n then print -1\n else do the following\n if uu is 1\n print 1 and new line\n else do the following\n print 2\n end of the block\nend of the block\n\n[CODE]:","reference_output":"int A[100][100];\nint B[26000];\nvector NEB[27000];\nint yy = 0;\nint vis[27000], low[27000], malow[27000], tim[27000], F[27000];\nint t = 1;\nint uu = 0;\nvector check;\nvoid dfs(int s) {\n low[s] = t;\n vis[s] = 1;\n tim[s] = t;\n t++;\n int pp = 0;\n for (int i = 0; i < NEB[s].size(); i++) {\n int l = NEB[s][i];\n if (F[s] != l) {\n if (vis[l] == 1) {\n low[s] = min(low[s], tim[l]);\n } else {\n pp++;\n F[l] = s;\n dfs(l);\n int u = s;\n low[u] = min(low[u], low[l]);\n malow[u] = max(malow[u], low[l]);\n }\n }\n }\n int u = s;\n if (s == yy && pp > 1) {\n uu = 1;\n check.push_back(s);\n } else if (s != yy && malow[u] >= tim[u]) {\n uu = 1;\n check.push_back(s);\n }\n}\nint main() {\n int n, m;\n cin >> n >> m;\n int no = 0;\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n char c;\n cin >> c;\n if (c == '#') {\n no++;\n A[i][j] = 1;\n B[(m + 1) * i + j] = 1;\n yy = (m + 1) * i + j;\n }\n }\n }\n int P[4] = {-1, 1, (0 - m - 1), m + 1};\n for (int i = 1; i < 2700; i++) {\n for (int j = 0; j < 4; j++) {\n if (i + P[j] >= 0 && B[i + P[j]] == 1) NEB[i].push_back(i + P[j]);\n }\n }\n dfs(yy);\n if (no < 3)\n cout << -1 << endl;\n else {\n if (uu == 1)\n cout << 1 << endl;\n else\n cout << 2 << endl;\n }\n}","item":{"problem_id":"193A","pseudocode":"create integer array A of size 100 X 100\ncreate integer array B of size 26000\ncreate vector integer array NEB of size 27000\nlet yy be integer with yy=0\ncreate integer arrays vis,low,malow,tim,F of sizes 27000 each\ncreate integer t=1\ncreate integer uu=0\ncreate integer vector check\nin the function dfs which takes a integer s\n set low[s] = t\n set vis[s] = 1\n set tim[s] =t\n add 1 to t\n create integer pp=0\n for i=0 to NEB[s].size exclusive\n create integer l = NEB[s][i]\n if F[s] is not equal to 1\n if vis[l] is equal to 1\n set low[s] to minimum of low[s] and tim[l]\n else do the following\n add 1 to pp\n set F[l] =s\n call dfs with argument l\n create integer u=s\n set low[u] = minimum of low[u] and low[l]\n set malow[w] to maximum of malow[u] and low[l]\n end of the block\n end of the block\n end of the block\n create integer u = s\n is s=yy and pp>1\n set uu=1\n add s to the end of check\n else if ss is not equal to yy and malow[u] >= tim[u]\n set uu to 1\n add s to end of check\n end of the block\nend of the block\ndefine the main function\n n,m = integers\n read n and m\n create integer no=0\n for i=1 to n inclusive\n for j=1 to m inclusive\n c= char\n read c\n if c is equal to #\n increment no\n set A[i][j] to 1\n set B[(m + 1) * i + j] = 1\n set yy = (m + 1) * i + j\n end of the block\n end of the block\n end of the block\n create integer array of size 4 P = {-1, 1, (0 - m - 1), m + 1}{-1, 1, (0 - m - 1), m + 1}\n for i=1 to 2700 exclusive\n for j=0 to 4 exclusive\n if i + P[j] >= 0 and B[i + P[j]] = 1 then add i+P[j] to the end of NEB[i]\n end of the block\n end of the block\n call dfs on yy\n if no<3\n then print -1\n else do the following\n if uu is 1\n print 1 and new line\n else do the following\n print 2\n end of the block\nend of the block","testcases":[[["5 4","####","#..#","#..#","#..#","####"],["2"]],[["5 5","#####","#...#","#####","#...#","#####"],["2"]],[["1 10",".########."],["1"]],[["1 1","#"],["-1"]],[["3 3",".#.","###",".#."],["1"]],[["1 2","##"],["-1"]],[["2 1","#","#"],["-1"]],[["3 3","###","#.#","###"],["2"]],[["2 2","##","#."],["1"]],[["2 2","##","##"],["2"]],[["2 2",".#","##"],["1"]],[["2 2",".#",".#"],["-1"]],[["9 9","#########","#.......#","#.#####.#","#.#.#.#.#","#.#.#.#.#","#.#.#.#.#","#.#####.#","#...#...#","#########"],["1"]],[["50 1","#","#","#","#",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".","."],["1"]],[["3 50","....##############################################","....#.......#...#..#....#..............#.........#","....##############################################"],["2"]],[["2 2","##",".."],["-1"]],[["5 5","#####","#####","#....","#####","#####"],["1"]],[["3 5","##.##","#####","##.##"],["1"]],[["4 4","####","####","####","####"],["2"]],[["5 7",".#####.",".#...#.","###.###","#.#.#.#","###.###"],["1"]],[["2 5","#####","##.##"],["1"]],[["6 2","##","##","#.","##","##","##"],["1"]],[["2 5","##.##","#####"],["1"]],[["5 5","#####","#####","##.##","##.##","##.##"],["2"]],[["5 3","###","###",".#.","###","###"],["1"]],[["5 5","###..","###..","#..##","#####","#####"],["1"]]]}} +{"instance_id":"pseudo_to_code_2k_44","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare character array a size 55 by 55\ndeclare integer array is size 55 by 55\ndeclare integers n, m\ndeclare integer arrays dx size 4 = {-1, 1, 0, 0}, dy size 4 = {0, 0, -1, 1}\ndeclare inline work with integers x, y as arguments, returning void\n if is[x][y] is 1, return from function\n if a[x][y] is not '#', return from function\n let is[x][y] be 1\n declare integer i\n for i = 0 to 4 exclusive, run work with x + dx[i], y + dy[i] as arguments\nend of the block\ndeclare inline check with integers x, y as arguments, returning boolean\n let a[x][y] be '.'\n declare integer kk = 0\n set bytes from is to size of is to value 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if a[i][j] is '#' and is[i][j] is 0\n increment kk\n run work(i,j)\n end of the block\n end of the block\n let a[x][y] be '#'\n return kk is greater than 1\nend of the block\ndefine the main function\n read n, m\n declare integer kk = 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n read a[i][j]\n if a[i][j] is '#', increment kk\n end of the block\n end of the block\n if kk is less than 3\n print -1 and newline\n return to indicate successful execution\n end of the block\n declare integer ans = 2\n for i = 0 to n inclusive\n for j = 1 to m inclusive\n if a[i][j] is '#'\n if result of run check(i,j) is true, let ans be 1\n end of the block\n end of the block\n print ans and newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"char a[55][55];\nint is[55][55];\nint n, m;\nint dx[4] = {-1, 1, 0, 0}, dy[4] = {0, 0, -1, 1};\ninline void work(int x, int y) {\n if (is[x][y] == 1) return;\n if (a[x][y] != '#') return;\n is[x][y] = 1;\n int i;\n for (i = 0; i < 4; i++) work(x + dx[i], y + dy[i]);\n}\ninline bool check(int x, int y) {\n a[x][y] = '.';\n int kk = 0;\n memset(is, 0, sizeof(is));\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++)\n if (a[i][j] == '#' && (is[i][j] == 0)) {\n kk++;\n work(i, j);\n }\n }\n a[x][y] = '#';\n return kk > 1;\n}\nint main() {\n cin >> n >> m;\n int kk = 0;\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= m; j++) {\n cin >> a[i][j];\n if (a[i][j] == '#') kk++;\n }\n }\n if (kk < 3) {\n cout << -1 << endl;\n return 0;\n }\n int ans = 2;\n for (int i = 0; i <= n; i++) {\n for (int j = 1; j <= m; j++)\n if (a[i][j] == '#') {\n if (check(i, j)) ans = 1;\n }\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"193A","pseudocode":"declare character array a size 55 by 55\ndeclare integer array is size 55 by 55\ndeclare integers n, m\ndeclare integer arrays dx size 4 = {-1, 1, 0, 0}, dy size 4 = {0, 0, -1, 1}\ndeclare inline work with integers x, y as arguments, returning void\n if is[x][y] is 1, return from function\n if a[x][y] is not '#', return from function\n let is[x][y] be 1\n declare integer i\n for i = 0 to 4 exclusive, run work with x + dx[i], y + dy[i] as arguments\nend of the block\ndeclare inline check with integers x, y as arguments, returning boolean\n let a[x][y] be '.'\n declare integer kk = 0\n set bytes from is to size of is to value 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n if a[i][j] is '#' and is[i][j] is 0\n increment kk\n run work(i,j)\n end of the block\n end of the block\n let a[x][y] be '#'\n return kk is greater than 1\nend of the block\ndefine the main function\n read n, m\n declare integer kk = 0\n for i = 1 to n inclusive\n for j = 1 to m inclusive\n read a[i][j]\n if a[i][j] is '#', increment kk\n end of the block\n end of the block\n if kk is less than 3\n print -1 and newline\n return to indicate successful execution\n end of the block\n declare integer ans = 2\n for i = 0 to n inclusive\n for j = 1 to m inclusive\n if a[i][j] is '#'\n if result of run check(i,j) is true, let ans be 1\n end of the block\n end of the block\n print ans and newline\n return to indicate successful execution\nend of the block","testcases":[[["5 4","####","#..#","#..#","#..#","####"],["2"]],[["5 5","#####","#...#","#####","#...#","#####"],["2"]],[["1 10",".########."],["1"]],[["1 1","#"],["-1"]],[["3 3",".#.","###",".#."],["1"]],[["1 2","##"],["-1"]],[["2 1","#","#"],["-1"]],[["3 3","###","#.#","###"],["2"]],[["2 2","##","#."],["1"]],[["2 2","##","##"],["2"]],[["2 2",".#","##"],["1"]],[["2 2",".#",".#"],["-1"]],[["9 9","#########","#.......#","#.#####.#","#.#.#.#.#","#.#.#.#.#","#.#.#.#.#","#.#####.#","#...#...#","#########"],["1"]],[["50 1","#","#","#","#",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".","."],["1"]],[["3 50","....##############################################","....#.......#...#..#....#..............#.........#","....##############################################"],["2"]],[["2 2","##",".."],["-1"]],[["5 5","#####","#####","#....","#####","#####"],["1"]],[["3 5","##.##","#####","##.##"],["1"]],[["4 4","####","####","####","####"],["2"]],[["5 7",".#####.",".#...#.","###.###","#.#.#.#","###.###"],["1"]],[["2 5","#####","##.##"],["1"]],[["6 2","##","##","#.","##","##","##"],["1"]],[["2 5","##.##","#####"],["1"]],[["5 5","#####","#####","##.##","##.##","##.##"],["2"]],[["5 3","###","###",".#.","###","###"],["1"]],[["5 5","###..","###..","#..##","#####","#####"],["1"]]]}} +{"instance_id":"pseudo_to_code_2k_45","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n make ints i and j\n make int array vis of size 220 with array of size 220 with {0}\n make integer array vis1 of size 220 with array of size 220 with {0}\n make int arrays x of size 5, y of size 5, x1 of size 5, and y1 of size 5\n for i = 0 to 4 exclusive, read x[i] and y[i]\n for i = 0 to 4 exclusive, read x1[i] and y1[i]\n sort x using x + 4\n sort x1 using x1 + 4\n sort y using y + 4\n sort y1 using y1 + 4\n make integer ox = min(x[0], x1[0])\n create int oy = min(y[0], y1[0])\n if ox is less than 0, set ox to -ox\n if oy is less than 0, set oy to -oy\n for i = x[0] + ox to x[3] + ox\n for j = y[0] + oy to y[3] + oy, set vis[i][j] to 1\n make integer mid = (x1[0] + ox + x1[3] + ox) \/ 2\n create int s = y1[0] + oy\n let int t = y1[3] + oy\n for i = mid to x1[0] + ox\n for j = s to t, set vis1[i][j] to 1\n increment s\n decrease t by 1\n end of the block\n set s to y1[0] + oy\n set t to y1[3] + oy\n for i = mid to x1[3] + ox\n for j = s to t, set vis1[i][j] to 1\n increment s\n decrease t by 1\n end of the block\n for i = 0 to 220 exclusive\n for j = 0 to 220 exclusive\n if vis[i][j] is equal to 1 and vis1[i][j] is equal to 1\n print \"YES\"\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n show \"NO\"\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int i, j;\n int vis[220][220] = {0};\n int vis1[220][220] = {0};\n int x[5], y[5], x1[5], y1[5];\n for (i = 0; i < 4; i++) cin >> x[i] >> y[i];\n for (i = 0; i < 4; i++) cin >> x1[i] >> y1[i];\n sort(x, x + 4);\n sort(x1, x1 + 4);\n sort(y, y + 4);\n sort(y1, y1 + 4);\n int ox = min(x[0], x1[0]);\n int oy = min(y[0], y1[0]);\n if (ox < 0) ox = -ox;\n if (oy < 0) oy = -oy;\n for (i = x[0] + ox; i <= x[3] + ox; i++)\n for (j = y[0] + oy; j <= y[3] + oy; j++) vis[i][j] = 1;\n int mid = (x1[0] + ox + x1[3] + ox) \/ 2;\n int s = y1[0] + oy;\n int t = y1[3] + oy;\n for (i = mid; i >= x1[0] + ox; i--) {\n for (j = s; j <= t; j++) { vis1[i][j] = 1; }\n s++;\n t--;\n }\n s = y1[0] + oy;\n t = y1[3] + oy;\n for (i = mid; i <= x1[3] + ox; i++) {\n for (j = s; j <= t; j++) { vis1[i][j] = 1; }\n s++;\n t--;\n }\n for (i = 0; i < 220; i++) {\n for (j = 0; j < 220; j++) {\n if (vis[i][j] == 1 && vis1[i][j] == 1) {\n cout << \"YES\" << endl;\n return 0;\n }\n }\n }\n cout << \"NO\" << endl;\n return 0;\n}","item":{"problem_id":"993A","pseudocode":"define the main function\n make ints i and j\n make int array vis of size 220 with array of size 220 with {0}\n make integer array vis1 of size 220 with array of size 220 with {0}\n make int arrays x of size 5, y of size 5, x1 of size 5, and y1 of size 5\n for i = 0 to 4 exclusive, read x[i] and y[i]\n for i = 0 to 4 exclusive, read x1[i] and y1[i]\n sort x using x + 4\n sort x1 using x1 + 4\n sort y using y + 4\n sort y1 using y1 + 4\n make integer ox = min(x[0], x1[0])\n create int oy = min(y[0], y1[0])\n if ox is less than 0, set ox to -ox\n if oy is less than 0, set oy to -oy\n for i = x[0] + ox to x[3] + ox\n for j = y[0] + oy to y[3] + oy, set vis[i][j] to 1\n make integer mid = (x1[0] + ox + x1[3] + ox) \/ 2\n create int s = y1[0] + oy\n let int t = y1[3] + oy\n for i = mid to x1[0] + ox\n for j = s to t, set vis1[i][j] to 1\n increment s\n decrease t by 1\n end of the block\n set s to y1[0] + oy\n set t to y1[3] + oy\n for i = mid to x1[3] + ox\n for j = s to t, set vis1[i][j] to 1\n increment s\n decrease t by 1\n end of the block\n for i = 0 to 220 exclusive\n for j = 0 to 220 exclusive\n if vis[i][j] is equal to 1 and vis1[i][j] is equal to 1\n print \"YES\"\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n show \"NO\"\n return to indicate successful execution\nend of the block","testcases":[[["0 0 6 0 6 6 0 6","1 3 3 5 5 3 3 1"],["YES"]],[["0 0 6 0 6 6 0 6","7 3 9 5 11 3 9 1"],["NO"]],[["6 0 6 6 0 6 0 0","7 4 4 7 7 10 10 7"],["YES"]],[["0 0 6 0 6 6 0 6","8 4 4 8 8 12 12 8"],["YES"]],[["2 2 4 2 4 4 2 4","0 3 3 6 6 3 3 0"],["YES"]],[["-5 -5 5 -5 5 5 -5 5","-5 7 0 2 5 7 0 12"],["YES"]],[["-5 -5 5 -5 5 5 -5 5","-5 12 0 7 5 12 0 17"],["NO"]],[["-5 -5 5 -5 5 5 -5 5","6 0 0 6 -6 0 0 -6"],["YES"]],[["-100 -100 100 -100 100 100 -100 100","-100 0 0 -100 100 0 0 100"],["YES"]],[["92 1 92 98 -5 98 -5 1","44 60 56 48 44 36 32 48"],["YES"]],[["-12 -54 -12 33 -99 33 -99 -54","-77 -40 -86 -31 -77 -22 -68 -31"],["YES"]],[["3 45 19 45 19 61 3 61","-29 45 -13 29 3 45 -13 61"],["YES"]],[["79 -19 79 15 45 15 45 -19","-1 24 -29 52 -1 80 27 52"],["NO"]],[["75 -57 75 -21 39 -21 39 -57","10 -42 -32 0 10 42 52 0"],["NO"]],[["-11 53 9 53 9 73 -11 73","-10 9 -43 42 -10 75 23 42"],["YES"]],[["-10 -36 -10 27 -73 27 -73 -36","44 -28 71 -55 44 -82 17 -55"],["NO"]],[["-63 -15 6 -15 6 54 -63 54","15 -13 -8 10 15 33 38 10"],["YES"]],[["47 15 51 15 51 19 47 19","19 0 -27 46 19 92 65 46"],["NO"]],[["87 -5 87 79 3 79 3 -5","36 36 78 -6 36 -48 -6 -6"],["YES"]],[["-4 56 10 56 10 70 -4 70","-11 47 -35 71 -11 95 13 71"],["YES"]],[["-41 6 -41 8 -43 8 -43 6","-7 27 43 -23 -7 -73 -57 -23"],["NO"]],[["44 -58 44 7 -21 7 -21 -58","22 19 47 -6 22 -31 -3 -6"],["YES"]],[["-37 -63 49 -63 49 23 -37 23","-52 68 -21 37 -52 6 -83 37"],["YES"]],[["93 20 93 55 58 55 58 20","61 -17 39 5 61 27 83 5"],["YES"]],[["-7 4 -7 58 -61 58 -61 4","-28 45 -17 34 -28 23 -39 34"],["YES"]],[["24 -79 87 -79 87 -16 24 -16","-59 21 -85 47 -59 73 -33 47"],["NO"]],[["-68 -15 6 -15 6 59 -68 59","48 -18 57 -27 48 -36 39 -27"],["NO"]],[["25 1 25 91 -65 91 -65 1","24 3 15 12 24 21 33 12"],["YES"]],[["55 24 73 24 73 42 55 42","49 17 10 56 49 95 88 56"],["YES"]],[["69 -65 69 -28 32 -28 32 -65","-1 50 43 6 -1 -38 -45 6"],["NO"]],[["86 -26 86 18 42 18 42 -26","3 -22 -40 21 3 64 46 21"],["YES"]],[["52 -47 52 -30 35 -30 35 -47","49 -22 64 -37 49 -52 34 -37"],["YES"]],[["27 -59 27 9 -41 9 -41 -59","-10 -17 2 -29 -10 -41 -22 -29"],["YES"]],[["-90 2 0 2 0 92 -90 92","-66 31 -86 51 -66 71 -46 51"],["YES"]],[["-93 -86 -85 -86 -85 -78 -93 -78","-13 61 0 48 -13 35 -26 48"],["NO"]],[["-3 -45 85 -45 85 43 -3 43","-22 0 -66 44 -22 88 22 44"],["YES"]],[["-27 -73 72 -73 72 26 -27 26","58 11 100 -31 58 -73 16 -31"],["YES"]],[["-40 -31 8 -31 8 17 -40 17","0 18 -35 53 0 88 35 53"],["NO"]],[["-15 -63 -15 7 -85 7 -85 -63","-35 -40 -33 -42 -35 -44 -37 -42"],["YES"]],[["-100 -100 -100 100 100 100 100 -100","-100 0 0 100 100 0 0 -100"],["YES"]],[["67 33 67 67 33 67 33 33","43 11 9 45 43 79 77 45"],["YES"]],[["14 8 9 8 9 3 14 3","-2 -13 14 3 30 -13 14 -29"],["YES"]],[["4 3 7 3 7 6 4 6","7 29 20 16 7 3 -6 16"],["YES"]],[["14 30 3 30 3 19 14 19","19 -13 11 -5 19 3 27 -5"],["NO"]],[["-54 3 -50 3 -50 -1 -54 -1","3 -50 -6 -41 -15 -50 -6 -59"],["NO"]],[["3 8 3 -10 21 -10 21 8","-9 2 -21 -10 -9 -22 3 -10"],["YES"]],[["-35 3 -21 3 -21 -11 -35 -11","-8 -10 3 -21 -8 -32 -19 -21"],["NO"]],[["-5 -23 -5 -31 3 -31 3 -23","-7 -23 -2 -28 3 -23 -2 -18"],["YES"]],[["3 20 10 20 10 13 3 13","3 20 21 38 39 20 21 2"],["YES"]],[["25 3 16 3 16 12 25 12","21 -2 16 -7 11 -2 16 3"],["YES"]],[["-1 18 -1 3 14 3 14 18","14 3 19 8 14 13 9 8"],["YES"]],[["-44 -17 -64 -17 -64 3 -44 3","-56 15 -44 27 -32 15 -44 3"],["YES"]],[["17 3 2 3 2 18 17 18","22 23 2 3 -18 23 2 43"],["YES"]],[["3 -22 3 -36 -11 -36 -11 -22","11 -44 19 -36 11 -28 3 -36"],["YES"]],[["3 45 3 48 0 48 0 45","13 38 4 47 13 56 22 47"],["NO"]],[["3 -10 2 -10 2 -9 3 -9","38 -10 20 -28 2 -10 20 8"],["YES"]],[["-66 3 -47 3 -47 22 -66 22","-52 -2 -45 5 -52 12 -59 5"],["YES"]],[["3 37 -1 37 -1 41 3 41","6 31 9 34 6 37 3 34"],["NO"]],[["13 1 15 1 15 3 13 3","13 19 21 11 13 3 5 11"],["YES"]],[["20 8 3 8 3 -9 20 -9","2 -11 3 -10 2 -9 1 -10"],["NO"]],[["3 41 3 21 -17 21 -17 41","26 12 10 28 26 44 42 28"],["NO"]],[["11 11 11 3 3 3 3 11","-12 26 -27 11 -12 -4 3 11"],["YES"]],[["-29 3 -29 12 -38 12 -38 3","-35 9 -29 15 -23 9 -29 3"],["YES"]],[["3 -32 1 -32 1 -30 3 -30","4 -32 -16 -52 -36 -32 -16 -12"],["YES"]],[["-16 -10 -16 9 3 9 3 -10","-8 -1 2 9 12 -1 2 -11"],["YES"]],[["3 -42 -5 -42 -5 -34 3 -34","-8 -54 -19 -43 -8 -32 3 -43"],["YES"]],[["-47 3 -37 3 -37 -7 -47 -7","-37 3 -33 -1 -37 -5 -41 -1"],["YES"]],[["10 3 12 3 12 5 10 5","12 4 20 12 12 20 4 12"],["YES"]],[["3 -41 -9 -41 -9 -53 3 -53","18 -16 38 -36 18 -56 -2 -36"],["YES"]],[["3 40 2 40 2 41 3 41","22 39 13 48 4 39 13 30"],["NO"]],[["21 26 21 44 3 44 3 26","-20 38 -32 26 -20 14 -8 26"],["NO"]],[["0 7 3 7 3 10 0 10","3 9 -17 29 -37 9 -17 -11"],["YES"]],[["3 21 3 18 6 18 6 21","-27 18 -11 2 5 18 -11 34"],["YES"]],[["-29 13 -39 13 -39 3 -29 3","-36 -4 -50 -18 -36 -32 -22 -18"],["NO"]],[["3 -26 -2 -26 -2 -21 3 -21","-5 -37 -16 -26 -5 -15 6 -26"],["YES"]],[["3 9 -1 9 -1 13 3 13","-9 17 -1 9 -9 1 -17 9"],["YES"]],[["48 8 43 8 43 3 48 3","31 -4 43 8 55 -4 43 -16"],["YES"]],[["-3 1 3 1 3 -5 -3 -5","20 -22 3 -5 20 12 37 -5"],["YES"]],[["14 3 14 -16 -5 -16 -5 3","14 2 15 1 14 0 13 1"],["YES"]],[["-10 12 -10 -1 3 -1 3 12","1 10 -2 7 -5 10 -2 13"],["YES"]],[["39 21 21 21 21 3 39 3","27 3 47 -17 27 -37 7 -17"],["YES"]],[["3 1 3 17 -13 17 -13 1","17 20 10 27 3 20 10 13"],["NO"]],[["15 -18 3 -18 3 -6 15 -6","29 -1 16 -14 3 -1 16 12"],["YES"]],[["41 -6 41 3 32 3 32 -6","33 3 35 5 33 7 31 5"],["YES"]],[["7 35 3 35 3 39 7 39","23 15 3 35 23 55 43 35"],["YES"]],[["19 19 35 19 35 3 19 3","25 -9 16 -18 7 -9 16 0"],["NO"]],[["-20 3 -20 9 -26 9 -26 3","-19 4 -21 2 -19 0 -17 2"],["YES"]],[["13 3 22 3 22 -6 13 -6","26 3 22 -1 18 3 22 7"],["YES"]],[["-4 -8 -4 -15 3 -15 3 -8","-10 5 -27 -12 -10 -29 7 -12"],["YES"]],[["3 15 7 15 7 19 3 19","-12 30 -23 19 -12 8 -1 19"],["NO"]],[["-12 3 5 3 5 -14 -12 -14","-14 22 5 3 24 22 5 41"],["YES"]],[["-37 3 -17 3 -17 -17 -37 -17","-9 -41 9 -23 -9 -5 -27 -23"],["YES"]],[["3 57 3 45 -9 45 -9 57","8 50 21 37 8 24 -5 37"],["YES"]],[["42 3 42 -6 33 -6 33 3","42 4 41 3 40 4 41 5"],["YES"]],[["3 59 3 45 -11 45 -11 59","-2 50 -8 44 -2 38 4 44"],["YES"]],[["-51 3 -39 3 -39 15 -51 15","-39 14 -53 0 -39 -14 -25 0"],["YES"]],[["-7 -15 -7 3 11 3 11 -15","15 -1 22 -8 15 -15 8 -8"],["YES"]],[["3 -39 14 -39 14 -50 3 -50","17 -39 5 -27 -7 -39 5 -51"],["YES"]],[["91 -27 91 29 35 29 35 -27","59 39 95 3 59 -33 23 3"],["YES"]],[["-81 -60 -31 -60 -31 -10 -81 -10","-58 -68 -95 -31 -58 6 -21 -31"],["YES"]],[["78 -59 78 -2 21 -2 21 -59","48 1 86 -37 48 -75 10 -37"],["YES"]],[["-38 -26 32 -26 32 44 -38 44","2 -27 -44 19 2 65 48 19"],["YES"]],[["73 -54 73 -4 23 -4 23 -54","47 1 77 -29 47 -59 17 -29"],["YES"]],[["-6 -25 46 -25 46 27 -6 27","21 -43 -21 -1 21 41 63 -1"],["YES"]],[["-17 -91 -17 -27 -81 -27 -81 -91","-48 -21 -12 -57 -48 -93 -84 -57"],["YES"]],[["-7 16 43 16 43 66 -7 66","18 -7 -27 38 18 83 63 38"],["YES"]],[["-46 11 16 11 16 73 -46 73","-18 -8 -67 41 -18 90 31 41"],["YES"]],[["-33 -64 25 -64 25 -6 -33 -6","-5 -74 -51 -28 -5 18 41 -28"],["YES"]],[["99 -100 100 -100 100 -99 99 -99","99 -99 100 -98 99 -97 98 -98"],["YES"]],[["-100 -100 -100 -99 -99 -99 -99 -100","-10 -10 -9 -9 -10 -8 -11 -9"],["NO"]],[["-4 3 -3 3 -3 4 -4 4","0 -4 4 0 0 4 -4 0"],["NO"]],[["0 0 10 0 10 10 0 10","11 9 13 7 15 9 13 11"],["NO"]],[["1 1 1 6 6 6 6 1","5 8 8 11 11 8 8 5"],["NO"]],[["99 99 99 100 100 100 100 99","-100 0 0 100 100 0 0 -100"],["NO"]],[["0 0 0 2 2 2 2 0","5 1 9 5 5 9 1 5"],["NO"]],[["3 2 3 3 4 3 4 2","0 4 4 0 0 -4 -4 0"],["NO"]],[["0 0 2 0 2 2 0 2","4 1 7 4 4 7 1 4"],["NO"]],[["3 6 3 8 5 8 5 6","2 9 4 11 6 9 4 7"],["YES"]],[["0 0 10 0 10 10 0 10","-1 5 5 -1 11 5 5 11"],["YES"]],[["0 0 1 0 1 1 0 1","3 0 6 3 3 6 0 3"],["NO"]],[["3 7 4 7 4 6 3 6","0 0 10 10 20 0 10 -10"],["NO"]],[["0 0 0 1 1 1 1 0","0 3 3 6 6 3 3 0"],["NO"]],[["0 0 0 4 4 4 4 0","3 6 7 10 11 6 7 2"],["NO"]],[["0 0 0 1 1 1 1 0","0 10 10 0 20 10 10 20"],["NO"]]]}} +{"instance_id":"pseudo_to_code_2k_46","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integer adj of size 1000 with array of size 1000\ndeclare swap taking in floats &a and &b\n if b is less than a\n create float temp = b\n set b to a\n set a to temp\n end of the block\n return\nend of the block\ndeclare inside taking in float arrays p of size 2 and s of size 4 with array of size 2 and returning bool\n if s[0][0] is equal to s[1][0]\n create float l = s[0][0] and u = s[2][0]\n swap values of l and u\n if p[0] is less than or equal to u and p[0] is greater than or equal to 1\n set l to s[0][1]\n set u to s[1][1]\n swap values of l and u\n if p[1] is greater than or equal to 1 and p[1] is less than or equal to u\n return true\n otherwise do\n return false\n else do\n return false\n end of the block\n else\n make floats l = s[0][1] and u = s[2][1]\n swap values of l and u\n if p[1] is less than or equal to u and p[1] is greater than or equal to 1\n set l to s[0][0]\n set u to s[1][0]\n swap values of l and u\n if p[0] is greater than or equal to 1 and p[0] is less than or equal to u\n return true\n else\n return false\n otherwise\n return false\n end of the block\n end of the block\nend of the block\ndefine the main function\n make float arrays p1 of size 4 with array of size 2 and p2 of size 4 with array of size 2\n for i = 0 to (4) exclusive\n for j = 0 to (2) exclusive, read p1[i][j]\n end of the block\n for i = 0 to (4) exclusive\n for j = 0 to (2) exclusive, read p2[i][j]\n end of the block\n create bool ans = false\n for i = 0 to (4) exclusive\n if inside(p2[i], p1) is truthy, set ans to true\n end of the block\n make float array p of size 2 containing {0, 0}\n for i = 0 to (4) exclusive\n set p[0] to p[0] + p2[i][0]\n set p[1] to p[1] + p2[i][1]\n end of the block\n set p[0] to p[0] * 1.0 \/ 4\n set p[1] to p[1] * 1.0 \/ 4\n if inside(p, p1) is truthy, set ans to true\n for i = 0 to (4) exclusive\n make floats x = p1[i][0] - p1[i][1] and y = p1[i][0] + p1[i][1]\n set p1[i][0] to x\n set p1[i][1] to y\n end of the block\n for i = 0 to (4) exclusive\n make floats x = p2[i][0] - p2[i][1] and y = p2[i][0] + p2[i][1]\n set p2[i][0] to x\n set p2[i][1] to y\n end of the block\n for i = 0 to (4) exclusive\n if inside(p1[i], p2) is truthy, set ans to true\n end of the block\n if ans is truthy\n print \"YES\\n\"\n else do\n show \"NO\\n\"\n end of the block\nend of the block\n\n[CODE]:","reference_output":"int adj[1000][1000];\nvoid swap(float &a, float &b) {\n if (b < a) {\n float temp = b;\n b = a;\n a = temp;\n }\n return;\n}\nbool inside(float p[2], float s[4][2]) {\n if (s[0][0] == s[1][0]) {\n float l = s[0][0], u = s[2][0];\n swap(l, u);\n if (p[0] <= u && p[0] >= l) {\n l = s[0][1];\n u = s[1][1];\n swap(l, u);\n if (p[1] >= l && p[1] <= u) {\n return true;\n } else\n return false;\n } else {\n return false;\n }\n } else {\n float l = s[0][1], u = s[2][1];\n swap(l, u);\n if (p[1] <= u && p[1] >= l) {\n l = s[0][0];\n u = s[1][0];\n swap(l, u);\n if (p[0] >= l && p[0] <= u) {\n return true;\n } else\n return false;\n } else {\n return false;\n }\n }\n}\nint main() {\n float p1[4][2], p2[4][2];\n for (int i = 0; i < (4); i++) {\n for (int j = 0; j < (2); j++) cin >> p1[i][j];\n }\n for (int i = 0; i < (4); i++) {\n for (int j = 0; j < (2); j++) cin >> p2[i][j];\n }\n bool ans = false;\n for (int i = 0; i < (4); i++) {\n if (inside(p2[i], p1)) ans = true;\n }\n float p[2] = {0, 0};\n for (int i = 0; i < (4); i++) {\n p[0] += p2[i][0];\n p[1] += p2[i][1];\n }\n p[0] = p[0] * 1.0 \/ 4;\n p[1] = p[1] * 1.0 \/ 4;\n if (inside(p, p1)) ans = true;\n for (int i = 0; i < (4); i++) {\n float x = p1[i][0] - p1[i][1], y = p1[i][0] + p1[i][1];\n p1[i][0] = x;\n p1[i][1] = y;\n }\n for (int i = 0; i < (4); i++) {\n float x = p2[i][0] - p2[i][1], y = p2[i][0] + p2[i][1];\n p2[i][0] = x;\n p2[i][1] = y;\n }\n for (int i = 0; i < (4); i++) {\n if (inside(p1[i], p2)) ans = true;\n }\n if (ans) {\n cout << \"YES\\n\";\n } else {\n cout << \"NO\\n\";\n }\n}","item":{"problem_id":"993A","pseudocode":"create integer adj of size 1000 with array of size 1000\ndeclare swap taking in floats &a and &b\n if b is less than a\n create float temp = b\n set b to a\n set a to temp\n end of the block\n return\nend of the block\ndeclare inside taking in float arrays p of size 2 and s of size 4 with array of size 2 and returning bool\n if s[0][0] is equal to s[1][0]\n create float l = s[0][0] and u = s[2][0]\n swap values of l and u\n if p[0] is less than or equal to u and p[0] is greater than or equal to 1\n set l to s[0][1]\n set u to s[1][1]\n swap values of l and u\n if p[1] is greater than or equal to 1 and p[1] is less than or equal to u\n return true\n otherwise do\n return false\n else do\n return false\n end of the block\n else\n make floats l = s[0][1] and u = s[2][1]\n swap values of l and u\n if p[1] is less than or equal to u and p[1] is greater than or equal to 1\n set l to s[0][0]\n set u to s[1][0]\n swap values of l and u\n if p[0] is greater than or equal to 1 and p[0] is less than or equal to u\n return true\n else\n return false\n otherwise\n return false\n end of the block\n end of the block\nend of the block\ndefine the main function\n make float arrays p1 of size 4 with array of size 2 and p2 of size 4 with array of size 2\n for i = 0 to (4) exclusive\n for j = 0 to (2) exclusive, read p1[i][j]\n end of the block\n for i = 0 to (4) exclusive\n for j = 0 to (2) exclusive, read p2[i][j]\n end of the block\n create bool ans = false\n for i = 0 to (4) exclusive\n if inside(p2[i], p1) is truthy, set ans to true\n end of the block\n make float array p of size 2 containing {0, 0}\n for i = 0 to (4) exclusive\n set p[0] to p[0] + p2[i][0]\n set p[1] to p[1] + p2[i][1]\n end of the block\n set p[0] to p[0] * 1.0 \/ 4\n set p[1] to p[1] * 1.0 \/ 4\n if inside(p, p1) is truthy, set ans to true\n for i = 0 to (4) exclusive\n make floats x = p1[i][0] - p1[i][1] and y = p1[i][0] + p1[i][1]\n set p1[i][0] to x\n set p1[i][1] to y\n end of the block\n for i = 0 to (4) exclusive\n make floats x = p2[i][0] - p2[i][1] and y = p2[i][0] + p2[i][1]\n set p2[i][0] to x\n set p2[i][1] to y\n end of the block\n for i = 0 to (4) exclusive\n if inside(p1[i], p2) is truthy, set ans to true\n end of the block\n if ans is truthy\n print \"YES\\n\"\n else do\n show \"NO\\n\"\n end of the block\nend of the block","testcases":[[["0 0 6 0 6 6 0 6","1 3 3 5 5 3 3 1"],["YES"]],[["0 0 6 0 6 6 0 6","7 3 9 5 11 3 9 1"],["NO"]],[["6 0 6 6 0 6 0 0","7 4 4 7 7 10 10 7"],["YES"]],[["0 0 6 0 6 6 0 6","8 4 4 8 8 12 12 8"],["YES"]],[["2 2 4 2 4 4 2 4","0 3 3 6 6 3 3 0"],["YES"]],[["-5 -5 5 -5 5 5 -5 5","-5 7 0 2 5 7 0 12"],["YES"]],[["-5 -5 5 -5 5 5 -5 5","-5 12 0 7 5 12 0 17"],["NO"]],[["-5 -5 5 -5 5 5 -5 5","6 0 0 6 -6 0 0 -6"],["YES"]],[["-100 -100 100 -100 100 100 -100 100","-100 0 0 -100 100 0 0 100"],["YES"]],[["92 1 92 98 -5 98 -5 1","44 60 56 48 44 36 32 48"],["YES"]],[["-12 -54 -12 33 -99 33 -99 -54","-77 -40 -86 -31 -77 -22 -68 -31"],["YES"]],[["3 45 19 45 19 61 3 61","-29 45 -13 29 3 45 -13 61"],["YES"]],[["79 -19 79 15 45 15 45 -19","-1 24 -29 52 -1 80 27 52"],["NO"]],[["75 -57 75 -21 39 -21 39 -57","10 -42 -32 0 10 42 52 0"],["NO"]],[["-11 53 9 53 9 73 -11 73","-10 9 -43 42 -10 75 23 42"],["YES"]],[["-10 -36 -10 27 -73 27 -73 -36","44 -28 71 -55 44 -82 17 -55"],["NO"]],[["-63 -15 6 -15 6 54 -63 54","15 -13 -8 10 15 33 38 10"],["YES"]],[["47 15 51 15 51 19 47 19","19 0 -27 46 19 92 65 46"],["NO"]],[["87 -5 87 79 3 79 3 -5","36 36 78 -6 36 -48 -6 -6"],["YES"]],[["-4 56 10 56 10 70 -4 70","-11 47 -35 71 -11 95 13 71"],["YES"]],[["-41 6 -41 8 -43 8 -43 6","-7 27 43 -23 -7 -73 -57 -23"],["NO"]],[["44 -58 44 7 -21 7 -21 -58","22 19 47 -6 22 -31 -3 -6"],["YES"]],[["-37 -63 49 -63 49 23 -37 23","-52 68 -21 37 -52 6 -83 37"],["YES"]],[["93 20 93 55 58 55 58 20","61 -17 39 5 61 27 83 5"],["YES"]],[["-7 4 -7 58 -61 58 -61 4","-28 45 -17 34 -28 23 -39 34"],["YES"]],[["24 -79 87 -79 87 -16 24 -16","-59 21 -85 47 -59 73 -33 47"],["NO"]],[["-68 -15 6 -15 6 59 -68 59","48 -18 57 -27 48 -36 39 -27"],["NO"]],[["25 1 25 91 -65 91 -65 1","24 3 15 12 24 21 33 12"],["YES"]],[["55 24 73 24 73 42 55 42","49 17 10 56 49 95 88 56"],["YES"]],[["69 -65 69 -28 32 -28 32 -65","-1 50 43 6 -1 -38 -45 6"],["NO"]],[["86 -26 86 18 42 18 42 -26","3 -22 -40 21 3 64 46 21"],["YES"]],[["52 -47 52 -30 35 -30 35 -47","49 -22 64 -37 49 -52 34 -37"],["YES"]],[["27 -59 27 9 -41 9 -41 -59","-10 -17 2 -29 -10 -41 -22 -29"],["YES"]],[["-90 2 0 2 0 92 -90 92","-66 31 -86 51 -66 71 -46 51"],["YES"]],[["-93 -86 -85 -86 -85 -78 -93 -78","-13 61 0 48 -13 35 -26 48"],["NO"]],[["-3 -45 85 -45 85 43 -3 43","-22 0 -66 44 -22 88 22 44"],["YES"]],[["-27 -73 72 -73 72 26 -27 26","58 11 100 -31 58 -73 16 -31"],["YES"]],[["-40 -31 8 -31 8 17 -40 17","0 18 -35 53 0 88 35 53"],["NO"]],[["-15 -63 -15 7 -85 7 -85 -63","-35 -40 -33 -42 -35 -44 -37 -42"],["YES"]],[["-100 -100 -100 100 100 100 100 -100","-100 0 0 100 100 0 0 -100"],["YES"]],[["67 33 67 67 33 67 33 33","43 11 9 45 43 79 77 45"],["YES"]],[["14 8 9 8 9 3 14 3","-2 -13 14 3 30 -13 14 -29"],["YES"]],[["4 3 7 3 7 6 4 6","7 29 20 16 7 3 -6 16"],["YES"]],[["14 30 3 30 3 19 14 19","19 -13 11 -5 19 3 27 -5"],["NO"]],[["-54 3 -50 3 -50 -1 -54 -1","3 -50 -6 -41 -15 -50 -6 -59"],["NO"]],[["3 8 3 -10 21 -10 21 8","-9 2 -21 -10 -9 -22 3 -10"],["YES"]],[["-35 3 -21 3 -21 -11 -35 -11","-8 -10 3 -21 -8 -32 -19 -21"],["NO"]],[["-5 -23 -5 -31 3 -31 3 -23","-7 -23 -2 -28 3 -23 -2 -18"],["YES"]],[["3 20 10 20 10 13 3 13","3 20 21 38 39 20 21 2"],["YES"]],[["25 3 16 3 16 12 25 12","21 -2 16 -7 11 -2 16 3"],["YES"]],[["-1 18 -1 3 14 3 14 18","14 3 19 8 14 13 9 8"],["YES"]],[["-44 -17 -64 -17 -64 3 -44 3","-56 15 -44 27 -32 15 -44 3"],["YES"]],[["17 3 2 3 2 18 17 18","22 23 2 3 -18 23 2 43"],["YES"]],[["3 -22 3 -36 -11 -36 -11 -22","11 -44 19 -36 11 -28 3 -36"],["YES"]],[["3 45 3 48 0 48 0 45","13 38 4 47 13 56 22 47"],["NO"]],[["3 -10 2 -10 2 -9 3 -9","38 -10 20 -28 2 -10 20 8"],["YES"]],[["-66 3 -47 3 -47 22 -66 22","-52 -2 -45 5 -52 12 -59 5"],["YES"]],[["3 37 -1 37 -1 41 3 41","6 31 9 34 6 37 3 34"],["NO"]],[["13 1 15 1 15 3 13 3","13 19 21 11 13 3 5 11"],["YES"]],[["20 8 3 8 3 -9 20 -9","2 -11 3 -10 2 -9 1 -10"],["NO"]],[["3 41 3 21 -17 21 -17 41","26 12 10 28 26 44 42 28"],["NO"]],[["11 11 11 3 3 3 3 11","-12 26 -27 11 -12 -4 3 11"],["YES"]],[["-29 3 -29 12 -38 12 -38 3","-35 9 -29 15 -23 9 -29 3"],["YES"]],[["3 -32 1 -32 1 -30 3 -30","4 -32 -16 -52 -36 -32 -16 -12"],["YES"]],[["-16 -10 -16 9 3 9 3 -10","-8 -1 2 9 12 -1 2 -11"],["YES"]],[["3 -42 -5 -42 -5 -34 3 -34","-8 -54 -19 -43 -8 -32 3 -43"],["YES"]],[["-47 3 -37 3 -37 -7 -47 -7","-37 3 -33 -1 -37 -5 -41 -1"],["YES"]],[["10 3 12 3 12 5 10 5","12 4 20 12 12 20 4 12"],["YES"]],[["3 -41 -9 -41 -9 -53 3 -53","18 -16 38 -36 18 -56 -2 -36"],["YES"]],[["3 40 2 40 2 41 3 41","22 39 13 48 4 39 13 30"],["NO"]],[["21 26 21 44 3 44 3 26","-20 38 -32 26 -20 14 -8 26"],["NO"]],[["0 7 3 7 3 10 0 10","3 9 -17 29 -37 9 -17 -11"],["YES"]],[["3 21 3 18 6 18 6 21","-27 18 -11 2 5 18 -11 34"],["YES"]],[["-29 13 -39 13 -39 3 -29 3","-36 -4 -50 -18 -36 -32 -22 -18"],["NO"]],[["3 -26 -2 -26 -2 -21 3 -21","-5 -37 -16 -26 -5 -15 6 -26"],["YES"]],[["3 9 -1 9 -1 13 3 13","-9 17 -1 9 -9 1 -17 9"],["YES"]],[["48 8 43 8 43 3 48 3","31 -4 43 8 55 -4 43 -16"],["YES"]],[["-3 1 3 1 3 -5 -3 -5","20 -22 3 -5 20 12 37 -5"],["YES"]],[["14 3 14 -16 -5 -16 -5 3","14 2 15 1 14 0 13 1"],["YES"]],[["-10 12 -10 -1 3 -1 3 12","1 10 -2 7 -5 10 -2 13"],["YES"]],[["39 21 21 21 21 3 39 3","27 3 47 -17 27 -37 7 -17"],["YES"]],[["3 1 3 17 -13 17 -13 1","17 20 10 27 3 20 10 13"],["NO"]],[["15 -18 3 -18 3 -6 15 -6","29 -1 16 -14 3 -1 16 12"],["YES"]],[["41 -6 41 3 32 3 32 -6","33 3 35 5 33 7 31 5"],["YES"]],[["7 35 3 35 3 39 7 39","23 15 3 35 23 55 43 35"],["YES"]],[["19 19 35 19 35 3 19 3","25 -9 16 -18 7 -9 16 0"],["NO"]],[["-20 3 -20 9 -26 9 -26 3","-19 4 -21 2 -19 0 -17 2"],["YES"]],[["13 3 22 3 22 -6 13 -6","26 3 22 -1 18 3 22 7"],["YES"]],[["-4 -8 -4 -15 3 -15 3 -8","-10 5 -27 -12 -10 -29 7 -12"],["YES"]],[["3 15 7 15 7 19 3 19","-12 30 -23 19 -12 8 -1 19"],["NO"]],[["-12 3 5 3 5 -14 -12 -14","-14 22 5 3 24 22 5 41"],["YES"]],[["-37 3 -17 3 -17 -17 -37 -17","-9 -41 9 -23 -9 -5 -27 -23"],["YES"]],[["3 57 3 45 -9 45 -9 57","8 50 21 37 8 24 -5 37"],["YES"]],[["42 3 42 -6 33 -6 33 3","42 4 41 3 40 4 41 5"],["YES"]],[["3 59 3 45 -11 45 -11 59","-2 50 -8 44 -2 38 4 44"],["YES"]],[["-51 3 -39 3 -39 15 -51 15","-39 14 -53 0 -39 -14 -25 0"],["YES"]],[["-7 -15 -7 3 11 3 11 -15","15 -1 22 -8 15 -15 8 -8"],["YES"]],[["3 -39 14 -39 14 -50 3 -50","17 -39 5 -27 -7 -39 5 -51"],["YES"]],[["91 -27 91 29 35 29 35 -27","59 39 95 3 59 -33 23 3"],["YES"]],[["-81 -60 -31 -60 -31 -10 -81 -10","-58 -68 -95 -31 -58 6 -21 -31"],["YES"]],[["78 -59 78 -2 21 -2 21 -59","48 1 86 -37 48 -75 10 -37"],["YES"]],[["-38 -26 32 -26 32 44 -38 44","2 -27 -44 19 2 65 48 19"],["YES"]],[["73 -54 73 -4 23 -4 23 -54","47 1 77 -29 47 -59 17 -29"],["YES"]],[["-6 -25 46 -25 46 27 -6 27","21 -43 -21 -1 21 41 63 -1"],["YES"]],[["-17 -91 -17 -27 -81 -27 -81 -91","-48 -21 -12 -57 -48 -93 -84 -57"],["YES"]],[["-7 16 43 16 43 66 -7 66","18 -7 -27 38 18 83 63 38"],["YES"]],[["-46 11 16 11 16 73 -46 73","-18 -8 -67 41 -18 90 31 41"],["YES"]],[["-33 -64 25 -64 25 -6 -33 -6","-5 -74 -51 -28 -5 18 41 -28"],["YES"]],[["99 -100 100 -100 100 -99 99 -99","99 -99 100 -98 99 -97 98 -98"],["YES"]],[["-100 -100 -100 -99 -99 -99 -99 -100","-10 -10 -9 -9 -10 -8 -11 -9"],["NO"]],[["-4 3 -3 3 -3 4 -4 4","0 -4 4 0 0 4 -4 0"],["NO"]],[["0 0 10 0 10 10 0 10","11 9 13 7 15 9 13 11"],["NO"]],[["1 1 1 6 6 6 6 1","5 8 8 11 11 8 8 5"],["NO"]],[["99 99 99 100 100 100 100 99","-100 0 0 100 100 0 0 -100"],["NO"]],[["0 0 0 2 2 2 2 0","5 1 9 5 5 9 1 5"],["NO"]],[["3 2 3 3 4 3 4 2","0 4 4 0 0 -4 -4 0"],["NO"]],[["0 0 2 0 2 2 0 2","4 1 7 4 4 7 1 4"],["NO"]],[["3 6 3 8 5 8 5 6","2 9 4 11 6 9 4 7"],["YES"]],[["0 0 10 0 10 10 0 10","-1 5 5 -1 11 5 5 11"],["YES"]],[["0 0 1 0 1 1 0 1","3 0 6 3 3 6 0 3"],["NO"]],[["3 7 4 7 4 6 3 6","0 0 10 10 20 0 10 -10"],["NO"]],[["0 0 0 1 1 1 1 0","0 3 3 6 6 3 3 0"],["NO"]],[["0 0 0 4 4 4 4 0","3 6 7 10 11 6 7 2"],["NO"]],[["0 0 0 1 1 1 1 0","0 10 10 0 20 10 10 20"],["NO"]]]}} +{"instance_id":"pseudo_to_code_2k_47","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmake string s\nin function ok with return type boolean and parameter string t\n make int msk = 0\n for i = 0 to (cast t size to int) exclusive\n if isupper(t[i]) then set msk to msk bitwise or 1\n if islower(t[i]) then set msk to msk bitwise or1\n if isdigit(t[i]) then set msk to msk bitwise or 1\n end of the block\n return msk is equal to 7\nend of the block\ndefine the main function\n make integer t\n read t\n for i = 0 to t exclusive\n read s\n if ok(s)\n print s\n continue\n end of the block\n make boolean fnd = false\n for i = 0 to (cast s size to int) exclusive\n make string t = s\n set t[i] to '1'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n set t[i] to 'a'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n set t[i] to 'A'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n end of the block\n if fnd then continue\n if isupper(s[2])\n set s[0] to 'a'\n set s[1] to '1'\n print s\n continue\n end of the block\n if islower(s[2])\n set s[0] to 'A'\n set s[1] to '1'\n print s\n continue\n end of the block\n if isdigit(s[2])\n set s[0] to 'a'\n set s[1] to 'A'\n print s\n continue\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"string s;\nbool ok(string t) {\n int msk = 0;\n for (int i = 0; i < int(t.size()); ++i) {\n if (isupper(t[i])) msk |= 1;\n if (islower(t[i])) msk |= 2;\n if (isdigit(t[i])) msk |= 4;\n }\n return msk == 7;\n}\nint main() {\n int t;\n cin >> t;\n for (int i = 0; i < t; ++i) {\n cin >> s;\n if (ok(s)) {\n cout << s << endl;\n continue;\n }\n bool fnd = false;\n for (int i = 0; i < int(s.size()); ++i) {\n string t = s;\n t[i] = '1';\n if (ok(t)) {\n cout << t << endl;\n fnd = true;\n break;\n }\n t[i] = 'a';\n if (ok(t)) {\n cout << t << endl;\n fnd = true;\n break;\n }\n t[i] = 'A';\n if (ok(t)) {\n cout << t << endl;\n fnd = true;\n break;\n }\n }\n if (fnd) continue;\n if (isupper(s[2])) {\n s[0] = 'a';\n s[1] = '1';\n cout << s << endl;\n continue;\n }\n if (islower(s[2])) {\n s[0] = 'A';\n s[1] = '1';\n cout << s << endl;\n continue;\n }\n if (isdigit(s[2])) {\n s[0] = 'a';\n s[1] = 'A';\n cout << s << endl;\n continue;\n }\n }\n return 0;\n}","item":{"problem_id":"1051A","pseudocode":"make string s\nin function ok with return type boolean and parameter string t\n make int msk = 0\n for i = 0 to (cast t size to int) exclusive\n if isupper(t[i]) then set msk to msk bitwise or 1\n if islower(t[i]) then set msk to msk bitwise or1\n if isdigit(t[i]) then set msk to msk bitwise or 1\n end of the block\n return msk is equal to 7\nend of the block\ndefine the main function\n make integer t\n read t\n for i = 0 to t exclusive\n read s\n if ok(s)\n print s\n continue\n end of the block\n make boolean fnd = false\n for i = 0 to (cast s size to int) exclusive\n make string t = s\n set t[i] to '1'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n set t[i] to 'a'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n set t[i] to 'A'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n end of the block\n if fnd then continue\n if isupper(s[2])\n set s[0] to 'a'\n set s[1] to '1'\n print s\n continue\n end of the block\n if islower(s[2])\n set s[0] to 'A'\n set s[1] to '1'\n print s\n continue\n end of the block\n if isdigit(s[2])\n set s[0] to 'a'\n set s[1] to 'A'\n print s\n continue\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2","abcDCE","htQw27"],["1bcDCE","htQw27"]],[["3","afd","142","TRE"],["A1d","aA2","a1E"]],[["4","YtG3","33Yo","123n","m23m"],["YtG3","33Yo","A23n","A23m"]],[["6","11b","4bh","Beh","TuY","1YJ","P28"],["A1b","4Ah","B1h","1uY","1aJ","Pa8"]],[["1","aAbAcDeF"],["1AbAcDeF"]],[["1","000"],["aA0"]],[["1","a00"],["aA0"]],[["1","M62H"],["a62H"]],[["1","NV641"],["aV641"]],[["1","825"],["aA5"]],[["1","A00"],["Aa0"]],[["1","Gfxqp2"],["Gfxqp2"]],[["1","oypS"],["1ypS"]],[["1","R0FYRZ"],["a0FYRZ"]],[["1","11g9"],["A1g9"]],[["1","0a0"],["Aa0"]],[["1","WK7S"],["aK7S"]],[["1","0aa"],["0Aa"]]]}} +{"instance_id":"pseudo_to_code_2k_48","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmake string s\nin function ok with return type boolean and parameter string t\n make int msk = 0\n for i = 0 to (cast t size to int) exclusive\n if isupper(t[i]) then set msk to msk bitwise or 1\n if islower(t[i]) then set msk to msk bitwise or1\n if isdigit(t[i]) then set msk to msk bitwise or 1\n end of the block\n return msk is equal to 7\nend of the block\ndefine the main function\n make integer t\n read t\n for i = 0 to t exclusive\n read s\n if ok(s)\n print s\n continue\n end of the block\n make boolean fnd = false\n for i = 0 to (cast s size to int) exclusive\n make string t = s\n set t[i] to '1'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n set t[i] to 'a'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n set t[i] to 'A'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n end of the block\n if fnd then continue\n if isupper(s[2])\n set s[0] to 'a'\n set s[1] to '1'\n print s\n continue\n end of the block\n if islower(s[2])\n set s[0] to 'A'\n set s[1] to '1'\n print s\n continue\n end of the block\n if isdigit(s[2])\n set s[0] to 'a'\n set s[1] to 'A'\n print s\n continue\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"string s;\nbool ok(string t) {\n int msk = 0;\n for (int i = 0; i < int(t.size()); ++i) {\n if (isupper(t[i])) msk |= 1;\n if (islower(t[i])) msk |= 2;\n if (isdigit(t[i])) msk |= 4;\n }\n return msk == 7;\n}\nint main() {\n int t;\n cin >> t;\n for (int i = 0; i < t; ++i) {\n cin >> s;\n if (ok(s)) {\n cout << s << endl;\n continue;\n }\n bool fnd = false;\n for (int i = 0; i < int(s.size()); ++i) {\n string t = s;\n t[i] = '1';\n if (ok(t)) {\n cout << t << endl;\n fnd = true;\n break;\n }\n t[i] = 'a';\n if (ok(t)) {\n cout << t << endl;\n fnd = true;\n break;\n }\n t[i] = 'A';\n if (ok(t)) {\n cout << t << endl;\n fnd = true;\n break;\n }\n }\n if (fnd) continue;\n if (isupper(s[2])) {\n s[0] = 'a';\n s[1] = '1';\n cout << s << endl;\n continue;\n }\n if (islower(s[2])) {\n s[0] = 'A';\n s[1] = '1';\n cout << s << endl;\n continue;\n }\n if (isdigit(s[2])) {\n s[0] = 'a';\n s[1] = 'A';\n cout << s << endl;\n continue;\n }\n }\n return 0;\n}","item":{"problem_id":"1051A","pseudocode":"make string s\nin function ok with return type boolean and parameter string t\n make int msk = 0\n for i = 0 to (cast t size to int) exclusive\n if isupper(t[i]) then set msk to msk bitwise or 1\n if islower(t[i]) then set msk to msk bitwise or1\n if isdigit(t[i]) then set msk to msk bitwise or 1\n end of the block\n return msk is equal to 7\nend of the block\ndefine the main function\n make integer t\n read t\n for i = 0 to t exclusive\n read s\n if ok(s)\n print s\n continue\n end of the block\n make boolean fnd = false\n for i = 0 to (cast s size to int) exclusive\n make string t = s\n set t[i] to '1'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n set t[i] to 'a'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n set t[i] to 'A'\n if ok(t)\n print t\n set fnd to true\n break\n end of the block\n end of the block\n if fnd then continue\n if isupper(s[2])\n set s[0] to 'a'\n set s[1] to '1'\n print s\n continue\n end of the block\n if islower(s[2])\n set s[0] to 'A'\n set s[1] to '1'\n print s\n continue\n end of the block\n if isdigit(s[2])\n set s[0] to 'a'\n set s[1] to 'A'\n print s\n continue\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2","abcDCE","htQw27"],["1bcDCE","htQw27"]],[["3","afd","142","TRE"],["A1d","aA2","a1E"]],[["4","YtG3","33Yo","123n","m23m"],["YtG3","33Yo","A23n","A23m"]],[["6","11b","4bh","Beh","TuY","1YJ","P28"],["A1b","4Ah","B1h","1uY","1aJ","Pa8"]],[["1","aAbAcDeF"],["1AbAcDeF"]],[["1","000"],["aA0"]],[["1","a00"],["aA0"]],[["1","M62H"],["a62H"]],[["1","NV641"],["aV641"]],[["1","825"],["aA5"]],[["1","A00"],["Aa0"]],[["1","Gfxqp2"],["Gfxqp2"]],[["1","oypS"],["1ypS"]],[["1","R0FYRZ"],["a0FYRZ"]],[["1","11g9"],["A1g9"]],[["1","0a0"],["Aa0"]],[["1","WK7S"],["aK7S"]],[["1","0aa"],["0Aa"]]]}} +{"instance_id":"pseudo_to_code_2k_49","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare constant integer INF = 1e9 + 10\ndeclare map from integer to character rep\ndeclare integer arrays cnt size 3, tp size 110\ndeclare con with character ch as argument, returning integer\n if 'a' is less than or equal to ch and ch is less than or equal to 'z', return 0 from function\n if 'A' is less than or equal to ch and ch is less than or equal to 'Z', return 1 from function\n return 2\nend of the block\ndefine the main function\n let rep[1] be 'a'\n let rep[2] be 'A'\n let rep[4] be '1'\n declare integer Tst\n read Tst\n while decrement Tst is true\n declare string s\n read s\n declare integer msk = 0\n let cnt[0] be cnt[1] be cnt[2] be 0\n for i = 0 to integer casted size of s exclusive\n let tp[i] be result of run con(s[i])\n let msk be msk bitwise or ( 1 bitshift left tp[i] )\n increment cnt[tp[i]]\n end of the block\n if msk is 7\n print s, '\\n'\n else if result of run __builtin_popcount(msk) is 2\n for i = 0 to integer casted size of s exclusive\n if cnt[tp[i]] is greater than 1\n let s[i] be rep[7 bitwise xor msk]\n end loop\n end of the block\n print s, '\\n'\n else\n declare integer M = 7 bitwise xor msk\n declare integer t = result of run __builtin_ctz(M)\n let M be M bitwise xor ( 1 bitshift left t )\n let s[0] be rep[1 bitshift left t]\n let s[1] be rep[1 bitshift left result of run __builtin_ctz(M)]\n print s, '\\n'\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int INF = 1e9 + 10;\nmap rep;\nint cnt[3], tp[110];\nint con(char ch) {\n if ('a' <= ch && ch <= 'z') return 0;\n if ('A' <= ch && ch <= 'Z') return 1;\n return 2;\n}\nint main() {\n rep[1] = 'a';\n rep[2] = 'A';\n rep[4] = '1';\n int Tst;\n cin >> Tst;\n while (Tst--) {\n string s;\n cin >> s;\n int msk = 0;\n cnt[0] = cnt[1] = cnt[2] = 0;\n for (int i = 0; i < ((int)(s).size()); i++) {\n tp[i] = con(s[i]);\n msk |= 1 << tp[i];\n ++cnt[tp[i]];\n }\n if (msk == 7)\n cout << s << '\\n';\n else if (__builtin_popcount(msk) == 2) {\n for (int i = 0; i < ((int)(s).size()); i++)\n if (cnt[tp[i]] > 1) {\n s[i] = rep[7 ^ msk];\n break;\n }\n cout << s << '\\n';\n } else {\n int M = 7 ^ msk;\n int t = __builtin_ctz(M);\n M ^= 1 << t;\n s[0] = rep[1 << t];\n s[1] = rep[1 << (__builtin_ctz(M))];\n cout << s << '\\n';\n }\n }\n return 0;\n}","item":{"problem_id":"1051A","pseudocode":"declare constant integer INF = 1e9 + 10\ndeclare map from integer to character rep\ndeclare integer arrays cnt size 3, tp size 110\ndeclare con with character ch as argument, returning integer\n if 'a' is less than or equal to ch and ch is less than or equal to 'z', return 0 from function\n if 'A' is less than or equal to ch and ch is less than or equal to 'Z', return 1 from function\n return 2\nend of the block\ndefine the main function\n let rep[1] be 'a'\n let rep[2] be 'A'\n let rep[4] be '1'\n declare integer Tst\n read Tst\n while decrement Tst is true\n declare string s\n read s\n declare integer msk = 0\n let cnt[0] be cnt[1] be cnt[2] be 0\n for i = 0 to integer casted size of s exclusive\n let tp[i] be result of run con(s[i])\n let msk be msk bitwise or ( 1 bitshift left tp[i] )\n increment cnt[tp[i]]\n end of the block\n if msk is 7\n print s, '\\n'\n else if result of run __builtin_popcount(msk) is 2\n for i = 0 to integer casted size of s exclusive\n if cnt[tp[i]] is greater than 1\n let s[i] be rep[7 bitwise xor msk]\n end loop\n end of the block\n print s, '\\n'\n else\n declare integer M = 7 bitwise xor msk\n declare integer t = result of run __builtin_ctz(M)\n let M be M bitwise xor ( 1 bitshift left t )\n let s[0] be rep[1 bitshift left t]\n let s[1] be rep[1 bitshift left result of run __builtin_ctz(M)]\n print s, '\\n'\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2","abcDCE","htQw27"],["1bcDCE","htQw27"]],[["3","afd","142","TRE"],["A1d","aA2","a1E"]],[["4","YtG3","33Yo","123n","m23m"],["YtG3","33Yo","A23n","A23m"]],[["6","11b","4bh","Beh","TuY","1YJ","P28"],["A1b","4Ah","B1h","1uY","1aJ","Pa8"]],[["1","aAbAcDeF"],["1AbAcDeF"]],[["1","000"],["aA0"]],[["1","a00"],["aA0"]],[["1","M62H"],["a62H"]],[["1","NV641"],["aV641"]],[["1","825"],["aA5"]],[["1","A00"],["Aa0"]],[["1","Gfxqp2"],["Gfxqp2"]],[["1","oypS"],["1ypS"]],[["1","R0FYRZ"],["a0FYRZ"]],[["1","11g9"],["A1g9"]],[["1","0a0"],["Aa0"]],[["1","WK7S"],["aK7S"]],[["1","0aa"],["0Aa"]]]}} +{"instance_id":"pseudo_to_code_2k_50","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n n = int\n read n\n let num = 0, chr = 0, CHR = 0 be ints\n str = string\n for i = 0 to n exclusvie\n read str\n for j = 0 to length of str exclusive\n if str at j is between 'a' and 'z' both inclusive\n increment chr\n else if str at j is between 'A' and 'Z' both inclusive\n increment CHR\n else\n increment num\n end of the block\n end of the block\n if chr = and CHR = 0\n insert \"aA\" int str at 0\n call erase on str with args 2, 2\n else if chr and num are both = 0\n insert \"a1\" into str[0]\n call erase on str with args 2, 2\n else if CHR and num are both = 0\n insert \"A1\" into str[0]\n erase 2, 2 form str\n else if chr = 0\n for j = 0 to length of str\n if str at j >= 'A' bit and str[j] <= 'Z' bit and CHR > 1\n insert \"a\" in str at j\n erase j+1, 1 form str\n exit loop\n else if str[j] is >= '0' bit and str[j] <= '9' bit and num > 1\n insert \"a\", j into str\n erase j+1, 1 from str\n exit loop\n end of the block\n end of the block\n else if CHR = 0\n for j = 0 to length of str\n if str at j >= 'a' bit and str[j] <= 'z' bit and chr > 1\n call insert on str with args j, \"A\"\n erase j+1, 1 from str\n exit loop\n else if str at j >= 'a' bit and str[j] <= 'z' bit and num > 1\n call insert on str with args j, \"A\"\n erase j+1, 1 from str\n exit loop\n end of the block\n end of the block\n else if num = 0\n for j = 0 to length of str\n if str at j >= 'a' bit and str[j] <= 'z' bit and chr > 1\n insert j, \"1\" into str\n erase j+1, 1 from str\n exit loop\n else if str at j >= 'A' bit and str[j] <= 'Z' bit and CHR > 1\n insert j, \"1\" into str\n erase j+1, 1 from str\n exit loop\n end of the block\n end of the block\n end of the block\n print str\n set num to 0\n set chr to 0\n set CHR to 0\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int n;\n cin >> n;\n int num = 0, chr = 0, CHR = 0;\n string str;\n for (int i = 0; i < n; i++) {\n cin >> str;\n for (int j = 0; j < str.length(); j++) {\n if (str[j] >= 'a' & str[j] <= 'z') {\n chr++;\n } else if (str[j] >= 'A' & str[j] <= 'Z') {\n CHR++;\n } else {\n num++;\n }\n }\n if (chr == 0 && CHR == 0) {\n str.insert(0, \"aA\");\n str.erase(2, 2);\n } else if (chr == 0 && num == 0) {\n str.insert(0, \"a1\");\n str.erase(2, 2);\n } else if (CHR == 0 && num == 0) {\n str.insert(0, \"A1\");\n str.erase(2, 2);\n } else if (chr == 0) {\n for (int j = 0; j < str.length(); j++) {\n if (str[j] >= 'A' & str[j] <= 'Z' & CHR > 1) {\n str.insert(j, \"a\");\n str.erase(j + 1, 1);\n break;\n } else if (str[j] >= '0' & str[j] <= '9' & num > 1) {\n str.insert(j, \"a\");\n str.erase(j + 1, 1);\n break;\n }\n }\n } else if (CHR == 0) {\n for (int j = 0; j < str.length(); j++) {\n if (str[j] >= 'a' & str[j] <= 'z' & chr > 1) {\n str.insert(j, \"A\");\n str.erase(j + 1, 1);\n break;\n } else if (str[j] >= '0' & str[j] <= '9' & num > 1) {\n str.insert(j, \"A\");\n str.erase(j + 1, 1);\n break;\n }\n }\n } else if (num == 0) {\n for (int j = 0; j < str.length(); j++) {\n if (str[j] >= 'a' & str[j] <= 'z' & chr > 1) {\n str.insert(j, \"1\");\n str.erase(j + 1, 1);\n break;\n } else if (str[j] >= 'A' & str[j] <= 'Z' & CHR > 1) {\n str.insert(j, \"1\");\n str.erase(j + 1, 1);\n break;\n }\n }\n }\n cout << str << endl;\n num = 0;\n chr = 0;\n CHR = 0;\n }\n return 0;\n}","item":{"problem_id":"1051A","pseudocode":"define the main function\n n = int\n read n\n let num = 0, chr = 0, CHR = 0 be ints\n str = string\n for i = 0 to n exclusvie\n read str\n for j = 0 to length of str exclusive\n if str at j is between 'a' and 'z' both inclusive\n increment chr\n else if str at j is between 'A' and 'Z' both inclusive\n increment CHR\n else\n increment num\n end of the block\n end of the block\n if chr = and CHR = 0\n insert \"aA\" int str at 0\n call erase on str with args 2, 2\n else if chr and num are both = 0\n insert \"a1\" into str[0]\n call erase on str with args 2, 2\n else if CHR and num are both = 0\n insert \"A1\" into str[0]\n erase 2, 2 form str\n else if chr = 0\n for j = 0 to length of str\n if str at j >= 'A' bit and str[j] <= 'Z' bit and CHR > 1\n insert \"a\" in str at j\n erase j+1, 1 form str\n exit loop\n else if str[j] is >= '0' bit and str[j] <= '9' bit and num > 1\n insert \"a\", j into str\n erase j+1, 1 from str\n exit loop\n end of the block\n end of the block\n else if CHR = 0\n for j = 0 to length of str\n if str at j >= 'a' bit and str[j] <= 'z' bit and chr > 1\n call insert on str with args j, \"A\"\n erase j+1, 1 from str\n exit loop\n else if str at j >= 'a' bit and str[j] <= 'z' bit and num > 1\n call insert on str with args j, \"A\"\n erase j+1, 1 from str\n exit loop\n end of the block\n end of the block\n else if num = 0\n for j = 0 to length of str\n if str at j >= 'a' bit and str[j] <= 'z' bit and chr > 1\n insert j, \"1\" into str\n erase j+1, 1 from str\n exit loop\n else if str at j >= 'A' bit and str[j] <= 'Z' bit and CHR > 1\n insert j, \"1\" into str\n erase j+1, 1 from str\n exit loop\n end of the block\n end of the block\n end of the block\n print str\n set num to 0\n set chr to 0\n set CHR to 0\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2","abcDCE","htQw27"],["1bcDCE","htQw27"]],[["3","afd","142","TRE"],["A1d","aA2","a1E"]],[["4","YtG3","33Yo","123n","m23m"],["YtG3","33Yo","A23n","A23m"]],[["6","11b","4bh","Beh","TuY","1YJ","P28"],["A1b","4Ah","B1h","1uY","1aJ","Pa8"]],[["1","aAbAcDeF"],["1AbAcDeF"]],[["1","000"],["aA0"]],[["1","a00"],["aA0"]],[["1","M62H"],["a62H"]],[["1","NV641"],["aV641"]],[["1","825"],["aA5"]],[["1","A00"],["Aa0"]],[["1","Gfxqp2"],["Gfxqp2"]],[["1","oypS"],["1ypS"]],[["1","R0FYRZ"],["a0FYRZ"]],[["1","11g9"],["A1g9"]],[["1","0a0"],["Aa0"]],[["1","WK7S"],["aK7S"]],[["1","0aa"],["0Aa"]]]}} +{"instance_id":"pseudo_to_code_2k_51","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare ok with string t as argument, returning boolean\n declare integer msk = 0\n for i = 0 to integer casted size of t exclusive\n if t[i] is upper case, let msk be msk bitwise or 1\n if t[i] is lower case, let msk be msk bitwise or 2\n if t[i] is digit, let msk be msk bitwise or 4\n end of the block\n return mks is 7\nend of the block\ndefine the main function\n declare integer t\n declare string s\n read t\n for i = 0 to t exclusive\n read s\n if result of run ok(s) is true\n print s and newline\n end current loop iteration\n end of the block\n declare boolean fnd = false\n for i = 0 to integer casted size of s exclusive\n deeclare string t = s\n let t[i] be '1'\n if result of run ok(t) is true\n print t, newline\n let fnd be true\n end loop\n end of the block\n let t[i] be 'a'\n if result of run ok(t) is true\n print t, newline\n let fnd be true\n end loop\n end of the block\n let t[i] be 'A'\n if result of run ok(t) is true\n print t, newline\n let fnd be true\n end loop\n end of the block\n end of the block\n if fnd is true, end loop iteration\n if s[2] is upper case\n let s[0] be 'a'\n let s[1] be '1'\n print s, newline\n end loop iteration\n end of the block\n if s[2] is lower case\n let s[0] be 'A'\n let s[1] be '1'\n print s, newline\n end loop iteration\n end of the block\n if s[2] is digit\n let s[0] be 'a'\n let s[1] be 'A'\n print s, newline\n end loop iteration\n end of the block\n end of the block\nend of the block\n\n[CODE]:","reference_output":"bool ok(string t) {\n int msk = 0;\n for (int i = 0; i < int(t.size()); ++i) {\n if (isupper(t[i])) msk |= 1;\n if (islower(t[i])) msk |= 2;\n if (isdigit(t[i])) msk |= 4;\n }\n return msk == 7;\n}\nint main() {\n int t;\n string s;\n cin >> t;\n for (int i = 0; i < t; ++i) {\n cin >> s;\n if (ok(s)) {\n cout << s << endl;\n continue;\n }\n bool fnd = false;\n for (int i = 0; i < int(s.size()); ++i) {\n string t = s;\n t[i] = '1';\n if (ok(t)) {\n cout << t << endl;\n fnd = true;\n break;\n }\n t[i] = 'a';\n if (ok(t)) {\n cout << t << endl;\n fnd = true;\n break;\n }\n t[i] = 'A';\n if (ok(t)) {\n cout << t << endl;\n fnd = true;\n break;\n }\n }\n if (fnd) continue;\n if (isupper(s[2])) {\n s[0] = 'a';\n s[1] = '1';\n cout << s << endl;\n continue;\n }\n if (islower(s[2])) {\n s[0] = 'A';\n s[1] = '1';\n cout << s << endl;\n continue;\n }\n if (isdigit(s[2])) {\n s[0] = 'a';\n s[1] = 'A';\n cout << s << endl;\n continue;\n }\n }\n}","item":{"problem_id":"1051A","pseudocode":"declare ok with string t as argument, returning boolean\n declare integer msk = 0\n for i = 0 to integer casted size of t exclusive\n if t[i] is upper case, let msk be msk bitwise or 1\n if t[i] is lower case, let msk be msk bitwise or 2\n if t[i] is digit, let msk be msk bitwise or 4\n end of the block\n return mks is 7\nend of the block\ndefine the main function\n declare integer t\n declare string s\n read t\n for i = 0 to t exclusive\n read s\n if result of run ok(s) is true\n print s and newline\n end current loop iteration\n end of the block\n declare boolean fnd = false\n for i = 0 to integer casted size of s exclusive\n deeclare string t = s\n let t[i] be '1'\n if result of run ok(t) is true\n print t, newline\n let fnd be true\n end loop\n end of the block\n let t[i] be 'a'\n if result of run ok(t) is true\n print t, newline\n let fnd be true\n end loop\n end of the block\n let t[i] be 'A'\n if result of run ok(t) is true\n print t, newline\n let fnd be true\n end loop\n end of the block\n end of the block\n if fnd is true, end loop iteration\n if s[2] is upper case\n let s[0] be 'a'\n let s[1] be '1'\n print s, newline\n end loop iteration\n end of the block\n if s[2] is lower case\n let s[0] be 'A'\n let s[1] be '1'\n print s, newline\n end loop iteration\n end of the block\n if s[2] is digit\n let s[0] be 'a'\n let s[1] be 'A'\n print s, newline\n end loop iteration\n end of the block\n end of the block\nend of the block","testcases":[[["2","abcDCE","htQw27"],["1bcDCE","htQw27"]],[["3","afd","142","TRE"],["A1d","aA2","a1E"]],[["4","YtG3","33Yo","123n","m23m"],["YtG3","33Yo","A23n","A23m"]],[["6","11b","4bh","Beh","TuY","1YJ","P28"],["A1b","4Ah","B1h","1uY","1aJ","Pa8"]],[["1","aAbAcDeF"],["1AbAcDeF"]],[["1","000"],["aA0"]],[["1","a00"],["aA0"]],[["1","M62H"],["a62H"]],[["1","NV641"],["aV641"]],[["1","825"],["aA5"]],[["1","A00"],["Aa0"]],[["1","Gfxqp2"],["Gfxqp2"]],[["1","oypS"],["1ypS"]],[["1","R0FYRZ"],["a0FYRZ"]],[["1","11g9"],["A1g9"]],[["1","0a0"],["Aa0"]],[["1","WK7S"],["aK7S"]],[["1","0aa"],["0Aa"]]]}} +{"instance_id":"pseudo_to_code_2k_52","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate map of strings to integers M\ncreate 2d array of booleans like with size 7 by 7\ndeclare strings s1, s2 and temp\ncreate integer n and integer array g with size 3\ncreate an array of integers team with size 3\ncreate an array of integers heros with size 7\ncreate integer b1 = INT_MAX and b2= -1\nvoid function back_track with int argument a\n declare integers i and j\n if a is equal to 7\n declare an array of integers count with elements 0, 0, 0\n create ints mx = - and mn = INT_MAX\n for i = 0 to 7 exclusive increment count[heros[i]]\n if count[0], count[1] or count[2] = 0, return\n for i from 0 to 7 exclusive\n declare integer temp = g[heros[i]] \/ count[heros[i]]\n change mx to max of mx and temp\n change mn to min of mn and temp\n end of the block\n if mx - mn is greater than b1, return\n create int likeNum = 0\n loop i from 0 to 7 exclusive\n loop j from 0 to 7 exclusive\n if heros[i] = heros[j] and like[i][j] != 0, increment likeNum by one\n if mx - mn < b1 or mx - mn = b1and likeNum > b2\n set b1 to mx - mn\n set b2 to likeNum\n end of the block\n return\n end of the block\n loop i from 0 to 3 exclusive\n change heros[a] to i\n call back_track(a + 1)\n end of the block\nend of the block\ndefine the main function\n assign 0 to M[\"Anka\"]\n assign 1 to M[\"Chapay\"]\n assign 2 to M[\"Cleo\"]\n assign 3 to M[\"Troll\"]\n assign 4 to M[\"Dracul\"]\n assign 5 to M[\"Snowy\"]\n assign 6 to M[\"Hexadecimal\"]\n loop i from 0 to 7 exclusive\n loop j from 0 to 7 exclusive, change like[i][j] to false\n read n\n while n != 0, decrement it and continue the loop\n read input to s1, temp and s2\n set value of like[M[s1]][M[s2]] to true\n end of the block\n read g[0], g[1] and g[2]\n call back_track(0)\n print b1, ' ' and b2\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"map M;\nbool like[7][7];\nstring s1, s2, temp;\nint n, g[3];\nint team[3];\nint heros[7];\nint b1 = INT_MAX, b2 = -1;\nvoid back_track(int a) {\n int i, j;\n if (a == 7) {\n int count[3] = {0, 0, 0};\n int mx = -1, mn = INT_MAX;\n for (i = 0; i < 7; i++) count[heros[i]]++;\n if (count[0] == 0 || count[1] == 0 || count[2] == 0) return;\n for (i = 0; i < 7; i++) {\n int temp = g[heros[i]] \/ count[heros[i]];\n mx = max(mx, temp);\n mn = min(mn, temp);\n }\n if (mx - mn > b1) return;\n int likeNum = 0;\n for (i = 0; i < 7; i++)\n for (j = 0; j < 7; j++)\n if (heros[i] == heros[j] && like[i][j]) likeNum++;\n if ((mx - mn) < b1 || (mx - mn) == b1 && likeNum > b2) {\n b1 = mx - mn;\n b2 = likeNum;\n }\n return;\n }\n for (i = 0; i < 3; i++) {\n heros[a] = i;\n back_track(a + 1);\n }\n}\nint main() {\n M[\"Anka\"] = 0;\n M[\"Chapay\"] = 1;\n M[\"Cleo\"] = 2;\n M[\"Troll\"] = 3;\n M[\"Dracul\"] = 4;\n M[\"Snowy\"] = 5;\n M[\"Hexadecimal\"] = 6;\n for (int i = 0; i < 7; i++)\n for (int j = 0; j < 7; j++) like[i][j] = false;\n cin >> n;\n while (n--) {\n cin >> s1 >> temp >> s2;\n like[M[s1]][M[s2]] = true;\n }\n cin >> g[0] >> g[1] >> g[2];\n back_track(0);\n cout << b1 << ' ' << b2 << endl;\n return 0;\n}","item":{"problem_id":"77A","pseudocode":"create map of strings to integers M\ncreate 2d array of booleans like with size 7 by 7\ndeclare strings s1, s2 and temp\ncreate integer n and integer array g with size 3\ncreate an array of integers team with size 3\ncreate an array of integers heros with size 7\ncreate integer b1 = INT_MAX and b2= -1\nvoid function back_track with int argument a\n declare integers i and j\n if a is equal to 7\n declare an array of integers count with elements 0, 0, 0\n create ints mx = - and mn = INT_MAX\n for i = 0 to 7 exclusive increment count[heros[i]]\n if count[0], count[1] or count[2] = 0, return\n for i from 0 to 7 exclusive\n declare integer temp = g[heros[i]] \/ count[heros[i]]\n change mx to max of mx and temp\n change mn to min of mn and temp\n end of the block\n if mx - mn is greater than b1, return\n create int likeNum = 0\n loop i from 0 to 7 exclusive\n loop j from 0 to 7 exclusive\n if heros[i] = heros[j] and like[i][j] != 0, increment likeNum by one\n if mx - mn < b1 or mx - mn = b1and likeNum > b2\n set b1 to mx - mn\n set b2 to likeNum\n end of the block\n return\n end of the block\n loop i from 0 to 3 exclusive\n change heros[a] to i\n call back_track(a + 1)\n end of the block\nend of the block\ndefine the main function\n assign 0 to M[\"Anka\"]\n assign 1 to M[\"Chapay\"]\n assign 2 to M[\"Cleo\"]\n assign 3 to M[\"Troll\"]\n assign 4 to M[\"Dracul\"]\n assign 5 to M[\"Snowy\"]\n assign 6 to M[\"Hexadecimal\"]\n loop i from 0 to 7 exclusive\n loop j from 0 to 7 exclusive, change like[i][j] to false\n read n\n while n != 0, decrement it and continue the loop\n read input to s1, temp and s2\n set value of like[M[s1]][M[s2]] to true\n end of the block\n read g[0], g[1] and g[2]\n call back_track(0)\n print b1, ' ' and b2\n return to indicate successful execution\nend of the block","testcases":[[["3","Troll likes Dracul","Dracul likes Anka","Snowy likes Hexadecimal","210 200 180"],["30 3"]],[["2","Anka likes Chapay","Chapay likes Anka","10000 50 50"],["1950 2"]],[["11","Snowy likes Dracul","Anka likes Dracul","Chapay likes Snowy","Hexadecimal likes Troll","Anka likes Cleo","Chapay likes Dracul","Anka likes Chapay","Snowy likes Troll","Anka likes Hexadecimal","Cleo likes Chapay","Troll likes Cleo","100 100 100"],["17 5"]],[["14","Chapay likes Cleo","Cleo likes Anka","Dracul likes Snowy","Snowy likes Cleo","Chapay likes Anka","Snowy likes Anka","Chapay likes Troll","Troll likes Anka","Anka likes Snowy","Chapay likes Dracul","Dracul likes Anka","Hexadecimal likes Chapay","Snowy likes Dracul","Cleo likes Dracul","15 15 15"],["2 6"]],[["4","Anka likes Cleo","Snowy likes Cleo","Anka likes Hexadecimal","Cleo likes Snowy","1 1 1"],["0 3"]],[["8","Snowy likes Anka","Hexadecimal likes Snowy","Troll likes Dracul","Hexadecimal likes Troll","Snowy likes Troll","Anka likes Snowy","Snowy likes Chapay","Anka likes Chapay","70 70 70"],["12 5"]],[["0","100 300 600"],["50 0"]],[["3","Chapay likes Hexadecimal","Anka likes Cleo","Troll likes Snowy","15 15000 90"],["2985 2"]],[["0","1 1 10000"],["1999 0"]],[["13","Cleo likes Hexadecimal","Cleo likes Snowy","Hexadecimal likes Anka","Anka likes Snowy","Troll likes Snowy","Chapay likes Hexadecimal","Hexadecimal likes Snowy","Snowy likes Chapay","Troll likes Cleo","Anka likes Hexadecimal","Hexadecimal likes Cleo","Chapay likes Dracul","Snowy likes Dracul","1000000000 2000000000 1000000000"],["166666666 6"]],[["12","Cleo likes Hexadecimal","Chapay likes Anka","Hexadecimal likes Cleo","Anka likes Snowy","Anka likes Cleo","Dracul likes Snowy","Anka likes Troll","Snowy likes Anka","Cleo likes Anka","Hexadecimal likes Troll","Hexadecimal likes Chapay","Snowy likes Troll","1000000000 1 2000000000"],["499999999 7"]],[["0","2000000000 2000000000 2000000000"],["333333334 0"]],[["2","Snowy likes Hexadecimal","Troll likes Dracul","2000000000 2000000000 2000000000"],["333333334 2"]],[["12","Snowy likes Chapay","Cleo likes Dracul","Hexadecimal likes Snowy","Hexadecimal likes Anka","Dracul likes Chapay","Cleo likes Troll","Dracul likes Snowy","Snowy likes Dracul","Troll likes Chapay","Dracul likes Anka","Chapay likes Hexadecimal","Troll likes Dracul","436364663 856574374 347564737"],["111742423 6"]],[["12","Anka likes Dracul","Dracul likes Troll","Cleo likes Troll","Snowy likes Hexadecimal","Hexadecimal likes Chapay","Cleo likes Dracul","Cleo likes Chapay","Hexadecimal likes Anka","Snowy likes Cleo","Hexadecimal likes Snowy","Cleo likes Snowy","Chapay likes Snowy","584329075 428752235 675234087"],["77788420 6"]],[["8","Anka likes Chapay","Dracul likes Snowy","Snowy likes Cleo","Cleo likes Anka","Cleo likes Troll","Hexadecimal likes Troll","Troll likes Cleo","Snowy likes Dracul","325432666 254352394 547360304"],["55277237 6"]],[["18","Snowy likes Troll","Chapay likes Hexadecimal","Cleo likes Snowy","Dracul likes Snowy","Snowy likes Chapay","Troll likes Cleo","Snowy likes Anka","Dracul likes Hexadecimal","Hexadecimal likes Anka","Anka likes Hexadecimal","Anka likes Chapay","Troll likes Anka","Anka likes Snowy","Anka likes Troll","Snowy likes Cleo","Hexadecimal likes Troll","Hexadecimal likes Dracul","Cleo likes Anka","20000 1000 20000"],["5666 8"]],[["6","Chapay likes Troll","Troll likes Cleo","Cleo likes Troll","Chapay likes Snowy","Anka likes Snowy","Troll likes Dracul","987499608 272739716 133573597"],["113301305 5"]],[["6","Anka likes Troll","Troll likes Chapay","Troll likes Hexadecimal","Hexadecimal likes Cleo","Snowy likes Hexadecimal","Chapay likes Troll","740076959 230477703 987799796"],["98788895 5"]],[["17","Cleo likes Dracul","Troll likes Cleo","Anka likes Chapay","Anka likes Troll","Chapay likes Snowy","Troll likes Snowy","Chapay likes Dracul","Hexadecimal likes Snowy","Dracul likes Snowy","Troll likes Hexadecimal","Hexadecimal likes Anka","Cleo likes Snowy","Hexadecimal likes Dracul","Snowy likes Chapay","Snowy likes Hexadecimal","Snowy likes Dracul","Dracul likes Troll","112909524 619275170 403563648"],["88872300 9"]],[["1","Hexadecimal likes Chapay","848189141 631955593 79523012"],["203206701 1"]],[["18","Anka likes Troll","Dracul likes Chapay","Hexadecimal likes Dracul","Chapay likes Dracul","Anka likes Hexadecimal","Snowy likes Cleo","Dracul likes Anka","Snowy likes Anka","Snowy likes Hexadecimal","Dracul likes Troll","Dracul likes Snowy","Hexadecimal likes Anka","Chapay likes Hexadecimal","Snowy likes Dracul","Cleo likes Snowy","Chapay likes Cleo","Anka likes Dracul","Troll likes Anka","838821770 712931449 361810998"],["124167182 8"]],[["18","Hexadecimal likes Chapay","Troll likes Dracul","Troll likes Snowy","Cleo likes Dracul","Chapay likes Snowy","Dracul likes Chapay","Cleo likes Snowy","Dracul likes Hexadecimal","Troll likes Anka","Anka likes Troll","Hexadecimal likes Dracul","Chapay likes Hexadecimal","Cleo likes Chapay","Anka likes Hexadecimal","Snowy likes Dracul","Chapay likes Troll","Anka likes Snowy","Dracul likes Cleo","240256138 922743697 38909902"],["191776022 10"]],[["0","477107314 230715335 261545417"],["43678104 0"]],[["16","Chapay likes Snowy","Hexadecimal likes Anka","Chapay likes Troll","Dracul likes Cleo","Troll likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Cleo","Snowy likes Cleo","Snowy likes Anka","Troll likes Chapay","Snowy likes Hexadecimal","Troll likes Snowy","Cleo likes Hexadecimal","Anka likes Snowy","Snowy likes Chapay","Anka likes Dracul","843382501 58524777 503038818"],["192994632 8"]],[["5","Troll likes Chapay","Anka likes Snowy","Anka likes Dracul","Chapay likes Anka","Snowy likes Troll","709201888 431802832 597079932"],["82638550 3"]],[["18","Cleo likes Snowy","Snowy likes Hexadecimal","Cleo likes Hexadecimal","Troll likes Dracul","Hexadecimal likes Snowy","Dracul likes Troll","Chapay likes Anka","Chapay likes Cleo","Troll likes Chapay","Hexadecimal likes Chapay","Anka likes Snowy","Troll likes Snowy","Dracul likes Snowy","Dracul likes Chapay","Chapay likes Troll","Cleo likes Troll","Hexadecimal likes Cleo","Anka likes Chapay","864225278 509037060 402199775"],["86975205 9"]],[["12","Cleo likes Hexadecimal","Troll likes Cleo","Anka likes Cleo","Hexadecimal likes Troll","Anka likes Snowy","Hexadecimal likes Anka","Troll likes Hexadecimal","Troll likes Anka","Dracul likes Cleo","Cleo likes Troll","Dracul likes Troll","Chapay likes Anka","762445890 377707484 324080158"],["92108551 6"]],[["21","Chapay likes Dracul","Snowy likes Chapay","Snowy likes Troll","Cleo likes Chapay","Cleo likes Troll","Chapay likes Cleo","Snowy likes Anka","Dracul likes Anka","Troll likes Snowy","Snowy likes Cleo","Chapay likes Hexadecimal","Cleo likes Anka","Cleo likes Snowy","Hexadecimal likes Cleo","Hexadecimal likes Snowy","Hexadecimal likes Anka","Hexadecimal likes Troll","Anka likes Snowy","Dracul likes Troll","Chapay likes Anka","Snowy likes Hexadecimal","482557397 502108264 750230216"],["9775434 8"]],[["6","Troll likes Chapay","Hexadecimal likes Snowy","Cleo likes Dracul","Cleo likes Anka","Chapay likes Anka","Anka likes Chapay","758376921 432619768 578580897"],["72980564 5"]],[["5","Chapay likes Cleo","Anka likes Hexadecimal","Anka likes Chapay","Cleo likes Troll","Anka likes Cleo","299076810 225593528 36830738"],["62861532 3"]],[["13","Anka likes Cleo","Cleo likes Troll","Chapay likes Cleo","Snowy likes Troll","Chapay likes Anka","Chapay likes Snowy","Snowy likes Chapay","Anka likes Snowy","Snowy likes Dracul","Cleo likes Hexadecimal","Dracul likes Chapay","Anka likes Hexadecimal","Snowy likes Cleo","554338888 280967932 682619964"],["96188303 7"]],[["17","Hexadecimal likes Chapay","Chapay likes Snowy","Chapay likes Troll","Anka likes Hexadecimal","Cleo likes Troll","Snowy likes Cleo","Cleo likes Anka","Cleo likes Hexadecimal","Anka likes Snowy","Chapay likes Hexadecimal","Anka likes Cleo","Dracul likes Snowy","Chapay likes Anka","Troll likes Hexadecimal","Troll likes Anka","Anka likes Dracul","Hexadecimal likes Anka","828886798 548024213 166661324"],["107350782 9"]],[["2","Troll likes Cleo","Anka likes Cleo","14344913 559182022 405430772"],["172049094 2"]],[["22","Cleo likes Snowy","Cleo likes Troll","Chapay likes Dracul","Snowy likes Troll","Dracul likes Chapay","Dracul likes Snowy","Chapay likes Cleo","Snowy likes Chapay","Dracul likes Troll","Anka likes Hexadecimal","Snowy likes Anka","Hexadecimal likes Cleo","Hexadecimal likes Troll","Dracul likes Anka","Cleo likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Troll","Chapay likes Hexadecimal","Anka likes Snowy","Troll likes Hexadecimal","Snowy likes Hexadecimal","Anka likes Chapay","458053183 602148195 994999698"],["102639975 9"]],[["5","Troll likes Dracul","Anka likes Chapay","Cleo likes Anka","Chapay likes Cleo","Snowy likes Hexadecimal","222 400 400"],["89 5"]],[["0","2000000000 2000000000 1"],["666666665 0"]],[["0","1200000000 1200000000 1200000000"],["200000000 0"]],[["0","1 2000000000 2000000000"],["666666665 0"]]]}} +{"instance_id":"pseudo_to_code_2k_53","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nN=2002\nmp=map from string to long long\nlikes=map from pair of long long, long long to long long\ndefine the main function\n n=7, sz=0, m, a, b, c = long long\n read m\n while decremented value of m not equal 0\n l,r=string\n read l,r,r\n if mp[l] is 0 increment sz, mp[l] = sz\n if mp[r] is 0 increment sz, mp[r] = sz\n likes[make_pair(mp[l], mp[r])] = l\n end of the block\n read a,b,c\n pt=2187, minimal=a+b+c, ml=long long\n for i=0 to pt excluisve\n t=array of 3 vector of long long\n k=i, m1,m2,m3=long long, lks=0\n for i=1 to n inclusive\n add i at end of t[k modulo 3]\n divide k by 3\n end of the block\n it size of t[0] and size of t[1] and size of t[2]\n m1=a\/size of t[0]\n m2=b\/size of t[1]\n m3=c\/size of t[2]\n m1=max(m1, max(m2,m3))-min(m1, min(m2,m3))\n for i=0 to 3 exclusive\n for j=0 to size of t[i] exclusive\n for k=0 to size of t[i] exclusive add likes[make_pair(t[i][j], t[i][k])] to lks\n if minimal>m1\n minimal=m1\n ml=lks\n else if minimal is m1\n ml=max(ml,lks)\n end of the block\n end of the block\n print minimal, space, ml\nend of the block\n\n[CODE]:","reference_output":"const long long N = 2002;\nmap mp;\nmap, long long> likes;\nint main() {\n long long n = 7, m, sz = 0, a, b, c;\n cin >> m;\n while (m--) {\n string l, r;\n cin >> l >> r >> r;\n if (mp[l] == 0) mp[l] = ++sz;\n if (mp[r] == 0) mp[r] = ++sz;\n likes[make_pair(mp[l], mp[r])] = 1;\n }\n cin >> a >> b >> c;\n long long pt = 2187, minimal = a + b + c, ml;\n for (long long i = 0; i < pt; i++) {\n vector t[3];\n long long k = i, m1, m2, m3, lks = 0;\n for (long long i = 1; i <= n; i++) {\n t[k % 3].push_back(i);\n k \/= 3;\n }\n if (t[0].size() && t[1].size() && t[2].size()) {\n m1 = a \/ t[0].size();\n m2 = b \/ t[1].size();\n m3 = c \/ t[2].size();\n m1 = max(m1, max(m2, m3)) - min(m1, min(m2, m3));\n for (long long i = 0; i < 3; i++)\n for (long long j = 0; j < t[i].size(); j++)\n for (long long k = 0; k < t[i].size(); k++) lks += likes[make_pair(t[i][j], t[i][k])];\n if (minimal > m1) {\n minimal = m1;\n ml = lks;\n } else if (minimal == m1)\n ml = max(ml, lks);\n }\n }\n cout << minimal << \" \" << ml << endl;\n}","item":{"problem_id":"77A","pseudocode":"N=2002\nmp=map from string to long long\nlikes=map from pair of long long, long long to long long\ndefine the main function\n n=7, sz=0, m, a, b, c = long long\n read m\n while decremented value of m not equal 0\n l,r=string\n read l,r,r\n if mp[l] is 0 increment sz, mp[l] = sz\n if mp[r] is 0 increment sz, mp[r] = sz\n likes[make_pair(mp[l], mp[r])] = l\n end of the block\n read a,b,c\n pt=2187, minimal=a+b+c, ml=long long\n for i=0 to pt excluisve\n t=array of 3 vector of long long\n k=i, m1,m2,m3=long long, lks=0\n for i=1 to n inclusive\n add i at end of t[k modulo 3]\n divide k by 3\n end of the block\n it size of t[0] and size of t[1] and size of t[2]\n m1=a\/size of t[0]\n m2=b\/size of t[1]\n m3=c\/size of t[2]\n m1=max(m1, max(m2,m3))-min(m1, min(m2,m3))\n for i=0 to 3 exclusive\n for j=0 to size of t[i] exclusive\n for k=0 to size of t[i] exclusive add likes[make_pair(t[i][j], t[i][k])] to lks\n if minimal>m1\n minimal=m1\n ml=lks\n else if minimal is m1\n ml=max(ml,lks)\n end of the block\n end of the block\n print minimal, space, ml\nend of the block","testcases":[[["3","Troll likes Dracul","Dracul likes Anka","Snowy likes Hexadecimal","210 200 180"],["30 3"]],[["2","Anka likes Chapay","Chapay likes Anka","10000 50 50"],["1950 2"]],[["11","Snowy likes Dracul","Anka likes Dracul","Chapay likes Snowy","Hexadecimal likes Troll","Anka likes Cleo","Chapay likes Dracul","Anka likes Chapay","Snowy likes Troll","Anka likes Hexadecimal","Cleo likes Chapay","Troll likes Cleo","100 100 100"],["17 5"]],[["14","Chapay likes Cleo","Cleo likes Anka","Dracul likes Snowy","Snowy likes Cleo","Chapay likes Anka","Snowy likes Anka","Chapay likes Troll","Troll likes Anka","Anka likes Snowy","Chapay likes Dracul","Dracul likes Anka","Hexadecimal likes Chapay","Snowy likes Dracul","Cleo likes Dracul","15 15 15"],["2 6"]],[["4","Anka likes Cleo","Snowy likes Cleo","Anka likes Hexadecimal","Cleo likes Snowy","1 1 1"],["0 3"]],[["8","Snowy likes Anka","Hexadecimal likes Snowy","Troll likes Dracul","Hexadecimal likes Troll","Snowy likes Troll","Anka likes Snowy","Snowy likes Chapay","Anka likes Chapay","70 70 70"],["12 5"]],[["0","100 300 600"],["50 0"]],[["3","Chapay likes Hexadecimal","Anka likes Cleo","Troll likes Snowy","15 15000 90"],["2985 2"]],[["0","1 1 10000"],["1999 0"]],[["13","Cleo likes Hexadecimal","Cleo likes Snowy","Hexadecimal likes Anka","Anka likes Snowy","Troll likes Snowy","Chapay likes Hexadecimal","Hexadecimal likes Snowy","Snowy likes Chapay","Troll likes Cleo","Anka likes Hexadecimal","Hexadecimal likes Cleo","Chapay likes Dracul","Snowy likes Dracul","1000000000 2000000000 1000000000"],["166666666 6"]],[["12","Cleo likes Hexadecimal","Chapay likes Anka","Hexadecimal likes Cleo","Anka likes Snowy","Anka likes Cleo","Dracul likes Snowy","Anka likes Troll","Snowy likes Anka","Cleo likes Anka","Hexadecimal likes Troll","Hexadecimal likes Chapay","Snowy likes Troll","1000000000 1 2000000000"],["499999999 7"]],[["0","2000000000 2000000000 2000000000"],["333333334 0"]],[["2","Snowy likes Hexadecimal","Troll likes Dracul","2000000000 2000000000 2000000000"],["333333334 2"]],[["12","Snowy likes Chapay","Cleo likes Dracul","Hexadecimal likes Snowy","Hexadecimal likes Anka","Dracul likes Chapay","Cleo likes Troll","Dracul likes Snowy","Snowy likes Dracul","Troll likes Chapay","Dracul likes Anka","Chapay likes Hexadecimal","Troll likes Dracul","436364663 856574374 347564737"],["111742423 6"]],[["12","Anka likes Dracul","Dracul likes Troll","Cleo likes Troll","Snowy likes Hexadecimal","Hexadecimal likes Chapay","Cleo likes Dracul","Cleo likes Chapay","Hexadecimal likes Anka","Snowy likes Cleo","Hexadecimal likes Snowy","Cleo likes Snowy","Chapay likes Snowy","584329075 428752235 675234087"],["77788420 6"]],[["8","Anka likes Chapay","Dracul likes Snowy","Snowy likes Cleo","Cleo likes Anka","Cleo likes Troll","Hexadecimal likes Troll","Troll likes Cleo","Snowy likes Dracul","325432666 254352394 547360304"],["55277237 6"]],[["18","Snowy likes Troll","Chapay likes Hexadecimal","Cleo likes Snowy","Dracul likes Snowy","Snowy likes Chapay","Troll likes Cleo","Snowy likes Anka","Dracul likes Hexadecimal","Hexadecimal likes Anka","Anka likes Hexadecimal","Anka likes Chapay","Troll likes Anka","Anka likes Snowy","Anka likes Troll","Snowy likes Cleo","Hexadecimal likes Troll","Hexadecimal likes Dracul","Cleo likes Anka","20000 1000 20000"],["5666 8"]],[["6","Chapay likes Troll","Troll likes Cleo","Cleo likes Troll","Chapay likes Snowy","Anka likes Snowy","Troll likes Dracul","987499608 272739716 133573597"],["113301305 5"]],[["6","Anka likes Troll","Troll likes Chapay","Troll likes Hexadecimal","Hexadecimal likes Cleo","Snowy likes Hexadecimal","Chapay likes Troll","740076959 230477703 987799796"],["98788895 5"]],[["17","Cleo likes Dracul","Troll likes Cleo","Anka likes Chapay","Anka likes Troll","Chapay likes Snowy","Troll likes Snowy","Chapay likes Dracul","Hexadecimal likes Snowy","Dracul likes Snowy","Troll likes Hexadecimal","Hexadecimal likes Anka","Cleo likes Snowy","Hexadecimal likes Dracul","Snowy likes Chapay","Snowy likes Hexadecimal","Snowy likes Dracul","Dracul likes Troll","112909524 619275170 403563648"],["88872300 9"]],[["1","Hexadecimal likes Chapay","848189141 631955593 79523012"],["203206701 1"]],[["18","Anka likes Troll","Dracul likes Chapay","Hexadecimal likes Dracul","Chapay likes Dracul","Anka likes Hexadecimal","Snowy likes Cleo","Dracul likes Anka","Snowy likes Anka","Snowy likes Hexadecimal","Dracul likes Troll","Dracul likes Snowy","Hexadecimal likes Anka","Chapay likes Hexadecimal","Snowy likes Dracul","Cleo likes Snowy","Chapay likes Cleo","Anka likes Dracul","Troll likes Anka","838821770 712931449 361810998"],["124167182 8"]],[["18","Hexadecimal likes Chapay","Troll likes Dracul","Troll likes Snowy","Cleo likes Dracul","Chapay likes Snowy","Dracul likes Chapay","Cleo likes Snowy","Dracul likes Hexadecimal","Troll likes Anka","Anka likes Troll","Hexadecimal likes Dracul","Chapay likes Hexadecimal","Cleo likes Chapay","Anka likes Hexadecimal","Snowy likes Dracul","Chapay likes Troll","Anka likes Snowy","Dracul likes Cleo","240256138 922743697 38909902"],["191776022 10"]],[["0","477107314 230715335 261545417"],["43678104 0"]],[["16","Chapay likes Snowy","Hexadecimal likes Anka","Chapay likes Troll","Dracul likes Cleo","Troll likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Cleo","Snowy likes Cleo","Snowy likes Anka","Troll likes Chapay","Snowy likes Hexadecimal","Troll likes Snowy","Cleo likes Hexadecimal","Anka likes Snowy","Snowy likes Chapay","Anka likes Dracul","843382501 58524777 503038818"],["192994632 8"]],[["5","Troll likes Chapay","Anka likes Snowy","Anka likes Dracul","Chapay likes Anka","Snowy likes Troll","709201888 431802832 597079932"],["82638550 3"]],[["18","Cleo likes Snowy","Snowy likes Hexadecimal","Cleo likes Hexadecimal","Troll likes Dracul","Hexadecimal likes Snowy","Dracul likes Troll","Chapay likes Anka","Chapay likes Cleo","Troll likes Chapay","Hexadecimal likes Chapay","Anka likes Snowy","Troll likes Snowy","Dracul likes Snowy","Dracul likes Chapay","Chapay likes Troll","Cleo likes Troll","Hexadecimal likes Cleo","Anka likes Chapay","864225278 509037060 402199775"],["86975205 9"]],[["12","Cleo likes Hexadecimal","Troll likes Cleo","Anka likes Cleo","Hexadecimal likes Troll","Anka likes Snowy","Hexadecimal likes Anka","Troll likes Hexadecimal","Troll likes Anka","Dracul likes Cleo","Cleo likes Troll","Dracul likes Troll","Chapay likes Anka","762445890 377707484 324080158"],["92108551 6"]],[["21","Chapay likes Dracul","Snowy likes Chapay","Snowy likes Troll","Cleo likes Chapay","Cleo likes Troll","Chapay likes Cleo","Snowy likes Anka","Dracul likes Anka","Troll likes Snowy","Snowy likes Cleo","Chapay likes Hexadecimal","Cleo likes Anka","Cleo likes Snowy","Hexadecimal likes Cleo","Hexadecimal likes Snowy","Hexadecimal likes Anka","Hexadecimal likes Troll","Anka likes Snowy","Dracul likes Troll","Chapay likes Anka","Snowy likes Hexadecimal","482557397 502108264 750230216"],["9775434 8"]],[["6","Troll likes Chapay","Hexadecimal likes Snowy","Cleo likes Dracul","Cleo likes Anka","Chapay likes Anka","Anka likes Chapay","758376921 432619768 578580897"],["72980564 5"]],[["5","Chapay likes Cleo","Anka likes Hexadecimal","Anka likes Chapay","Cleo likes Troll","Anka likes Cleo","299076810 225593528 36830738"],["62861532 3"]],[["13","Anka likes Cleo","Cleo likes Troll","Chapay likes Cleo","Snowy likes Troll","Chapay likes Anka","Chapay likes Snowy","Snowy likes Chapay","Anka likes Snowy","Snowy likes Dracul","Cleo likes Hexadecimal","Dracul likes Chapay","Anka likes Hexadecimal","Snowy likes Cleo","554338888 280967932 682619964"],["96188303 7"]],[["17","Hexadecimal likes Chapay","Chapay likes Snowy","Chapay likes Troll","Anka likes Hexadecimal","Cleo likes Troll","Snowy likes Cleo","Cleo likes Anka","Cleo likes Hexadecimal","Anka likes Snowy","Chapay likes Hexadecimal","Anka likes Cleo","Dracul likes Snowy","Chapay likes Anka","Troll likes Hexadecimal","Troll likes Anka","Anka likes Dracul","Hexadecimal likes Anka","828886798 548024213 166661324"],["107350782 9"]],[["2","Troll likes Cleo","Anka likes Cleo","14344913 559182022 405430772"],["172049094 2"]],[["22","Cleo likes Snowy","Cleo likes Troll","Chapay likes Dracul","Snowy likes Troll","Dracul likes Chapay","Dracul likes Snowy","Chapay likes Cleo","Snowy likes Chapay","Dracul likes Troll","Anka likes Hexadecimal","Snowy likes Anka","Hexadecimal likes Cleo","Hexadecimal likes Troll","Dracul likes Anka","Cleo likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Troll","Chapay likes Hexadecimal","Anka likes Snowy","Troll likes Hexadecimal","Snowy likes Hexadecimal","Anka likes Chapay","458053183 602148195 994999698"],["102639975 9"]],[["5","Troll likes Dracul","Anka likes Chapay","Cleo likes Anka","Chapay likes Cleo","Snowy likes Hexadecimal","222 400 400"],["89 5"]],[["0","2000000000 2000000000 1"],["666666665 0"]],[["0","1200000000 1200000000 1200000000"],["200000000 0"]],[["0","1 2000000000 2000000000"],["666666665 0"]]]}} +{"instance_id":"pseudo_to_code_2k_54","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integer vector array vec with size 3\ncreate map like from string to integer\ncreate integers diff, ans, a, b, c, create 2d integer array mat with size 10 by 10\ndeclare cal\n create integers sum, i, j, k, with sum = 0\n for i = 0 to 3 exclusive\n for j = 0 to integer casted size of vec[i]\n for k = 0 to integer casted size of vec[i] exclusive, increment sum by mat[vec[i][j]][vec[i][k]]\n end of the block\n return sum from function\nend of the block\ndeclare count with integer now as argument, returning void\n if now is 7\n if size of vec[0] and size of vec[1] and size of vec[2]\n create integer array x with x = { a \/ size of vec[0], b \/ size of vec[1], c \/ size of vec[2] }\n sort elements from x to x + 3\n if x[2] - x[0] is less than diff\n set diff to x[2] - x[0]\n set ans to result of run cal\n else if x[2] - x[0] is diff\n set ans to maximum of ans and result of run cal\n end of the block\n return from function\n end of the block\n for i = 0 to 3 exclusive\n add element now to end of vec[i]\n run count with now + 1 as argument\n remove last element from vec[i]\n end of the block\nend of the block\ndefine the main function\n set like[ \"Anka\" ] to 0\n set like[ \"Chapay\" ] to 1\n set like[ \"Cleo\" ] to 2\n set like[ \"Troll\" ] to 3\n set like[ \"Dracul\" ] to 4\n set like[ \"Snowy\" ] to 5\n set like[ \"Hexadecimal\" ] to 6\n create integers n, i\n create strings name1, str, name2\n while read n is true\n set diff to ( 1 bitshift left 31 ) - 1\n for i = 0 to 3 exclusive, remove all elements from vec[i]\n set bytes from mat to size of mat to value 0\n for i = 0 to n exclusive\n read name1 read str read name2\n increment mat[like[name1]][like[name2]]\n end of the block\n read a read b read c\n run count with 0 as argument\n print diff print \" \" print ans print newline\n end of the block\nend of the block\n\n[CODE]:","reference_output":"vector vec[3];\nmap like;\nint diff, mat[10][10], ans, a, b, c;\nint cal() {\n int sum = 0, i, j, k;\n for (i = 0; i < 3; i++) {\n for (j = 0; j < (int)vec[i].size(); j++)\n for (k = 0; k < (int)vec[i].size(); k++) sum += mat[vec[i][j]][vec[i][k]];\n }\n return sum;\n}\nvoid count(int now) {\n if (now == 7) {\n if (vec[0].size() && vec[1].size() && vec[2].size()) {\n int x[] = {a \/ vec[0].size(), b \/ vec[1].size(), c \/ vec[2].size()};\n sort(x, x + 3);\n if (x[2] - x[0] < diff) {\n diff = x[2] - x[0];\n ans = cal();\n } else if (x[2] - x[0] == diff)\n ans = max(ans, cal());\n }\n return;\n }\n for (int i = 0; i < 3; i++) {\n vec[i].push_back(now);\n count(now + 1);\n vec[i].pop_back();\n }\n}\nint main() {\n like[\"Anka\"] = 0;\n like[\"Chapay\"] = 1;\n like[\"Cleo\"] = 2;\n like[\"Troll\"] = 3;\n like[\"Dracul\"] = 4;\n like[\"Snowy\"] = 5;\n like[\"Hexadecimal\"] = 6;\n int n, i;\n string name1, str, name2;\n while (cin >> n) {\n diff = (1 << 31) - 1;\n for (i = 0; i < 3; i++) vec[i].clear();\n memset(mat, 0, sizeof(mat));\n for (i = 0; i < n; i++) {\n cin >> name1 >> str >> name2;\n mat[like[name1]][like[name2]]++;\n }\n cin >> a >> b >> c;\n count(0);\n cout << diff << \" \" << ans << endl;\n }\n}","item":{"problem_id":"77A","pseudocode":"create integer vector array vec with size 3\ncreate map like from string to integer\ncreate integers diff, ans, a, b, c, create 2d integer array mat with size 10 by 10\ndeclare cal\n create integers sum, i, j, k, with sum = 0\n for i = 0 to 3 exclusive\n for j = 0 to integer casted size of vec[i]\n for k = 0 to integer casted size of vec[i] exclusive, increment sum by mat[vec[i][j]][vec[i][k]]\n end of the block\n return sum from function\nend of the block\ndeclare count with integer now as argument, returning void\n if now is 7\n if size of vec[0] and size of vec[1] and size of vec[2]\n create integer array x with x = { a \/ size of vec[0], b \/ size of vec[1], c \/ size of vec[2] }\n sort elements from x to x + 3\n if x[2] - x[0] is less than diff\n set diff to x[2] - x[0]\n set ans to result of run cal\n else if x[2] - x[0] is diff\n set ans to maximum of ans and result of run cal\n end of the block\n return from function\n end of the block\n for i = 0 to 3 exclusive\n add element now to end of vec[i]\n run count with now + 1 as argument\n remove last element from vec[i]\n end of the block\nend of the block\ndefine the main function\n set like[ \"Anka\" ] to 0\n set like[ \"Chapay\" ] to 1\n set like[ \"Cleo\" ] to 2\n set like[ \"Troll\" ] to 3\n set like[ \"Dracul\" ] to 4\n set like[ \"Snowy\" ] to 5\n set like[ \"Hexadecimal\" ] to 6\n create integers n, i\n create strings name1, str, name2\n while read n is true\n set diff to ( 1 bitshift left 31 ) - 1\n for i = 0 to 3 exclusive, remove all elements from vec[i]\n set bytes from mat to size of mat to value 0\n for i = 0 to n exclusive\n read name1 read str read name2\n increment mat[like[name1]][like[name2]]\n end of the block\n read a read b read c\n run count with 0 as argument\n print diff print \" \" print ans print newline\n end of the block\nend of the block","testcases":[[["3","Troll likes Dracul","Dracul likes Anka","Snowy likes Hexadecimal","210 200 180"],["30 3"]],[["2","Anka likes Chapay","Chapay likes Anka","10000 50 50"],["1950 2"]],[["11","Snowy likes Dracul","Anka likes Dracul","Chapay likes Snowy","Hexadecimal likes Troll","Anka likes Cleo","Chapay likes Dracul","Anka likes Chapay","Snowy likes Troll","Anka likes Hexadecimal","Cleo likes Chapay","Troll likes Cleo","100 100 100"],["17 5"]],[["14","Chapay likes Cleo","Cleo likes Anka","Dracul likes Snowy","Snowy likes Cleo","Chapay likes Anka","Snowy likes Anka","Chapay likes Troll","Troll likes Anka","Anka likes Snowy","Chapay likes Dracul","Dracul likes Anka","Hexadecimal likes Chapay","Snowy likes Dracul","Cleo likes Dracul","15 15 15"],["2 6"]],[["4","Anka likes Cleo","Snowy likes Cleo","Anka likes Hexadecimal","Cleo likes Snowy","1 1 1"],["0 3"]],[["8","Snowy likes Anka","Hexadecimal likes Snowy","Troll likes Dracul","Hexadecimal likes Troll","Snowy likes Troll","Anka likes Snowy","Snowy likes Chapay","Anka likes Chapay","70 70 70"],["12 5"]],[["0","100 300 600"],["50 0"]],[["3","Chapay likes Hexadecimal","Anka likes Cleo","Troll likes Snowy","15 15000 90"],["2985 2"]],[["0","1 1 10000"],["1999 0"]],[["13","Cleo likes Hexadecimal","Cleo likes Snowy","Hexadecimal likes Anka","Anka likes Snowy","Troll likes Snowy","Chapay likes Hexadecimal","Hexadecimal likes Snowy","Snowy likes Chapay","Troll likes Cleo","Anka likes Hexadecimal","Hexadecimal likes Cleo","Chapay likes Dracul","Snowy likes Dracul","1000000000 2000000000 1000000000"],["166666666 6"]],[["12","Cleo likes Hexadecimal","Chapay likes Anka","Hexadecimal likes Cleo","Anka likes Snowy","Anka likes Cleo","Dracul likes Snowy","Anka likes Troll","Snowy likes Anka","Cleo likes Anka","Hexadecimal likes Troll","Hexadecimal likes Chapay","Snowy likes Troll","1000000000 1 2000000000"],["499999999 7"]],[["0","2000000000 2000000000 2000000000"],["333333334 0"]],[["2","Snowy likes Hexadecimal","Troll likes Dracul","2000000000 2000000000 2000000000"],["333333334 2"]],[["12","Snowy likes Chapay","Cleo likes Dracul","Hexadecimal likes Snowy","Hexadecimal likes Anka","Dracul likes Chapay","Cleo likes Troll","Dracul likes Snowy","Snowy likes Dracul","Troll likes Chapay","Dracul likes Anka","Chapay likes Hexadecimal","Troll likes Dracul","436364663 856574374 347564737"],["111742423 6"]],[["12","Anka likes Dracul","Dracul likes Troll","Cleo likes Troll","Snowy likes Hexadecimal","Hexadecimal likes Chapay","Cleo likes Dracul","Cleo likes Chapay","Hexadecimal likes Anka","Snowy likes Cleo","Hexadecimal likes Snowy","Cleo likes Snowy","Chapay likes Snowy","584329075 428752235 675234087"],["77788420 6"]],[["8","Anka likes Chapay","Dracul likes Snowy","Snowy likes Cleo","Cleo likes Anka","Cleo likes Troll","Hexadecimal likes Troll","Troll likes Cleo","Snowy likes Dracul","325432666 254352394 547360304"],["55277237 6"]],[["18","Snowy likes Troll","Chapay likes Hexadecimal","Cleo likes Snowy","Dracul likes Snowy","Snowy likes Chapay","Troll likes Cleo","Snowy likes Anka","Dracul likes Hexadecimal","Hexadecimal likes Anka","Anka likes Hexadecimal","Anka likes Chapay","Troll likes Anka","Anka likes Snowy","Anka likes Troll","Snowy likes Cleo","Hexadecimal likes Troll","Hexadecimal likes Dracul","Cleo likes Anka","20000 1000 20000"],["5666 8"]],[["6","Chapay likes Troll","Troll likes Cleo","Cleo likes Troll","Chapay likes Snowy","Anka likes Snowy","Troll likes Dracul","987499608 272739716 133573597"],["113301305 5"]],[["6","Anka likes Troll","Troll likes Chapay","Troll likes Hexadecimal","Hexadecimal likes Cleo","Snowy likes Hexadecimal","Chapay likes Troll","740076959 230477703 987799796"],["98788895 5"]],[["17","Cleo likes Dracul","Troll likes Cleo","Anka likes Chapay","Anka likes Troll","Chapay likes Snowy","Troll likes Snowy","Chapay likes Dracul","Hexadecimal likes Snowy","Dracul likes Snowy","Troll likes Hexadecimal","Hexadecimal likes Anka","Cleo likes Snowy","Hexadecimal likes Dracul","Snowy likes Chapay","Snowy likes Hexadecimal","Snowy likes Dracul","Dracul likes Troll","112909524 619275170 403563648"],["88872300 9"]],[["1","Hexadecimal likes Chapay","848189141 631955593 79523012"],["203206701 1"]],[["18","Anka likes Troll","Dracul likes Chapay","Hexadecimal likes Dracul","Chapay likes Dracul","Anka likes Hexadecimal","Snowy likes Cleo","Dracul likes Anka","Snowy likes Anka","Snowy likes Hexadecimal","Dracul likes Troll","Dracul likes Snowy","Hexadecimal likes Anka","Chapay likes Hexadecimal","Snowy likes Dracul","Cleo likes Snowy","Chapay likes Cleo","Anka likes Dracul","Troll likes Anka","838821770 712931449 361810998"],["124167182 8"]],[["18","Hexadecimal likes Chapay","Troll likes Dracul","Troll likes Snowy","Cleo likes Dracul","Chapay likes Snowy","Dracul likes Chapay","Cleo likes Snowy","Dracul likes Hexadecimal","Troll likes Anka","Anka likes Troll","Hexadecimal likes Dracul","Chapay likes Hexadecimal","Cleo likes Chapay","Anka likes Hexadecimal","Snowy likes Dracul","Chapay likes Troll","Anka likes Snowy","Dracul likes Cleo","240256138 922743697 38909902"],["191776022 10"]],[["0","477107314 230715335 261545417"],["43678104 0"]],[["16","Chapay likes Snowy","Hexadecimal likes Anka","Chapay likes Troll","Dracul likes Cleo","Troll likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Cleo","Snowy likes Cleo","Snowy likes Anka","Troll likes Chapay","Snowy likes Hexadecimal","Troll likes Snowy","Cleo likes Hexadecimal","Anka likes Snowy","Snowy likes Chapay","Anka likes Dracul","843382501 58524777 503038818"],["192994632 8"]],[["5","Troll likes Chapay","Anka likes Snowy","Anka likes Dracul","Chapay likes Anka","Snowy likes Troll","709201888 431802832 597079932"],["82638550 3"]],[["18","Cleo likes Snowy","Snowy likes Hexadecimal","Cleo likes Hexadecimal","Troll likes Dracul","Hexadecimal likes Snowy","Dracul likes Troll","Chapay likes Anka","Chapay likes Cleo","Troll likes Chapay","Hexadecimal likes Chapay","Anka likes Snowy","Troll likes Snowy","Dracul likes Snowy","Dracul likes Chapay","Chapay likes Troll","Cleo likes Troll","Hexadecimal likes Cleo","Anka likes Chapay","864225278 509037060 402199775"],["86975205 9"]],[["12","Cleo likes Hexadecimal","Troll likes Cleo","Anka likes Cleo","Hexadecimal likes Troll","Anka likes Snowy","Hexadecimal likes Anka","Troll likes Hexadecimal","Troll likes Anka","Dracul likes Cleo","Cleo likes Troll","Dracul likes Troll","Chapay likes Anka","762445890 377707484 324080158"],["92108551 6"]],[["21","Chapay likes Dracul","Snowy likes Chapay","Snowy likes Troll","Cleo likes Chapay","Cleo likes Troll","Chapay likes Cleo","Snowy likes Anka","Dracul likes Anka","Troll likes Snowy","Snowy likes Cleo","Chapay likes Hexadecimal","Cleo likes Anka","Cleo likes Snowy","Hexadecimal likes Cleo","Hexadecimal likes Snowy","Hexadecimal likes Anka","Hexadecimal likes Troll","Anka likes Snowy","Dracul likes Troll","Chapay likes Anka","Snowy likes Hexadecimal","482557397 502108264 750230216"],["9775434 8"]],[["6","Troll likes Chapay","Hexadecimal likes Snowy","Cleo likes Dracul","Cleo likes Anka","Chapay likes Anka","Anka likes Chapay","758376921 432619768 578580897"],["72980564 5"]],[["5","Chapay likes Cleo","Anka likes Hexadecimal","Anka likes Chapay","Cleo likes Troll","Anka likes Cleo","299076810 225593528 36830738"],["62861532 3"]],[["13","Anka likes Cleo","Cleo likes Troll","Chapay likes Cleo","Snowy likes Troll","Chapay likes Anka","Chapay likes Snowy","Snowy likes Chapay","Anka likes Snowy","Snowy likes Dracul","Cleo likes Hexadecimal","Dracul likes Chapay","Anka likes Hexadecimal","Snowy likes Cleo","554338888 280967932 682619964"],["96188303 7"]],[["17","Hexadecimal likes Chapay","Chapay likes Snowy","Chapay likes Troll","Anka likes Hexadecimal","Cleo likes Troll","Snowy likes Cleo","Cleo likes Anka","Cleo likes Hexadecimal","Anka likes Snowy","Chapay likes Hexadecimal","Anka likes Cleo","Dracul likes Snowy","Chapay likes Anka","Troll likes Hexadecimal","Troll likes Anka","Anka likes Dracul","Hexadecimal likes Anka","828886798 548024213 166661324"],["107350782 9"]],[["2","Troll likes Cleo","Anka likes Cleo","14344913 559182022 405430772"],["172049094 2"]],[["22","Cleo likes Snowy","Cleo likes Troll","Chapay likes Dracul","Snowy likes Troll","Dracul likes Chapay","Dracul likes Snowy","Chapay likes Cleo","Snowy likes Chapay","Dracul likes Troll","Anka likes Hexadecimal","Snowy likes Anka","Hexadecimal likes Cleo","Hexadecimal likes Troll","Dracul likes Anka","Cleo likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Troll","Chapay likes Hexadecimal","Anka likes Snowy","Troll likes Hexadecimal","Snowy likes Hexadecimal","Anka likes Chapay","458053183 602148195 994999698"],["102639975 9"]],[["5","Troll likes Dracul","Anka likes Chapay","Cleo likes Anka","Chapay likes Cleo","Snowy likes Hexadecimal","222 400 400"],["89 5"]],[["0","2000000000 2000000000 1"],["666666665 0"]],[["0","1200000000 1200000000 1200000000"],["200000000 0"]],[["0","1 2000000000 2000000000"],["666666665 0"]]]}} +{"instance_id":"pseudo_to_code_2k_55","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integers b1, b2, b3, emm1, emm2 and integer array lk of size 10 within an array of size 10\ncreate integer array a of size 8\ncreate string key-type integer map m\ndeclare js taking in integers x, y, and z and returning integer\n set x to b1 \/ x\n set y to b2 \/ y\n set z to b3 \/ z\n set emm1 = the max of abs(x - y), max(abs(y - z), abs(x - z)) and return emm1\nend of the block\ndeclare haogan taking in integers x, y, and z and returning integer\n create integer ss = 0\n for i = 1 to x inclusive\n for j = 1 to x inclusive\n if lk[a[i][a[j]] is truthy, increment ss\n for i = x + 1 to x + y inclusive\n for j = x + 1 to x + y inclusive\n if lk[a[i]][a[j]] is truthy, increment ss\n for i = x + y + 1 to 7 inclusive\n for j = x + y + 1 to 7 inclusive\n if lk[a[i]][a[j]] is truthy, increment ss\n set emm2 to ss and return emm2\nend of the block\ndefine the main function\n set m[\"Anka\"] to 1\n set m[\"Chapay\"] to 2\n set m[\"Cleo\"] to 3\n set m[\"Troll\"] to 4\n set m[\"Dracul\"] to 5\n set m[\"Snowy\"] to 6\n set m[\"Hexadecimal\"] to 7\n create integer n\n read n\n while n-- is truthy\n create strings s1, s, and s2\n read s1, s, and s2\n set lk[m[s1]][m[s2]] to 1\n end of the block\n create integers ans1 = 1e9 and ans2 = -1e9\n read b1, b2, and b3\n if b1 is less than b2, swap the values of b1 and b2\n if b2 is less than b3, swap the values of b2 and b3\n if b1 is less than b2, swap the values of b1 and b2\n for i = 1 to 7 inclusive, set a[i] to i\n do\n if the return value of js(4, 2, 1) is equal to ans1 and the return value of haogan(4, 2, 1) is greater than ans2, set ans2 to emm2\n if emm1 is less than ans1\n set ans1 to emm1\n set ans2 to the return value of haogan(4, 2, 1)\n end of the block\n if the return value of js(3, 3, 1) is equal to ans1 and the return value of haogan(3, 3, 1) is greater than ans2, set ans2 to emm2\n if emm1 is less than ans1\n set ans1 to emm1\n set ans2 to the return value of haogan(3, 3, 1)\n end of the block\n if the return value of js(3, 2, 2) is equal to ans1 and the return value of haogan(3, 2, 2) is greater than ans2, set ans2 to emm2\n if emm1 is less than ans1\n set ans1 to emm1\n set ans2 to the return value of haogan(3, 2, 2)\n end of the block\n if the return value of js(5, 1, 1) is equal to ans1 and the return value of haogan(5, 1, 1) is greater than ans2, set ans2 to emm2\n if emm1 is less than ans1\n set ans1 to emm1\n set ans2 to haogan(5, 1, 1)\n end of the block\n while the return value of next_permutation(a + 1, a + 7 + 1) is truthy\n print ans1, ' ', and ans2\nend of the block\n\n[CODE]:","reference_output":"int b1, b2, b3, emm1, emm2, lk[10][10];\nint a[8];\nmap m;\nint js(int x, int y, int z) {\n x = b1 \/ x;\n y = b2 \/ y;\n z = b3 \/ z;\n return emm1 = max(abs(x - y), max(abs(y - z), abs(x - z)));\n}\nint haogan(int x, int y, int z) {\n int ss = 0;\n for (int i = 1; i <= x; i++)\n for (int j = 1; j <= x; j++)\n if (lk[a[i]][a[j]]) ss++;\n for (int i = x + 1; i <= x + y; i++)\n for (int j = x + 1; j <= x + y; j++)\n if (lk[a[i]][a[j]]) ss++;\n for (int i = x + y + 1; i <= 7; i++)\n for (int j = x + y + 1; j <= 7; j++)\n if (lk[a[i]][a[j]]) ss++;\n return emm2 = ss;\n}\nint main() {\n m[\"Anka\"] = 1;\n m[\"Chapay\"] = 2;\n m[\"Cleo\"] = 3;\n m[\"Troll\"] = 4;\n m[\"Dracul\"] = 5;\n m[\"Snowy\"] = 6;\n m[\"Hexadecimal\"] = 7;\n int n;\n cin >> n;\n while (n--) {\n string s1, s, s2;\n cin >> s1 >> s >> s2;\n lk[m[s1]][m[s2]] = 1;\n }\n int ans1 = 1e9, ans2 = -1e9;\n cin >> b1 >> b2 >> b3;\n if (b1 < b2) swap(b1, b2);\n if (b2 < b3) swap(b2, b3);\n if (b1 < b2) swap(b1, b2);\n for (int i = 1; i <= 7; i++) a[i] = i;\n do {\n if ((js(4, 2, 1) == ans1) && (haogan(4, 2, 1) > ans2)) { ans2 = emm2; }\n if (emm1 < ans1) {\n ans1 = emm1;\n ans2 = haogan(4, 2, 1);\n }\n if ((js(3, 3, 1) == ans1) && (haogan(3, 3, 1) > ans2)) { ans2 = emm2; }\n if (emm1 < ans1) {\n ans1 = emm1;\n ans2 = haogan(3, 3, 1);\n }\n if ((js(3, 2, 2) == ans1) && (haogan(3, 2, 2) > ans2)) { ans2 = emm2; }\n if (emm1 < ans1) {\n ans1 = emm1;\n ans2 = haogan(3, 2, 2);\n }\n if ((js(5, 1, 1) == ans1) && (haogan(5, 1, 1) > ans2)) { ans2 = emm2; }\n if (emm1 < ans1) {\n ans1 = emm1;\n ans2 = haogan(5, 1, 1);\n }\n } while (next_permutation(a + 1, a + 7 + 1));\n cout << ans1 << ' ' << ans2 << endl;\n}","item":{"problem_id":"77A","pseudocode":"create integers b1, b2, b3, emm1, emm2 and integer array lk of size 10 within an array of size 10\ncreate integer array a of size 8\ncreate string key-type integer map m\ndeclare js taking in integers x, y, and z and returning integer\n set x to b1 \/ x\n set y to b2 \/ y\n set z to b3 \/ z\n set emm1 = the max of abs(x - y), max(abs(y - z), abs(x - z)) and return emm1\nend of the block\ndeclare haogan taking in integers x, y, and z and returning integer\n create integer ss = 0\n for i = 1 to x inclusive\n for j = 1 to x inclusive\n if lk[a[i][a[j]] is truthy, increment ss\n for i = x + 1 to x + y inclusive\n for j = x + 1 to x + y inclusive\n if lk[a[i]][a[j]] is truthy, increment ss\n for i = x + y + 1 to 7 inclusive\n for j = x + y + 1 to 7 inclusive\n if lk[a[i]][a[j]] is truthy, increment ss\n set emm2 to ss and return emm2\nend of the block\ndefine the main function\n set m[\"Anka\"] to 1\n set m[\"Chapay\"] to 2\n set m[\"Cleo\"] to 3\n set m[\"Troll\"] to 4\n set m[\"Dracul\"] to 5\n set m[\"Snowy\"] to 6\n set m[\"Hexadecimal\"] to 7\n create integer n\n read n\n while n-- is truthy\n create strings s1, s, and s2\n read s1, s, and s2\n set lk[m[s1]][m[s2]] to 1\n end of the block\n create integers ans1 = 1e9 and ans2 = -1e9\n read b1, b2, and b3\n if b1 is less than b2, swap the values of b1 and b2\n if b2 is less than b3, swap the values of b2 and b3\n if b1 is less than b2, swap the values of b1 and b2\n for i = 1 to 7 inclusive, set a[i] to i\n do\n if the return value of js(4, 2, 1) is equal to ans1 and the return value of haogan(4, 2, 1) is greater than ans2, set ans2 to emm2\n if emm1 is less than ans1\n set ans1 to emm1\n set ans2 to the return value of haogan(4, 2, 1)\n end of the block\n if the return value of js(3, 3, 1) is equal to ans1 and the return value of haogan(3, 3, 1) is greater than ans2, set ans2 to emm2\n if emm1 is less than ans1\n set ans1 to emm1\n set ans2 to the return value of haogan(3, 3, 1)\n end of the block\n if the return value of js(3, 2, 2) is equal to ans1 and the return value of haogan(3, 2, 2) is greater than ans2, set ans2 to emm2\n if emm1 is less than ans1\n set ans1 to emm1\n set ans2 to the return value of haogan(3, 2, 2)\n end of the block\n if the return value of js(5, 1, 1) is equal to ans1 and the return value of haogan(5, 1, 1) is greater than ans2, set ans2 to emm2\n if emm1 is less than ans1\n set ans1 to emm1\n set ans2 to haogan(5, 1, 1)\n end of the block\n while the return value of next_permutation(a + 1, a + 7 + 1) is truthy\n print ans1, ' ', and ans2\nend of the block","testcases":[[["3","Troll likes Dracul","Dracul likes Anka","Snowy likes Hexadecimal","210 200 180"],["30 3"]],[["2","Anka likes Chapay","Chapay likes Anka","10000 50 50"],["1950 2"]],[["11","Snowy likes Dracul","Anka likes Dracul","Chapay likes Snowy","Hexadecimal likes Troll","Anka likes Cleo","Chapay likes Dracul","Anka likes Chapay","Snowy likes Troll","Anka likes Hexadecimal","Cleo likes Chapay","Troll likes Cleo","100 100 100"],["17 5"]],[["14","Chapay likes Cleo","Cleo likes Anka","Dracul likes Snowy","Snowy likes Cleo","Chapay likes Anka","Snowy likes Anka","Chapay likes Troll","Troll likes Anka","Anka likes Snowy","Chapay likes Dracul","Dracul likes Anka","Hexadecimal likes Chapay","Snowy likes Dracul","Cleo likes Dracul","15 15 15"],["2 6"]],[["4","Anka likes Cleo","Snowy likes Cleo","Anka likes Hexadecimal","Cleo likes Snowy","1 1 1"],["0 3"]],[["8","Snowy likes Anka","Hexadecimal likes Snowy","Troll likes Dracul","Hexadecimal likes Troll","Snowy likes Troll","Anka likes Snowy","Snowy likes Chapay","Anka likes Chapay","70 70 70"],["12 5"]],[["0","100 300 600"],["50 0"]],[["3","Chapay likes Hexadecimal","Anka likes Cleo","Troll likes Snowy","15 15000 90"],["2985 2"]],[["0","1 1 10000"],["1999 0"]],[["13","Cleo likes Hexadecimal","Cleo likes Snowy","Hexadecimal likes Anka","Anka likes Snowy","Troll likes Snowy","Chapay likes Hexadecimal","Hexadecimal likes Snowy","Snowy likes Chapay","Troll likes Cleo","Anka likes Hexadecimal","Hexadecimal likes Cleo","Chapay likes Dracul","Snowy likes Dracul","1000000000 2000000000 1000000000"],["166666666 6"]],[["12","Cleo likes Hexadecimal","Chapay likes Anka","Hexadecimal likes Cleo","Anka likes Snowy","Anka likes Cleo","Dracul likes Snowy","Anka likes Troll","Snowy likes Anka","Cleo likes Anka","Hexadecimal likes Troll","Hexadecimal likes Chapay","Snowy likes Troll","1000000000 1 2000000000"],["499999999 7"]],[["0","2000000000 2000000000 2000000000"],["333333334 0"]],[["2","Snowy likes Hexadecimal","Troll likes Dracul","2000000000 2000000000 2000000000"],["333333334 2"]],[["12","Snowy likes Chapay","Cleo likes Dracul","Hexadecimal likes Snowy","Hexadecimal likes Anka","Dracul likes Chapay","Cleo likes Troll","Dracul likes Snowy","Snowy likes Dracul","Troll likes Chapay","Dracul likes Anka","Chapay likes Hexadecimal","Troll likes Dracul","436364663 856574374 347564737"],["111742423 6"]],[["12","Anka likes Dracul","Dracul likes Troll","Cleo likes Troll","Snowy likes Hexadecimal","Hexadecimal likes Chapay","Cleo likes Dracul","Cleo likes Chapay","Hexadecimal likes Anka","Snowy likes Cleo","Hexadecimal likes Snowy","Cleo likes Snowy","Chapay likes Snowy","584329075 428752235 675234087"],["77788420 6"]],[["8","Anka likes Chapay","Dracul likes Snowy","Snowy likes Cleo","Cleo likes Anka","Cleo likes Troll","Hexadecimal likes Troll","Troll likes Cleo","Snowy likes Dracul","325432666 254352394 547360304"],["55277237 6"]],[["18","Snowy likes Troll","Chapay likes Hexadecimal","Cleo likes Snowy","Dracul likes Snowy","Snowy likes Chapay","Troll likes Cleo","Snowy likes Anka","Dracul likes Hexadecimal","Hexadecimal likes Anka","Anka likes Hexadecimal","Anka likes Chapay","Troll likes Anka","Anka likes Snowy","Anka likes Troll","Snowy likes Cleo","Hexadecimal likes Troll","Hexadecimal likes Dracul","Cleo likes Anka","20000 1000 20000"],["5666 8"]],[["6","Chapay likes Troll","Troll likes Cleo","Cleo likes Troll","Chapay likes Snowy","Anka likes Snowy","Troll likes Dracul","987499608 272739716 133573597"],["113301305 5"]],[["6","Anka likes Troll","Troll likes Chapay","Troll likes Hexadecimal","Hexadecimal likes Cleo","Snowy likes Hexadecimal","Chapay likes Troll","740076959 230477703 987799796"],["98788895 5"]],[["17","Cleo likes Dracul","Troll likes Cleo","Anka likes Chapay","Anka likes Troll","Chapay likes Snowy","Troll likes Snowy","Chapay likes Dracul","Hexadecimal likes Snowy","Dracul likes Snowy","Troll likes Hexadecimal","Hexadecimal likes Anka","Cleo likes Snowy","Hexadecimal likes Dracul","Snowy likes Chapay","Snowy likes Hexadecimal","Snowy likes Dracul","Dracul likes Troll","112909524 619275170 403563648"],["88872300 9"]],[["1","Hexadecimal likes Chapay","848189141 631955593 79523012"],["203206701 1"]],[["18","Anka likes Troll","Dracul likes Chapay","Hexadecimal likes Dracul","Chapay likes Dracul","Anka likes Hexadecimal","Snowy likes Cleo","Dracul likes Anka","Snowy likes Anka","Snowy likes Hexadecimal","Dracul likes Troll","Dracul likes Snowy","Hexadecimal likes Anka","Chapay likes Hexadecimal","Snowy likes Dracul","Cleo likes Snowy","Chapay likes Cleo","Anka likes Dracul","Troll likes Anka","838821770 712931449 361810998"],["124167182 8"]],[["18","Hexadecimal likes Chapay","Troll likes Dracul","Troll likes Snowy","Cleo likes Dracul","Chapay likes Snowy","Dracul likes Chapay","Cleo likes Snowy","Dracul likes Hexadecimal","Troll likes Anka","Anka likes Troll","Hexadecimal likes Dracul","Chapay likes Hexadecimal","Cleo likes Chapay","Anka likes Hexadecimal","Snowy likes Dracul","Chapay likes Troll","Anka likes Snowy","Dracul likes Cleo","240256138 922743697 38909902"],["191776022 10"]],[["0","477107314 230715335 261545417"],["43678104 0"]],[["16","Chapay likes Snowy","Hexadecimal likes Anka","Chapay likes Troll","Dracul likes Cleo","Troll likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Cleo","Snowy likes Cleo","Snowy likes Anka","Troll likes Chapay","Snowy likes Hexadecimal","Troll likes Snowy","Cleo likes Hexadecimal","Anka likes Snowy","Snowy likes Chapay","Anka likes Dracul","843382501 58524777 503038818"],["192994632 8"]],[["5","Troll likes Chapay","Anka likes Snowy","Anka likes Dracul","Chapay likes Anka","Snowy likes Troll","709201888 431802832 597079932"],["82638550 3"]],[["18","Cleo likes Snowy","Snowy likes Hexadecimal","Cleo likes Hexadecimal","Troll likes Dracul","Hexadecimal likes Snowy","Dracul likes Troll","Chapay likes Anka","Chapay likes Cleo","Troll likes Chapay","Hexadecimal likes Chapay","Anka likes Snowy","Troll likes Snowy","Dracul likes Snowy","Dracul likes Chapay","Chapay likes Troll","Cleo likes Troll","Hexadecimal likes Cleo","Anka likes Chapay","864225278 509037060 402199775"],["86975205 9"]],[["12","Cleo likes Hexadecimal","Troll likes Cleo","Anka likes Cleo","Hexadecimal likes Troll","Anka likes Snowy","Hexadecimal likes Anka","Troll likes Hexadecimal","Troll likes Anka","Dracul likes Cleo","Cleo likes Troll","Dracul likes Troll","Chapay likes Anka","762445890 377707484 324080158"],["92108551 6"]],[["21","Chapay likes Dracul","Snowy likes Chapay","Snowy likes Troll","Cleo likes Chapay","Cleo likes Troll","Chapay likes Cleo","Snowy likes Anka","Dracul likes Anka","Troll likes Snowy","Snowy likes Cleo","Chapay likes Hexadecimal","Cleo likes Anka","Cleo likes Snowy","Hexadecimal likes Cleo","Hexadecimal likes Snowy","Hexadecimal likes Anka","Hexadecimal likes Troll","Anka likes Snowy","Dracul likes Troll","Chapay likes Anka","Snowy likes Hexadecimal","482557397 502108264 750230216"],["9775434 8"]],[["6","Troll likes Chapay","Hexadecimal likes Snowy","Cleo likes Dracul","Cleo likes Anka","Chapay likes Anka","Anka likes Chapay","758376921 432619768 578580897"],["72980564 5"]],[["5","Chapay likes Cleo","Anka likes Hexadecimal","Anka likes Chapay","Cleo likes Troll","Anka likes Cleo","299076810 225593528 36830738"],["62861532 3"]],[["13","Anka likes Cleo","Cleo likes Troll","Chapay likes Cleo","Snowy likes Troll","Chapay likes Anka","Chapay likes Snowy","Snowy likes Chapay","Anka likes Snowy","Snowy likes Dracul","Cleo likes Hexadecimal","Dracul likes Chapay","Anka likes Hexadecimal","Snowy likes Cleo","554338888 280967932 682619964"],["96188303 7"]],[["17","Hexadecimal likes Chapay","Chapay likes Snowy","Chapay likes Troll","Anka likes Hexadecimal","Cleo likes Troll","Snowy likes Cleo","Cleo likes Anka","Cleo likes Hexadecimal","Anka likes Snowy","Chapay likes Hexadecimal","Anka likes Cleo","Dracul likes Snowy","Chapay likes Anka","Troll likes Hexadecimal","Troll likes Anka","Anka likes Dracul","Hexadecimal likes Anka","828886798 548024213 166661324"],["107350782 9"]],[["2","Troll likes Cleo","Anka likes Cleo","14344913 559182022 405430772"],["172049094 2"]],[["22","Cleo likes Snowy","Cleo likes Troll","Chapay likes Dracul","Snowy likes Troll","Dracul likes Chapay","Dracul likes Snowy","Chapay likes Cleo","Snowy likes Chapay","Dracul likes Troll","Anka likes Hexadecimal","Snowy likes Anka","Hexadecimal likes Cleo","Hexadecimal likes Troll","Dracul likes Anka","Cleo likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Troll","Chapay likes Hexadecimal","Anka likes Snowy","Troll likes Hexadecimal","Snowy likes Hexadecimal","Anka likes Chapay","458053183 602148195 994999698"],["102639975 9"]],[["5","Troll likes Dracul","Anka likes Chapay","Cleo likes Anka","Chapay likes Cleo","Snowy likes Hexadecimal","222 400 400"],["89 5"]],[["0","2000000000 2000000000 1"],["666666665 0"]],[["0","1200000000 1200000000 1200000000"],["200000000 0"]],[["0","1 2000000000 2000000000"],["666666665 0"]]]}} +{"instance_id":"pseudo_to_code_2k_56","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nvec = int vector array of size 3\nlike = string and int map\ndiff, ans, a, b, c = int and mat = two dimensional int array of sizes 10 and 10\nin function cal returning an int\n sum, i, j, k = int with sum = 0\n for i = 0 to 3\n for j = 0 to size of vec[i]\n for k = 0 to size of vec[i] increment sum by mat[vec[i][j]][vec[i][k]]\n end of the block\n return sum\nend of the block\nin function count taking an int now\n if now is 7\n if size of vec[0] and size of vec[1] and size of vec[2] are all not 0\n x = int array with the values a \/ size of vec[0], b \/ size of vec[1] and c \/ size of vec[2]\n sort x\n if x[2] - x[0] is less than diff\n set diff to x[2] - x[0]\n set ans to cal\n else if x[2] - x[0] is diff\n set ans to max of ans and cal\n end of the block\n return\n end of the block\n for i = 0 to 3\n append now to vec[i]\n call count of now + 1\n remove last value of vec[i]\n end of the block\nend of the block\ndefine the main function\n set like[\"Anka\"] to 0\n set like[\"Chapay\"] to 1\n set like[\"Cleo\"] to 2\n set like[\"Troll\"] to 3\n set like[\"Dracul\"] to 4\n set like[\"Snowy\"] to 5\n set like[\"Hexadecimal\"] to 6\n n, i = int\n name1, str, name2 = string\n loop while reading n\n set diff to (1 bitshift right by 31) - 1\n for i = 0 to 3 clear vec[i]\n set all values of mat to 0\n for i = 0 to n\n read name1 then str then name2\n increment mat[like[name1]][like[name2]]\n end of the block\n read a then b then c\n call count of 0\n print diff and ans\n end of the block\nend of the block\n\n[CODE]:","reference_output":"vector vec[3];\nmap like;\nint diff, mat[10][10], ans, a, b, c;\nint cal() {\n int sum = 0, i, j, k;\n for (i = 0; i < 3; i++) {\n for (j = 0; j < vec[i].size(); j++)\n for (k = 0; k < vec[i].size(); k++) sum += mat[vec[i][j]][vec[i][k]];\n }\n return sum;\n}\nvoid count(int now) {\n if (now == 7) {\n if (vec[0].size() && vec[1].size() && vec[2].size()) {\n int x[] = {a \/ vec[0].size(), b \/ vec[1].size(), c \/ vec[2].size()};\n sort(x, x + 3);\n if (x[2] - x[0] < diff) {\n diff = x[2] - x[0];\n ans = cal();\n } else if (x[2] - x[0] == diff)\n ans = max(ans, cal());\n }\n return;\n }\n for (int i = 0; i < 3; i++) {\n vec[i].push_back(now);\n count(now + 1);\n vec[i].pop_back();\n }\n}\nint main() {\n like[\"Anka\"] = 0;\n like[\"Chapay\"] = 1;\n like[\"Cleo\"] = 2;\n like[\"Troll\"] = 3;\n like[\"Dracul\"] = 4;\n like[\"Snowy\"] = 5;\n like[\"Hexadecimal\"] = 6;\n int n, i;\n string name1, str, name2;\n while (cin >> n) {\n diff = (1 << 31) - 1;\n for (i = 0; i < 3; i++) vec[i].clear();\n memset(mat, 0, sizeof(mat));\n for (i = 0; i < n; i++) {\n cin >> name1 >> str >> name2;\n mat[like[name1]][like[name2]]++;\n }\n cin >> a >> b >> c;\n count(0);\n cout << diff << \" \" << ans << endl;\n }\n}","item":{"problem_id":"77A","pseudocode":"vec = int vector array of size 3\nlike = string and int map\ndiff, ans, a, b, c = int and mat = two dimensional int array of sizes 10 and 10\nin function cal returning an int\n sum, i, j, k = int with sum = 0\n for i = 0 to 3\n for j = 0 to size of vec[i]\n for k = 0 to size of vec[i] increment sum by mat[vec[i][j]][vec[i][k]]\n end of the block\n return sum\nend of the block\nin function count taking an int now\n if now is 7\n if size of vec[0] and size of vec[1] and size of vec[2] are all not 0\n x = int array with the values a \/ size of vec[0], b \/ size of vec[1] and c \/ size of vec[2]\n sort x\n if x[2] - x[0] is less than diff\n set diff to x[2] - x[0]\n set ans to cal\n else if x[2] - x[0] is diff\n set ans to max of ans and cal\n end of the block\n return\n end of the block\n for i = 0 to 3\n append now to vec[i]\n call count of now + 1\n remove last value of vec[i]\n end of the block\nend of the block\ndefine the main function\n set like[\"Anka\"] to 0\n set like[\"Chapay\"] to 1\n set like[\"Cleo\"] to 2\n set like[\"Troll\"] to 3\n set like[\"Dracul\"] to 4\n set like[\"Snowy\"] to 5\n set like[\"Hexadecimal\"] to 6\n n, i = int\n name1, str, name2 = string\n loop while reading n\n set diff to (1 bitshift right by 31) - 1\n for i = 0 to 3 clear vec[i]\n set all values of mat to 0\n for i = 0 to n\n read name1 then str then name2\n increment mat[like[name1]][like[name2]]\n end of the block\n read a then b then c\n call count of 0\n print diff and ans\n end of the block\nend of the block","testcases":[[["3","Troll likes Dracul","Dracul likes Anka","Snowy likes Hexadecimal","210 200 180"],["30 3"]],[["2","Anka likes Chapay","Chapay likes Anka","10000 50 50"],["1950 2"]],[["11","Snowy likes Dracul","Anka likes Dracul","Chapay likes Snowy","Hexadecimal likes Troll","Anka likes Cleo","Chapay likes Dracul","Anka likes Chapay","Snowy likes Troll","Anka likes Hexadecimal","Cleo likes Chapay","Troll likes Cleo","100 100 100"],["17 5"]],[["14","Chapay likes Cleo","Cleo likes Anka","Dracul likes Snowy","Snowy likes Cleo","Chapay likes Anka","Snowy likes Anka","Chapay likes Troll","Troll likes Anka","Anka likes Snowy","Chapay likes Dracul","Dracul likes Anka","Hexadecimal likes Chapay","Snowy likes Dracul","Cleo likes Dracul","15 15 15"],["2 6"]],[["4","Anka likes Cleo","Snowy likes Cleo","Anka likes Hexadecimal","Cleo likes Snowy","1 1 1"],["0 3"]],[["8","Snowy likes Anka","Hexadecimal likes Snowy","Troll likes Dracul","Hexadecimal likes Troll","Snowy likes Troll","Anka likes Snowy","Snowy likes Chapay","Anka likes Chapay","70 70 70"],["12 5"]],[["0","100 300 600"],["50 0"]],[["3","Chapay likes Hexadecimal","Anka likes Cleo","Troll likes Snowy","15 15000 90"],["2985 2"]],[["0","1 1 10000"],["1999 0"]],[["13","Cleo likes Hexadecimal","Cleo likes Snowy","Hexadecimal likes Anka","Anka likes Snowy","Troll likes Snowy","Chapay likes Hexadecimal","Hexadecimal likes Snowy","Snowy likes Chapay","Troll likes Cleo","Anka likes Hexadecimal","Hexadecimal likes Cleo","Chapay likes Dracul","Snowy likes Dracul","1000000000 2000000000 1000000000"],["166666666 6"]],[["12","Cleo likes Hexadecimal","Chapay likes Anka","Hexadecimal likes Cleo","Anka likes Snowy","Anka likes Cleo","Dracul likes Snowy","Anka likes Troll","Snowy likes Anka","Cleo likes Anka","Hexadecimal likes Troll","Hexadecimal likes Chapay","Snowy likes Troll","1000000000 1 2000000000"],["499999999 7"]],[["0","2000000000 2000000000 2000000000"],["333333334 0"]],[["2","Snowy likes Hexadecimal","Troll likes Dracul","2000000000 2000000000 2000000000"],["333333334 2"]],[["12","Snowy likes Chapay","Cleo likes Dracul","Hexadecimal likes Snowy","Hexadecimal likes Anka","Dracul likes Chapay","Cleo likes Troll","Dracul likes Snowy","Snowy likes Dracul","Troll likes Chapay","Dracul likes Anka","Chapay likes Hexadecimal","Troll likes Dracul","436364663 856574374 347564737"],["111742423 6"]],[["12","Anka likes Dracul","Dracul likes Troll","Cleo likes Troll","Snowy likes Hexadecimal","Hexadecimal likes Chapay","Cleo likes Dracul","Cleo likes Chapay","Hexadecimal likes Anka","Snowy likes Cleo","Hexadecimal likes Snowy","Cleo likes Snowy","Chapay likes Snowy","584329075 428752235 675234087"],["77788420 6"]],[["8","Anka likes Chapay","Dracul likes Snowy","Snowy likes Cleo","Cleo likes Anka","Cleo likes Troll","Hexadecimal likes Troll","Troll likes Cleo","Snowy likes Dracul","325432666 254352394 547360304"],["55277237 6"]],[["18","Snowy likes Troll","Chapay likes Hexadecimal","Cleo likes Snowy","Dracul likes Snowy","Snowy likes Chapay","Troll likes Cleo","Snowy likes Anka","Dracul likes Hexadecimal","Hexadecimal likes Anka","Anka likes Hexadecimal","Anka likes Chapay","Troll likes Anka","Anka likes Snowy","Anka likes Troll","Snowy likes Cleo","Hexadecimal likes Troll","Hexadecimal likes Dracul","Cleo likes Anka","20000 1000 20000"],["5666 8"]],[["6","Chapay likes Troll","Troll likes Cleo","Cleo likes Troll","Chapay likes Snowy","Anka likes Snowy","Troll likes Dracul","987499608 272739716 133573597"],["113301305 5"]],[["6","Anka likes Troll","Troll likes Chapay","Troll likes Hexadecimal","Hexadecimal likes Cleo","Snowy likes Hexadecimal","Chapay likes Troll","740076959 230477703 987799796"],["98788895 5"]],[["17","Cleo likes Dracul","Troll likes Cleo","Anka likes Chapay","Anka likes Troll","Chapay likes Snowy","Troll likes Snowy","Chapay likes Dracul","Hexadecimal likes Snowy","Dracul likes Snowy","Troll likes Hexadecimal","Hexadecimal likes Anka","Cleo likes Snowy","Hexadecimal likes Dracul","Snowy likes Chapay","Snowy likes Hexadecimal","Snowy likes Dracul","Dracul likes Troll","112909524 619275170 403563648"],["88872300 9"]],[["1","Hexadecimal likes Chapay","848189141 631955593 79523012"],["203206701 1"]],[["18","Anka likes Troll","Dracul likes Chapay","Hexadecimal likes Dracul","Chapay likes Dracul","Anka likes Hexadecimal","Snowy likes Cleo","Dracul likes Anka","Snowy likes Anka","Snowy likes Hexadecimal","Dracul likes Troll","Dracul likes Snowy","Hexadecimal likes Anka","Chapay likes Hexadecimal","Snowy likes Dracul","Cleo likes Snowy","Chapay likes Cleo","Anka likes Dracul","Troll likes Anka","838821770 712931449 361810998"],["124167182 8"]],[["18","Hexadecimal likes Chapay","Troll likes Dracul","Troll likes Snowy","Cleo likes Dracul","Chapay likes Snowy","Dracul likes Chapay","Cleo likes Snowy","Dracul likes Hexadecimal","Troll likes Anka","Anka likes Troll","Hexadecimal likes Dracul","Chapay likes Hexadecimal","Cleo likes Chapay","Anka likes Hexadecimal","Snowy likes Dracul","Chapay likes Troll","Anka likes Snowy","Dracul likes Cleo","240256138 922743697 38909902"],["191776022 10"]],[["0","477107314 230715335 261545417"],["43678104 0"]],[["16","Chapay likes Snowy","Hexadecimal likes Anka","Chapay likes Troll","Dracul likes Cleo","Troll likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Cleo","Snowy likes Cleo","Snowy likes Anka","Troll likes Chapay","Snowy likes Hexadecimal","Troll likes Snowy","Cleo likes Hexadecimal","Anka likes Snowy","Snowy likes Chapay","Anka likes Dracul","843382501 58524777 503038818"],["192994632 8"]],[["5","Troll likes Chapay","Anka likes Snowy","Anka likes Dracul","Chapay likes Anka","Snowy likes Troll","709201888 431802832 597079932"],["82638550 3"]],[["18","Cleo likes Snowy","Snowy likes Hexadecimal","Cleo likes Hexadecimal","Troll likes Dracul","Hexadecimal likes Snowy","Dracul likes Troll","Chapay likes Anka","Chapay likes Cleo","Troll likes Chapay","Hexadecimal likes Chapay","Anka likes Snowy","Troll likes Snowy","Dracul likes Snowy","Dracul likes Chapay","Chapay likes Troll","Cleo likes Troll","Hexadecimal likes Cleo","Anka likes Chapay","864225278 509037060 402199775"],["86975205 9"]],[["12","Cleo likes Hexadecimal","Troll likes Cleo","Anka likes Cleo","Hexadecimal likes Troll","Anka likes Snowy","Hexadecimal likes Anka","Troll likes Hexadecimal","Troll likes Anka","Dracul likes Cleo","Cleo likes Troll","Dracul likes Troll","Chapay likes Anka","762445890 377707484 324080158"],["92108551 6"]],[["21","Chapay likes Dracul","Snowy likes Chapay","Snowy likes Troll","Cleo likes Chapay","Cleo likes Troll","Chapay likes Cleo","Snowy likes Anka","Dracul likes Anka","Troll likes Snowy","Snowy likes Cleo","Chapay likes Hexadecimal","Cleo likes Anka","Cleo likes Snowy","Hexadecimal likes Cleo","Hexadecimal likes Snowy","Hexadecimal likes Anka","Hexadecimal likes Troll","Anka likes Snowy","Dracul likes Troll","Chapay likes Anka","Snowy likes Hexadecimal","482557397 502108264 750230216"],["9775434 8"]],[["6","Troll likes Chapay","Hexadecimal likes Snowy","Cleo likes Dracul","Cleo likes Anka","Chapay likes Anka","Anka likes Chapay","758376921 432619768 578580897"],["72980564 5"]],[["5","Chapay likes Cleo","Anka likes Hexadecimal","Anka likes Chapay","Cleo likes Troll","Anka likes Cleo","299076810 225593528 36830738"],["62861532 3"]],[["13","Anka likes Cleo","Cleo likes Troll","Chapay likes Cleo","Snowy likes Troll","Chapay likes Anka","Chapay likes Snowy","Snowy likes Chapay","Anka likes Snowy","Snowy likes Dracul","Cleo likes Hexadecimal","Dracul likes Chapay","Anka likes Hexadecimal","Snowy likes Cleo","554338888 280967932 682619964"],["96188303 7"]],[["17","Hexadecimal likes Chapay","Chapay likes Snowy","Chapay likes Troll","Anka likes Hexadecimal","Cleo likes Troll","Snowy likes Cleo","Cleo likes Anka","Cleo likes Hexadecimal","Anka likes Snowy","Chapay likes Hexadecimal","Anka likes Cleo","Dracul likes Snowy","Chapay likes Anka","Troll likes Hexadecimal","Troll likes Anka","Anka likes Dracul","Hexadecimal likes Anka","828886798 548024213 166661324"],["107350782 9"]],[["2","Troll likes Cleo","Anka likes Cleo","14344913 559182022 405430772"],["172049094 2"]],[["22","Cleo likes Snowy","Cleo likes Troll","Chapay likes Dracul","Snowy likes Troll","Dracul likes Chapay","Dracul likes Snowy","Chapay likes Cleo","Snowy likes Chapay","Dracul likes Troll","Anka likes Hexadecimal","Snowy likes Anka","Hexadecimal likes Cleo","Hexadecimal likes Troll","Dracul likes Anka","Cleo likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Troll","Chapay likes Hexadecimal","Anka likes Snowy","Troll likes Hexadecimal","Snowy likes Hexadecimal","Anka likes Chapay","458053183 602148195 994999698"],["102639975 9"]],[["5","Troll likes Dracul","Anka likes Chapay","Cleo likes Anka","Chapay likes Cleo","Snowy likes Hexadecimal","222 400 400"],["89 5"]],[["0","2000000000 2000000000 1"],["666666665 0"]],[["0","1200000000 1200000000 1200000000"],["200000000 0"]],[["0","1 2000000000 2000000000"],["666666665 0"]]]}} +{"instance_id":"pseudo_to_code_2k_57","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare long longs ml = 0 and md = 10e10\ncreate vector of ints team with 7 elements filled with 0\ncreate map of string to int called hashi\ncreate map of int\/int pairs to bool called likes\ncreate vector of long long called xp with 3 elements\ntri is a void function with int argument i\n if i is equal to 7\n create long longs mie = 10e10 and mae and lik = 0\n create bool can = true\n for integer j = 0 to 3 exclusive\n create long long co = 0\n loop k from 0 to 7 exclusive\n if team[k] is equal to j\n increment co\n for l = 0 to 7 exclusive\n if team[l] = j and likes[pair(k, l)] is true, increment lik by one\n end of the block\n end of the block\n end of the block\n if co is equal to 0\n assign false to can\n break\n end of the block\n change mie to min of mie and xp[j] \/ co\n change mae to max of mae and xp[j] \/ co\n end of the block\n if can is true\n create long long dif = mae - mie\n if dif = md\n set ml to max of lik and ml\n else if dif < md\n assign dif to md\n assign lik to ml\n end of the block\n end of the block\n else\n for integer j = 0 to 3 exclusive\n set team[i] to j\n call tri(i + 1)\n end of the block\n end of the block\n return\nend of the block\ndefine the main function\n declare int variable n\n read input to n\n assign 0 to hashi[\"Trolong long\"]\n assign 1 to hashi[\"Dracul\"]\n assign 2 to hashi[\"Anka\"]\n assign 3 to hashi[\"Snowy\"]\n assign 4 to hashi[\"Hexadecimal\"]\n assign 5 to hashi[\"Chapay\"]\n assign 6 to hashi[\"Cleo\"]\n loop, decrementing n, while it is not 0\n create strings p and q\n read input to p, q and q\n set likes[pair(hashi[p], hashi[q])] to true\n end of the block\n loop i from 0 to 3 exclusive, read xp[i]\n call tri(0)\n print md, \" \", ml and \"\\n\"\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long md = 10e10, ml = 0;\nvector team(7, 0);\nmap hashi;\nmap, bool> likes;\nvector xp(3);\nvoid tri(int i) {\n if (i == 7) {\n long long mie = 10e10, mae = 0, lik = 0;\n bool can = true;\n for (int j = 0; j < 3; j++) {\n long long co = 0;\n for (int k = 0; k < 7; k++) {\n if (team[k] == j) {\n co++;\n for (int l = 0; l < 7; l++) {\n if (team[l] == j && likes[pair(k, l)]) { lik++; }\n }\n }\n }\n if (co == 0) {\n can = false;\n break;\n }\n mie = min(mie, xp[j] \/ co);\n mae = max(mae, xp[j] \/ co);\n }\n if (can) {\n long long dif = mae - mie;\n if (dif == md)\n ml = max(lik, ml);\n else if (dif < md) {\n md = dif;\n ml = lik;\n }\n }\n } else {\n for (int j = 0; j < 3; j++) {\n team[i] = j;\n tri(i + 1);\n }\n }\n return;\n}\nint main() {\n int n;\n cin >> n;\n hashi[\"Trolong long\"] = 0;\n hashi[\"Dracul\"] = 1;\n hashi[\"Anka\"] = 2;\n hashi[\"Snowy\"] = 3;\n hashi[\"Hexadecimal\"] = 4;\n hashi[\"Chapay\"] = 5;\n hashi[\"Cleo\"] = 6;\n while (n--) {\n string p, q;\n cin >> p >> q >> q;\n likes[pair(hashi[p], hashi[q])] = true;\n }\n for (int i = 0; i < 3; i++) cin >> xp[i];\n tri(0);\n cout << md << \" \" << ml << \"\\n\";\n return 0;\n}","item":{"problem_id":"77A","pseudocode":"declare long longs ml = 0 and md = 10e10\ncreate vector of ints team with 7 elements filled with 0\ncreate map of string to int called hashi\ncreate map of int\/int pairs to bool called likes\ncreate vector of long long called xp with 3 elements\ntri is a void function with int argument i\n if i is equal to 7\n create long longs mie = 10e10 and mae and lik = 0\n create bool can = true\n for integer j = 0 to 3 exclusive\n create long long co = 0\n loop k from 0 to 7 exclusive\n if team[k] is equal to j\n increment co\n for l = 0 to 7 exclusive\n if team[l] = j and likes[pair(k, l)] is true, increment lik by one\n end of the block\n end of the block\n end of the block\n if co is equal to 0\n assign false to can\n break\n end of the block\n change mie to min of mie and xp[j] \/ co\n change mae to max of mae and xp[j] \/ co\n end of the block\n if can is true\n create long long dif = mae - mie\n if dif = md\n set ml to max of lik and ml\n else if dif < md\n assign dif to md\n assign lik to ml\n end of the block\n end of the block\n else\n for integer j = 0 to 3 exclusive\n set team[i] to j\n call tri(i + 1)\n end of the block\n end of the block\n return\nend of the block\ndefine the main function\n declare int variable n\n read input to n\n assign 0 to hashi[\"Trolong long\"]\n assign 1 to hashi[\"Dracul\"]\n assign 2 to hashi[\"Anka\"]\n assign 3 to hashi[\"Snowy\"]\n assign 4 to hashi[\"Hexadecimal\"]\n assign 5 to hashi[\"Chapay\"]\n assign 6 to hashi[\"Cleo\"]\n loop, decrementing n, while it is not 0\n create strings p and q\n read input to p, q and q\n set likes[pair(hashi[p], hashi[q])] to true\n end of the block\n loop i from 0 to 3 exclusive, read xp[i]\n call tri(0)\n print md, \" \", ml and \"\\n\"\n return to indicate successful execution\nend of the block","testcases":[[["3","Troll likes Dracul","Dracul likes Anka","Snowy likes Hexadecimal","210 200 180"],["30 3"]],[["2","Anka likes Chapay","Chapay likes Anka","10000 50 50"],["1950 2"]],[["11","Snowy likes Dracul","Anka likes Dracul","Chapay likes Snowy","Hexadecimal likes Troll","Anka likes Cleo","Chapay likes Dracul","Anka likes Chapay","Snowy likes Troll","Anka likes Hexadecimal","Cleo likes Chapay","Troll likes Cleo","100 100 100"],["17 5"]],[["14","Chapay likes Cleo","Cleo likes Anka","Dracul likes Snowy","Snowy likes Cleo","Chapay likes Anka","Snowy likes Anka","Chapay likes Troll","Troll likes Anka","Anka likes Snowy","Chapay likes Dracul","Dracul likes Anka","Hexadecimal likes Chapay","Snowy likes Dracul","Cleo likes Dracul","15 15 15"],["2 6"]],[["4","Anka likes Cleo","Snowy likes Cleo","Anka likes Hexadecimal","Cleo likes Snowy","1 1 1"],["0 3"]],[["8","Snowy likes Anka","Hexadecimal likes Snowy","Troll likes Dracul","Hexadecimal likes Troll","Snowy likes Troll","Anka likes Snowy","Snowy likes Chapay","Anka likes Chapay","70 70 70"],["12 5"]],[["0","100 300 600"],["50 0"]],[["3","Chapay likes Hexadecimal","Anka likes Cleo","Troll likes Snowy","15 15000 90"],["2985 2"]],[["0","1 1 10000"],["1999 0"]],[["13","Cleo likes Hexadecimal","Cleo likes Snowy","Hexadecimal likes Anka","Anka likes Snowy","Troll likes Snowy","Chapay likes Hexadecimal","Hexadecimal likes Snowy","Snowy likes Chapay","Troll likes Cleo","Anka likes Hexadecimal","Hexadecimal likes Cleo","Chapay likes Dracul","Snowy likes Dracul","1000000000 2000000000 1000000000"],["166666666 6"]],[["12","Cleo likes Hexadecimal","Chapay likes Anka","Hexadecimal likes Cleo","Anka likes Snowy","Anka likes Cleo","Dracul likes Snowy","Anka likes Troll","Snowy likes Anka","Cleo likes Anka","Hexadecimal likes Troll","Hexadecimal likes Chapay","Snowy likes Troll","1000000000 1 2000000000"],["499999999 7"]],[["0","2000000000 2000000000 2000000000"],["333333334 0"]],[["2","Snowy likes Hexadecimal","Troll likes Dracul","2000000000 2000000000 2000000000"],["333333334 2"]],[["12","Snowy likes Chapay","Cleo likes Dracul","Hexadecimal likes Snowy","Hexadecimal likes Anka","Dracul likes Chapay","Cleo likes Troll","Dracul likes Snowy","Snowy likes Dracul","Troll likes Chapay","Dracul likes Anka","Chapay likes Hexadecimal","Troll likes Dracul","436364663 856574374 347564737"],["111742423 6"]],[["12","Anka likes Dracul","Dracul likes Troll","Cleo likes Troll","Snowy likes Hexadecimal","Hexadecimal likes Chapay","Cleo likes Dracul","Cleo likes Chapay","Hexadecimal likes Anka","Snowy likes Cleo","Hexadecimal likes Snowy","Cleo likes Snowy","Chapay likes Snowy","584329075 428752235 675234087"],["77788420 6"]],[["8","Anka likes Chapay","Dracul likes Snowy","Snowy likes Cleo","Cleo likes Anka","Cleo likes Troll","Hexadecimal likes Troll","Troll likes Cleo","Snowy likes Dracul","325432666 254352394 547360304"],["55277237 6"]],[["18","Snowy likes Troll","Chapay likes Hexadecimal","Cleo likes Snowy","Dracul likes Snowy","Snowy likes Chapay","Troll likes Cleo","Snowy likes Anka","Dracul likes Hexadecimal","Hexadecimal likes Anka","Anka likes Hexadecimal","Anka likes Chapay","Troll likes Anka","Anka likes Snowy","Anka likes Troll","Snowy likes Cleo","Hexadecimal likes Troll","Hexadecimal likes Dracul","Cleo likes Anka","20000 1000 20000"],["5666 8"]],[["6","Chapay likes Troll","Troll likes Cleo","Cleo likes Troll","Chapay likes Snowy","Anka likes Snowy","Troll likes Dracul","987499608 272739716 133573597"],["113301305 5"]],[["6","Anka likes Troll","Troll likes Chapay","Troll likes Hexadecimal","Hexadecimal likes Cleo","Snowy likes Hexadecimal","Chapay likes Troll","740076959 230477703 987799796"],["98788895 5"]],[["17","Cleo likes Dracul","Troll likes Cleo","Anka likes Chapay","Anka likes Troll","Chapay likes Snowy","Troll likes Snowy","Chapay likes Dracul","Hexadecimal likes Snowy","Dracul likes Snowy","Troll likes Hexadecimal","Hexadecimal likes Anka","Cleo likes Snowy","Hexadecimal likes Dracul","Snowy likes Chapay","Snowy likes Hexadecimal","Snowy likes Dracul","Dracul likes Troll","112909524 619275170 403563648"],["88872300 9"]],[["1","Hexadecimal likes Chapay","848189141 631955593 79523012"],["203206701 1"]],[["18","Anka likes Troll","Dracul likes Chapay","Hexadecimal likes Dracul","Chapay likes Dracul","Anka likes Hexadecimal","Snowy likes Cleo","Dracul likes Anka","Snowy likes Anka","Snowy likes Hexadecimal","Dracul likes Troll","Dracul likes Snowy","Hexadecimal likes Anka","Chapay likes Hexadecimal","Snowy likes Dracul","Cleo likes Snowy","Chapay likes Cleo","Anka likes Dracul","Troll likes Anka","838821770 712931449 361810998"],["124167182 8"]],[["18","Hexadecimal likes Chapay","Troll likes Dracul","Troll likes Snowy","Cleo likes Dracul","Chapay likes Snowy","Dracul likes Chapay","Cleo likes Snowy","Dracul likes Hexadecimal","Troll likes Anka","Anka likes Troll","Hexadecimal likes Dracul","Chapay likes Hexadecimal","Cleo likes Chapay","Anka likes Hexadecimal","Snowy likes Dracul","Chapay likes Troll","Anka likes Snowy","Dracul likes Cleo","240256138 922743697 38909902"],["191776022 10"]],[["0","477107314 230715335 261545417"],["43678104 0"]],[["16","Chapay likes Snowy","Hexadecimal likes Anka","Chapay likes Troll","Dracul likes Cleo","Troll likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Cleo","Snowy likes Cleo","Snowy likes Anka","Troll likes Chapay","Snowy likes Hexadecimal","Troll likes Snowy","Cleo likes Hexadecimal","Anka likes Snowy","Snowy likes Chapay","Anka likes Dracul","843382501 58524777 503038818"],["192994632 8"]],[["5","Troll likes Chapay","Anka likes Snowy","Anka likes Dracul","Chapay likes Anka","Snowy likes Troll","709201888 431802832 597079932"],["82638550 3"]],[["18","Cleo likes Snowy","Snowy likes Hexadecimal","Cleo likes Hexadecimal","Troll likes Dracul","Hexadecimal likes Snowy","Dracul likes Troll","Chapay likes Anka","Chapay likes Cleo","Troll likes Chapay","Hexadecimal likes Chapay","Anka likes Snowy","Troll likes Snowy","Dracul likes Snowy","Dracul likes Chapay","Chapay likes Troll","Cleo likes Troll","Hexadecimal likes Cleo","Anka likes Chapay","864225278 509037060 402199775"],["86975205 9"]],[["12","Cleo likes Hexadecimal","Troll likes Cleo","Anka likes Cleo","Hexadecimal likes Troll","Anka likes Snowy","Hexadecimal likes Anka","Troll likes Hexadecimal","Troll likes Anka","Dracul likes Cleo","Cleo likes Troll","Dracul likes Troll","Chapay likes Anka","762445890 377707484 324080158"],["92108551 6"]],[["21","Chapay likes Dracul","Snowy likes Chapay","Snowy likes Troll","Cleo likes Chapay","Cleo likes Troll","Chapay likes Cleo","Snowy likes Anka","Dracul likes Anka","Troll likes Snowy","Snowy likes Cleo","Chapay likes Hexadecimal","Cleo likes Anka","Cleo likes Snowy","Hexadecimal likes Cleo","Hexadecimal likes Snowy","Hexadecimal likes Anka","Hexadecimal likes Troll","Anka likes Snowy","Dracul likes Troll","Chapay likes Anka","Snowy likes Hexadecimal","482557397 502108264 750230216"],["9775434 8"]],[["6","Troll likes Chapay","Hexadecimal likes Snowy","Cleo likes Dracul","Cleo likes Anka","Chapay likes Anka","Anka likes Chapay","758376921 432619768 578580897"],["72980564 5"]],[["5","Chapay likes Cleo","Anka likes Hexadecimal","Anka likes Chapay","Cleo likes Troll","Anka likes Cleo","299076810 225593528 36830738"],["62861532 3"]],[["13","Anka likes Cleo","Cleo likes Troll","Chapay likes Cleo","Snowy likes Troll","Chapay likes Anka","Chapay likes Snowy","Snowy likes Chapay","Anka likes Snowy","Snowy likes Dracul","Cleo likes Hexadecimal","Dracul likes Chapay","Anka likes Hexadecimal","Snowy likes Cleo","554338888 280967932 682619964"],["96188303 7"]],[["17","Hexadecimal likes Chapay","Chapay likes Snowy","Chapay likes Troll","Anka likes Hexadecimal","Cleo likes Troll","Snowy likes Cleo","Cleo likes Anka","Cleo likes Hexadecimal","Anka likes Snowy","Chapay likes Hexadecimal","Anka likes Cleo","Dracul likes Snowy","Chapay likes Anka","Troll likes Hexadecimal","Troll likes Anka","Anka likes Dracul","Hexadecimal likes Anka","828886798 548024213 166661324"],["107350782 9"]],[["2","Troll likes Cleo","Anka likes Cleo","14344913 559182022 405430772"],["172049094 2"]],[["22","Cleo likes Snowy","Cleo likes Troll","Chapay likes Dracul","Snowy likes Troll","Dracul likes Chapay","Dracul likes Snowy","Chapay likes Cleo","Snowy likes Chapay","Dracul likes Troll","Anka likes Hexadecimal","Snowy likes Anka","Hexadecimal likes Cleo","Hexadecimal likes Troll","Dracul likes Anka","Cleo likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Troll","Chapay likes Hexadecimal","Anka likes Snowy","Troll likes Hexadecimal","Snowy likes Hexadecimal","Anka likes Chapay","458053183 602148195 994999698"],["102639975 9"]],[["5","Troll likes Dracul","Anka likes Chapay","Cleo likes Anka","Chapay likes Cleo","Snowy likes Hexadecimal","222 400 400"],["89 5"]],[["0","2000000000 2000000000 1"],["666666665 0"]],[["0","1200000000 1200000000 1200000000"],["200000000 0"]],[["0","1 2000000000 2000000000"],["666666665 0"]]]}} +{"instance_id":"pseudo_to_code_2k_58","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet mat be a logical matrix of size 7x7\nin int function calc which takes string s\n let r = 0 = integer\n for i = 0 to 7 exlusive\n for j = 0 to 7 exclusive\n if s at i is same as s at j and mat at i and j is not 0 then increment r\n end of the block\n end of the block\n return r\nend of the block\ndefine the main function\n let n, ans, temp, lans, ltemp be int with ans = temp = lans = ltemp = INT_MAX\n read n\n let arr, t be long long arrays of size 3 both with all 0\n for i = 0 to 7 exclusive\n for j = 0 to 7 exclusive, set mat[i][j] to false\n let hero be a map form string to int\n set hero at \"Anka\" to 0\n set hero at \"Chapay\" to 1\n set hero[\"Cleo\"] = 2\n set hero[\"Dracul\"] to 3\n set hero[\"Dracul\"] tp 4\n hero[\"Snowy\"] = 5\n set hero at Hexadecimal = 6\n let x, y, z, q be strings\n for i = 0 to n exclusive\n read x, y, z\n set mat[hero[x]][hero[z]] to true\n end of the block\n read arr at 0, arra at 1, arr at 2\n sort the first 3 elements of arr\n let h be a set of strings\n let it be a set string iterator\n set t at 2 = arr[2] \/ 5\n t[1] = arr[1]\n set t at 0 to arr[0]\n sort the first 3 elements of t\n set temp to t[2] - t[0]\n if temp is less than ans\n set ans to temp\n call insert on h with arg \"aaaaabc\"\n end of the block\n set t at 2 = arr[2]\/4\n set t at 1 = arr[1]\/2\n set t at 0 to arr at 0\n sort the first three elements of arr\n set temp = t[2] - t[0]\n if temp is less than ans\n set ans to temp\n clear h\n insert \"aaaabbc\" in h\n else if temp is same as ans\n insert \"aaaabbc\" in h\n end of the block\n set t[2] = arr[2] \/ 3\n set t[1] = arr[1] \/ 3\n set t at 0 to arr at 0\n sort the first 3 elements of t\n set tempo to t[2] - t[0]\n if temp < ans\n set ans to temp\n clear h\n insert \"aaaabbc\" in h\n else if temp is same as ans\n insert \"aaaabbc\" in h\n end of the block\n set t[2] to arr[2] \/ 3\n set t[1] to arr[1] \/ 2\n set t[0] to arr[0] \/ 2\n sort the first 3 elements of t\n set temp to t[2] - t[0]\n if temp is less than ans\n set ans to temp\n clear h\n insert \"aaabbcc\" in h\n if temp = ans\n insert \"aaabbcc\" in h\n end of the block\n while h is not empty\n set q to be q * the first element of h\n do loop\n set ltemp to calc of q\n if ltemp is greater than lans then set lans to ltemp\n while the result of calling next_permutation with args start of q and end of q is not 0\n erase q from h\n end of the block\n print ans and space and lans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"bool mat[7][7];\nint calc(string s) {\n int r = 0;\n for (int i = 0; i < 7; i++) {\n for (int j = 0; j < 7; j++) {\n if (s[i] == s[j] && mat[i][j]) r++;\n }\n }\n return r;\n}\nint main() {\n int n, ans = INT_MAX, temp = INT_MAX, lans = 0, ltemp = 0;\n cin >> n;\n long long arr[3], t[3] = {0, 0, 0};\n for (int i = 0; i < 7; i++)\n for (int j = 0; j < 7; j++) mat[i][j] = false;\n map hero;\n hero[\"Anka\"] = 0;\n hero[\"Chapay\"] = 1;\n hero[\"Cleo\"] = 2;\n hero[\"Troll\"] = 3;\n hero[\"Dracul\"] = 4;\n hero[\"Snowy\"] = 5;\n hero[\"Hexadecimal\"] = 6;\n string x, y, z, q;\n for (int i = 0; i < n; i++) {\n cin >> x >> y >> z;\n mat[hero[x]][hero[z]] = true;\n }\n cin >> arr[0] >> arr[1] >> arr[2];\n sort(arr, arr + 3);\n set h;\n set::iterator it;\n t[2] = arr[2] \/ 5;\n t[1] = arr[1];\n t[0] = arr[0];\n sort(t, t + 3);\n temp = t[2] - t[0];\n if (temp < ans) {\n ans = temp;\n h.insert(\"aaaaabc\");\n }\n t[2] = arr[2] \/ 4;\n t[1] = arr[1] \/ 2;\n t[0] = arr[0];\n sort(t, t + 3);\n temp = t[2] - t[0];\n if (temp < ans) {\n ans = temp;\n h.clear();\n h.insert(\"aaaabbc\");\n } else if (temp == ans) {\n h.insert(\"aaaabbc\");\n }\n t[2] = arr[2] \/ 3;\n t[1] = arr[1] \/ 3;\n t[0] = arr[0];\n sort(t, t + 3);\n temp = t[2] - t[0];\n if (temp < ans) {\n ans = temp;\n h.clear();\n h.insert(\"aaabbbc\");\n } else if (temp == ans) {\n h.insert(\"aaabbbc\");\n }\n t[2] = arr[2] \/ 3;\n t[1] = arr[1] \/ 2;\n t[0] = arr[0] \/ 2;\n sort(t, t + 3);\n temp = t[2] - t[0];\n if (temp < ans) {\n ans = temp;\n h.clear();\n h.insert(\"aaabbcc\");\n } else if (temp == ans) {\n h.insert(\"aaabbcc\");\n }\n while (!h.empty()) {\n q = *(h.begin());\n do {\n ltemp = calc(q);\n if (ltemp > lans) lans = ltemp;\n } while (next_permutation(q.begin(), q.end()));\n h.erase(q);\n }\n cout << ans << \" \" << lans << endl;\n return 0;\n}","item":{"problem_id":"77A","pseudocode":"let mat be a logical matrix of size 7x7\nin int function calc which takes string s\n let r = 0 = integer\n for i = 0 to 7 exlusive\n for j = 0 to 7 exclusive\n if s at i is same as s at j and mat at i and j is not 0 then increment r\n end of the block\n end of the block\n return r\nend of the block\ndefine the main function\n let n, ans, temp, lans, ltemp be int with ans = temp = lans = ltemp = INT_MAX\n read n\n let arr, t be long long arrays of size 3 both with all 0\n for i = 0 to 7 exclusive\n for j = 0 to 7 exclusive, set mat[i][j] to false\n let hero be a map form string to int\n set hero at \"Anka\" to 0\n set hero at \"Chapay\" to 1\n set hero[\"Cleo\"] = 2\n set hero[\"Dracul\"] to 3\n set hero[\"Dracul\"] tp 4\n hero[\"Snowy\"] = 5\n set hero at Hexadecimal = 6\n let x, y, z, q be strings\n for i = 0 to n exclusive\n read x, y, z\n set mat[hero[x]][hero[z]] to true\n end of the block\n read arr at 0, arra at 1, arr at 2\n sort the first 3 elements of arr\n let h be a set of strings\n let it be a set string iterator\n set t at 2 = arr[2] \/ 5\n t[1] = arr[1]\n set t at 0 to arr[0]\n sort the first 3 elements of t\n set temp to t[2] - t[0]\n if temp is less than ans\n set ans to temp\n call insert on h with arg \"aaaaabc\"\n end of the block\n set t at 2 = arr[2]\/4\n set t at 1 = arr[1]\/2\n set t at 0 to arr at 0\n sort the first three elements of arr\n set temp = t[2] - t[0]\n if temp is less than ans\n set ans to temp\n clear h\n insert \"aaaabbc\" in h\n else if temp is same as ans\n insert \"aaaabbc\" in h\n end of the block\n set t[2] = arr[2] \/ 3\n set t[1] = arr[1] \/ 3\n set t at 0 to arr at 0\n sort the first 3 elements of t\n set tempo to t[2] - t[0]\n if temp < ans\n set ans to temp\n clear h\n insert \"aaaabbc\" in h\n else if temp is same as ans\n insert \"aaaabbc\" in h\n end of the block\n set t[2] to arr[2] \/ 3\n set t[1] to arr[1] \/ 2\n set t[0] to arr[0] \/ 2\n sort the first 3 elements of t\n set temp to t[2] - t[0]\n if temp is less than ans\n set ans to temp\n clear h\n insert \"aaabbcc\" in h\n if temp = ans\n insert \"aaabbcc\" in h\n end of the block\n while h is not empty\n set q to be q * the first element of h\n do loop\n set ltemp to calc of q\n if ltemp is greater than lans then set lans to ltemp\n while the result of calling next_permutation with args start of q and end of q is not 0\n erase q from h\n end of the block\n print ans and space and lans\n return to indicate successful execution\nend of the block","testcases":[[["3","Troll likes Dracul","Dracul likes Anka","Snowy likes Hexadecimal","210 200 180"],["30 3"]],[["2","Anka likes Chapay","Chapay likes Anka","10000 50 50"],["1950 2"]],[["11","Snowy likes Dracul","Anka likes Dracul","Chapay likes Snowy","Hexadecimal likes Troll","Anka likes Cleo","Chapay likes Dracul","Anka likes Chapay","Snowy likes Troll","Anka likes Hexadecimal","Cleo likes Chapay","Troll likes Cleo","100 100 100"],["17 5"]],[["14","Chapay likes Cleo","Cleo likes Anka","Dracul likes Snowy","Snowy likes Cleo","Chapay likes Anka","Snowy likes Anka","Chapay likes Troll","Troll likes Anka","Anka likes Snowy","Chapay likes Dracul","Dracul likes Anka","Hexadecimal likes Chapay","Snowy likes Dracul","Cleo likes Dracul","15 15 15"],["2 6"]],[["4","Anka likes Cleo","Snowy likes Cleo","Anka likes Hexadecimal","Cleo likes Snowy","1 1 1"],["0 3"]],[["8","Snowy likes Anka","Hexadecimal likes Snowy","Troll likes Dracul","Hexadecimal likes Troll","Snowy likes Troll","Anka likes Snowy","Snowy likes Chapay","Anka likes Chapay","70 70 70"],["12 5"]],[["0","100 300 600"],["50 0"]],[["3","Chapay likes Hexadecimal","Anka likes Cleo","Troll likes Snowy","15 15000 90"],["2985 2"]],[["0","1 1 10000"],["1999 0"]],[["13","Cleo likes Hexadecimal","Cleo likes Snowy","Hexadecimal likes Anka","Anka likes Snowy","Troll likes Snowy","Chapay likes Hexadecimal","Hexadecimal likes Snowy","Snowy likes Chapay","Troll likes Cleo","Anka likes Hexadecimal","Hexadecimal likes Cleo","Chapay likes Dracul","Snowy likes Dracul","1000000000 2000000000 1000000000"],["166666666 6"]],[["12","Cleo likes Hexadecimal","Chapay likes Anka","Hexadecimal likes Cleo","Anka likes Snowy","Anka likes Cleo","Dracul likes Snowy","Anka likes Troll","Snowy likes Anka","Cleo likes Anka","Hexadecimal likes Troll","Hexadecimal likes Chapay","Snowy likes Troll","1000000000 1 2000000000"],["499999999 7"]],[["0","2000000000 2000000000 2000000000"],["333333334 0"]],[["2","Snowy likes Hexadecimal","Troll likes Dracul","2000000000 2000000000 2000000000"],["333333334 2"]],[["12","Snowy likes Chapay","Cleo likes Dracul","Hexadecimal likes Snowy","Hexadecimal likes Anka","Dracul likes Chapay","Cleo likes Troll","Dracul likes Snowy","Snowy likes Dracul","Troll likes Chapay","Dracul likes Anka","Chapay likes Hexadecimal","Troll likes Dracul","436364663 856574374 347564737"],["111742423 6"]],[["12","Anka likes Dracul","Dracul likes Troll","Cleo likes Troll","Snowy likes Hexadecimal","Hexadecimal likes Chapay","Cleo likes Dracul","Cleo likes Chapay","Hexadecimal likes Anka","Snowy likes Cleo","Hexadecimal likes Snowy","Cleo likes Snowy","Chapay likes Snowy","584329075 428752235 675234087"],["77788420 6"]],[["8","Anka likes Chapay","Dracul likes Snowy","Snowy likes Cleo","Cleo likes Anka","Cleo likes Troll","Hexadecimal likes Troll","Troll likes Cleo","Snowy likes Dracul","325432666 254352394 547360304"],["55277237 6"]],[["18","Snowy likes Troll","Chapay likes Hexadecimal","Cleo likes Snowy","Dracul likes Snowy","Snowy likes Chapay","Troll likes Cleo","Snowy likes Anka","Dracul likes Hexadecimal","Hexadecimal likes Anka","Anka likes Hexadecimal","Anka likes Chapay","Troll likes Anka","Anka likes Snowy","Anka likes Troll","Snowy likes Cleo","Hexadecimal likes Troll","Hexadecimal likes Dracul","Cleo likes Anka","20000 1000 20000"],["5666 8"]],[["6","Chapay likes Troll","Troll likes Cleo","Cleo likes Troll","Chapay likes Snowy","Anka likes Snowy","Troll likes Dracul","987499608 272739716 133573597"],["113301305 5"]],[["6","Anka likes Troll","Troll likes Chapay","Troll likes Hexadecimal","Hexadecimal likes Cleo","Snowy likes Hexadecimal","Chapay likes Troll","740076959 230477703 987799796"],["98788895 5"]],[["17","Cleo likes Dracul","Troll likes Cleo","Anka likes Chapay","Anka likes Troll","Chapay likes Snowy","Troll likes Snowy","Chapay likes Dracul","Hexadecimal likes Snowy","Dracul likes Snowy","Troll likes Hexadecimal","Hexadecimal likes Anka","Cleo likes Snowy","Hexadecimal likes Dracul","Snowy likes Chapay","Snowy likes Hexadecimal","Snowy likes Dracul","Dracul likes Troll","112909524 619275170 403563648"],["88872300 9"]],[["1","Hexadecimal likes Chapay","848189141 631955593 79523012"],["203206701 1"]],[["18","Anka likes Troll","Dracul likes Chapay","Hexadecimal likes Dracul","Chapay likes Dracul","Anka likes Hexadecimal","Snowy likes Cleo","Dracul likes Anka","Snowy likes Anka","Snowy likes Hexadecimal","Dracul likes Troll","Dracul likes Snowy","Hexadecimal likes Anka","Chapay likes Hexadecimal","Snowy likes Dracul","Cleo likes Snowy","Chapay likes Cleo","Anka likes Dracul","Troll likes Anka","838821770 712931449 361810998"],["124167182 8"]],[["18","Hexadecimal likes Chapay","Troll likes Dracul","Troll likes Snowy","Cleo likes Dracul","Chapay likes Snowy","Dracul likes Chapay","Cleo likes Snowy","Dracul likes Hexadecimal","Troll likes Anka","Anka likes Troll","Hexadecimal likes Dracul","Chapay likes Hexadecimal","Cleo likes Chapay","Anka likes Hexadecimal","Snowy likes Dracul","Chapay likes Troll","Anka likes Snowy","Dracul likes Cleo","240256138 922743697 38909902"],["191776022 10"]],[["0","477107314 230715335 261545417"],["43678104 0"]],[["16","Chapay likes Snowy","Hexadecimal likes Anka","Chapay likes Troll","Dracul likes Cleo","Troll likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Cleo","Snowy likes Cleo","Snowy likes Anka","Troll likes Chapay","Snowy likes Hexadecimal","Troll likes Snowy","Cleo likes Hexadecimal","Anka likes Snowy","Snowy likes Chapay","Anka likes Dracul","843382501 58524777 503038818"],["192994632 8"]],[["5","Troll likes Chapay","Anka likes Snowy","Anka likes Dracul","Chapay likes Anka","Snowy likes Troll","709201888 431802832 597079932"],["82638550 3"]],[["18","Cleo likes Snowy","Snowy likes Hexadecimal","Cleo likes Hexadecimal","Troll likes Dracul","Hexadecimal likes Snowy","Dracul likes Troll","Chapay likes Anka","Chapay likes Cleo","Troll likes Chapay","Hexadecimal likes Chapay","Anka likes Snowy","Troll likes Snowy","Dracul likes Snowy","Dracul likes Chapay","Chapay likes Troll","Cleo likes Troll","Hexadecimal likes Cleo","Anka likes Chapay","864225278 509037060 402199775"],["86975205 9"]],[["12","Cleo likes Hexadecimal","Troll likes Cleo","Anka likes Cleo","Hexadecimal likes Troll","Anka likes Snowy","Hexadecimal likes Anka","Troll likes Hexadecimal","Troll likes Anka","Dracul likes Cleo","Cleo likes Troll","Dracul likes Troll","Chapay likes Anka","762445890 377707484 324080158"],["92108551 6"]],[["21","Chapay likes Dracul","Snowy likes Chapay","Snowy likes Troll","Cleo likes Chapay","Cleo likes Troll","Chapay likes Cleo","Snowy likes Anka","Dracul likes Anka","Troll likes Snowy","Snowy likes Cleo","Chapay likes Hexadecimal","Cleo likes Anka","Cleo likes Snowy","Hexadecimal likes Cleo","Hexadecimal likes Snowy","Hexadecimal likes Anka","Hexadecimal likes Troll","Anka likes Snowy","Dracul likes Troll","Chapay likes Anka","Snowy likes Hexadecimal","482557397 502108264 750230216"],["9775434 8"]],[["6","Troll likes Chapay","Hexadecimal likes Snowy","Cleo likes Dracul","Cleo likes Anka","Chapay likes Anka","Anka likes Chapay","758376921 432619768 578580897"],["72980564 5"]],[["5","Chapay likes Cleo","Anka likes Hexadecimal","Anka likes Chapay","Cleo likes Troll","Anka likes Cleo","299076810 225593528 36830738"],["62861532 3"]],[["13","Anka likes Cleo","Cleo likes Troll","Chapay likes Cleo","Snowy likes Troll","Chapay likes Anka","Chapay likes Snowy","Snowy likes Chapay","Anka likes Snowy","Snowy likes Dracul","Cleo likes Hexadecimal","Dracul likes Chapay","Anka likes Hexadecimal","Snowy likes Cleo","554338888 280967932 682619964"],["96188303 7"]],[["17","Hexadecimal likes Chapay","Chapay likes Snowy","Chapay likes Troll","Anka likes Hexadecimal","Cleo likes Troll","Snowy likes Cleo","Cleo likes Anka","Cleo likes Hexadecimal","Anka likes Snowy","Chapay likes Hexadecimal","Anka likes Cleo","Dracul likes Snowy","Chapay likes Anka","Troll likes Hexadecimal","Troll likes Anka","Anka likes Dracul","Hexadecimal likes Anka","828886798 548024213 166661324"],["107350782 9"]],[["2","Troll likes Cleo","Anka likes Cleo","14344913 559182022 405430772"],["172049094 2"]],[["22","Cleo likes Snowy","Cleo likes Troll","Chapay likes Dracul","Snowy likes Troll","Dracul likes Chapay","Dracul likes Snowy","Chapay likes Cleo","Snowy likes Chapay","Dracul likes Troll","Anka likes Hexadecimal","Snowy likes Anka","Hexadecimal likes Cleo","Hexadecimal likes Troll","Dracul likes Anka","Cleo likes Hexadecimal","Hexadecimal likes Dracul","Chapay likes Troll","Chapay likes Hexadecimal","Anka likes Snowy","Troll likes Hexadecimal","Snowy likes Hexadecimal","Anka likes Chapay","458053183 602148195 994999698"],["102639975 9"]],[["5","Troll likes Dracul","Anka likes Chapay","Cleo likes Anka","Chapay likes Cleo","Snowy likes Hexadecimal","222 400 400"],["89 5"]],[["0","2000000000 2000000000 1"],["666666665 0"]],[["0","1200000000 1200000000 1200000000"],["200000000 0"]],[["0","1 2000000000 2000000000"],["666666665 0"]]]}} +{"instance_id":"pseudo_to_code_2k_59","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate const long long integer mod = 1e9 + 9\ndeclare mod_pow taking in long long ints x and n and returning long long integer\n make long long res = 1\n while n is greater than 0\n if n & 1 is truthy, set res to res * x % mod\n set x to x * x % mod\n move bits of n 1 place to right\n end of the block\n return res\nend of the block\ndeclare extgcd taking in long long ints a, b, &x, and &y and returning long long integer\n make long long int d = a\n if b is not 0\n set d to extgcd(b, a % b, y, x)\n set y to y - (a \/ b) * x\n else do\n set x to 1\n set y to 0\n end of the block\n return d\nend of the block\ndeclare mod_inverse taking in long long a and returning long long int\n create long long ints x, y, and m\n set m to mod\n call extgcd(a, m, x, y)\n return the result of (m + x % m) % m\nend of the block\ndefine the main function\n make long long ints n, a, b, k, ans, temp, rec, and q\n make string s\n read n, a, b, and k\n read s\n set ans to 0\n for i = 0 to k exclusive\n set temp to (mod_pow(a, n - i) * mod_pow(b, i)) % mod\n if s[i] is equal to '+'\n set ans to (ans + temp) % mod\n else do\n set ans to (ans - temp) % mod\n if ans is less than 0, set ans to ans + mod\n end of the block\n if n + 1 is k\n print ans\n return to indicate successful execution\n end of the block\n set rec to (n + 1) \/ k\n set q to mod_pow((mod_inverse(a) * b) % mod, k) % mod\n if q is equal to 1\n set ans to (ans * rec) % mod\n otherwise\n set ans to ((ans * (mod_pow(q, rec) - 1) % mod) * mod_inverse(q - 1)) % mod\n display ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const long long mod = 1e9 + 9;\nlong long mod_pow(long long x, long long n) {\n long long res = 1;\n while (n > 0) {\n if (n & 1) res = res * x % mod;\n x = x * x % mod;\n n >>= 1;\n }\n return res;\n}\nlong long extgcd(long long a, long long b, long long &x, long long &y) {\n long long d = a;\n if (b != 0) {\n d = extgcd(b, a % b, y, x);\n y -= (a \/ b) * x;\n } else {\n x = 1;\n y = 0;\n }\n return d;\n}\nlong long mod_inverse(long long a) {\n long long x, y, m;\n m = mod;\n extgcd(a, m, x, y);\n return (m + x % m) % m;\n}\nint main() {\n long long n, a, b, k, ans, temp, rec, q;\n string s;\n cin >> n >> a >> b >> k;\n cin >> s;\n ans = 0;\n for (int i = 0; i < k; i++) {\n temp = (mod_pow(a, n - i) * mod_pow(b, i)) % mod;\n if (s[i] == '+')\n ans = (ans + temp) % mod;\n else\n ans = (ans - temp) % mod;\n if (ans < 0) ans += mod;\n }\n if (n + 1 == k) {\n cout << ans << endl;\n return 0;\n }\n rec = (n + 1) \/ k;\n q = mod_pow((mod_inverse(a) * b) % mod, k) % mod;\n if (q == 1)\n ans = (ans * rec) % mod;\n else\n ans = ((ans * (mod_pow(q, rec) - 1) % mod) * mod_inverse(q - 1)) % mod;\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"963A","pseudocode":"create const long long integer mod = 1e9 + 9\ndeclare mod_pow taking in long long ints x and n and returning long long integer\n make long long res = 1\n while n is greater than 0\n if n & 1 is truthy, set res to res * x % mod\n set x to x * x % mod\n move bits of n 1 place to right\n end of the block\n return res\nend of the block\ndeclare extgcd taking in long long ints a, b, &x, and &y and returning long long integer\n make long long int d = a\n if b is not 0\n set d to extgcd(b, a % b, y, x)\n set y to y - (a \/ b) * x\n else do\n set x to 1\n set y to 0\n end of the block\n return d\nend of the block\ndeclare mod_inverse taking in long long a and returning long long int\n create long long ints x, y, and m\n set m to mod\n call extgcd(a, m, x, y)\n return the result of (m + x % m) % m\nend of the block\ndefine the main function\n make long long ints n, a, b, k, ans, temp, rec, and q\n make string s\n read n, a, b, and k\n read s\n set ans to 0\n for i = 0 to k exclusive\n set temp to (mod_pow(a, n - i) * mod_pow(b, i)) % mod\n if s[i] is equal to '+'\n set ans to (ans + temp) % mod\n else do\n set ans to (ans - temp) % mod\n if ans is less than 0, set ans to ans + mod\n end of the block\n if n + 1 is k\n print ans\n return to indicate successful execution\n end of the block\n set rec to (n + 1) \/ k\n set q to mod_pow((mod_inverse(a) * b) % mod, k) % mod\n if q is equal to 1\n set ans to (ans * rec) % mod\n otherwise\n set ans to ((ans * (mod_pow(q, rec) - 1) % mod) * mod_inverse(q - 1)) % mod\n display ans\n return to indicate successful execution\nend of the block","testcases":[[["2 2 3 3","+-+"],["7"]],[["4 1 5 1","-"],["999999228"]],[["1 1 4 2","-+"],["3"]],[["3 1 4 4","+--+"],["45"]],[["5 1 1 6","++---+"],["0"]],[["5 2 2 6","+--++-"],["0"]],[["686653196 115381398 884618610 3","+-+"],["542231211"]],[["608663287 430477711 172252358 8","-+--+-+-"],["594681696"]],[["904132655 827386249 118827660 334","+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++++------+++-+-+-++-++++++++-+-++-+++--+--++------+--+-+++--++--+---++-++-+-+-++---++-++--+-+-++-+------+-+----+++-+++--+-+-+--+--+--+------+--+---+--+-++--+++---+-+-++--------+-++--++-+-+-+-+-+-+--+-++++-+++--+--++----+--+-++-++--+--+-+-++-+-++++-"],["188208979"]],[["234179195 430477711 115381398 12","++++-+-+-+++"],["549793323"]],[["75952547 967294208 907708706 252","++--++--+++-+-+--++--++++++---+++-++-+-----++++--++-+-++------+-+-+-++-+-+-++++------++---+-++++---+-+-++++--++++++--+-+++-++--+--+---++++---+-+++-+++--+-+--+++++---+--++-++++--++++-+-++-+++-++-----+-+++++----++--+++-+-+++++-+--++-++-+--+-++++--+-+-+-+"],["605712499"]],[["74709071 801809249 753674746 18","++++++-+-+---+-+--"],["13414893"]],[["743329 973758 92942 82","++----+-++++----+--+++---+--++++-+-+---+++++--+--+++++++--++-+++----+--+++++-+--+-"],["299311566"]],[["18111 291387 518587 2","++"],["724471355"]],[["996144 218286 837447 1","-"],["549104837"]],[["179358 828426 548710 67","++++---+--++----+-+-++++----+--+---+------++-+-++++--+----+---+-+--"],["759716474"]],[["397521 174985 279760 1","+"],["25679493"]],[["613632 812232 482342 1","-"],["891965141"]],[["936810 183454 647048 1","+"],["523548992"]],[["231531 250371 921383 28","++-+------+--+--++++--+-+++-"],["134450934"]],[["947301 87242 360762 97","--+++--+++-++--++-++--++--+++---+++--++++--+++++--+-++-++-----+-++-+--++-----+-++-+--++-++-+-----"],["405016159"]],[["425583346 814209084 570987274 1","+"],["63271171"]],[["354062556 688076879 786825319 1","+"],["545304776"]],[["206671954 13571766 192250278 1","+"],["717117421"]],[["23047921 621656196 160244047 1","-"],["101533009"]],[["806038018 740585177 987616107 293","-+++++--++++---++-+--+-+---+-++++--+--+++--++---++++++++--+++++-+-++-+--+----+--+++-+-++-+++-+-+-+----------++-+-+++++++-+-+-+-++---+++-+-+-------+-+-++--++-++-++-++-+---+--++-++--+++--+++-+-+----++--+-+-++-+---+---+-+-+++------+-+++-+---++-+--+++----+++++---++-++--+----+++-+--+++-+------+-++"],["441468166"]],[["262060935 184120408 148332034 148","+--+-------+-+-+--++-+++--++-+-++++++--++-+++-+++--+-------+-+--+++-+-+-+---++-++-+-++---+--+-+-+--+------+++--+--+-+-+---+---+-+-++++---+++--+++---"],["700325386"]],[["919350941 654611542 217223605 186","++-++-+++++-+++--+---+++++++-++-+----+-++--+-++--++--+++-+++---+--+--++-+-+++-+-+++-++---+--+++-+-+++--+-+-------+-++------++---+-+---++-++-++---+-+--+-+--+++++---+--+--++++-++-++--+--++"],["116291420"]],[["289455627 906207104 512692624 154","-------++--+++---++-++------++----------+--+++-+-+++---+---+++--++++++--+-+-+--+---+-+-++-++--+-++--++++---+-+---+-----+--+-+---------+++-++---++-+-+-----"],["48198216"]],[["258833760 515657142 791267045 1","-"],["935800888"]],[["691617927 66917103 843055237 8","--+++---"],["147768186"]],[["379582849 362892355 986900829 50","++-++---+-+++++--++++--+--++--++-----+------++--+-"],["927469713"]],[["176799169 363368399 841293419 1","+"],["746494802"]],[["144808247 203038656 166324035 4","-+-+"],["909066471"]],[["477607531 177367565 20080950 2","++"],["928662830"]],[["682074525 289438443 917164266 1","+"],["28048785"]],[["938449224 59852396 219719125 1","-"],["648647459"]],[["395171426 872478622 193568600 147","+---++---+-+--+++++--+---+-++++-+-++---++++--+--+-+-++-+-++--------++---+++-+---++---+---+-+--+-++++-+++-+-+-++-+--+++-++-+-+-+-++++++-+---+---++--"],["460881399"]],[["403493428 317461491 556701240 1","-"],["936516261"]],[["917751169 330191895 532837377 70","-+-+++++++--++---++-+++++-+++-----+-+++---+--+-+-++-++-+-+-++-++-+----"],["908035409"]],[["252089413 552678586 938424519 1","-"],["627032736"]],[["649316142 320010793 200197645 1","-"],["323650777"]],[["116399299 784781190 299072480 5","++++-"],["754650814"]]]}} +{"instance_id":"pseudo_to_code_2k_60","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare constant integer N = 2e5 + 10\ndeclare long long integers n, a, b, k, MOD = 1e9 + 9\ndeclare fast_power with long longs base, power as arguments, returning long long\n declare long long result = 1\n while power is greater than 0\n if power % 2 is 1, let result be (result * base) % MOD\n let base be (base * base) % MOD\n let power be power \/ 2\n end of the block\n return result from function\nend of the block\ndefine the main function\n read n, a, b, k\n declare string s\n read s\n declare integer l = (n + 1) \/ k - 1\n declare long long integer val = (b * result of run fast_power(a, MOD - 2)) % MOD\n declare long long integer valp = result of run fast_power(val, k)\n declare long long integer ans = 0\n declare long long integer geo\n if valp is not 1\n let geo be (result of run fast_power(valp, l + 1) - 1) % MOD + MOD\n let geo be geo * result of run fast_power((valp - 1) % MOD + MOD, MOD - 2) % MOD\n let geo be geo % MOD\n else\n let geo be l + 1\n for i = 0 to k exclusive\n declare long long integer calc = result of run fast_power(b, i) * result of run fast_power(a, n - i) % MOD\n if s[i] is '-'\n let ans be (ans - (geo * calc % MOD)) % MOD + MOD\n else\n let ans be (ans + (geo * calc % MOD) % MOD)\n let ans be ans % MOD\n end of the block\n print ans and newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int N = 2e5 + 10;\nlong long int n, a, b, k, MOD = 1e9 + 9;\nlong long fast_power(long long base, long long power) {\n long long result = 1;\n while (power > 0) {\n if (power % 2 == 1) { result = (result * base) % MOD; }\n base = (base * base) % MOD;\n power = power \/ 2;\n }\n return result;\n}\nint main() {\n cin >> n >> a >> b >> k;\n string s;\n cin >> s;\n int l = (n + 1) \/ k - 1;\n long long int val = (b * fast_power(a, MOD - 2)) % MOD;\n long long int valp = fast_power(val, k);\n long long int ans = 0;\n long long int geo;\n if (valp != 1) {\n geo = (fast_power(valp, l + 1) - 1) % MOD + MOD;\n geo = geo * fast_power((valp - 1) % MOD + MOD, MOD - 2) % MOD;\n geo %= MOD;\n } else\n geo = l + 1;\n for (int i = 0; i < k; i++) {\n long long int calc = fast_power(b, i) * fast_power(a, n - i) % MOD;\n if (s[i] == '-')\n ans = (ans - (geo * calc % MOD)) % MOD + MOD;\n else\n ans = (ans + (geo * calc % MOD) % MOD);\n ans %= MOD;\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"963A","pseudocode":"declare constant integer N = 2e5 + 10\ndeclare long long integers n, a, b, k, MOD = 1e9 + 9\ndeclare fast_power with long longs base, power as arguments, returning long long\n declare long long result = 1\n while power is greater than 0\n if power % 2 is 1, let result be (result * base) % MOD\n let base be (base * base) % MOD\n let power be power \/ 2\n end of the block\n return result from function\nend of the block\ndefine the main function\n read n, a, b, k\n declare string s\n read s\n declare integer l = (n + 1) \/ k - 1\n declare long long integer val = (b * result of run fast_power(a, MOD - 2)) % MOD\n declare long long integer valp = result of run fast_power(val, k)\n declare long long integer ans = 0\n declare long long integer geo\n if valp is not 1\n let geo be (result of run fast_power(valp, l + 1) - 1) % MOD + MOD\n let geo be geo * result of run fast_power((valp - 1) % MOD + MOD, MOD - 2) % MOD\n let geo be geo % MOD\n else\n let geo be l + 1\n for i = 0 to k exclusive\n declare long long integer calc = result of run fast_power(b, i) * result of run fast_power(a, n - i) % MOD\n if s[i] is '-'\n let ans be (ans - (geo * calc % MOD)) % MOD + MOD\n else\n let ans be (ans + (geo * calc % MOD) % MOD)\n let ans be ans % MOD\n end of the block\n print ans and newline\n return to indicate successful execution\nend of the block","testcases":[[["2 2 3 3","+-+"],["7"]],[["4 1 5 1","-"],["999999228"]],[["1 1 4 2","-+"],["3"]],[["3 1 4 4","+--+"],["45"]],[["5 1 1 6","++---+"],["0"]],[["5 2 2 6","+--++-"],["0"]],[["686653196 115381398 884618610 3","+-+"],["542231211"]],[["608663287 430477711 172252358 8","-+--+-+-"],["594681696"]],[["904132655 827386249 118827660 334","+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++++------+++-+-+-++-++++++++-+-++-+++--+--++------+--+-+++--++--+---++-++-+-+-++---++-++--+-+-++-+------+-+----+++-+++--+-+-+--+--+--+------+--+---+--+-++--+++---+-+-++--------+-++--++-+-+-+-+-+-+--+-++++-+++--+--++----+--+-++-++--+--+-+-++-+-++++-"],["188208979"]],[["234179195 430477711 115381398 12","++++-+-+-+++"],["549793323"]],[["75952547 967294208 907708706 252","++--++--+++-+-+--++--++++++---+++-++-+-----++++--++-+-++------+-+-+-++-+-+-++++------++---+-++++---+-+-++++--++++++--+-+++-++--+--+---++++---+-+++-+++--+-+--+++++---+--++-++++--++++-+-++-+++-++-----+-+++++----++--+++-+-+++++-+--++-++-+--+-++++--+-+-+-+"],["605712499"]],[["74709071 801809249 753674746 18","++++++-+-+---+-+--"],["13414893"]],[["743329 973758 92942 82","++----+-++++----+--+++---+--++++-+-+---+++++--+--+++++++--++-+++----+--+++++-+--+-"],["299311566"]],[["18111 291387 518587 2","++"],["724471355"]],[["996144 218286 837447 1","-"],["549104837"]],[["179358 828426 548710 67","++++---+--++----+-+-++++----+--+---+------++-+-++++--+----+---+-+--"],["759716474"]],[["397521 174985 279760 1","+"],["25679493"]],[["613632 812232 482342 1","-"],["891965141"]],[["936810 183454 647048 1","+"],["523548992"]],[["231531 250371 921383 28","++-+------+--+--++++--+-+++-"],["134450934"]],[["947301 87242 360762 97","--+++--+++-++--++-++--++--+++---+++--++++--+++++--+-++-++-----+-++-+--++-----+-++-+--++-++-+-----"],["405016159"]],[["425583346 814209084 570987274 1","+"],["63271171"]],[["354062556 688076879 786825319 1","+"],["545304776"]],[["206671954 13571766 192250278 1","+"],["717117421"]],[["23047921 621656196 160244047 1","-"],["101533009"]],[["806038018 740585177 987616107 293","-+++++--++++---++-+--+-+---+-++++--+--+++--++---++++++++--+++++-+-++-+--+----+--+++-+-++-+++-+-+-+----------++-+-+++++++-+-+-+-++---+++-+-+-------+-+-++--++-++-++-++-+---+--++-++--+++--+++-+-+----++--+-+-++-+---+---+-+-+++------+-+++-+---++-+--+++----+++++---++-++--+----+++-+--+++-+------+-++"],["441468166"]],[["262060935 184120408 148332034 148","+--+-------+-+-+--++-+++--++-+-++++++--++-+++-+++--+-------+-+--+++-+-+-+---++-++-+-++---+--+-+-+--+------+++--+--+-+-+---+---+-+-++++---+++--+++---"],["700325386"]],[["919350941 654611542 217223605 186","++-++-+++++-+++--+---+++++++-++-+----+-++--+-++--++--+++-+++---+--+--++-+-+++-+-+++-++---+--+++-+-+++--+-+-------+-++------++---+-+---++-++-++---+-+--+-+--+++++---+--+--++++-++-++--+--++"],["116291420"]],[["289455627 906207104 512692624 154","-------++--+++---++-++------++----------+--+++-+-+++---+---+++--++++++--+-+-+--+---+-+-++-++--+-++--++++---+-+---+-----+--+-+---------+++-++---++-+-+-----"],["48198216"]],[["258833760 515657142 791267045 1","-"],["935800888"]],[["691617927 66917103 843055237 8","--+++---"],["147768186"]],[["379582849 362892355 986900829 50","++-++---+-+++++--++++--+--++--++-----+------++--+-"],["927469713"]],[["176799169 363368399 841293419 1","+"],["746494802"]],[["144808247 203038656 166324035 4","-+-+"],["909066471"]],[["477607531 177367565 20080950 2","++"],["928662830"]],[["682074525 289438443 917164266 1","+"],["28048785"]],[["938449224 59852396 219719125 1","-"],["648647459"]],[["395171426 872478622 193568600 147","+---++---+-+--+++++--+---+-++++-+-++---++++--+--+-+-++-+-++--------++---+++-+---++---+---+-+--+-++++-+++-+-+-++-+--+++-++-+-+-+-++++++-+---+---++--"],["460881399"]],[["403493428 317461491 556701240 1","-"],["936516261"]],[["917751169 330191895 532837377 70","-+-+++++++--++---++-+++++-+++-----+-+++---+--+-+-++-++-+-+-++-++-+----"],["908035409"]],[["252089413 552678586 938424519 1","-"],["627032736"]],[["649316142 320010793 200197645 1","-"],["323650777"]],[["116399299 784781190 299072480 5","++++-"],["754650814"]]]}} +{"instance_id":"pseudo_to_code_2k_61","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare new long long variable mod with value 1e9+9\nnew array of characters s with size 500005\nlong long function power with long long arguments a and b\n create long long variable ret = 1\n change a to a modulo mod\n while b is not 0\n if b & 1 is not 0, change ret to ret * a % mod\n change a to a squared modulo mod\n set b to b >> 1\n end of the block\n return ret\nend of the block\ndefine the main function\n declare long long variables n, a, b and k\n read n, a, b and k from the user input\n read input an store it into s\n read input into s\n declare new long long called t with value (n + 1) \/ k\n declare new long long u = power(b, k) * power(power(a, k), mod - 2) % mod\n assign (power(u, t) + mod - 1) % mod * power(u - 1 + mod, mod - 2) % mod to t\n if u = 1, assign (n + 1) \/ k to t\n declare long long variable with name ans with value 0\n for i = 0 to k exclusive incrementing i\n declare long long variable tmp\n assign the new value = power(a, n - i) * power(b, i) % mod\n assign tmp * t % mod to tmp\n if s[i] = '+'\n change the value of ans to (ans + tmp) % mod\n else\n change ans to ans - tmp + mod\n change the value of ans to ans modulo mod\n end of the block\n end of the block\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long mod = 1e9 + 9;\nchar s[500005];\nlong long power(long long a, long long b) {\n long long ret = 1;\n a %= mod;\n while (b) {\n if (b & 1) ret = ret * a % mod;\n a = a * a % mod;\n b >>= 1;\n }\n return ret;\n}\nint main() {\n long long n, a, b, k;\n cin >> n >> a >> b >> k;\n gets(s);\n gets(s);\n long long t = (n + 1) \/ k;\n long long u = power(b, k) * power(power(a, k), mod - 2) % mod;\n t = (power(u, t) + mod - 1) % mod * power(u - 1 + mod, mod - 2) % mod;\n if (u == 1) t = (n + 1) \/ k;\n long long ans = 0;\n for (int i = 0; i < k; ++i) {\n long long tmp;\n tmp = power(a, n - i) * power(b, i) % mod;\n tmp = tmp * t % mod;\n if (s[i] == '+') {\n ans = (ans + tmp) % mod;\n } else {\n ans = ans - tmp + mod;\n ans %= mod;\n }\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"963A","pseudocode":"declare new long long variable mod with value 1e9+9\nnew array of characters s with size 500005\nlong long function power with long long arguments a and b\n create long long variable ret = 1\n change a to a modulo mod\n while b is not 0\n if b & 1 is not 0, change ret to ret * a % mod\n change a to a squared modulo mod\n set b to b >> 1\n end of the block\n return ret\nend of the block\ndefine the main function\n declare long long variables n, a, b and k\n read n, a, b and k from the user input\n read input an store it into s\n read input into s\n declare new long long called t with value (n + 1) \/ k\n declare new long long u = power(b, k) * power(power(a, k), mod - 2) % mod\n assign (power(u, t) + mod - 1) % mod * power(u - 1 + mod, mod - 2) % mod to t\n if u = 1, assign (n + 1) \/ k to t\n declare long long variable with name ans with value 0\n for i = 0 to k exclusive incrementing i\n declare long long variable tmp\n assign the new value = power(a, n - i) * power(b, i) % mod\n assign tmp * t % mod to tmp\n if s[i] = '+'\n change the value of ans to (ans + tmp) % mod\n else\n change ans to ans - tmp + mod\n change the value of ans to ans modulo mod\n end of the block\n end of the block\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["2 2 3 3","+-+"],["7"]],[["4 1 5 1","-"],["999999228"]],[["1 1 4 2","-+"],["3"]],[["3 1 4 4","+--+"],["45"]],[["5 1 1 6","++---+"],["0"]],[["5 2 2 6","+--++-"],["0"]],[["686653196 115381398 884618610 3","+-+"],["542231211"]],[["608663287 430477711 172252358 8","-+--+-+-"],["594681696"]],[["904132655 827386249 118827660 334","+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++++------+++-+-+-++-++++++++-+-++-+++--+--++------+--+-+++--++--+---++-++-+-+-++---++-++--+-+-++-+------+-+----+++-+++--+-+-+--+--+--+------+--+---+--+-++--+++---+-+-++--------+-++--++-+-+-+-+-+-+--+-++++-+++--+--++----+--+-++-++--+--+-+-++-+-++++-"],["188208979"]],[["234179195 430477711 115381398 12","++++-+-+-+++"],["549793323"]],[["75952547 967294208 907708706 252","++--++--+++-+-+--++--++++++---+++-++-+-----++++--++-+-++------+-+-+-++-+-+-++++------++---+-++++---+-+-++++--++++++--+-+++-++--+--+---++++---+-+++-+++--+-+--+++++---+--++-++++--++++-+-++-+++-++-----+-+++++----++--+++-+-+++++-+--++-++-+--+-++++--+-+-+-+"],["605712499"]],[["74709071 801809249 753674746 18","++++++-+-+---+-+--"],["13414893"]],[["743329 973758 92942 82","++----+-++++----+--+++---+--++++-+-+---+++++--+--+++++++--++-+++----+--+++++-+--+-"],["299311566"]],[["18111 291387 518587 2","++"],["724471355"]],[["996144 218286 837447 1","-"],["549104837"]],[["179358 828426 548710 67","++++---+--++----+-+-++++----+--+---+------++-+-++++--+----+---+-+--"],["759716474"]],[["397521 174985 279760 1","+"],["25679493"]],[["613632 812232 482342 1","-"],["891965141"]],[["936810 183454 647048 1","+"],["523548992"]],[["231531 250371 921383 28","++-+------+--+--++++--+-+++-"],["134450934"]],[["947301 87242 360762 97","--+++--+++-++--++-++--++--+++---+++--++++--+++++--+-++-++-----+-++-+--++-----+-++-+--++-++-+-----"],["405016159"]],[["425583346 814209084 570987274 1","+"],["63271171"]],[["354062556 688076879 786825319 1","+"],["545304776"]],[["206671954 13571766 192250278 1","+"],["717117421"]],[["23047921 621656196 160244047 1","-"],["101533009"]],[["806038018 740585177 987616107 293","-+++++--++++---++-+--+-+---+-++++--+--+++--++---++++++++--+++++-+-++-+--+----+--+++-+-++-+++-+-+-+----------++-+-+++++++-+-+-+-++---+++-+-+-------+-+-++--++-++-++-++-+---+--++-++--+++--+++-+-+----++--+-+-++-+---+---+-+-+++------+-+++-+---++-+--+++----+++++---++-++--+----+++-+--+++-+------+-++"],["441468166"]],[["262060935 184120408 148332034 148","+--+-------+-+-+--++-+++--++-+-++++++--++-+++-+++--+-------+-+--+++-+-+-+---++-++-+-++---+--+-+-+--+------+++--+--+-+-+---+---+-+-++++---+++--+++---"],["700325386"]],[["919350941 654611542 217223605 186","++-++-+++++-+++--+---+++++++-++-+----+-++--+-++--++--+++-+++---+--+--++-+-+++-+-+++-++---+--+++-+-+++--+-+-------+-++------++---+-+---++-++-++---+-+--+-+--+++++---+--+--++++-++-++--+--++"],["116291420"]],[["289455627 906207104 512692624 154","-------++--+++---++-++------++----------+--+++-+-+++---+---+++--++++++--+-+-+--+---+-+-++-++--+-++--++++---+-+---+-----+--+-+---------+++-++---++-+-+-----"],["48198216"]],[["258833760 515657142 791267045 1","-"],["935800888"]],[["691617927 66917103 843055237 8","--+++---"],["147768186"]],[["379582849 362892355 986900829 50","++-++---+-+++++--++++--+--++--++-----+------++--+-"],["927469713"]],[["176799169 363368399 841293419 1","+"],["746494802"]],[["144808247 203038656 166324035 4","-+-+"],["909066471"]],[["477607531 177367565 20080950 2","++"],["928662830"]],[["682074525 289438443 917164266 1","+"],["28048785"]],[["938449224 59852396 219719125 1","-"],["648647459"]],[["395171426 872478622 193568600 147","+---++---+-+--+++++--+---+-++++-+-++---++++--+--+-+-++-+-++--------++---+++-+---++---+---+-+--+-++++-+++-+-+-++-+--+++-++-+-+-+-++++++-+---+---++--"],["460881399"]],[["403493428 317461491 556701240 1","-"],["936516261"]],[["917751169 330191895 532837377 70","-+-+++++++--++---++-+++++-+++-----+-+++---+--+-+-++-++-+-+-++-++-+----"],["908035409"]],[["252089413 552678586 938424519 1","-"],["627032736"]],[["649316142 320010793 200197645 1","-"],["323650777"]],[["116399299 784781190 299072480 5","++++-"],["754650814"]]]}} +{"instance_id":"pseudo_to_code_2k_62","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate long long integer MOD = 1000000009\ninto the function pw which takes two long long integers a and b and returns a long long integer\n if b is 0 then return 1\n if b is 1 then return a % MOD\n if b%2 is true\n create long long rs= pw(a,b-1)\n return (rs * a) % MOD\n end of the block\n create long long integer rs= pw(a,b\/2)\n return (rs * rs) % MOD\nend of the block\nsm = long long integer vector\ninto the function solve which takes a and b\n if b is 0 then return 0\n for i=0 to 35 exclusive\n create long long integer ba = (1LL << i) & b\n if ba is equal to 0 then continue\n return sm[i] + solve(a, b - (1LL << i)) * pw(a, (1LL << i))) % MOD\n end of the block\nend of the block\ndefine the main function\n n,a,b,k = long long integers\n read n,a,b,k\n s=string\n read s\n create long long integers X and Y with values 1\n for i=o to k exclusive\n set X = X * b\n set X = X % MOD\n end of the block\n for i=0 to k exclusive\n set Y = Y * a\n set Y = Y % MOD\n end of the block\n set X = X * pw(Y, MOD - 2)\n set X = X % MOD\n add 1 to the end of sm\n for i=0 to 40 exclusive\n add sm.back() + sm.back() * pw(X, (1LL << i) to end of sm\n set sm.back() = sm.back() % MOD\n end of the block\n create long long integer st = solve(X, (n + 1) \/ k)\n create long long integer ans=0\n for i=0 to k exclusive\n create long long integer rs = (pw(b, i) * pw(a, n - i)) % MOD\n if s[i] is '-' then set rs = rs * -1\n set rs = rs * st\n set ans = ans + rs\n set ans = ans % MOD\n end of the block\n if ans is less than 0 then set ans = ans + MOD\n print ans\nend of the block\n\n[CODE]:","reference_output":"long long MOD = 1000000009;\nlong long pw(long long a, long long b) {\n if (b == 0) return 1;\n if (b == 1) return a % MOD;\n if (b % 2) {\n long long rs = pw(a, b - 1);\n return (rs * a) % MOD;\n }\n long long rs = pw(a, b \/ 2);\n return (rs * rs) % MOD;\n}\nvector sm;\nlong long solve(long long a, long long b) {\n if (b == 0) return 0;\n for (long long i = 0; i < 35; i++) {\n long long ba = (1LL << i) & b;\n if (ba == 0) continue;\n return (sm[i] + solve(a, b - (1LL << i)) * pw(a, (1LL << i))) % MOD;\n }\n}\nint main() {\n long long n, a, b, k;\n cin >> n >> a >> b >> k;\n string s;\n cin >> s;\n long long X = 1, Y = 1;\n for (long long i = 0; i < k; i++) {\n X *= b;\n X %= MOD;\n }\n for (long long i = 0; i < k; i++) {\n Y *= a;\n Y %= MOD;\n }\n X *= pw(Y, MOD - 2);\n X %= MOD;\n sm.push_back(1);\n for (long long i = 0; i < 40; i++) {\n sm.push_back(sm.back() + sm.back() * pw(X, (1LL << i)));\n sm.back() %= MOD;\n }\n long long st = solve(X, (n + 1) \/ k);\n long long ans = 0;\n for (long long i = 0; i < k; i++) {\n long long rs = (pw(b, i) * pw(a, n - i)) % MOD;\n if (s[i] == '-') rs *= -1;\n rs *= st;\n ans += rs;\n ans %= MOD;\n }\n if (ans < 0) ans += MOD;\n cout << ans << endl;\n}","item":{"problem_id":"963A","pseudocode":"create long long integer MOD = 1000000009\ninto the function pw which takes two long long integers a and b and returns a long long integer\n if b is 0 then return 1\n if b is 1 then return a % MOD\n if b%2 is true\n create long long rs= pw(a,b-1)\n return (rs * a) % MOD\n end of the block\n create long long integer rs= pw(a,b\/2)\n return (rs * rs) % MOD\nend of the block\nsm = long long integer vector\ninto the function solve which takes a and b\n if b is 0 then return 0\n for i=0 to 35 exclusive\n create long long integer ba = (1LL << i) & b\n if ba is equal to 0 then continue\n return sm[i] + solve(a, b - (1LL << i)) * pw(a, (1LL << i))) % MOD\n end of the block\nend of the block\ndefine the main function\n n,a,b,k = long long integers\n read n,a,b,k\n s=string\n read s\n create long long integers X and Y with values 1\n for i=o to k exclusive\n set X = X * b\n set X = X % MOD\n end of the block\n for i=0 to k exclusive\n set Y = Y * a\n set Y = Y % MOD\n end of the block\n set X = X * pw(Y, MOD - 2)\n set X = X % MOD\n add 1 to the end of sm\n for i=0 to 40 exclusive\n add sm.back() + sm.back() * pw(X, (1LL << i) to end of sm\n set sm.back() = sm.back() % MOD\n end of the block\n create long long integer st = solve(X, (n + 1) \/ k)\n create long long integer ans=0\n for i=0 to k exclusive\n create long long integer rs = (pw(b, i) * pw(a, n - i)) % MOD\n if s[i] is '-' then set rs = rs * -1\n set rs = rs * st\n set ans = ans + rs\n set ans = ans % MOD\n end of the block\n if ans is less than 0 then set ans = ans + MOD\n print ans\nend of the block","testcases":[[["2 2 3 3","+-+"],["7"]],[["4 1 5 1","-"],["999999228"]],[["1 1 4 2","-+"],["3"]],[["3 1 4 4","+--+"],["45"]],[["5 1 1 6","++---+"],["0"]],[["5 2 2 6","+--++-"],["0"]],[["686653196 115381398 884618610 3","+-+"],["542231211"]],[["608663287 430477711 172252358 8","-+--+-+-"],["594681696"]],[["904132655 827386249 118827660 334","+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++++------+++-+-+-++-++++++++-+-++-+++--+--++------+--+-+++--++--+---++-++-+-+-++---++-++--+-+-++-+------+-+----+++-+++--+-+-+--+--+--+------+--+---+--+-++--+++---+-+-++--------+-++--++-+-+-+-+-+-+--+-++++-+++--+--++----+--+-++-++--+--+-+-++-+-++++-"],["188208979"]],[["234179195 430477711 115381398 12","++++-+-+-+++"],["549793323"]],[["75952547 967294208 907708706 252","++--++--+++-+-+--++--++++++---+++-++-+-----++++--++-+-++------+-+-+-++-+-+-++++------++---+-++++---+-+-++++--++++++--+-+++-++--+--+---++++---+-+++-+++--+-+--+++++---+--++-++++--++++-+-++-+++-++-----+-+++++----++--+++-+-+++++-+--++-++-+--+-++++--+-+-+-+"],["605712499"]],[["74709071 801809249 753674746 18","++++++-+-+---+-+--"],["13414893"]],[["743329 973758 92942 82","++----+-++++----+--+++---+--++++-+-+---+++++--+--+++++++--++-+++----+--+++++-+--+-"],["299311566"]],[["18111 291387 518587 2","++"],["724471355"]],[["996144 218286 837447 1","-"],["549104837"]],[["179358 828426 548710 67","++++---+--++----+-+-++++----+--+---+------++-+-++++--+----+---+-+--"],["759716474"]],[["397521 174985 279760 1","+"],["25679493"]],[["613632 812232 482342 1","-"],["891965141"]],[["936810 183454 647048 1","+"],["523548992"]],[["231531 250371 921383 28","++-+------+--+--++++--+-+++-"],["134450934"]],[["947301 87242 360762 97","--+++--+++-++--++-++--++--+++---+++--++++--+++++--+-++-++-----+-++-+--++-----+-++-+--++-++-+-----"],["405016159"]],[["425583346 814209084 570987274 1","+"],["63271171"]],[["354062556 688076879 786825319 1","+"],["545304776"]],[["206671954 13571766 192250278 1","+"],["717117421"]],[["23047921 621656196 160244047 1","-"],["101533009"]],[["806038018 740585177 987616107 293","-+++++--++++---++-+--+-+---+-++++--+--+++--++---++++++++--+++++-+-++-+--+----+--+++-+-++-+++-+-+-+----------++-+-+++++++-+-+-+-++---+++-+-+-------+-+-++--++-++-++-++-+---+--++-++--+++--+++-+-+----++--+-+-++-+---+---+-+-+++------+-+++-+---++-+--+++----+++++---++-++--+----+++-+--+++-+------+-++"],["441468166"]],[["262060935 184120408 148332034 148","+--+-------+-+-+--++-+++--++-+-++++++--++-+++-+++--+-------+-+--+++-+-+-+---++-++-+-++---+--+-+-+--+------+++--+--+-+-+---+---+-+-++++---+++--+++---"],["700325386"]],[["919350941 654611542 217223605 186","++-++-+++++-+++--+---+++++++-++-+----+-++--+-++--++--+++-+++---+--+--++-+-+++-+-+++-++---+--+++-+-+++--+-+-------+-++------++---+-+---++-++-++---+-+--+-+--+++++---+--+--++++-++-++--+--++"],["116291420"]],[["289455627 906207104 512692624 154","-------++--+++---++-++------++----------+--+++-+-+++---+---+++--++++++--+-+-+--+---+-+-++-++--+-++--++++---+-+---+-----+--+-+---------+++-++---++-+-+-----"],["48198216"]],[["258833760 515657142 791267045 1","-"],["935800888"]],[["691617927 66917103 843055237 8","--+++---"],["147768186"]],[["379582849 362892355 986900829 50","++-++---+-+++++--++++--+--++--++-----+------++--+-"],["927469713"]],[["176799169 363368399 841293419 1","+"],["746494802"]],[["144808247 203038656 166324035 4","-+-+"],["909066471"]],[["477607531 177367565 20080950 2","++"],["928662830"]],[["682074525 289438443 917164266 1","+"],["28048785"]],[["938449224 59852396 219719125 1","-"],["648647459"]],[["395171426 872478622 193568600 147","+---++---+-+--+++++--+---+-++++-+-++---++++--+--+-+-++-+-++--------++---+++-+---++---+---+-+--+-++++-+++-+-+-++-+--+++-++-+-+-+-++++++-+---+---++--"],["460881399"]],[["403493428 317461491 556701240 1","-"],["936516261"]],[["917751169 330191895 532837377 70","-+-+++++++--++---++-+++++-+++-----+-+++---+--+-+-++-++-+-+-++-++-+----"],["908035409"]],[["252089413 552678586 938424519 1","-"],["627032736"]],[["649316142 320010793 200197645 1","-"],["323650777"]],[["116399299 784781190 299072480 5","++++-"],["754650814"]]]}} +{"instance_id":"pseudo_to_code_2k_63","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmake long long int mod = 1e9 + 9\ncreate ints d, x, and y\ndeclare fastexp taking in long long ints b and p and returning long long integer\n if p is 0, return 1\n create long long int ans = fastexp(b, p \/ 2) % mod\n if p modulo 2 is truthy\n return the result of ((1LL * b * ans % mod) * 1LL * ans) % mod\n else do\n return the result of (1LL * ans * ans + mod) % mod\nend of the block\ndefine the main function\n make long long ints a, n, b, and k\n create string s\n make long long integers v1, v2, v3, and sum = 0\n read n, a, b, and k\n read s\n for h = 0 to k exclusive\n if s[h] equals '+'\n set v1 to fastexp(a, n - h) % mod\n set v2 to fastexp(b, h) % mod\n set v3 to (v1 * v2 + mod) % mod\n set sum to (sum % mod + v3 % mod + mod) % mod\n else do\n set v1 to fastexp(a, n - h)\n set v2 to return value of fastexp(b, h)\n set v3 to (v1 * v2 + mod) % mod\n set sum to (sum % mod - v3 % mod + mod) % mod\n end of the block\n end of the block\n create long long int v1 = (n + 1) \/ k\n make long long integer inv_a = fastexp(a, mod - 2) % mod\n make long long integer vv = ((inv_a % mod) * (b % mod) + mod) % mod\n let long long integer vl1 = ((fastexp(vv, k) % mod)) % mod\n if vl1 is 1\n create long long int ans = ((v1 * sum) + mod) % mod\n display ans\n return to indicate successful execution\n end of the block\n create long long integer vl4 = fastexp(vl1, vl) % mod\n set vl4 to (vl4 - 1 + mod) % mod\n set vl4 to (vl4 * sum + mod) % mod\n make long long integer vl2 = (((vl1 + mod) % mod) - 1 + mod) % mod\n create long long integer vl3 = (vl4 * (fastexp(vl2, mod - 2)) + mod) % mod\n print the result of vl3 % mod\nend of the block\n\n[CODE]:","reference_output":"long long int mod = 1e9 + 9;\nint d, x, y;\nlong long int fastexp(long long int b, long long int p) {\n if (p == 0) return 1;\n long long int ans = fastexp(b, p \/ 2) % mod;\n if (p % 2)\n return ((1LL * b * ans % mod) * 1LL * ans) % mod;\n else\n return (1LL * ans * ans + mod) % mod;\n}\nint main() {\n long long int a, n, b, k;\n string s;\n long long int v1, v2, v3, sum = 0;\n cin >> n >> a >> b >> k;\n cin >> s;\n for (int h = 0; h < k; h++) {\n if (s[h] == '+') {\n v1 = fastexp(a, n - h) % mod;\n v2 = fastexp(b, h) % mod;\n v3 = (v1 * v2 + mod) % mod;\n sum = (sum % mod + v3 % mod + mod) % mod;\n } else {\n v1 = fastexp(a, n - h);\n v2 = fastexp(b, h);\n v3 = (v1 * v2 + mod) % mod;\n sum = (sum % mod - v3 % mod + mod) % mod;\n }\n }\n long long int vl = (n + 1) \/ k;\n long long int inv_a = fastexp(a, mod - 2) % mod;\n long long int vv = ((inv_a % mod) * (b % mod) + mod) % mod;\n long long int vl1 = ((fastexp(vv, k) % mod)) % mod;\n if (vl1 == 1) {\n long long int ans = ((vl * sum) + mod) % mod;\n cout << ans << endl;\n return 0;\n }\n long long int vl4 = fastexp(vl1, vl) % mod;\n vl4 = (vl4 - 1 + mod) % mod;\n vl4 = (vl4 * sum + mod) % mod;\n long long int vl2 = (((vl1 + mod) % mod) - 1 + mod) % mod;\n long long int vl3 = (vl4 * (fastexp(vl2, mod - 2)) + mod) % mod;\n cout << vl3 % mod << endl;\n}","item":{"problem_id":"963A","pseudocode":"make long long int mod = 1e9 + 9\ncreate ints d, x, and y\ndeclare fastexp taking in long long ints b and p and returning long long integer\n if p is 0, return 1\n create long long int ans = fastexp(b, p \/ 2) % mod\n if p modulo 2 is truthy\n return the result of ((1LL * b * ans % mod) * 1LL * ans) % mod\n else do\n return the result of (1LL * ans * ans + mod) % mod\nend of the block\ndefine the main function\n make long long ints a, n, b, and k\n create string s\n make long long integers v1, v2, v3, and sum = 0\n read n, a, b, and k\n read s\n for h = 0 to k exclusive\n if s[h] equals '+'\n set v1 to fastexp(a, n - h) % mod\n set v2 to fastexp(b, h) % mod\n set v3 to (v1 * v2 + mod) % mod\n set sum to (sum % mod + v3 % mod + mod) % mod\n else do\n set v1 to fastexp(a, n - h)\n set v2 to return value of fastexp(b, h)\n set v3 to (v1 * v2 + mod) % mod\n set sum to (sum % mod - v3 % mod + mod) % mod\n end of the block\n end of the block\n create long long int v1 = (n + 1) \/ k\n make long long integer inv_a = fastexp(a, mod - 2) % mod\n make long long integer vv = ((inv_a % mod) * (b % mod) + mod) % mod\n let long long integer vl1 = ((fastexp(vv, k) % mod)) % mod\n if vl1 is 1\n create long long int ans = ((v1 * sum) + mod) % mod\n display ans\n return to indicate successful execution\n end of the block\n create long long integer vl4 = fastexp(vl1, vl) % mod\n set vl4 to (vl4 - 1 + mod) % mod\n set vl4 to (vl4 * sum + mod) % mod\n make long long integer vl2 = (((vl1 + mod) % mod) - 1 + mod) % mod\n create long long integer vl3 = (vl4 * (fastexp(vl2, mod - 2)) + mod) % mod\n print the result of vl3 % mod\nend of the block","testcases":[[["2 2 3 3","+-+"],["7"]],[["4 1 5 1","-"],["999999228"]],[["1 1 4 2","-+"],["3"]],[["3 1 4 4","+--+"],["45"]],[["5 1 1 6","++---+"],["0"]],[["5 2 2 6","+--++-"],["0"]],[["686653196 115381398 884618610 3","+-+"],["542231211"]],[["608663287 430477711 172252358 8","-+--+-+-"],["594681696"]],[["904132655 827386249 118827660 334","+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++++------+++-+-+-++-++++++++-+-++-+++--+--++------+--+-+++--++--+---++-++-+-+-++---++-++--+-+-++-+------+-+----+++-+++--+-+-+--+--+--+------+--+---+--+-++--+++---+-+-++--------+-++--++-+-+-+-+-+-+--+-++++-+++--+--++----+--+-++-++--+--+-+-++-+-++++-"],["188208979"]],[["234179195 430477711 115381398 12","++++-+-+-+++"],["549793323"]],[["75952547 967294208 907708706 252","++--++--+++-+-+--++--++++++---+++-++-+-----++++--++-+-++------+-+-+-++-+-+-++++------++---+-++++---+-+-++++--++++++--+-+++-++--+--+---++++---+-+++-+++--+-+--+++++---+--++-++++--++++-+-++-+++-++-----+-+++++----++--+++-+-+++++-+--++-++-+--+-++++--+-+-+-+"],["605712499"]],[["74709071 801809249 753674746 18","++++++-+-+---+-+--"],["13414893"]],[["743329 973758 92942 82","++----+-++++----+--+++---+--++++-+-+---+++++--+--+++++++--++-+++----+--+++++-+--+-"],["299311566"]],[["18111 291387 518587 2","++"],["724471355"]],[["996144 218286 837447 1","-"],["549104837"]],[["179358 828426 548710 67","++++---+--++----+-+-++++----+--+---+------++-+-++++--+----+---+-+--"],["759716474"]],[["397521 174985 279760 1","+"],["25679493"]],[["613632 812232 482342 1","-"],["891965141"]],[["936810 183454 647048 1","+"],["523548992"]],[["231531 250371 921383 28","++-+------+--+--++++--+-+++-"],["134450934"]],[["947301 87242 360762 97","--+++--+++-++--++-++--++--+++---+++--++++--+++++--+-++-++-----+-++-+--++-----+-++-+--++-++-+-----"],["405016159"]],[["425583346 814209084 570987274 1","+"],["63271171"]],[["354062556 688076879 786825319 1","+"],["545304776"]],[["206671954 13571766 192250278 1","+"],["717117421"]],[["23047921 621656196 160244047 1","-"],["101533009"]],[["806038018 740585177 987616107 293","-+++++--++++---++-+--+-+---+-++++--+--+++--++---++++++++--+++++-+-++-+--+----+--+++-+-++-+++-+-+-+----------++-+-+++++++-+-+-+-++---+++-+-+-------+-+-++--++-++-++-++-+---+--++-++--+++--+++-+-+----++--+-+-++-+---+---+-+-+++------+-+++-+---++-+--+++----+++++---++-++--+----+++-+--+++-+------+-++"],["441468166"]],[["262060935 184120408 148332034 148","+--+-------+-+-+--++-+++--++-+-++++++--++-+++-+++--+-------+-+--+++-+-+-+---++-++-+-++---+--+-+-+--+------+++--+--+-+-+---+---+-+-++++---+++--+++---"],["700325386"]],[["919350941 654611542 217223605 186","++-++-+++++-+++--+---+++++++-++-+----+-++--+-++--++--+++-+++---+--+--++-+-+++-+-+++-++---+--+++-+-+++--+-+-------+-++------++---+-+---++-++-++---+-+--+-+--+++++---+--+--++++-++-++--+--++"],["116291420"]],[["289455627 906207104 512692624 154","-------++--+++---++-++------++----------+--+++-+-+++---+---+++--++++++--+-+-+--+---+-+-++-++--+-++--++++---+-+---+-----+--+-+---------+++-++---++-+-+-----"],["48198216"]],[["258833760 515657142 791267045 1","-"],["935800888"]],[["691617927 66917103 843055237 8","--+++---"],["147768186"]],[["379582849 362892355 986900829 50","++-++---+-+++++--++++--+--++--++-----+------++--+-"],["927469713"]],[["176799169 363368399 841293419 1","+"],["746494802"]],[["144808247 203038656 166324035 4","-+-+"],["909066471"]],[["477607531 177367565 20080950 2","++"],["928662830"]],[["682074525 289438443 917164266 1","+"],["28048785"]],[["938449224 59852396 219719125 1","-"],["648647459"]],[["395171426 872478622 193568600 147","+---++---+-+--+++++--+---+-++++-+-++---++++--+--+-+-++-+-++--------++---+++-+---++---+---+-+--+-++++-+++-+-+-++-+--+++-++-+-+-+-++++++-+---+---++--"],["460881399"]],[["403493428 317461491 556701240 1","-"],["936516261"]],[["917751169 330191895 532837377 70","-+-+++++++--++---++-+++++-+++-----+-+++---+--+-+-++-++-+-+-++-++-+----"],["908035409"]],[["252089413 552678586 938424519 1","-"],["627032736"]],[["649316142 320010793 200197645 1","-"],["323650777"]],[["116399299 784781190 299072480 5","++++-"],["754650814"]]]}} +{"instance_id":"pseudo_to_code_2k_64","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nMAXN = constant integer = 100000\nMOD = constant long long = 1000000009\nin function poww_mod with arguments long long a and long long b that returns long long\n ans = long long = 1\n a = a modulo MOD\n while b is nonzero\n if b ends in a one in bits, then ans = (a * ans) modulo MOD\n a = (a * a) modulo MOD\n b shifted by one bit to the right\n end of the block\n return ans modulo MOD\nend of the block\nin function inv with arguments of long long t and long long p that returns a long long\n t = t modulo p\n return 1 if t is 1 else return (p - p \/ t) * (call inv with arguments of p modulo t and p) modulo p\nend of the block\nn = integer = 0, k = integer = 0, a = integer = 0, b = integer = 0\nans = long long array of size MAX + 5, answer = long long = 0\ns = string\ndefine the main function\n read n, a, b, k\n read s\n pre = long long = 0\n while k < 10000 and k < n\n k = k * 2\n s = s + s\n end of the block\n for i = 0 to k exclusive\n if s[i] is +\n ans[i] = pre + (call poww_mod with arguments of a, n - i) * (call poww_mod with arguments of b, i) modulo MOD\n else\n ans[i] = pre - (call poww_mod with arguments of a, n - i) * (call poww_mod with arguments of b, i) modulo MOD\n pre = ans[i]\n end of the block\n if n < k\n if ans[n] < 0, then ans[n] = ans[n] + mod\n print ans[n]\n else\n beishu = integer = n \/ k\n save = integer = n - n \/ k\n mode = long long =(call poww_mod with arguments of b, k) * (inverse of arguments of (the result of calling poww_mod with arguments of a, k), i) MOD )modulo MOD\n answer = pre\n for i = 1 to beishu exclusive\n pre = (pre * mode) modulo MOD\n answer = (answer + pre) modulo MOD\n end of the block\n for i = n \/ k * k to n inclusive\n if s[i modulo k] is +\n answer = (answer + (call poww_mod with arguments of a, n - i) * (call poww_mod with arguments of b, i)) modulo MOD\n else\n answer = (answer - (call poww_mod with arguments of a, n - i) * (call poww_mod with arguments of b, i)) modulo MOD\n end of the block\n if answer < 0, then answer = answer + MOD\n print answer\n end of the block\nend of the block\n\n[CODE]:","reference_output":"const int MAXN = 100000;\nconst long long MOD = 1000000009;\nlong long poww_mod(long long a, long long b) {\n long long ans = 1;\n a = a % MOD;\n while (b) {\n if (b & 1) ans = (a * ans) % MOD;\n a = (a * a) % MOD;\n b >>= 1;\n }\n return ans % MOD;\n}\nlong long inv(long long t, long long p) {\n t = t % p;\n return t == 1 ? 1 : (p - p \/ t) * inv(p % t, p) % p;\n}\nint n = 0, k = 0, a = 0, b = 0;\nlong long ans[MAXN + 5], answer = 0;\nstring s;\nint main() {\n cin >> n >> a >> b >> k;\n cin >> s;\n long long pre = 0;\n while (k < 10000 && k < n) {\n k = k * 2;\n s = s + s;\n }\n for (int i = 0; i < k; ++i) {\n if (s[i] == '+')\n ans[i] = (pre + poww_mod(a, n - i) * poww_mod(b, i)) % MOD;\n else\n ans[i] = (pre - poww_mod(a, n - i) * poww_mod(b, i)) % MOD;\n pre = ans[i];\n }\n if (n < k) {\n if (ans[n] < 0) ans[n] += MOD;\n cout << ans[n] << endl;\n } else {\n int beishu = n \/ k;\n int save = n - n \/ k;\n long long mode = (poww_mod(b, k) * inv(poww_mod(a, k), MOD)) % MOD;\n answer = pre;\n for (int i = 1; i < beishu; ++i) {\n pre = (pre * mode) % MOD;\n answer = (answer + pre) % MOD;\n }\n for (int i = (n \/ k) * k; i <= n; ++i) {\n if (s[i % k] == '+')\n answer = (answer + poww_mod(a, n - i) * poww_mod(b, i)) % MOD;\n else\n answer = (answer - poww_mod(a, n - i) * poww_mod(b, i)) % MOD;\n }\n if (answer < 0) answer += MOD;\n cout << answer << endl;\n }\n}","item":{"problem_id":"963A","pseudocode":"MAXN = constant integer = 100000\nMOD = constant long long = 1000000009\nin function poww_mod with arguments long long a and long long b that returns long long\n ans = long long = 1\n a = a modulo MOD\n while b is nonzero\n if b ends in a one in bits, then ans = (a * ans) modulo MOD\n a = (a * a) modulo MOD\n b shifted by one bit to the right\n end of the block\n return ans modulo MOD\nend of the block\nin function inv with arguments of long long t and long long p that returns a long long\n t = t modulo p\n return 1 if t is 1 else return (p - p \/ t) * (call inv with arguments of p modulo t and p) modulo p\nend of the block\nn = integer = 0, k = integer = 0, a = integer = 0, b = integer = 0\nans = long long array of size MAX + 5, answer = long long = 0\ns = string\ndefine the main function\n read n, a, b, k\n read s\n pre = long long = 0\n while k < 10000 and k < n\n k = k * 2\n s = s + s\n end of the block\n for i = 0 to k exclusive\n if s[i] is +\n ans[i] = pre + (call poww_mod with arguments of a, n - i) * (call poww_mod with arguments of b, i) modulo MOD\n else\n ans[i] = pre - (call poww_mod with arguments of a, n - i) * (call poww_mod with arguments of b, i) modulo MOD\n pre = ans[i]\n end of the block\n if n < k\n if ans[n] < 0, then ans[n] = ans[n] + mod\n print ans[n]\n else\n beishu = integer = n \/ k\n save = integer = n - n \/ k\n mode = long long =(call poww_mod with arguments of b, k) * (inverse of arguments of (the result of calling poww_mod with arguments of a, k), i) MOD )modulo MOD\n answer = pre\n for i = 1 to beishu exclusive\n pre = (pre * mode) modulo MOD\n answer = (answer + pre) modulo MOD\n end of the block\n for i = n \/ k * k to n inclusive\n if s[i modulo k] is +\n answer = (answer + (call poww_mod with arguments of a, n - i) * (call poww_mod with arguments of b, i)) modulo MOD\n else\n answer = (answer - (call poww_mod with arguments of a, n - i) * (call poww_mod with arguments of b, i)) modulo MOD\n end of the block\n if answer < 0, then answer = answer + MOD\n print answer\n end of the block\nend of the block","testcases":[[["2 2 3 3","+-+"],["7"]],[["4 1 5 1","-"],["999999228"]],[["1 1 4 2","-+"],["3"]],[["3 1 4 4","+--+"],["45"]],[["5 1 1 6","++---+"],["0"]],[["5 2 2 6","+--++-"],["0"]],[["686653196 115381398 884618610 3","+-+"],["542231211"]],[["608663287 430477711 172252358 8","-+--+-+-"],["594681696"]],[["904132655 827386249 118827660 334","+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++++------+++-+-+-++-++++++++-+-++-+++--+--++------+--+-+++--++--+---++-++-+-+-++---++-++--+-+-++-+------+-+----+++-+++--+-+-+--+--+--+------+--+---+--+-++--+++---+-+-++--------+-++--++-+-+-+-+-+-+--+-++++-+++--+--++----+--+-++-++--+--+-+-++-+-++++-"],["188208979"]],[["234179195 430477711 115381398 12","++++-+-+-+++"],["549793323"]],[["75952547 967294208 907708706 252","++--++--+++-+-+--++--++++++---+++-++-+-----++++--++-+-++------+-+-+-++-+-+-++++------++---+-++++---+-+-++++--++++++--+-+++-++--+--+---++++---+-+++-+++--+-+--+++++---+--++-++++--++++-+-++-+++-++-----+-+++++----++--+++-+-+++++-+--++-++-+--+-++++--+-+-+-+"],["605712499"]],[["74709071 801809249 753674746 18","++++++-+-+---+-+--"],["13414893"]],[["743329 973758 92942 82","++----+-++++----+--+++---+--++++-+-+---+++++--+--+++++++--++-+++----+--+++++-+--+-"],["299311566"]],[["18111 291387 518587 2","++"],["724471355"]],[["996144 218286 837447 1","-"],["549104837"]],[["179358 828426 548710 67","++++---+--++----+-+-++++----+--+---+------++-+-++++--+----+---+-+--"],["759716474"]],[["397521 174985 279760 1","+"],["25679493"]],[["613632 812232 482342 1","-"],["891965141"]],[["936810 183454 647048 1","+"],["523548992"]],[["231531 250371 921383 28","++-+------+--+--++++--+-+++-"],["134450934"]],[["947301 87242 360762 97","--+++--+++-++--++-++--++--+++---+++--++++--+++++--+-++-++-----+-++-+--++-----+-++-+--++-++-+-----"],["405016159"]],[["425583346 814209084 570987274 1","+"],["63271171"]],[["354062556 688076879 786825319 1","+"],["545304776"]],[["206671954 13571766 192250278 1","+"],["717117421"]],[["23047921 621656196 160244047 1","-"],["101533009"]],[["806038018 740585177 987616107 293","-+++++--++++---++-+--+-+---+-++++--+--+++--++---++++++++--+++++-+-++-+--+----+--+++-+-++-+++-+-+-+----------++-+-+++++++-+-+-+-++---+++-+-+-------+-+-++--++-++-++-++-+---+--++-++--+++--+++-+-+----++--+-+-++-+---+---+-+-+++------+-+++-+---++-+--+++----+++++---++-++--+----+++-+--+++-+------+-++"],["441468166"]],[["262060935 184120408 148332034 148","+--+-------+-+-+--++-+++--++-+-++++++--++-+++-+++--+-------+-+--+++-+-+-+---++-++-+-++---+--+-+-+--+------+++--+--+-+-+---+---+-+-++++---+++--+++---"],["700325386"]],[["919350941 654611542 217223605 186","++-++-+++++-+++--+---+++++++-++-+----+-++--+-++--++--+++-+++---+--+--++-+-+++-+-+++-++---+--+++-+-+++--+-+-------+-++------++---+-+---++-++-++---+-+--+-+--+++++---+--+--++++-++-++--+--++"],["116291420"]],[["289455627 906207104 512692624 154","-------++--+++---++-++------++----------+--+++-+-+++---+---+++--++++++--+-+-+--+---+-+-++-++--+-++--++++---+-+---+-----+--+-+---------+++-++---++-+-+-----"],["48198216"]],[["258833760 515657142 791267045 1","-"],["935800888"]],[["691617927 66917103 843055237 8","--+++---"],["147768186"]],[["379582849 362892355 986900829 50","++-++---+-+++++--++++--+--++--++-----+------++--+-"],["927469713"]],[["176799169 363368399 841293419 1","+"],["746494802"]],[["144808247 203038656 166324035 4","-+-+"],["909066471"]],[["477607531 177367565 20080950 2","++"],["928662830"]],[["682074525 289438443 917164266 1","+"],["28048785"]],[["938449224 59852396 219719125 1","-"],["648647459"]],[["395171426 872478622 193568600 147","+---++---+-+--+++++--+---+-++++-+-++---++++--+--+-+-++-+-++--------++---+++-+---++---+---+-+--+-++++-+++-+-+-++-+--+++-++-+-+-+-++++++-+---+---++--"],["460881399"]],[["403493428 317461491 556701240 1","-"],["936516261"]],[["917751169 330191895 532837377 70","-+-+++++++--++---++-+++++-+++-----+-+++---+--+-+-++-++-+-+-++-++-+----"],["908035409"]],[["252089413 552678586 938424519 1","-"],["627032736"]],[["649316142 320010793 200197645 1","-"],["323650777"]],[["116399299 784781190 299072480 5","++++-"],["754650814"]]]}} +{"instance_id":"pseudo_to_code_2k_65","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate a long long integer mod=1e9+9\ninto the function qm which takes two long long integers a and b and returns a long long int\n let ans be long long int with ans=1\n while b>0 do the following\n if b&1 then set ans= ans * a % mod\n set b= b >> 1\n set a= a*a%mod\n end of the block\n return (ans % mod + mod) % mod\nend of the block\nc= character array of size 1000005\ndefine the main function\n n,a,b,k= long long ints\n read n,a,b,k\n read c\n create long long int ans=0\n if n+1 <= k\n for i=0 to n inclusive\n if c[i] = -\n then set ans = ans - qm(a, n - i) * qm(b, i)\n set ans = (ans % mod + mod) % mod\n else do the following\n set ans = ans + qm(a, n - i) * qm(b, i)\n set ans = (ans % mod + mod) % mod\n end of the block\n end of the block\n set ans = (ans % mod + mod) % mod\n print ans\n else do the following\n create long long t= (n+1) \/ k\n creaye long long integer g = (n+1) %k\n let x=0 be a long long integer\n if g is equal to 0\n for i=0 to k exclusive\n if c[i] is equal to -\n then set x = x - qm(a, n - i) * qm(b, i)\n set x = (x % mod + mod) % mod\n else do the following\n set x = x + qm(a, n - i) * qm(b, i)\n assign (x % mod + mod) % mod to x\n end of the block\n end of the block\n if qm(a, k) = qm(b, k)\n then set ans = t*t\n assign (ans % mod + mod) % mod to ans\n print ans\n return to indicate successful execution\n end of the block\n create long long integer jj = qm(a, t * k) - qm(b, t * k)\n set jj = x*jj%mod\n set jj= jj* qm(a,k) % mod\n do nothing\n set jj = jj % mod\n create long long integer nn = qm(a, k) - qm(b, k)\n set nn = nn % mod\n assign nn * qm(a, t * k) to nn\n set nn = nn % mod\n set nn = qm(nn, mod - 2)\n assign jj * nn to ans\n set ans to (ans % mod + mod) % mod\n print ans\n else do the following\n for i=0 to k exclusive\n if c[i] is equal to -\n set x = x - qm(a, n - i) * qm(b, i)\n set x = (x % mod + mod) % mod\n else do the following\n set x to x + qm(a, n - i) * qm(b, i)\n assign (x % mod + mod) % mod to x\n end of the block\n end of the block\n if qm(a, k) == qm(b, k)\n then set ans= t*x\n set ans = (ans % mod + mod) % mod\n for hh=0 to g exclusive\n if c[hh] is equal to -\n set ans = ans - qm(a, n - (t * k + hh)) * qm(b, (t * k + hh))\n set ans = (ans % mod + mod) % mod\n else do the following\n set ans = ans + qm(a, n - (t * k + hh)) * qm(b, (t * k + hh))\n set ans = (ans % mod + mod) % mod\n end of the block\n end of the block\n set ans = (ans % mod + mod) % mod\n print ans\n return to indicate successful execution\n end of the block\n create long long integer jj = qm(a, t * k) - qm(b, t * k)\n set jj to x * jj % mod\n set jj = jj * qm(a, k) % mod\n do nothing\n assign jj % mod to jj\n create long long integer nn = (qm(a, k) - qm(b, k))\n set nn = nn % mod\n assign nn * qm(a, t * k) to nn\n set nn = nn % mod\n set nn = qm(nn, mod - 2)\n set ans = jj * nn\n set ans = (ans % mod + mod) % mod\n for hh=0 to g exclusive\n if c[hh] is -\n set ans = ans - qm(a, n - (t * k + hh)) * qm(b, (t * k + hh))\n set ans = (ans % mod + mod) % mod\n else do the following\n set ans = ans + qm(a, n - (t * k + hh)) * qm(b, (t * k + hh))\n set ans = (ans % mod + mod) % mod\n end of the block\n end of the block\n set ans = (ans % mod + mod) % mod\n print ans\n end of the block\n end of the block\nend of the block\n\n[CODE]:","reference_output":"long long mod = 1e9 + 9;\nlong long qm(long long a, long long b) {\n long long ans = 1;\n while (b > 0) {\n if (b & 1) ans = ans * a % mod;\n b >>= 1;\n a = a * a % mod;\n }\n return (ans % mod + mod) % mod;\n}\nchar c[1000005];\nint main() {\n long long n, a, b, k;\n cin >> n >> a >> b >> k;\n cin >> c;\n long long ans = 0;\n if (n + 1 <= k) {\n for (long long i = 0; i <= n; i++) {\n if (c[i] == '-') {\n ans = ans - qm(a, n - i) * qm(b, i);\n ans = (ans % mod + mod) % mod;\n } else {\n ans = ans + qm(a, n - i) * qm(b, i);\n ans = (ans % mod + mod) % mod;\n }\n }\n ans = (ans % mod + mod) % mod;\n cout << ans << endl;\n } else {\n long long t = (n + 1) \/ k;\n long long g = (n + 1) % k;\n long long x = 0;\n if (g == 0) {\n for (long long i = 0; i < k; i++) {\n if (c[i] == '-') {\n x = x - qm(a, n - i) * qm(b, i);\n x = (x % mod + mod) % mod;\n } else {\n x = x + qm(a, n - i) * qm(b, i);\n x = (x % mod + mod) % mod;\n }\n }\n if (qm(a, k) == qm(b, k)) {\n ans = t * x;\n ans = (ans % mod + mod) % mod;\n cout << ans << endl;\n return 0;\n }\n long long jj = qm(a, t * k) - qm(b, t * k);\n jj = x * jj % mod;\n jj = jj * qm(a, k) % mod;\n ;\n jj = jj % mod;\n long long nn = (qm(a, k) - qm(b, k));\n nn = nn % mod;\n nn = nn * qm(a, t * k);\n nn = nn % mod;\n nn = qm(nn, mod - 2);\n ans = jj * nn;\n ans = (ans % mod + mod) % mod;\n cout << ans << endl;\n } else {\n for (long long i = 0; i < k; i++) {\n if (c[i] == '-') {\n x = x - qm(a, n - i) * qm(b, i);\n x = (x % mod + mod) % mod;\n } else {\n x = x + qm(a, n - i) * qm(b, i);\n x = (x % mod + mod) % mod;\n }\n }\n if (qm(a, k) == qm(b, k)) {\n ans = t * x;\n ans = (ans % mod + mod) % mod;\n for (long long hh = 0; hh < g; hh++) {\n if (c[hh] == '-') {\n ans = ans - qm(a, n - (t * k + hh)) * qm(b, (t * k + hh));\n ans = (ans % mod + mod) % mod;\n } else {\n ans = ans + qm(a, n - (t * k + hh)) * qm(b, (t * k + hh));\n ans = (ans % mod + mod) % mod;\n }\n }\n ans = (ans % mod + mod) % mod;\n cout << ans << endl;\n return 0;\n }\n long long jj = qm(a, t * k) - qm(b, t * k);\n jj = x * jj % mod;\n jj = jj * qm(a, k) % mod;\n ;\n jj = jj % mod;\n long long nn = (qm(a, k) - qm(b, k));\n nn = nn % mod;\n nn = nn * qm(a, t * k);\n nn = nn % mod;\n nn = qm(nn, mod - 2);\n ans = jj * nn;\n ans = (ans % mod + mod) % mod;\n for (long long hh = 0; hh < g; hh++) {\n if (c[hh] == '-') {\n ans = ans - qm(a, n - (t * k + hh)) * qm(b, (t * k + hh));\n ans = (ans % mod + mod) % mod;\n } else {\n ans = ans + qm(a, n - (t * k + hh)) * qm(b, (t * k + hh));\n ans = (ans % mod + mod) % mod;\n }\n }\n ans = (ans % mod + mod) % mod;\n cout << ans << endl;\n }\n }\n}","item":{"problem_id":"963A","pseudocode":"create a long long integer mod=1e9+9\ninto the function qm which takes two long long integers a and b and returns a long long int\n let ans be long long int with ans=1\n while b>0 do the following\n if b&1 then set ans= ans * a % mod\n set b= b >> 1\n set a= a*a%mod\n end of the block\n return (ans % mod + mod) % mod\nend of the block\nc= character array of size 1000005\ndefine the main function\n n,a,b,k= long long ints\n read n,a,b,k\n read c\n create long long int ans=0\n if n+1 <= k\n for i=0 to n inclusive\n if c[i] = -\n then set ans = ans - qm(a, n - i) * qm(b, i)\n set ans = (ans % mod + mod) % mod\n else do the following\n set ans = ans + qm(a, n - i) * qm(b, i)\n set ans = (ans % mod + mod) % mod\n end of the block\n end of the block\n set ans = (ans % mod + mod) % mod\n print ans\n else do the following\n create long long t= (n+1) \/ k\n creaye long long integer g = (n+1) %k\n let x=0 be a long long integer\n if g is equal to 0\n for i=0 to k exclusive\n if c[i] is equal to -\n then set x = x - qm(a, n - i) * qm(b, i)\n set x = (x % mod + mod) % mod\n else do the following\n set x = x + qm(a, n - i) * qm(b, i)\n assign (x % mod + mod) % mod to x\n end of the block\n end of the block\n if qm(a, k) = qm(b, k)\n then set ans = t*t\n assign (ans % mod + mod) % mod to ans\n print ans\n return to indicate successful execution\n end of the block\n create long long integer jj = qm(a, t * k) - qm(b, t * k)\n set jj = x*jj%mod\n set jj= jj* qm(a,k) % mod\n do nothing\n set jj = jj % mod\n create long long integer nn = qm(a, k) - qm(b, k)\n set nn = nn % mod\n assign nn * qm(a, t * k) to nn\n set nn = nn % mod\n set nn = qm(nn, mod - 2)\n assign jj * nn to ans\n set ans to (ans % mod + mod) % mod\n print ans\n else do the following\n for i=0 to k exclusive\n if c[i] is equal to -\n set x = x - qm(a, n - i) * qm(b, i)\n set x = (x % mod + mod) % mod\n else do the following\n set x to x + qm(a, n - i) * qm(b, i)\n assign (x % mod + mod) % mod to x\n end of the block\n end of the block\n if qm(a, k) == qm(b, k)\n then set ans= t*x\n set ans = (ans % mod + mod) % mod\n for hh=0 to g exclusive\n if c[hh] is equal to -\n set ans = ans - qm(a, n - (t * k + hh)) * qm(b, (t * k + hh))\n set ans = (ans % mod + mod) % mod\n else do the following\n set ans = ans + qm(a, n - (t * k + hh)) * qm(b, (t * k + hh))\n set ans = (ans % mod + mod) % mod\n end of the block\n end of the block\n set ans = (ans % mod + mod) % mod\n print ans\n return to indicate successful execution\n end of the block\n create long long integer jj = qm(a, t * k) - qm(b, t * k)\n set jj to x * jj % mod\n set jj = jj * qm(a, k) % mod\n do nothing\n assign jj % mod to jj\n create long long integer nn = (qm(a, k) - qm(b, k))\n set nn = nn % mod\n assign nn * qm(a, t * k) to nn\n set nn = nn % mod\n set nn = qm(nn, mod - 2)\n set ans = jj * nn\n set ans = (ans % mod + mod) % mod\n for hh=0 to g exclusive\n if c[hh] is -\n set ans = ans - qm(a, n - (t * k + hh)) * qm(b, (t * k + hh))\n set ans = (ans % mod + mod) % mod\n else do the following\n set ans = ans + qm(a, n - (t * k + hh)) * qm(b, (t * k + hh))\n set ans = (ans % mod + mod) % mod\n end of the block\n end of the block\n set ans = (ans % mod + mod) % mod\n print ans\n end of the block\n end of the block\nend of the block","testcases":[[["2 2 3 3","+-+"],["7"]],[["4 1 5 1","-"],["999999228"]],[["1 1 4 2","-+"],["3"]],[["3 1 4 4","+--+"],["45"]],[["5 1 1 6","++---+"],["0"]],[["5 2 2 6","+--++-"],["0"]],[["686653196 115381398 884618610 3","+-+"],["542231211"]],[["608663287 430477711 172252358 8","-+--+-+-"],["594681696"]],[["904132655 827386249 118827660 334","+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++++------+++-+-+-++-++++++++-+-++-+++--+--++------+--+-+++--++--+---++-++-+-+-++---++-++--+-+-++-+------+-+----+++-+++--+-+-+--+--+--+------+--+---+--+-++--+++---+-+-++--------+-++--++-+-+-+-+-+-+--+-++++-+++--+--++----+--+-++-++--+--+-+-++-+-++++-"],["188208979"]],[["234179195 430477711 115381398 12","++++-+-+-+++"],["549793323"]],[["75952547 967294208 907708706 252","++--++--+++-+-+--++--++++++---+++-++-+-----++++--++-+-++------+-+-+-++-+-+-++++------++---+-++++---+-+-++++--++++++--+-+++-++--+--+---++++---+-+++-+++--+-+--+++++---+--++-++++--++++-+-++-+++-++-----+-+++++----++--+++-+-+++++-+--++-++-+--+-++++--+-+-+-+"],["605712499"]],[["74709071 801809249 753674746 18","++++++-+-+---+-+--"],["13414893"]],[["743329 973758 92942 82","++----+-++++----+--+++---+--++++-+-+---+++++--+--+++++++--++-+++----+--+++++-+--+-"],["299311566"]],[["18111 291387 518587 2","++"],["724471355"]],[["996144 218286 837447 1","-"],["549104837"]],[["179358 828426 548710 67","++++---+--++----+-+-++++----+--+---+------++-+-++++--+----+---+-+--"],["759716474"]],[["397521 174985 279760 1","+"],["25679493"]],[["613632 812232 482342 1","-"],["891965141"]],[["936810 183454 647048 1","+"],["523548992"]],[["231531 250371 921383 28","++-+------+--+--++++--+-+++-"],["134450934"]],[["947301 87242 360762 97","--+++--+++-++--++-++--++--+++---+++--++++--+++++--+-++-++-----+-++-+--++-----+-++-+--++-++-+-----"],["405016159"]],[["425583346 814209084 570987274 1","+"],["63271171"]],[["354062556 688076879 786825319 1","+"],["545304776"]],[["206671954 13571766 192250278 1","+"],["717117421"]],[["23047921 621656196 160244047 1","-"],["101533009"]],[["806038018 740585177 987616107 293","-+++++--++++---++-+--+-+---+-++++--+--+++--++---++++++++--+++++-+-++-+--+----+--+++-+-++-+++-+-+-+----------++-+-+++++++-+-+-+-++---+++-+-+-------+-+-++--++-++-++-++-+---+--++-++--+++--+++-+-+----++--+-+-++-+---+---+-+-+++------+-+++-+---++-+--+++----+++++---++-++--+----+++-+--+++-+------+-++"],["441468166"]],[["262060935 184120408 148332034 148","+--+-------+-+-+--++-+++--++-+-++++++--++-+++-+++--+-------+-+--+++-+-+-+---++-++-+-++---+--+-+-+--+------+++--+--+-+-+---+---+-+-++++---+++--+++---"],["700325386"]],[["919350941 654611542 217223605 186","++-++-+++++-+++--+---+++++++-++-+----+-++--+-++--++--+++-+++---+--+--++-+-+++-+-+++-++---+--+++-+-+++--+-+-------+-++------++---+-+---++-++-++---+-+--+-+--+++++---+--+--++++-++-++--+--++"],["116291420"]],[["289455627 906207104 512692624 154","-------++--+++---++-++------++----------+--+++-+-+++---+---+++--++++++--+-+-+--+---+-+-++-++--+-++--++++---+-+---+-----+--+-+---------+++-++---++-+-+-----"],["48198216"]],[["258833760 515657142 791267045 1","-"],["935800888"]],[["691617927 66917103 843055237 8","--+++---"],["147768186"]],[["379582849 362892355 986900829 50","++-++---+-+++++--++++--+--++--++-----+------++--+-"],["927469713"]],[["176799169 363368399 841293419 1","+"],["746494802"]],[["144808247 203038656 166324035 4","-+-+"],["909066471"]],[["477607531 177367565 20080950 2","++"],["928662830"]],[["682074525 289438443 917164266 1","+"],["28048785"]],[["938449224 59852396 219719125 1","-"],["648647459"]],[["395171426 872478622 193568600 147","+---++---+-+--+++++--+---+-++++-+-++---++++--+--+-+-++-+-++--------++---+++-+---++---+---+-+--+-++++-+++-+-+-++-+--+++-++-+-+-+-++++++-+---+---++--"],["460881399"]],[["403493428 317461491 556701240 1","-"],["936516261"]],[["917751169 330191895 532837377 70","-+-+++++++--++---++-+++++-+++-----+-+++---+--+-+-++-++-+-+-++-++-+----"],["908035409"]],[["252089413 552678586 938424519 1","-"],["627032736"]],[["649316142 320010793 200197645 1","-"],["323650777"]],[["116399299 784781190 299072480 5","++++-"],["754650814"]]]}} +{"instance_id":"pseudo_to_code_2k_66","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmake ints n, a, b, and k\nlet int array s of size 100000\nlet string inp\nmake map dp from ints and ints\ndeclare bpow taking in ints n and e and returning integer\n create integer array b of size 30\n set b[0] to n\n for i = 1 to 30 exclusive, set b[i] to ((long long)b[i - 1] * b[i - 1]) % 1000000009\n make integer ans = 1\n for i = 0 to 30 exclusive\n if e & (1 << i) are truthy set ans to ((long long)ans * b[i]) % 1000000009\n return ans\nend of the block\ndeclare bdiv taking in integers n and d and returning integer\n return the result of ((long long)n * bpow(d, 1000000009 - 2)) % 1000000009\nend of the block\ndeclare alt taking in int e and returning int\n if e % k is not 0, end function\n if dp.count(e) is falsy\n if e is 0\n end function\n else if e is k\n set dp[e] to 1\n else do\n create int l = e \/ 2 \/ k * k\n make integer r = e - 1\n let integer ans = (((long long)alt(l) * bpow(a, r)) + (long long)alt(r) * bpow(b, l)) % 1000000009\n set dp[e] to ans\n end of the block\n end of the block\n return dp[e]\nend of the block\ndefine the main function\n read n, a, b, and k\n read inp\n for i = 0 to k exclusive\n if inp[i] is '+'\n set s[i] to 1\n else do\n set s[i] to -1\n end of the block\n create int x = 0\n for i = 0 to k exclusive\n create integer toadd = ((long long)s[i] * bpow(a, k - 1 - i)) % 1000000009\n set toadd to ((long long)toadd * bpow(b, i)) % 1000000009\n set x to ((long long)x + toadd + 1000000009) % 1000000009\n end of the block\n display x, \" \", and alt(n + 1) to error\n create integer ans = ((long long)x * alt(n + 1)) % 1000000009\n display ans\nend of the block\n\n[CODE]:","reference_output":"int n, a, b, k;\nint s[100000];\nstring inp;\nmap dp;\nint bpow(int n, int e) {\n int b[30];\n b[0] = n;\n for (int i = 1; i < 30; i++) b[i] = ((long long)b[i - 1] * b[i - 1]) % 1000000009;\n int ans = 1;\n for (int i = 0; i < 30; i++)\n if (e & (1 << i)) ans = ((long long)ans * b[i]) % 1000000009;\n return ans;\n}\nint bdiv(int n, int d) {\n return ((long long)n * bpow(d, 1000000009 - 2)) % 1000000009;\n}\nint alt(int e) {\n assert(e % k == 0);\n if (!dp.count(e)) {\n if (e == 0)\n assert(0);\n else if (e == k)\n dp[e] = 1;\n else {\n int l = e \/ 2 \/ k * k;\n int r = e - l;\n int ans = (((long long)alt(l) * bpow(a, r)) + (long long)alt(r) * bpow(b, l)) % 1000000009;\n dp[e] = ans;\n }\n }\n return dp[e];\n}\nint main() {\n cin >> n >> a >> b >> k;\n cin >> inp;\n for (int i = 0; i < k; i++) {\n if (inp[i] == '+')\n s[i] = 1;\n else\n s[i] = -1;\n }\n int x = 0;\n for (int i = 0; i < k; i++) {\n int toadd = ((long long)s[i] * bpow(a, k - 1 - i)) % 1000000009;\n toadd = ((long long)toadd * bpow(b, i)) % 1000000009;\n x = ((long long)x + toadd + 1000000009) % 1000000009;\n }\n cerr << x << \" \" << alt(n + 1) << endl;\n int ans = ((long long)x * alt(n + 1)) % 1000000009;\n cout << ans << endl;\n}","item":{"problem_id":"963A","pseudocode":"make ints n, a, b, and k\nlet int array s of size 100000\nlet string inp\nmake map dp from ints and ints\ndeclare bpow taking in ints n and e and returning integer\n create integer array b of size 30\n set b[0] to n\n for i = 1 to 30 exclusive, set b[i] to ((long long)b[i - 1] * b[i - 1]) % 1000000009\n make integer ans = 1\n for i = 0 to 30 exclusive\n if e & (1 << i) are truthy set ans to ((long long)ans * b[i]) % 1000000009\n return ans\nend of the block\ndeclare bdiv taking in integers n and d and returning integer\n return the result of ((long long)n * bpow(d, 1000000009 - 2)) % 1000000009\nend of the block\ndeclare alt taking in int e and returning int\n if e % k is not 0, end function\n if dp.count(e) is falsy\n if e is 0\n end function\n else if e is k\n set dp[e] to 1\n else do\n create int l = e \/ 2 \/ k * k\n make integer r = e - 1\n let integer ans = (((long long)alt(l) * bpow(a, r)) + (long long)alt(r) * bpow(b, l)) % 1000000009\n set dp[e] to ans\n end of the block\n end of the block\n return dp[e]\nend of the block\ndefine the main function\n read n, a, b, and k\n read inp\n for i = 0 to k exclusive\n if inp[i] is '+'\n set s[i] to 1\n else do\n set s[i] to -1\n end of the block\n create int x = 0\n for i = 0 to k exclusive\n create integer toadd = ((long long)s[i] * bpow(a, k - 1 - i)) % 1000000009\n set toadd to ((long long)toadd * bpow(b, i)) % 1000000009\n set x to ((long long)x + toadd + 1000000009) % 1000000009\n end of the block\n display x, \" \", and alt(n + 1) to error\n create integer ans = ((long long)x * alt(n + 1)) % 1000000009\n display ans\nend of the block","testcases":[[["2 2 3 3","+-+"],["7"]],[["4 1 5 1","-"],["999999228"]],[["1 1 4 2","-+"],["3"]],[["3 1 4 4","+--+"],["45"]],[["5 1 1 6","++---+"],["0"]],[["5 2 2 6","+--++-"],["0"]],[["686653196 115381398 884618610 3","+-+"],["542231211"]],[["608663287 430477711 172252358 8","-+--+-+-"],["594681696"]],[["904132655 827386249 118827660 334","+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++++------+++-+-+-++-++++++++-+-++-+++--+--++------+--+-+++--++--+---++-++-+-+-++---++-++--+-+-++-+------+-+----+++-+++--+-+-+--+--+--+------+--+---+--+-++--+++---+-+-++--------+-++--++-+-+-+-+-+-+--+-++++-+++--+--++----+--+-++-++--+--+-+-++-+-++++-"],["188208979"]],[["234179195 430477711 115381398 12","++++-+-+-+++"],["549793323"]],[["75952547 967294208 907708706 252","++--++--+++-+-+--++--++++++---+++-++-+-----++++--++-+-++------+-+-+-++-+-+-++++------++---+-++++---+-+-++++--++++++--+-+++-++--+--+---++++---+-+++-+++--+-+--+++++---+--++-++++--++++-+-++-+++-++-----+-+++++----++--+++-+-+++++-+--++-++-+--+-++++--+-+-+-+"],["605712499"]],[["74709071 801809249 753674746 18","++++++-+-+---+-+--"],["13414893"]],[["743329 973758 92942 82","++----+-++++----+--+++---+--++++-+-+---+++++--+--+++++++--++-+++----+--+++++-+--+-"],["299311566"]],[["18111 291387 518587 2","++"],["724471355"]],[["996144 218286 837447 1","-"],["549104837"]],[["179358 828426 548710 67","++++---+--++----+-+-++++----+--+---+------++-+-++++--+----+---+-+--"],["759716474"]],[["397521 174985 279760 1","+"],["25679493"]],[["613632 812232 482342 1","-"],["891965141"]],[["936810 183454 647048 1","+"],["523548992"]],[["231531 250371 921383 28","++-+------+--+--++++--+-+++-"],["134450934"]],[["947301 87242 360762 97","--+++--+++-++--++-++--++--+++---+++--++++--+++++--+-++-++-----+-++-+--++-----+-++-+--++-++-+-----"],["405016159"]],[["425583346 814209084 570987274 1","+"],["63271171"]],[["354062556 688076879 786825319 1","+"],["545304776"]],[["206671954 13571766 192250278 1","+"],["717117421"]],[["23047921 621656196 160244047 1","-"],["101533009"]],[["806038018 740585177 987616107 293","-+++++--++++---++-+--+-+---+-++++--+--+++--++---++++++++--+++++-+-++-+--+----+--+++-+-++-+++-+-+-+----------++-+-+++++++-+-+-+-++---+++-+-+-------+-+-++--++-++-++-++-+---+--++-++--+++--+++-+-+----++--+-+-++-+---+---+-+-+++------+-+++-+---++-+--+++----+++++---++-++--+----+++-+--+++-+------+-++"],["441468166"]],[["262060935 184120408 148332034 148","+--+-------+-+-+--++-+++--++-+-++++++--++-+++-+++--+-------+-+--+++-+-+-+---++-++-+-++---+--+-+-+--+------+++--+--+-+-+---+---+-+-++++---+++--+++---"],["700325386"]],[["919350941 654611542 217223605 186","++-++-+++++-+++--+---+++++++-++-+----+-++--+-++--++--+++-+++---+--+--++-+-+++-+-+++-++---+--+++-+-+++--+-+-------+-++------++---+-+---++-++-++---+-+--+-+--+++++---+--+--++++-++-++--+--++"],["116291420"]],[["289455627 906207104 512692624 154","-------++--+++---++-++------++----------+--+++-+-+++---+---+++--++++++--+-+-+--+---+-+-++-++--+-++--++++---+-+---+-----+--+-+---------+++-++---++-+-+-----"],["48198216"]],[["258833760 515657142 791267045 1","-"],["935800888"]],[["691617927 66917103 843055237 8","--+++---"],["147768186"]],[["379582849 362892355 986900829 50","++-++---+-+++++--++++--+--++--++-----+------++--+-"],["927469713"]],[["176799169 363368399 841293419 1","+"],["746494802"]],[["144808247 203038656 166324035 4","-+-+"],["909066471"]],[["477607531 177367565 20080950 2","++"],["928662830"]],[["682074525 289438443 917164266 1","+"],["28048785"]],[["938449224 59852396 219719125 1","-"],["648647459"]],[["395171426 872478622 193568600 147","+---++---+-+--+++++--+---+-++++-+-++---++++--+--+-+-++-+-++--------++---+++-+---++---+---+-+--+-++++-+++-+-+-++-+--+++-++-+-+-+-++++++-+---+---++--"],["460881399"]],[["403493428 317461491 556701240 1","-"],["936516261"]],[["917751169 330191895 532837377 70","-+-+++++++--++---++-+++++-+++-----+-+++---+--+-+-++-++-+-+-++-++-+----"],["908035409"]],[["252089413 552678586 938424519 1","-"],["627032736"]],[["649316142 320010793 200197645 1","-"],["323650777"]],[["116399299 784781190 299072480 5","++++-"],["754650814"]]]}} +{"instance_id":"pseudo_to_code_2k_67","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare long long MOD = 1000000009\ndeclare pw with long longs a, b as arguments, returning long long\n if b is 0, return 1 from function\n if b is 1, return a % MOD\n if b % 2\n declare long long rs = result of run pw ( a, b - 1 )\n return ( rs * a ) % MOD from function\n end of the block\n declare long long rs = result of run w with a, b \/ 2 as arguments\n return ( rs * rs ) % MOD\nend of the block\ndeclare long long vector sm\ndeclare solve with long longs a, b as arguments, returning long long\n if b is 0, return 0 from function\n for i = 0 to 35 exclusive\n declare long long ba = (1LL bitshift left i ) bitwise and b\n if ba is 0, end current loop iteration\n return ( sm[i] + result of run solve( a, b - ( 1LL bitshift left i )) * result of run pw(a, (1LL bitshift left i))) % MOD\n end of the block\nend of the block\ndefine the main function\n declare long longs n, a, b, k\n read n, a, b, k\n declare string s\n read s\n declare long long X = 1, y + 1\n for i = 0 to k exclusive\n let X be X * b\n let X be X % MOD\n end of the block\n for i = 0 to k exclusive\n let Y be Y * a\n let Y be Y % MOD\n end of the block\n let X be X * result of run pw(Y, MOD - 2)\n let X be X % MOD\n add 1 to end of sm\n for i = 0 to 40 exclusive\n add ( back of sm + back of sm * result of run pw(X, (1LL bitshift left i) ) to end of sm\n let back of sm be back of sm % MOD\n end of the block\n declare long long st = result of run solve(X, (n + 1) \/ k)\n declare long long ans = 0\n for i = 0 to k exclusive\n declare long long rs = (result of run pw(b,i) * result of run pw(a,n-1) ) % MOD\n if s[i] is '-', let rs be rs * -1\n let rs be rs * st\n increment ans by rs\n let ans be ans % MOD\n end of the block\n if ans is less than 0, increment ans by MOD\n print ans and newline\nend of the block\n\n[CODE]:","reference_output":"long long MOD = 1000000009;\nlong long pw(long long a, long long b) {\n if (b == 0) return 1;\n if (b == 1) return a % MOD;\n if (b % 2) {\n long long rs = pw(a, b - 1);\n return (rs * a) % MOD;\n }\n long long rs = pw(a, b \/ 2);\n return (rs * rs) % MOD;\n}\nvector sm;\nlong long solve(long long a, long long b) {\n if (b == 0) return 0;\n for (long long i = 0; i < 35; i++) {\n long long ba = (1LL << i) & b;\n if (ba == 0) continue;\n return (sm[i] + solve(a, b - (1LL << i)) * pw(a, (1LL << i))) % MOD;\n }\n}\nint main() {\n long long n, a, b, k;\n cin >> n >> a >> b >> k;\n string s;\n cin >> s;\n long long X = 1, Y = 1;\n for (long long i = 0; i < k; i++) {\n X *= b;\n X %= MOD;\n }\n for (long long i = 0; i < k; i++) {\n Y *= a;\n Y %= MOD;\n }\n X *= pw(Y, MOD - 2);\n X %= MOD;\n sm.push_back(1);\n for (long long i = 0; i < 40; i++) {\n sm.push_back(sm.back() + sm.back() * pw(X, (1LL << i)));\n sm.back() %= MOD;\n }\n long long st = solve(X, (n + 1) \/ k);\n long long ans = 0;\n for (long long i = 0; i < k; i++) {\n long long rs = (pw(b, i) * pw(a, n - i)) % MOD;\n if (s[i] == '-') rs *= -1;\n rs *= st;\n ans += rs;\n ans %= MOD;\n }\n if (ans < 0) ans += MOD;\n cout << ans << endl;\n}","item":{"problem_id":"963A","pseudocode":"declare long long MOD = 1000000009\ndeclare pw with long longs a, b as arguments, returning long long\n if b is 0, return 1 from function\n if b is 1, return a % MOD\n if b % 2\n declare long long rs = result of run pw ( a, b - 1 )\n return ( rs * a ) % MOD from function\n end of the block\n declare long long rs = result of run w with a, b \/ 2 as arguments\n return ( rs * rs ) % MOD\nend of the block\ndeclare long long vector sm\ndeclare solve with long longs a, b as arguments, returning long long\n if b is 0, return 0 from function\n for i = 0 to 35 exclusive\n declare long long ba = (1LL bitshift left i ) bitwise and b\n if ba is 0, end current loop iteration\n return ( sm[i] + result of run solve( a, b - ( 1LL bitshift left i )) * result of run pw(a, (1LL bitshift left i))) % MOD\n end of the block\nend of the block\ndefine the main function\n declare long longs n, a, b, k\n read n, a, b, k\n declare string s\n read s\n declare long long X = 1, y + 1\n for i = 0 to k exclusive\n let X be X * b\n let X be X % MOD\n end of the block\n for i = 0 to k exclusive\n let Y be Y * a\n let Y be Y % MOD\n end of the block\n let X be X * result of run pw(Y, MOD - 2)\n let X be X % MOD\n add 1 to end of sm\n for i = 0 to 40 exclusive\n add ( back of sm + back of sm * result of run pw(X, (1LL bitshift left i) ) to end of sm\n let back of sm be back of sm % MOD\n end of the block\n declare long long st = result of run solve(X, (n + 1) \/ k)\n declare long long ans = 0\n for i = 0 to k exclusive\n declare long long rs = (result of run pw(b,i) * result of run pw(a,n-1) ) % MOD\n if s[i] is '-', let rs be rs * -1\n let rs be rs * st\n increment ans by rs\n let ans be ans % MOD\n end of the block\n if ans is less than 0, increment ans by MOD\n print ans and newline\nend of the block","testcases":[[["2 2 3 3","+-+"],["7"]],[["4 1 5 1","-"],["999999228"]],[["1 1 4 2","-+"],["3"]],[["3 1 4 4","+--+"],["45"]],[["5 1 1 6","++---+"],["0"]],[["5 2 2 6","+--++-"],["0"]],[["686653196 115381398 884618610 3","+-+"],["542231211"]],[["608663287 430477711 172252358 8","-+--+-+-"],["594681696"]],[["904132655 827386249 118827660 334","+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++++------+++-+-+-++-++++++++-+-++-+++--+--++------+--+-+++--++--+---++-++-+-+-++---++-++--+-+-++-+------+-+----+++-+++--+-+-+--+--+--+------+--+---+--+-++--+++---+-+-++--------+-++--++-+-+-+-+-+-+--+-++++-+++--+--++----+--+-++-++--+--+-+-++-+-++++-"],["188208979"]],[["234179195 430477711 115381398 12","++++-+-+-+++"],["549793323"]],[["75952547 967294208 907708706 252","++--++--+++-+-+--++--++++++---+++-++-+-----++++--++-+-++------+-+-+-++-+-+-++++------++---+-++++---+-+-++++--++++++--+-+++-++--+--+---++++---+-+++-+++--+-+--+++++---+--++-++++--++++-+-++-+++-++-----+-+++++----++--+++-+-+++++-+--++-++-+--+-++++--+-+-+-+"],["605712499"]],[["74709071 801809249 753674746 18","++++++-+-+---+-+--"],["13414893"]],[["743329 973758 92942 82","++----+-++++----+--+++---+--++++-+-+---+++++--+--+++++++--++-+++----+--+++++-+--+-"],["299311566"]],[["18111 291387 518587 2","++"],["724471355"]],[["996144 218286 837447 1","-"],["549104837"]],[["179358 828426 548710 67","++++---+--++----+-+-++++----+--+---+------++-+-++++--+----+---+-+--"],["759716474"]],[["397521 174985 279760 1","+"],["25679493"]],[["613632 812232 482342 1","-"],["891965141"]],[["936810 183454 647048 1","+"],["523548992"]],[["231531 250371 921383 28","++-+------+--+--++++--+-+++-"],["134450934"]],[["947301 87242 360762 97","--+++--+++-++--++-++--++--+++---+++--++++--+++++--+-++-++-----+-++-+--++-----+-++-+--++-++-+-----"],["405016159"]],[["425583346 814209084 570987274 1","+"],["63271171"]],[["354062556 688076879 786825319 1","+"],["545304776"]],[["206671954 13571766 192250278 1","+"],["717117421"]],[["23047921 621656196 160244047 1","-"],["101533009"]],[["806038018 740585177 987616107 293","-+++++--++++---++-+--+-+---+-++++--+--+++--++---++++++++--+++++-+-++-+--+----+--+++-+-++-+++-+-+-+----------++-+-+++++++-+-+-+-++---+++-+-+-------+-+-++--++-++-++-++-+---+--++-++--+++--+++-+-+----++--+-+-++-+---+---+-+-+++------+-+++-+---++-+--+++----+++++---++-++--+----+++-+--+++-+------+-++"],["441468166"]],[["262060935 184120408 148332034 148","+--+-------+-+-+--++-+++--++-+-++++++--++-+++-+++--+-------+-+--+++-+-+-+---++-++-+-++---+--+-+-+--+------+++--+--+-+-+---+---+-+-++++---+++--+++---"],["700325386"]],[["919350941 654611542 217223605 186","++-++-+++++-+++--+---+++++++-++-+----+-++--+-++--++--+++-+++---+--+--++-+-+++-+-+++-++---+--+++-+-+++--+-+-------+-++------++---+-+---++-++-++---+-+--+-+--+++++---+--+--++++-++-++--+--++"],["116291420"]],[["289455627 906207104 512692624 154","-------++--+++---++-++------++----------+--+++-+-+++---+---+++--++++++--+-+-+--+---+-+-++-++--+-++--++++---+-+---+-----+--+-+---------+++-++---++-+-+-----"],["48198216"]],[["258833760 515657142 791267045 1","-"],["935800888"]],[["691617927 66917103 843055237 8","--+++---"],["147768186"]],[["379582849 362892355 986900829 50","++-++---+-+++++--++++--+--++--++-----+------++--+-"],["927469713"]],[["176799169 363368399 841293419 1","+"],["746494802"]],[["144808247 203038656 166324035 4","-+-+"],["909066471"]],[["477607531 177367565 20080950 2","++"],["928662830"]],[["682074525 289438443 917164266 1","+"],["28048785"]],[["938449224 59852396 219719125 1","-"],["648647459"]],[["395171426 872478622 193568600 147","+---++---+-+--+++++--+---+-++++-+-++---++++--+--+-+-++-+-++--------++---+++-+---++---+---+-+--+-++++-+++-+-+-++-+--+++-++-+-+-+-++++++-+---+---++--"],["460881399"]],[["403493428 317461491 556701240 1","-"],["936516261"]],[["917751169 330191895 532837377 70","-+-+++++++--++---++-+++++-+++-----+-+++---+--+-+-++-++-+-+-++-++-+----"],["908035409"]],[["252089413 552678586 938424519 1","-"],["627032736"]],[["649316142 320010793 200197645 1","-"],["323650777"]],[["116399299 784781190 299072480 5","++++-"],["754650814"]]]}} +{"instance_id":"pseudo_to_code_2k_68","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate long long integer MOD = 1000000009\ninto the function pw which takes two long long integers a and b and returns a long long integer\n if b is 0 then return 1\n if b is 1 then return a % MOD\n if b%2 is true\n create long long rs= pw(a,b-1)\n return (rs * a) % MOD\n end of the block\n create long long integer rs= pw(a,b\/2)\n return (rs * rs) % MOD\nend of the block\nsm = long long integer vector\ninto the function solve which takes a and b\n if b is 0 then return 0\n for i=0 to 35 exclusive\n create long long integer ba = (1LL << i) & b\n if ba is equal to 0 then continue\n return sm[i] + solve(a, b - (1LL << i)) * pw(a, (1LL << i))) % MOD\n end of the block\nend of the block\ndefine the main function\n n,a,b,k = long long integers\n read n,a,b,k\n s=string\n read s\n create long long integers X and Y with values 1\n for i=o to k exclusive\n set X = X * b\n set X = X % MOD\n end of the block\n for i=0 to k exclusive\n set Y = Y * a\n set Y = Y % MOD\n end of the block\n set X = X * pw(Y, MOD - 2)\n set X = X % MOD\n add 1 to the end of sm\n for i=0 to 40 exclusive\n add sm.back() + sm.back() * pw(X, (1LL << i) to end of sm\n set sm.back() = sm.back() % MOD\n end of the block\n create long long integer st = solve(X, (n + 1) \/ k)\n create long long integer ans=0\n for i=0 to k exclusive\n create long long integer rs = (pw(b, i) * pw(a, n - i)) % MOD\n if s[i] is '-' then set rs = rs * -1\n set rs = rs * st\n set ans = ans + rs\n set ans = ans % MOD\n end of the block\n if ans is less than 0 then set ans = ans + MOD\n print ans\nend of the block\n\n[CODE]:","reference_output":"long long MOD = 1000000009;\nlong long pw(long long a, long long b) {\n if (b == 0) return 1;\n if (b == 1) return a % MOD;\n if (b % 2) {\n long long rs = pw(a, b - 1);\n return (rs * a) % MOD;\n }\n long long rs = pw(a, b \/ 2);\n return (rs * rs) % MOD;\n}\nvector sm;\nlong long solve(long long a, long long b) {\n if (b == 0) return 0;\n for (long long i = 0; i < 35; i++) {\n long long ba = (1LL << i) & b;\n if (ba == 0) continue;\n return (sm[i] + solve(a, b - (1LL << i)) * pw(a, (1LL << i))) % MOD;\n }\n}\nint main() {\n long long n, a, b, k;\n cin >> n >> a >> b >> k;\n string s;\n cin >> s;\n long long X = 1, Y = 1;\n for (long long i = 0; i < k; i++) {\n X *= b;\n X %= MOD;\n }\n for (long long i = 0; i < k; i++) {\n Y *= a;\n Y %= MOD;\n }\n X *= pw(Y, MOD - 2);\n X %= MOD;\n sm.push_back(1);\n for (long long i = 0; i < 40; i++) {\n sm.push_back(sm.back() + sm.back() * pw(X, (1LL << i)));\n sm.back() %= MOD;\n }\n long long st = solve(X, (n + 1) \/ k);\n long long ans = 0;\n for (long long i = 0; i < k; i++) {\n long long rs = (pw(b, i) * pw(a, n - i)) % MOD;\n if (s[i] == '-') rs *= -1;\n rs *= st;\n ans += rs;\n ans %= MOD;\n }\n if (ans < 0) ans += MOD;\n cout << ans << endl;\n}","item":{"problem_id":"963A","pseudocode":"create long long integer MOD = 1000000009\ninto the function pw which takes two long long integers a and b and returns a long long integer\n if b is 0 then return 1\n if b is 1 then return a % MOD\n if b%2 is true\n create long long rs= pw(a,b-1)\n return (rs * a) % MOD\n end of the block\n create long long integer rs= pw(a,b\/2)\n return (rs * rs) % MOD\nend of the block\nsm = long long integer vector\ninto the function solve which takes a and b\n if b is 0 then return 0\n for i=0 to 35 exclusive\n create long long integer ba = (1LL << i) & b\n if ba is equal to 0 then continue\n return sm[i] + solve(a, b - (1LL << i)) * pw(a, (1LL << i))) % MOD\n end of the block\nend of the block\ndefine the main function\n n,a,b,k = long long integers\n read n,a,b,k\n s=string\n read s\n create long long integers X and Y with values 1\n for i=o to k exclusive\n set X = X * b\n set X = X % MOD\n end of the block\n for i=0 to k exclusive\n set Y = Y * a\n set Y = Y % MOD\n end of the block\n set X = X * pw(Y, MOD - 2)\n set X = X % MOD\n add 1 to the end of sm\n for i=0 to 40 exclusive\n add sm.back() + sm.back() * pw(X, (1LL << i) to end of sm\n set sm.back() = sm.back() % MOD\n end of the block\n create long long integer st = solve(X, (n + 1) \/ k)\n create long long integer ans=0\n for i=0 to k exclusive\n create long long integer rs = (pw(b, i) * pw(a, n - i)) % MOD\n if s[i] is '-' then set rs = rs * -1\n set rs = rs * st\n set ans = ans + rs\n set ans = ans % MOD\n end of the block\n if ans is less than 0 then set ans = ans + MOD\n print ans\nend of the block","testcases":[[["2 2 3 3","+-+"],["7"]],[["4 1 5 1","-"],["999999228"]],[["1 1 4 2","-+"],["3"]],[["3 1 4 4","+--+"],["45"]],[["5 1 1 6","++---+"],["0"]],[["5 2 2 6","+--++-"],["0"]],[["686653196 115381398 884618610 3","+-+"],["542231211"]],[["608663287 430477711 172252358 8","-+--+-+-"],["594681696"]],[["904132655 827386249 118827660 334","+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++++------+++-+-+-++-++++++++-+-++-+++--+--++------+--+-+++--++--+---++-++-+-+-++---++-++--+-+-++-+------+-+----+++-+++--+-+-+--+--+--+------+--+---+--+-++--+++---+-+-++--------+-++--++-+-+-+-+-+-+--+-++++-+++--+--++----+--+-++-++--+--+-+-++-+-++++-"],["188208979"]],[["234179195 430477711 115381398 12","++++-+-+-+++"],["549793323"]],[["75952547 967294208 907708706 252","++--++--+++-+-+--++--++++++---+++-++-+-----++++--++-+-++------+-+-+-++-+-+-++++------++---+-++++---+-+-++++--++++++--+-+++-++--+--+---++++---+-+++-+++--+-+--+++++---+--++-++++--++++-+-++-+++-++-----+-+++++----++--+++-+-+++++-+--++-++-+--+-++++--+-+-+-+"],["605712499"]],[["74709071 801809249 753674746 18","++++++-+-+---+-+--"],["13414893"]],[["743329 973758 92942 82","++----+-++++----+--+++---+--++++-+-+---+++++--+--+++++++--++-+++----+--+++++-+--+-"],["299311566"]],[["18111 291387 518587 2","++"],["724471355"]],[["996144 218286 837447 1","-"],["549104837"]],[["179358 828426 548710 67","++++---+--++----+-+-++++----+--+---+------++-+-++++--+----+---+-+--"],["759716474"]],[["397521 174985 279760 1","+"],["25679493"]],[["613632 812232 482342 1","-"],["891965141"]],[["936810 183454 647048 1","+"],["523548992"]],[["231531 250371 921383 28","++-+------+--+--++++--+-+++-"],["134450934"]],[["947301 87242 360762 97","--+++--+++-++--++-++--++--+++---+++--++++--+++++--+-++-++-----+-++-+--++-----+-++-+--++-++-+-----"],["405016159"]],[["425583346 814209084 570987274 1","+"],["63271171"]],[["354062556 688076879 786825319 1","+"],["545304776"]],[["206671954 13571766 192250278 1","+"],["717117421"]],[["23047921 621656196 160244047 1","-"],["101533009"]],[["806038018 740585177 987616107 293","-+++++--++++---++-+--+-+---+-++++--+--+++--++---++++++++--+++++-+-++-+--+----+--+++-+-++-+++-+-+-+----------++-+-+++++++-+-+-+-++---+++-+-+-------+-+-++--++-++-++-++-+---+--++-++--+++--+++-+-+----++--+-+-++-+---+---+-+-+++------+-+++-+---++-+--+++----+++++---++-++--+----+++-+--+++-+------+-++"],["441468166"]],[["262060935 184120408 148332034 148","+--+-------+-+-+--++-+++--++-+-++++++--++-+++-+++--+-------+-+--+++-+-+-+---++-++-+-++---+--+-+-+--+------+++--+--+-+-+---+---+-+-++++---+++--+++---"],["700325386"]],[["919350941 654611542 217223605 186","++-++-+++++-+++--+---+++++++-++-+----+-++--+-++--++--+++-+++---+--+--++-+-+++-+-+++-++---+--+++-+-+++--+-+-------+-++------++---+-+---++-++-++---+-+--+-+--+++++---+--+--++++-++-++--+--++"],["116291420"]],[["289455627 906207104 512692624 154","-------++--+++---++-++------++----------+--+++-+-+++---+---+++--++++++--+-+-+--+---+-+-++-++--+-++--++++---+-+---+-----+--+-+---------+++-++---++-+-+-----"],["48198216"]],[["258833760 515657142 791267045 1","-"],["935800888"]],[["691617927 66917103 843055237 8","--+++---"],["147768186"]],[["379582849 362892355 986900829 50","++-++---+-+++++--++++--+--++--++-----+------++--+-"],["927469713"]],[["176799169 363368399 841293419 1","+"],["746494802"]],[["144808247 203038656 166324035 4","-+-+"],["909066471"]],[["477607531 177367565 20080950 2","++"],["928662830"]],[["682074525 289438443 917164266 1","+"],["28048785"]],[["938449224 59852396 219719125 1","-"],["648647459"]],[["395171426 872478622 193568600 147","+---++---+-+--+++++--+---+-++++-+-++---++++--+--+-+-++-+-++--------++---+++-+---++---+---+-+--+-++++-+++-+-+-++-+--+++-++-+-+-+-++++++-+---+---++--"],["460881399"]],[["403493428 317461491 556701240 1","-"],["936516261"]],[["917751169 330191895 532837377 70","-+-+++++++--++---++-+++++-+++-----+-+++---+--+-+-++-++-+-+-++-++-+----"],["908035409"]],[["252089413 552678586 938424519 1","-"],["627032736"]],[["649316142 320010793 200197645 1","-"],["323650777"]],[["116399299 784781190 299072480 5","++++-"],["754650814"]]]}} +{"instance_id":"pseudo_to_code_2k_69","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate long longs A, B, ans with ans = -0x7fffffff\ncreate long longs bxb, bex, bob, bpb\ndefine the main function\n read A read B\n if B is 0\n print A * A print newline\n for i = 0 to A exclusive print \"o\"\n print newline\n return to indicate successful execution\n end of the block\n if B is 1\n print A * A - 1 print newline\n for i = 0 to A exclusive, print \"o\"\n print \"x\" print newline\n return to indicate successful execution\n end of the block\n if A is 0\n print -B * B print newline\n for i = 0 to B exclusive, print \"x'\n print newline\n return to indicate successful execution\n end of the block\n for xb = 2 to minimum of (B and A + 1) inclusive\n create integer ob with ob = xb - 1\n create long long score with score = ob - 1\n increment score by (A - (ob - 1)) * (A - (ob - 1))\n end statement\n create long long pb with pb = B \/ xb\n create long long ex with ex = B % xb\n decrement score by ( xb - ex ) * pb * pb\n decrement score by ex * ( pb + 1 ) * ( pb + 1 )\n if score is greater than ans\n set ans to score\n set bxb to xb\n set bex to ex\n set bob to ob\n set bpb to pb\n end of the block\n end of the block\n print ans print newline\n for i = 0 to bxb exclusive\n for j = 0 to bpb exclusive, print \"x\"\n if i is less than bex, print \"x\"\n if i is 0\n for j = 0 to A - ( bob - 1 ) exclusive, print \"o\"\n else if i + 1 is less than bxb\n print \"o\"\n end of the block\n print newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long A, B, ans = -0x7fffffff;\nlong long bxb, bex, bob, bpb;\nint main() {\n cin >> A >> B;\n if (B == 0) {\n cout << A * A << endl;\n for (int i = 0; i < A; i++) cout << \"o\";\n cout << endl;\n return 0;\n }\n if (B == 1) {\n cout << A * A - 1 << endl;\n for (int i = 0; i < A; i++) cout << \"o\";\n cout << \"x\" << endl;\n return 0;\n }\n if (A == 0) {\n cout << -B * B << endl;\n for (int i = 0; i < B; i++) cout << \"x\";\n cout << endl;\n return 0;\n }\n for (int xb = 2; xb <= min(B, A + 1); xb++) {\n int ob = xb - 1;\n long long score = ob - 1;\n score += (A - (ob - 1)) * (A - (ob - 1));\n ;\n long long pb = B \/ xb;\n long long ex = B % xb;\n score -= (xb - ex) * pb * pb;\n score -= ex * (pb + 1) * (pb + 1);\n if (score > ans) {\n ans = score;\n bxb = xb;\n bex = ex;\n bob = ob;\n bpb = pb;\n }\n }\n cout << ans << endl;\n for (int i = 0; i < bxb; i++) {\n for (int j = 0; j < bpb; j++) cout << \"x\";\n if (i < bex) cout << \"x\";\n if (i == 0)\n for (int j = 0; j < A - (bob - 1); j++) cout << \"o\";\n else if (i + 1 < bxb)\n cout << \"o\";\n }\n cout << endl;\n return 0;\n}","item":{"problem_id":"398A","pseudocode":"create long longs A, B, ans with ans = -0x7fffffff\ncreate long longs bxb, bex, bob, bpb\ndefine the main function\n read A read B\n if B is 0\n print A * A print newline\n for i = 0 to A exclusive print \"o\"\n print newline\n return to indicate successful execution\n end of the block\n if B is 1\n print A * A - 1 print newline\n for i = 0 to A exclusive, print \"o\"\n print \"x\" print newline\n return to indicate successful execution\n end of the block\n if A is 0\n print -B * B print newline\n for i = 0 to B exclusive, print \"x'\n print newline\n return to indicate successful execution\n end of the block\n for xb = 2 to minimum of (B and A + 1) inclusive\n create integer ob with ob = xb - 1\n create long long score with score = ob - 1\n increment score by (A - (ob - 1)) * (A - (ob - 1))\n end statement\n create long long pb with pb = B \/ xb\n create long long ex with ex = B % xb\n decrement score by ( xb - ex ) * pb * pb\n decrement score by ex * ( pb + 1 ) * ( pb + 1 )\n if score is greater than ans\n set ans to score\n set bxb to xb\n set bex to ex\n set bob to ob\n set bpb to pb\n end of the block\n end of the block\n print ans print newline\n for i = 0 to bxb exclusive\n for j = 0 to bpb exclusive, print \"x\"\n if i is less than bex, print \"x\"\n if i is 0\n for j = 0 to A - ( bob - 1 ) exclusive, print \"o\"\n else if i + 1 is less than bxb\n print \"o\"\n end of the block\n print newline\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["-1","xxoox"]],[["4 0"],["16","oooo"]],[["0 4"],["-16","xxxx"]],[["8 6"],["46","xxxooooooooxxx"]],[["1 1"],["0","ox"]],[["38 5"],["1431","xxxooooooooooooooooooooooooooooooooooooooxx"]],[["2 122"],["-4960","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]],[["4 2"],["14","xoooox"]],[["4 9"],["-13","xxoxxoxxoxxox"]],[["8 10"],["16","xxxxoooooooxxxoxxx"]],[["206 209"],["34847","xxxxxxxxxxxxxxxxxxxoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxx"]],[["5 17"],["-44","xxxoxxxoxxxoxxxoxxxoxx"]],[["1 2"],["-1","xox"]],[["2 1"],["3","oox"]],[["1 1"],["0","ox"]],[["1 0"],["1","o"]],[["0 1"],["-1","x"]],[["2 2"],["2","xoox"]],[["4 1"],["15","oooox"]],[["4 2"],["14","xoooox"]],[["4 3"],["11","xxoooox"]],[["4 4"],["8","xxooooxx"]],[["4 5"],["3","xxxooooxx"]],[["4 6"],["-2","xxxooooxxx"]],[["4 7"],["-7","xxxoooxxoxx"]]]}} +{"instance_id":"pseudo_to_code_2k_70","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare integer variables co and cx\ncreate const long long inf = -1e16\ninlined long long function gox with int argument num\n return inf if num is greater than cx\n declare int ex = cx % num\n declare int variable anch = cx \/ num\n declare long long variable ans = 1LL * (anch + 1) * (anch + 1) * ex\n increase ans by 1LL * anch * anch * (num - ex)\n return -ans\nend of the block\ninlined long long function goo with int argument num\n if num is greater than co\n declare int variable juntos = co - num + 1\n create long long ans = 1LL * juntos * juntos\n increase ans by num - 1\n return ans\nend of the block\ninlined void function build with int arguments x and o\n create string s\n declare integer xx = cx \/ x\n create bool flag = true if x > o, else false\n declare bool variable fst = true\n create integer ex = cx % x\n declare integer prim = co - o + 1\n while either x or o is true\n if flag is true\n push 'x' into s xx times\n if ex is greater than 0, push 'x' into s and decrement ex\n decrement x\n else\n if fst is true\n push 'o' into s prim times\n set fst to false\n else\n push 'o' into s\n decrement o\n end of the block\n invert the value of flag\n end of the block\n print s\nend of the block\ndefine the main function\n read co and cx\n if co is 0 or cx is 0\n if co is greater than 0\n print 1LL * co * co\n print 'o' co times\n print a new line\n end of the block\n if cx is greater than 0\n print - 1LL * cx * cx\n print 'x' cx times\n print\n end of the block\n return to indicate successful execution\n end of the block\n declare int lim = min of co and cx\n create long long ans = LLONG_MIN\n pos is a pair of integers\n for integer i = 1 to lim + 1 exclusive\n if ans is less than gox(i) + goo(i)\n assign gox(i) + goo(i) to ans\n pos = {i, i}\n end of the block\n end of the block\n for i = 2 to cx + 1 exclusive\n if ans is less than gox(i) + goo(i - 1)\n change ans to gox(i) + goo(i - 1)\n pos = {i, i - 1}\n end of the block\n end of the block\n for i = 2 to co + 1 exclusive\n if ans is less than gox(i - 1) + goo(i)\n set ans to gox(i - 1) + goo(i)\n pos = {i - 1, i}\n end of the block\n end of the block\n print ans\n call build with arguments pos.first and pos.second\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int co, cx;\nconst long long inf = -1e16;\ninline long long gox(int num) {\n if (num > cx) return inf;\n int ex = cx % num;\n int anch = cx \/ num;\n long long ans = 1LL * (anch + 1) * (anch + 1) * ex;\n ans += 1LL * anch * anch * (num - ex);\n return -ans;\n}\ninline long long goo(int num) {\n if (num > co) return inf;\n int juntos = co - num + 1;\n long long ans = 1LL * juntos * juntos;\n ans += num - 1;\n return ans;\n}\ninline void build(int x, int o) {\n string s;\n int xx = cx \/ x;\n bool flag = (x > o);\n bool fst = true;\n int ex = cx % x;\n int prim = co - o + 1;\n while (x || o) {\n if (flag) {\n for (int i = int(0); i < int(xx); ++i) s.push_back('x');\n if (ex > 0) s.push_back('x'), ex--;\n x--;\n } else {\n if (fst) {\n for (int i = int(0); i < int(prim); ++i) s.push_back('o');\n fst = false;\n } else\n s.push_back('o');\n o--;\n }\n flag = (!flag);\n }\n cout << s << endl;\n}\nint main() {\n cin >> co >> cx;\n if (co == 0 || cx == 0) {\n if (co > 0) {\n cout << 1LL * co * co << endl;\n for (int i = int(0); i < int(co); ++i) cout << 'o';\n cout << endl;\n }\n if (cx > 0) {\n cout << -1LL * cx * cx << endl;\n for (int i = int(0); i < int(cx); ++i) cout << 'x';\n cout << endl;\n }\n return 0;\n }\n int lim = min(co, cx);\n long long ans = LLONG_MIN;\n pair pos;\n for (int i = int(1); i < int(lim + 1); ++i) {\n if (ans < gox(i) + goo(i)) {\n ans = gox(i) + goo(i);\n pos = {i, i};\n }\n }\n for (int i = int(2); i < int(cx + 1); ++i) {\n if (ans < gox(i) + goo(i - 1)) {\n ans = gox(i) + goo(i - 1);\n pos = {i, i - 1};\n }\n }\n for (int i = int(2); i < int(co + 1); ++i) {\n if (ans < gox(i - 1) + goo(i)) {\n ans = gox(i - 1) + goo(i);\n pos = {i - 1, i};\n }\n }\n cout << ans << endl;\n build(pos.first, pos.second);\n return 0;\n}","item":{"problem_id":"398A","pseudocode":"declare integer variables co and cx\ncreate const long long inf = -1e16\ninlined long long function gox with int argument num\n return inf if num is greater than cx\n declare int ex = cx % num\n declare int variable anch = cx \/ num\n declare long long variable ans = 1LL * (anch + 1) * (anch + 1) * ex\n increase ans by 1LL * anch * anch * (num - ex)\n return -ans\nend of the block\ninlined long long function goo with int argument num\n if num is greater than co\n declare int variable juntos = co - num + 1\n create long long ans = 1LL * juntos * juntos\n increase ans by num - 1\n return ans\nend of the block\ninlined void function build with int arguments x and o\n create string s\n declare integer xx = cx \/ x\n create bool flag = true if x > o, else false\n declare bool variable fst = true\n create integer ex = cx % x\n declare integer prim = co - o + 1\n while either x or o is true\n if flag is true\n push 'x' into s xx times\n if ex is greater than 0, push 'x' into s and decrement ex\n decrement x\n else\n if fst is true\n push 'o' into s prim times\n set fst to false\n else\n push 'o' into s\n decrement o\n end of the block\n invert the value of flag\n end of the block\n print s\nend of the block\ndefine the main function\n read co and cx\n if co is 0 or cx is 0\n if co is greater than 0\n print 1LL * co * co\n print 'o' co times\n print a new line\n end of the block\n if cx is greater than 0\n print - 1LL * cx * cx\n print 'x' cx times\n print\n end of the block\n return to indicate successful execution\n end of the block\n declare int lim = min of co and cx\n create long long ans = LLONG_MIN\n pos is a pair of integers\n for integer i = 1 to lim + 1 exclusive\n if ans is less than gox(i) + goo(i)\n assign gox(i) + goo(i) to ans\n pos = {i, i}\n end of the block\n end of the block\n for i = 2 to cx + 1 exclusive\n if ans is less than gox(i) + goo(i - 1)\n change ans to gox(i) + goo(i - 1)\n pos = {i, i - 1}\n end of the block\n end of the block\n for i = 2 to co + 1 exclusive\n if ans is less than gox(i - 1) + goo(i)\n set ans to gox(i - 1) + goo(i)\n pos = {i - 1, i}\n end of the block\n end of the block\n print ans\n call build with arguments pos.first and pos.second\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["-1","xxoox"]],[["4 0"],["16","oooo"]],[["0 4"],["-16","xxxx"]],[["8 6"],["46","xxxooooooooxxx"]],[["1 1"],["0","ox"]],[["38 5"],["1431","xxxooooooooooooooooooooooooooooooooooooooxx"]],[["2 122"],["-4960","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]],[["4 2"],["14","xoooox"]],[["4 9"],["-13","xxoxxoxxoxxox"]],[["8 10"],["16","xxxxoooooooxxxoxxx"]],[["206 209"],["34847","xxxxxxxxxxxxxxxxxxxoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxx"]],[["5 17"],["-44","xxxoxxxoxxxoxxxoxxxoxx"]],[["1 2"],["-1","xox"]],[["2 1"],["3","oox"]],[["1 1"],["0","ox"]],[["1 0"],["1","o"]],[["0 1"],["-1","x"]],[["2 2"],["2","xoox"]],[["4 1"],["15","oooox"]],[["4 2"],["14","xoooox"]],[["4 3"],["11","xxoooox"]],[["4 4"],["8","xxooooxx"]],[["4 5"],["3","xxxooooxx"]],[["4 6"],["-2","xxxooooxxx"]],[["4 7"],["-7","xxxoooxxoxx"]]]}} +{"instance_id":"pseudo_to_code_2k_71","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create long long a and b\n read a,b\n if a equal to 0\n print -1 * b * b\n for i=0 to b exclusive, print x\n print a newline\n else if b = 0\n print a * a\n for i=0 to a exclusive, print o\n print a newline\n else if b equal to 1\n print a*a -1\n for i=0 to a exclusive, print o\n print x\n print a newline\n else\n ser ret to LLONG_MIN\n set foo=0\n for j=1 to min of b-1 and a\n assign (a - j + 1) * (a - j + 1) + (j - 1) to pos\n set q = b \/ (j + 1) and r to b % (j + 1)\n set neg = r * (q + 1) * (q + 1) + (j + 1 - r) * q * q\n if pos - neg greater than ret\n ret = pos - neg\n assign j + 1 to foo\n end of the block\n end of the block\n print ret\n set q = b \/ foo, r = b % foo\n assign (a - (foo - 1) + 1) to g\n for j=1 to foo + 1 exclusive\n for i=0 to q exclusive, print x\n if <= r, print x\n if j different from foo\n if j equal to 1\n for i=0 to g exclusive, print o\n else\n print o\n end of the block\n end of the block\n print a newline\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n long long a, b;\n cin >> a >> b;\n if (a == 0) {\n cout << -1 * b * b << endl;\n for (int(i) = (0); (i) < (b); ++(i)) cout << 'x';\n cout << endl;\n } else if (b == 0) {\n cout << a * a << endl;\n for (int(i) = (0); (i) < (a); ++(i)) cout << 'o';\n cout << endl;\n } else if (b == 1) {\n cout << a * a - 1 << endl;\n for (int(i) = (0); (i) < (a); ++(i)) cout << 'o';\n cout << 'x';\n cout << endl;\n } else {\n long long ret = LLONG_MIN;\n long long foo = 0;\n for (long long j = 1; j <= min(b - 1, a); j++) {\n long long pos = (a - j + 1) * (a - j + 1) + (j - 1);\n long long q = b \/ (j + 1), r = b % (j + 1);\n long long neg = r * (q + 1) * (q + 1) + (j + 1 - r) * q * q;\n if (pos - neg > ret) {\n ret = pos - neg;\n foo = j + 1;\n }\n }\n cout << ret << endl;\n long long q = b \/ foo, r = b % foo;\n long long g = (a - (foo - 1) + 1);\n for (int(j) = (1); (j) < (foo + 1); ++(j)) {\n for (int(i) = (0); (i) < (q); ++(i)) cout << 'x';\n if (j <= r) cout << 'x';\n if (j != foo) {\n if (j == 1)\n for (int(i) = (0); (i) < (g); ++(i)) cout << 'o';\n else\n cout << 'o';\n }\n }\n cout << endl;\n }\n return 0;\n}","item":{"problem_id":"398A","pseudocode":"define the main function\n create long long a and b\n read a,b\n if a equal to 0\n print -1 * b * b\n for i=0 to b exclusive, print x\n print a newline\n else if b = 0\n print a * a\n for i=0 to a exclusive, print o\n print a newline\n else if b equal to 1\n print a*a -1\n for i=0 to a exclusive, print o\n print x\n print a newline\n else\n ser ret to LLONG_MIN\n set foo=0\n for j=1 to min of b-1 and a\n assign (a - j + 1) * (a - j + 1) + (j - 1) to pos\n set q = b \/ (j + 1) and r to b % (j + 1)\n set neg = r * (q + 1) * (q + 1) + (j + 1 - r) * q * q\n if pos - neg greater than ret\n ret = pos - neg\n assign j + 1 to foo\n end of the block\n end of the block\n print ret\n set q = b \/ foo, r = b % foo\n assign (a - (foo - 1) + 1) to g\n for j=1 to foo + 1 exclusive\n for i=0 to q exclusive, print x\n if <= r, print x\n if j different from foo\n if j equal to 1\n for i=0 to g exclusive, print o\n else\n print o\n end of the block\n end of the block\n print a newline\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["-1","xxoox"]],[["4 0"],["16","oooo"]],[["0 4"],["-16","xxxx"]],[["8 6"],["46","xxxooooooooxxx"]],[["1 1"],["0","ox"]],[["38 5"],["1431","xxxooooooooooooooooooooooooooooooooooooooxx"]],[["2 122"],["-4960","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]],[["4 2"],["14","xoooox"]],[["4 9"],["-13","xxoxxoxxoxxox"]],[["8 10"],["16","xxxxoooooooxxxoxxx"]],[["206 209"],["34847","xxxxxxxxxxxxxxxxxxxoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxx"]],[["5 17"],["-44","xxxoxxxoxxxoxxxoxxxoxx"]],[["1 2"],["-1","xox"]],[["2 1"],["3","oox"]],[["1 1"],["0","ox"]],[["1 0"],["1","o"]],[["0 1"],["-1","x"]],[["2 2"],["2","xoox"]],[["4 1"],["15","oooox"]],[["4 2"],["14","xoooox"]],[["4 3"],["11","xxoooox"]],[["4 4"],["8","xxooooxx"]],[["4 5"],["3","xxxooooxx"]],[["4 6"],["-2","xxxooooxxx"]],[["4 7"],["-7","xxxoooxxoxx"]]]}} +{"instance_id":"pseudo_to_code_2k_72","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integers flag, gender, ok, t and cnt\ncal is a new array of integers with size 10005\ndeclare new string variable s\ncreate an arrays of strings x with 6 elements = \"lios\", \"liala\", \"etr\", \"etra\", \"initis\", \"inites\", and y wth 10005 elements\nfunction cmp with string arguments a and b that returns integer\n define integer variables len1 = length of a, and len2 = length of b\n in a for loop, change i from 0 to len2 exclusive\n if a[len1 - len2 + i] != b[i], return 0\n return 1\nend of the block\nfunction over with string argument s\n print s\n terminate the process\nend of the block\ndefine the main function\n create new integer called cnt with value 0\n loop, reading s from the input\n increment cnt by one\n change the value of y[cnt] to s\n change flag to 0\n in a for loop, change i from 0 to 6 exclusive\n if cmp(y[cnt], x[i]) returned true\n change flag to 1\n change the value of cal[cnt] to i\n end of the block\n if flag = 0, call over(\"NO\")\n if character from the input is equal to '\\n', stop the loop\n end of the block\n if cnt = 1, call over(\"YES\")\n start for loop from i = 1 to cnt exclusive\n if cal[i] % 2 != cal[i + 1] % 2 || cal[i] > cal[i + 1], call over(\"NO\")\n change flag to 0\n for integer i = 1 to cnt inclusive incrementing i\n if cal[i] \/ 2 = 1, increment flag by one\n if flag != 1, call over(\"NO\")\n call over(\"YES\")\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int flag, gender, ok, t, cnt;\nint cal[10005];\nstring s;\nstring x[6] = {\"lios\", \"liala\", \"etr\", \"etra\", \"initis\", \"inites\"}, y[10005];\nint cmp(string a, string b) {\n int len1 = a.size(), len2 = b.size();\n for (int i = 0; i < len2; i++)\n if (a[len1 - len2 + i] != b[i]) return 0;\n return 1;\n}\nvoid over(string s) {\n cout << s << endl;\n exit(0);\n}\nint main() {\n int cnt = 0;\n while (cin >> s) {\n cnt++;\n y[cnt] = s;\n flag = 0;\n for (int i = 0; i < 6; i++)\n if (cmp(y[cnt], x[i])) {\n flag = 1;\n cal[cnt] = i;\n }\n if (flag == 0) over(\"NO\");\n if (cin.get() == '\\n') break;\n }\n if (cnt == 1) over(\"YES\");\n for (int i = 1; i < cnt; i++)\n if (cal[i] % 2 != cal[i + 1] % 2 || cal[i] > cal[i + 1]) over(\"NO\");\n flag = 0;\n for (int i = 1; i <= cnt; i++)\n if (cal[i] \/ 2 == 1) flag++;\n if (flag != 1) over(\"NO\");\n over(\"YES\");\n return 0;\n}","item":{"problem_id":"113A","pseudocode":"create integers flag, gender, ok, t and cnt\ncal is a new array of integers with size 10005\ndeclare new string variable s\ncreate an arrays of strings x with 6 elements = \"lios\", \"liala\", \"etr\", \"etra\", \"initis\", \"inites\", and y wth 10005 elements\nfunction cmp with string arguments a and b that returns integer\n define integer variables len1 = length of a, and len2 = length of b\n in a for loop, change i from 0 to len2 exclusive\n if a[len1 - len2 + i] != b[i], return 0\n return 1\nend of the block\nfunction over with string argument s\n print s\n terminate the process\nend of the block\ndefine the main function\n create new integer called cnt with value 0\n loop, reading s from the input\n increment cnt by one\n change the value of y[cnt] to s\n change flag to 0\n in a for loop, change i from 0 to 6 exclusive\n if cmp(y[cnt], x[i]) returned true\n change flag to 1\n change the value of cal[cnt] to i\n end of the block\n if flag = 0, call over(\"NO\")\n if character from the input is equal to '\\n', stop the loop\n end of the block\n if cnt = 1, call over(\"YES\")\n start for loop from i = 1 to cnt exclusive\n if cal[i] % 2 != cal[i + 1] % 2 || cal[i] > cal[i + 1], call over(\"NO\")\n change flag to 0\n for integer i = 1 to cnt inclusive incrementing i\n if cal[i] \/ 2 = 1, increment flag by one\n if flag != 1, call over(\"NO\")\n call over(\"YES\")\n return to indicate successful execution\nend of the block","testcases":[[["petr"],["YES"]],[["etis atis animatis etis atis amatis"],["NO"]],[["nataliala kataliala vetra feinites"],["YES"]],[["qweasbvflios"],["YES"]],[["lios lios petr initis qwe"],["NO"]],[["lios initis"],["NO"]],[["petr initis lios"],["NO"]],[["petra petra petra"],["NO"]],[["in"],["NO"]],[["liala petra initis"],["NO"]],[["liala petra inites"],["YES"]],[["liala initis"],["NO"]],[["liala petra petr inites"],["NO"]],[["liala petr inites"],["NO"]],[["llilitos"],["NO"]],[["umeszdawsvgkjhlqwzentsphxqhdungbylhnikwviuhccbstghhxlmvcjznnkjqkugsdysjbedwpmsmxmgxlrlxctnebtbwrsvgjktkrosffwymovxvsgfmmqwfflpvbumozikroxrdgwjrnstngstxbiyyuxehrhviteptedlmyetr"],["YES"]],[["i i i i i i i i i i i i i i i a a a a a a v v v v v v v v v v v"],["NO"]],[["fbvzqonvdlqdanwliolaqfj sbauorbinites xkbfnfinitespjy phbexglblzpobtqpisyijycmtliola aosinites lbpjiwcjoqyuhglthloiniteswb mjtxhoofohzzgefvhsywojcuxtetxmojrlktodhbgyrkeejgjzxkzyvrxwmyaqkeoqnvusnlrsfffrzeoqjdfumolhksqkrtzwhnforgpenziokrxlnhcapbbupctlmuetrani pigxerwetupjbkvlmgnjhdfjliolanz tqhaidxbqmdaeincxjuliola"],["NO"]],[["mfrmqetr"],["YES"]],[["hnwvfllholxfialiola cknjtxpliola daliola gqfapnhmmworliola qhetra qrisbexsrefcwzoxqwxrevinites wwldqkqhvrgwplqinites nqdpoauitczttxoinites fgbmdfpxkhahkinites"],["NO"]],[["kcymcpgqdxkudadewddualeemhixhsdazudnjdmuvxvrlrbrpsdpxpagmrogplltnifrtomdtahxwadguvetxaqkvsvnoyhowirnluhmyewzapirnpfdisvhtbenxmfezahqoflkjrfqjubwdfktnpeirodwubftzlcczzavfiooihzvnqincndisudihvbcaxptrwovekmhiiwsgzgbxydvuldlnktxtltrlajjzietkxbnhetra"],["YES"]],[["dosiydnwxemojaavfdvlwsyhzqywqjutovygtlcleklhybczhjqfzxwdmlwqwcqqyfjkzhsizlmdarrfronxqkcknwpkvhdlgatdyjisjoopvngpjggldxjfxaauoxmqirkuphydyweoixftstlozaoywnxgriscudwlokncbmaebpssccmmmfjennyjaryqlzjknnklqketra"],["YES"]],[["etretra linites"],["YES"]],[["petretra petr"],["NO"]],[["lialalios petraveryfunnypetr"],["YES"]],[["petropetrapetr petra"],["NO"]],[["lios petrnonono"],["NO"]],[["lios petr initisandinitisandliala petrainitis"],["NO"]],[["petro"],["NO"]],[["petr initesinitis"],["YES"]],[["lios initis"],["NO"]],[["liala initespetra"],["YES"]],[["lios petrapetr"],["YES"]],[["initis petr"],["NO"]],[["lioslialapetrpetrainitisinitesliosliala initesinitislioslialapetrpetrainitisinitetra"],["YES"]],[["veryfunnyprefixpetr"],["YES"]],[["veryfunnyprefixpetra"],["YES"]],[["veryfunnyprefixinitis"],["YES"]],[["veryfunnyprefixinites"],["YES"]],[["veryfunnyprefixliala"],["YES"]],[["veryfunnyprefixlios"],["YES"]],[["veryfunnyprefixlialas"],["NO"]],[["veryfunnyprefixliala veryfunnyprefixpetretra"],["YES"]],[["veryfunnyprefixlios veryfunnyprefixinitisetr"],["YES"]],[["veryfunnyprefixlios aabbinitis"],["NO"]],[["veryfunnyprefixlios inites"],["NO"]],[["lios petr initis"],["YES"]],[["liala etra inites"],["YES"]],[["lios"],["YES"]],[["liala"],["YES"]],[["initis"],["YES"]],[["inites"],["YES"]],[["tes"],["NO"]],[["tr"],["NO"]],[["a"],["NO"]],[["lios lios"],["NO"]],[["lios"],["YES"]],[["liala"],["YES"]],[["petr"],["YES"]],[["petra"],["YES"]],[["pinitis"],["YES"]],[["pinites"],["YES"]],[["plios pliala"],["NO"]],[["plios petr"],["YES"]],[["plios petra"],["NO"]],[["plios plios"],["NO"]],[["plios initis"],["NO"]],[["plios pinites"],["NO"]],[["pliala plios"],["NO"]],[["pliala ppliala"],["NO"]],[["pliala petr"],["NO"]],[["pliala petra"],["YES"]],[["pliala pinitis"],["NO"]],[["pliala pinites"],["NO"]],[["petr plios"],["NO"]],[["petr pliala"],["NO"]],[["petr petr"],["NO"]],[["petr petra"],["NO"]],[["petr pinitis"],["YES"]],[["petr pinites"],["NO"]],[["petra lios"],["NO"]],[["petra liala"],["NO"]],[["petra petr"],["NO"]],[["petra petra"],["NO"]],[["petra initis"],["NO"]],[["petra inites"],["YES"]],[["initis lios"],["NO"]],[["initis liala"],["NO"]],[["initis petr"],["NO"]],[["initis petra"],["NO"]],[["initis initis"],["NO"]],[["initis inites"],["NO"]],[["inites lios"],["NO"]],[["inites liala"],["NO"]],[["inites petr"],["NO"]],[["inites petra"],["NO"]],[["inites initis"],["NO"]],[["inites inites"],["NO"]],[["lios lios lios"],["NO"]],[["lios lios liala"],["NO"]],[["lios lios etr"],["YES"]],[["lios lios etra"],["NO"]],[["lios lios initis"],["NO"]],[["lios lios inites"],["NO"]],[["lios liala lios"],["NO"]],[["lios liala liala"],["NO"]],[["lios liala etr"],["NO"]],[["lios liala etra"],["NO"]],[["lios liala initis"],["NO"]],[["lios liala inites"],["NO"]],[["lios etr lios"],["NO"]],[["lios etr liala"],["NO"]],[["lios etr etr"],["NO"]],[["lios etr etra"],["NO"]],[["lios etr initis"],["YES"]],[["lios etr inites"],["NO"]],[["lios etra lios"],["NO"]],[["lios etra liala"],["NO"]],[["lios etra etr"],["NO"]],[["lios etra etra"],["NO"]],[["lios etra initis"],["NO"]],[["lios etra inites"],["NO"]],[["lios initis lios"],["NO"]],[["lios initis liala"],["NO"]],[["lios initis etr"],["NO"]],[["lios initis etra"],["NO"]],[["lios initis initis"],["NO"]],[["lios initis inites"],["NO"]],[["lios inites lios"],["NO"]],[["lios inites liala"],["NO"]],[["lios inites etr"],["NO"]],[["lios inites etra"],["NO"]],[["lios inites initis"],["NO"]],[["lios inites inites"],["NO"]],[["liala lios lios"],["NO"]],[["liala lios liala"],["NO"]],[["liala lios etr"],["NO"]],[["liala lios etra"],["NO"]],[["liala lios initis"],["NO"]],[["liala lios inites"],["NO"]],[["liala liala lios"],["NO"]],[["liala liala liala"],["NO"]],[["liala liala etr"],["NO"]],[["liala liala etra"],["YES"]],[["liala liala initis"],["NO"]],[["liala liala inites"],["NO"]],[["liala etr lios"],["NO"]],[["liala etr liala"],["NO"]],[["liala etr etr"],["NO"]],[["liala etr etra"],["NO"]],[["liala etr initis"],["NO"]],[["liala etr inites"],["NO"]],[["liala etra lios"],["NO"]],[["liala etra liala"],["NO"]],[["liala etra etr"],["NO"]],[["liala etra etra"],["NO"]],[["liala etra initis"],["NO"]],[["liala etra inites"],["YES"]],[["liala initis lios"],["NO"]],[["liala initis liala"],["NO"]],[["liala initis etr"],["NO"]],[["liala initis etra"],["NO"]],[["liala initis initis"],["NO"]],[["liala initis inites"],["NO"]],[["liala inites lios"],["NO"]],[["liala inites liala"],["NO"]],[["liala inites etr"],["NO"]],[["liala inites etra"],["NO"]],[["liala inites initis"],["NO"]],[["liala inites inites"],["NO"]],[["etr lios lios"],["NO"]],[["etr lios liala"],["NO"]],[["etr lios etr"],["NO"]],[["etr lios etra"],["NO"]],[["etr lios initis"],["NO"]],[["etr lios inites"],["NO"]],[["etr liala lios"],["NO"]],[["etr liala liala"],["NO"]],[["etr liala etr"],["NO"]],[["etr liala etra"],["NO"]],[["etr liala initis"],["NO"]],[["etr liala inites"],["NO"]],[["etr etr lios"],["NO"]],[["etr etr liala"],["NO"]],[["etr etr etr"],["NO"]],[["etr etr etra"],["NO"]],[["etr etr initis"],["NO"]],[["etr etr inites"],["NO"]],[["etr etra lios"],["NO"]],[["etr etra liala"],["NO"]],[["etr etra etr"],["NO"]],[["etr etra etra"],["NO"]],[["etr etra initis"],["NO"]],[["etr etra inites"],["NO"]],[["etr initis lios"],["NO"]],[["etr initis liala"],["NO"]],[["etr initis etr"],["NO"]],[["etr initis etra"],["NO"]],[["etr initis initis"],["YES"]],[["etr initis inites"],["NO"]],[["etr inites lios"],["NO"]],[["etr inites liala"],["NO"]],[["etr inites etr"],["NO"]],[["etr inites etra"],["NO"]],[["etr inites initis"],["NO"]],[["etr inites inites"],["NO"]],[["etra lios lios"],["NO"]],[["etra lios liala"],["NO"]],[["etra lios etr"],["NO"]],[["etra lios etra"],["NO"]],[["etra lios initis"],["NO"]],[["etra lios inites"],["NO"]],[["etra liala lios"],["NO"]],[["etra liala liala"],["NO"]],[["etra liala etr"],["NO"]],[["etra liala etra"],["NO"]],[["etra liala initis"],["NO"]],[["etra liala inites"],["NO"]],[["etra etr lios"],["NO"]],[["etra etr liala"],["NO"]],[["etra etr etr"],["NO"]],[["etra etr etra"],["NO"]],[["etra etr initis"],["NO"]],[["etra etr inites"],["NO"]],[["etra etra lios"],["NO"]],[["etra etra liala"],["NO"]],[["etra etra etr"],["NO"]],[["etra etra etra"],["NO"]],[["etra etra initis"],["NO"]],[["etra etra inites"],["NO"]],[["etra initis lios"],["NO"]],[["etra initis liala"],["NO"]],[["etra initis etr"],["NO"]],[["etra initis etra"],["NO"]],[["etra initis initis"],["NO"]],[["etra initis inites"],["NO"]],[["etra inites lios"],["NO"]],[["etra inites liala"],["NO"]],[["etra inites etr"],["NO"]],[["etra inites etra"],["NO"]],[["etra inites initis"],["NO"]],[["etra inites inites"],["YES"]],[["initis lios lios"],["NO"]],[["initis lios liala"],["NO"]],[["initis lios etr"],["NO"]],[["initis lios etra"],["NO"]],[["initis lios initis"],["NO"]],[["initis lios inites"],["NO"]],[["initis liala lios"],["NO"]],[["initis liala liala"],["NO"]],[["initis liala etr"],["NO"]],[["initis liala etra"],["NO"]],[["initis liala initis"],["NO"]],[["initis liala inites"],["NO"]],[["initis etr lios"],["NO"]],[["initis etr liala"],["NO"]],[["initis etr etr"],["NO"]],[["initis etr etra"],["NO"]],[["initis etr initis"],["NO"]],[["initis etr inites"],["NO"]],[["initis etra lios"],["NO"]],[["initis etra liala"],["NO"]],[["initis etra etr"],["NO"]],[["initis etra etra"],["NO"]],[["initis etra initis"],["NO"]],[["initis etra inites"],["NO"]],[["initis initis lios"],["NO"]],[["initis initis liala"],["NO"]],[["initis initis etr"],["NO"]],[["initis initis etra"],["NO"]],[["initis initis initis"],["NO"]],[["initis initis inites"],["NO"]],[["initis inites lios"],["NO"]],[["initis inites liala"],["NO"]],[["initis inites etr"],["NO"]],[["initis inites etra"],["NO"]],[["initis inites initis"],["NO"]],[["initis inites inites"],["NO"]],[["inites lios lios"],["NO"]],[["inites lios liala"],["NO"]],[["inites lios etr"],["NO"]],[["inites lios etra"],["NO"]],[["inites lios initis"],["NO"]],[["inites lios inites"],["NO"]],[["inites liala lios"],["NO"]],[["inites liala liala"],["NO"]],[["inites liala etr"],["NO"]],[["inites liala etra"],["NO"]],[["inites liala initis"],["NO"]],[["inites liala inites"],["NO"]],[["inites etr lios"],["NO"]],[["inites etr liala"],["NO"]],[["inites etr etr"],["NO"]],[["inites etr etra"],["NO"]],[["inites etr initis"],["NO"]],[["inites etr inites"],["NO"]],[["inites etra lios"],["NO"]],[["inites etra liala"],["NO"]],[["inites etra etr"],["NO"]],[["inites etra etra"],["NO"]],[["inites etra initis"],["NO"]],[["inites etra inites"],["NO"]],[["inites initis lios"],["NO"]],[["inites initis liala"],["NO"]],[["inites initis etr"],["NO"]],[["inites initis etra"],["NO"]],[["inites initis initis"],["NO"]],[["inites initis inites"],["NO"]],[["inites inites lios"],["NO"]],[["inites inites liala"],["NO"]],[["inites inites etr"],["NO"]],[["inites inites etra"],["NO"]],[["inites inites initis"],["NO"]],[["inites inites inites"],["NO"]]]}} +{"instance_id":"pseudo_to_code_2k_73","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare int variables flag, gender, ok, t and cnt\ndeclare new string called s\ndefine new array of strings filled with elements \"lios\", \"liala\", \"etr\", \"etra\", \"initis\" and \"inites\"\ninteger function cmp with string arguments a and b\n define integers len1 = length of a, and lent2 = length of b\n start for loop from i = 0 to len2 exclusive\n return 0 if a[len1 - len2 + i] != b[i]\n end of the block\n return 1\nend of the block\ndefine the main function\n assign the new value = 3 to gender\n read s and keep looping\n set ok to 0\n for integer i = 0 to 6 exclusive incrementing i\n if cmp(s, x[i]) is not 0\n assign 1 to ok\n increment cnt by one\n if gender = 3\n set the value of gender to i modulo 2\n else if i % 2 != gender\n print \"NO\"\n return to indicate successful execution\n end of the block\n assign the new value = i \/ 2 + 1 to t\n if t is equal to 1 and flag = 0\n change flag to 1\n else if t and flag are both 1\n change flag to 1\n else if t is equal to 2 and flag is equal to 1\n set the value of flag to 2\n else if t is equal to 2 and flag = 0\n assign the new value = 2 to flag\n else if t is equal to 3 and flag = 0\n assign the new value = -1 to flag\n else if t is equal to 3 and flag = 2\n set the value of flag to 3\n else if t and flag are both equal to 3\n change flag to 3\n else\n print \"NO\"\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n if ok is equal to 0\n print \"NO\"\n return to indicate successful execution\n end of the block\n if character from the input is equal to '\\n', break the loop\n end of the block\n if flag = 1 and cnt > 1\n print \"NO\"\n else\n print \"YES\"\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int flag, gender, ok, t, cnt;\nstring s;\nstring x[6] = {\"lios\", \"liala\", \"etr\", \"etra\", \"initis\", \"inites\"};\nint cmp(string a, string b) {\n int len1 = a.size(), len2 = b.size();\n for (int i = 0; i < len2; i++) {\n if (a[len1 - len2 + i] != b[i]) return 0;\n }\n return 1;\n}\nint main() {\n gender = 3;\n while (cin >> s) {\n ok = 0;\n for (int i = 0; i < 6; i++) {\n if (cmp(s, x[i])) {\n ok = 1;\n cnt++;\n if (gender == 3)\n gender = i % 2;\n else if (i % 2 != gender) {\n cout << \"NO\" << endl;\n return 0;\n }\n t = i \/ 2 + 1;\n if (t == 1 && flag == 0)\n flag = 1;\n else if (t == 1 && flag == 1)\n flag = 1;\n else if (t == 2 && flag == 1)\n flag = 2;\n else if (t == 2 && flag == 0)\n flag = 2;\n else if (t == 3 && flag == 0)\n flag = -1;\n else if (t == 3 && flag == 2)\n flag = 3;\n else if (t == 3 && flag == 3)\n flag = 3;\n else {\n cout << \"NO\" << endl;\n return 0;\n }\n }\n }\n if (ok == 0) {\n cout << \"NO\" << endl;\n return 0;\n }\n if (cin.get() == '\\n') break;\n }\n if (flag == 1 && cnt > 1)\n cout << \"NO\" << endl;\n else\n cout << \"YES\" << endl;\n return 0;\n}","item":{"problem_id":"113A","pseudocode":"declare int variables flag, gender, ok, t and cnt\ndeclare new string called s\ndefine new array of strings filled with elements \"lios\", \"liala\", \"etr\", \"etra\", \"initis\" and \"inites\"\ninteger function cmp with string arguments a and b\n define integers len1 = length of a, and lent2 = length of b\n start for loop from i = 0 to len2 exclusive\n return 0 if a[len1 - len2 + i] != b[i]\n end of the block\n return 1\nend of the block\ndefine the main function\n assign the new value = 3 to gender\n read s and keep looping\n set ok to 0\n for integer i = 0 to 6 exclusive incrementing i\n if cmp(s, x[i]) is not 0\n assign 1 to ok\n increment cnt by one\n if gender = 3\n set the value of gender to i modulo 2\n else if i % 2 != gender\n print \"NO\"\n return to indicate successful execution\n end of the block\n assign the new value = i \/ 2 + 1 to t\n if t is equal to 1 and flag = 0\n change flag to 1\n else if t and flag are both 1\n change flag to 1\n else if t is equal to 2 and flag is equal to 1\n set the value of flag to 2\n else if t is equal to 2 and flag = 0\n assign the new value = 2 to flag\n else if t is equal to 3 and flag = 0\n assign the new value = -1 to flag\n else if t is equal to 3 and flag = 2\n set the value of flag to 3\n else if t and flag are both equal to 3\n change flag to 3\n else\n print \"NO\"\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n if ok is equal to 0\n print \"NO\"\n return to indicate successful execution\n end of the block\n if character from the input is equal to '\\n', break the loop\n end of the block\n if flag = 1 and cnt > 1\n print \"NO\"\n else\n print \"YES\"\n return to indicate successful execution\nend of the block","testcases":[[["petr"],["YES"]],[["etis atis animatis etis atis amatis"],["NO"]],[["nataliala kataliala vetra feinites"],["YES"]],[["qweasbvflios"],["YES"]],[["lios lios petr initis qwe"],["NO"]],[["lios initis"],["NO"]],[["petr initis lios"],["NO"]],[["petra petra petra"],["NO"]],[["in"],["NO"]],[["liala petra initis"],["NO"]],[["liala petra inites"],["YES"]],[["liala initis"],["NO"]],[["liala petra petr inites"],["NO"]],[["liala petr inites"],["NO"]],[["llilitos"],["NO"]],[["umeszdawsvgkjhlqwzentsphxqhdungbylhnikwviuhccbstghhxlmvcjznnkjqkugsdysjbedwpmsmxmgxlrlxctnebtbwrsvgjktkrosffwymovxvsgfmmqwfflpvbumozikroxrdgwjrnstngstxbiyyuxehrhviteptedlmyetr"],["YES"]],[["i i i i i i i i i i i i i i i a a a a a a v v v v v v v v v v v"],["NO"]],[["fbvzqonvdlqdanwliolaqfj sbauorbinites xkbfnfinitespjy phbexglblzpobtqpisyijycmtliola aosinites lbpjiwcjoqyuhglthloiniteswb mjtxhoofohzzgefvhsywojcuxtetxmojrlktodhbgyrkeejgjzxkzyvrxwmyaqkeoqnvusnlrsfffrzeoqjdfumolhksqkrtzwhnforgpenziokrxlnhcapbbupctlmuetrani pigxerwetupjbkvlmgnjhdfjliolanz tqhaidxbqmdaeincxjuliola"],["NO"]],[["mfrmqetr"],["YES"]],[["hnwvfllholxfialiola cknjtxpliola daliola gqfapnhmmworliola qhetra qrisbexsrefcwzoxqwxrevinites wwldqkqhvrgwplqinites nqdpoauitczttxoinites fgbmdfpxkhahkinites"],["NO"]],[["kcymcpgqdxkudadewddualeemhixhsdazudnjdmuvxvrlrbrpsdpxpagmrogplltnifrtomdtahxwadguvetxaqkvsvnoyhowirnluhmyewzapirnpfdisvhtbenxmfezahqoflkjrfqjubwdfktnpeirodwubftzlcczzavfiooihzvnqincndisudihvbcaxptrwovekmhiiwsgzgbxydvuldlnktxtltrlajjzietkxbnhetra"],["YES"]],[["dosiydnwxemojaavfdvlwsyhzqywqjutovygtlcleklhybczhjqfzxwdmlwqwcqqyfjkzhsizlmdarrfronxqkcknwpkvhdlgatdyjisjoopvngpjggldxjfxaauoxmqirkuphydyweoixftstlozaoywnxgriscudwlokncbmaebpssccmmmfjennyjaryqlzjknnklqketra"],["YES"]],[["etretra linites"],["YES"]],[["petretra petr"],["NO"]],[["lialalios petraveryfunnypetr"],["YES"]],[["petropetrapetr petra"],["NO"]],[["lios petrnonono"],["NO"]],[["lios petr initisandinitisandliala petrainitis"],["NO"]],[["petro"],["NO"]],[["petr initesinitis"],["YES"]],[["lios initis"],["NO"]],[["liala initespetra"],["YES"]],[["lios petrapetr"],["YES"]],[["initis petr"],["NO"]],[["lioslialapetrpetrainitisinitesliosliala initesinitislioslialapetrpetrainitisinitetra"],["YES"]],[["veryfunnyprefixpetr"],["YES"]],[["veryfunnyprefixpetra"],["YES"]],[["veryfunnyprefixinitis"],["YES"]],[["veryfunnyprefixinites"],["YES"]],[["veryfunnyprefixliala"],["YES"]],[["veryfunnyprefixlios"],["YES"]],[["veryfunnyprefixlialas"],["NO"]],[["veryfunnyprefixliala veryfunnyprefixpetretra"],["YES"]],[["veryfunnyprefixlios veryfunnyprefixinitisetr"],["YES"]],[["veryfunnyprefixlios aabbinitis"],["NO"]],[["veryfunnyprefixlios inites"],["NO"]],[["lios petr initis"],["YES"]],[["liala etra inites"],["YES"]],[["lios"],["YES"]],[["liala"],["YES"]],[["initis"],["YES"]],[["inites"],["YES"]],[["tes"],["NO"]],[["tr"],["NO"]],[["a"],["NO"]],[["lios lios"],["NO"]],[["lios"],["YES"]],[["liala"],["YES"]],[["petr"],["YES"]],[["petra"],["YES"]],[["pinitis"],["YES"]],[["pinites"],["YES"]],[["plios pliala"],["NO"]],[["plios petr"],["YES"]],[["plios petra"],["NO"]],[["plios plios"],["NO"]],[["plios initis"],["NO"]],[["plios pinites"],["NO"]],[["pliala plios"],["NO"]],[["pliala ppliala"],["NO"]],[["pliala petr"],["NO"]],[["pliala petra"],["YES"]],[["pliala pinitis"],["NO"]],[["pliala pinites"],["NO"]],[["petr plios"],["NO"]],[["petr pliala"],["NO"]],[["petr petr"],["NO"]],[["petr petra"],["NO"]],[["petr pinitis"],["YES"]],[["petr pinites"],["NO"]],[["petra lios"],["NO"]],[["petra liala"],["NO"]],[["petra petr"],["NO"]],[["petra petra"],["NO"]],[["petra initis"],["NO"]],[["petra inites"],["YES"]],[["initis lios"],["NO"]],[["initis liala"],["NO"]],[["initis petr"],["NO"]],[["initis petra"],["NO"]],[["initis initis"],["NO"]],[["initis inites"],["NO"]],[["inites lios"],["NO"]],[["inites liala"],["NO"]],[["inites petr"],["NO"]],[["inites petra"],["NO"]],[["inites initis"],["NO"]],[["inites inites"],["NO"]],[["lios lios lios"],["NO"]],[["lios lios liala"],["NO"]],[["lios lios etr"],["YES"]],[["lios lios etra"],["NO"]],[["lios lios initis"],["NO"]],[["lios lios inites"],["NO"]],[["lios liala lios"],["NO"]],[["lios liala liala"],["NO"]],[["lios liala etr"],["NO"]],[["lios liala etra"],["NO"]],[["lios liala initis"],["NO"]],[["lios liala inites"],["NO"]],[["lios etr lios"],["NO"]],[["lios etr liala"],["NO"]],[["lios etr etr"],["NO"]],[["lios etr etra"],["NO"]],[["lios etr initis"],["YES"]],[["lios etr inites"],["NO"]],[["lios etra lios"],["NO"]],[["lios etra liala"],["NO"]],[["lios etra etr"],["NO"]],[["lios etra etra"],["NO"]],[["lios etra initis"],["NO"]],[["lios etra inites"],["NO"]],[["lios initis lios"],["NO"]],[["lios initis liala"],["NO"]],[["lios initis etr"],["NO"]],[["lios initis etra"],["NO"]],[["lios initis initis"],["NO"]],[["lios initis inites"],["NO"]],[["lios inites lios"],["NO"]],[["lios inites liala"],["NO"]],[["lios inites etr"],["NO"]],[["lios inites etra"],["NO"]],[["lios inites initis"],["NO"]],[["lios inites inites"],["NO"]],[["liala lios lios"],["NO"]],[["liala lios liala"],["NO"]],[["liala lios etr"],["NO"]],[["liala lios etra"],["NO"]],[["liala lios initis"],["NO"]],[["liala lios inites"],["NO"]],[["liala liala lios"],["NO"]],[["liala liala liala"],["NO"]],[["liala liala etr"],["NO"]],[["liala liala etra"],["YES"]],[["liala liala initis"],["NO"]],[["liala liala inites"],["NO"]],[["liala etr lios"],["NO"]],[["liala etr liala"],["NO"]],[["liala etr etr"],["NO"]],[["liala etr etra"],["NO"]],[["liala etr initis"],["NO"]],[["liala etr inites"],["NO"]],[["liala etra lios"],["NO"]],[["liala etra liala"],["NO"]],[["liala etra etr"],["NO"]],[["liala etra etra"],["NO"]],[["liala etra initis"],["NO"]],[["liala etra inites"],["YES"]],[["liala initis lios"],["NO"]],[["liala initis liala"],["NO"]],[["liala initis etr"],["NO"]],[["liala initis etra"],["NO"]],[["liala initis initis"],["NO"]],[["liala initis inites"],["NO"]],[["liala inites lios"],["NO"]],[["liala inites liala"],["NO"]],[["liala inites etr"],["NO"]],[["liala inites etra"],["NO"]],[["liala inites initis"],["NO"]],[["liala inites inites"],["NO"]],[["etr lios lios"],["NO"]],[["etr lios liala"],["NO"]],[["etr lios etr"],["NO"]],[["etr lios etra"],["NO"]],[["etr lios initis"],["NO"]],[["etr lios inites"],["NO"]],[["etr liala lios"],["NO"]],[["etr liala liala"],["NO"]],[["etr liala etr"],["NO"]],[["etr liala etra"],["NO"]],[["etr liala initis"],["NO"]],[["etr liala inites"],["NO"]],[["etr etr lios"],["NO"]],[["etr etr liala"],["NO"]],[["etr etr etr"],["NO"]],[["etr etr etra"],["NO"]],[["etr etr initis"],["NO"]],[["etr etr inites"],["NO"]],[["etr etra lios"],["NO"]],[["etr etra liala"],["NO"]],[["etr etra etr"],["NO"]],[["etr etra etra"],["NO"]],[["etr etra initis"],["NO"]],[["etr etra inites"],["NO"]],[["etr initis lios"],["NO"]],[["etr initis liala"],["NO"]],[["etr initis etr"],["NO"]],[["etr initis etra"],["NO"]],[["etr initis initis"],["YES"]],[["etr initis inites"],["NO"]],[["etr inites lios"],["NO"]],[["etr inites liala"],["NO"]],[["etr inites etr"],["NO"]],[["etr inites etra"],["NO"]],[["etr inites initis"],["NO"]],[["etr inites inites"],["NO"]],[["etra lios lios"],["NO"]],[["etra lios liala"],["NO"]],[["etra lios etr"],["NO"]],[["etra lios etra"],["NO"]],[["etra lios initis"],["NO"]],[["etra lios inites"],["NO"]],[["etra liala lios"],["NO"]],[["etra liala liala"],["NO"]],[["etra liala etr"],["NO"]],[["etra liala etra"],["NO"]],[["etra liala initis"],["NO"]],[["etra liala inites"],["NO"]],[["etra etr lios"],["NO"]],[["etra etr liala"],["NO"]],[["etra etr etr"],["NO"]],[["etra etr etra"],["NO"]],[["etra etr initis"],["NO"]],[["etra etr inites"],["NO"]],[["etra etra lios"],["NO"]],[["etra etra liala"],["NO"]],[["etra etra etr"],["NO"]],[["etra etra etra"],["NO"]],[["etra etra initis"],["NO"]],[["etra etra inites"],["NO"]],[["etra initis lios"],["NO"]],[["etra initis liala"],["NO"]],[["etra initis etr"],["NO"]],[["etra initis etra"],["NO"]],[["etra initis initis"],["NO"]],[["etra initis inites"],["NO"]],[["etra inites lios"],["NO"]],[["etra inites liala"],["NO"]],[["etra inites etr"],["NO"]],[["etra inites etra"],["NO"]],[["etra inites initis"],["NO"]],[["etra inites inites"],["YES"]],[["initis lios lios"],["NO"]],[["initis lios liala"],["NO"]],[["initis lios etr"],["NO"]],[["initis lios etra"],["NO"]],[["initis lios initis"],["NO"]],[["initis lios inites"],["NO"]],[["initis liala lios"],["NO"]],[["initis liala liala"],["NO"]],[["initis liala etr"],["NO"]],[["initis liala etra"],["NO"]],[["initis liala initis"],["NO"]],[["initis liala inites"],["NO"]],[["initis etr lios"],["NO"]],[["initis etr liala"],["NO"]],[["initis etr etr"],["NO"]],[["initis etr etra"],["NO"]],[["initis etr initis"],["NO"]],[["initis etr inites"],["NO"]],[["initis etra lios"],["NO"]],[["initis etra liala"],["NO"]],[["initis etra etr"],["NO"]],[["initis etra etra"],["NO"]],[["initis etra initis"],["NO"]],[["initis etra inites"],["NO"]],[["initis initis lios"],["NO"]],[["initis initis liala"],["NO"]],[["initis initis etr"],["NO"]],[["initis initis etra"],["NO"]],[["initis initis initis"],["NO"]],[["initis initis inites"],["NO"]],[["initis inites lios"],["NO"]],[["initis inites liala"],["NO"]],[["initis inites etr"],["NO"]],[["initis inites etra"],["NO"]],[["initis inites initis"],["NO"]],[["initis inites inites"],["NO"]],[["inites lios lios"],["NO"]],[["inites lios liala"],["NO"]],[["inites lios etr"],["NO"]],[["inites lios etra"],["NO"]],[["inites lios initis"],["NO"]],[["inites lios inites"],["NO"]],[["inites liala lios"],["NO"]],[["inites liala liala"],["NO"]],[["inites liala etr"],["NO"]],[["inites liala etra"],["NO"]],[["inites liala initis"],["NO"]],[["inites liala inites"],["NO"]],[["inites etr lios"],["NO"]],[["inites etr liala"],["NO"]],[["inites etr etr"],["NO"]],[["inites etr etra"],["NO"]],[["inites etr initis"],["NO"]],[["inites etr inites"],["NO"]],[["inites etra lios"],["NO"]],[["inites etra liala"],["NO"]],[["inites etra etr"],["NO"]],[["inites etra etra"],["NO"]],[["inites etra initis"],["NO"]],[["inites etra inites"],["NO"]],[["inites initis lios"],["NO"]],[["inites initis liala"],["NO"]],[["inites initis etr"],["NO"]],[["inites initis etra"],["NO"]],[["inites initis initis"],["NO"]],[["inites initis inites"],["NO"]],[["inites inites lios"],["NO"]],[["inites inites liala"],["NO"]],[["inites inites etr"],["NO"]],[["inites inites etra"],["NO"]],[["inites inites initis"],["NO"]],[["inites inites inites"],["NO"]]]}} +{"instance_id":"pseudo_to_code_2k_74","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nin the function to_num which takes a string s and returns an integer\n if size of s is greater than or equal to 4\n if s.substr(s.size() - 4) = \"lios\" then return 0\n end of the block\n if size of s >= 5\n if s.substr(s.size() - 5) = \"liala\" then return 1\n end of the block\n if size of s >= 3\n if s.substr(s.size() - 3) = \"etr\" then return 2\n end of the block\n if size of s >= 4\n if s.substr(s.size() - 4) = \"etra\" then return 3\n end of the block\n if size of s >=6\n if s.substr(s.size() - 6) = \"initis\" then return 4\n end of the block\n if size of s >= 6\n if s.substr(s.size() - 6) = \"inites\" then return 5\n end of the block\n return -1\nend of the block\nin the function islegal which takes a integer vector ans and returns a boolean\n if ans[0] % 2 is equal to 0\n for i=1 to size of ans exclusive\n if ans[i] % 2 is not equal to 0 then return false\n else do the following\n for i=1 to size of ans exclusive\n if ans[i] is equal to -1 then return false\n if ans[i] % 2 = 0 then return false\n end of the block\n end of the block\n return true\nend of the block\nin the function isok which takes an integer vector ans and returns a boolean\n create a boolean f = false\n for i=0 to size of ans exclusive\n if ans[i]\/2 is equal to 0 and f is false\n set f to true\n continue\n end of the block\n if f is false\n if ans[i]\/2 is not equal to 0 then return false\n else do the following\n if ans[i]\/2 is not equal to 2 then return false\n end of the block\n end of the block\n if f is false then return false\n return true\nend of the block\ndefine the main function\n c=array of chars of size 100010\n s= string\n res= vector of string\n ans = vector of integer\n create an integer pos=0\n read c\n set s=c\n for i=0 to size of s exclusive\n if s[i] is empty\n add s.substr(pos, i - pos) to the end of res\n set pos to i+1\n end of the block\n add s.substr(pos) to end of res\n for i=0 to size of res exclusive add to_num(res[i] to end of ans\n if size of ans is equal to 1 and asn[0] >=0\n print YES\n return to indicate successful execution\n end of the block\n if islegal(ans) is true\n if isok(ans)is true\n print YES\n else do the following\n print NO\n else do the following\n print NO\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int to_num(string s) {\n if (s.size() >= 4) {\n if (s.substr(s.size() - 4) == \"lios\") return 0;\n }\n if (s.size() >= 5) {\n if (s.substr(s.size() - 5) == \"liala\") return 1;\n }\n if (s.size() >= 3) {\n if (s.substr(s.size() - 3) == \"etr\") return 2;\n }\n if (s.size() >= 4) {\n if (s.substr(s.size() - 4) == \"etra\") return 3;\n }\n if (s.size() >= 6) {\n if (s.substr(s.size() - 6) == \"initis\") return 4;\n }\n if (s.size() >= 6) {\n if (s.substr(s.size() - 6) == \"inites\") return 5;\n }\n return -1;\n}\nbool islegal(vector ans) {\n if (ans[0] % 2 == 0) {\n for (int i = 1; i < ans.size(); i++)\n if (ans[i] % 2 != 0) return false;\n } else {\n for (int i = 0; i < ans.size(); i++) {\n if (ans[i] == -1) return false;\n if (ans[i] % 2 == 0) return false;\n }\n }\n return true;\n}\nbool isok(vector ans) {\n bool f = false;\n for (int i = 0; i < ans.size(); i++) {\n if ((ans[i] \/ 2) == 1 && !f) {\n f = true;\n continue;\n }\n if (!f) {\n if (ans[i] \/ 2 != 0) return false;\n } else {\n if (ans[i] \/ 2 != 2) return false;\n }\n }\n if (!f) { return false; }\n return true;\n}\nint main() {\n char c[100010];\n string s;\n vector res;\n vector ans;\n int pos = 0;\n gets(c);\n s = c;\n for (int i = 0; i < s.size(); i++)\n if (s[i] == ' ') {\n res.push_back(s.substr(pos, i - pos));\n pos = i + 1;\n }\n res.push_back(s.substr(pos));\n for (int i = 0; i < res.size(); i++) ans.push_back(to_num(res[i]));\n if (ans.size() == 1 && ans[0] >= 0) {\n puts(\"YES\");\n return 0;\n }\n if (islegal(ans)) {\n if (isok(ans))\n puts(\"YES\");\n else\n puts(\"NO\");\n } else\n puts(\"NO\");\n return 0;\n}","item":{"problem_id":"113A","pseudocode":"in the function to_num which takes a string s and returns an integer\n if size of s is greater than or equal to 4\n if s.substr(s.size() - 4) = \"lios\" then return 0\n end of the block\n if size of s >= 5\n if s.substr(s.size() - 5) = \"liala\" then return 1\n end of the block\n if size of s >= 3\n if s.substr(s.size() - 3) = \"etr\" then return 2\n end of the block\n if size of s >= 4\n if s.substr(s.size() - 4) = \"etra\" then return 3\n end of the block\n if size of s >=6\n if s.substr(s.size() - 6) = \"initis\" then return 4\n end of the block\n if size of s >= 6\n if s.substr(s.size() - 6) = \"inites\" then return 5\n end of the block\n return -1\nend of the block\nin the function islegal which takes a integer vector ans and returns a boolean\n if ans[0] % 2 is equal to 0\n for i=1 to size of ans exclusive\n if ans[i] % 2 is not equal to 0 then return false\n else do the following\n for i=1 to size of ans exclusive\n if ans[i] is equal to -1 then return false\n if ans[i] % 2 = 0 then return false\n end of the block\n end of the block\n return true\nend of the block\nin the function isok which takes an integer vector ans and returns a boolean\n create a boolean f = false\n for i=0 to size of ans exclusive\n if ans[i]\/2 is equal to 0 and f is false\n set f to true\n continue\n end of the block\n if f is false\n if ans[i]\/2 is not equal to 0 then return false\n else do the following\n if ans[i]\/2 is not equal to 2 then return false\n end of the block\n end of the block\n if f is false then return false\n return true\nend of the block\ndefine the main function\n c=array of chars of size 100010\n s= string\n res= vector of string\n ans = vector of integer\n create an integer pos=0\n read c\n set s=c\n for i=0 to size of s exclusive\n if s[i] is empty\n add s.substr(pos, i - pos) to the end of res\n set pos to i+1\n end of the block\n add s.substr(pos) to end of res\n for i=0 to size of res exclusive add to_num(res[i] to end of ans\n if size of ans is equal to 1 and asn[0] >=0\n print YES\n return to indicate successful execution\n end of the block\n if islegal(ans) is true\n if isok(ans)is true\n print YES\n else do the following\n print NO\n else do the following\n print NO\n return to indicate successful execution\nend of the block","testcases":[[["petr"],["YES"]],[["etis atis animatis etis atis amatis"],["NO"]],[["nataliala kataliala vetra feinites"],["YES"]],[["qweasbvflios"],["YES"]],[["lios lios petr initis qwe"],["NO"]],[["lios initis"],["NO"]],[["petr initis lios"],["NO"]],[["petra petra petra"],["NO"]],[["in"],["NO"]],[["liala petra initis"],["NO"]],[["liala petra inites"],["YES"]],[["liala initis"],["NO"]],[["liala petra petr inites"],["NO"]],[["liala petr inites"],["NO"]],[["llilitos"],["NO"]],[["umeszdawsvgkjhlqwzentsphxqhdungbylhnikwviuhccbstghhxlmvcjznnkjqkugsdysjbedwpmsmxmgxlrlxctnebtbwrsvgjktkrosffwymovxvsgfmmqwfflpvbumozikroxrdgwjrnstngstxbiyyuxehrhviteptedlmyetr"],["YES"]],[["i i i i i i i i i i i i i i i a a a a a a v v v v v v v v v v v"],["NO"]],[["fbvzqonvdlqdanwliolaqfj sbauorbinites xkbfnfinitespjy phbexglblzpobtqpisyijycmtliola aosinites lbpjiwcjoqyuhglthloiniteswb mjtxhoofohzzgefvhsywojcuxtetxmojrlktodhbgyrkeejgjzxkzyvrxwmyaqkeoqnvusnlrsfffrzeoqjdfumolhksqkrtzwhnforgpenziokrxlnhcapbbupctlmuetrani pigxerwetupjbkvlmgnjhdfjliolanz tqhaidxbqmdaeincxjuliola"],["NO"]],[["mfrmqetr"],["YES"]],[["hnwvfllholxfialiola cknjtxpliola daliola gqfapnhmmworliola qhetra qrisbexsrefcwzoxqwxrevinites wwldqkqhvrgwplqinites nqdpoauitczttxoinites fgbmdfpxkhahkinites"],["NO"]],[["kcymcpgqdxkudadewddualeemhixhsdazudnjdmuvxvrlrbrpsdpxpagmrogplltnifrtomdtahxwadguvetxaqkvsvnoyhowirnluhmyewzapirnpfdisvhtbenxmfezahqoflkjrfqjubwdfktnpeirodwubftzlcczzavfiooihzvnqincndisudihvbcaxptrwovekmhiiwsgzgbxydvuldlnktxtltrlajjzietkxbnhetra"],["YES"]],[["dosiydnwxemojaavfdvlwsyhzqywqjutovygtlcleklhybczhjqfzxwdmlwqwcqqyfjkzhsizlmdarrfronxqkcknwpkvhdlgatdyjisjoopvngpjggldxjfxaauoxmqirkuphydyweoixftstlozaoywnxgriscudwlokncbmaebpssccmmmfjennyjaryqlzjknnklqketra"],["YES"]],[["etretra linites"],["YES"]],[["petretra petr"],["NO"]],[["lialalios petraveryfunnypetr"],["YES"]],[["petropetrapetr petra"],["NO"]],[["lios petrnonono"],["NO"]],[["lios petr initisandinitisandliala petrainitis"],["NO"]],[["petro"],["NO"]],[["petr initesinitis"],["YES"]],[["lios initis"],["NO"]],[["liala initespetra"],["YES"]],[["lios petrapetr"],["YES"]],[["initis petr"],["NO"]],[["lioslialapetrpetrainitisinitesliosliala initesinitislioslialapetrpetrainitisinitetra"],["YES"]],[["veryfunnyprefixpetr"],["YES"]],[["veryfunnyprefixpetra"],["YES"]],[["veryfunnyprefixinitis"],["YES"]],[["veryfunnyprefixinites"],["YES"]],[["veryfunnyprefixliala"],["YES"]],[["veryfunnyprefixlios"],["YES"]],[["veryfunnyprefixlialas"],["NO"]],[["veryfunnyprefixliala veryfunnyprefixpetretra"],["YES"]],[["veryfunnyprefixlios veryfunnyprefixinitisetr"],["YES"]],[["veryfunnyprefixlios aabbinitis"],["NO"]],[["veryfunnyprefixlios inites"],["NO"]],[["lios petr initis"],["YES"]],[["liala etra inites"],["YES"]],[["lios"],["YES"]],[["liala"],["YES"]],[["initis"],["YES"]],[["inites"],["YES"]],[["tes"],["NO"]],[["tr"],["NO"]],[["a"],["NO"]],[["lios lios"],["NO"]],[["lios"],["YES"]],[["liala"],["YES"]],[["petr"],["YES"]],[["petra"],["YES"]],[["pinitis"],["YES"]],[["pinites"],["YES"]],[["plios pliala"],["NO"]],[["plios petr"],["YES"]],[["plios petra"],["NO"]],[["plios plios"],["NO"]],[["plios initis"],["NO"]],[["plios pinites"],["NO"]],[["pliala plios"],["NO"]],[["pliala ppliala"],["NO"]],[["pliala petr"],["NO"]],[["pliala petra"],["YES"]],[["pliala pinitis"],["NO"]],[["pliala pinites"],["NO"]],[["petr plios"],["NO"]],[["petr pliala"],["NO"]],[["petr petr"],["NO"]],[["petr petra"],["NO"]],[["petr pinitis"],["YES"]],[["petr pinites"],["NO"]],[["petra lios"],["NO"]],[["petra liala"],["NO"]],[["petra petr"],["NO"]],[["petra petra"],["NO"]],[["petra initis"],["NO"]],[["petra inites"],["YES"]],[["initis lios"],["NO"]],[["initis liala"],["NO"]],[["initis petr"],["NO"]],[["initis petra"],["NO"]],[["initis initis"],["NO"]],[["initis inites"],["NO"]],[["inites lios"],["NO"]],[["inites liala"],["NO"]],[["inites petr"],["NO"]],[["inites petra"],["NO"]],[["inites initis"],["NO"]],[["inites inites"],["NO"]],[["lios lios lios"],["NO"]],[["lios lios liala"],["NO"]],[["lios lios etr"],["YES"]],[["lios lios etra"],["NO"]],[["lios lios initis"],["NO"]],[["lios lios inites"],["NO"]],[["lios liala lios"],["NO"]],[["lios liala liala"],["NO"]],[["lios liala etr"],["NO"]],[["lios liala etra"],["NO"]],[["lios liala initis"],["NO"]],[["lios liala inites"],["NO"]],[["lios etr lios"],["NO"]],[["lios etr liala"],["NO"]],[["lios etr etr"],["NO"]],[["lios etr etra"],["NO"]],[["lios etr initis"],["YES"]],[["lios etr inites"],["NO"]],[["lios etra lios"],["NO"]],[["lios etra liala"],["NO"]],[["lios etra etr"],["NO"]],[["lios etra etra"],["NO"]],[["lios etra initis"],["NO"]],[["lios etra inites"],["NO"]],[["lios initis lios"],["NO"]],[["lios initis liala"],["NO"]],[["lios initis etr"],["NO"]],[["lios initis etra"],["NO"]],[["lios initis initis"],["NO"]],[["lios initis inites"],["NO"]],[["lios inites lios"],["NO"]],[["lios inites liala"],["NO"]],[["lios inites etr"],["NO"]],[["lios inites etra"],["NO"]],[["lios inites initis"],["NO"]],[["lios inites inites"],["NO"]],[["liala lios lios"],["NO"]],[["liala lios liala"],["NO"]],[["liala lios etr"],["NO"]],[["liala lios etra"],["NO"]],[["liala lios initis"],["NO"]],[["liala lios inites"],["NO"]],[["liala liala lios"],["NO"]],[["liala liala liala"],["NO"]],[["liala liala etr"],["NO"]],[["liala liala etra"],["YES"]],[["liala liala initis"],["NO"]],[["liala liala inites"],["NO"]],[["liala etr lios"],["NO"]],[["liala etr liala"],["NO"]],[["liala etr etr"],["NO"]],[["liala etr etra"],["NO"]],[["liala etr initis"],["NO"]],[["liala etr inites"],["NO"]],[["liala etra lios"],["NO"]],[["liala etra liala"],["NO"]],[["liala etra etr"],["NO"]],[["liala etra etra"],["NO"]],[["liala etra initis"],["NO"]],[["liala etra inites"],["YES"]],[["liala initis lios"],["NO"]],[["liala initis liala"],["NO"]],[["liala initis etr"],["NO"]],[["liala initis etra"],["NO"]],[["liala initis initis"],["NO"]],[["liala initis inites"],["NO"]],[["liala inites lios"],["NO"]],[["liala inites liala"],["NO"]],[["liala inites etr"],["NO"]],[["liala inites etra"],["NO"]],[["liala inites initis"],["NO"]],[["liala inites inites"],["NO"]],[["etr lios lios"],["NO"]],[["etr lios liala"],["NO"]],[["etr lios etr"],["NO"]],[["etr lios etra"],["NO"]],[["etr lios initis"],["NO"]],[["etr lios inites"],["NO"]],[["etr liala lios"],["NO"]],[["etr liala liala"],["NO"]],[["etr liala etr"],["NO"]],[["etr liala etra"],["NO"]],[["etr liala initis"],["NO"]],[["etr liala inites"],["NO"]],[["etr etr lios"],["NO"]],[["etr etr liala"],["NO"]],[["etr etr etr"],["NO"]],[["etr etr etra"],["NO"]],[["etr etr initis"],["NO"]],[["etr etr inites"],["NO"]],[["etr etra lios"],["NO"]],[["etr etra liala"],["NO"]],[["etr etra etr"],["NO"]],[["etr etra etra"],["NO"]],[["etr etra initis"],["NO"]],[["etr etra inites"],["NO"]],[["etr initis lios"],["NO"]],[["etr initis liala"],["NO"]],[["etr initis etr"],["NO"]],[["etr initis etra"],["NO"]],[["etr initis initis"],["YES"]],[["etr initis inites"],["NO"]],[["etr inites lios"],["NO"]],[["etr inites liala"],["NO"]],[["etr inites etr"],["NO"]],[["etr inites etra"],["NO"]],[["etr inites initis"],["NO"]],[["etr inites inites"],["NO"]],[["etra lios lios"],["NO"]],[["etra lios liala"],["NO"]],[["etra lios etr"],["NO"]],[["etra lios etra"],["NO"]],[["etra lios initis"],["NO"]],[["etra lios inites"],["NO"]],[["etra liala lios"],["NO"]],[["etra liala liala"],["NO"]],[["etra liala etr"],["NO"]],[["etra liala etra"],["NO"]],[["etra liala initis"],["NO"]],[["etra liala inites"],["NO"]],[["etra etr lios"],["NO"]],[["etra etr liala"],["NO"]],[["etra etr etr"],["NO"]],[["etra etr etra"],["NO"]],[["etra etr initis"],["NO"]],[["etra etr inites"],["NO"]],[["etra etra lios"],["NO"]],[["etra etra liala"],["NO"]],[["etra etra etr"],["NO"]],[["etra etra etra"],["NO"]],[["etra etra initis"],["NO"]],[["etra etra inites"],["NO"]],[["etra initis lios"],["NO"]],[["etra initis liala"],["NO"]],[["etra initis etr"],["NO"]],[["etra initis etra"],["NO"]],[["etra initis initis"],["NO"]],[["etra initis inites"],["NO"]],[["etra inites lios"],["NO"]],[["etra inites liala"],["NO"]],[["etra inites etr"],["NO"]],[["etra inites etra"],["NO"]],[["etra inites initis"],["NO"]],[["etra inites inites"],["YES"]],[["initis lios lios"],["NO"]],[["initis lios liala"],["NO"]],[["initis lios etr"],["NO"]],[["initis lios etra"],["NO"]],[["initis lios initis"],["NO"]],[["initis lios inites"],["NO"]],[["initis liala lios"],["NO"]],[["initis liala liala"],["NO"]],[["initis liala etr"],["NO"]],[["initis liala etra"],["NO"]],[["initis liala initis"],["NO"]],[["initis liala inites"],["NO"]],[["initis etr lios"],["NO"]],[["initis etr liala"],["NO"]],[["initis etr etr"],["NO"]],[["initis etr etra"],["NO"]],[["initis etr initis"],["NO"]],[["initis etr inites"],["NO"]],[["initis etra lios"],["NO"]],[["initis etra liala"],["NO"]],[["initis etra etr"],["NO"]],[["initis etra etra"],["NO"]],[["initis etra initis"],["NO"]],[["initis etra inites"],["NO"]],[["initis initis lios"],["NO"]],[["initis initis liala"],["NO"]],[["initis initis etr"],["NO"]],[["initis initis etra"],["NO"]],[["initis initis initis"],["NO"]],[["initis initis inites"],["NO"]],[["initis inites lios"],["NO"]],[["initis inites liala"],["NO"]],[["initis inites etr"],["NO"]],[["initis inites etra"],["NO"]],[["initis inites initis"],["NO"]],[["initis inites inites"],["NO"]],[["inites lios lios"],["NO"]],[["inites lios liala"],["NO"]],[["inites lios etr"],["NO"]],[["inites lios etra"],["NO"]],[["inites lios initis"],["NO"]],[["inites lios inites"],["NO"]],[["inites liala lios"],["NO"]],[["inites liala liala"],["NO"]],[["inites liala etr"],["NO"]],[["inites liala etra"],["NO"]],[["inites liala initis"],["NO"]],[["inites liala inites"],["NO"]],[["inites etr lios"],["NO"]],[["inites etr liala"],["NO"]],[["inites etr etr"],["NO"]],[["inites etr etra"],["NO"]],[["inites etr initis"],["NO"]],[["inites etr inites"],["NO"]],[["inites etra lios"],["NO"]],[["inites etra liala"],["NO"]],[["inites etra etr"],["NO"]],[["inites etra etra"],["NO"]],[["inites etra initis"],["NO"]],[["inites etra inites"],["NO"]],[["inites initis lios"],["NO"]],[["inites initis liala"],["NO"]],[["inites initis etr"],["NO"]],[["inites initis etra"],["NO"]],[["inites initis initis"],["NO"]],[["inites initis inites"],["NO"]],[["inites inites lios"],["NO"]],[["inites inites liala"],["NO"]],[["inites inites etr"],["NO"]],[["inites inites etra"],["NO"]],[["inites inites initis"],["NO"]],[["inites inites inites"],["NO"]]]}} +{"instance_id":"pseudo_to_code_2k_75","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nin the function to_num which takes a string s and returns an integer\n if size of s is greater than or equal to 4\n if s.substr(s.size() - 4) = \"lios\" then return 0\n end of the block\n if size of s >= 5\n if s.substr(s.size() - 5) = \"liala\" then return 1\n end of the block\n if size of s >= 3\n if s.substr(s.size() - 3) = \"etr\" then return 2\n end of the block\n if size of s >= 4\n if s.substr(s.size() - 4) = \"etra\" then return 3\n end of the block\n if size of s >=6\n if s.substr(s.size() - 6) = \"initis\" then return 4\n end of the block\n if size of s >= 6\n if s.substr(s.size() - 6) = \"inites\" then return 5\n end of the block\n return -1\nend of the block\nin the function islegal which takes a integer vector ans and returns a boolean\n if ans[0] % 2 is equal to 0\n for i=1 to size of ans exclusive\n if ans[i] % 2 is not equal to 0 then return false\n else do the following\n for i=1 to size of ans exclusive\n if ans[i] is equal to -1 then return false\n if ans[i] % 2 = 0 then return false\n end of the block\n end of the block\n return true\nend of the block\nin the function isok which takes an integer vector ans and returns a boolean\n create a boolean f = false\n for i=0 to size of ans exclusive\n if ans[i]\/2 is equal to 0 and f is false\n set f to true\n continue\n end of the block\n if f is false\n if ans[i]\/2 is not equal to 0 then return false\n else do the following\n if ans[i]\/2 is not equal to 2 then return false\n end of the block\n end of the block\n if f is false then return false\n return true\nend of the block\ndefine the main function\n c=array of chars of size 100010\n s= string\n res= vector of string\n ans = vector of integer\n create an integer pos=0\n read c\n set s=c\n for i=0 to size of s exclusive\n if s[i] is empty\n add s.substr(pos, i - pos) to the end of res\n set pos to i+1\n end of the block\n add s.substr(pos) to end of res\n for i=0 to size of res exclusive add to_num(res[i] to end of ans\n if size of ans is equal to 1 and asn[0] >=0\n print YES\n return to indicate successful execution\n end of the block\n if islegal(ans) is true\n if isok(ans)is true\n print YES\n else do the following\n print NO\n else do the following\n print NO\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int to_num(string s) {\n if (s.size() >= 4) {\n if (s.substr(s.size() - 4) == \"lios\") return 0;\n }\n if (s.size() >= 5) {\n if (s.substr(s.size() - 5) == \"liala\") return 1;\n }\n if (s.size() >= 3) {\n if (s.substr(s.size() - 3) == \"etr\") return 2;\n }\n if (s.size() >= 4) {\n if (s.substr(s.size() - 4) == \"etra\") return 3;\n }\n if (s.size() >= 6) {\n if (s.substr(s.size() - 6) == \"initis\") return 4;\n }\n if (s.size() >= 6) {\n if (s.substr(s.size() - 6) == \"inites\") return 5;\n }\n return -1;\n}\nbool islegal(vector ans) {\n if (ans[0] % 2 == 0) {\n for (int i = 1; i < ans.size(); i++)\n if (ans[i] % 2 != 0) return false;\n } else {\n for (int i = 0; i < ans.size(); i++) {\n if (ans[i] == -1) return false;\n if (ans[i] % 2 == 0) return false;\n }\n }\n return true;\n}\nbool isok(vector ans) {\n bool f = false;\n for (int i = 0; i < ans.size(); i++) {\n if ((ans[i] \/ 2) == 1 && !f) {\n f = true;\n continue;\n }\n if (!f) {\n if (ans[i] \/ 2 != 0) return false;\n } else {\n if (ans[i] \/ 2 != 2) return false;\n }\n }\n if (!f) { return false; }\n return true;\n}\nint main() {\n char c[100010];\n string s;\n vector res;\n vector ans;\n int pos = 0;\n gets(c);\n s = c;\n for (int i = 0; i < s.size(); i++)\n if (s[i] == ' ') {\n res.push_back(s.substr(pos, i - pos));\n pos = i + 1;\n }\n res.push_back(s.substr(pos));\n for (int i = 0; i < res.size(); i++) ans.push_back(to_num(res[i]));\n if (ans.size() == 1 && ans[0] >= 0) {\n puts(\"YES\");\n return 0;\n }\n if (islegal(ans)) {\n if (isok(ans))\n puts(\"YES\");\n else\n puts(\"NO\");\n } else\n puts(\"NO\");\n return 0;\n}","item":{"problem_id":"113A","pseudocode":"in the function to_num which takes a string s and returns an integer\n if size of s is greater than or equal to 4\n if s.substr(s.size() - 4) = \"lios\" then return 0\n end of the block\n if size of s >= 5\n if s.substr(s.size() - 5) = \"liala\" then return 1\n end of the block\n if size of s >= 3\n if s.substr(s.size() - 3) = \"etr\" then return 2\n end of the block\n if size of s >= 4\n if s.substr(s.size() - 4) = \"etra\" then return 3\n end of the block\n if size of s >=6\n if s.substr(s.size() - 6) = \"initis\" then return 4\n end of the block\n if size of s >= 6\n if s.substr(s.size() - 6) = \"inites\" then return 5\n end of the block\n return -1\nend of the block\nin the function islegal which takes a integer vector ans and returns a boolean\n if ans[0] % 2 is equal to 0\n for i=1 to size of ans exclusive\n if ans[i] % 2 is not equal to 0 then return false\n else do the following\n for i=1 to size of ans exclusive\n if ans[i] is equal to -1 then return false\n if ans[i] % 2 = 0 then return false\n end of the block\n end of the block\n return true\nend of the block\nin the function isok which takes an integer vector ans and returns a boolean\n create a boolean f = false\n for i=0 to size of ans exclusive\n if ans[i]\/2 is equal to 0 and f is false\n set f to true\n continue\n end of the block\n if f is false\n if ans[i]\/2 is not equal to 0 then return false\n else do the following\n if ans[i]\/2 is not equal to 2 then return false\n end of the block\n end of the block\n if f is false then return false\n return true\nend of the block\ndefine the main function\n c=array of chars of size 100010\n s= string\n res= vector of string\n ans = vector of integer\n create an integer pos=0\n read c\n set s=c\n for i=0 to size of s exclusive\n if s[i] is empty\n add s.substr(pos, i - pos) to the end of res\n set pos to i+1\n end of the block\n add s.substr(pos) to end of res\n for i=0 to size of res exclusive add to_num(res[i] to end of ans\n if size of ans is equal to 1 and asn[0] >=0\n print YES\n return to indicate successful execution\n end of the block\n if islegal(ans) is true\n if isok(ans)is true\n print YES\n else do the following\n print NO\n else do the following\n print NO\n return to indicate successful execution\nend of the block","testcases":[[["petr"],["YES"]],[["etis atis animatis etis atis amatis"],["NO"]],[["nataliala kataliala vetra feinites"],["YES"]],[["qweasbvflios"],["YES"]],[["lios lios petr initis qwe"],["NO"]],[["lios initis"],["NO"]],[["petr initis lios"],["NO"]],[["petra petra petra"],["NO"]],[["in"],["NO"]],[["liala petra initis"],["NO"]],[["liala petra inites"],["YES"]],[["liala initis"],["NO"]],[["liala petra petr inites"],["NO"]],[["liala petr inites"],["NO"]],[["llilitos"],["NO"]],[["umeszdawsvgkjhlqwzentsphxqhdungbylhnikwviuhccbstghhxlmvcjznnkjqkugsdysjbedwpmsmxmgxlrlxctnebtbwrsvgjktkrosffwymovxvsgfmmqwfflpvbumozikroxrdgwjrnstngstxbiyyuxehrhviteptedlmyetr"],["YES"]],[["i i i i i i i i i i i i i i i a a a a a a v v v v v v v v v v v"],["NO"]],[["fbvzqonvdlqdanwliolaqfj sbauorbinites xkbfnfinitespjy phbexglblzpobtqpisyijycmtliola aosinites lbpjiwcjoqyuhglthloiniteswb mjtxhoofohzzgefvhsywojcuxtetxmojrlktodhbgyrkeejgjzxkzyvrxwmyaqkeoqnvusnlrsfffrzeoqjdfumolhksqkrtzwhnforgpenziokrxlnhcapbbupctlmuetrani pigxerwetupjbkvlmgnjhdfjliolanz tqhaidxbqmdaeincxjuliola"],["NO"]],[["mfrmqetr"],["YES"]],[["hnwvfllholxfialiola cknjtxpliola daliola gqfapnhmmworliola qhetra qrisbexsrefcwzoxqwxrevinites wwldqkqhvrgwplqinites nqdpoauitczttxoinites fgbmdfpxkhahkinites"],["NO"]],[["kcymcpgqdxkudadewddualeemhixhsdazudnjdmuvxvrlrbrpsdpxpagmrogplltnifrtomdtahxwadguvetxaqkvsvnoyhowirnluhmyewzapirnpfdisvhtbenxmfezahqoflkjrfqjubwdfktnpeirodwubftzlcczzavfiooihzvnqincndisudihvbcaxptrwovekmhiiwsgzgbxydvuldlnktxtltrlajjzietkxbnhetra"],["YES"]],[["dosiydnwxemojaavfdvlwsyhzqywqjutovygtlcleklhybczhjqfzxwdmlwqwcqqyfjkzhsizlmdarrfronxqkcknwpkvhdlgatdyjisjoopvngpjggldxjfxaauoxmqirkuphydyweoixftstlozaoywnxgriscudwlokncbmaebpssccmmmfjennyjaryqlzjknnklqketra"],["YES"]],[["etretra linites"],["YES"]],[["petretra petr"],["NO"]],[["lialalios petraveryfunnypetr"],["YES"]],[["petropetrapetr petra"],["NO"]],[["lios petrnonono"],["NO"]],[["lios petr initisandinitisandliala petrainitis"],["NO"]],[["petro"],["NO"]],[["petr initesinitis"],["YES"]],[["lios initis"],["NO"]],[["liala initespetra"],["YES"]],[["lios petrapetr"],["YES"]],[["initis petr"],["NO"]],[["lioslialapetrpetrainitisinitesliosliala initesinitislioslialapetrpetrainitisinitetra"],["YES"]],[["veryfunnyprefixpetr"],["YES"]],[["veryfunnyprefixpetra"],["YES"]],[["veryfunnyprefixinitis"],["YES"]],[["veryfunnyprefixinites"],["YES"]],[["veryfunnyprefixliala"],["YES"]],[["veryfunnyprefixlios"],["YES"]],[["veryfunnyprefixlialas"],["NO"]],[["veryfunnyprefixliala veryfunnyprefixpetretra"],["YES"]],[["veryfunnyprefixlios veryfunnyprefixinitisetr"],["YES"]],[["veryfunnyprefixlios aabbinitis"],["NO"]],[["veryfunnyprefixlios inites"],["NO"]],[["lios petr initis"],["YES"]],[["liala etra inites"],["YES"]],[["lios"],["YES"]],[["liala"],["YES"]],[["initis"],["YES"]],[["inites"],["YES"]],[["tes"],["NO"]],[["tr"],["NO"]],[["a"],["NO"]],[["lios lios"],["NO"]],[["lios"],["YES"]],[["liala"],["YES"]],[["petr"],["YES"]],[["petra"],["YES"]],[["pinitis"],["YES"]],[["pinites"],["YES"]],[["plios pliala"],["NO"]],[["plios petr"],["YES"]],[["plios petra"],["NO"]],[["plios plios"],["NO"]],[["plios initis"],["NO"]],[["plios pinites"],["NO"]],[["pliala plios"],["NO"]],[["pliala ppliala"],["NO"]],[["pliala petr"],["NO"]],[["pliala petra"],["YES"]],[["pliala pinitis"],["NO"]],[["pliala pinites"],["NO"]],[["petr plios"],["NO"]],[["petr pliala"],["NO"]],[["petr petr"],["NO"]],[["petr petra"],["NO"]],[["petr pinitis"],["YES"]],[["petr pinites"],["NO"]],[["petra lios"],["NO"]],[["petra liala"],["NO"]],[["petra petr"],["NO"]],[["petra petra"],["NO"]],[["petra initis"],["NO"]],[["petra inites"],["YES"]],[["initis lios"],["NO"]],[["initis liala"],["NO"]],[["initis petr"],["NO"]],[["initis petra"],["NO"]],[["initis initis"],["NO"]],[["initis inites"],["NO"]],[["inites lios"],["NO"]],[["inites liala"],["NO"]],[["inites petr"],["NO"]],[["inites petra"],["NO"]],[["inites initis"],["NO"]],[["inites inites"],["NO"]],[["lios lios lios"],["NO"]],[["lios lios liala"],["NO"]],[["lios lios etr"],["YES"]],[["lios lios etra"],["NO"]],[["lios lios initis"],["NO"]],[["lios lios inites"],["NO"]],[["lios liala lios"],["NO"]],[["lios liala liala"],["NO"]],[["lios liala etr"],["NO"]],[["lios liala etra"],["NO"]],[["lios liala initis"],["NO"]],[["lios liala inites"],["NO"]],[["lios etr lios"],["NO"]],[["lios etr liala"],["NO"]],[["lios etr etr"],["NO"]],[["lios etr etra"],["NO"]],[["lios etr initis"],["YES"]],[["lios etr inites"],["NO"]],[["lios etra lios"],["NO"]],[["lios etra liala"],["NO"]],[["lios etra etr"],["NO"]],[["lios etra etra"],["NO"]],[["lios etra initis"],["NO"]],[["lios etra inites"],["NO"]],[["lios initis lios"],["NO"]],[["lios initis liala"],["NO"]],[["lios initis etr"],["NO"]],[["lios initis etra"],["NO"]],[["lios initis initis"],["NO"]],[["lios initis inites"],["NO"]],[["lios inites lios"],["NO"]],[["lios inites liala"],["NO"]],[["lios inites etr"],["NO"]],[["lios inites etra"],["NO"]],[["lios inites initis"],["NO"]],[["lios inites inites"],["NO"]],[["liala lios lios"],["NO"]],[["liala lios liala"],["NO"]],[["liala lios etr"],["NO"]],[["liala lios etra"],["NO"]],[["liala lios initis"],["NO"]],[["liala lios inites"],["NO"]],[["liala liala lios"],["NO"]],[["liala liala liala"],["NO"]],[["liala liala etr"],["NO"]],[["liala liala etra"],["YES"]],[["liala liala initis"],["NO"]],[["liala liala inites"],["NO"]],[["liala etr lios"],["NO"]],[["liala etr liala"],["NO"]],[["liala etr etr"],["NO"]],[["liala etr etra"],["NO"]],[["liala etr initis"],["NO"]],[["liala etr inites"],["NO"]],[["liala etra lios"],["NO"]],[["liala etra liala"],["NO"]],[["liala etra etr"],["NO"]],[["liala etra etra"],["NO"]],[["liala etra initis"],["NO"]],[["liala etra inites"],["YES"]],[["liala initis lios"],["NO"]],[["liala initis liala"],["NO"]],[["liala initis etr"],["NO"]],[["liala initis etra"],["NO"]],[["liala initis initis"],["NO"]],[["liala initis inites"],["NO"]],[["liala inites lios"],["NO"]],[["liala inites liala"],["NO"]],[["liala inites etr"],["NO"]],[["liala inites etra"],["NO"]],[["liala inites initis"],["NO"]],[["liala inites inites"],["NO"]],[["etr lios lios"],["NO"]],[["etr lios liala"],["NO"]],[["etr lios etr"],["NO"]],[["etr lios etra"],["NO"]],[["etr lios initis"],["NO"]],[["etr lios inites"],["NO"]],[["etr liala lios"],["NO"]],[["etr liala liala"],["NO"]],[["etr liala etr"],["NO"]],[["etr liala etra"],["NO"]],[["etr liala initis"],["NO"]],[["etr liala inites"],["NO"]],[["etr etr lios"],["NO"]],[["etr etr liala"],["NO"]],[["etr etr etr"],["NO"]],[["etr etr etra"],["NO"]],[["etr etr initis"],["NO"]],[["etr etr inites"],["NO"]],[["etr etra lios"],["NO"]],[["etr etra liala"],["NO"]],[["etr etra etr"],["NO"]],[["etr etra etra"],["NO"]],[["etr etra initis"],["NO"]],[["etr etra inites"],["NO"]],[["etr initis lios"],["NO"]],[["etr initis liala"],["NO"]],[["etr initis etr"],["NO"]],[["etr initis etra"],["NO"]],[["etr initis initis"],["YES"]],[["etr initis inites"],["NO"]],[["etr inites lios"],["NO"]],[["etr inites liala"],["NO"]],[["etr inites etr"],["NO"]],[["etr inites etra"],["NO"]],[["etr inites initis"],["NO"]],[["etr inites inites"],["NO"]],[["etra lios lios"],["NO"]],[["etra lios liala"],["NO"]],[["etra lios etr"],["NO"]],[["etra lios etra"],["NO"]],[["etra lios initis"],["NO"]],[["etra lios inites"],["NO"]],[["etra liala lios"],["NO"]],[["etra liala liala"],["NO"]],[["etra liala etr"],["NO"]],[["etra liala etra"],["NO"]],[["etra liala initis"],["NO"]],[["etra liala inites"],["NO"]],[["etra etr lios"],["NO"]],[["etra etr liala"],["NO"]],[["etra etr etr"],["NO"]],[["etra etr etra"],["NO"]],[["etra etr initis"],["NO"]],[["etra etr inites"],["NO"]],[["etra etra lios"],["NO"]],[["etra etra liala"],["NO"]],[["etra etra etr"],["NO"]],[["etra etra etra"],["NO"]],[["etra etra initis"],["NO"]],[["etra etra inites"],["NO"]],[["etra initis lios"],["NO"]],[["etra initis liala"],["NO"]],[["etra initis etr"],["NO"]],[["etra initis etra"],["NO"]],[["etra initis initis"],["NO"]],[["etra initis inites"],["NO"]],[["etra inites lios"],["NO"]],[["etra inites liala"],["NO"]],[["etra inites etr"],["NO"]],[["etra inites etra"],["NO"]],[["etra inites initis"],["NO"]],[["etra inites inites"],["YES"]],[["initis lios lios"],["NO"]],[["initis lios liala"],["NO"]],[["initis lios etr"],["NO"]],[["initis lios etra"],["NO"]],[["initis lios initis"],["NO"]],[["initis lios inites"],["NO"]],[["initis liala lios"],["NO"]],[["initis liala liala"],["NO"]],[["initis liala etr"],["NO"]],[["initis liala etra"],["NO"]],[["initis liala initis"],["NO"]],[["initis liala inites"],["NO"]],[["initis etr lios"],["NO"]],[["initis etr liala"],["NO"]],[["initis etr etr"],["NO"]],[["initis etr etra"],["NO"]],[["initis etr initis"],["NO"]],[["initis etr inites"],["NO"]],[["initis etra lios"],["NO"]],[["initis etra liala"],["NO"]],[["initis etra etr"],["NO"]],[["initis etra etra"],["NO"]],[["initis etra initis"],["NO"]],[["initis etra inites"],["NO"]],[["initis initis lios"],["NO"]],[["initis initis liala"],["NO"]],[["initis initis etr"],["NO"]],[["initis initis etra"],["NO"]],[["initis initis initis"],["NO"]],[["initis initis inites"],["NO"]],[["initis inites lios"],["NO"]],[["initis inites liala"],["NO"]],[["initis inites etr"],["NO"]],[["initis inites etra"],["NO"]],[["initis inites initis"],["NO"]],[["initis inites inites"],["NO"]],[["inites lios lios"],["NO"]],[["inites lios liala"],["NO"]],[["inites lios etr"],["NO"]],[["inites lios etra"],["NO"]],[["inites lios initis"],["NO"]],[["inites lios inites"],["NO"]],[["inites liala lios"],["NO"]],[["inites liala liala"],["NO"]],[["inites liala etr"],["NO"]],[["inites liala etra"],["NO"]],[["inites liala initis"],["NO"]],[["inites liala inites"],["NO"]],[["inites etr lios"],["NO"]],[["inites etr liala"],["NO"]],[["inites etr etr"],["NO"]],[["inites etr etra"],["NO"]],[["inites etr initis"],["NO"]],[["inites etr inites"],["NO"]],[["inites etra lios"],["NO"]],[["inites etra liala"],["NO"]],[["inites etra etr"],["NO"]],[["inites etra etra"],["NO"]],[["inites etra initis"],["NO"]],[["inites etra inites"],["NO"]],[["inites initis lios"],["NO"]],[["inites initis liala"],["NO"]],[["inites initis etr"],["NO"]],[["inites initis etra"],["NO"]],[["inites initis initis"],["NO"]],[["inites initis inites"],["NO"]],[["inites inites lios"],["NO"]],[["inites inites liala"],["NO"]],[["inites inites etr"],["NO"]],[["inites inites etra"],["NO"]],[["inites inites initis"],["NO"]],[["inites inites inites"],["NO"]]]}} +{"instance_id":"pseudo_to_code_2k_76","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nip, ip2 and n are ints with ip and ip2 = 0\ndeclare vector of integers called v\ns is a new array of characters with 100010 elements\nin the function next_token that returns boolean\n set the value of ip to ip2\n while ip < n and (s[ip] < 'a' or s[ip] > 'z')\n if ip is equal to n, return false\n change ip2 to ip\n while ip2 < n and s[ip2] >= 'a' and s[ip2] <= 'z'\n return true\nend of the block\ndeclare character z\nfunction get_type that returns integer\n define new integer len with value ip2-ip\n change z to s[ip2]\n assign the new value = 0 to s[ip2]\n if s + ip + len - 4 matches \"lios\", return 0\n if result of s + ip + len - 5 = \"liala\" return 1\n if s + ip + len - 3 matches \"etr\" return 10\n if strcmp(s + ip + len - 4,\"etra\") returns 0, return 11\n if comparison of s + ip + len - 6 with \"initis\" returns 0, return 20\n return 21 if s + ip + len - 6 matches \"inites\"\n return -1\nend of the block\nboolean function solve\n in a for loop, change i from 0 to length of v exclusive\n if v[i] is equal to -1, return false\n return true if length of v = 1\n start for loop from i = 0 to length of v exclusive incrementing i\n in a for loop, change j from 0 to i exclusive\n return false if v[i] % 10 != v[j] % 10\n start for loop from i = 0 to length of v - 1 exclusive incrementing i\n if v[i] is greater than v[i + 1], return false\n create new integer cnt = 0\n increment i in a loop from i = 0 to length of v exclusive\n if v[i] \/ 10 = 1, increment cnt\n if cnt is equal to 1\n return true\n else\n return false\nend of the block\ndefine the main function\n store input into s\n change n to length of s\n while next_token() returns true\n push new value = the result of get_type() into v\n change s[ip2] to z\n end of the block\n if call to solve() returned true\n print \"YES\"\n else\n print \"NO\" to standard output\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int ip = 0, ip2 = 0, n;\nvector v;\nchar s[100010];\nbool next_token() {\n ip = ip2;\n while (ip < n && (s[ip] < 'a' || s[ip] > 'z')) ip++;\n if (ip == n) return false;\n ip2 = ip;\n while (ip2 < n && s[ip2] >= 'a' && s[ip2] <= 'z') ip2++;\n return true;\n}\nchar z;\nint get_type() {\n int len = ip2 - ip;\n z = s[ip2];\n s[ip2] = 0;\n if (strcmp(s + ip + len - 4, \"lios\") == 0) return 0;\n if (strcmp(s + ip + len - 5, \"liala\") == 0) return 1;\n if (strcmp(s + ip + len - 3, \"etr\") == 0) return 10;\n if (strcmp(s + ip + len - 4, \"etra\") == 0) return 11;\n if (strcmp(s + ip + len - 6, \"initis\") == 0) return 20;\n if (strcmp(s + ip + len - 6, \"inites\") == 0) return 21;\n return -1;\n}\nbool solve() {\n for (int i = 0; i < v.size(); i++)\n if (v[i] == -1) return false;\n if (v.size() == 1) return true;\n for (int i = 0; i < v.size(); i++)\n for (int j = 0; j < i; j++)\n if (v[i] % 10 != v[j] % 10) return false;\n for (int i = 0; i < v.size() - 1; i++)\n if (v[i] > v[i + 1]) return false;\n int cnt = 0;\n for (int i = 0; i < v.size(); i++)\n if (v[i] \/ 10 == 1) cnt++;\n if (cnt == 1)\n return true;\n else\n return false;\n}\nint main() {\n gets(s);\n n = strlen(s);\n while (next_token()) {\n v.push_back(get_type());\n s[ip2] = z;\n }\n if (solve())\n puts(\"YES\");\n else\n puts(\"NO\");\n return 0;\n}","item":{"problem_id":"113A","pseudocode":"ip, ip2 and n are ints with ip and ip2 = 0\ndeclare vector of integers called v\ns is a new array of characters with 100010 elements\nin the function next_token that returns boolean\n set the value of ip to ip2\n while ip < n and (s[ip] < 'a' or s[ip] > 'z')\n if ip is equal to n, return false\n change ip2 to ip\n while ip2 < n and s[ip2] >= 'a' and s[ip2] <= 'z'\n return true\nend of the block\ndeclare character z\nfunction get_type that returns integer\n define new integer len with value ip2-ip\n change z to s[ip2]\n assign the new value = 0 to s[ip2]\n if s + ip + len - 4 matches \"lios\", return 0\n if result of s + ip + len - 5 = \"liala\" return 1\n if s + ip + len - 3 matches \"etr\" return 10\n if strcmp(s + ip + len - 4,\"etra\") returns 0, return 11\n if comparison of s + ip + len - 6 with \"initis\" returns 0, return 20\n return 21 if s + ip + len - 6 matches \"inites\"\n return -1\nend of the block\nboolean function solve\n in a for loop, change i from 0 to length of v exclusive\n if v[i] is equal to -1, return false\n return true if length of v = 1\n start for loop from i = 0 to length of v exclusive incrementing i\n in a for loop, change j from 0 to i exclusive\n return false if v[i] % 10 != v[j] % 10\n start for loop from i = 0 to length of v - 1 exclusive incrementing i\n if v[i] is greater than v[i + 1], return false\n create new integer cnt = 0\n increment i in a loop from i = 0 to length of v exclusive\n if v[i] \/ 10 = 1, increment cnt\n if cnt is equal to 1\n return true\n else\n return false\nend of the block\ndefine the main function\n store input into s\n change n to length of s\n while next_token() returns true\n push new value = the result of get_type() into v\n change s[ip2] to z\n end of the block\n if call to solve() returned true\n print \"YES\"\n else\n print \"NO\" to standard output\n return to indicate successful execution\nend of the block","testcases":[[["petr"],["YES"]],[["etis atis animatis etis atis amatis"],["NO"]],[["nataliala kataliala vetra feinites"],["YES"]],[["qweasbvflios"],["YES"]],[["lios lios petr initis qwe"],["NO"]],[["lios initis"],["NO"]],[["petr initis lios"],["NO"]],[["petra petra petra"],["NO"]],[["in"],["NO"]],[["liala petra initis"],["NO"]],[["liala petra inites"],["YES"]],[["liala initis"],["NO"]],[["liala petra petr inites"],["NO"]],[["liala petr inites"],["NO"]],[["llilitos"],["NO"]],[["umeszdawsvgkjhlqwzentsphxqhdungbylhnikwviuhccbstghhxlmvcjznnkjqkugsdysjbedwpmsmxmgxlrlxctnebtbwrsvgjktkrosffwymovxvsgfmmqwfflpvbumozikroxrdgwjrnstngstxbiyyuxehrhviteptedlmyetr"],["YES"]],[["i i i i i i i i i i i i i i i a a a a a a v v v v v v v v v v v"],["NO"]],[["fbvzqonvdlqdanwliolaqfj sbauorbinites xkbfnfinitespjy phbexglblzpobtqpisyijycmtliola aosinites lbpjiwcjoqyuhglthloiniteswb mjtxhoofohzzgefvhsywojcuxtetxmojrlktodhbgyrkeejgjzxkzyvrxwmyaqkeoqnvusnlrsfffrzeoqjdfumolhksqkrtzwhnforgpenziokrxlnhcapbbupctlmuetrani pigxerwetupjbkvlmgnjhdfjliolanz tqhaidxbqmdaeincxjuliola"],["NO"]],[["mfrmqetr"],["YES"]],[["hnwvfllholxfialiola cknjtxpliola daliola gqfapnhmmworliola qhetra qrisbexsrefcwzoxqwxrevinites wwldqkqhvrgwplqinites nqdpoauitczttxoinites fgbmdfpxkhahkinites"],["NO"]],[["kcymcpgqdxkudadewddualeemhixhsdazudnjdmuvxvrlrbrpsdpxpagmrogplltnifrtomdtahxwadguvetxaqkvsvnoyhowirnluhmyewzapirnpfdisvhtbenxmfezahqoflkjrfqjubwdfktnpeirodwubftzlcczzavfiooihzvnqincndisudihvbcaxptrwovekmhiiwsgzgbxydvuldlnktxtltrlajjzietkxbnhetra"],["YES"]],[["dosiydnwxemojaavfdvlwsyhzqywqjutovygtlcleklhybczhjqfzxwdmlwqwcqqyfjkzhsizlmdarrfronxqkcknwpkvhdlgatdyjisjoopvngpjggldxjfxaauoxmqirkuphydyweoixftstlozaoywnxgriscudwlokncbmaebpssccmmmfjennyjaryqlzjknnklqketra"],["YES"]],[["etretra linites"],["YES"]],[["petretra petr"],["NO"]],[["lialalios petraveryfunnypetr"],["YES"]],[["petropetrapetr petra"],["NO"]],[["lios petrnonono"],["NO"]],[["lios petr initisandinitisandliala petrainitis"],["NO"]],[["petro"],["NO"]],[["petr initesinitis"],["YES"]],[["lios initis"],["NO"]],[["liala initespetra"],["YES"]],[["lios petrapetr"],["YES"]],[["initis petr"],["NO"]],[["lioslialapetrpetrainitisinitesliosliala initesinitislioslialapetrpetrainitisinitetra"],["YES"]],[["veryfunnyprefixpetr"],["YES"]],[["veryfunnyprefixpetra"],["YES"]],[["veryfunnyprefixinitis"],["YES"]],[["veryfunnyprefixinites"],["YES"]],[["veryfunnyprefixliala"],["YES"]],[["veryfunnyprefixlios"],["YES"]],[["veryfunnyprefixlialas"],["NO"]],[["veryfunnyprefixliala veryfunnyprefixpetretra"],["YES"]],[["veryfunnyprefixlios veryfunnyprefixinitisetr"],["YES"]],[["veryfunnyprefixlios aabbinitis"],["NO"]],[["veryfunnyprefixlios inites"],["NO"]],[["lios petr initis"],["YES"]],[["liala etra inites"],["YES"]],[["lios"],["YES"]],[["liala"],["YES"]],[["initis"],["YES"]],[["inites"],["YES"]],[["tes"],["NO"]],[["tr"],["NO"]],[["a"],["NO"]],[["lios lios"],["NO"]],[["lios"],["YES"]],[["liala"],["YES"]],[["petr"],["YES"]],[["petra"],["YES"]],[["pinitis"],["YES"]],[["pinites"],["YES"]],[["plios pliala"],["NO"]],[["plios petr"],["YES"]],[["plios petra"],["NO"]],[["plios plios"],["NO"]],[["plios initis"],["NO"]],[["plios pinites"],["NO"]],[["pliala plios"],["NO"]],[["pliala ppliala"],["NO"]],[["pliala petr"],["NO"]],[["pliala petra"],["YES"]],[["pliala pinitis"],["NO"]],[["pliala pinites"],["NO"]],[["petr plios"],["NO"]],[["petr pliala"],["NO"]],[["petr petr"],["NO"]],[["petr petra"],["NO"]],[["petr pinitis"],["YES"]],[["petr pinites"],["NO"]],[["petra lios"],["NO"]],[["petra liala"],["NO"]],[["petra petr"],["NO"]],[["petra petra"],["NO"]],[["petra initis"],["NO"]],[["petra inites"],["YES"]],[["initis lios"],["NO"]],[["initis liala"],["NO"]],[["initis petr"],["NO"]],[["initis petra"],["NO"]],[["initis initis"],["NO"]],[["initis inites"],["NO"]],[["inites lios"],["NO"]],[["inites liala"],["NO"]],[["inites petr"],["NO"]],[["inites petra"],["NO"]],[["inites initis"],["NO"]],[["inites inites"],["NO"]],[["lios lios lios"],["NO"]],[["lios lios liala"],["NO"]],[["lios lios etr"],["YES"]],[["lios lios etra"],["NO"]],[["lios lios initis"],["NO"]],[["lios lios inites"],["NO"]],[["lios liala lios"],["NO"]],[["lios liala liala"],["NO"]],[["lios liala etr"],["NO"]],[["lios liala etra"],["NO"]],[["lios liala initis"],["NO"]],[["lios liala inites"],["NO"]],[["lios etr lios"],["NO"]],[["lios etr liala"],["NO"]],[["lios etr etr"],["NO"]],[["lios etr etra"],["NO"]],[["lios etr initis"],["YES"]],[["lios etr inites"],["NO"]],[["lios etra lios"],["NO"]],[["lios etra liala"],["NO"]],[["lios etra etr"],["NO"]],[["lios etra etra"],["NO"]],[["lios etra initis"],["NO"]],[["lios etra inites"],["NO"]],[["lios initis lios"],["NO"]],[["lios initis liala"],["NO"]],[["lios initis etr"],["NO"]],[["lios initis etra"],["NO"]],[["lios initis initis"],["NO"]],[["lios initis inites"],["NO"]],[["lios inites lios"],["NO"]],[["lios inites liala"],["NO"]],[["lios inites etr"],["NO"]],[["lios inites etra"],["NO"]],[["lios inites initis"],["NO"]],[["lios inites inites"],["NO"]],[["liala lios lios"],["NO"]],[["liala lios liala"],["NO"]],[["liala lios etr"],["NO"]],[["liala lios etra"],["NO"]],[["liala lios initis"],["NO"]],[["liala lios inites"],["NO"]],[["liala liala lios"],["NO"]],[["liala liala liala"],["NO"]],[["liala liala etr"],["NO"]],[["liala liala etra"],["YES"]],[["liala liala initis"],["NO"]],[["liala liala inites"],["NO"]],[["liala etr lios"],["NO"]],[["liala etr liala"],["NO"]],[["liala etr etr"],["NO"]],[["liala etr etra"],["NO"]],[["liala etr initis"],["NO"]],[["liala etr inites"],["NO"]],[["liala etra lios"],["NO"]],[["liala etra liala"],["NO"]],[["liala etra etr"],["NO"]],[["liala etra etra"],["NO"]],[["liala etra initis"],["NO"]],[["liala etra inites"],["YES"]],[["liala initis lios"],["NO"]],[["liala initis liala"],["NO"]],[["liala initis etr"],["NO"]],[["liala initis etra"],["NO"]],[["liala initis initis"],["NO"]],[["liala initis inites"],["NO"]],[["liala inites lios"],["NO"]],[["liala inites liala"],["NO"]],[["liala inites etr"],["NO"]],[["liala inites etra"],["NO"]],[["liala inites initis"],["NO"]],[["liala inites inites"],["NO"]],[["etr lios lios"],["NO"]],[["etr lios liala"],["NO"]],[["etr lios etr"],["NO"]],[["etr lios etra"],["NO"]],[["etr lios initis"],["NO"]],[["etr lios inites"],["NO"]],[["etr liala lios"],["NO"]],[["etr liala liala"],["NO"]],[["etr liala etr"],["NO"]],[["etr liala etra"],["NO"]],[["etr liala initis"],["NO"]],[["etr liala inites"],["NO"]],[["etr etr lios"],["NO"]],[["etr etr liala"],["NO"]],[["etr etr etr"],["NO"]],[["etr etr etra"],["NO"]],[["etr etr initis"],["NO"]],[["etr etr inites"],["NO"]],[["etr etra lios"],["NO"]],[["etr etra liala"],["NO"]],[["etr etra etr"],["NO"]],[["etr etra etra"],["NO"]],[["etr etra initis"],["NO"]],[["etr etra inites"],["NO"]],[["etr initis lios"],["NO"]],[["etr initis liala"],["NO"]],[["etr initis etr"],["NO"]],[["etr initis etra"],["NO"]],[["etr initis initis"],["YES"]],[["etr initis inites"],["NO"]],[["etr inites lios"],["NO"]],[["etr inites liala"],["NO"]],[["etr inites etr"],["NO"]],[["etr inites etra"],["NO"]],[["etr inites initis"],["NO"]],[["etr inites inites"],["NO"]],[["etra lios lios"],["NO"]],[["etra lios liala"],["NO"]],[["etra lios etr"],["NO"]],[["etra lios etra"],["NO"]],[["etra lios initis"],["NO"]],[["etra lios inites"],["NO"]],[["etra liala lios"],["NO"]],[["etra liala liala"],["NO"]],[["etra liala etr"],["NO"]],[["etra liala etra"],["NO"]],[["etra liala initis"],["NO"]],[["etra liala inites"],["NO"]],[["etra etr lios"],["NO"]],[["etra etr liala"],["NO"]],[["etra etr etr"],["NO"]],[["etra etr etra"],["NO"]],[["etra etr initis"],["NO"]],[["etra etr inites"],["NO"]],[["etra etra lios"],["NO"]],[["etra etra liala"],["NO"]],[["etra etra etr"],["NO"]],[["etra etra etra"],["NO"]],[["etra etra initis"],["NO"]],[["etra etra inites"],["NO"]],[["etra initis lios"],["NO"]],[["etra initis liala"],["NO"]],[["etra initis etr"],["NO"]],[["etra initis etra"],["NO"]],[["etra initis initis"],["NO"]],[["etra initis inites"],["NO"]],[["etra inites lios"],["NO"]],[["etra inites liala"],["NO"]],[["etra inites etr"],["NO"]],[["etra inites etra"],["NO"]],[["etra inites initis"],["NO"]],[["etra inites inites"],["YES"]],[["initis lios lios"],["NO"]],[["initis lios liala"],["NO"]],[["initis lios etr"],["NO"]],[["initis lios etra"],["NO"]],[["initis lios initis"],["NO"]],[["initis lios inites"],["NO"]],[["initis liala lios"],["NO"]],[["initis liala liala"],["NO"]],[["initis liala etr"],["NO"]],[["initis liala etra"],["NO"]],[["initis liala initis"],["NO"]],[["initis liala inites"],["NO"]],[["initis etr lios"],["NO"]],[["initis etr liala"],["NO"]],[["initis etr etr"],["NO"]],[["initis etr etra"],["NO"]],[["initis etr initis"],["NO"]],[["initis etr inites"],["NO"]],[["initis etra lios"],["NO"]],[["initis etra liala"],["NO"]],[["initis etra etr"],["NO"]],[["initis etra etra"],["NO"]],[["initis etra initis"],["NO"]],[["initis etra inites"],["NO"]],[["initis initis lios"],["NO"]],[["initis initis liala"],["NO"]],[["initis initis etr"],["NO"]],[["initis initis etra"],["NO"]],[["initis initis initis"],["NO"]],[["initis initis inites"],["NO"]],[["initis inites lios"],["NO"]],[["initis inites liala"],["NO"]],[["initis inites etr"],["NO"]],[["initis inites etra"],["NO"]],[["initis inites initis"],["NO"]],[["initis inites inites"],["NO"]],[["inites lios lios"],["NO"]],[["inites lios liala"],["NO"]],[["inites lios etr"],["NO"]],[["inites lios etra"],["NO"]],[["inites lios initis"],["NO"]],[["inites lios inites"],["NO"]],[["inites liala lios"],["NO"]],[["inites liala liala"],["NO"]],[["inites liala etr"],["NO"]],[["inites liala etra"],["NO"]],[["inites liala initis"],["NO"]],[["inites liala inites"],["NO"]],[["inites etr lios"],["NO"]],[["inites etr liala"],["NO"]],[["inites etr etr"],["NO"]],[["inites etr etra"],["NO"]],[["inites etr initis"],["NO"]],[["inites etr inites"],["NO"]],[["inites etra lios"],["NO"]],[["inites etra liala"],["NO"]],[["inites etra etr"],["NO"]],[["inites etra etra"],["NO"]],[["inites etra initis"],["NO"]],[["inites etra inites"],["NO"]],[["inites initis lios"],["NO"]],[["inites initis liala"],["NO"]],[["inites initis etr"],["NO"]],[["inites initis etra"],["NO"]],[["inites initis initis"],["NO"]],[["inites initis inites"],["NO"]],[["inites inites lios"],["NO"]],[["inites inites liala"],["NO"]],[["inites inites etr"],["NO"]],[["inites inites etra"],["NO"]],[["inites inites initis"],["NO"]],[["inites inites inites"],["NO"]]]}} +{"instance_id":"pseudo_to_code_2k_77","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare constant integer N = 1e5 + 7\ndeclare constant string array s = {\"lios\", \"liala\", \"etr\", \"etra\", \"initis\", \"inites\"}\ndeclare map from string to integer mp\ndeclare string array h size N\ndeclare integer a size N\ndeclare inline get_s with string address s as argument, returning integer\n if size of s is less than 3, return 0 from function\n for i = 3 to 6 inclusive\n if i is greater than size of s, return 0 from function\n if first index of ( substring of s from size of s - i to i ) in mp is not end of mp, return mp[substring of s from size of s - i to i]\n end of the block\n return to indicate successful execution\nend of the block\ndefine the main function\n declare integer cnt = 0\n for i = 0 to 6 exclusive, let mp[s[i]] be i + 1\n while ( read h[cnt] ), increment cnt\n declare booleans f1 = 0, f2 = 0\n for i = 0 to cnt exclusive\n let a[i] be result of run get_s(h[i])\n if not a[i], return 0 * print \"NO\"\n let f1 be f1 bitwise or (bitwise and 1 ), let f2 be f2 bitwise or ( bitwise not a[i] bitwise and 1 )\n end of the block\n if cnt is 1, return 0 * print \"YES\"\n if f1 and f2, return 0 * print \"NO\"\n for i = 0 to cnt exclusive, increment a[i] by 1, let a[i] be a[i] bitshift right 1\n declare integer p = 0\n while p is less than cnt - 1 and a[p] is a[p+1] and a[p] is 1, increment p\n if a[p] is 1\n increment p\n else if a[p] is 3\n return 0 * print \"NO\"\n if a[p] is not 2\n return 0 * print \"NO\"\n else\n increment p\n while p is less than cnt\n if a[increment p] is not 3, return 0 * print \"NO\"\n if a[increment p] is not 3, return 0 * print \"NO\"\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int N = 1e5 + 7;\nconst string s[] = {\"lios\", \"liala\", \"etr\", \"etra\", \"initis\", \"inites\"};\nmap mp;\nstring h[N];\nint a[N];\ninline int get_s(string &s) {\n if (s.size() < 3) return 0;\n for (int i = 3; i <= 6; i++) {\n if (i > s.size()) return 0;\n if (mp.find(s.substr(s.size() - i, i)) != mp.end()) return mp[s.substr(s.size() - i, i)];\n }\n return 0;\n}\nint main() {\n int cnt = 0;\n for (int i = 0; i < 6; i++) mp[s[i]] = i + 1;\n while (cin >> h[cnt]) cnt++;\n bool f1 = 0, f2 = 0;\n for (int i = 0; i < cnt; i++) {\n a[i] = get_s(h[i]);\n if (!a[i]) return 0 * puts(\"NO\");\n f1 |= a[i] & 1, f2 |= ~a[i] & 1;\n }\n if (cnt == 1) return 0 * puts(\"YES\");\n if (f1 && f2) return 0 * puts(\"NO\");\n for (int i = 0; i < cnt; i++) (a[i] += 1) >>= 1;\n int p = 0;\n while (p < cnt - 1 && a[p] == a[p + 1] && a[p] == 1) p++;\n if (a[p] == 1)\n p++;\n else if (a[p] == 3)\n return 0 * puts(\"NO\");\n if (a[p] != 2)\n return 0 * puts(\"NO\");\n else\n p++;\n while (p < cnt)\n if (a[p++] != 3) return 0 * puts(\"NO\");\n puts(\"YES\");\n return 0;\n}","item":{"problem_id":"113A","pseudocode":"declare constant integer N = 1e5 + 7\ndeclare constant string array s = {\"lios\", \"liala\", \"etr\", \"etra\", \"initis\", \"inites\"}\ndeclare map from string to integer mp\ndeclare string array h size N\ndeclare integer a size N\ndeclare inline get_s with string address s as argument, returning integer\n if size of s is less than 3, return 0 from function\n for i = 3 to 6 inclusive\n if i is greater than size of s, return 0 from function\n if first index of ( substring of s from size of s - i to i ) in mp is not end of mp, return mp[substring of s from size of s - i to i]\n end of the block\n return to indicate successful execution\nend of the block\ndefine the main function\n declare integer cnt = 0\n for i = 0 to 6 exclusive, let mp[s[i]] be i + 1\n while ( read h[cnt] ), increment cnt\n declare booleans f1 = 0, f2 = 0\n for i = 0 to cnt exclusive\n let a[i] be result of run get_s(h[i])\n if not a[i], return 0 * print \"NO\"\n let f1 be f1 bitwise or (bitwise and 1 ), let f2 be f2 bitwise or ( bitwise not a[i] bitwise and 1 )\n end of the block\n if cnt is 1, return 0 * print \"YES\"\n if f1 and f2, return 0 * print \"NO\"\n for i = 0 to cnt exclusive, increment a[i] by 1, let a[i] be a[i] bitshift right 1\n declare integer p = 0\n while p is less than cnt - 1 and a[p] is a[p+1] and a[p] is 1, increment p\n if a[p] is 1\n increment p\n else if a[p] is 3\n return 0 * print \"NO\"\n if a[p] is not 2\n return 0 * print \"NO\"\n else\n increment p\n while p is less than cnt\n if a[increment p] is not 3, return 0 * print \"NO\"\n if a[increment p] is not 3, return 0 * print \"NO\"\n return to indicate successful execution\nend of the block","testcases":[[["petr"],["YES"]],[["etis atis animatis etis atis amatis"],["NO"]],[["nataliala kataliala vetra feinites"],["YES"]],[["qweasbvflios"],["YES"]],[["lios lios petr initis qwe"],["NO"]],[["lios initis"],["NO"]],[["petr initis lios"],["NO"]],[["petra petra petra"],["NO"]],[["in"],["NO"]],[["liala petra initis"],["NO"]],[["liala petra inites"],["YES"]],[["liala initis"],["NO"]],[["liala petra petr inites"],["NO"]],[["liala petr inites"],["NO"]],[["llilitos"],["NO"]],[["umeszdawsvgkjhlqwzentsphxqhdungbylhnikwviuhccbstghhxlmvcjznnkjqkugsdysjbedwpmsmxmgxlrlxctnebtbwrsvgjktkrosffwymovxvsgfmmqwfflpvbumozikroxrdgwjrnstngstxbiyyuxehrhviteptedlmyetr"],["YES"]],[["i i i i i i i i i i i i i i i a a a a a a v v v v v v v v v v v"],["NO"]],[["fbvzqonvdlqdanwliolaqfj sbauorbinites xkbfnfinitespjy phbexglblzpobtqpisyijycmtliola aosinites lbpjiwcjoqyuhglthloiniteswb mjtxhoofohzzgefvhsywojcuxtetxmojrlktodhbgyrkeejgjzxkzyvrxwmyaqkeoqnvusnlrsfffrzeoqjdfumolhksqkrtzwhnforgpenziokrxlnhcapbbupctlmuetrani pigxerwetupjbkvlmgnjhdfjliolanz tqhaidxbqmdaeincxjuliola"],["NO"]],[["mfrmqetr"],["YES"]],[["hnwvfllholxfialiola cknjtxpliola daliola gqfapnhmmworliola qhetra qrisbexsrefcwzoxqwxrevinites wwldqkqhvrgwplqinites nqdpoauitczttxoinites fgbmdfpxkhahkinites"],["NO"]],[["kcymcpgqdxkudadewddualeemhixhsdazudnjdmuvxvrlrbrpsdpxpagmrogplltnifrtomdtahxwadguvetxaqkvsvnoyhowirnluhmyewzapirnpfdisvhtbenxmfezahqoflkjrfqjubwdfktnpeirodwubftzlcczzavfiooihzvnqincndisudihvbcaxptrwovekmhiiwsgzgbxydvuldlnktxtltrlajjzietkxbnhetra"],["YES"]],[["dosiydnwxemojaavfdvlwsyhzqywqjutovygtlcleklhybczhjqfzxwdmlwqwcqqyfjkzhsizlmdarrfronxqkcknwpkvhdlgatdyjisjoopvngpjggldxjfxaauoxmqirkuphydyweoixftstlozaoywnxgriscudwlokncbmaebpssccmmmfjennyjaryqlzjknnklqketra"],["YES"]],[["etretra linites"],["YES"]],[["petretra petr"],["NO"]],[["lialalios petraveryfunnypetr"],["YES"]],[["petropetrapetr petra"],["NO"]],[["lios petrnonono"],["NO"]],[["lios petr initisandinitisandliala petrainitis"],["NO"]],[["petro"],["NO"]],[["petr initesinitis"],["YES"]],[["lios initis"],["NO"]],[["liala initespetra"],["YES"]],[["lios petrapetr"],["YES"]],[["initis petr"],["NO"]],[["lioslialapetrpetrainitisinitesliosliala initesinitislioslialapetrpetrainitisinitetra"],["YES"]],[["veryfunnyprefixpetr"],["YES"]],[["veryfunnyprefixpetra"],["YES"]],[["veryfunnyprefixinitis"],["YES"]],[["veryfunnyprefixinites"],["YES"]],[["veryfunnyprefixliala"],["YES"]],[["veryfunnyprefixlios"],["YES"]],[["veryfunnyprefixlialas"],["NO"]],[["veryfunnyprefixliala veryfunnyprefixpetretra"],["YES"]],[["veryfunnyprefixlios veryfunnyprefixinitisetr"],["YES"]],[["veryfunnyprefixlios aabbinitis"],["NO"]],[["veryfunnyprefixlios inites"],["NO"]],[["lios petr initis"],["YES"]],[["liala etra inites"],["YES"]],[["lios"],["YES"]],[["liala"],["YES"]],[["initis"],["YES"]],[["inites"],["YES"]],[["tes"],["NO"]],[["tr"],["NO"]],[["a"],["NO"]],[["lios lios"],["NO"]],[["lios"],["YES"]],[["liala"],["YES"]],[["petr"],["YES"]],[["petra"],["YES"]],[["pinitis"],["YES"]],[["pinites"],["YES"]],[["plios pliala"],["NO"]],[["plios petr"],["YES"]],[["plios petra"],["NO"]],[["plios plios"],["NO"]],[["plios initis"],["NO"]],[["plios pinites"],["NO"]],[["pliala plios"],["NO"]],[["pliala ppliala"],["NO"]],[["pliala petr"],["NO"]],[["pliala petra"],["YES"]],[["pliala pinitis"],["NO"]],[["pliala pinites"],["NO"]],[["petr plios"],["NO"]],[["petr pliala"],["NO"]],[["petr petr"],["NO"]],[["petr petra"],["NO"]],[["petr pinitis"],["YES"]],[["petr pinites"],["NO"]],[["petra lios"],["NO"]],[["petra liala"],["NO"]],[["petra petr"],["NO"]],[["petra petra"],["NO"]],[["petra initis"],["NO"]],[["petra inites"],["YES"]],[["initis lios"],["NO"]],[["initis liala"],["NO"]],[["initis petr"],["NO"]],[["initis petra"],["NO"]],[["initis initis"],["NO"]],[["initis inites"],["NO"]],[["inites lios"],["NO"]],[["inites liala"],["NO"]],[["inites petr"],["NO"]],[["inites petra"],["NO"]],[["inites initis"],["NO"]],[["inites inites"],["NO"]],[["lios lios lios"],["NO"]],[["lios lios liala"],["NO"]],[["lios lios etr"],["YES"]],[["lios lios etra"],["NO"]],[["lios lios initis"],["NO"]],[["lios lios inites"],["NO"]],[["lios liala lios"],["NO"]],[["lios liala liala"],["NO"]],[["lios liala etr"],["NO"]],[["lios liala etra"],["NO"]],[["lios liala initis"],["NO"]],[["lios liala inites"],["NO"]],[["lios etr lios"],["NO"]],[["lios etr liala"],["NO"]],[["lios etr etr"],["NO"]],[["lios etr etra"],["NO"]],[["lios etr initis"],["YES"]],[["lios etr inites"],["NO"]],[["lios etra lios"],["NO"]],[["lios etra liala"],["NO"]],[["lios etra etr"],["NO"]],[["lios etra etra"],["NO"]],[["lios etra initis"],["NO"]],[["lios etra inites"],["NO"]],[["lios initis lios"],["NO"]],[["lios initis liala"],["NO"]],[["lios initis etr"],["NO"]],[["lios initis etra"],["NO"]],[["lios initis initis"],["NO"]],[["lios initis inites"],["NO"]],[["lios inites lios"],["NO"]],[["lios inites liala"],["NO"]],[["lios inites etr"],["NO"]],[["lios inites etra"],["NO"]],[["lios inites initis"],["NO"]],[["lios inites inites"],["NO"]],[["liala lios lios"],["NO"]],[["liala lios liala"],["NO"]],[["liala lios etr"],["NO"]],[["liala lios etra"],["NO"]],[["liala lios initis"],["NO"]],[["liala lios inites"],["NO"]],[["liala liala lios"],["NO"]],[["liala liala liala"],["NO"]],[["liala liala etr"],["NO"]],[["liala liala etra"],["YES"]],[["liala liala initis"],["NO"]],[["liala liala inites"],["NO"]],[["liala etr lios"],["NO"]],[["liala etr liala"],["NO"]],[["liala etr etr"],["NO"]],[["liala etr etra"],["NO"]],[["liala etr initis"],["NO"]],[["liala etr inites"],["NO"]],[["liala etra lios"],["NO"]],[["liala etra liala"],["NO"]],[["liala etra etr"],["NO"]],[["liala etra etra"],["NO"]],[["liala etra initis"],["NO"]],[["liala etra inites"],["YES"]],[["liala initis lios"],["NO"]],[["liala initis liala"],["NO"]],[["liala initis etr"],["NO"]],[["liala initis etra"],["NO"]],[["liala initis initis"],["NO"]],[["liala initis inites"],["NO"]],[["liala inites lios"],["NO"]],[["liala inites liala"],["NO"]],[["liala inites etr"],["NO"]],[["liala inites etra"],["NO"]],[["liala inites initis"],["NO"]],[["liala inites inites"],["NO"]],[["etr lios lios"],["NO"]],[["etr lios liala"],["NO"]],[["etr lios etr"],["NO"]],[["etr lios etra"],["NO"]],[["etr lios initis"],["NO"]],[["etr lios inites"],["NO"]],[["etr liala lios"],["NO"]],[["etr liala liala"],["NO"]],[["etr liala etr"],["NO"]],[["etr liala etra"],["NO"]],[["etr liala initis"],["NO"]],[["etr liala inites"],["NO"]],[["etr etr lios"],["NO"]],[["etr etr liala"],["NO"]],[["etr etr etr"],["NO"]],[["etr etr etra"],["NO"]],[["etr etr initis"],["NO"]],[["etr etr inites"],["NO"]],[["etr etra lios"],["NO"]],[["etr etra liala"],["NO"]],[["etr etra etr"],["NO"]],[["etr etra etra"],["NO"]],[["etr etra initis"],["NO"]],[["etr etra inites"],["NO"]],[["etr initis lios"],["NO"]],[["etr initis liala"],["NO"]],[["etr initis etr"],["NO"]],[["etr initis etra"],["NO"]],[["etr initis initis"],["YES"]],[["etr initis inites"],["NO"]],[["etr inites lios"],["NO"]],[["etr inites liala"],["NO"]],[["etr inites etr"],["NO"]],[["etr inites etra"],["NO"]],[["etr inites initis"],["NO"]],[["etr inites inites"],["NO"]],[["etra lios lios"],["NO"]],[["etra lios liala"],["NO"]],[["etra lios etr"],["NO"]],[["etra lios etra"],["NO"]],[["etra lios initis"],["NO"]],[["etra lios inites"],["NO"]],[["etra liala lios"],["NO"]],[["etra liala liala"],["NO"]],[["etra liala etr"],["NO"]],[["etra liala etra"],["NO"]],[["etra liala initis"],["NO"]],[["etra liala inites"],["NO"]],[["etra etr lios"],["NO"]],[["etra etr liala"],["NO"]],[["etra etr etr"],["NO"]],[["etra etr etra"],["NO"]],[["etra etr initis"],["NO"]],[["etra etr inites"],["NO"]],[["etra etra lios"],["NO"]],[["etra etra liala"],["NO"]],[["etra etra etr"],["NO"]],[["etra etra etra"],["NO"]],[["etra etra initis"],["NO"]],[["etra etra inites"],["NO"]],[["etra initis lios"],["NO"]],[["etra initis liala"],["NO"]],[["etra initis etr"],["NO"]],[["etra initis etra"],["NO"]],[["etra initis initis"],["NO"]],[["etra initis inites"],["NO"]],[["etra inites lios"],["NO"]],[["etra inites liala"],["NO"]],[["etra inites etr"],["NO"]],[["etra inites etra"],["NO"]],[["etra inites initis"],["NO"]],[["etra inites inites"],["YES"]],[["initis lios lios"],["NO"]],[["initis lios liala"],["NO"]],[["initis lios etr"],["NO"]],[["initis lios etra"],["NO"]],[["initis lios initis"],["NO"]],[["initis lios inites"],["NO"]],[["initis liala lios"],["NO"]],[["initis liala liala"],["NO"]],[["initis liala etr"],["NO"]],[["initis liala etra"],["NO"]],[["initis liala initis"],["NO"]],[["initis liala inites"],["NO"]],[["initis etr lios"],["NO"]],[["initis etr liala"],["NO"]],[["initis etr etr"],["NO"]],[["initis etr etra"],["NO"]],[["initis etr initis"],["NO"]],[["initis etr inites"],["NO"]],[["initis etra lios"],["NO"]],[["initis etra liala"],["NO"]],[["initis etra etr"],["NO"]],[["initis etra etra"],["NO"]],[["initis etra initis"],["NO"]],[["initis etra inites"],["NO"]],[["initis initis lios"],["NO"]],[["initis initis liala"],["NO"]],[["initis initis etr"],["NO"]],[["initis initis etra"],["NO"]],[["initis initis initis"],["NO"]],[["initis initis inites"],["NO"]],[["initis inites lios"],["NO"]],[["initis inites liala"],["NO"]],[["initis inites etr"],["NO"]],[["initis inites etra"],["NO"]],[["initis inites initis"],["NO"]],[["initis inites inites"],["NO"]],[["inites lios lios"],["NO"]],[["inites lios liala"],["NO"]],[["inites lios etr"],["NO"]],[["inites lios etra"],["NO"]],[["inites lios initis"],["NO"]],[["inites lios inites"],["NO"]],[["inites liala lios"],["NO"]],[["inites liala liala"],["NO"]],[["inites liala etr"],["NO"]],[["inites liala etra"],["NO"]],[["inites liala initis"],["NO"]],[["inites liala inites"],["NO"]],[["inites etr lios"],["NO"]],[["inites etr liala"],["NO"]],[["inites etr etr"],["NO"]],[["inites etr etra"],["NO"]],[["inites etr initis"],["NO"]],[["inites etr inites"],["NO"]],[["inites etra lios"],["NO"]],[["inites etra liala"],["NO"]],[["inites etra etr"],["NO"]],[["inites etra etra"],["NO"]],[["inites etra initis"],["NO"]],[["inites etra inites"],["NO"]],[["inites initis lios"],["NO"]],[["inites initis liala"],["NO"]],[["inites initis etr"],["NO"]],[["inites initis etra"],["NO"]],[["inites initis initis"],["NO"]],[["inites initis inites"],["NO"]],[["inites inites lios"],["NO"]],[["inites inites liala"],["NO"]],[["inites inites etr"],["NO"]],[["inites inites etra"],["NO"]],[["inites inites initis"],["NO"]],[["inites inites inites"],["NO"]]]}} +{"instance_id":"pseudo_to_code_2k_78","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmake string vector word\nmake integer vector be and af\ncreate int set g\ndeclare sf taking in string s and returning int\n make int n = s.size()\n if n is greater than or equal to 4 and s.substr(n - 4, 4) is equal to \"lios\"\n return to indicate successful execution\n else if n is greater than 5 and s.substr(n - 5, 5) is equal to \"liala\"\n return 1\n else if n is greater than or equal to 3 and s.substr(n - 3, 3) is equal to \"etr\"\n return 2\n else if n is greater than or equal to 4 and s.substr(n - 4, 4) is equal to \"etra\"\n return 3\n else if n is greater than or equal to 6 and s.substr(n - 6, 6) equals \"initis\"\n return 4\n else if n is greater than or equal to 6 and s.substr(n - 6, 6) equals \"inites\"\n return 5\n else do\n return -1\n end of the block\nend of the block\ndefine the main function\n make string s\n read s and while it's truthy, append s to word\n for i = 0 to size of word exclusive\n make integer j = sf(word[i])\n if j is equal to -1\n print \"NO\"\n return to indicate successful execution\n end of the block\n insert j % 2 to g\n append j \/ 2 to be\n append j \/ 2 to af\n end of the block\n if size of word is 1\n print \"YES\"\n return to indicate successful execution\n end of the block\n sort af\n if g.size() is not 1\n print \"NO\"\n return to indicate successful execution\n end of the block\n make integer cnt = 0\n for i = 0 to af.size() exclusive\n if af[i] is not equal to be[i]\n show \"NO\"\n return to indicate successful execution\n end of the block\n if af[i] is equal to 1, increment cnt\n end of the block\n if cnt is equal to 0 and size of word is not equal to 1\n show \"NO\"\n return to indicate successful execution\n else if cnt is not 1 and cnt is not 0\n display \"NO\"\n return to indicate successful execution\n end of the block\n output \"YES\"\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"vector word;\nvector be, af;\nset g;\nint sf(string s) {\n int n = s.size();\n if (n >= 4 && s.substr(n - 4, 4) == \"lios\") {\n return 0;\n } else if (n >= 5 && s.substr(n - 5, 5) == \"liala\") {\n return 1;\n } else if (n >= 3 && s.substr(n - 3, 3) == \"etr\") {\n return 2;\n } else if (n >= 4 && s.substr(n - 4, 4) == \"etra\") {\n return 3;\n } else if (n >= 6 && s.substr(n - 6, 6) == \"initis\") {\n return 4;\n } else if (n >= 6 && s.substr(n - 6, 6) == \"inites\") {\n return 5;\n } else {\n return -1;\n }\n}\nint main() {\n string s;\n while (cin >> s) { word.push_back(s); }\n for (int i = 0; i < word.size(); i++) {\n int j = sf(word[i]);\n if (j == -1) {\n cout << \"NO\" << endl;\n return 0;\n }\n g.insert(j % 2);\n be.push_back(j \/ 2);\n af.push_back(j \/ 2);\n }\n if (word.size() == 1) {\n cout << \"YES\" << endl;\n return 0;\n }\n sort(af.begin(), af.end());\n if (g.size() != 1) {\n cout << \"NO\" << endl;\n return 0;\n }\n int cnt = 0;\n for (int i = 0; i < af.size(); i++) {\n if (af[i] != be[i]) {\n cout << \"NO\" << endl;\n return 0;\n }\n if (af[i] == 1) { cnt++; }\n }\n if (cnt == 0 && word.size() != 1) {\n cout << \"NO\" << endl;\n return 0;\n } else if (cnt != 1 && cnt != 0) {\n cout << \"NO\" << endl;\n return 0;\n }\n cout << \"YES\" << endl;\n return 0;\n}","item":{"problem_id":"113A","pseudocode":"make string vector word\nmake integer vector be and af\ncreate int set g\ndeclare sf taking in string s and returning int\n make int n = s.size()\n if n is greater than or equal to 4 and s.substr(n - 4, 4) is equal to \"lios\"\n return to indicate successful execution\n else if n is greater than 5 and s.substr(n - 5, 5) is equal to \"liala\"\n return 1\n else if n is greater than or equal to 3 and s.substr(n - 3, 3) is equal to \"etr\"\n return 2\n else if n is greater than or equal to 4 and s.substr(n - 4, 4) is equal to \"etra\"\n return 3\n else if n is greater than or equal to 6 and s.substr(n - 6, 6) equals \"initis\"\n return 4\n else if n is greater than or equal to 6 and s.substr(n - 6, 6) equals \"inites\"\n return 5\n else do\n return -1\n end of the block\nend of the block\ndefine the main function\n make string s\n read s and while it's truthy, append s to word\n for i = 0 to size of word exclusive\n make integer j = sf(word[i])\n if j is equal to -1\n print \"NO\"\n return to indicate successful execution\n end of the block\n insert j % 2 to g\n append j \/ 2 to be\n append j \/ 2 to af\n end of the block\n if size of word is 1\n print \"YES\"\n return to indicate successful execution\n end of the block\n sort af\n if g.size() is not 1\n print \"NO\"\n return to indicate successful execution\n end of the block\n make integer cnt = 0\n for i = 0 to af.size() exclusive\n if af[i] is not equal to be[i]\n show \"NO\"\n return to indicate successful execution\n end of the block\n if af[i] is equal to 1, increment cnt\n end of the block\n if cnt is equal to 0 and size of word is not equal to 1\n show \"NO\"\n return to indicate successful execution\n else if cnt is not 1 and cnt is not 0\n display \"NO\"\n return to indicate successful execution\n end of the block\n output \"YES\"\n return to indicate successful execution\nend of the block","testcases":[[["petr"],["YES"]],[["etis atis animatis etis atis amatis"],["NO"]],[["nataliala kataliala vetra feinites"],["YES"]],[["qweasbvflios"],["YES"]],[["lios lios petr initis qwe"],["NO"]],[["lios initis"],["NO"]],[["petr initis lios"],["NO"]],[["petra petra petra"],["NO"]],[["in"],["NO"]],[["liala petra initis"],["NO"]],[["liala petra inites"],["YES"]],[["liala initis"],["NO"]],[["liala petra petr inites"],["NO"]],[["liala petr inites"],["NO"]],[["llilitos"],["NO"]],[["umeszdawsvgkjhlqwzentsphxqhdungbylhnikwviuhccbstghhxlmvcjznnkjqkugsdysjbedwpmsmxmgxlrlxctnebtbwrsvgjktkrosffwymovxvsgfmmqwfflpvbumozikroxrdgwjrnstngstxbiyyuxehrhviteptedlmyetr"],["YES"]],[["i i i i i i i i i i i i i i i a a a a a a v v v v v v v v v v v"],["NO"]],[["fbvzqonvdlqdanwliolaqfj sbauorbinites xkbfnfinitespjy phbexglblzpobtqpisyijycmtliola aosinites lbpjiwcjoqyuhglthloiniteswb mjtxhoofohzzgefvhsywojcuxtetxmojrlktodhbgyrkeejgjzxkzyvrxwmyaqkeoqnvusnlrsfffrzeoqjdfumolhksqkrtzwhnforgpenziokrxlnhcapbbupctlmuetrani pigxerwetupjbkvlmgnjhdfjliolanz tqhaidxbqmdaeincxjuliola"],["NO"]],[["mfrmqetr"],["YES"]],[["hnwvfllholxfialiola cknjtxpliola daliola gqfapnhmmworliola qhetra qrisbexsrefcwzoxqwxrevinites wwldqkqhvrgwplqinites nqdpoauitczttxoinites fgbmdfpxkhahkinites"],["NO"]],[["kcymcpgqdxkudadewddualeemhixhsdazudnjdmuvxvrlrbrpsdpxpagmrogplltnifrtomdtahxwadguvetxaqkvsvnoyhowirnluhmyewzapirnpfdisvhtbenxmfezahqoflkjrfqjubwdfktnpeirodwubftzlcczzavfiooihzvnqincndisudihvbcaxptrwovekmhiiwsgzgbxydvuldlnktxtltrlajjzietkxbnhetra"],["YES"]],[["dosiydnwxemojaavfdvlwsyhzqywqjutovygtlcleklhybczhjqfzxwdmlwqwcqqyfjkzhsizlmdarrfronxqkcknwpkvhdlgatdyjisjoopvngpjggldxjfxaauoxmqirkuphydyweoixftstlozaoywnxgriscudwlokncbmaebpssccmmmfjennyjaryqlzjknnklqketra"],["YES"]],[["etretra linites"],["YES"]],[["petretra petr"],["NO"]],[["lialalios petraveryfunnypetr"],["YES"]],[["petropetrapetr petra"],["NO"]],[["lios petrnonono"],["NO"]],[["lios petr initisandinitisandliala petrainitis"],["NO"]],[["petro"],["NO"]],[["petr initesinitis"],["YES"]],[["lios initis"],["NO"]],[["liala initespetra"],["YES"]],[["lios petrapetr"],["YES"]],[["initis petr"],["NO"]],[["lioslialapetrpetrainitisinitesliosliala initesinitislioslialapetrpetrainitisinitetra"],["YES"]],[["veryfunnyprefixpetr"],["YES"]],[["veryfunnyprefixpetra"],["YES"]],[["veryfunnyprefixinitis"],["YES"]],[["veryfunnyprefixinites"],["YES"]],[["veryfunnyprefixliala"],["YES"]],[["veryfunnyprefixlios"],["YES"]],[["veryfunnyprefixlialas"],["NO"]],[["veryfunnyprefixliala veryfunnyprefixpetretra"],["YES"]],[["veryfunnyprefixlios veryfunnyprefixinitisetr"],["YES"]],[["veryfunnyprefixlios aabbinitis"],["NO"]],[["veryfunnyprefixlios inites"],["NO"]],[["lios petr initis"],["YES"]],[["liala etra inites"],["YES"]],[["lios"],["YES"]],[["liala"],["YES"]],[["initis"],["YES"]],[["inites"],["YES"]],[["tes"],["NO"]],[["tr"],["NO"]],[["a"],["NO"]],[["lios lios"],["NO"]],[["lios"],["YES"]],[["liala"],["YES"]],[["petr"],["YES"]],[["petra"],["YES"]],[["pinitis"],["YES"]],[["pinites"],["YES"]],[["plios pliala"],["NO"]],[["plios petr"],["YES"]],[["plios petra"],["NO"]],[["plios plios"],["NO"]],[["plios initis"],["NO"]],[["plios pinites"],["NO"]],[["pliala plios"],["NO"]],[["pliala ppliala"],["NO"]],[["pliala petr"],["NO"]],[["pliala petra"],["YES"]],[["pliala pinitis"],["NO"]],[["pliala pinites"],["NO"]],[["petr plios"],["NO"]],[["petr pliala"],["NO"]],[["petr petr"],["NO"]],[["petr petra"],["NO"]],[["petr pinitis"],["YES"]],[["petr pinites"],["NO"]],[["petra lios"],["NO"]],[["petra liala"],["NO"]],[["petra petr"],["NO"]],[["petra petra"],["NO"]],[["petra initis"],["NO"]],[["petra inites"],["YES"]],[["initis lios"],["NO"]],[["initis liala"],["NO"]],[["initis petr"],["NO"]],[["initis petra"],["NO"]],[["initis initis"],["NO"]],[["initis inites"],["NO"]],[["inites lios"],["NO"]],[["inites liala"],["NO"]],[["inites petr"],["NO"]],[["inites petra"],["NO"]],[["inites initis"],["NO"]],[["inites inites"],["NO"]],[["lios lios lios"],["NO"]],[["lios lios liala"],["NO"]],[["lios lios etr"],["YES"]],[["lios lios etra"],["NO"]],[["lios lios initis"],["NO"]],[["lios lios inites"],["NO"]],[["lios liala lios"],["NO"]],[["lios liala liala"],["NO"]],[["lios liala etr"],["NO"]],[["lios liala etra"],["NO"]],[["lios liala initis"],["NO"]],[["lios liala inites"],["NO"]],[["lios etr lios"],["NO"]],[["lios etr liala"],["NO"]],[["lios etr etr"],["NO"]],[["lios etr etra"],["NO"]],[["lios etr initis"],["YES"]],[["lios etr inites"],["NO"]],[["lios etra lios"],["NO"]],[["lios etra liala"],["NO"]],[["lios etra etr"],["NO"]],[["lios etra etra"],["NO"]],[["lios etra initis"],["NO"]],[["lios etra inites"],["NO"]],[["lios initis lios"],["NO"]],[["lios initis liala"],["NO"]],[["lios initis etr"],["NO"]],[["lios initis etra"],["NO"]],[["lios initis initis"],["NO"]],[["lios initis inites"],["NO"]],[["lios inites lios"],["NO"]],[["lios inites liala"],["NO"]],[["lios inites etr"],["NO"]],[["lios inites etra"],["NO"]],[["lios inites initis"],["NO"]],[["lios inites inites"],["NO"]],[["liala lios lios"],["NO"]],[["liala lios liala"],["NO"]],[["liala lios etr"],["NO"]],[["liala lios etra"],["NO"]],[["liala lios initis"],["NO"]],[["liala lios inites"],["NO"]],[["liala liala lios"],["NO"]],[["liala liala liala"],["NO"]],[["liala liala etr"],["NO"]],[["liala liala etra"],["YES"]],[["liala liala initis"],["NO"]],[["liala liala inites"],["NO"]],[["liala etr lios"],["NO"]],[["liala etr liala"],["NO"]],[["liala etr etr"],["NO"]],[["liala etr etra"],["NO"]],[["liala etr initis"],["NO"]],[["liala etr inites"],["NO"]],[["liala etra lios"],["NO"]],[["liala etra liala"],["NO"]],[["liala etra etr"],["NO"]],[["liala etra etra"],["NO"]],[["liala etra initis"],["NO"]],[["liala etra inites"],["YES"]],[["liala initis lios"],["NO"]],[["liala initis liala"],["NO"]],[["liala initis etr"],["NO"]],[["liala initis etra"],["NO"]],[["liala initis initis"],["NO"]],[["liala initis inites"],["NO"]],[["liala inites lios"],["NO"]],[["liala inites liala"],["NO"]],[["liala inites etr"],["NO"]],[["liala inites etra"],["NO"]],[["liala inites initis"],["NO"]],[["liala inites inites"],["NO"]],[["etr lios lios"],["NO"]],[["etr lios liala"],["NO"]],[["etr lios etr"],["NO"]],[["etr lios etra"],["NO"]],[["etr lios initis"],["NO"]],[["etr lios inites"],["NO"]],[["etr liala lios"],["NO"]],[["etr liala liala"],["NO"]],[["etr liala etr"],["NO"]],[["etr liala etra"],["NO"]],[["etr liala initis"],["NO"]],[["etr liala inites"],["NO"]],[["etr etr lios"],["NO"]],[["etr etr liala"],["NO"]],[["etr etr etr"],["NO"]],[["etr etr etra"],["NO"]],[["etr etr initis"],["NO"]],[["etr etr inites"],["NO"]],[["etr etra lios"],["NO"]],[["etr etra liala"],["NO"]],[["etr etra etr"],["NO"]],[["etr etra etra"],["NO"]],[["etr etra initis"],["NO"]],[["etr etra inites"],["NO"]],[["etr initis lios"],["NO"]],[["etr initis liala"],["NO"]],[["etr initis etr"],["NO"]],[["etr initis etra"],["NO"]],[["etr initis initis"],["YES"]],[["etr initis inites"],["NO"]],[["etr inites lios"],["NO"]],[["etr inites liala"],["NO"]],[["etr inites etr"],["NO"]],[["etr inites etra"],["NO"]],[["etr inites initis"],["NO"]],[["etr inites inites"],["NO"]],[["etra lios lios"],["NO"]],[["etra lios liala"],["NO"]],[["etra lios etr"],["NO"]],[["etra lios etra"],["NO"]],[["etra lios initis"],["NO"]],[["etra lios inites"],["NO"]],[["etra liala lios"],["NO"]],[["etra liala liala"],["NO"]],[["etra liala etr"],["NO"]],[["etra liala etra"],["NO"]],[["etra liala initis"],["NO"]],[["etra liala inites"],["NO"]],[["etra etr lios"],["NO"]],[["etra etr liala"],["NO"]],[["etra etr etr"],["NO"]],[["etra etr etra"],["NO"]],[["etra etr initis"],["NO"]],[["etra etr inites"],["NO"]],[["etra etra lios"],["NO"]],[["etra etra liala"],["NO"]],[["etra etra etr"],["NO"]],[["etra etra etra"],["NO"]],[["etra etra initis"],["NO"]],[["etra etra inites"],["NO"]],[["etra initis lios"],["NO"]],[["etra initis liala"],["NO"]],[["etra initis etr"],["NO"]],[["etra initis etra"],["NO"]],[["etra initis initis"],["NO"]],[["etra initis inites"],["NO"]],[["etra inites lios"],["NO"]],[["etra inites liala"],["NO"]],[["etra inites etr"],["NO"]],[["etra inites etra"],["NO"]],[["etra inites initis"],["NO"]],[["etra inites inites"],["YES"]],[["initis lios lios"],["NO"]],[["initis lios liala"],["NO"]],[["initis lios etr"],["NO"]],[["initis lios etra"],["NO"]],[["initis lios initis"],["NO"]],[["initis lios inites"],["NO"]],[["initis liala lios"],["NO"]],[["initis liala liala"],["NO"]],[["initis liala etr"],["NO"]],[["initis liala etra"],["NO"]],[["initis liala initis"],["NO"]],[["initis liala inites"],["NO"]],[["initis etr lios"],["NO"]],[["initis etr liala"],["NO"]],[["initis etr etr"],["NO"]],[["initis etr etra"],["NO"]],[["initis etr initis"],["NO"]],[["initis etr inites"],["NO"]],[["initis etra lios"],["NO"]],[["initis etra liala"],["NO"]],[["initis etra etr"],["NO"]],[["initis etra etra"],["NO"]],[["initis etra initis"],["NO"]],[["initis etra inites"],["NO"]],[["initis initis lios"],["NO"]],[["initis initis liala"],["NO"]],[["initis initis etr"],["NO"]],[["initis initis etra"],["NO"]],[["initis initis initis"],["NO"]],[["initis initis inites"],["NO"]],[["initis inites lios"],["NO"]],[["initis inites liala"],["NO"]],[["initis inites etr"],["NO"]],[["initis inites etra"],["NO"]],[["initis inites initis"],["NO"]],[["initis inites inites"],["NO"]],[["inites lios lios"],["NO"]],[["inites lios liala"],["NO"]],[["inites lios etr"],["NO"]],[["inites lios etra"],["NO"]],[["inites lios initis"],["NO"]],[["inites lios inites"],["NO"]],[["inites liala lios"],["NO"]],[["inites liala liala"],["NO"]],[["inites liala etr"],["NO"]],[["inites liala etra"],["NO"]],[["inites liala initis"],["NO"]],[["inites liala inites"],["NO"]],[["inites etr lios"],["NO"]],[["inites etr liala"],["NO"]],[["inites etr etr"],["NO"]],[["inites etr etra"],["NO"]],[["inites etr initis"],["NO"]],[["inites etr inites"],["NO"]],[["inites etra lios"],["NO"]],[["inites etra liala"],["NO"]],[["inites etra etr"],["NO"]],[["inites etra etra"],["NO"]],[["inites etra initis"],["NO"]],[["inites etra inites"],["NO"]],[["inites initis lios"],["NO"]],[["inites initis liala"],["NO"]],[["inites initis etr"],["NO"]],[["inites initis etra"],["NO"]],[["inites initis initis"],["NO"]],[["inites initis inites"],["NO"]],[["inites inites lios"],["NO"]],[["inites inites liala"],["NO"]],[["inites inites etr"],["NO"]],[["inites inites etra"],["NO"]],[["inites inites initis"],["NO"]],[["inites inites inites"],["NO"]]]}} +{"instance_id":"pseudo_to_code_2k_79","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nf is an integer array of size 1005\ng is an integer array of size 1005\nin function find with parameter integer x and return integer\n return f[x] if f[x] equals x, otherwise return call find with f[x]\nend of the block\nin function clear\n for i = 0 to 1005 exclusive, set f[i] to i\nend of the block\ndefine the main function\n call memset with g, 0, call sizeof with g\n call clear\n n, m, k are integers\n read n, m, k\n i and j are integers\n for i = 0 to k exclusive\n declare an integer gov\n read gov\n assign 1 to g[gov]\n end of the block\n for i = 0 to m exclusive\n x and y are integers\n read x, y\n if g[x] equals 1\n assign x to f[call find with y]\n else if g[y] equals 1\n assign y to f[call find with x]\n else\n if g[call find with x] equals 1\n set f[call find with y] to f[call find with x]\n else if g[call find with y] equals 1\n set f[find call with x] to f[find call with y]\n else\n set f[find call with y] to f[find call with x]\n end of the block\n end of the block\n ans is an integer set to 0\n maxx is an integer set to 0\n temp is an integer\n for i = 1 to n inclusive\n assign 1 to temp\n if g[i]\n for j = 1 to n inclusive\n if i isn't equal to j and not g[j] and f[call find with j] equals i, increment temp\n end of the block\n add temp * (temp - 1) \/ 2 to ans\n set maxx to call max with maxx, temp\n end of the block\n end of the block\n cnt is an integer set to 0\n for i = 1 to n inclusive\n if not g[i] and not g[f[call find with i]], increment cnt\n end of the block\n add maxx * cnt to ans\n add cnt * (cnt - 1) \/ 2 to ans\n subtract m from ans\n display ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int f[1005];\nint g[1005];\nint find(int x) {\n return f[x] == x ? x : f[x] = find(f[x]);\n}\nvoid clear() {\n for (int i = 0; i < 1005; i++) f[i] = i;\n}\nint main() {\n memset(g, 0, sizeof(g));\n clear();\n int n, m, k;\n cin >> n >> m >> k;\n int i, j;\n for (i = 0; i < k; i++) {\n int gov;\n cin >> gov;\n g[gov] = 1;\n }\n for (i = 0; i < m; i++) {\n int x, y;\n cin >> x >> y;\n if (g[x] == 1)\n f[find(y)] = x;\n else if (g[y] == 1)\n f[find(x)] = y;\n else {\n if (g[find(x)] == 1)\n f[find(y)] = f[find(x)];\n else if (g[find(y)] == 1)\n f[find(x)] = f[find(y)];\n else\n f[find(y)] = f[find(x)];\n }\n }\n int ans = 0;\n int maxx = 0;\n int temp;\n for (i = 1; i <= n; i++) {\n temp = 1;\n if (g[i]) {\n for (j = 1; j <= n; j++) {\n if (i != j && !g[j] && f[find(j)] == i) { temp++; }\n }\n ans += temp * (temp - 1) \/ 2;\n maxx = max(maxx, temp);\n }\n }\n int cnt = 0;\n for (i = 1; i <= n; i++) {\n if (!g[i] && !g[f[find(i)]]) { cnt++; }\n }\n ans += maxx * cnt;\n ans += cnt * (cnt - 1) \/ 2;\n ans -= m;\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"744A","pseudocode":"f is an integer array of size 1005\ng is an integer array of size 1005\nin function find with parameter integer x and return integer\n return f[x] if f[x] equals x, otherwise return call find with f[x]\nend of the block\nin function clear\n for i = 0 to 1005 exclusive, set f[i] to i\nend of the block\ndefine the main function\n call memset with g, 0, call sizeof with g\n call clear\n n, m, k are integers\n read n, m, k\n i and j are integers\n for i = 0 to k exclusive\n declare an integer gov\n read gov\n assign 1 to g[gov]\n end of the block\n for i = 0 to m exclusive\n x and y are integers\n read x, y\n if g[x] equals 1\n assign x to f[call find with y]\n else if g[y] equals 1\n assign y to f[call find with x]\n else\n if g[call find with x] equals 1\n set f[call find with y] to f[call find with x]\n else if g[call find with y] equals 1\n set f[find call with x] to f[find call with y]\n else\n set f[find call with y] to f[find call with x]\n end of the block\n end of the block\n ans is an integer set to 0\n maxx is an integer set to 0\n temp is an integer\n for i = 1 to n inclusive\n assign 1 to temp\n if g[i]\n for j = 1 to n inclusive\n if i isn't equal to j and not g[j] and f[call find with j] equals i, increment temp\n end of the block\n add temp * (temp - 1) \/ 2 to ans\n set maxx to call max with maxx, temp\n end of the block\n end of the block\n cnt is an integer set to 0\n for i = 1 to n inclusive\n if not g[i] and not g[f[call find with i]], increment cnt\n end of the block\n add maxx * cnt to ans\n add cnt * (cnt - 1) \/ 2 to ans\n subtract m from ans\n display ans\n return to indicate successful execution\nend of the block","testcases":[[["4 1 2","1 3","1 2"],["2"]],[["3 3 1","2","1 2","1 3","2 3"],["0"]],[["10 3 2","1 10","1 2","1 3","4 5"],["33"]],[["1 0 1","1"],["0"]],[["1000 0 1","72"],["499500"]],[["24 38 2","4 13","7 1","24 1","2 8","17 2","2 18","22 2","23 3","5 9","21 5","6 7","6 19","6 20","11 7","7 20","13 8","16 8","9 10","14 9","21 9","12 10","10 22","23 10","17 11","11 24","20 12","13 16","13 23","15 14","17 14","14 20","19 16","17 20","17 23","18 22","18 23","22 19","21 20","23 24"],["215"]],[["10 30 1","4","1 2","3 1","4 1","1 6","1 8","10 1","2 4","2 7","3 4","3 5","7 3","3 9","10 3","5 4","6 4","7 4","9 4","10 4","6 5","5 8","9 5","10 5","6 7","9 6","10 6","7 8","9 7","10 7","9 8","10 8"],["15"]],[["10 13 2","5 10","2 1","1 4","2 3","2 8","3 4","7 3","4 6","8 4","4 9","6 7","6 9","10 6","7 8"],["23"]],[["10 10 3","2 5 6","1 3","4 1","4 3","5 3","3 9","8 4","9 4","5 10","8 7","10 8"],["18"]],[["10 5 3","1 5 9","1 3","1 8","2 3","8 4","5 7"],["17"]],[["6 4 2","1 4","1 2","2 3","4 5","5 6"],["2"]],[["7 8 2","1 4","1 2","2 3","4 5","4 6","4 7","5 6","5 7","6 7"],["1"]],[["5 2 3","1 3 4","1 5","2 4"],["0"]],[["5 3 2","1 2","2 3","2 4","1 5"],["1"]],[["9 5 2","1 5","1 2","2 3","3 4","5 6","6 7"],["13"]],[["6 4 1","1","2 3","3 4","4 5","5 6"],["11"]],[["6 4 2","1 5","1 2","2 3","3 4","5 6"],["3"]],[["7 3 3","1 5 6","1 2","1 3","6 7"],["4"]],[["5 2 2","1 2","1 3","2 4"],["2"]],[["11 7 2","1 4","1 2","1 3","4 5","4 6","5 6","9 10","1 11"],["24"]],[["20 4 5","1 3 9 10 20","5 6","1 2","7 9","4 10"],["89"]]]}} +{"instance_id":"pseudo_to_code_2k_80","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nf=array of 1005 int\ng=array of 1005 int\nfunction find (get int x, return int)\n if f[x] is x return x else (f[x] = find(f[x]), return f[x])\nend of the block\nfunction clear (no args, no return value)\n for i=0 to 1005 exclusive f[i]=i\nend of the block\ndefine the main function\n fill g with 0\n clear()\n n,m,k=int\n read n,m,k\n i,j=int\n for i=0 to k exclusive\n gov=int\n read gov\n g[gov]=1\n end of the block\n for i=0 to m exclusive\n x,y=int\n read x,y\n if g[x] is 1\n f[find(y)]=x\n else if g[y] is 1\n f[find(x)]=y\n else\n if g[find(x)] is 1\n f[find(y)]=f[find(x)]\n else if g[find(y)] is 1\n f[find(x)]=f[find(y)]\n else\n f[find(y)]=f[find(x)]\n end of the block\n end of the block\n ans=0\n maxx=0\n temp=int\n for i=1 to n inclusive\n temp=1\n if g[i]\n for j=1 to n inclusive\n if i is not j and not g[j] and f[find(j)] is i increment temp\n end of the block\n add temp*(temp-1)\/2 to ans\n maxx=max(maxx,temp)\n end of the block\n end of the block\n cnt=0\n for i=1 to n inclusive\n if not g[i] and not g[f[find(i)]] increment cnt\n end of the block\n add maxx*cnt to ans\n add cnt*(cnt-1)\/2 to ans\n subtract m from ans\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int f[1005];\nint g[1005];\nint find(int x) {\n return f[x] == x ? x : f[x] = find(f[x]);\n}\nvoid clear() {\n for (int i = 0; i < 1005; i++) f[i] = i;\n}\nint main() {\n memset(g, 0, sizeof(g));\n clear();\n int n, m, k;\n cin >> n >> m >> k;\n int i, j;\n for (i = 0; i < k; i++) {\n int gov;\n cin >> gov;\n g[gov] = 1;\n }\n for (i = 0; i < m; i++) {\n int x, y;\n cin >> x >> y;\n if (g[x] == 1)\n f[find(y)] = x;\n else if (g[y] == 1)\n f[find(x)] = y;\n else {\n if (g[find(x)] == 1)\n f[find(y)] = f[find(x)];\n else if (g[find(y)] == 1)\n f[find(x)] = f[find(y)];\n else\n f[find(y)] = f[find(x)];\n }\n }\n int ans = 0;\n int maxx = 0;\n int temp;\n for (i = 1; i <= n; i++) {\n temp = 1;\n if (g[i]) {\n for (j = 1; j <= n; j++) {\n if (i != j && !g[j] && f[find(j)] == i) { temp++; }\n }\n ans += temp * (temp - 1) \/ 2;\n maxx = max(maxx, temp);\n }\n }\n int cnt = 0;\n for (i = 1; i <= n; i++) {\n if (!g[i] && !g[f[find(i)]]) { cnt++; }\n }\n ans += maxx * cnt;\n ans += cnt * (cnt - 1) \/ 2;\n ans -= m;\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"744A","pseudocode":"f=array of 1005 int\ng=array of 1005 int\nfunction find (get int x, return int)\n if f[x] is x return x else (f[x] = find(f[x]), return f[x])\nend of the block\nfunction clear (no args, no return value)\n for i=0 to 1005 exclusive f[i]=i\nend of the block\ndefine the main function\n fill g with 0\n clear()\n n,m,k=int\n read n,m,k\n i,j=int\n for i=0 to k exclusive\n gov=int\n read gov\n g[gov]=1\n end of the block\n for i=0 to m exclusive\n x,y=int\n read x,y\n if g[x] is 1\n f[find(y)]=x\n else if g[y] is 1\n f[find(x)]=y\n else\n if g[find(x)] is 1\n f[find(y)]=f[find(x)]\n else if g[find(y)] is 1\n f[find(x)]=f[find(y)]\n else\n f[find(y)]=f[find(x)]\n end of the block\n end of the block\n ans=0\n maxx=0\n temp=int\n for i=1 to n inclusive\n temp=1\n if g[i]\n for j=1 to n inclusive\n if i is not j and not g[j] and f[find(j)] is i increment temp\n end of the block\n add temp*(temp-1)\/2 to ans\n maxx=max(maxx,temp)\n end of the block\n end of the block\n cnt=0\n for i=1 to n inclusive\n if not g[i] and not g[f[find(i)]] increment cnt\n end of the block\n add maxx*cnt to ans\n add cnt*(cnt-1)\/2 to ans\n subtract m from ans\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["4 1 2","1 3","1 2"],["2"]],[["3 3 1","2","1 2","1 3","2 3"],["0"]],[["10 3 2","1 10","1 2","1 3","4 5"],["33"]],[["1 0 1","1"],["0"]],[["1000 0 1","72"],["499500"]],[["24 38 2","4 13","7 1","24 1","2 8","17 2","2 18","22 2","23 3","5 9","21 5","6 7","6 19","6 20","11 7","7 20","13 8","16 8","9 10","14 9","21 9","12 10","10 22","23 10","17 11","11 24","20 12","13 16","13 23","15 14","17 14","14 20","19 16","17 20","17 23","18 22","18 23","22 19","21 20","23 24"],["215"]],[["10 30 1","4","1 2","3 1","4 1","1 6","1 8","10 1","2 4","2 7","3 4","3 5","7 3","3 9","10 3","5 4","6 4","7 4","9 4","10 4","6 5","5 8","9 5","10 5","6 7","9 6","10 6","7 8","9 7","10 7","9 8","10 8"],["15"]],[["10 13 2","5 10","2 1","1 4","2 3","2 8","3 4","7 3","4 6","8 4","4 9","6 7","6 9","10 6","7 8"],["23"]],[["10 10 3","2 5 6","1 3","4 1","4 3","5 3","3 9","8 4","9 4","5 10","8 7","10 8"],["18"]],[["10 5 3","1 5 9","1 3","1 8","2 3","8 4","5 7"],["17"]],[["6 4 2","1 4","1 2","2 3","4 5","5 6"],["2"]],[["7 8 2","1 4","1 2","2 3","4 5","4 6","4 7","5 6","5 7","6 7"],["1"]],[["5 2 3","1 3 4","1 5","2 4"],["0"]],[["5 3 2","1 2","2 3","2 4","1 5"],["1"]],[["9 5 2","1 5","1 2","2 3","3 4","5 6","6 7"],["13"]],[["6 4 1","1","2 3","3 4","4 5","5 6"],["11"]],[["6 4 2","1 5","1 2","2 3","3 4","5 6"],["3"]],[["7 3 3","1 5 6","1 2","1 3","6 7"],["4"]],[["5 2 2","1 2","1 3","2 4"],["2"]],[["11 7 2","1 4","1 2","1 3","4 5","4 6","5 6","9 10","1 11"],["24"]],[["20 4 5","1 3 9 10 20","5 6","1 2","7 9","4 10"],["89"]]]}} +{"instance_id":"pseudo_to_code_2k_81","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare new array of integers fa with 202002 elements\nsum is a new array of integers with 202002 elements\ncreate and array of integers c with size 202002\nfunction max with int arguments a and b that returns int\n if a is greater than b\n return a\n else\n return b as a result\nend of the block\nint function findfa with int argument x\n if fa[x] is equal to x\n return x\n else\n return the result of findfa(fa[x])\nend of the block\nfunction U with int arguments x and y\n rx is a new integer variable = findfa(x)\n declare integer ry = findfa(y)\n if rx is not equal to ry\n set fa[rx] to ry\n add sum[rx] to sum[ry]\n end of the block\nend of the block\nvis is an array of booleans with size 202002\ndeclare vector of integers called vec\ndefine the main function\n create integers n, m and k\n read variables n, m and k from the input\n remove all elements from vec\n for i from 0 to n inclusive\n assign i to fa[i]\n assign 1 to sum[i]\n end of the block\n for i = 0 to k exclusive, read from the input to c[i]\n declare new ints x and y\n for i = 0 to m exclusive\n read user input to x and y\n call U of x and y\n end of the block\n set first sizeof(vis) bytes at the pointer vis to 0\n for i = 0 to k exclusive, change the value of vis[findfa(c[i])] to 1\n create integer variable with name MAX with value -1\n create new long long called ans with value 0\n start for loop from i = 1 to n inclusive incrementing i\n if fa[i] is equal to i\n if vis[i] is equal to 1\n set MAX to max of MAX and sum[i]\n else\n push sum[i] to the vec\n add sum[i] * (sum[i] - 1) \/ 2 to ans\n end of the block\n end of the block\n declare integer len with value length of vec\n start for loop from i = 0 to len exclusive incrementing i\n start for loop from j = i + 1 to len exclusive, changing ans to the sum of ans and vec[i] * vec[j] on each iteration\n change ans to ans + vec[i] * MAX\n end of the block\n change ans to ans - m\n if ans is greater than 0\n print ans\n else\n print \"0\" to the standard output\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int fa[202002];\nint sum[202002];\nint c[202002];\nint max(int a, int b) {\n if (a > b)\n return a;\n else\n return b;\n}\nint findfa(int x) {\n if (fa[x] == x)\n return x;\n else\n return findfa(fa[x]);\n}\nvoid U(int x, int y) {\n int rx = findfa(x);\n int ry = findfa(y);\n if (rx != ry) {\n fa[rx] = ry;\n sum[ry] += sum[rx];\n }\n}\nbool vis[202002];\nvector vec;\nint main() {\n int n, m, k;\n cin >> n >> m >> k;\n vec.clear();\n for (int i = 0; i <= n; i++) {\n fa[i] = i;\n sum[i] = 1;\n }\n for (int i = 0; i < k; i++) cin >> c[i];\n int x, y;\n for (int i = 0; i < m; i++) {\n cin >> x >> y;\n U(x, y);\n }\n memset(vis, 0, sizeof(vis));\n for (int i = 0; i < k; i++) vis[findfa(c[i])] = 1;\n int MAX = -1;\n long long ans = 0;\n for (int i = 1; i <= n; i++) {\n if (fa[i] == i) {\n if (vis[i] == 1)\n MAX = max(MAX, sum[i]);\n else\n vec.push_back(sum[i]);\n ans += sum[i] * (sum[i] - 1) \/ 2;\n }\n }\n int len = vec.size();\n for (int i = 0; i < len; i++) {\n for (int j = i + 1; j < len; j++) { ans += vec[i] * vec[j]; }\n ans += vec[i] * MAX;\n }\n ans = ans - m;\n if (ans > 0)\n cout << ans << endl;\n else\n cout << \"0\" << endl;\n return 0;\n}","item":{"problem_id":"744A","pseudocode":"declare new array of integers fa with 202002 elements\nsum is a new array of integers with 202002 elements\ncreate and array of integers c with size 202002\nfunction max with int arguments a and b that returns int\n if a is greater than b\n return a\n else\n return b as a result\nend of the block\nint function findfa with int argument x\n if fa[x] is equal to x\n return x\n else\n return the result of findfa(fa[x])\nend of the block\nfunction U with int arguments x and y\n rx is a new integer variable = findfa(x)\n declare integer ry = findfa(y)\n if rx is not equal to ry\n set fa[rx] to ry\n add sum[rx] to sum[ry]\n end of the block\nend of the block\nvis is an array of booleans with size 202002\ndeclare vector of integers called vec\ndefine the main function\n create integers n, m and k\n read variables n, m and k from the input\n remove all elements from vec\n for i from 0 to n inclusive\n assign i to fa[i]\n assign 1 to sum[i]\n end of the block\n for i = 0 to k exclusive, read from the input to c[i]\n declare new ints x and y\n for i = 0 to m exclusive\n read user input to x and y\n call U of x and y\n end of the block\n set first sizeof(vis) bytes at the pointer vis to 0\n for i = 0 to k exclusive, change the value of vis[findfa(c[i])] to 1\n create integer variable with name MAX with value -1\n create new long long called ans with value 0\n start for loop from i = 1 to n inclusive incrementing i\n if fa[i] is equal to i\n if vis[i] is equal to 1\n set MAX to max of MAX and sum[i]\n else\n push sum[i] to the vec\n add sum[i] * (sum[i] - 1) \/ 2 to ans\n end of the block\n end of the block\n declare integer len with value length of vec\n start for loop from i = 0 to len exclusive incrementing i\n start for loop from j = i + 1 to len exclusive, changing ans to the sum of ans and vec[i] * vec[j] on each iteration\n change ans to ans + vec[i] * MAX\n end of the block\n change ans to ans - m\n if ans is greater than 0\n print ans\n else\n print \"0\" to the standard output\n return to indicate successful execution\nend of the block","testcases":[[["4 1 2","1 3","1 2"],["2"]],[["3 3 1","2","1 2","1 3","2 3"],["0"]],[["10 3 2","1 10","1 2","1 3","4 5"],["33"]],[["1 0 1","1"],["0"]],[["1000 0 1","72"],["499500"]],[["24 38 2","4 13","7 1","24 1","2 8","17 2","2 18","22 2","23 3","5 9","21 5","6 7","6 19","6 20","11 7","7 20","13 8","16 8","9 10","14 9","21 9","12 10","10 22","23 10","17 11","11 24","20 12","13 16","13 23","15 14","17 14","14 20","19 16","17 20","17 23","18 22","18 23","22 19","21 20","23 24"],["215"]],[["10 30 1","4","1 2","3 1","4 1","1 6","1 8","10 1","2 4","2 7","3 4","3 5","7 3","3 9","10 3","5 4","6 4","7 4","9 4","10 4","6 5","5 8","9 5","10 5","6 7","9 6","10 6","7 8","9 7","10 7","9 8","10 8"],["15"]],[["10 13 2","5 10","2 1","1 4","2 3","2 8","3 4","7 3","4 6","8 4","4 9","6 7","6 9","10 6","7 8"],["23"]],[["10 10 3","2 5 6","1 3","4 1","4 3","5 3","3 9","8 4","9 4","5 10","8 7","10 8"],["18"]],[["10 5 3","1 5 9","1 3","1 8","2 3","8 4","5 7"],["17"]],[["6 4 2","1 4","1 2","2 3","4 5","5 6"],["2"]],[["7 8 2","1 4","1 2","2 3","4 5","4 6","4 7","5 6","5 7","6 7"],["1"]],[["5 2 3","1 3 4","1 5","2 4"],["0"]],[["5 3 2","1 2","2 3","2 4","1 5"],["1"]],[["9 5 2","1 5","1 2","2 3","3 4","5 6","6 7"],["13"]],[["6 4 1","1","2 3","3 4","4 5","5 6"],["11"]],[["6 4 2","1 5","1 2","2 3","3 4","5 6"],["3"]],[["7 3 3","1 5 6","1 2","1 3","6 7"],["4"]],[["5 2 2","1 2","1 3","2 4"],["2"]],[["11 7 2","1 4","1 2","1 3","4 5","4 6","5 6","9 10","1 11"],["24"]],[["20 4 5","1 3 9 10 20","5 6","1 2","7 9","4 10"],["89"]]]}} +{"instance_id":"pseudo_to_code_2k_82","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nv = vector of long integers of size 1100\nvisited = array of boolean values of length 1100\nlet ans be a long integer with ans = 0\nlet edges be a long integer with edges = 0\nlet edge be a long integer with edge = 0\nlet dfs be a long integer function that accepts long integer values x, parentu\n visited[x] is equal to true\n let n be a long integer with n = 1\n edges = edges + length of v[x]\n for long integer i = 0 to length of v[x] exclusive,\n if not visited[v[x][i]], n = n + depth first search of v[x][i], x\n end of the block\n return the value of n\nend of the block\ndefine the main function\n let n, m, k, x, y be long integers\n read n, m, k\n home = vector of long integers\n for long integer i = 0 to k exclusive\n read x\n push to back x in home\n end of the block\n for long integer i = 0 to m exclusive\n read x, y\n push to back y in v[x]\n push to back x in v[y]\n end of the block\n let sum be a long integer with sum = 0\n let num be a long integer with num = 0\n for long integer i = 0 to k exclusive\n if not visited[home[i]]\n edges is equal to 0\n let node be a long integer with node is equal to depth first search of home[i], 0\n edges is equal to edges \/ 2\n increment edge by edges\n num is equal to maximum of num and node\n ans is equal to ans + ((node - 1) * (node)) \/ 2 - edges\n increment sum by node\n end of the block\n end of the block\n ans is equal to ans + (n - sum) * num\n ans is equal to ans + ((n - sum - 1) * (n - sum)) \/ 2 - (m - edge)\n print ans and newline\nend of the block\n\n[CODE]:","reference_output":"vector v[1100];\nbool visited[1100];\nlong long int ans = 0;\nlong long int edges = 0;\nlong long int edge = 0;\nlong long int dfs(long long int x, long long int parent) {\n visited[x] = true;\n long long int n = 1;\n edges += v[x].size();\n for (long long int i = 0; i < v[x].size(); i++) {\n if (!visited[v[x][i]]) n += dfs(v[x][i], x);\n }\n return n;\n}\nint main() {\n long long int n, m, k, x, y;\n cin >> n >> m >> k;\n vector home;\n for (long long int i = 0; i < k; i++) {\n cin >> x;\n home.push_back(x);\n }\n for (long long int i = 0; i < m; i++) {\n cin >> x >> y;\n v[x].push_back(y);\n v[y].push_back(x);\n }\n long long int sum = 0;\n long long int num = 0;\n for (long long int i = 0; i < k; i++) {\n if (!visited[home[i]]) {\n edges = 0;\n long long int node = dfs(home[i], 0);\n edges \/= 2;\n edge += edges;\n num = max(num, node);\n ans += ((node - 1) * (node)) \/ 2 - edges;\n sum += node;\n }\n }\n ans += (n - sum) * num;\n ans += ((n - sum - 1) * (n - sum)) \/ 2 - (m - edge);\n cout << ans << endl;\n}","item":{"problem_id":"744A","pseudocode":"v = vector of long integers of size 1100\nvisited = array of boolean values of length 1100\nlet ans be a long integer with ans = 0\nlet edges be a long integer with edges = 0\nlet edge be a long integer with edge = 0\nlet dfs be a long integer function that accepts long integer values x, parentu\n visited[x] is equal to true\n let n be a long integer with n = 1\n edges = edges + length of v[x]\n for long integer i = 0 to length of v[x] exclusive,\n if not visited[v[x][i]], n = n + depth first search of v[x][i], x\n end of the block\n return the value of n\nend of the block\ndefine the main function\n let n, m, k, x, y be long integers\n read n, m, k\n home = vector of long integers\n for long integer i = 0 to k exclusive\n read x\n push to back x in home\n end of the block\n for long integer i = 0 to m exclusive\n read x, y\n push to back y in v[x]\n push to back x in v[y]\n end of the block\n let sum be a long integer with sum = 0\n let num be a long integer with num = 0\n for long integer i = 0 to k exclusive\n if not visited[home[i]]\n edges is equal to 0\n let node be a long integer with node is equal to depth first search of home[i], 0\n edges is equal to edges \/ 2\n increment edge by edges\n num is equal to maximum of num and node\n ans is equal to ans + ((node - 1) * (node)) \/ 2 - edges\n increment sum by node\n end of the block\n end of the block\n ans is equal to ans + (n - sum) * num\n ans is equal to ans + ((n - sum - 1) * (n - sum)) \/ 2 - (m - edge)\n print ans and newline\nend of the block","testcases":[[["4 1 2","1 3","1 2"],["2"]],[["3 3 1","2","1 2","1 3","2 3"],["0"]],[["10 3 2","1 10","1 2","1 3","4 5"],["33"]],[["1 0 1","1"],["0"]],[["1000 0 1","72"],["499500"]],[["24 38 2","4 13","7 1","24 1","2 8","17 2","2 18","22 2","23 3","5 9","21 5","6 7","6 19","6 20","11 7","7 20","13 8","16 8","9 10","14 9","21 9","12 10","10 22","23 10","17 11","11 24","20 12","13 16","13 23","15 14","17 14","14 20","19 16","17 20","17 23","18 22","18 23","22 19","21 20","23 24"],["215"]],[["10 30 1","4","1 2","3 1","4 1","1 6","1 8","10 1","2 4","2 7","3 4","3 5","7 3","3 9","10 3","5 4","6 4","7 4","9 4","10 4","6 5","5 8","9 5","10 5","6 7","9 6","10 6","7 8","9 7","10 7","9 8","10 8"],["15"]],[["10 13 2","5 10","2 1","1 4","2 3","2 8","3 4","7 3","4 6","8 4","4 9","6 7","6 9","10 6","7 8"],["23"]],[["10 10 3","2 5 6","1 3","4 1","4 3","5 3","3 9","8 4","9 4","5 10","8 7","10 8"],["18"]],[["10 5 3","1 5 9","1 3","1 8","2 3","8 4","5 7"],["17"]],[["6 4 2","1 4","1 2","2 3","4 5","5 6"],["2"]],[["7 8 2","1 4","1 2","2 3","4 5","4 6","4 7","5 6","5 7","6 7"],["1"]],[["5 2 3","1 3 4","1 5","2 4"],["0"]],[["5 3 2","1 2","2 3","2 4","1 5"],["1"]],[["9 5 2","1 5","1 2","2 3","3 4","5 6","6 7"],["13"]],[["6 4 1","1","2 3","3 4","4 5","5 6"],["11"]],[["6 4 2","1 5","1 2","2 3","3 4","5 6"],["3"]],[["7 3 3","1 5 6","1 2","1 3","6 7"],["4"]],[["5 2 2","1 2","1 3","2 4"],["2"]],[["11 7 2","1 4","1 2","1 3","4 5","4 6","5 6","9 10","1 11"],["24"]],[["20 4 5","1 3 9 10 20","5 6","1 2","7 9","4 10"],["89"]]]}} +{"instance_id":"pseudo_to_code_2k_83","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nf = int array of size 1000\nin function find taking int x and returning int\n if f[x] is x\n return x\n else\n return find of f[x]\nend of the block\nin function unionn taking int a, int b\n x = int with x = find of a\n y = int with y = find of b\n if x is not y set f[x] to y\nend of the block\ndefine the main function\n t = int\n n, m, k, x, y = int\n s, num = int array of size 1000 each\n loop while reading n then m then k\n set all values of num to 0\n for i = 1 to n inclusive set f[i] to i\n for i = 1 to k inclusive read s[i]\n for i = 0 to m\n read x then y\n call unionn of x, y\n end of the block\n for i = 1 to n inclusive increment num[find of i]\n Max, sum, ss = int with Max = 0 and sum = 0 and ss = n\n for i = 1 to k inclusive\n set num[s[i]] to num[find of s[i]]\n set Max to max of Max, num[s[i]]\n decrement ss by num[s[i]]\n increment sum by (num[s[i]]) * (num[s[i]] - 1) \/ 2\n end of the block\n increment sum by (ss + Max) * (ss + Max - 1) \/ 2\n decrement sum by Max * (Max - 1) \/ 2 + m\n print sum\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int f[1000];\nint find(int x) {\n if (f[x] == x)\n return x;\n else\n return find(f[x]);\n}\nvoid unionn(int a, int b) {\n int x = find(a);\n int y = find(b);\n if (x != y) f[x] = y;\n}\nint main() {\n int t;\n int n, m, k, x, y;\n int s[1000], num[1000];\n while (cin >> n >> m >> k) {\n memset(num, 0, sizeof(num));\n for (int i = 1; i <= n; i++) f[i] = i;\n for (int i = 1; i <= k; i++) cin >> s[i];\n for (int i = 0; i < m; i++) {\n cin >> x >> y;\n unionn(x, y);\n }\n for (int i = 1; i <= n; i++) num[find(i)]++;\n int Max = 0, sum = 0, ss = n;\n for (int i = 1; i <= k; i++) {\n num[s[i]] = num[find(s[i])];\n Max = max(Max, num[s[i]]);\n ss -= num[s[i]];\n sum += (num[s[i]]) * (num[s[i]] - 1) \/ 2;\n }\n sum += (ss + Max) * (ss + Max - 1) \/ 2;\n sum -= Max * (Max - 1) \/ 2 + m;\n cout << sum << endl;\n }\n return 0;\n}","item":{"problem_id":"744A","pseudocode":"f = int array of size 1000\nin function find taking int x and returning int\n if f[x] is x\n return x\n else\n return find of f[x]\nend of the block\nin function unionn taking int a, int b\n x = int with x = find of a\n y = int with y = find of b\n if x is not y set f[x] to y\nend of the block\ndefine the main function\n t = int\n n, m, k, x, y = int\n s, num = int array of size 1000 each\n loop while reading n then m then k\n set all values of num to 0\n for i = 1 to n inclusive set f[i] to i\n for i = 1 to k inclusive read s[i]\n for i = 0 to m\n read x then y\n call unionn of x, y\n end of the block\n for i = 1 to n inclusive increment num[find of i]\n Max, sum, ss = int with Max = 0 and sum = 0 and ss = n\n for i = 1 to k inclusive\n set num[s[i]] to num[find of s[i]]\n set Max to max of Max, num[s[i]]\n decrement ss by num[s[i]]\n increment sum by (num[s[i]]) * (num[s[i]] - 1) \/ 2\n end of the block\n increment sum by (ss + Max) * (ss + Max - 1) \/ 2\n decrement sum by Max * (Max - 1) \/ 2 + m\n print sum\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["4 1 2","1 3","1 2"],["2"]],[["3 3 1","2","1 2","1 3","2 3"],["0"]],[["10 3 2","1 10","1 2","1 3","4 5"],["33"]],[["1 0 1","1"],["0"]],[["1000 0 1","72"],["499500"]],[["24 38 2","4 13","7 1","24 1","2 8","17 2","2 18","22 2","23 3","5 9","21 5","6 7","6 19","6 20","11 7","7 20","13 8","16 8","9 10","14 9","21 9","12 10","10 22","23 10","17 11","11 24","20 12","13 16","13 23","15 14","17 14","14 20","19 16","17 20","17 23","18 22","18 23","22 19","21 20","23 24"],["215"]],[["10 30 1","4","1 2","3 1","4 1","1 6","1 8","10 1","2 4","2 7","3 4","3 5","7 3","3 9","10 3","5 4","6 4","7 4","9 4","10 4","6 5","5 8","9 5","10 5","6 7","9 6","10 6","7 8","9 7","10 7","9 8","10 8"],["15"]],[["10 13 2","5 10","2 1","1 4","2 3","2 8","3 4","7 3","4 6","8 4","4 9","6 7","6 9","10 6","7 8"],["23"]],[["10 10 3","2 5 6","1 3","4 1","4 3","5 3","3 9","8 4","9 4","5 10","8 7","10 8"],["18"]],[["10 5 3","1 5 9","1 3","1 8","2 3","8 4","5 7"],["17"]],[["6 4 2","1 4","1 2","2 3","4 5","5 6"],["2"]],[["7 8 2","1 4","1 2","2 3","4 5","4 6","4 7","5 6","5 7","6 7"],["1"]],[["5 2 3","1 3 4","1 5","2 4"],["0"]],[["5 3 2","1 2","2 3","2 4","1 5"],["1"]],[["9 5 2","1 5","1 2","2 3","3 4","5 6","6 7"],["13"]],[["6 4 1","1","2 3","3 4","4 5","5 6"],["11"]],[["6 4 2","1 5","1 2","2 3","3 4","5 6"],["3"]],[["7 3 3","1 5 6","1 2","1 3","6 7"],["4"]],[["5 2 2","1 2","1 3","2 4"],["2"]],[["11 7 2","1 4","1 2","1 3","4 5","4 6","5 6","9 10","1 11"],["24"]],[["20 4 5","1 3 9 10 20","5 6","1 2","7 9","4 10"],["89"]]]}} +{"instance_id":"pseudo_to_code_2k_84","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate int array num of size 1005\nmake integer array r of size 1005\ndeclare fast taking in int x and returning int\n if r[x] is equal to x, return x\n return r[x] = find(r[x])\nend of the block\ndeclare setunion taking in ints x and y\n create int rx = find(x)\n make int ry = find(y)\n if rx is not equal to ry, set r[rx] to ry\nend of the block\ndefine the main function\n create ints n, m, and k\n make int array gov of size 1005\n make ints x and y\n read n, m, and k and while they are truthy\n set all contents of num to 0\n for i = 0 to n, set r[i] to i\n for i = 0 to k, read gov[i]\n for i = 1 to m\n read x and y\n call setunion with arguments x and y\n end of the block\n for i = 1 to n, increment num[find(i)]\n create int maxs = 0\n make integer left = n\n let int re = 0\n for i = 1 to k\n set num[gov[i]] to num[find(gov[i])\n set maxs to max of maxs and num[gov[i]]\n subtract num[gov[i]] from left\n add (num[gov[i]] - 1) * num[gov[i]] \/ 2 to re\n end of the block\n set re to re + (left + maxs) * (left + maxs - 1) \/ 2\n set re to re - maxs * (maxs - 1) \/ 2 + m\n print re\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int num[1005];\nint r[1005];\nint find(int x) {\n if (r[x] == x) return x;\n return r[x] = find(r[x]);\n}\nvoid setunion(int x, int y) {\n int rx = find(x);\n int ry = find(y);\n if (rx != ry) r[rx] = ry;\n}\nint main() {\n int n, m, k;\n int gov[1005];\n int x, y;\n while (cin >> n >> m >> k) {\n memset(num, 0, sizeof(num));\n for (int i = 0; i <= n; i++) { r[i] = i; }\n for (int i = 1; i <= k; i++) { cin >> gov[i]; }\n for (int i = 1; i <= m; i++) {\n cin >> x >> y;\n setunion(x, y);\n }\n for (int i = 1; i <= n; i++) { num[find(i)]++; }\n int maxs = 0;\n int left = n;\n int re = 0;\n for (int i = 1; i <= k; i++) {\n num[gov[i]] = num[find(gov[i])];\n maxs = max(maxs, num[gov[i]]);\n left -= num[gov[i]];\n re += (num[gov[i]] - 1) * num[gov[i]] \/ 2;\n }\n re += (left + maxs) * (left + maxs - 1) \/ 2;\n re -= maxs * (maxs - 1) \/ 2 + m;\n cout << re << endl;\n }\n return 0;\n}","item":{"problem_id":"744A","pseudocode":"create int array num of size 1005\nmake integer array r of size 1005\ndeclare fast taking in int x and returning int\n if r[x] is equal to x, return x\n return r[x] = find(r[x])\nend of the block\ndeclare setunion taking in ints x and y\n create int rx = find(x)\n make int ry = find(y)\n if rx is not equal to ry, set r[rx] to ry\nend of the block\ndefine the main function\n create ints n, m, and k\n make int array gov of size 1005\n make ints x and y\n read n, m, and k and while they are truthy\n set all contents of num to 0\n for i = 0 to n, set r[i] to i\n for i = 0 to k, read gov[i]\n for i = 1 to m\n read x and y\n call setunion with arguments x and y\n end of the block\n for i = 1 to n, increment num[find(i)]\n create int maxs = 0\n make integer left = n\n let int re = 0\n for i = 1 to k\n set num[gov[i]] to num[find(gov[i])\n set maxs to max of maxs and num[gov[i]]\n subtract num[gov[i]] from left\n add (num[gov[i]] - 1) * num[gov[i]] \/ 2 to re\n end of the block\n set re to re + (left + maxs) * (left + maxs - 1) \/ 2\n set re to re - maxs * (maxs - 1) \/ 2 + m\n print re\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["4 1 2","1 3","1 2"],["2"]],[["3 3 1","2","1 2","1 3","2 3"],["0"]],[["10 3 2","1 10","1 2","1 3","4 5"],["33"]],[["1 0 1","1"],["0"]],[["1000 0 1","72"],["499500"]],[["24 38 2","4 13","7 1","24 1","2 8","17 2","2 18","22 2","23 3","5 9","21 5","6 7","6 19","6 20","11 7","7 20","13 8","16 8","9 10","14 9","21 9","12 10","10 22","23 10","17 11","11 24","20 12","13 16","13 23","15 14","17 14","14 20","19 16","17 20","17 23","18 22","18 23","22 19","21 20","23 24"],["215"]],[["10 30 1","4","1 2","3 1","4 1","1 6","1 8","10 1","2 4","2 7","3 4","3 5","7 3","3 9","10 3","5 4","6 4","7 4","9 4","10 4","6 5","5 8","9 5","10 5","6 7","9 6","10 6","7 8","9 7","10 7","9 8","10 8"],["15"]],[["10 13 2","5 10","2 1","1 4","2 3","2 8","3 4","7 3","4 6","8 4","4 9","6 7","6 9","10 6","7 8"],["23"]],[["10 10 3","2 5 6","1 3","4 1","4 3","5 3","3 9","8 4","9 4","5 10","8 7","10 8"],["18"]],[["10 5 3","1 5 9","1 3","1 8","2 3","8 4","5 7"],["17"]],[["6 4 2","1 4","1 2","2 3","4 5","5 6"],["2"]],[["7 8 2","1 4","1 2","2 3","4 5","4 6","4 7","5 6","5 7","6 7"],["1"]],[["5 2 3","1 3 4","1 5","2 4"],["0"]],[["5 3 2","1 2","2 3","2 4","1 5"],["1"]],[["9 5 2","1 5","1 2","2 3","3 4","5 6","6 7"],["13"]],[["6 4 1","1","2 3","3 4","4 5","5 6"],["11"]],[["6 4 2","1 5","1 2","2 3","3 4","5 6"],["3"]],[["7 3 3","1 5 6","1 2","1 3","6 7"],["4"]],[["5 2 2","1 2","1 3","2 4"],["2"]],[["11 7 2","1 4","1 2","1 3","4 5","4 6","5 6","9 10","1 11"],["24"]],[["20 4 5","1 3 9 10 20","5 6","1 2","7 9","4 10"],["89"]]]}} +{"instance_id":"pseudo_to_code_2k_85","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nedges=array of 1004 by 1004 int\ndegree=array of 1004 int\nfunction dfs (get int index, int cap, pointer to int visited, pointer to int numedges, pointer to int numver, int n, return nothing)\n visited[index]=1\n for i=0 to n exclusive\n if edges[index][i] is 1\n if visited[i] is 0\n add degree[i] to numedges[cap]\n increment numver[cap]\n dfs(i, cap, visited, numedges, numver, n)\n end of the block\n end of the block\n end of the block\nend of the block\ndefine the main function\n n,m,k=int\n read n,m,k\n cap=array of k int\n for i=0 to k exclusive\n read cap[i]\n decrement cap[i]\n end of the block\n a,b=int\n visited = array of n int\n for i=0 to n exclusive\n visited[i]=0\n degree[i]=0\n end of the block\n for i=0 to m exclusive\n read a,b\n decrement a\n decrement b\n edges[a][b]=1\n edges[b][a]=1\n increment degree[a]\n increment degree[b]\n end of the block\n numedges = array of k+1 int\n numver = array of k+1 int\n for i=0 to k-1 exclusive\n numedges[i]=0\n numver[i]=0\n end of the block\n count=0\n for i=0 to k exclusive\n dfs(cap[i], i, visited, numedges, numver, n)\n add degree[cap[i]] to numedges[i]\n increment numver[i]\n end of the block\n for i=0 to n exclusive\n if visited[i] is 0\n dfs(i, k, visited, numedges, numver, n)\n add degree[i] to numedges[k]\n increment numver[k]\n end of the block\n end of the block\n maxm=0\n maxindex=0\n ans=0\n for i=0 to k exclusive\n if numver[i] > maxm\n maxm=numver[i]\n maxindex=i\n end of the block\n end of the block\n for i=0 to k exclusive\n if i is maxindex continue\n xx=numver[i]*(numver[i]-1)\n divide xx by 2\n add (xx-numedges[i]\/2) to ans\n end of the block\n xx=numver[maxindex]+numver[k]\n x2=(xx*(xx-1))\/2\n subtract numedges[maxindex]\/2 from x2\n subtract numedges[k]\/2 from x2\n add x2 to ans\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int edges[1004][1004];\nint degree[1004];\nvoid dfs(int index, int cap, int *visited, int *numedges, int *numver, int n) {\n visited[index] = 1;\n for (int i = 0; i < n; i++) {\n if (edges[index][i] == 1) {\n if (visited[i] == 0) {\n numedges[cap] += degree[i];\n numver[cap]++;\n dfs(i, cap, visited, numedges, numver, n);\n }\n }\n }\n}\nint main() {\n int n, m, k;\n cin >> n >> m >> k;\n int cap[k];\n for (int i = 0; i < k; i++) {\n cin >> cap[i];\n cap[i]--;\n }\n int a, b;\n int visited[n];\n for (int i = 0; i < n; i++) {\n visited[i] = 0;\n degree[i] = 0;\n }\n for (int i = 0; i < m; i++) {\n cin >> a >> b;\n a--;\n b--;\n edges[a][b] = 1;\n edges[b][a] = 1;\n degree[a]++;\n degree[b]++;\n }\n int numedges[k + 1];\n int numver[k + 1];\n for (int i = 0; i < k + 1; i++) {\n numedges[i] = 0;\n numver[i] = 0;\n }\n int count = 0;\n for (int i = 0; i < k; i++) {\n dfs(cap[i], i, visited, numedges, numver, n);\n numedges[i] += degree[cap[i]];\n numver[i] += 1;\n }\n for (int i = 0; i < n; i++) {\n if (visited[i] == 0) {\n dfs(i, k, visited, numedges, numver, n);\n numedges[k] += degree[i];\n numver[k]++;\n }\n }\n int maxm = 0;\n int maxindex = 0;\n long long ans = 0;\n for (int i = 0; i < k; i++) {\n if (numver[i] > maxm) {\n maxm = numver[i];\n maxindex = i;\n }\n }\n for (int i = 0; i < k; i++) {\n if (i == maxindex) continue;\n long long xx = numver[i] * (numver[i] - 1);\n xx \/= 2;\n ans += (xx - numedges[i] \/ 2);\n }\n long long xx = numver[maxindex] + numver[k];\n long long x2 = (xx * (xx - 1)) \/ 2;\n x2 -= numedges[maxindex] \/ 2;\n x2 -= numedges[k] \/ 2;\n ans += x2;\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"744A","pseudocode":"edges=array of 1004 by 1004 int\ndegree=array of 1004 int\nfunction dfs (get int index, int cap, pointer to int visited, pointer to int numedges, pointer to int numver, int n, return nothing)\n visited[index]=1\n for i=0 to n exclusive\n if edges[index][i] is 1\n if visited[i] is 0\n add degree[i] to numedges[cap]\n increment numver[cap]\n dfs(i, cap, visited, numedges, numver, n)\n end of the block\n end of the block\n end of the block\nend of the block\ndefine the main function\n n,m,k=int\n read n,m,k\n cap=array of k int\n for i=0 to k exclusive\n read cap[i]\n decrement cap[i]\n end of the block\n a,b=int\n visited = array of n int\n for i=0 to n exclusive\n visited[i]=0\n degree[i]=0\n end of the block\n for i=0 to m exclusive\n read a,b\n decrement a\n decrement b\n edges[a][b]=1\n edges[b][a]=1\n increment degree[a]\n increment degree[b]\n end of the block\n numedges = array of k+1 int\n numver = array of k+1 int\n for i=0 to k-1 exclusive\n numedges[i]=0\n numver[i]=0\n end of the block\n count=0\n for i=0 to k exclusive\n dfs(cap[i], i, visited, numedges, numver, n)\n add degree[cap[i]] to numedges[i]\n increment numver[i]\n end of the block\n for i=0 to n exclusive\n if visited[i] is 0\n dfs(i, k, visited, numedges, numver, n)\n add degree[i] to numedges[k]\n increment numver[k]\n end of the block\n end of the block\n maxm=0\n maxindex=0\n ans=0\n for i=0 to k exclusive\n if numver[i] > maxm\n maxm=numver[i]\n maxindex=i\n end of the block\n end of the block\n for i=0 to k exclusive\n if i is maxindex continue\n xx=numver[i]*(numver[i]-1)\n divide xx by 2\n add (xx-numedges[i]\/2) to ans\n end of the block\n xx=numver[maxindex]+numver[k]\n x2=(xx*(xx-1))\/2\n subtract numedges[maxindex]\/2 from x2\n subtract numedges[k]\/2 from x2\n add x2 to ans\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["4 1 2","1 3","1 2"],["2"]],[["3 3 1","2","1 2","1 3","2 3"],["0"]],[["10 3 2","1 10","1 2","1 3","4 5"],["33"]],[["1 0 1","1"],["0"]],[["1000 0 1","72"],["499500"]],[["24 38 2","4 13","7 1","24 1","2 8","17 2","2 18","22 2","23 3","5 9","21 5","6 7","6 19","6 20","11 7","7 20","13 8","16 8","9 10","14 9","21 9","12 10","10 22","23 10","17 11","11 24","20 12","13 16","13 23","15 14","17 14","14 20","19 16","17 20","17 23","18 22","18 23","22 19","21 20","23 24"],["215"]],[["10 30 1","4","1 2","3 1","4 1","1 6","1 8","10 1","2 4","2 7","3 4","3 5","7 3","3 9","10 3","5 4","6 4","7 4","9 4","10 4","6 5","5 8","9 5","10 5","6 7","9 6","10 6","7 8","9 7","10 7","9 8","10 8"],["15"]],[["10 13 2","5 10","2 1","1 4","2 3","2 8","3 4","7 3","4 6","8 4","4 9","6 7","6 9","10 6","7 8"],["23"]],[["10 10 3","2 5 6","1 3","4 1","4 3","5 3","3 9","8 4","9 4","5 10","8 7","10 8"],["18"]],[["10 5 3","1 5 9","1 3","1 8","2 3","8 4","5 7"],["17"]],[["6 4 2","1 4","1 2","2 3","4 5","5 6"],["2"]],[["7 8 2","1 4","1 2","2 3","4 5","4 6","4 7","5 6","5 7","6 7"],["1"]],[["5 2 3","1 3 4","1 5","2 4"],["0"]],[["5 3 2","1 2","2 3","2 4","1 5"],["1"]],[["9 5 2","1 5","1 2","2 3","3 4","5 6","6 7"],["13"]],[["6 4 1","1","2 3","3 4","4 5","5 6"],["11"]],[["6 4 2","1 5","1 2","2 3","3 4","5 6"],["3"]],[["7 3 3","1 5 6","1 2","1 3","6 7"],["4"]],[["5 2 2","1 2","1 3","2 4"],["2"]],[["11 7 2","1 4","1 2","1 3","4 5","4 6","5 6","9 10","1 11"],["24"]],[["20 4 5","1 3 9 10 20","5 6","1 2","7 9","4 10"],["89"]]]}} +{"instance_id":"pseudo_to_code_2k_86","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nfa = integer array of size 202002\nsum = integer array of size 202002\nc = integer array of size 202002\nin function max with arguments of integer a and integer b that returns an integer\n if a > b\n return a\n else\n return b\nend of the block\nin function findfa with arguments integer x that returns an integer\n if fa[x] is x\n return x\n else\n return the result of calling findfa with argument of fa[x]\nend of the block\nin function joint with argument integer x and integer y that returns nothing\n rx = integer = the result of calling findfa with argument of x\n ry = integer = the result of calling findfa with argument of y\n if rx is not ry\n fa[rx] = ry\n sum[ry] = sum[ry] + sum[rx]\n end of the block\nend of the block\nvis = boolean array of size 202002\nvec = integer vector\ndefine the main function\n n, m, k = integer\n read n, m, k\n clear all elements of vec\n for i = 0 to n inclusive\n fa[i] = i\n sum[i] = 1\n end of the block\n for i = 0 to k exclusive, then read c[i]\n x, y = integers\n for i = 0 to m exclusive\n read x, y\n call join with arguments of x and y\n end of the block\n set all elements of vis to 0\n for i = 0 to k exclusive, vis[the result of calling findfa with argument c[i] = 1\n mx = integer = -1\n ans = long long = 0\n for i = 1 to n inclusive\n if fa[i] is i\n if vis[i] is 1\n mx = the bigger value between mx and sum[i]\n else\n push back the values of vec and insert a new element of sum[i] at the end of vec\n ans = ans + sum[i] * (sum[i] - 1) \/ 2\n end of the block\n end of the block\n sz = integer = size of vec\n for i = 0 to sz exclusive\n for j = i + 1 to sz exclusive, then ans = ans + vec[i] * vec[j]\n ans = ans + vec[i] * mx\n end of the block\n ans = ans - m\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int fa[202002];\nint sum[202002];\nint c[202002];\nint max(int a, int b) {\n if (a > b)\n return a;\n else\n return b;\n}\nint findfa(int x) {\n if (fa[x] == x)\n return x;\n else\n return findfa(fa[x]);\n}\nvoid joint(int x, int y) {\n int rx = findfa(x);\n int ry = findfa(y);\n if (rx != ry) {\n fa[rx] = ry;\n sum[ry] += sum[rx];\n }\n}\nbool vis[202002];\nvector vec;\nint main() {\n int n, m, k;\n cin >> n >> m >> k;\n vec.clear();\n for (int i = 0; i <= n; i++) {\n fa[i] = i;\n sum[i] = 1;\n }\n for (int i = 0; i < k; i++) cin >> c[i];\n int x, y;\n for (int i = 0; i < m; i++) {\n cin >> x >> y;\n joint(x, y);\n }\n memset(vis, 0, sizeof(vis));\n for (int i = 0; i < k; i++) vis[findfa(c[i])] = 1;\n int mx = -1;\n long long ans = 0;\n for (int i = 1; i <= n; i++) {\n if (fa[i] == i) {\n if (vis[i] == 1)\n mx = max(mx, sum[i]);\n else\n vec.push_back(sum[i]);\n ans += sum[i] * (sum[i] - 1) \/ 2;\n }\n }\n int sz = vec.size();\n for (int i = 0; i < sz; i++) {\n for (int j = i + 1; j < sz; j++) { ans += vec[i] * vec[j]; }\n ans += vec[i] * mx;\n }\n ans -= m;\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"744A","pseudocode":"fa = integer array of size 202002\nsum = integer array of size 202002\nc = integer array of size 202002\nin function max with arguments of integer a and integer b that returns an integer\n if a > b\n return a\n else\n return b\nend of the block\nin function findfa with arguments integer x that returns an integer\n if fa[x] is x\n return x\n else\n return the result of calling findfa with argument of fa[x]\nend of the block\nin function joint with argument integer x and integer y that returns nothing\n rx = integer = the result of calling findfa with argument of x\n ry = integer = the result of calling findfa with argument of y\n if rx is not ry\n fa[rx] = ry\n sum[ry] = sum[ry] + sum[rx]\n end of the block\nend of the block\nvis = boolean array of size 202002\nvec = integer vector\ndefine the main function\n n, m, k = integer\n read n, m, k\n clear all elements of vec\n for i = 0 to n inclusive\n fa[i] = i\n sum[i] = 1\n end of the block\n for i = 0 to k exclusive, then read c[i]\n x, y = integers\n for i = 0 to m exclusive\n read x, y\n call join with arguments of x and y\n end of the block\n set all elements of vis to 0\n for i = 0 to k exclusive, vis[the result of calling findfa with argument c[i] = 1\n mx = integer = -1\n ans = long long = 0\n for i = 1 to n inclusive\n if fa[i] is i\n if vis[i] is 1\n mx = the bigger value between mx and sum[i]\n else\n push back the values of vec and insert a new element of sum[i] at the end of vec\n ans = ans + sum[i] * (sum[i] - 1) \/ 2\n end of the block\n end of the block\n sz = integer = size of vec\n for i = 0 to sz exclusive\n for j = i + 1 to sz exclusive, then ans = ans + vec[i] * vec[j]\n ans = ans + vec[i] * mx\n end of the block\n ans = ans - m\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["4 1 2","1 3","1 2"],["2"]],[["3 3 1","2","1 2","1 3","2 3"],["0"]],[["10 3 2","1 10","1 2","1 3","4 5"],["33"]],[["1 0 1","1"],["0"]],[["1000 0 1","72"],["499500"]],[["24 38 2","4 13","7 1","24 1","2 8","17 2","2 18","22 2","23 3","5 9","21 5","6 7","6 19","6 20","11 7","7 20","13 8","16 8","9 10","14 9","21 9","12 10","10 22","23 10","17 11","11 24","20 12","13 16","13 23","15 14","17 14","14 20","19 16","17 20","17 23","18 22","18 23","22 19","21 20","23 24"],["215"]],[["10 30 1","4","1 2","3 1","4 1","1 6","1 8","10 1","2 4","2 7","3 4","3 5","7 3","3 9","10 3","5 4","6 4","7 4","9 4","10 4","6 5","5 8","9 5","10 5","6 7","9 6","10 6","7 8","9 7","10 7","9 8","10 8"],["15"]],[["10 13 2","5 10","2 1","1 4","2 3","2 8","3 4","7 3","4 6","8 4","4 9","6 7","6 9","10 6","7 8"],["23"]],[["10 10 3","2 5 6","1 3","4 1","4 3","5 3","3 9","8 4","9 4","5 10","8 7","10 8"],["18"]],[["10 5 3","1 5 9","1 3","1 8","2 3","8 4","5 7"],["17"]],[["6 4 2","1 4","1 2","2 3","4 5","5 6"],["2"]],[["7 8 2","1 4","1 2","2 3","4 5","4 6","4 7","5 6","5 7","6 7"],["1"]],[["5 2 3","1 3 4","1 5","2 4"],["0"]],[["5 3 2","1 2","2 3","2 4","1 5"],["1"]],[["9 5 2","1 5","1 2","2 3","3 4","5 6","6 7"],["13"]],[["6 4 1","1","2 3","3 4","4 5","5 6"],["11"]],[["6 4 2","1 5","1 2","2 3","3 4","5 6"],["3"]],[["7 3 3","1 5 6","1 2","1 3","6 7"],["4"]],[["5 2 2","1 2","1 3","2 4"],["2"]],[["11 7 2","1 4","1 2","1 3","4 5","4 6","5 6","9 10","1 11"],["24"]],[["20 4 5","1 3 9 10 20","5 6","1 2","7 9","4 10"],["89"]]]}} +{"instance_id":"pseudo_to_code_2k_87","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integer array dx of size 8 containing {0, 0, 1, 1, 1, -1, -1, -1}\ncreate int array dy of size 8 containing {1, -1, -1, 0, 1, -1, 0, 1}\nlet integer vector v of size 1005\nmake bool array vis of size 1005\ncreate int flag = 0 and cnt and int array dd of size 1005\ndeclare dfs taking in int s\n set vis[s] to true\n increment cnt\n if dd[s] is truthy, set flag to 1\n for i = 0 to size of v[s] exclusive\n if vis[v[s][i]] is falsy, call dfs(v[s][i])\n end of the block\n end function\nend of the block\ndefine the main function\n create ints n, m, k, a, and b\n create long long ints maxx = 0, ans = 0, and cnt1 = 0\n make long long vector vec\n read n, m, and k\n while k-- is truthy\n read a\n set dd[a] to 1\n end of the block\n create int ml = m\n while m1-- is falsy\n read a and b\n append b to v[a]\n append a to v[b]\n end of the block\n for i = 1 to n\n if vis[i] is falsy\n set cnt and flag to 0\n call dfs with argument i\n if flag is equal to 0\n set cnt1 to cnt1 + cnt\n else\n set maxx to (cnt < maxx ? maxx : cnt)\n append cnt to vec\n end of the block\n end of the block\n end of the block\n for i = 0 to size of vec exclusive\n if vec[i] is equal to maxx\n set cnt1 to cnt 1 + vec[i]\n set ans to ans + (cnt1 * (cnt1 - 1)) \/ 2\n increment maxx\n else do\n set ans to ans + (vec[i] * (vec[i] - 1)) \/ 2\n end of the block\n end of the block\n print the result of (ans - m)\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int dx[8] = {0, 0, 1, 1, 1, -1, -1, -1};\nint dy[8] = {1, -1, -1, 0, 1, -1, 0, 1};\nvector v[1005];\nbool vis[1005];\nint flag = 0, cnt, dd[1005];\nvoid dfs(int s) {\n vis[s] = true;\n cnt++;\n if (dd[s]) flag = 1;\n for (int i = 0; i < v[s].size(); i++) {\n if (!vis[v[s][i]]) dfs(v[s][i]);\n }\n return;\n}\nint main() {\n int n, m, k, a, b;\n long long maxx = 0, ans = 0, cnt1 = 0;\n vector vec;\n cin >> n >> m >> k;\n while (k--) {\n cin >> a;\n dd[a] = 1;\n }\n int m1 = m;\n while (m1--) {\n cin >> a >> b;\n v[a].push_back(b);\n v[b].push_back(a);\n }\n for (int i = 1; i <= n; i++) {\n if (!vis[i]) {\n cnt = 0, flag = 0;\n dfs(i);\n if (flag == 0)\n cnt1 += cnt;\n else {\n maxx = (cnt < maxx ? maxx : cnt);\n vec.push_back(cnt);\n }\n }\n }\n for (int i = 0; i < vec.size(); i++) {\n if (vec[i] == maxx) {\n cnt1 += vec[i];\n ans += (cnt1 * (cnt1 - 1)) \/ 2;\n maxx++;\n } else {\n ans += (vec[i] * (vec[i] - 1)) \/ 2;\n }\n }\n cout << (ans - m) << endl;\n return 0;\n}","item":{"problem_id":"744A","pseudocode":"create integer array dx of size 8 containing {0, 0, 1, 1, 1, -1, -1, -1}\ncreate int array dy of size 8 containing {1, -1, -1, 0, 1, -1, 0, 1}\nlet integer vector v of size 1005\nmake bool array vis of size 1005\ncreate int flag = 0 and cnt and int array dd of size 1005\ndeclare dfs taking in int s\n set vis[s] to true\n increment cnt\n if dd[s] is truthy, set flag to 1\n for i = 0 to size of v[s] exclusive\n if vis[v[s][i]] is falsy, call dfs(v[s][i])\n end of the block\n end function\nend of the block\ndefine the main function\n create ints n, m, k, a, and b\n create long long ints maxx = 0, ans = 0, and cnt1 = 0\n make long long vector vec\n read n, m, and k\n while k-- is truthy\n read a\n set dd[a] to 1\n end of the block\n create int ml = m\n while m1-- is falsy\n read a and b\n append b to v[a]\n append a to v[b]\n end of the block\n for i = 1 to n\n if vis[i] is falsy\n set cnt and flag to 0\n call dfs with argument i\n if flag is equal to 0\n set cnt1 to cnt1 + cnt\n else\n set maxx to (cnt < maxx ? maxx : cnt)\n append cnt to vec\n end of the block\n end of the block\n end of the block\n for i = 0 to size of vec exclusive\n if vec[i] is equal to maxx\n set cnt1 to cnt 1 + vec[i]\n set ans to ans + (cnt1 * (cnt1 - 1)) \/ 2\n increment maxx\n else do\n set ans to ans + (vec[i] * (vec[i] - 1)) \/ 2\n end of the block\n end of the block\n print the result of (ans - m)\n return to indicate successful execution\nend of the block","testcases":[[["4 1 2","1 3","1 2"],["2"]],[["3 3 1","2","1 2","1 3","2 3"],["0"]],[["10 3 2","1 10","1 2","1 3","4 5"],["33"]],[["1 0 1","1"],["0"]],[["1000 0 1","72"],["499500"]],[["24 38 2","4 13","7 1","24 1","2 8","17 2","2 18","22 2","23 3","5 9","21 5","6 7","6 19","6 20","11 7","7 20","13 8","16 8","9 10","14 9","21 9","12 10","10 22","23 10","17 11","11 24","20 12","13 16","13 23","15 14","17 14","14 20","19 16","17 20","17 23","18 22","18 23","22 19","21 20","23 24"],["215"]],[["10 30 1","4","1 2","3 1","4 1","1 6","1 8","10 1","2 4","2 7","3 4","3 5","7 3","3 9","10 3","5 4","6 4","7 4","9 4","10 4","6 5","5 8","9 5","10 5","6 7","9 6","10 6","7 8","9 7","10 7","9 8","10 8"],["15"]],[["10 13 2","5 10","2 1","1 4","2 3","2 8","3 4","7 3","4 6","8 4","4 9","6 7","6 9","10 6","7 8"],["23"]],[["10 10 3","2 5 6","1 3","4 1","4 3","5 3","3 9","8 4","9 4","5 10","8 7","10 8"],["18"]],[["10 5 3","1 5 9","1 3","1 8","2 3","8 4","5 7"],["17"]],[["6 4 2","1 4","1 2","2 3","4 5","5 6"],["2"]],[["7 8 2","1 4","1 2","2 3","4 5","4 6","4 7","5 6","5 7","6 7"],["1"]],[["5 2 3","1 3 4","1 5","2 4"],["0"]],[["5 3 2","1 2","2 3","2 4","1 5"],["1"]],[["9 5 2","1 5","1 2","2 3","3 4","5 6","6 7"],["13"]],[["6 4 1","1","2 3","3 4","4 5","5 6"],["11"]],[["6 4 2","1 5","1 2","2 3","3 4","5 6"],["3"]],[["7 3 3","1 5 6","1 2","1 3","6 7"],["4"]],[["5 2 2","1 2","1 3","2 4"],["2"]],[["11 7 2","1 4","1 2","1 3","4 5","4 6","5 6","9 10","1 11"],["24"]],[["20 4 5","1 3 9 10 20","5 6","1 2","7 9","4 10"],["89"]]]}} +{"instance_id":"pseudo_to_code_2k_88","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare integer array father size 1005\ndeclare n, m, k as integers\ndeclare find with integer x as argument, returning integer\n return x if father[x] is x, else let father[x] be run find with father[x] as argument\nend of the block\ndeclare integer array node size 1005\ndeclare integer array fathercnt size 1005\ndeclare integer cnt\ndeclare integer array isgro size 1005\ndefine the main function\n set bytes from isgro to size of isgro to value 0\n read n, m, k\n declare integer gro\n for j = 1 to n inclusive, let father[j] be j\n for i = 0 to k exclusive\n declare integer g\n read g\n let isgro[g] be 1\n let gro be g\n end of the block\n for j = 1 to n inclusive, let fathercnt[j] be 1\n for i = 0 to m exclusive\n declare p, q as integers\n read p and q\n if isgro[p] is true\n declare integer x\n let x be result of run find(q)\n if father[ run find(q) ] is not father[ run find(p) ]\n let father[ run find(q) ] be father [ run find(p) ]\n increment fathercnt[ run find(p) ] by fathercnt[x]\n let fathercnt[x] be 0\n end of the block\n else if isgro[q] is true\n declare integer x\n let x be result of run find(p)\n if father[ run find(p) ] is not father[ run find(q) ]\n let father[ run find(p) ] be father [ run find(q) ]\n increment fathercnt[ run find(q) ] by fathercnt[x]\n let fathercnt[x] be 0\n end of the block\n else\n declare integer x\n if isgro[father[result of run find(p)]] is true\n let x be result of run find(q)\n if father[ run find(q) ] is not father[ run find(p) ]\n let father[ run find(q) ] be father [ run find(p) ]\n increment fathercnt[ run find(p) ] by fathercnt[x]\n let fathercnt[x] be 0\n end of the block\n else\n let x be result of run find(p)\n if father[ run find(p) ] is not father[ run find(q) ]\n let father[ run find(p) ] be father [ run find(q) ]\n increment fathercnt[ run find(q) ] by fathercnt[x]\n let fathercnt[x] be 0\n end of the block\n end of the block\n end of the block\n end of the block\n declare integer maxfather = 0\n declare integer strunity\n for i = 1 to n inclusive\n if fathercnt[i] is greater than maxfather\n let maxfather be fathercnt[i]\n let strunity be i\n end of the block\n end of the block\n declare integer maxgro = 0\n declare integer strgro = gro\n for i = 1 to n inclusive\n if isgro[i] and fathercnt[i] is greater than maxgro\n let maxgro be fathercnt[i]\n let strgro be i\n end of the block\n end of the block\n for i = 1 to n inclusive\n if fathercnt[i] is not 0\n if isgro[run find(i)] is not 1\n increment fathercnt[strgro] by fathercnt[i]\n let fathercnt[i] be 0\n end of the block\n end of the block\n end of the block\n let cnt be 0\n for i = 1 to n inclusive\n if isgro[i] is true, increment cnt by fathercnt[i] * (fathercnt[i] - 1)) \/ 2\n end of the block\n print cnt - m, newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int father[1005];\nint n, m, k;\nint find(int x) {\n return father[x] == x ? x : father[x] = find(father[x]);\n}\nint node[1005];\nint fathercnt[1005];\nint cnt;\nint isgro[1005];\nint main() {\n memset(isgro, 0, sizeof(isgro));\n cin >> n >> m >> k;\n int gro;\n for (int j = 1; j <= n; j++) { father[j] = j; }\n for (int i = 0; i < k; i++) {\n int g;\n cin >> g;\n isgro[g] = 1;\n gro = g;\n }\n for (int j = 1; j <= n; j++) { fathercnt[j] = 1; }\n for (int i = 0; i < m; i++) {\n int p, q;\n cin >> p >> q;\n if (isgro[p]) {\n int x;\n x = find(q);\n if (father[find(q)] != father[find(p)]) {\n father[find(q)] = father[find(p)];\n fathercnt[find(p)] += fathercnt[x];\n fathercnt[x] = 0;\n }\n } else if (isgro[q]) {\n int x;\n x = find(p);\n if (father[find(p)] != father[find(q)]) {\n father[find(p)] = father[find(q)];\n fathercnt[find(q)] += fathercnt[x];\n fathercnt[x] = 0;\n }\n } else {\n int x;\n if (isgro[father[find(p)]]) {\n x = find(q);\n if (father[find(q)] != father[find(p)]) {\n father[find(q)] = father[find(p)];\n fathercnt[find(p)] += fathercnt[x];\n fathercnt[x] = 0;\n }\n } else {\n x = find(p);\n if (father[find(p)] != father[find(q)]) {\n father[find(p)] = father[find(q)];\n fathercnt[find(q)] += fathercnt[x];\n fathercnt[x] = 0;\n }\n }\n }\n }\n int maxfather = 0;\n int strunity;\n for (int i = 1; i <= n; i++) {\n if (fathercnt[i] > maxfather) {\n maxfather = fathercnt[i];\n strunity = i;\n }\n }\n int maxgro = 0;\n int strgro = gro;\n for (int i = 1; i <= n; i++) {\n if (isgro[i] && fathercnt[i] > maxgro) {\n maxgro = fathercnt[i];\n strgro = i;\n }\n }\n for (int i = 1; i <= n; i++) {\n if (fathercnt[i] != 0) {\n if (isgro[find(i)] != 1) {\n fathercnt[strgro] += fathercnt[i];\n fathercnt[i] = 0;\n }\n }\n }\n cnt = 0;\n for (int i = 1; i <= n; i++) {\n if (isgro[i]) { cnt += (fathercnt[i] * (fathercnt[i] - 1)) \/ 2; }\n }\n cout << cnt - m << endl;\n return 0;\n}","item":{"problem_id":"744A","pseudocode":"declare integer array father size 1005\ndeclare n, m, k as integers\ndeclare find with integer x as argument, returning integer\n return x if father[x] is x, else let father[x] be run find with father[x] as argument\nend of the block\ndeclare integer array node size 1005\ndeclare integer array fathercnt size 1005\ndeclare integer cnt\ndeclare integer array isgro size 1005\ndefine the main function\n set bytes from isgro to size of isgro to value 0\n read n, m, k\n declare integer gro\n for j = 1 to n inclusive, let father[j] be j\n for i = 0 to k exclusive\n declare integer g\n read g\n let isgro[g] be 1\n let gro be g\n end of the block\n for j = 1 to n inclusive, let fathercnt[j] be 1\n for i = 0 to m exclusive\n declare p, q as integers\n read p and q\n if isgro[p] is true\n declare integer x\n let x be result of run find(q)\n if father[ run find(q) ] is not father[ run find(p) ]\n let father[ run find(q) ] be father [ run find(p) ]\n increment fathercnt[ run find(p) ] by fathercnt[x]\n let fathercnt[x] be 0\n end of the block\n else if isgro[q] is true\n declare integer x\n let x be result of run find(p)\n if father[ run find(p) ] is not father[ run find(q) ]\n let father[ run find(p) ] be father [ run find(q) ]\n increment fathercnt[ run find(q) ] by fathercnt[x]\n let fathercnt[x] be 0\n end of the block\n else\n declare integer x\n if isgro[father[result of run find(p)]] is true\n let x be result of run find(q)\n if father[ run find(q) ] is not father[ run find(p) ]\n let father[ run find(q) ] be father [ run find(p) ]\n increment fathercnt[ run find(p) ] by fathercnt[x]\n let fathercnt[x] be 0\n end of the block\n else\n let x be result of run find(p)\n if father[ run find(p) ] is not father[ run find(q) ]\n let father[ run find(p) ] be father [ run find(q) ]\n increment fathercnt[ run find(q) ] by fathercnt[x]\n let fathercnt[x] be 0\n end of the block\n end of the block\n end of the block\n end of the block\n declare integer maxfather = 0\n declare integer strunity\n for i = 1 to n inclusive\n if fathercnt[i] is greater than maxfather\n let maxfather be fathercnt[i]\n let strunity be i\n end of the block\n end of the block\n declare integer maxgro = 0\n declare integer strgro = gro\n for i = 1 to n inclusive\n if isgro[i] and fathercnt[i] is greater than maxgro\n let maxgro be fathercnt[i]\n let strgro be i\n end of the block\n end of the block\n for i = 1 to n inclusive\n if fathercnt[i] is not 0\n if isgro[run find(i)] is not 1\n increment fathercnt[strgro] by fathercnt[i]\n let fathercnt[i] be 0\n end of the block\n end of the block\n end of the block\n let cnt be 0\n for i = 1 to n inclusive\n if isgro[i] is true, increment cnt by fathercnt[i] * (fathercnt[i] - 1)) \/ 2\n end of the block\n print cnt - m, newline\n return to indicate successful execution\nend of the block","testcases":[[["4 1 2","1 3","1 2"],["2"]],[["3 3 1","2","1 2","1 3","2 3"],["0"]],[["10 3 2","1 10","1 2","1 3","4 5"],["33"]],[["1 0 1","1"],["0"]],[["1000 0 1","72"],["499500"]],[["24 38 2","4 13","7 1","24 1","2 8","17 2","2 18","22 2","23 3","5 9","21 5","6 7","6 19","6 20","11 7","7 20","13 8","16 8","9 10","14 9","21 9","12 10","10 22","23 10","17 11","11 24","20 12","13 16","13 23","15 14","17 14","14 20","19 16","17 20","17 23","18 22","18 23","22 19","21 20","23 24"],["215"]],[["10 30 1","4","1 2","3 1","4 1","1 6","1 8","10 1","2 4","2 7","3 4","3 5","7 3","3 9","10 3","5 4","6 4","7 4","9 4","10 4","6 5","5 8","9 5","10 5","6 7","9 6","10 6","7 8","9 7","10 7","9 8","10 8"],["15"]],[["10 13 2","5 10","2 1","1 4","2 3","2 8","3 4","7 3","4 6","8 4","4 9","6 7","6 9","10 6","7 8"],["23"]],[["10 10 3","2 5 6","1 3","4 1","4 3","5 3","3 9","8 4","9 4","5 10","8 7","10 8"],["18"]],[["10 5 3","1 5 9","1 3","1 8","2 3","8 4","5 7"],["17"]],[["6 4 2","1 4","1 2","2 3","4 5","5 6"],["2"]],[["7 8 2","1 4","1 2","2 3","4 5","4 6","4 7","5 6","5 7","6 7"],["1"]],[["5 2 3","1 3 4","1 5","2 4"],["0"]],[["5 3 2","1 2","2 3","2 4","1 5"],["1"]],[["9 5 2","1 5","1 2","2 3","3 4","5 6","6 7"],["13"]],[["6 4 1","1","2 3","3 4","4 5","5 6"],["11"]],[["6 4 2","1 5","1 2","2 3","3 4","5 6"],["3"]],[["7 3 3","1 5 6","1 2","1 3","6 7"],["4"]],[["5 2 2","1 2","1 3","2 4"],["2"]],[["11 7 2","1 4","1 2","1 3","4 5","4 6","5 6","9 10","1 11"],["24"]],[["20 4 5","1 3 9 10 20","5 6","1 2","7 9","4 10"],["89"]]]}} +{"instance_id":"pseudo_to_code_2k_89","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate constant integer N = 100 + 5\ncreate constant integer mod = 1000000000 + 7\nbool function ok with char argument a\n if a is a letter character return 1\n if a is a capital letter character return 1\n if a is a digit return 1\n if a is '_' return 1\n return to indicate successful execution\nend of the block\ndefine the main function\n declare array of characters of size N\n read a + 1\n create integer len with value = length of (a + 1)\n set integer op to 1\n set boolean flag to 1\n integers cnt1 = 0, cnt2 = 0, ccnt = 0 and cnt3 = 0\n for integer i = 1 to len and flag inclusive\n if op is equal to 1\n increase cnt1\n if a[i] is '@'\n decrement cnt1\n set value of op to 2\n go to the start of the loop\n end of the block\n if ok(a[i]) is false, set flag to 0\n if cnt1 is greater than 16, set flag to 0\n else if op is equal to 2\n increment ccnt\n if cnt1 = 0 or cnt1 > 16, set flag to 0\n if a[i] is '.'\n if cnt2 = 0 or cnt2 > 16, set flag to 0\n set cnt2 to 0\n go to the start of the loop\n end of the block\n if a[i] is '\/'\n decrement ccnt\n op = 3\n continue the loop\n end of the block\n if ok(a[i]) is false, set flag to 0\n increase cnt2\n if cnt2 is greater than 16, set flag to 0\n else\n if cnt2 = 0 or cnt2 is greater than 16, set flag to 0\n if ccnt = 0 or ccnt is greater than 32, set flag to 0\n if ok(a[i]) is false, set flag to 0\n increase cnt3\n if cnt3 is greater than 16, set flag to 0\n end of the block\n end of the block\n if op is equal to 1, set flag to 0\n if op = 2 and (cnt2 = 0 or cnt2 is greater than 16), set flag to 0\n if op = 3 and (cnt3 = 0 or cnt3 is greater than 16), set flag to 0\n if flag is true\n print \"YES\" and a new line\n else\n print \"NO\" and a new line\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int N = 100 + 5;\nconst int mod = 1000000000 + 7;\nbool ok(char a) {\n if (a >= 'a' && a <= 'z') return 1;\n if (a >= 'A' && a <= 'Z') return 1;\n if (a >= '0' && a <= '9') return 1;\n if (a == '_') return 1;\n return 0;\n}\nint main() {\n char a[N];\n cin >> a + 1;\n int len = strlen(a + 1);\n int op = 1;\n bool flag = 1;\n int cnt1 = 0, cnt2 = 0, ccnt = 0, cnt3 = 0;\n for (int i = 1; i <= len && flag; i++) {\n if (op == 1) {\n cnt1++;\n if (a[i] == '@') {\n cnt1--;\n op = 2;\n continue;\n }\n if (!ok(a[i])) { flag = 0; }\n if (cnt1 > 16) flag = 0;\n } else if (op == 2) {\n ccnt++;\n if (cnt1 == 0 || cnt1 > 16) flag = 0;\n if (a[i] == '.') {\n if (cnt2 == 0 || cnt2 > 16) flag = 0;\n cnt2 = 0;\n continue;\n }\n if (a[i] == '\/') {\n ccnt--;\n op = 3;\n continue;\n }\n if (!ok(a[i])) { flag = 0; }\n cnt2++;\n if (cnt2 > 16) flag = 0;\n } else {\n if (cnt2 == 0 || cnt2 > 16) flag = 0;\n if (ccnt == 0 || ccnt > 32) flag = 0;\n if (!ok(a[i])) flag = 0;\n cnt3++;\n if (cnt3 > 16) flag = 0;\n }\n }\n if (op == 1) flag = 0;\n if (op == 2 && (cnt2 == 0 || cnt2 > 16)) flag = 0;\n if (op == 3 && (cnt3 == 0 || cnt3 > 16)) flag = 0;\n if (flag)\n cout << \"YES\" << endl;\n else\n cout << \"NO\" << endl;\n return 0;\n}","item":{"problem_id":"21A","pseudocode":"create constant integer N = 100 + 5\ncreate constant integer mod = 1000000000 + 7\nbool function ok with char argument a\n if a is a letter character return 1\n if a is a capital letter character return 1\n if a is a digit return 1\n if a is '_' return 1\n return to indicate successful execution\nend of the block\ndefine the main function\n declare array of characters of size N\n read a + 1\n create integer len with value = length of (a + 1)\n set integer op to 1\n set boolean flag to 1\n integers cnt1 = 0, cnt2 = 0, ccnt = 0 and cnt3 = 0\n for integer i = 1 to len and flag inclusive\n if op is equal to 1\n increase cnt1\n if a[i] is '@'\n decrement cnt1\n set value of op to 2\n go to the start of the loop\n end of the block\n if ok(a[i]) is false, set flag to 0\n if cnt1 is greater than 16, set flag to 0\n else if op is equal to 2\n increment ccnt\n if cnt1 = 0 or cnt1 > 16, set flag to 0\n if a[i] is '.'\n if cnt2 = 0 or cnt2 > 16, set flag to 0\n set cnt2 to 0\n go to the start of the loop\n end of the block\n if a[i] is '\/'\n decrement ccnt\n op = 3\n continue the loop\n end of the block\n if ok(a[i]) is false, set flag to 0\n increase cnt2\n if cnt2 is greater than 16, set flag to 0\n else\n if cnt2 = 0 or cnt2 is greater than 16, set flag to 0\n if ccnt = 0 or ccnt is greater than 32, set flag to 0\n if ok(a[i]) is false, set flag to 0\n increase cnt3\n if cnt3 is greater than 16, set flag to 0\n end of the block\n end of the block\n if op is equal to 1, set flag to 0\n if op = 2 and (cnt2 = 0 or cnt2 is greater than 16), set flag to 0\n if op = 3 and (cnt3 = 0 or cnt3 is greater than 16), set flag to 0\n if flag is true\n print \"YES\" and a new line\n else\n print \"NO\" and a new line\n return to indicate successful execution\nend of the block","testcases":[[["mike@codeforces.com"],["YES"]],[["john.smith@codeforces.ru\/contest.icpc\/12"],["NO"]],[["test@test.ri\/abacaba"],["YES"]],[["@ops"],["NO"]],[["this-is-the-test"],["NO"]],[["mike@codeforces.commike@codeforces.com"],["NO"]],[["oooop\/oooop"],["NO"]],[["w@S8\/XU.5._R7fHq.@..\/e.WP!54Ey1L.9jv"],["NO"]],[["lNC9D1L5U@.L!_!CcAOEEx.0z.aiW\/S430sbQT"],["NO"]],[["@\/YTd.K1@lD"],["NO"]],[["Fyi!d1l@.OesGopTnRn.81xdSb8q.\/MzuI"],["NO"]],[["_TlPy65w\/@.Vl@.8k"],["NO"]],[["xpS@._s8.e0lJci\/.LdiT"],["NO"]],[["lGwo8.D2@.3"],["NO"]],[["Ccz9T5rKZQuEerGo@6l."],["NO"]],[["Y@5nh@8.9P.Bx5AaY.1g.Tc_MK7.g_..0."],["NO"]],[["Q2\/6y!SP9sG@7zIGr.Du_nR8."],["NO"]],[["eWfLL@gW!BEJUxFh@dghf.d4.FiYp\/2.Pr7a\/5O6zXdAkikjCEDrb"],["NO"]],[["8oI\/a@Q"],["NO"]],[["J@Y9Gz550l@PqVZdQ!u"],["NO"]],[["VTE6aTTta@DHe4xeG@6.c2R.J.O7sndWEEW.9j@.l..3Bs"],["NO"]],[["aeo2XkK@UX.nQJN!Tg..wGN5YOi68U.oP2Yl3\/"],["NO"]],[["m13zREg8LbPr@T2.Z9@g.9u.v.A..XNH\/1\/tloIceXydZf3"],["NO"]],[["4@@..f3ZT.\/oUGZ@"],["NO"]],[["G.rVAxwDx@a.PVSe!KtpX4tzs\/0yQGzZCPJPJoda"],["NO"]],[["SV9T5RR425Sl0b@kzj.XT.PFWc..ho\/VE7gjf"],["NO"]],[["bgko@1..\/xwSj_J"],["NO"]],[["n5ymLC.bE@ukio.im2..\/."],["NO"]],[["zr.KB_6ZMSwI2GA5@R\/4iP1ZKHpszW!YN\/"],["NO"]],[["@alK@pR"],["NO"]],[["al_Y2I4IKp@A_N.ruCw0VL\/hRzJtx.S7sp\/r!c.n9ffh"],["NO"]],[["C1rE26_rTAVzLm@6@X5OGX.ibJ9.\/kkBEVlcU"],["NO"]],[["feGSXP@eyUfr8.x4Re.JL.6B.r\/fX_"],["NO"]],[["Ht15T@50eo.E@."],["NO"]],[["k9MITs_Ar.JL2RRs4@VRq.wCuJ.6..amF.fE4.5I.6fJ7gz7"],["NO"]],[["MiWPE8@fc.\/IViqq4T4PSUuMdhH"],["NO"]],[["pxSCmv!NbMvz2@pTQ.t!.Ntz\/QEh_sl"],["NO"]],[["s@mH@RO_\/iWD"],["NO"]],[["UP51i49wX@pvx@2LWm8w\/G4M3J.\/9L6Szy"],["NO"]],[["xC_5Vx8NgF..ln@X1.drRTX..1vx.Xb3of@\/PQYPeq@_y8!h_iF"],["NO"]],[["qG3@LKp"],["YES"]],[["flTq1knyb@2!Mtfss"],["NO"]],[["\/pqi7WXQPJFM4q1@hxUyUy\/_pWo0n"],["NO"]],[["zXme@.Dq.TWBs.fB.M"],["NO"]],[["o3EaAnc3K6@h"],["YES"]],[["G\/AZdVMTzRLV4Ucm@eQ!..pq!..tRTi5.Ejkqa\/HGpFYk"],["NO"]],[[".c_V@L.1v!AFAEk7glMq.ag8Sy8@0.Qm\/OLKoJpZlac"],["NO"]],[["WKxNIM79u@I.RM"],["NO"]],[["POTjlYcxAZsbyZPDh@sPm.z6aVaO.H1wEUhD9YvROQFUk\/M_jTHS_6!"],["NO"]],[["pbRIiuA@KZ2hVed2fMikA.@ebd.tE2Y"],["NO"]],[["OlS_OwxYhH@im.0A7o\/juNlxB"],["YES"]],[["xkjHHDRBEFwgNP@G9TGStEs2Lu.BJge3EBXw3c9EfE"],["YES"]],[["bK@8X7tQO.pXBHJpDewD"],["YES"]],[["kKUXy6@0WefbXz39ywP.Q3r7uF"],["YES"]],[["SllbRLdZ6@.T.E3x.BE2nIv.5db_.38.\/zgVGNjpldr"],["NO"]],[["4lBJkY8c097oa@ZYmVbtiyyYN.gbj"],["YES"]],[["F@JX4.SI1\/0EY3XmYatfY"],["YES"]],[["oLo01@B77Pu.9R.vtAZG0.HQSunv0J."],["NO"]],[["xLEctap0T@22U9W_fA\/7iQeJGFu1lSgMZ"],["YES"]],[["WYh@yUWfOQiF.gOK9k8aEa"],["YES"]],[["BPxNVANhtEh@Oh_go."],["NO"]],[["mGIY@cHRNC8GlJ\/2pcl3LYxpi3PaKGs"],["YES"]],[["x6yfn7BGwqWd@.N\/UXC"],["NO"]],[["cUIr@cP.eGQC2xJXvI1X7"],["YES"]],[["MLZ6e1vgZ4hOI@ktWk.Ro.o6C4\/i8cnKHT"],["YES"]],[["XCJIa@jFaP.Eu28YaoT9Z.Epk.Z\/4TBzLWf724zE1r"],["YES"]],[["Cz1U1xjg6iW0U@.97HoVA.YG.Qd.eI.DCXxtibi6HG.GV\/0sN"],["NO"]],[["nrKbWV@P0irxQoRxDsNvG\/69WxCwCsfB"],["YES"]],[["yI1nRv3FbuhgaI@.Y9vKe.8oc.BLi.6JfYT\/tT5d36"],["NO"]],[["IGsma3L6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR\/_97Ltj3"],["YES"]],[["Uu538LDu9Bye@Gu0W0P5a.b9zA9nSaNhzB_TQ2.z\/qfi5CZrH"],["YES"]],[["bdHl525me@XzR_iO23v.YFXbnHUybbgw.i\/WVEhm"],["YES"]],[["NQsZ0K@eE8VMB.w2nYtKImB.4nUF"],["YES"]],[["186@E.MmBaKLj.WYpt4wPZkzv93"],["YES"]],[["hmhYxkGtWYRJFtBU@Drg3L7WKujE.lU61Ljqxv.\/FJ4X"],["NO"]],[["t1RIUz9l3FA15@tOL9.rv.NjhouD."],["NO"]],[["_I4ytjyccT@q.WIc.Cqn"],["YES"]],[["LwHHRYq@whOoq.e9b6i0xnoWBl7z.SGJiJe\/iUij1x7"],["YES"]],[["Yesx@9_KiJq2cBI6."],["NO"]],[["Zu5VFUtSbIw@ner5e"],["YES"]],[["test@test."],["NO"]],[["test@.test"],["NO"]],[["est.@test"],["NO"]],[["test@test.ru\/"],["NO"]],[["asd@asd@"],["NO"]],[["@"],["NO"]],[["\/"],["NO"]],[["."],["NO"]],[["mike@"],["NO"]],[["@mike"],["NO"]],[["@mail.ru"],["NO"]],[["test.me"],["NO"]],[["$@ru"],["NO"]],[["testme@o.o.o.o.o\/ooooo"],["YES"]],[["oooop\/oooop"],["NO"]],[["mail.ru\/a"],["NO"]],[["mike@mail.ru\/aaa"],["YES"]],[["mike@mike.mike"],["YES"]]]}} +{"instance_id":"pseudo_to_code_2k_90","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nboolean function l that takes character c as argument\n return true if c is a letter\n return true if c is a capital letter\n return true if c is a digit\n return true if c is an underscore\n return false\nend of the block\nfunction un with string argument s\n set value of int n to length s\n if n is 0 or n > 16 return false\n for i = 0 to n exclusive\n if l(s at index i) is false return false\n end of the block\n return true\nend of the block\nfunction hn with string argument s\n declare integers n = size of s, i, nw = 0\n if n is 0 or n > 32 return false\n appen character '.' to s\n for i = 0 to n + 1 exclusive\n if s[i] is character \".\"\n if nw is equal to 0 or nw is greater than 16 return false\n nw = 0\n else\n if l(s at index i) is false return false\n increase nw\n end of the block\n end of the block\n return true\nend of the block\nboolean function r with string argument s\n return un(s)\nend of the block\nboolean function f with string argument s\n int n = length of s, i, j\n for i = 0 to n exclusive\n if s at index i is \"@\" break the loop\n end of the block\n if i is equal to n return false\n if un(substring of s from 0 to i) is false return false\n for j = from i + 1 to n exclusive\n if s[j] is \"\/\" break the loop\n end of the block\n if hn(substring of s from i + 1 to j - i - 1) is false return false\n if j is not equal to n and r(substring of s from 0 to j +1) is false return false\n return true\nend of the block\nlet s be string\ndefine the main function\n read s\n if f(s)\n print \"YES\" and a new line\n else\n print \"NO\" and a new line\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"bool l(char c) {\n if (c >= 'a' && c <= 'z') { return true; }\n if (c >= 'A' && c <= 'Z') { return true; }\n if (c >= '0' && c <= '9') { return true; }\n if (c == '_') { return true; }\n return false;\n}\nbool un(string s) {\n int n = s.size();\n if (n == 0 || n > 16) { return false; }\n for (int i = 0; i < n; i++) {\n if (!l(s[i])) { return false; }\n }\n return true;\n}\nbool hn(string s) {\n int n = s.size(), i, nw = 0;\n if (n == 0 || n > 32) { return false; }\n s += '.';\n for (i = 0; i < n + 1; i++) {\n if (s[i] == '.') {\n if (nw == 0 || nw > 16) { return false; }\n nw = 0;\n } else {\n if (!l(s[i])) { return false; }\n nw++;\n }\n }\n return true;\n}\nbool r(string s) {\n return un(s);\n}\nbool f(string s) {\n int n = s.size(), i, j;\n for (i = 0; i < n; i++) {\n if (s[i] == '@') { break; }\n }\n if (i == n) { return false; }\n if (!un(s.substr(0, i))) { return false; }\n for (j = i + 1; j < n; j++) {\n if (s[j] == '\/') { break; }\n }\n if (!hn(s.substr(i + 1, j - i - 1))) { return false; }\n if (j != n && !r(s.substr(j + 1))) { return false; }\n return true;\n}\nstring s;\nint main() {\n cin >> s;\n if (f(s)) {\n cout << \"YES\" << endl;\n } else {\n cout << \"NO\" << endl;\n }\n return 0;\n}","item":{"problem_id":"21A","pseudocode":"boolean function l that takes character c as argument\n return true if c is a letter\n return true if c is a capital letter\n return true if c is a digit\n return true if c is an underscore\n return false\nend of the block\nfunction un with string argument s\n set value of int n to length s\n if n is 0 or n > 16 return false\n for i = 0 to n exclusive\n if l(s at index i) is false return false\n end of the block\n return true\nend of the block\nfunction hn with string argument s\n declare integers n = size of s, i, nw = 0\n if n is 0 or n > 32 return false\n appen character '.' to s\n for i = 0 to n + 1 exclusive\n if s[i] is character \".\"\n if nw is equal to 0 or nw is greater than 16 return false\n nw = 0\n else\n if l(s at index i) is false return false\n increase nw\n end of the block\n end of the block\n return true\nend of the block\nboolean function r with string argument s\n return un(s)\nend of the block\nboolean function f with string argument s\n int n = length of s, i, j\n for i = 0 to n exclusive\n if s at index i is \"@\" break the loop\n end of the block\n if i is equal to n return false\n if un(substring of s from 0 to i) is false return false\n for j = from i + 1 to n exclusive\n if s[j] is \"\/\" break the loop\n end of the block\n if hn(substring of s from i + 1 to j - i - 1) is false return false\n if j is not equal to n and r(substring of s from 0 to j +1) is false return false\n return true\nend of the block\nlet s be string\ndefine the main function\n read s\n if f(s)\n print \"YES\" and a new line\n else\n print \"NO\" and a new line\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["mike@codeforces.com"],["YES"]],[["john.smith@codeforces.ru\/contest.icpc\/12"],["NO"]],[["test@test.ri\/abacaba"],["YES"]],[["@ops"],["NO"]],[["this-is-the-test"],["NO"]],[["mike@codeforces.commike@codeforces.com"],["NO"]],[["oooop\/oooop"],["NO"]],[["w@S8\/XU.5._R7fHq.@..\/e.WP!54Ey1L.9jv"],["NO"]],[["lNC9D1L5U@.L!_!CcAOEEx.0z.aiW\/S430sbQT"],["NO"]],[["@\/YTd.K1@lD"],["NO"]],[["Fyi!d1l@.OesGopTnRn.81xdSb8q.\/MzuI"],["NO"]],[["_TlPy65w\/@.Vl@.8k"],["NO"]],[["xpS@._s8.e0lJci\/.LdiT"],["NO"]],[["lGwo8.D2@.3"],["NO"]],[["Ccz9T5rKZQuEerGo@6l."],["NO"]],[["Y@5nh@8.9P.Bx5AaY.1g.Tc_MK7.g_..0."],["NO"]],[["Q2\/6y!SP9sG@7zIGr.Du_nR8."],["NO"]],[["eWfLL@gW!BEJUxFh@dghf.d4.FiYp\/2.Pr7a\/5O6zXdAkikjCEDrb"],["NO"]],[["8oI\/a@Q"],["NO"]],[["J@Y9Gz550l@PqVZdQ!u"],["NO"]],[["VTE6aTTta@DHe4xeG@6.c2R.J.O7sndWEEW.9j@.l..3Bs"],["NO"]],[["aeo2XkK@UX.nQJN!Tg..wGN5YOi68U.oP2Yl3\/"],["NO"]],[["m13zREg8LbPr@T2.Z9@g.9u.v.A..XNH\/1\/tloIceXydZf3"],["NO"]],[["4@@..f3ZT.\/oUGZ@"],["NO"]],[["G.rVAxwDx@a.PVSe!KtpX4tzs\/0yQGzZCPJPJoda"],["NO"]],[["SV9T5RR425Sl0b@kzj.XT.PFWc..ho\/VE7gjf"],["NO"]],[["bgko@1..\/xwSj_J"],["NO"]],[["n5ymLC.bE@ukio.im2..\/."],["NO"]],[["zr.KB_6ZMSwI2GA5@R\/4iP1ZKHpszW!YN\/"],["NO"]],[["@alK@pR"],["NO"]],[["al_Y2I4IKp@A_N.ruCw0VL\/hRzJtx.S7sp\/r!c.n9ffh"],["NO"]],[["C1rE26_rTAVzLm@6@X5OGX.ibJ9.\/kkBEVlcU"],["NO"]],[["feGSXP@eyUfr8.x4Re.JL.6B.r\/fX_"],["NO"]],[["Ht15T@50eo.E@."],["NO"]],[["k9MITs_Ar.JL2RRs4@VRq.wCuJ.6..amF.fE4.5I.6fJ7gz7"],["NO"]],[["MiWPE8@fc.\/IViqq4T4PSUuMdhH"],["NO"]],[["pxSCmv!NbMvz2@pTQ.t!.Ntz\/QEh_sl"],["NO"]],[["s@mH@RO_\/iWD"],["NO"]],[["UP51i49wX@pvx@2LWm8w\/G4M3J.\/9L6Szy"],["NO"]],[["xC_5Vx8NgF..ln@X1.drRTX..1vx.Xb3of@\/PQYPeq@_y8!h_iF"],["NO"]],[["qG3@LKp"],["YES"]],[["flTq1knyb@2!Mtfss"],["NO"]],[["\/pqi7WXQPJFM4q1@hxUyUy\/_pWo0n"],["NO"]],[["zXme@.Dq.TWBs.fB.M"],["NO"]],[["o3EaAnc3K6@h"],["YES"]],[["G\/AZdVMTzRLV4Ucm@eQ!..pq!..tRTi5.Ejkqa\/HGpFYk"],["NO"]],[[".c_V@L.1v!AFAEk7glMq.ag8Sy8@0.Qm\/OLKoJpZlac"],["NO"]],[["WKxNIM79u@I.RM"],["NO"]],[["POTjlYcxAZsbyZPDh@sPm.z6aVaO.H1wEUhD9YvROQFUk\/M_jTHS_6!"],["NO"]],[["pbRIiuA@KZ2hVed2fMikA.@ebd.tE2Y"],["NO"]],[["OlS_OwxYhH@im.0A7o\/juNlxB"],["YES"]],[["xkjHHDRBEFwgNP@G9TGStEs2Lu.BJge3EBXw3c9EfE"],["YES"]],[["bK@8X7tQO.pXBHJpDewD"],["YES"]],[["kKUXy6@0WefbXz39ywP.Q3r7uF"],["YES"]],[["SllbRLdZ6@.T.E3x.BE2nIv.5db_.38.\/zgVGNjpldr"],["NO"]],[["4lBJkY8c097oa@ZYmVbtiyyYN.gbj"],["YES"]],[["F@JX4.SI1\/0EY3XmYatfY"],["YES"]],[["oLo01@B77Pu.9R.vtAZG0.HQSunv0J."],["NO"]],[["xLEctap0T@22U9W_fA\/7iQeJGFu1lSgMZ"],["YES"]],[["WYh@yUWfOQiF.gOK9k8aEa"],["YES"]],[["BPxNVANhtEh@Oh_go."],["NO"]],[["mGIY@cHRNC8GlJ\/2pcl3LYxpi3PaKGs"],["YES"]],[["x6yfn7BGwqWd@.N\/UXC"],["NO"]],[["cUIr@cP.eGQC2xJXvI1X7"],["YES"]],[["MLZ6e1vgZ4hOI@ktWk.Ro.o6C4\/i8cnKHT"],["YES"]],[["XCJIa@jFaP.Eu28YaoT9Z.Epk.Z\/4TBzLWf724zE1r"],["YES"]],[["Cz1U1xjg6iW0U@.97HoVA.YG.Qd.eI.DCXxtibi6HG.GV\/0sN"],["NO"]],[["nrKbWV@P0irxQoRxDsNvG\/69WxCwCsfB"],["YES"]],[["yI1nRv3FbuhgaI@.Y9vKe.8oc.BLi.6JfYT\/tT5d36"],["NO"]],[["IGsma3L6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR\/_97Ltj3"],["YES"]],[["Uu538LDu9Bye@Gu0W0P5a.b9zA9nSaNhzB_TQ2.z\/qfi5CZrH"],["YES"]],[["bdHl525me@XzR_iO23v.YFXbnHUybbgw.i\/WVEhm"],["YES"]],[["NQsZ0K@eE8VMB.w2nYtKImB.4nUF"],["YES"]],[["186@E.MmBaKLj.WYpt4wPZkzv93"],["YES"]],[["hmhYxkGtWYRJFtBU@Drg3L7WKujE.lU61Ljqxv.\/FJ4X"],["NO"]],[["t1RIUz9l3FA15@tOL9.rv.NjhouD."],["NO"]],[["_I4ytjyccT@q.WIc.Cqn"],["YES"]],[["LwHHRYq@whOoq.e9b6i0xnoWBl7z.SGJiJe\/iUij1x7"],["YES"]],[["Yesx@9_KiJq2cBI6."],["NO"]],[["Zu5VFUtSbIw@ner5e"],["YES"]],[["test@test."],["NO"]],[["test@.test"],["NO"]],[["est.@test"],["NO"]],[["test@test.ru\/"],["NO"]],[["asd@asd@"],["NO"]],[["@"],["NO"]],[["\/"],["NO"]],[["."],["NO"]],[["mike@"],["NO"]],[["@mike"],["NO"]],[["@mail.ru"],["NO"]],[["test.me"],["NO"]],[["$@ru"],["NO"]],[["testme@o.o.o.o.o\/ooooo"],["YES"]],[["oooop\/oooop"],["NO"]],[["mail.ru\/a"],["NO"]],[["mike@mail.ru\/aaa"],["YES"]],[["mike@mike.mike"],["YES"]]]}} +{"instance_id":"pseudo_to_code_2k_91","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate constant integer N with N = 100 + 5\ncreate contant integer mod with mod = 1000000000 + 7\ndeclare boolean ok with character a as argument, returning boolean\n if a is greater than or equal to 'a' and a is less than or equal to 'z', return 1 from function\n if a is greater than or equal to 'A' and a is less than or equal to 'Z', return 1 from function\n if a is greater than or equal to '0' and a is less than or equal to '9', return 1 from function\n if a is '_', return 1 from function\n return to indicate successful execution\nend of the block\ndefine the main function\n create character array a with size N\n read a + 1\n create integer len with len = string length of (a + 1)\n create integer op with op = 1\n create boolean flag with flag = 1\n create integers cnt1, cnt2, ccnt, cnt3, with cnt1 = 0, cnt2 = 0, ccnt = 0, cnt3 = 0\n for i = 1 to len and flag inclusive\n if op is 1\n increment cnt1\n if a[i] is '@'\n decrement cnt1\n set op to 2\n break current loop iteration\n end of the block\n if result of run ok with a[i] as argument is false, set flag to 0\n if cnt1 is greater than 16, set flag to 0\n else if op is 2\n increment ccnt\n if cnt is 0 or cnt1 is greater than 16, set flag to 0\n if a[i] is '.'\n if cnt2 is 0 or cnt2 is greater than 16, set flag to 0\n set cnt2 to 0\n break current loop iteration\n end of the block\n if a[i] is '\/'\n decrement ccnt\n set op to 3\n break current loop iteration\n end of the block\n if result of run ok with a[i] as argument is false, set flag to 0\n increment cnt2\n if cnt2 is greater than 16, set flag to 0\n else\n if cnt2 is 0 or cnt2 is greater than 16, set flag to 0\n if ccnt is 0 or ccnt is greater than 32, set flag to 0\n if result of run ok with a[i] as argument is false, set flag to 0\n increment cnt3\n if cnt3 is greater than 16, set flag to 0\n end of the block\n end of the block\n if op is 1, set flag to 0\n if op is 2 and ( cnt2 is 0 or cnt2 is greater than 16 ), set flag to 0\n if op is 3 and ( cnt3 is 0 or cnt3 is greater than 16 ), set flag to 0\n if flag is true\n print \"YES\" print newline\n else\n print \"NO\" print newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int N = 100 + 5;\nconst int mod = 1000000000 + 7;\nbool ok(char a) {\n if (a >= 'a' && a <= 'z') return 1;\n if (a >= 'A' && a <= 'Z') return 1;\n if (a >= '0' && a <= '9') return 1;\n if (a == '_') return 1;\n return 0;\n}\nint main() {\n char a[N];\n cin >> a + 1;\n int len = strlen(a + 1);\n int op = 1;\n bool flag = 1;\n int cnt1 = 0, cnt2 = 0, ccnt = 0, cnt3 = 0;\n for (int i = 1; i <= len && flag; i++) {\n if (op == 1) {\n cnt1++;\n if (a[i] == '@') {\n cnt1--;\n op = 2;\n continue;\n }\n if (!ok(a[i])) { flag = 0; }\n if (cnt1 > 16) flag = 0;\n } else if (op == 2) {\n ccnt++;\n if (cnt1 == 0 || cnt1 > 16) flag = 0;\n if (a[i] == '.') {\n if (cnt2 == 0 || cnt2 > 16) flag = 0;\n cnt2 = 0;\n continue;\n }\n if (a[i] == '\/') {\n ccnt--;\n op = 3;\n continue;\n }\n if (!ok(a[i])) { flag = 0; }\n cnt2++;\n if (cnt2 > 16) flag = 0;\n } else {\n if (cnt2 == 0 || cnt2 > 16) flag = 0;\n if (ccnt == 0 || ccnt > 32) flag = 0;\n if (!ok(a[i])) flag = 0;\n cnt3++;\n if (cnt3 > 16) flag = 0;\n }\n }\n if (op == 1) flag = 0;\n if (op == 2 && (cnt2 == 0 || cnt2 > 16)) flag = 0;\n if (op == 3 && (cnt3 == 0 || cnt3 > 16)) flag = 0;\n if (flag)\n cout << \"YES\" << endl;\n else\n cout << \"NO\" << endl;\n return 0;\n}","item":{"problem_id":"21A","pseudocode":"create constant integer N with N = 100 + 5\ncreate contant integer mod with mod = 1000000000 + 7\ndeclare boolean ok with character a as argument, returning boolean\n if a is greater than or equal to 'a' and a is less than or equal to 'z', return 1 from function\n if a is greater than or equal to 'A' and a is less than or equal to 'Z', return 1 from function\n if a is greater than or equal to '0' and a is less than or equal to '9', return 1 from function\n if a is '_', return 1 from function\n return to indicate successful execution\nend of the block\ndefine the main function\n create character array a with size N\n read a + 1\n create integer len with len = string length of (a + 1)\n create integer op with op = 1\n create boolean flag with flag = 1\n create integers cnt1, cnt2, ccnt, cnt3, with cnt1 = 0, cnt2 = 0, ccnt = 0, cnt3 = 0\n for i = 1 to len and flag inclusive\n if op is 1\n increment cnt1\n if a[i] is '@'\n decrement cnt1\n set op to 2\n break current loop iteration\n end of the block\n if result of run ok with a[i] as argument is false, set flag to 0\n if cnt1 is greater than 16, set flag to 0\n else if op is 2\n increment ccnt\n if cnt is 0 or cnt1 is greater than 16, set flag to 0\n if a[i] is '.'\n if cnt2 is 0 or cnt2 is greater than 16, set flag to 0\n set cnt2 to 0\n break current loop iteration\n end of the block\n if a[i] is '\/'\n decrement ccnt\n set op to 3\n break current loop iteration\n end of the block\n if result of run ok with a[i] as argument is false, set flag to 0\n increment cnt2\n if cnt2 is greater than 16, set flag to 0\n else\n if cnt2 is 0 or cnt2 is greater than 16, set flag to 0\n if ccnt is 0 or ccnt is greater than 32, set flag to 0\n if result of run ok with a[i] as argument is false, set flag to 0\n increment cnt3\n if cnt3 is greater than 16, set flag to 0\n end of the block\n end of the block\n if op is 1, set flag to 0\n if op is 2 and ( cnt2 is 0 or cnt2 is greater than 16 ), set flag to 0\n if op is 3 and ( cnt3 is 0 or cnt3 is greater than 16 ), set flag to 0\n if flag is true\n print \"YES\" print newline\n else\n print \"NO\" print newline\n return to indicate successful execution\nend of the block","testcases":[[["mike@codeforces.com"],["YES"]],[["john.smith@codeforces.ru\/contest.icpc\/12"],["NO"]],[["test@test.ri\/abacaba"],["YES"]],[["@ops"],["NO"]],[["this-is-the-test"],["NO"]],[["mike@codeforces.commike@codeforces.com"],["NO"]],[["oooop\/oooop"],["NO"]],[["w@S8\/XU.5._R7fHq.@..\/e.WP!54Ey1L.9jv"],["NO"]],[["lNC9D1L5U@.L!_!CcAOEEx.0z.aiW\/S430sbQT"],["NO"]],[["@\/YTd.K1@lD"],["NO"]],[["Fyi!d1l@.OesGopTnRn.81xdSb8q.\/MzuI"],["NO"]],[["_TlPy65w\/@.Vl@.8k"],["NO"]],[["xpS@._s8.e0lJci\/.LdiT"],["NO"]],[["lGwo8.D2@.3"],["NO"]],[["Ccz9T5rKZQuEerGo@6l."],["NO"]],[["Y@5nh@8.9P.Bx5AaY.1g.Tc_MK7.g_..0."],["NO"]],[["Q2\/6y!SP9sG@7zIGr.Du_nR8."],["NO"]],[["eWfLL@gW!BEJUxFh@dghf.d4.FiYp\/2.Pr7a\/5O6zXdAkikjCEDrb"],["NO"]],[["8oI\/a@Q"],["NO"]],[["J@Y9Gz550l@PqVZdQ!u"],["NO"]],[["VTE6aTTta@DHe4xeG@6.c2R.J.O7sndWEEW.9j@.l..3Bs"],["NO"]],[["aeo2XkK@UX.nQJN!Tg..wGN5YOi68U.oP2Yl3\/"],["NO"]],[["m13zREg8LbPr@T2.Z9@g.9u.v.A..XNH\/1\/tloIceXydZf3"],["NO"]],[["4@@..f3ZT.\/oUGZ@"],["NO"]],[["G.rVAxwDx@a.PVSe!KtpX4tzs\/0yQGzZCPJPJoda"],["NO"]],[["SV9T5RR425Sl0b@kzj.XT.PFWc..ho\/VE7gjf"],["NO"]],[["bgko@1..\/xwSj_J"],["NO"]],[["n5ymLC.bE@ukio.im2..\/."],["NO"]],[["zr.KB_6ZMSwI2GA5@R\/4iP1ZKHpszW!YN\/"],["NO"]],[["@alK@pR"],["NO"]],[["al_Y2I4IKp@A_N.ruCw0VL\/hRzJtx.S7sp\/r!c.n9ffh"],["NO"]],[["C1rE26_rTAVzLm@6@X5OGX.ibJ9.\/kkBEVlcU"],["NO"]],[["feGSXP@eyUfr8.x4Re.JL.6B.r\/fX_"],["NO"]],[["Ht15T@50eo.E@."],["NO"]],[["k9MITs_Ar.JL2RRs4@VRq.wCuJ.6..amF.fE4.5I.6fJ7gz7"],["NO"]],[["MiWPE8@fc.\/IViqq4T4PSUuMdhH"],["NO"]],[["pxSCmv!NbMvz2@pTQ.t!.Ntz\/QEh_sl"],["NO"]],[["s@mH@RO_\/iWD"],["NO"]],[["UP51i49wX@pvx@2LWm8w\/G4M3J.\/9L6Szy"],["NO"]],[["xC_5Vx8NgF..ln@X1.drRTX..1vx.Xb3of@\/PQYPeq@_y8!h_iF"],["NO"]],[["qG3@LKp"],["YES"]],[["flTq1knyb@2!Mtfss"],["NO"]],[["\/pqi7WXQPJFM4q1@hxUyUy\/_pWo0n"],["NO"]],[["zXme@.Dq.TWBs.fB.M"],["NO"]],[["o3EaAnc3K6@h"],["YES"]],[["G\/AZdVMTzRLV4Ucm@eQ!..pq!..tRTi5.Ejkqa\/HGpFYk"],["NO"]],[[".c_V@L.1v!AFAEk7glMq.ag8Sy8@0.Qm\/OLKoJpZlac"],["NO"]],[["WKxNIM79u@I.RM"],["NO"]],[["POTjlYcxAZsbyZPDh@sPm.z6aVaO.H1wEUhD9YvROQFUk\/M_jTHS_6!"],["NO"]],[["pbRIiuA@KZ2hVed2fMikA.@ebd.tE2Y"],["NO"]],[["OlS_OwxYhH@im.0A7o\/juNlxB"],["YES"]],[["xkjHHDRBEFwgNP@G9TGStEs2Lu.BJge3EBXw3c9EfE"],["YES"]],[["bK@8X7tQO.pXBHJpDewD"],["YES"]],[["kKUXy6@0WefbXz39ywP.Q3r7uF"],["YES"]],[["SllbRLdZ6@.T.E3x.BE2nIv.5db_.38.\/zgVGNjpldr"],["NO"]],[["4lBJkY8c097oa@ZYmVbtiyyYN.gbj"],["YES"]],[["F@JX4.SI1\/0EY3XmYatfY"],["YES"]],[["oLo01@B77Pu.9R.vtAZG0.HQSunv0J."],["NO"]],[["xLEctap0T@22U9W_fA\/7iQeJGFu1lSgMZ"],["YES"]],[["WYh@yUWfOQiF.gOK9k8aEa"],["YES"]],[["BPxNVANhtEh@Oh_go."],["NO"]],[["mGIY@cHRNC8GlJ\/2pcl3LYxpi3PaKGs"],["YES"]],[["x6yfn7BGwqWd@.N\/UXC"],["NO"]],[["cUIr@cP.eGQC2xJXvI1X7"],["YES"]],[["MLZ6e1vgZ4hOI@ktWk.Ro.o6C4\/i8cnKHT"],["YES"]],[["XCJIa@jFaP.Eu28YaoT9Z.Epk.Z\/4TBzLWf724zE1r"],["YES"]],[["Cz1U1xjg6iW0U@.97HoVA.YG.Qd.eI.DCXxtibi6HG.GV\/0sN"],["NO"]],[["nrKbWV@P0irxQoRxDsNvG\/69WxCwCsfB"],["YES"]],[["yI1nRv3FbuhgaI@.Y9vKe.8oc.BLi.6JfYT\/tT5d36"],["NO"]],[["IGsma3L6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR\/_97Ltj3"],["YES"]],[["Uu538LDu9Bye@Gu0W0P5a.b9zA9nSaNhzB_TQ2.z\/qfi5CZrH"],["YES"]],[["bdHl525me@XzR_iO23v.YFXbnHUybbgw.i\/WVEhm"],["YES"]],[["NQsZ0K@eE8VMB.w2nYtKImB.4nUF"],["YES"]],[["186@E.MmBaKLj.WYpt4wPZkzv93"],["YES"]],[["hmhYxkGtWYRJFtBU@Drg3L7WKujE.lU61Ljqxv.\/FJ4X"],["NO"]],[["t1RIUz9l3FA15@tOL9.rv.NjhouD."],["NO"]],[["_I4ytjyccT@q.WIc.Cqn"],["YES"]],[["LwHHRYq@whOoq.e9b6i0xnoWBl7z.SGJiJe\/iUij1x7"],["YES"]],[["Yesx@9_KiJq2cBI6."],["NO"]],[["Zu5VFUtSbIw@ner5e"],["YES"]],[["test@test."],["NO"]],[["test@.test"],["NO"]],[["est.@test"],["NO"]],[["test@test.ru\/"],["NO"]],[["asd@asd@"],["NO"]],[["@"],["NO"]],[["\/"],["NO"]],[["."],["NO"]],[["mike@"],["NO"]],[["@mike"],["NO"]],[["@mail.ru"],["NO"]],[["test.me"],["NO"]],[["$@ru"],["NO"]],[["testme@o.o.o.o.o\/ooooo"],["YES"]],[["oooop\/oooop"],["NO"]],[["mail.ru\/a"],["NO"]],[["mike@mail.ru\/aaa"],["YES"]],[["mike@mike.mike"],["YES"]]]}} +{"instance_id":"pseudo_to_code_2k_92","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create ints i, j, flag = 1, and dot = 0\n let string ch\n read ch\n for i = 0 to length of ch exclusive\n if ch[i] is equal to '@'\n if i is greater than 16 or i is less than 1\n set flag to 0\n move to print\n end of the block\n break loop\n else if ch[i] is greater than or equal to 'a' and ch[i] is less than or equal to 'z' or if ch[i] is greater than or equal to 'A' and ch[i] is less than or equal to 'Z'\n continue to next loop\n else if ch[i] is greater than or equal to '0' and ch[i] is less than or equal to '9' and if ch[i] is equal to '_'\n continue to next loop iteration\n else\n set flag to 0\n go to print\n end of the block\n end of the block\nidentify dot\n for j = i + 1 to length of ch exclusive\n if ch[j] is equal to '.'\n if j - 1 is greater than 17 or j - i is less than 2\n set flag to 0\n go to print\n end of the block\n set i to j\n else if ch[j] is greater than or equal to 'a' and ch[j] is less than or equal to 'z' or if ch[j] is greater than or equal to 'A' and ch[j] is less than or equal to 'Z'\n continue to next loop\n else if ch[j] is greater than or equal to '0' and ch[j] is less than or equal to '9' or if ch[j] is equal to '_'\n continue to next loop\n else if ch[j] is equal to '\/'\n if j - 1 is greater than 17 or j - i is less than 2\n set flag to 0\n go to print\n end of the block\n set i to j\n otherwise\n set flag to 0\n move to print\n end of the block\n end of the block\n if j - i is greater than 17 or j - i is less than 2, set flag to 0\nidentify print\n print \"YES\\n\" if flag is truthy or \"NO\\n\" if not\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int i, j, flag = 1, dot = 0;\n string ch;\n cin >> ch;\n for (i = 0; i < ch.length(); i++) {\n if (ch[i] == '@') {\n if (i > 16 || i < 1) {\n flag = 0;\n goto print;\n }\n break;\n } else if ((ch[i] >= 'a' && ch[i] <= 'z') || (ch[i] >= 'A' && ch[i] <= 'Z'))\n continue;\n else if ((ch[i] >= '0' && ch[i] <= '9') || (ch[i] == '_'))\n continue;\n else {\n flag = 0;\n goto print;\n }\n }\ndot:\n for (j = i + 1; j < ch.length(); j++) {\n if (ch[j] == '.') {\n if (j - i > 17 || j - i < 2) {\n flag = 0;\n goto print;\n }\n i = j;\n } else if ((ch[j] >= 'a' && ch[j] <= 'z') || (ch[j] >= 'A' && ch[j] <= 'Z'))\n continue;\n else if ((ch[j] >= '0' && ch[j] <= '9') || (ch[j] == '_'))\n continue;\n else if (ch[j] == '\/') {\n if (j - i > 17 || j - i < 2) {\n flag = 0;\n goto print;\n }\n i = j;\n } else {\n flag = 0;\n goto print;\n }\n }\n if (j - i > 17 || j - i < 2) flag = 0;\nprint:\n (flag) ? (cout << \"YES\\n\") : (cout << \"NO\\n\");\n return 0;\n}","item":{"problem_id":"21A","pseudocode":"define the main function\n create ints i, j, flag = 1, and dot = 0\n let string ch\n read ch\n for i = 0 to length of ch exclusive\n if ch[i] is equal to '@'\n if i is greater than 16 or i is less than 1\n set flag to 0\n move to print\n end of the block\n break loop\n else if ch[i] is greater than or equal to 'a' and ch[i] is less than or equal to 'z' or if ch[i] is greater than or equal to 'A' and ch[i] is less than or equal to 'Z'\n continue to next loop\n else if ch[i] is greater than or equal to '0' and ch[i] is less than or equal to '9' and if ch[i] is equal to '_'\n continue to next loop iteration\n else\n set flag to 0\n go to print\n end of the block\n end of the block\nidentify dot\n for j = i + 1 to length of ch exclusive\n if ch[j] is equal to '.'\n if j - 1 is greater than 17 or j - i is less than 2\n set flag to 0\n go to print\n end of the block\n set i to j\n else if ch[j] is greater than or equal to 'a' and ch[j] is less than or equal to 'z' or if ch[j] is greater than or equal to 'A' and ch[j] is less than or equal to 'Z'\n continue to next loop\n else if ch[j] is greater than or equal to '0' and ch[j] is less than or equal to '9' or if ch[j] is equal to '_'\n continue to next loop\n else if ch[j] is equal to '\/'\n if j - 1 is greater than 17 or j - i is less than 2\n set flag to 0\n go to print\n end of the block\n set i to j\n otherwise\n set flag to 0\n move to print\n end of the block\n end of the block\n if j - i is greater than 17 or j - i is less than 2, set flag to 0\nidentify print\n print \"YES\\n\" if flag is truthy or \"NO\\n\" if not\n return to indicate successful execution\nend of the block","testcases":[[["mike@codeforces.com"],["YES"]],[["john.smith@codeforces.ru\/contest.icpc\/12"],["NO"]],[["test@test.ri\/abacaba"],["YES"]],[["@ops"],["NO"]],[["this-is-the-test"],["NO"]],[["mike@codeforces.commike@codeforces.com"],["NO"]],[["oooop\/oooop"],["NO"]],[["w@S8\/XU.5._R7fHq.@..\/e.WP!54Ey1L.9jv"],["NO"]],[["lNC9D1L5U@.L!_!CcAOEEx.0z.aiW\/S430sbQT"],["NO"]],[["@\/YTd.K1@lD"],["NO"]],[["Fyi!d1l@.OesGopTnRn.81xdSb8q.\/MzuI"],["NO"]],[["_TlPy65w\/@.Vl@.8k"],["NO"]],[["xpS@._s8.e0lJci\/.LdiT"],["NO"]],[["lGwo8.D2@.3"],["NO"]],[["Ccz9T5rKZQuEerGo@6l."],["NO"]],[["Y@5nh@8.9P.Bx5AaY.1g.Tc_MK7.g_..0."],["NO"]],[["Q2\/6y!SP9sG@7zIGr.Du_nR8."],["NO"]],[["eWfLL@gW!BEJUxFh@dghf.d4.FiYp\/2.Pr7a\/5O6zXdAkikjCEDrb"],["NO"]],[["8oI\/a@Q"],["NO"]],[["J@Y9Gz550l@PqVZdQ!u"],["NO"]],[["VTE6aTTta@DHe4xeG@6.c2R.J.O7sndWEEW.9j@.l..3Bs"],["NO"]],[["aeo2XkK@UX.nQJN!Tg..wGN5YOi68U.oP2Yl3\/"],["NO"]],[["m13zREg8LbPr@T2.Z9@g.9u.v.A..XNH\/1\/tloIceXydZf3"],["NO"]],[["4@@..f3ZT.\/oUGZ@"],["NO"]],[["G.rVAxwDx@a.PVSe!KtpX4tzs\/0yQGzZCPJPJoda"],["NO"]],[["SV9T5RR425Sl0b@kzj.XT.PFWc..ho\/VE7gjf"],["NO"]],[["bgko@1..\/xwSj_J"],["NO"]],[["n5ymLC.bE@ukio.im2..\/."],["NO"]],[["zr.KB_6ZMSwI2GA5@R\/4iP1ZKHpszW!YN\/"],["NO"]],[["@alK@pR"],["NO"]],[["al_Y2I4IKp@A_N.ruCw0VL\/hRzJtx.S7sp\/r!c.n9ffh"],["NO"]],[["C1rE26_rTAVzLm@6@X5OGX.ibJ9.\/kkBEVlcU"],["NO"]],[["feGSXP@eyUfr8.x4Re.JL.6B.r\/fX_"],["NO"]],[["Ht15T@50eo.E@."],["NO"]],[["k9MITs_Ar.JL2RRs4@VRq.wCuJ.6..amF.fE4.5I.6fJ7gz7"],["NO"]],[["MiWPE8@fc.\/IViqq4T4PSUuMdhH"],["NO"]],[["pxSCmv!NbMvz2@pTQ.t!.Ntz\/QEh_sl"],["NO"]],[["s@mH@RO_\/iWD"],["NO"]],[["UP51i49wX@pvx@2LWm8w\/G4M3J.\/9L6Szy"],["NO"]],[["xC_5Vx8NgF..ln@X1.drRTX..1vx.Xb3of@\/PQYPeq@_y8!h_iF"],["NO"]],[["qG3@LKp"],["YES"]],[["flTq1knyb@2!Mtfss"],["NO"]],[["\/pqi7WXQPJFM4q1@hxUyUy\/_pWo0n"],["NO"]],[["zXme@.Dq.TWBs.fB.M"],["NO"]],[["o3EaAnc3K6@h"],["YES"]],[["G\/AZdVMTzRLV4Ucm@eQ!..pq!..tRTi5.Ejkqa\/HGpFYk"],["NO"]],[[".c_V@L.1v!AFAEk7glMq.ag8Sy8@0.Qm\/OLKoJpZlac"],["NO"]],[["WKxNIM79u@I.RM"],["NO"]],[["POTjlYcxAZsbyZPDh@sPm.z6aVaO.H1wEUhD9YvROQFUk\/M_jTHS_6!"],["NO"]],[["pbRIiuA@KZ2hVed2fMikA.@ebd.tE2Y"],["NO"]],[["OlS_OwxYhH@im.0A7o\/juNlxB"],["YES"]],[["xkjHHDRBEFwgNP@G9TGStEs2Lu.BJge3EBXw3c9EfE"],["YES"]],[["bK@8X7tQO.pXBHJpDewD"],["YES"]],[["kKUXy6@0WefbXz39ywP.Q3r7uF"],["YES"]],[["SllbRLdZ6@.T.E3x.BE2nIv.5db_.38.\/zgVGNjpldr"],["NO"]],[["4lBJkY8c097oa@ZYmVbtiyyYN.gbj"],["YES"]],[["F@JX4.SI1\/0EY3XmYatfY"],["YES"]],[["oLo01@B77Pu.9R.vtAZG0.HQSunv0J."],["NO"]],[["xLEctap0T@22U9W_fA\/7iQeJGFu1lSgMZ"],["YES"]],[["WYh@yUWfOQiF.gOK9k8aEa"],["YES"]],[["BPxNVANhtEh@Oh_go."],["NO"]],[["mGIY@cHRNC8GlJ\/2pcl3LYxpi3PaKGs"],["YES"]],[["x6yfn7BGwqWd@.N\/UXC"],["NO"]],[["cUIr@cP.eGQC2xJXvI1X7"],["YES"]],[["MLZ6e1vgZ4hOI@ktWk.Ro.o6C4\/i8cnKHT"],["YES"]],[["XCJIa@jFaP.Eu28YaoT9Z.Epk.Z\/4TBzLWf724zE1r"],["YES"]],[["Cz1U1xjg6iW0U@.97HoVA.YG.Qd.eI.DCXxtibi6HG.GV\/0sN"],["NO"]],[["nrKbWV@P0irxQoRxDsNvG\/69WxCwCsfB"],["YES"]],[["yI1nRv3FbuhgaI@.Y9vKe.8oc.BLi.6JfYT\/tT5d36"],["NO"]],[["IGsma3L6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR\/_97Ltj3"],["YES"]],[["Uu538LDu9Bye@Gu0W0P5a.b9zA9nSaNhzB_TQ2.z\/qfi5CZrH"],["YES"]],[["bdHl525me@XzR_iO23v.YFXbnHUybbgw.i\/WVEhm"],["YES"]],[["NQsZ0K@eE8VMB.w2nYtKImB.4nUF"],["YES"]],[["186@E.MmBaKLj.WYpt4wPZkzv93"],["YES"]],[["hmhYxkGtWYRJFtBU@Drg3L7WKujE.lU61Ljqxv.\/FJ4X"],["NO"]],[["t1RIUz9l3FA15@tOL9.rv.NjhouD."],["NO"]],[["_I4ytjyccT@q.WIc.Cqn"],["YES"]],[["LwHHRYq@whOoq.e9b6i0xnoWBl7z.SGJiJe\/iUij1x7"],["YES"]],[["Yesx@9_KiJq2cBI6."],["NO"]],[["Zu5VFUtSbIw@ner5e"],["YES"]],[["test@test."],["NO"]],[["test@.test"],["NO"]],[["est.@test"],["NO"]],[["test@test.ru\/"],["NO"]],[["asd@asd@"],["NO"]],[["@"],["NO"]],[["\/"],["NO"]],[["."],["NO"]],[["mike@"],["NO"]],[["@mike"],["NO"]],[["@mail.ru"],["NO"]],[["test.me"],["NO"]],[["$@ru"],["NO"]],[["testme@o.o.o.o.o\/ooooo"],["YES"]],[["oooop\/oooop"],["NO"]],[["mail.ru\/a"],["NO"]],[["mike@mail.ru\/aaa"],["YES"]],[["mike@mike.mike"],["YES"]]]}} +{"instance_id":"pseudo_to_code_2k_93","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare myCompare with constant pair address's i, j, from string to integer\n return second element of i is less than second element of j\nend of the block\ncreate string s\ndeclare check with no arguments, returning integer\n create integers x, y, 0, with x = 0, y = 0, flag = 0\n for i = 0 to size of s\n if flag is 0\n if s[i] is '@'\n if i - x is greater than 16 or i - x is less than 1 or i + 1 is size of s, return 0 from function\n set x to i + 1\n set y to i + 1\n set flag to 1\n else if s[i] is alphanumeric or s[i] is digit or s[i] is '_'\n break current loop iteration\n else if s[i] is not alphanumeric or s[i] is not digit or s[i] is not '_'\n return to indicate successful execution\n end of the block\n else if flag is 1\n if s[i] is '\/'\n if i - x is greater than 32 or i - x is less than 1 or i + 1 is size of s or s[i-1] is '.', return 0 from function\n set x to i + 1\n set flag to 2\n else if s[i] is '.'\n if i - y is greater than 16 or i - y is less than 1 or i + 1 is size of s, return 0 from function\n set y to i + 1\n else if s[i] is alphanumeric or s[i] is digit or s[i] is '.' or s[i] is '_'\n if i + 1 is size of s\n if i - x + 1 is greater than 32 or i - x + 1 is less than 1, return 0 from function\n if i - y + 1 is greater than 16 or i - y + 1 is less than 1, return 0 from function\n end of the block\n break current loop iteration\n else if s[i] is not alphanumeric or s[i] is not digit or s[i] is not '.' or s[i] is not '_'\n return to indicate successful execution\n end of the block\n else\n if s[i] is '_' and i + 1 is size of s, return 0 from function\n if s[i] is alphanumeric or s[i] is digit or s[i] is '_'\n if i + 1 is size of s\n if i - x + 1 is greater than 16 or i - x + 1 is less than 1, return 0 from function\n end of the block\n break current loop iteration\n end of the block\n if s[i] is not alphanumeric or s[i] is not digit or s[i] is not '_', return 0 from function\n end of the block\n end of the block\n if flag is greater than 0\n return 1 from function\n else\n return to indicate successful execution\nend of the block\ndefine the main function\n read s\n print \"YES\" if result of run check is true, else \"NO\" print newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"bool myCompare(const pair &i, const pair &j) {\n return i.second < j.second;\n}\nstring s;\nint check() {\n int x = 0, y = 0, flag = 0;\n for (int i = 0; i < s.size(); i++) {\n if (flag == 0) {\n if (s[i] == '@') {\n if ((i - x) > 16 || (i - x) < 1 || (i + 1 == s.size())) return 0;\n x = i + 1;\n y = i + 1;\n flag = 1;\n } else if (isalpha(s[i]) || isdigit(s[i]) || s[i] == '_') {\n continue;\n } else if (!isalpha(s[i]) || !isdigit(s[i]) || s[i] != '_') {\n return 0;\n }\n } else if (flag == 1) {\n if (s[i] == '\/') {\n if ((i - x) > 32 || (i - x) < 1 || (i + 1 == s.size()) || s[i - 1] == '.') return 0;\n x = i + 1;\n flag = 2;\n } else if (s[i] == '.') {\n if ((i - y) > 16 || (i - y) < 1 || (i + 1 == s.size())) return 0;\n y = i + 1;\n } else if (isalpha(s[i]) || isdigit(s[i]) || s[i] == '.' || s[i] == '_') {\n if (i + 1 == s.size()) {\n if ((i - x + 1) > 32 || (i - x + 1) < 1) return 0;\n if ((i - y + 1) > 16 || (i - y + 1) < 1) return 0;\n }\n continue;\n } else if (!isalpha(s[i]) || !isdigit(s[i]) || s[i] != '.' || s[i] != '_') {\n return 0;\n }\n } else {\n if (s[i] == '_' && i + 1 == s.size()) return 0;\n if (isalpha(s[i]) || isdigit(s[i]) || s[i] == '_') {\n if (i + 1 == s.size()) {\n if ((i - x + 1) > 16 || (i - x + 1) < 1) return 0;\n }\n continue;\n }\n if (!isalpha(s[i]) || !isdigit(s[i]) || s[i] != '_') { return 0; }\n }\n }\n if (flag > 0)\n return 1;\n else\n return 0;\n}\nint main() {\n cin >> s;\n cout << (check() ? \"YES\" : \"NO\") << endl;\n return 0;\n}","item":{"problem_id":"21A","pseudocode":"declare myCompare with constant pair address's i, j, from string to integer\n return second element of i is less than second element of j\nend of the block\ncreate string s\ndeclare check with no arguments, returning integer\n create integers x, y, 0, with x = 0, y = 0, flag = 0\n for i = 0 to size of s\n if flag is 0\n if s[i] is '@'\n if i - x is greater than 16 or i - x is less than 1 or i + 1 is size of s, return 0 from function\n set x to i + 1\n set y to i + 1\n set flag to 1\n else if s[i] is alphanumeric or s[i] is digit or s[i] is '_'\n break current loop iteration\n else if s[i] is not alphanumeric or s[i] is not digit or s[i] is not '_'\n return to indicate successful execution\n end of the block\n else if flag is 1\n if s[i] is '\/'\n if i - x is greater than 32 or i - x is less than 1 or i + 1 is size of s or s[i-1] is '.', return 0 from function\n set x to i + 1\n set flag to 2\n else if s[i] is '.'\n if i - y is greater than 16 or i - y is less than 1 or i + 1 is size of s, return 0 from function\n set y to i + 1\n else if s[i] is alphanumeric or s[i] is digit or s[i] is '.' or s[i] is '_'\n if i + 1 is size of s\n if i - x + 1 is greater than 32 or i - x + 1 is less than 1, return 0 from function\n if i - y + 1 is greater than 16 or i - y + 1 is less than 1, return 0 from function\n end of the block\n break current loop iteration\n else if s[i] is not alphanumeric or s[i] is not digit or s[i] is not '.' or s[i] is not '_'\n return to indicate successful execution\n end of the block\n else\n if s[i] is '_' and i + 1 is size of s, return 0 from function\n if s[i] is alphanumeric or s[i] is digit or s[i] is '_'\n if i + 1 is size of s\n if i - x + 1 is greater than 16 or i - x + 1 is less than 1, return 0 from function\n end of the block\n break current loop iteration\n end of the block\n if s[i] is not alphanumeric or s[i] is not digit or s[i] is not '_', return 0 from function\n end of the block\n end of the block\n if flag is greater than 0\n return 1 from function\n else\n return to indicate successful execution\nend of the block\ndefine the main function\n read s\n print \"YES\" if result of run check is true, else \"NO\" print newline\n return to indicate successful execution\nend of the block","testcases":[[["mike@codeforces.com"],["YES"]],[["john.smith@codeforces.ru\/contest.icpc\/12"],["NO"]],[["test@test.ri\/abacaba"],["YES"]],[["@ops"],["NO"]],[["this-is-the-test"],["NO"]],[["mike@codeforces.commike@codeforces.com"],["NO"]],[["oooop\/oooop"],["NO"]],[["w@S8\/XU.5._R7fHq.@..\/e.WP!54Ey1L.9jv"],["NO"]],[["lNC9D1L5U@.L!_!CcAOEEx.0z.aiW\/S430sbQT"],["NO"]],[["@\/YTd.K1@lD"],["NO"]],[["Fyi!d1l@.OesGopTnRn.81xdSb8q.\/MzuI"],["NO"]],[["_TlPy65w\/@.Vl@.8k"],["NO"]],[["xpS@._s8.e0lJci\/.LdiT"],["NO"]],[["lGwo8.D2@.3"],["NO"]],[["Ccz9T5rKZQuEerGo@6l."],["NO"]],[["Y@5nh@8.9P.Bx5AaY.1g.Tc_MK7.g_..0."],["NO"]],[["Q2\/6y!SP9sG@7zIGr.Du_nR8."],["NO"]],[["eWfLL@gW!BEJUxFh@dghf.d4.FiYp\/2.Pr7a\/5O6zXdAkikjCEDrb"],["NO"]],[["8oI\/a@Q"],["NO"]],[["J@Y9Gz550l@PqVZdQ!u"],["NO"]],[["VTE6aTTta@DHe4xeG@6.c2R.J.O7sndWEEW.9j@.l..3Bs"],["NO"]],[["aeo2XkK@UX.nQJN!Tg..wGN5YOi68U.oP2Yl3\/"],["NO"]],[["m13zREg8LbPr@T2.Z9@g.9u.v.A..XNH\/1\/tloIceXydZf3"],["NO"]],[["4@@..f3ZT.\/oUGZ@"],["NO"]],[["G.rVAxwDx@a.PVSe!KtpX4tzs\/0yQGzZCPJPJoda"],["NO"]],[["SV9T5RR425Sl0b@kzj.XT.PFWc..ho\/VE7gjf"],["NO"]],[["bgko@1..\/xwSj_J"],["NO"]],[["n5ymLC.bE@ukio.im2..\/."],["NO"]],[["zr.KB_6ZMSwI2GA5@R\/4iP1ZKHpszW!YN\/"],["NO"]],[["@alK@pR"],["NO"]],[["al_Y2I4IKp@A_N.ruCw0VL\/hRzJtx.S7sp\/r!c.n9ffh"],["NO"]],[["C1rE26_rTAVzLm@6@X5OGX.ibJ9.\/kkBEVlcU"],["NO"]],[["feGSXP@eyUfr8.x4Re.JL.6B.r\/fX_"],["NO"]],[["Ht15T@50eo.E@."],["NO"]],[["k9MITs_Ar.JL2RRs4@VRq.wCuJ.6..amF.fE4.5I.6fJ7gz7"],["NO"]],[["MiWPE8@fc.\/IViqq4T4PSUuMdhH"],["NO"]],[["pxSCmv!NbMvz2@pTQ.t!.Ntz\/QEh_sl"],["NO"]],[["s@mH@RO_\/iWD"],["NO"]],[["UP51i49wX@pvx@2LWm8w\/G4M3J.\/9L6Szy"],["NO"]],[["xC_5Vx8NgF..ln@X1.drRTX..1vx.Xb3of@\/PQYPeq@_y8!h_iF"],["NO"]],[["qG3@LKp"],["YES"]],[["flTq1knyb@2!Mtfss"],["NO"]],[["\/pqi7WXQPJFM4q1@hxUyUy\/_pWo0n"],["NO"]],[["zXme@.Dq.TWBs.fB.M"],["NO"]],[["o3EaAnc3K6@h"],["YES"]],[["G\/AZdVMTzRLV4Ucm@eQ!..pq!..tRTi5.Ejkqa\/HGpFYk"],["NO"]],[[".c_V@L.1v!AFAEk7glMq.ag8Sy8@0.Qm\/OLKoJpZlac"],["NO"]],[["WKxNIM79u@I.RM"],["NO"]],[["POTjlYcxAZsbyZPDh@sPm.z6aVaO.H1wEUhD9YvROQFUk\/M_jTHS_6!"],["NO"]],[["pbRIiuA@KZ2hVed2fMikA.@ebd.tE2Y"],["NO"]],[["OlS_OwxYhH@im.0A7o\/juNlxB"],["YES"]],[["xkjHHDRBEFwgNP@G9TGStEs2Lu.BJge3EBXw3c9EfE"],["YES"]],[["bK@8X7tQO.pXBHJpDewD"],["YES"]],[["kKUXy6@0WefbXz39ywP.Q3r7uF"],["YES"]],[["SllbRLdZ6@.T.E3x.BE2nIv.5db_.38.\/zgVGNjpldr"],["NO"]],[["4lBJkY8c097oa@ZYmVbtiyyYN.gbj"],["YES"]],[["F@JX4.SI1\/0EY3XmYatfY"],["YES"]],[["oLo01@B77Pu.9R.vtAZG0.HQSunv0J."],["NO"]],[["xLEctap0T@22U9W_fA\/7iQeJGFu1lSgMZ"],["YES"]],[["WYh@yUWfOQiF.gOK9k8aEa"],["YES"]],[["BPxNVANhtEh@Oh_go."],["NO"]],[["mGIY@cHRNC8GlJ\/2pcl3LYxpi3PaKGs"],["YES"]],[["x6yfn7BGwqWd@.N\/UXC"],["NO"]],[["cUIr@cP.eGQC2xJXvI1X7"],["YES"]],[["MLZ6e1vgZ4hOI@ktWk.Ro.o6C4\/i8cnKHT"],["YES"]],[["XCJIa@jFaP.Eu28YaoT9Z.Epk.Z\/4TBzLWf724zE1r"],["YES"]],[["Cz1U1xjg6iW0U@.97HoVA.YG.Qd.eI.DCXxtibi6HG.GV\/0sN"],["NO"]],[["nrKbWV@P0irxQoRxDsNvG\/69WxCwCsfB"],["YES"]],[["yI1nRv3FbuhgaI@.Y9vKe.8oc.BLi.6JfYT\/tT5d36"],["NO"]],[["IGsma3L6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR\/_97Ltj3"],["YES"]],[["Uu538LDu9Bye@Gu0W0P5a.b9zA9nSaNhzB_TQ2.z\/qfi5CZrH"],["YES"]],[["bdHl525me@XzR_iO23v.YFXbnHUybbgw.i\/WVEhm"],["YES"]],[["NQsZ0K@eE8VMB.w2nYtKImB.4nUF"],["YES"]],[["186@E.MmBaKLj.WYpt4wPZkzv93"],["YES"]],[["hmhYxkGtWYRJFtBU@Drg3L7WKujE.lU61Ljqxv.\/FJ4X"],["NO"]],[["t1RIUz9l3FA15@tOL9.rv.NjhouD."],["NO"]],[["_I4ytjyccT@q.WIc.Cqn"],["YES"]],[["LwHHRYq@whOoq.e9b6i0xnoWBl7z.SGJiJe\/iUij1x7"],["YES"]],[["Yesx@9_KiJq2cBI6."],["NO"]],[["Zu5VFUtSbIw@ner5e"],["YES"]],[["test@test."],["NO"]],[["test@.test"],["NO"]],[["est.@test"],["NO"]],[["test@test.ru\/"],["NO"]],[["asd@asd@"],["NO"]],[["@"],["NO"]],[["\/"],["NO"]],[["."],["NO"]],[["mike@"],["NO"]],[["@mike"],["NO"]],[["@mail.ru"],["NO"]],[["test.me"],["NO"]],[["$@ru"],["NO"]],[["testme@o.o.o.o.o\/ooooo"],["YES"]],[["oooop\/oooop"],["NO"]],[["mail.ru\/a"],["NO"]],[["mike@mail.ru\/aaa"],["YES"]],[["mike@mike.mike"],["YES"]]]}} +{"instance_id":"pseudo_to_code_2k_94","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nn=int\ncomputer and vis=array of 201 int, check=array of 3 by 201 int\nvv=array of 201 vector of int\nfunction bfs (get int k and now, return int)\n q=queue of int\n ans=n\n for i=1 to n inclusive\n if check[k][i] is 0 push i into q\n end of the block\n while q is not empty\n fill vis with 0\n while q is not empty\n head = first item in q\n pop q\n if vis[head] is n\n push head into q\n break\n end of the block\n increment vis[head]\n if computer[head] is not now\n push head into q\n continue\n end of the block\n for i=0 to size of vv[head] exclusive\n decrement check[k][vv[head][i]]\n if check[k][vv[head][i]] is 0 push vv[head][i] into q\n end of the block\n end of the block\n now = 1 if now is 3 else now+1\n if q is not empty increment ans\n end of the block\n return ans\nend of the block\ndefine the main function\n while read n\n fill check with 0\n for i=1 to n inclusive clear vv[i]\n for i=1 to n inclusive read compute[i]\n for i=1 to n inclusive\n ki=int\n read ki\n for j=1 to ki inclusive\n aj=int\n read aj\n add i to end of vv[aj]\n increment check[0][i],check[1][i],check[2][i]\n end of the block\n end of the block\n ans=3f3f3f3f in exadecimal\n for i=1 to 3 exclusive ans=min(ans, bfs(i-1,i))\n print ans\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n;\nint computer[201], check[3][201], vis[201];\nvector vv[201];\nint bfs(int k, int now) {\n queue q;\n int ans = n;\n for (int i = 1; i <= n; i++) {\n if (check[k][i] == 0) q.push(i);\n }\n while (!q.empty()) {\n memset(vis, 0, sizeof(vis));\n while (!q.empty()) {\n int head = q.front();\n q.pop();\n if (vis[head] == n) {\n q.push(head);\n break;\n }\n vis[head]++;\n if (computer[head] != now) {\n q.push(head);\n continue;\n }\n for (int i = 0; i < vv[head].size(); i++) {\n check[k][vv[head][i]]--;\n if (check[k][vv[head][i]] == 0) q.push(vv[head][i]);\n }\n }\n now = (now == 3 ? 1 : now + 1);\n if (!q.empty()) ans++;\n }\n return ans;\n}\nint main() {\n while (cin >> n) {\n memset(check, 0, sizeof(check));\n for (int i = 1; i <= n; i++) vv[i].clear();\n for (int i = 1; i <= n; i++) cin >> computer[i];\n for (int i = 1; i <= n; i++) {\n int ki;\n cin >> ki;\n for (int j = 1; j <= ki; j++) {\n int aj;\n cin >> aj;\n vv[aj].push_back(i);\n check[0][i]++, check[1][i]++, check[2][i]++;\n }\n }\n int ans = 0x3f3f3f3f;\n for (int i = 1; i <= 3; i++) ans = min(ans, bfs(i - 1, i));\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"213A","pseudocode":"n=int\ncomputer and vis=array of 201 int, check=array of 3 by 201 int\nvv=array of 201 vector of int\nfunction bfs (get int k and now, return int)\n q=queue of int\n ans=n\n for i=1 to n inclusive\n if check[k][i] is 0 push i into q\n end of the block\n while q is not empty\n fill vis with 0\n while q is not empty\n head = first item in q\n pop q\n if vis[head] is n\n push head into q\n break\n end of the block\n increment vis[head]\n if computer[head] is not now\n push head into q\n continue\n end of the block\n for i=0 to size of vv[head] exclusive\n decrement check[k][vv[head][i]]\n if check[k][vv[head][i]] is 0 push vv[head][i] into q\n end of the block\n end of the block\n now = 1 if now is 3 else now+1\n if q is not empty increment ans\n end of the block\n return ans\nend of the block\ndefine the main function\n while read n\n fill check with 0\n for i=1 to n inclusive clear vv[i]\n for i=1 to n inclusive read compute[i]\n for i=1 to n inclusive\n ki=int\n read ki\n for j=1 to ki inclusive\n aj=int\n read aj\n add i to end of vv[aj]\n increment check[0][i],check[1][i],check[2][i]\n end of the block\n end of the block\n ans=3f3f3f3f in exadecimal\n for i=1 to 3 exclusive ans=min(ans, bfs(i-1,i))\n print ans\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["1","1","0"],["1"]],[["5","2 2 1 1 3","1 5","2 5 1","2 5 4","1 5","0"],["7"]],[["7","1 3 3 1 2 1 1","0","1 1","1 1","2 1 6","3 1 2 7","1 1","1 1"],["11"]],[["2","2 1","0","1 1"],["4"]],[["3","2 1 2","0","0","0"],["4"]],[["4","2 1 1 1","0","0","1 1","1 3"],["6"]],[["6","1 1 2 3 3 1","2 2 3","0","0","0","2 2 1","1 1"],["10"]],[["8","2 2 2 1 1 2 1 1","3 5 6 7","1 5","2 5 6","1 5","0","1 5","1 5","2 5 6"],["11"]],[["9","3 3 2 1 3 1 2 2 1","2 4 3","0","2 4 2","0","1 4","2 4 2","0","1 4","3 4 3 8"],["13"]],[["10","3 1 2 2 2 1 2 1 1 1","0","2 6 9","0","1 9","0","1 3","4 3 6 5 2","3 6 4 2","0","1 3"],["14"]],[["11","1 2 2 3 3 2 2 2 2 3 1","1 4","2 7 11","0","0","1 2","1 11","0","1 2","3 7 11 2","3 3 2 9","0"],["14"]],[["12","1 3 2 2 1 3 2 1 3 2 2 2","2 3 4","3 12 11 10","1 8","2 8 7","2 9 10","1 3","0","0","1 4","4 3 1 12 9","3 8 3 4","1 4"],["18"]],[["13","3 3 2 2 1 3 1 1 1 1 2 1 2","5 6 3 11 13 12","1 6","2 10 6","3 6 3 11","1 6","1 10","3 6 2 3","4 6 3 9 11","3 6 2 3","0","3 6 2 3","4 6 3 4 13","2 6 3"],["21"]],[["14","3 2 2 1 2 1 1 3 1 2 2 3 1 1","2 9 13","3 9 13 8","2 9 6","3 9 6 13","1 9","1 9","3 9 6 13","2 9 13","0","4 9 3 13 4","4 9 6 13 2","2 9 13","1 9","8 9 5 6 3 13 7 4 11"],["20"]],[["15","1 2 3 2 3 2 2 2 3 3 3 2 3 1 3","5 2 7 4 3 6","0","2 7 4","2 2 15","1 7","1 7","0","2 4 6","1 6","2 15 3","4 12 2 15 7","0","3 2 5 6","3 2 4 6","1 2"],["20"]],[["16","3 3 1 3 2 3 2 2 3 1 2 3 2 2 2 3","1 14","4 14 10 13 6","3 14 15 6","1 14","4 14 10 9 7","4 14 10 13 9","4 14 10 13 6","4 14 4 12 3","2 14 4","1 14","1 14","2 14 1","4 14 10 4 1","0","2 14 10","1 14"],["22"]],[["17","3 2 3 2 2 2 1 3 3 3 3 2 3 3 3 1 1","0","0","2 8 10","4 12 8 6 16","0","2 8 13","3 2 8 10","1 12","4 8 17 3 16","2 2 8","0","1 2","2 8 10","2 12 8","2 8 10","1 8","2 12 8"],["21"]],[["18","2 1 1 3 2 1 3 2 3 3 2 2 1 1 3 1 1 3","3 16 8 6","3 16 6 1","4 6 13 5 7","2 6 2","4 16 6 17 1","2 16 8","3 6 17 12","1 16","0","3 6 15 1","3 16 6 12","7 16 9 8 6 13 17 14","1 6","1 6","3 8 6 13","0","1 6","3 9 6 13"],["26"]],[["19","2 1 2 3 3 3 2 1 1 1 1 3 3 1 1 1 2 2 3","0","2 1 7","0","4 3 2 17 13","1 17","1 3","3 1 3 6","4 1 17 9 13","3 1 16 17","0","3 3 6 17","1 6","6 10 6 7 17 9 11","3 10 17 13","4 3 17 13 8","1 3","3 6 7 16","0","6 1 7 17 11 13 15"],["29"]],[["20","1 2 2 2 1 3 3 2 2 1 2 2 3 1 2 2 2 1 1 1","2 10 8","5 10 12 3 20 7","0","3 10 15 3","0","3 14 17 3","2 12 20","0","3 17 10 12","1 17","1 5","1 5","0","1 18","3 18 5 12","5 5 12 8 3 19","0","0","1 12","1 18"],["24"]],[["11","3 1 3 2 3 2 3 2 3 1 3","6 2 3 9 5 7 10","1 6","2 6 2","5 6 2 3 9 5","2 3 9","0","5 3 9 5 8 4","4 2 3 9 5","2 2 3","8 6 2 3 9 5 4 11 7","4 2 3 9 5"],["21"]],[["12","2 3 3 1 1 3 2 2 3 1 3 3","1 9","1 1","2 2 11","5 1 2 11 5 8","4 9 10 1 11","5 9 10 12 11 5","4 1 12 11 5","5 10 1 2 12 11","0","1 9","1 12","0"],["19"]],[["13","3 2 2 1 3 3 2 3 2 2 1 2 3","7 4 3 2 5 9 8 13","1 4","1 4","0","3 4 2 6","2 4 2","4 4 3 2 9","5 4 2 6 9 7","3 4 2 6","6 4 3 2 5 9 7","6 4 3 2 6 9 7","8 4 2 6 5 9 8 11 10","7 4 3 2 6 9 8 11"],["21"]],[["14","2 3 1 3 1 1 1 2 2 3 1 1 3 1","4 14 9 8 5","4 4 8 5 1","9 4 14 9 8 1 2 13 7 12","0","2 14 8","2 4 14","7 9 6 10 8 1 2 13","2 4 6","1 14","1 9","8 4 6 10 8 5 1 2 3","7 14 6 10 8 1 2 7","5 10 8 5 1 2","0"],["21"]],[["15","3 2 2 2 1 1 2 1 1 2 2 3 3 3 2","1 13","4 13 1 8 14","10 5 13 1 8 14 4 2 11 15 10","6 5 13 1 8 9 14","0","11 5 13 1 8 14 4 2 11 10 3 12","11 13 1 8 14 4 2 11 15 10 3 6","2 13 1","4 5 13 1 8","8 5 13 1 8 14 2 11 15","6 5 13 1 8 14 2","10 5 13 1 8 14 2 11 15 10 3","0","4 13 1 8 9","8 5 13 1 8 9 14 2 11"],["23"]],[["16","3 1 2 3 3 2 3 1 3 2 2 1 2 2 1 2","0","0","7 2 8 4 12 5 9 11","1 1","4 1 8 4 12","5 2 4 12 5 11","4 4 12 5 10","0","5 1 8 4 12 5","6 1 4 12 5 9 11","6 2 1 8 4 12 5","2 4 13","3 1 8 4","8 1 4 13 12 5 10 3 6","4 4 12 5 6","8 8 4 13 12 5 9 6 14"],["26"]],[["17","2 3 1 3 3 3 1 1 1 2 2 2 3 2 3 3 2","5 4 14 2 11 7","3 13 4 14","7 6 4 14 2 1 10 12","2 6 13","9 4 2 9 8 7 17 1 10 12","0","5 4 14 2 9 11","4 13 4 2 11","4 13 4 14 2","7 13 4 2 11 8 7 1","4 13 4 14 2","8 6 4 2 8 7 17 1 10","0","1 4","7 13 4 14 2 9 8 7","6 4 2 17 1 10 12","5 13 4 2 9 8"],["27"]],[["18","1 2 3 3 2 2 1 1 3 1 2 3 2 3 1 2 2 3","5 9 3 14 12 2","7 9 4 3 14 16 7 12","1 9","1 9","6 9 14 12 1 6 15","6 9 14 12 2 1 11","2 9 14","7 9 14 7 12 2 1 6","0","6 9 18 14 7 1 6","4 9 14 7 1","2 9 14","6 9 3 14 7 1 6","2 9 3","9 9 3 14 16 12 2 1 6 17","4 9 4 18 14","8 9 18 14 12 1 11 6 13","2 9 4"],["26"]],[["19","2 3 3 2 3 1 3 1 2 2 2 1 1 1 2 2 1 3 3","0","3 1 10 6","8 1 6 2 17 18 12 15 7","5 6 2 9 17 18","6 6 2 17 18 12 16","1 11","9 1 11 6 2 17 18 4 12 15","3 1 6 2","4 1 6 2 8","0","1 1","5 1 6 2 17 18","12 1 10 6 2 8 17 18 4 12 15 7 3","10 11 6 2 17 18 4 12 16 15 7","8 1 6 2 8 17 18 12 16","8 11 6 2 9 17 18 4 12","3 11 6 2","5 10 6 2 9 17","10 1 6 2 17 18 12 5 15 7 3"],["30"]],[["20","2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1","1 7","13 7 1 11 4 6 16 20 12 5 18 19 15 10","8 7 1 11 4 6 17 8 16","3 7 1 11","9 7 1 11 4 6 8 20 12 3","4 7 1 11 4","0","6 7 1 11 4 6 17","4 7 1 11 4","7 7 1 11 4 6 17 5","2 7 1","9 7 1 11 4 6 17 8 14 20","11 7 1 11 4 6 20 3 5 15 10 2","5 7 1 11 4 6","9 7 1 11 4 6 8 16 14 5","5 7 1 11 4 6","5 7 1 11 4 6","11 7 1 11 4 9 6 17 8 20 3 5","11 7 1 11 4 6 17 16 20 12 5 18","6 7 1 11 4 6 14"],["35"]],[["21","1 2 1 3 3 3 1 1 2 2 3 1 3 1 3 3 1 1 1 2 2","1 5","0","1 11","0","0","0","1 8","0","1 11","1 1","1 19","0","1 2","0","0","0","0","1 19","0","0","0"],["25"]],[["22","2 3 2 3 3 2 1 2 3 3 1 3 1 1 2 2 3 3 1 3 2 2","0","1 8","1 22","1 12","0","1 14","0","0","0","2 22 14","1 12","0","0","0","0","0","0","0","0","1 16","1 13","0"],["25"]],[["23","3 1 3 3 2 2 2 1 3 2 3 1 1 1 1 2 3 1 2 1 3 1 1","0","1 11","1 11","2 11 16","1 2","3 11 1 12","2 11 16","2 12 2","1 13","2 12 2","0","0","0","2 13 11","0","1 11","2 12 2","3 16 6 21","1 11","0","0","2 11 12","0"],["27"]],[["24","1 2 1 1 2 2 1 1 3 2 3 1 3 2 3 3 1 1 3 2 3 2 1 2","1 16","0","0","1 2","0","0","0","0","1 2","0","0","0","0","0","0","0","2 12 24","0","0","1 11","0","0","0","0"],["27"]],[["25","3 3 1 1 1 2 2 2 3 1 2 3 2 1 2 2 2 3 2 1 2 3 2 1 1","0","0","0","0","0","0","1 12","0","1 19","0","2 12 21","2 3 10","0","1 21","0","1 9","1 3","0","0","2 3 2","0","1 12","0","1 3","2 21 9"],["29"]],[["26","1 2 2 1 1 2 1 1 2 1 3 1 3 1 2 3 3 3 2 1 2 1 3 3 2 2","1 9","1 1","0","0","0","0","0","0","0","0","0","1 5","0","2 15 12","1 8","0","0","0","0","2 3 26","0","0","0","1 22","0","1 8"],["30"]],[["27","2 1 1 3 2 1 1 2 3 1 1 2 2 2 1 2 1 1 3 3 3 1 1 1 3 1 1","0","0","0","1 12","0","0","0","0","0","0","1 26","0","0","0","0","1 27","0","0","0","0","0","0","1 5","0","2 20 27","1 18","0"],["30"]],[["28","2 1 1 3 2 3 2 2 1 3 2 3 3 2 3 1 2 2 3 3 3 3 1 3 2 1 3 3","0","1 7","0","2 28 18","1 28","0","0","0","0","0","0","2 10 18","3 8 10 18","0","2 1 20","0","1 18","1 27","2 27 18","0","0","1 28","0","0","0","0","1 28","1 9"],["33"]],[["29","3 3 3 3 3 1 1 1 3 2 2 1 1 3 1 1 1 2 1 2 3 1 1 2 1 3 1 2 3","0","0","0","0","0","1 1","0","0","2 28 15","0","0","0","2 24 23","1 28","0","1 28","1 20","0","0","0","0","1 28","0","0","2 23 16","0","0","1 7","1 28"],["32"]],[["30","1 3 3 3 2 3 1 3 3 3 3 2 3 1 3 2 1 1 1 1 2 3 2 1 1 3 3 2 2 2","0","1 20","0","1 7","2 6 9","1 20","1 20","3 7 6 9","2 10 6","0","0","2 6 9","0","0","1 20","2 6 9","2 6 9","0","2 6 9","0","2 6 9","3 27 6 9","2 6 9","2 6 9","0","0","0","2 6 9","3 6 9 19","3 27 6 9"],["34"]],[["4","1 1 2 3","1 2","1 3","0","1 1"],["8"]]]}} +{"instance_id":"pseudo_to_code_2k_95","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet n be an int\nlet computer be an integer array of length 201, check an integer matrix of size 3x201, vis an integer array of length 201\nlet vv be an integer vector of size 201\nin int function bsf that takes int num, int st\n let q be a queue of int\n let ans = n be an int\n for i = 1 to n inclusive\n if che[num][i] is 0, push i in q\n end of the block\n while q is not empty\n reset vis to all 0\n while q is not empty\n let head = int = result of calling front on q\n pop q\n if vis at head is n\n push head in q\n exit loop\n end of the block\n increment vis[head]\n if computer at head is not st\n push head in q\n next iteration\n end of the block\n for i = 0 to size of vv[head] exclusive\n let v = vv[head][i] be an int\n decrement check[num][v]\n if check[num][v] is 0 then push v in q\n end of the block\n end of the block\n set st to 1 if st is 3 else set st to st + 1\n if q is not empty then increment ans\n end of the block\n return ans\nend of the block\ndefine the main function\n while reading n\n reset check to all 0\n clear n elements of vv[i]\n read n elements of computer\n for i = 1 to n inclusive\n let ki = integer\n read ki\n for j = 1 to ki inclusive\n let aj be an integer\n read aj\n add i to the end of vv[aj]\n increment check[0][i]++, check[1][i]++, check[2][i]++\n end of the block\n end of the block\n let ans be an int = 0x3f3f3f3f\n for i = 1 to 3 inclusive, set ans to the minimum between ans and bfs of i - 1 and i\n print ans\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n;\nint computer[201], check[3][201], vis[201];\nvector vv[201];\nint bfs(int num, int st) {\n queue q;\n int ans = n;\n for (int i = 1; i <= n; i++) {\n if (check[num][i] == 0) q.push(i);\n }\n while (!q.empty()) {\n memset(vis, 0, sizeof(vis));\n while (!q.empty()) {\n int head = q.front();\n q.pop();\n if (vis[head] == n) {\n q.push(head);\n break;\n }\n vis[head]++;\n if (computer[head] != st) {\n q.push(head);\n continue;\n }\n for (int i = 0; i < vv[head].size(); i++) {\n int v = vv[head][i];\n check[num][v]--;\n if (check[num][v] == 0) q.push(v);\n }\n }\n st = (st == 3 ? 1 : st + 1);\n if (!q.empty()) ans++;\n }\n return ans;\n}\nint main() {\n while (cin >> n) {\n memset(check, 0, sizeof(check));\n for (int i = 1; i <= n; i++) vv[i].clear();\n for (int i = 1; i <= n; i++) cin >> computer[i];\n for (int i = 1; i <= n; i++) {\n int ki;\n cin >> ki;\n for (int j = 1; j <= ki; j++) {\n int aj;\n cin >> aj;\n vv[aj].push_back(i);\n check[0][i]++, check[1][i]++, check[2][i]++;\n }\n }\n int ans = 0x3f3f3f3f;\n for (int i = 1; i <= 3; i++) ans = min(ans, bfs(i - 1, i));\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"213A","pseudocode":"let n be an int\nlet computer be an integer array of length 201, check an integer matrix of size 3x201, vis an integer array of length 201\nlet vv be an integer vector of size 201\nin int function bsf that takes int num, int st\n let q be a queue of int\n let ans = n be an int\n for i = 1 to n inclusive\n if che[num][i] is 0, push i in q\n end of the block\n while q is not empty\n reset vis to all 0\n while q is not empty\n let head = int = result of calling front on q\n pop q\n if vis at head is n\n push head in q\n exit loop\n end of the block\n increment vis[head]\n if computer at head is not st\n push head in q\n next iteration\n end of the block\n for i = 0 to size of vv[head] exclusive\n let v = vv[head][i] be an int\n decrement check[num][v]\n if check[num][v] is 0 then push v in q\n end of the block\n end of the block\n set st to 1 if st is 3 else set st to st + 1\n if q is not empty then increment ans\n end of the block\n return ans\nend of the block\ndefine the main function\n while reading n\n reset check to all 0\n clear n elements of vv[i]\n read n elements of computer\n for i = 1 to n inclusive\n let ki = integer\n read ki\n for j = 1 to ki inclusive\n let aj be an integer\n read aj\n add i to the end of vv[aj]\n increment check[0][i]++, check[1][i]++, check[2][i]++\n end of the block\n end of the block\n let ans be an int = 0x3f3f3f3f\n for i = 1 to 3 inclusive, set ans to the minimum between ans and bfs of i - 1 and i\n print ans\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["1","1","0"],["1"]],[["5","2 2 1 1 3","1 5","2 5 1","2 5 4","1 5","0"],["7"]],[["7","1 3 3 1 2 1 1","0","1 1","1 1","2 1 6","3 1 2 7","1 1","1 1"],["11"]],[["2","2 1","0","1 1"],["4"]],[["3","2 1 2","0","0","0"],["4"]],[["4","2 1 1 1","0","0","1 1","1 3"],["6"]],[["6","1 1 2 3 3 1","2 2 3","0","0","0","2 2 1","1 1"],["10"]],[["8","2 2 2 1 1 2 1 1","3 5 6 7","1 5","2 5 6","1 5","0","1 5","1 5","2 5 6"],["11"]],[["9","3 3 2 1 3 1 2 2 1","2 4 3","0","2 4 2","0","1 4","2 4 2","0","1 4","3 4 3 8"],["13"]],[["10","3 1 2 2 2 1 2 1 1 1","0","2 6 9","0","1 9","0","1 3","4 3 6 5 2","3 6 4 2","0","1 3"],["14"]],[["11","1 2 2 3 3 2 2 2 2 3 1","1 4","2 7 11","0","0","1 2","1 11","0","1 2","3 7 11 2","3 3 2 9","0"],["14"]],[["12","1 3 2 2 1 3 2 1 3 2 2 2","2 3 4","3 12 11 10","1 8","2 8 7","2 9 10","1 3","0","0","1 4","4 3 1 12 9","3 8 3 4","1 4"],["18"]],[["13","3 3 2 2 1 3 1 1 1 1 2 1 2","5 6 3 11 13 12","1 6","2 10 6","3 6 3 11","1 6","1 10","3 6 2 3","4 6 3 9 11","3 6 2 3","0","3 6 2 3","4 6 3 4 13","2 6 3"],["21"]],[["14","3 2 2 1 2 1 1 3 1 2 2 3 1 1","2 9 13","3 9 13 8","2 9 6","3 9 6 13","1 9","1 9","3 9 6 13","2 9 13","0","4 9 3 13 4","4 9 6 13 2","2 9 13","1 9","8 9 5 6 3 13 7 4 11"],["20"]],[["15","1 2 3 2 3 2 2 2 3 3 3 2 3 1 3","5 2 7 4 3 6","0","2 7 4","2 2 15","1 7","1 7","0","2 4 6","1 6","2 15 3","4 12 2 15 7","0","3 2 5 6","3 2 4 6","1 2"],["20"]],[["16","3 3 1 3 2 3 2 2 3 1 2 3 2 2 2 3","1 14","4 14 10 13 6","3 14 15 6","1 14","4 14 10 9 7","4 14 10 13 9","4 14 10 13 6","4 14 4 12 3","2 14 4","1 14","1 14","2 14 1","4 14 10 4 1","0","2 14 10","1 14"],["22"]],[["17","3 2 3 2 2 2 1 3 3 3 3 2 3 3 3 1 1","0","0","2 8 10","4 12 8 6 16","0","2 8 13","3 2 8 10","1 12","4 8 17 3 16","2 2 8","0","1 2","2 8 10","2 12 8","2 8 10","1 8","2 12 8"],["21"]],[["18","2 1 1 3 2 1 3 2 3 3 2 2 1 1 3 1 1 3","3 16 8 6","3 16 6 1","4 6 13 5 7","2 6 2","4 16 6 17 1","2 16 8","3 6 17 12","1 16","0","3 6 15 1","3 16 6 12","7 16 9 8 6 13 17 14","1 6","1 6","3 8 6 13","0","1 6","3 9 6 13"],["26"]],[["19","2 1 2 3 3 3 2 1 1 1 1 3 3 1 1 1 2 2 3","0","2 1 7","0","4 3 2 17 13","1 17","1 3","3 1 3 6","4 1 17 9 13","3 1 16 17","0","3 3 6 17","1 6","6 10 6 7 17 9 11","3 10 17 13","4 3 17 13 8","1 3","3 6 7 16","0","6 1 7 17 11 13 15"],["29"]],[["20","1 2 2 2 1 3 3 2 2 1 2 2 3 1 2 2 2 1 1 1","2 10 8","5 10 12 3 20 7","0","3 10 15 3","0","3 14 17 3","2 12 20","0","3 17 10 12","1 17","1 5","1 5","0","1 18","3 18 5 12","5 5 12 8 3 19","0","0","1 12","1 18"],["24"]],[["11","3 1 3 2 3 2 3 2 3 1 3","6 2 3 9 5 7 10","1 6","2 6 2","5 6 2 3 9 5","2 3 9","0","5 3 9 5 8 4","4 2 3 9 5","2 2 3","8 6 2 3 9 5 4 11 7","4 2 3 9 5"],["21"]],[["12","2 3 3 1 1 3 2 2 3 1 3 3","1 9","1 1","2 2 11","5 1 2 11 5 8","4 9 10 1 11","5 9 10 12 11 5","4 1 12 11 5","5 10 1 2 12 11","0","1 9","1 12","0"],["19"]],[["13","3 2 2 1 3 3 2 3 2 2 1 2 3","7 4 3 2 5 9 8 13","1 4","1 4","0","3 4 2 6","2 4 2","4 4 3 2 9","5 4 2 6 9 7","3 4 2 6","6 4 3 2 5 9 7","6 4 3 2 6 9 7","8 4 2 6 5 9 8 11 10","7 4 3 2 6 9 8 11"],["21"]],[["14","2 3 1 3 1 1 1 2 2 3 1 1 3 1","4 14 9 8 5","4 4 8 5 1","9 4 14 9 8 1 2 13 7 12","0","2 14 8","2 4 14","7 9 6 10 8 1 2 13","2 4 6","1 14","1 9","8 4 6 10 8 5 1 2 3","7 14 6 10 8 1 2 7","5 10 8 5 1 2","0"],["21"]],[["15","3 2 2 2 1 1 2 1 1 2 2 3 3 3 2","1 13","4 13 1 8 14","10 5 13 1 8 14 4 2 11 15 10","6 5 13 1 8 9 14","0","11 5 13 1 8 14 4 2 11 10 3 12","11 13 1 8 14 4 2 11 15 10 3 6","2 13 1","4 5 13 1 8","8 5 13 1 8 14 2 11 15","6 5 13 1 8 14 2","10 5 13 1 8 14 2 11 15 10 3","0","4 13 1 8 9","8 5 13 1 8 9 14 2 11"],["23"]],[["16","3 1 2 3 3 2 3 1 3 2 2 1 2 2 1 2","0","0","7 2 8 4 12 5 9 11","1 1","4 1 8 4 12","5 2 4 12 5 11","4 4 12 5 10","0","5 1 8 4 12 5","6 1 4 12 5 9 11","6 2 1 8 4 12 5","2 4 13","3 1 8 4","8 1 4 13 12 5 10 3 6","4 4 12 5 6","8 8 4 13 12 5 9 6 14"],["26"]],[["17","2 3 1 3 3 3 1 1 1 2 2 2 3 2 3 3 2","5 4 14 2 11 7","3 13 4 14","7 6 4 14 2 1 10 12","2 6 13","9 4 2 9 8 7 17 1 10 12","0","5 4 14 2 9 11","4 13 4 2 11","4 13 4 14 2","7 13 4 2 11 8 7 1","4 13 4 14 2","8 6 4 2 8 7 17 1 10","0","1 4","7 13 4 14 2 9 8 7","6 4 2 17 1 10 12","5 13 4 2 9 8"],["27"]],[["18","1 2 3 3 2 2 1 1 3 1 2 3 2 3 1 2 2 3","5 9 3 14 12 2","7 9 4 3 14 16 7 12","1 9","1 9","6 9 14 12 1 6 15","6 9 14 12 2 1 11","2 9 14","7 9 14 7 12 2 1 6","0","6 9 18 14 7 1 6","4 9 14 7 1","2 9 14","6 9 3 14 7 1 6","2 9 3","9 9 3 14 16 12 2 1 6 17","4 9 4 18 14","8 9 18 14 12 1 11 6 13","2 9 4"],["26"]],[["19","2 3 3 2 3 1 3 1 2 2 2 1 1 1 2 2 1 3 3","0","3 1 10 6","8 1 6 2 17 18 12 15 7","5 6 2 9 17 18","6 6 2 17 18 12 16","1 11","9 1 11 6 2 17 18 4 12 15","3 1 6 2","4 1 6 2 8","0","1 1","5 1 6 2 17 18","12 1 10 6 2 8 17 18 4 12 15 7 3","10 11 6 2 17 18 4 12 16 15 7","8 1 6 2 8 17 18 12 16","8 11 6 2 9 17 18 4 12","3 11 6 2","5 10 6 2 9 17","10 1 6 2 17 18 12 5 15 7 3"],["30"]],[["20","2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1","1 7","13 7 1 11 4 6 16 20 12 5 18 19 15 10","8 7 1 11 4 6 17 8 16","3 7 1 11","9 7 1 11 4 6 8 20 12 3","4 7 1 11 4","0","6 7 1 11 4 6 17","4 7 1 11 4","7 7 1 11 4 6 17 5","2 7 1","9 7 1 11 4 6 17 8 14 20","11 7 1 11 4 6 20 3 5 15 10 2","5 7 1 11 4 6","9 7 1 11 4 6 8 16 14 5","5 7 1 11 4 6","5 7 1 11 4 6","11 7 1 11 4 9 6 17 8 20 3 5","11 7 1 11 4 6 17 16 20 12 5 18","6 7 1 11 4 6 14"],["35"]],[["21","1 2 1 3 3 3 1 1 2 2 3 1 3 1 3 3 1 1 1 2 2","1 5","0","1 11","0","0","0","1 8","0","1 11","1 1","1 19","0","1 2","0","0","0","0","1 19","0","0","0"],["25"]],[["22","2 3 2 3 3 2 1 2 3 3 1 3 1 1 2 2 3 3 1 3 2 2","0","1 8","1 22","1 12","0","1 14","0","0","0","2 22 14","1 12","0","0","0","0","0","0","0","0","1 16","1 13","0"],["25"]],[["23","3 1 3 3 2 2 2 1 3 2 3 1 1 1 1 2 3 1 2 1 3 1 1","0","1 11","1 11","2 11 16","1 2","3 11 1 12","2 11 16","2 12 2","1 13","2 12 2","0","0","0","2 13 11","0","1 11","2 12 2","3 16 6 21","1 11","0","0","2 11 12","0"],["27"]],[["24","1 2 1 1 2 2 1 1 3 2 3 1 3 2 3 3 1 1 3 2 3 2 1 2","1 16","0","0","1 2","0","0","0","0","1 2","0","0","0","0","0","0","0","2 12 24","0","0","1 11","0","0","0","0"],["27"]],[["25","3 3 1 1 1 2 2 2 3 1 2 3 2 1 2 2 2 3 2 1 2 3 2 1 1","0","0","0","0","0","0","1 12","0","1 19","0","2 12 21","2 3 10","0","1 21","0","1 9","1 3","0","0","2 3 2","0","1 12","0","1 3","2 21 9"],["29"]],[["26","1 2 2 1 1 2 1 1 2 1 3 1 3 1 2 3 3 3 2 1 2 1 3 3 2 2","1 9","1 1","0","0","0","0","0","0","0","0","0","1 5","0","2 15 12","1 8","0","0","0","0","2 3 26","0","0","0","1 22","0","1 8"],["30"]],[["27","2 1 1 3 2 1 1 2 3 1 1 2 2 2 1 2 1 1 3 3 3 1 1 1 3 1 1","0","0","0","1 12","0","0","0","0","0","0","1 26","0","0","0","0","1 27","0","0","0","0","0","0","1 5","0","2 20 27","1 18","0"],["30"]],[["28","2 1 1 3 2 3 2 2 1 3 2 3 3 2 3 1 2 2 3 3 3 3 1 3 2 1 3 3","0","1 7","0","2 28 18","1 28","0","0","0","0","0","0","2 10 18","3 8 10 18","0","2 1 20","0","1 18","1 27","2 27 18","0","0","1 28","0","0","0","0","1 28","1 9"],["33"]],[["29","3 3 3 3 3 1 1 1 3 2 2 1 1 3 1 1 1 2 1 2 3 1 1 2 1 3 1 2 3","0","0","0","0","0","1 1","0","0","2 28 15","0","0","0","2 24 23","1 28","0","1 28","1 20","0","0","0","0","1 28","0","0","2 23 16","0","0","1 7","1 28"],["32"]],[["30","1 3 3 3 2 3 1 3 3 3 3 2 3 1 3 2 1 1 1 1 2 3 2 1 1 3 3 2 2 2","0","1 20","0","1 7","2 6 9","1 20","1 20","3 7 6 9","2 10 6","0","0","2 6 9","0","0","1 20","2 6 9","2 6 9","0","2 6 9","0","2 6 9","3 27 6 9","2 6 9","2 6 9","0","0","0","2 6 9","3 6 9 19","3 27 6 9"],["34"]],[["4","1 1 2 3","1 2","1 3","0","1 1"],["8"]]]}} +{"instance_id":"pseudo_to_code_2k_96","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare int N and an arrays of ints a and c with 200 elements\ndeclare an array of int vectors called edges with 200 elements\nint function simulate with int argument s\n set first sizeof(c) bytes at the pointer c to 0\n for i = 0 to N exclusive\n for j = 0 to length of edges[i] exclusive, increment c[edges[i][j]]\n end of the block\n q is a new array of int queues with 3 elements\n for integer i = 0 to N exclusive\n if c[i] is false, push i into q[a[i]]\n create integer poped = 0\n declare int variable ret = -1\n while poped < N\n while q[s] is not empty\n declare int variable f = front element of q[s]\n remove front element from q[s]\n increment poped by one\n for i = 0 to length of edges[f] exclusive\n create int next = edges[f][i]\n decrement c[next], if c[next] != 0, push next into q[a[next]]\n end of the block\n end of the block\n assign (s + 1) % 3 to s\n increment ret by one\n end of the block\n return ret\nend of the block\ndefine the main function\n read N and loop further\n for i = 0 to N exclusive\n for integer i = int to N exclusive\n read input to a[i]\n a[i] = a[i] modulo 3\n end of the block\n for integer i = 0 to N exclusive\n declare ints k and t\n read k\n for j = 0 to k exclusive\n read input to t\n push i into edges[t - 1]\n end of the block\n end of the block\n create integer ans = 1000000000\n for integer i = 0 to 3 exclusive, set ans to min(ans, simulate(i))\n print ans + N\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int N, a[200], c[200];\nvector edges[200];\nint simulate(int s) {\n memset(c, 0, sizeof(c));\n for (int i = int(0); i < int(N); i++) {\n for (int j = int(0); j < int(edges[i].size()); j++) c[edges[i][j]]++;\n }\n queue q[3];\n for (int i = int(0); i < int(N); i++)\n if (!c[i]) q[a[i]].push(i);\n int poped = 0;\n int ret = -1;\n while (poped < N) {\n while (!q[s].empty()) {\n int f = q[s].front();\n q[s].pop();\n poped++;\n for (int i = int(0); i < int(edges[f].size()); i++) {\n int next = edges[f][i];\n if (!--c[next]) { q[a[next]].push(next); }\n }\n }\n s = (s + 1) % 3;\n ret++;\n }\n return ret;\n}\nint main() {\n while (cin >> N) {\n for (int i = int(0); i < int(N); i++) edges[i].clear();\n for (int i = int(0); i < int(N); i++) {\n cin >> a[i];\n a[i] %= 3;\n }\n for (int i = int(0); i < int(N); i++) {\n int k, t;\n cin >> k;\n for (int j = int(0); j < int(k); j++) {\n cin >> t;\n edges[t - 1].push_back(i);\n }\n }\n int ans = 1000000000;\n for (int i = int(0); i < int(3); i++) ans = min(ans, simulate(i));\n cout << ans + N << endl;\n }\n return 0;\n}","item":{"problem_id":"213A","pseudocode":"declare int N and an arrays of ints a and c with 200 elements\ndeclare an array of int vectors called edges with 200 elements\nint function simulate with int argument s\n set first sizeof(c) bytes at the pointer c to 0\n for i = 0 to N exclusive\n for j = 0 to length of edges[i] exclusive, increment c[edges[i][j]]\n end of the block\n q is a new array of int queues with 3 elements\n for integer i = 0 to N exclusive\n if c[i] is false, push i into q[a[i]]\n create integer poped = 0\n declare int variable ret = -1\n while poped < N\n while q[s] is not empty\n declare int variable f = front element of q[s]\n remove front element from q[s]\n increment poped by one\n for i = 0 to length of edges[f] exclusive\n create int next = edges[f][i]\n decrement c[next], if c[next] != 0, push next into q[a[next]]\n end of the block\n end of the block\n assign (s + 1) % 3 to s\n increment ret by one\n end of the block\n return ret\nend of the block\ndefine the main function\n read N and loop further\n for i = 0 to N exclusive\n for integer i = int to N exclusive\n read input to a[i]\n a[i] = a[i] modulo 3\n end of the block\n for integer i = 0 to N exclusive\n declare ints k and t\n read k\n for j = 0 to k exclusive\n read input to t\n push i into edges[t - 1]\n end of the block\n end of the block\n create integer ans = 1000000000\n for integer i = 0 to 3 exclusive, set ans to min(ans, simulate(i))\n print ans + N\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["1","1","0"],["1"]],[["5","2 2 1 1 3","1 5","2 5 1","2 5 4","1 5","0"],["7"]],[["7","1 3 3 1 2 1 1","0","1 1","1 1","2 1 6","3 1 2 7","1 1","1 1"],["11"]],[["2","2 1","0","1 1"],["4"]],[["3","2 1 2","0","0","0"],["4"]],[["4","2 1 1 1","0","0","1 1","1 3"],["6"]],[["6","1 1 2 3 3 1","2 2 3","0","0","0","2 2 1","1 1"],["10"]],[["8","2 2 2 1 1 2 1 1","3 5 6 7","1 5","2 5 6","1 5","0","1 5","1 5","2 5 6"],["11"]],[["9","3 3 2 1 3 1 2 2 1","2 4 3","0","2 4 2","0","1 4","2 4 2","0","1 4","3 4 3 8"],["13"]],[["10","3 1 2 2 2 1 2 1 1 1","0","2 6 9","0","1 9","0","1 3","4 3 6 5 2","3 6 4 2","0","1 3"],["14"]],[["11","1 2 2 3 3 2 2 2 2 3 1","1 4","2 7 11","0","0","1 2","1 11","0","1 2","3 7 11 2","3 3 2 9","0"],["14"]],[["12","1 3 2 2 1 3 2 1 3 2 2 2","2 3 4","3 12 11 10","1 8","2 8 7","2 9 10","1 3","0","0","1 4","4 3 1 12 9","3 8 3 4","1 4"],["18"]],[["13","3 3 2 2 1 3 1 1 1 1 2 1 2","5 6 3 11 13 12","1 6","2 10 6","3 6 3 11","1 6","1 10","3 6 2 3","4 6 3 9 11","3 6 2 3","0","3 6 2 3","4 6 3 4 13","2 6 3"],["21"]],[["14","3 2 2 1 2 1 1 3 1 2 2 3 1 1","2 9 13","3 9 13 8","2 9 6","3 9 6 13","1 9","1 9","3 9 6 13","2 9 13","0","4 9 3 13 4","4 9 6 13 2","2 9 13","1 9","8 9 5 6 3 13 7 4 11"],["20"]],[["15","1 2 3 2 3 2 2 2 3 3 3 2 3 1 3","5 2 7 4 3 6","0","2 7 4","2 2 15","1 7","1 7","0","2 4 6","1 6","2 15 3","4 12 2 15 7","0","3 2 5 6","3 2 4 6","1 2"],["20"]],[["16","3 3 1 3 2 3 2 2 3 1 2 3 2 2 2 3","1 14","4 14 10 13 6","3 14 15 6","1 14","4 14 10 9 7","4 14 10 13 9","4 14 10 13 6","4 14 4 12 3","2 14 4","1 14","1 14","2 14 1","4 14 10 4 1","0","2 14 10","1 14"],["22"]],[["17","3 2 3 2 2 2 1 3 3 3 3 2 3 3 3 1 1","0","0","2 8 10","4 12 8 6 16","0","2 8 13","3 2 8 10","1 12","4 8 17 3 16","2 2 8","0","1 2","2 8 10","2 12 8","2 8 10","1 8","2 12 8"],["21"]],[["18","2 1 1 3 2 1 3 2 3 3 2 2 1 1 3 1 1 3","3 16 8 6","3 16 6 1","4 6 13 5 7","2 6 2","4 16 6 17 1","2 16 8","3 6 17 12","1 16","0","3 6 15 1","3 16 6 12","7 16 9 8 6 13 17 14","1 6","1 6","3 8 6 13","0","1 6","3 9 6 13"],["26"]],[["19","2 1 2 3 3 3 2 1 1 1 1 3 3 1 1 1 2 2 3","0","2 1 7","0","4 3 2 17 13","1 17","1 3","3 1 3 6","4 1 17 9 13","3 1 16 17","0","3 3 6 17","1 6","6 10 6 7 17 9 11","3 10 17 13","4 3 17 13 8","1 3","3 6 7 16","0","6 1 7 17 11 13 15"],["29"]],[["20","1 2 2 2 1 3 3 2 2 1 2 2 3 1 2 2 2 1 1 1","2 10 8","5 10 12 3 20 7","0","3 10 15 3","0","3 14 17 3","2 12 20","0","3 17 10 12","1 17","1 5","1 5","0","1 18","3 18 5 12","5 5 12 8 3 19","0","0","1 12","1 18"],["24"]],[["11","3 1 3 2 3 2 3 2 3 1 3","6 2 3 9 5 7 10","1 6","2 6 2","5 6 2 3 9 5","2 3 9","0","5 3 9 5 8 4","4 2 3 9 5","2 2 3","8 6 2 3 9 5 4 11 7","4 2 3 9 5"],["21"]],[["12","2 3 3 1 1 3 2 2 3 1 3 3","1 9","1 1","2 2 11","5 1 2 11 5 8","4 9 10 1 11","5 9 10 12 11 5","4 1 12 11 5","5 10 1 2 12 11","0","1 9","1 12","0"],["19"]],[["13","3 2 2 1 3 3 2 3 2 2 1 2 3","7 4 3 2 5 9 8 13","1 4","1 4","0","3 4 2 6","2 4 2","4 4 3 2 9","5 4 2 6 9 7","3 4 2 6","6 4 3 2 5 9 7","6 4 3 2 6 9 7","8 4 2 6 5 9 8 11 10","7 4 3 2 6 9 8 11"],["21"]],[["14","2 3 1 3 1 1 1 2 2 3 1 1 3 1","4 14 9 8 5","4 4 8 5 1","9 4 14 9 8 1 2 13 7 12","0","2 14 8","2 4 14","7 9 6 10 8 1 2 13","2 4 6","1 14","1 9","8 4 6 10 8 5 1 2 3","7 14 6 10 8 1 2 7","5 10 8 5 1 2","0"],["21"]],[["15","3 2 2 2 1 1 2 1 1 2 2 3 3 3 2","1 13","4 13 1 8 14","10 5 13 1 8 14 4 2 11 15 10","6 5 13 1 8 9 14","0","11 5 13 1 8 14 4 2 11 10 3 12","11 13 1 8 14 4 2 11 15 10 3 6","2 13 1","4 5 13 1 8","8 5 13 1 8 14 2 11 15","6 5 13 1 8 14 2","10 5 13 1 8 14 2 11 15 10 3","0","4 13 1 8 9","8 5 13 1 8 9 14 2 11"],["23"]],[["16","3 1 2 3 3 2 3 1 3 2 2 1 2 2 1 2","0","0","7 2 8 4 12 5 9 11","1 1","4 1 8 4 12","5 2 4 12 5 11","4 4 12 5 10","0","5 1 8 4 12 5","6 1 4 12 5 9 11","6 2 1 8 4 12 5","2 4 13","3 1 8 4","8 1 4 13 12 5 10 3 6","4 4 12 5 6","8 8 4 13 12 5 9 6 14"],["26"]],[["17","2 3 1 3 3 3 1 1 1 2 2 2 3 2 3 3 2","5 4 14 2 11 7","3 13 4 14","7 6 4 14 2 1 10 12","2 6 13","9 4 2 9 8 7 17 1 10 12","0","5 4 14 2 9 11","4 13 4 2 11","4 13 4 14 2","7 13 4 2 11 8 7 1","4 13 4 14 2","8 6 4 2 8 7 17 1 10","0","1 4","7 13 4 14 2 9 8 7","6 4 2 17 1 10 12","5 13 4 2 9 8"],["27"]],[["18","1 2 3 3 2 2 1 1 3 1 2 3 2 3 1 2 2 3","5 9 3 14 12 2","7 9 4 3 14 16 7 12","1 9","1 9","6 9 14 12 1 6 15","6 9 14 12 2 1 11","2 9 14","7 9 14 7 12 2 1 6","0","6 9 18 14 7 1 6","4 9 14 7 1","2 9 14","6 9 3 14 7 1 6","2 9 3","9 9 3 14 16 12 2 1 6 17","4 9 4 18 14","8 9 18 14 12 1 11 6 13","2 9 4"],["26"]],[["19","2 3 3 2 3 1 3 1 2 2 2 1 1 1 2 2 1 3 3","0","3 1 10 6","8 1 6 2 17 18 12 15 7","5 6 2 9 17 18","6 6 2 17 18 12 16","1 11","9 1 11 6 2 17 18 4 12 15","3 1 6 2","4 1 6 2 8","0","1 1","5 1 6 2 17 18","12 1 10 6 2 8 17 18 4 12 15 7 3","10 11 6 2 17 18 4 12 16 15 7","8 1 6 2 8 17 18 12 16","8 11 6 2 9 17 18 4 12","3 11 6 2","5 10 6 2 9 17","10 1 6 2 17 18 12 5 15 7 3"],["30"]],[["20","2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1","1 7","13 7 1 11 4 6 16 20 12 5 18 19 15 10","8 7 1 11 4 6 17 8 16","3 7 1 11","9 7 1 11 4 6 8 20 12 3","4 7 1 11 4","0","6 7 1 11 4 6 17","4 7 1 11 4","7 7 1 11 4 6 17 5","2 7 1","9 7 1 11 4 6 17 8 14 20","11 7 1 11 4 6 20 3 5 15 10 2","5 7 1 11 4 6","9 7 1 11 4 6 8 16 14 5","5 7 1 11 4 6","5 7 1 11 4 6","11 7 1 11 4 9 6 17 8 20 3 5","11 7 1 11 4 6 17 16 20 12 5 18","6 7 1 11 4 6 14"],["35"]],[["21","1 2 1 3 3 3 1 1 2 2 3 1 3 1 3 3 1 1 1 2 2","1 5","0","1 11","0","0","0","1 8","0","1 11","1 1","1 19","0","1 2","0","0","0","0","1 19","0","0","0"],["25"]],[["22","2 3 2 3 3 2 1 2 3 3 1 3 1 1 2 2 3 3 1 3 2 2","0","1 8","1 22","1 12","0","1 14","0","0","0","2 22 14","1 12","0","0","0","0","0","0","0","0","1 16","1 13","0"],["25"]],[["23","3 1 3 3 2 2 2 1 3 2 3 1 1 1 1 2 3 1 2 1 3 1 1","0","1 11","1 11","2 11 16","1 2","3 11 1 12","2 11 16","2 12 2","1 13","2 12 2","0","0","0","2 13 11","0","1 11","2 12 2","3 16 6 21","1 11","0","0","2 11 12","0"],["27"]],[["24","1 2 1 1 2 2 1 1 3 2 3 1 3 2 3 3 1 1 3 2 3 2 1 2","1 16","0","0","1 2","0","0","0","0","1 2","0","0","0","0","0","0","0","2 12 24","0","0","1 11","0","0","0","0"],["27"]],[["25","3 3 1 1 1 2 2 2 3 1 2 3 2 1 2 2 2 3 2 1 2 3 2 1 1","0","0","0","0","0","0","1 12","0","1 19","0","2 12 21","2 3 10","0","1 21","0","1 9","1 3","0","0","2 3 2","0","1 12","0","1 3","2 21 9"],["29"]],[["26","1 2 2 1 1 2 1 1 2 1 3 1 3 1 2 3 3 3 2 1 2 1 3 3 2 2","1 9","1 1","0","0","0","0","0","0","0","0","0","1 5","0","2 15 12","1 8","0","0","0","0","2 3 26","0","0","0","1 22","0","1 8"],["30"]],[["27","2 1 1 3 2 1 1 2 3 1 1 2 2 2 1 2 1 1 3 3 3 1 1 1 3 1 1","0","0","0","1 12","0","0","0","0","0","0","1 26","0","0","0","0","1 27","0","0","0","0","0","0","1 5","0","2 20 27","1 18","0"],["30"]],[["28","2 1 1 3 2 3 2 2 1 3 2 3 3 2 3 1 2 2 3 3 3 3 1 3 2 1 3 3","0","1 7","0","2 28 18","1 28","0","0","0","0","0","0","2 10 18","3 8 10 18","0","2 1 20","0","1 18","1 27","2 27 18","0","0","1 28","0","0","0","0","1 28","1 9"],["33"]],[["29","3 3 3 3 3 1 1 1 3 2 2 1 1 3 1 1 1 2 1 2 3 1 1 2 1 3 1 2 3","0","0","0","0","0","1 1","0","0","2 28 15","0","0","0","2 24 23","1 28","0","1 28","1 20","0","0","0","0","1 28","0","0","2 23 16","0","0","1 7","1 28"],["32"]],[["30","1 3 3 3 2 3 1 3 3 3 3 2 3 1 3 2 1 1 1 1 2 3 2 1 1 3 3 2 2 2","0","1 20","0","1 7","2 6 9","1 20","1 20","3 7 6 9","2 10 6","0","0","2 6 9","0","0","1 20","2 6 9","2 6 9","0","2 6 9","0","2 6 9","3 27 6 9","2 6 9","2 6 9","0","0","0","2 6 9","3 6 9 19","3 27 6 9"],["34"]],[["4","1 1 2 3","1 2","1 3","0","1 1"],["8"]]]}} +{"instance_id":"pseudo_to_code_2k_97","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate const int N = 205\ndeclare integer variable n and arrays of integers in, tin and a with size N\ndeclare vector of integers e\nbfs is an int function with int argument k\n Q is a queue of integers with 5 elements\n for integer i = 1 to n inclusive\n if in[i] is false, push i into Q[a[i]]\n for i = 1 to n inclusive, change tin[i] to in[i]\n declare int step = -1\n while any of Q[1], Q[2] or Q[3] is not empty\n increment step by one\n while Q[k] is not empty\n declare integer variable u = front element of Q[k]\n remove front element from Q[k]\n increment step\n for i from 0 to length of e[u] exclusive\n declare int v = e[u][i]\n decrement tin[v] by one\n if tin[v] is false, push v into Q[a[v]]\n end of the block\n end of the block\n if k = 1\n assign 2 to k\n else if k = 2\n assign 3 to k\n else if k = 3\n assign 1 to k\n end of the block\n if step != -1, return step\n return to indicate successful execution\nend of the block\ndefine the main function\n read n\n for i = 1 to n inclusive, read a[i]\n for integers i = 1, m and x, while i <= n, incrementing i\n read input to m\n change in[i] to m\n decrement m and loop further, while m is not 0\n read x\n push i into e[x]\n end of the block\n end of the block\n declare integer variable ans = 0x3f3f3f3f\n for i = 1 to 3 inclusive, set ans to min of ans and bfs(i)\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int N = 205;\nint in[N], tin[N], n, a[N];\nvector e[N];\nint bfs(int k) {\n queue Q[5];\n for (int i = 1; i <= n; i++)\n if (!in[i]) Q[a[i]].push(i);\n for (int i = 1; i <= n; i++) tin[i] = in[i];\n int step = -1;\n while (!Q[1].empty() || !Q[2].empty() || !Q[3].empty()) {\n step++;\n while (!Q[k].empty()) {\n int u = Q[k].front();\n Q[k].pop();\n step++;\n for (int i = 0; i < e[u].size(); i++) {\n int v = e[u][i];\n tin[v]--;\n if (!tin[v]) Q[a[v]].push(v);\n }\n }\n if (k == 1)\n k = 2;\n else if (k == 2)\n k = 3;\n else if (k == 3)\n k = 1;\n }\n if (step != -1) return step;\n return 0;\n}\nint main() {\n cin >> n;\n for (int i = 1; i <= n; i++) cin >> a[i];\n for (int i = 1, m, x; i <= n; i++) {\n cin >> m;\n in[i] = m;\n while (m--) {\n cin >> x;\n e[x].push_back(i);\n }\n }\n int ans = 0x3f3f3f3f;\n for (int i = 1; i <= 3; i++) ans = min(ans, bfs(i));\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"213A","pseudocode":"create const int N = 205\ndeclare integer variable n and arrays of integers in, tin and a with size N\ndeclare vector of integers e\nbfs is an int function with int argument k\n Q is a queue of integers with 5 elements\n for integer i = 1 to n inclusive\n if in[i] is false, push i into Q[a[i]]\n for i = 1 to n inclusive, change tin[i] to in[i]\n declare int step = -1\n while any of Q[1], Q[2] or Q[3] is not empty\n increment step by one\n while Q[k] is not empty\n declare integer variable u = front element of Q[k]\n remove front element from Q[k]\n increment step\n for i from 0 to length of e[u] exclusive\n declare int v = e[u][i]\n decrement tin[v] by one\n if tin[v] is false, push v into Q[a[v]]\n end of the block\n end of the block\n if k = 1\n assign 2 to k\n else if k = 2\n assign 3 to k\n else if k = 3\n assign 1 to k\n end of the block\n if step != -1, return step\n return to indicate successful execution\nend of the block\ndefine the main function\n read n\n for i = 1 to n inclusive, read a[i]\n for integers i = 1, m and x, while i <= n, incrementing i\n read input to m\n change in[i] to m\n decrement m and loop further, while m is not 0\n read x\n push i into e[x]\n end of the block\n end of the block\n declare integer variable ans = 0x3f3f3f3f\n for i = 1 to 3 inclusive, set ans to min of ans and bfs(i)\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["1","1","0"],["1"]],[["5","2 2 1 1 3","1 5","2 5 1","2 5 4","1 5","0"],["7"]],[["7","1 3 3 1 2 1 1","0","1 1","1 1","2 1 6","3 1 2 7","1 1","1 1"],["11"]],[["2","2 1","0","1 1"],["4"]],[["3","2 1 2","0","0","0"],["4"]],[["4","2 1 1 1","0","0","1 1","1 3"],["6"]],[["6","1 1 2 3 3 1","2 2 3","0","0","0","2 2 1","1 1"],["10"]],[["8","2 2 2 1 1 2 1 1","3 5 6 7","1 5","2 5 6","1 5","0","1 5","1 5","2 5 6"],["11"]],[["9","3 3 2 1 3 1 2 2 1","2 4 3","0","2 4 2","0","1 4","2 4 2","0","1 4","3 4 3 8"],["13"]],[["10","3 1 2 2 2 1 2 1 1 1","0","2 6 9","0","1 9","0","1 3","4 3 6 5 2","3 6 4 2","0","1 3"],["14"]],[["11","1 2 2 3 3 2 2 2 2 3 1","1 4","2 7 11","0","0","1 2","1 11","0","1 2","3 7 11 2","3 3 2 9","0"],["14"]],[["12","1 3 2 2 1 3 2 1 3 2 2 2","2 3 4","3 12 11 10","1 8","2 8 7","2 9 10","1 3","0","0","1 4","4 3 1 12 9","3 8 3 4","1 4"],["18"]],[["13","3 3 2 2 1 3 1 1 1 1 2 1 2","5 6 3 11 13 12","1 6","2 10 6","3 6 3 11","1 6","1 10","3 6 2 3","4 6 3 9 11","3 6 2 3","0","3 6 2 3","4 6 3 4 13","2 6 3"],["21"]],[["14","3 2 2 1 2 1 1 3 1 2 2 3 1 1","2 9 13","3 9 13 8","2 9 6","3 9 6 13","1 9","1 9","3 9 6 13","2 9 13","0","4 9 3 13 4","4 9 6 13 2","2 9 13","1 9","8 9 5 6 3 13 7 4 11"],["20"]],[["15","1 2 3 2 3 2 2 2 3 3 3 2 3 1 3","5 2 7 4 3 6","0","2 7 4","2 2 15","1 7","1 7","0","2 4 6","1 6","2 15 3","4 12 2 15 7","0","3 2 5 6","3 2 4 6","1 2"],["20"]],[["16","3 3 1 3 2 3 2 2 3 1 2 3 2 2 2 3","1 14","4 14 10 13 6","3 14 15 6","1 14","4 14 10 9 7","4 14 10 13 9","4 14 10 13 6","4 14 4 12 3","2 14 4","1 14","1 14","2 14 1","4 14 10 4 1","0","2 14 10","1 14"],["22"]],[["17","3 2 3 2 2 2 1 3 3 3 3 2 3 3 3 1 1","0","0","2 8 10","4 12 8 6 16","0","2 8 13","3 2 8 10","1 12","4 8 17 3 16","2 2 8","0","1 2","2 8 10","2 12 8","2 8 10","1 8","2 12 8"],["21"]],[["18","2 1 1 3 2 1 3 2 3 3 2 2 1 1 3 1 1 3","3 16 8 6","3 16 6 1","4 6 13 5 7","2 6 2","4 16 6 17 1","2 16 8","3 6 17 12","1 16","0","3 6 15 1","3 16 6 12","7 16 9 8 6 13 17 14","1 6","1 6","3 8 6 13","0","1 6","3 9 6 13"],["26"]],[["19","2 1 2 3 3 3 2 1 1 1 1 3 3 1 1 1 2 2 3","0","2 1 7","0","4 3 2 17 13","1 17","1 3","3 1 3 6","4 1 17 9 13","3 1 16 17","0","3 3 6 17","1 6","6 10 6 7 17 9 11","3 10 17 13","4 3 17 13 8","1 3","3 6 7 16","0","6 1 7 17 11 13 15"],["29"]],[["20","1 2 2 2 1 3 3 2 2 1 2 2 3 1 2 2 2 1 1 1","2 10 8","5 10 12 3 20 7","0","3 10 15 3","0","3 14 17 3","2 12 20","0","3 17 10 12","1 17","1 5","1 5","0","1 18","3 18 5 12","5 5 12 8 3 19","0","0","1 12","1 18"],["24"]],[["11","3 1 3 2 3 2 3 2 3 1 3","6 2 3 9 5 7 10","1 6","2 6 2","5 6 2 3 9 5","2 3 9","0","5 3 9 5 8 4","4 2 3 9 5","2 2 3","8 6 2 3 9 5 4 11 7","4 2 3 9 5"],["21"]],[["12","2 3 3 1 1 3 2 2 3 1 3 3","1 9","1 1","2 2 11","5 1 2 11 5 8","4 9 10 1 11","5 9 10 12 11 5","4 1 12 11 5","5 10 1 2 12 11","0","1 9","1 12","0"],["19"]],[["13","3 2 2 1 3 3 2 3 2 2 1 2 3","7 4 3 2 5 9 8 13","1 4","1 4","0","3 4 2 6","2 4 2","4 4 3 2 9","5 4 2 6 9 7","3 4 2 6","6 4 3 2 5 9 7","6 4 3 2 6 9 7","8 4 2 6 5 9 8 11 10","7 4 3 2 6 9 8 11"],["21"]],[["14","2 3 1 3 1 1 1 2 2 3 1 1 3 1","4 14 9 8 5","4 4 8 5 1","9 4 14 9 8 1 2 13 7 12","0","2 14 8","2 4 14","7 9 6 10 8 1 2 13","2 4 6","1 14","1 9","8 4 6 10 8 5 1 2 3","7 14 6 10 8 1 2 7","5 10 8 5 1 2","0"],["21"]],[["15","3 2 2 2 1 1 2 1 1 2 2 3 3 3 2","1 13","4 13 1 8 14","10 5 13 1 8 14 4 2 11 15 10","6 5 13 1 8 9 14","0","11 5 13 1 8 14 4 2 11 10 3 12","11 13 1 8 14 4 2 11 15 10 3 6","2 13 1","4 5 13 1 8","8 5 13 1 8 14 2 11 15","6 5 13 1 8 14 2","10 5 13 1 8 14 2 11 15 10 3","0","4 13 1 8 9","8 5 13 1 8 9 14 2 11"],["23"]],[["16","3 1 2 3 3 2 3 1 3 2 2 1 2 2 1 2","0","0","7 2 8 4 12 5 9 11","1 1","4 1 8 4 12","5 2 4 12 5 11","4 4 12 5 10","0","5 1 8 4 12 5","6 1 4 12 5 9 11","6 2 1 8 4 12 5","2 4 13","3 1 8 4","8 1 4 13 12 5 10 3 6","4 4 12 5 6","8 8 4 13 12 5 9 6 14"],["26"]],[["17","2 3 1 3 3 3 1 1 1 2 2 2 3 2 3 3 2","5 4 14 2 11 7","3 13 4 14","7 6 4 14 2 1 10 12","2 6 13","9 4 2 9 8 7 17 1 10 12","0","5 4 14 2 9 11","4 13 4 2 11","4 13 4 14 2","7 13 4 2 11 8 7 1","4 13 4 14 2","8 6 4 2 8 7 17 1 10","0","1 4","7 13 4 14 2 9 8 7","6 4 2 17 1 10 12","5 13 4 2 9 8"],["27"]],[["18","1 2 3 3 2 2 1 1 3 1 2 3 2 3 1 2 2 3","5 9 3 14 12 2","7 9 4 3 14 16 7 12","1 9","1 9","6 9 14 12 1 6 15","6 9 14 12 2 1 11","2 9 14","7 9 14 7 12 2 1 6","0","6 9 18 14 7 1 6","4 9 14 7 1","2 9 14","6 9 3 14 7 1 6","2 9 3","9 9 3 14 16 12 2 1 6 17","4 9 4 18 14","8 9 18 14 12 1 11 6 13","2 9 4"],["26"]],[["19","2 3 3 2 3 1 3 1 2 2 2 1 1 1 2 2 1 3 3","0","3 1 10 6","8 1 6 2 17 18 12 15 7","5 6 2 9 17 18","6 6 2 17 18 12 16","1 11","9 1 11 6 2 17 18 4 12 15","3 1 6 2","4 1 6 2 8","0","1 1","5 1 6 2 17 18","12 1 10 6 2 8 17 18 4 12 15 7 3","10 11 6 2 17 18 4 12 16 15 7","8 1 6 2 8 17 18 12 16","8 11 6 2 9 17 18 4 12","3 11 6 2","5 10 6 2 9 17","10 1 6 2 17 18 12 5 15 7 3"],["30"]],[["20","2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1","1 7","13 7 1 11 4 6 16 20 12 5 18 19 15 10","8 7 1 11 4 6 17 8 16","3 7 1 11","9 7 1 11 4 6 8 20 12 3","4 7 1 11 4","0","6 7 1 11 4 6 17","4 7 1 11 4","7 7 1 11 4 6 17 5","2 7 1","9 7 1 11 4 6 17 8 14 20","11 7 1 11 4 6 20 3 5 15 10 2","5 7 1 11 4 6","9 7 1 11 4 6 8 16 14 5","5 7 1 11 4 6","5 7 1 11 4 6","11 7 1 11 4 9 6 17 8 20 3 5","11 7 1 11 4 6 17 16 20 12 5 18","6 7 1 11 4 6 14"],["35"]],[["21","1 2 1 3 3 3 1 1 2 2 3 1 3 1 3 3 1 1 1 2 2","1 5","0","1 11","0","0","0","1 8","0","1 11","1 1","1 19","0","1 2","0","0","0","0","1 19","0","0","0"],["25"]],[["22","2 3 2 3 3 2 1 2 3 3 1 3 1 1 2 2 3 3 1 3 2 2","0","1 8","1 22","1 12","0","1 14","0","0","0","2 22 14","1 12","0","0","0","0","0","0","0","0","1 16","1 13","0"],["25"]],[["23","3 1 3 3 2 2 2 1 3 2 3 1 1 1 1 2 3 1 2 1 3 1 1","0","1 11","1 11","2 11 16","1 2","3 11 1 12","2 11 16","2 12 2","1 13","2 12 2","0","0","0","2 13 11","0","1 11","2 12 2","3 16 6 21","1 11","0","0","2 11 12","0"],["27"]],[["24","1 2 1 1 2 2 1 1 3 2 3 1 3 2 3 3 1 1 3 2 3 2 1 2","1 16","0","0","1 2","0","0","0","0","1 2","0","0","0","0","0","0","0","2 12 24","0","0","1 11","0","0","0","0"],["27"]],[["25","3 3 1 1 1 2 2 2 3 1 2 3 2 1 2 2 2 3 2 1 2 3 2 1 1","0","0","0","0","0","0","1 12","0","1 19","0","2 12 21","2 3 10","0","1 21","0","1 9","1 3","0","0","2 3 2","0","1 12","0","1 3","2 21 9"],["29"]],[["26","1 2 2 1 1 2 1 1 2 1 3 1 3 1 2 3 3 3 2 1 2 1 3 3 2 2","1 9","1 1","0","0","0","0","0","0","0","0","0","1 5","0","2 15 12","1 8","0","0","0","0","2 3 26","0","0","0","1 22","0","1 8"],["30"]],[["27","2 1 1 3 2 1 1 2 3 1 1 2 2 2 1 2 1 1 3 3 3 1 1 1 3 1 1","0","0","0","1 12","0","0","0","0","0","0","1 26","0","0","0","0","1 27","0","0","0","0","0","0","1 5","0","2 20 27","1 18","0"],["30"]],[["28","2 1 1 3 2 3 2 2 1 3 2 3 3 2 3 1 2 2 3 3 3 3 1 3 2 1 3 3","0","1 7","0","2 28 18","1 28","0","0","0","0","0","0","2 10 18","3 8 10 18","0","2 1 20","0","1 18","1 27","2 27 18","0","0","1 28","0","0","0","0","1 28","1 9"],["33"]],[["29","3 3 3 3 3 1 1 1 3 2 2 1 1 3 1 1 1 2 1 2 3 1 1 2 1 3 1 2 3","0","0","0","0","0","1 1","0","0","2 28 15","0","0","0","2 24 23","1 28","0","1 28","1 20","0","0","0","0","1 28","0","0","2 23 16","0","0","1 7","1 28"],["32"]],[["30","1 3 3 3 2 3 1 3 3 3 3 2 3 1 3 2 1 1 1 1 2 3 2 1 1 3 3 2 2 2","0","1 20","0","1 7","2 6 9","1 20","1 20","3 7 6 9","2 10 6","0","0","2 6 9","0","0","1 20","2 6 9","2 6 9","0","2 6 9","0","2 6 9","3 27 6 9","2 6 9","2 6 9","0","0","0","2 6 9","3 6 9 19","3 27 6 9"],["34"]],[["4","1 1 2 3","1 2","1 3","0","1 1"],["8"]]]}} +{"instance_id":"pseudo_to_code_2k_98","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet n be an int\nlet vv be an int vector of size 210\nlet computer, in, bk, temp be integer vectors of size 210 each\nin int function bfs which takes int st\n let q be an int queue\n let ans = n = integer\n for i = 1 to n inclusive\n if in at i is 0 then push i into q\n end of the block\n while q isn't empty\n reset all bk to 0\n while q isn't empty\n head = front of q = integer\n pop q\n if bk at head is 5\n push head in q\n exit loop\n end of the block\n increment bk at head\n if computer at head is not st\n push head into q\n next iteration\n end of the block\n let up be an integer = the size of vv at head\n for i = 0 to up exclusive\n let the integer v be vv[head][i]\n decrement in at v\n if in at v is 0 then push v into q\n end of the block\n end of the block\n set st = 1 if st is 3 else increment st\n if q isn't empty then increment ans\n end of the block\n return ans\nend of the block\ndefine the main function\n while reading n\n reset all in to 0\n clear vv form 1 to n inclusive\n read computer from 1 to n inclusive\n for i = 1 to n inclusive\n let ki be an int\n read ki\n for j = 1 to ki inclusive\n declare int aj\n read aj\n add i to the end of vv[aj]\n increment in at i\n end of the block\n end of the block\n let ans be an integer = 0x3f3f3f3f\n for i = 1 to n inclusive, set temp at i to in at i\n for i = 1 to 3 inclusive\n for j = 1 to n inclusive\n set ans to the minimum between ans and bfs of i\n end of the block\n print ans\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n;\nvector vv[210];\nint computer[210], in[210], bk[210], temp[210];\nint bfs(int st) {\n queue q;\n int ans = n;\n for (int i = 1; i <= n; i++) {\n if (in[i] == 0) q.push(i);\n }\n while (!q.empty()) {\n memset(bk, 0, sizeof(bk));\n while (!q.empty()) {\n int head = q.front();\n q.pop();\n if (bk[head] == 5) {\n q.push(head);\n break;\n }\n bk[head]++;\n if (computer[head] != st) {\n q.push(head);\n continue;\n }\n int up = vv[head].size();\n for (int i = 0; i < up; i++) {\n int v = vv[head][i];\n in[v]--;\n if (in[v] == 0) q.push(v);\n }\n }\n st = (st == 3 ? 1 : st + 1);\n if (!q.empty()) ans++;\n }\n return ans;\n}\nint main() {\n while (cin >> n) {\n memset(in, 0, sizeof(in));\n for (int i = 1; i <= n; i++) vv[i].clear();\n for (int i = 1; i <= n; i++) cin >> computer[i];\n for (int i = 1; i <= n; i++) {\n int ki;\n cin >> ki;\n for (int j = 1; j <= ki; j++) {\n int aj;\n cin >> aj;\n vv[aj].push_back(i);\n in[i]++;\n }\n }\n int ans = 0x3f3f3f3f;\n for (int i = 1; i <= n; i++) temp[i] = in[i];\n for (int i = 1; i <= 3; i++) {\n for (int j = 1; j <= n; j++) in[j] = temp[j];\n ans = min(ans, bfs(i));\n }\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"213A","pseudocode":"let n be an int\nlet vv be an int vector of size 210\nlet computer, in, bk, temp be integer vectors of size 210 each\nin int function bfs which takes int st\n let q be an int queue\n let ans = n = integer\n for i = 1 to n inclusive\n if in at i is 0 then push i into q\n end of the block\n while q isn't empty\n reset all bk to 0\n while q isn't empty\n head = front of q = integer\n pop q\n if bk at head is 5\n push head in q\n exit loop\n end of the block\n increment bk at head\n if computer at head is not st\n push head into q\n next iteration\n end of the block\n let up be an integer = the size of vv at head\n for i = 0 to up exclusive\n let the integer v be vv[head][i]\n decrement in at v\n if in at v is 0 then push v into q\n end of the block\n end of the block\n set st = 1 if st is 3 else increment st\n if q isn't empty then increment ans\n end of the block\n return ans\nend of the block\ndefine the main function\n while reading n\n reset all in to 0\n clear vv form 1 to n inclusive\n read computer from 1 to n inclusive\n for i = 1 to n inclusive\n let ki be an int\n read ki\n for j = 1 to ki inclusive\n declare int aj\n read aj\n add i to the end of vv[aj]\n increment in at i\n end of the block\n end of the block\n let ans be an integer = 0x3f3f3f3f\n for i = 1 to n inclusive, set temp at i to in at i\n for i = 1 to 3 inclusive\n for j = 1 to n inclusive\n set ans to the minimum between ans and bfs of i\n end of the block\n print ans\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["1","1","0"],["1"]],[["5","2 2 1 1 3","1 5","2 5 1","2 5 4","1 5","0"],["7"]],[["7","1 3 3 1 2 1 1","0","1 1","1 1","2 1 6","3 1 2 7","1 1","1 1"],["11"]],[["2","2 1","0","1 1"],["4"]],[["3","2 1 2","0","0","0"],["4"]],[["4","2 1 1 1","0","0","1 1","1 3"],["6"]],[["6","1 1 2 3 3 1","2 2 3","0","0","0","2 2 1","1 1"],["10"]],[["8","2 2 2 1 1 2 1 1","3 5 6 7","1 5","2 5 6","1 5","0","1 5","1 5","2 5 6"],["11"]],[["9","3 3 2 1 3 1 2 2 1","2 4 3","0","2 4 2","0","1 4","2 4 2","0","1 4","3 4 3 8"],["13"]],[["10","3 1 2 2 2 1 2 1 1 1","0","2 6 9","0","1 9","0","1 3","4 3 6 5 2","3 6 4 2","0","1 3"],["14"]],[["11","1 2 2 3 3 2 2 2 2 3 1","1 4","2 7 11","0","0","1 2","1 11","0","1 2","3 7 11 2","3 3 2 9","0"],["14"]],[["12","1 3 2 2 1 3 2 1 3 2 2 2","2 3 4","3 12 11 10","1 8","2 8 7","2 9 10","1 3","0","0","1 4","4 3 1 12 9","3 8 3 4","1 4"],["18"]],[["13","3 3 2 2 1 3 1 1 1 1 2 1 2","5 6 3 11 13 12","1 6","2 10 6","3 6 3 11","1 6","1 10","3 6 2 3","4 6 3 9 11","3 6 2 3","0","3 6 2 3","4 6 3 4 13","2 6 3"],["21"]],[["14","3 2 2 1 2 1 1 3 1 2 2 3 1 1","2 9 13","3 9 13 8","2 9 6","3 9 6 13","1 9","1 9","3 9 6 13","2 9 13","0","4 9 3 13 4","4 9 6 13 2","2 9 13","1 9","8 9 5 6 3 13 7 4 11"],["20"]],[["15","1 2 3 2 3 2 2 2 3 3 3 2 3 1 3","5 2 7 4 3 6","0","2 7 4","2 2 15","1 7","1 7","0","2 4 6","1 6","2 15 3","4 12 2 15 7","0","3 2 5 6","3 2 4 6","1 2"],["20"]],[["16","3 3 1 3 2 3 2 2 3 1 2 3 2 2 2 3","1 14","4 14 10 13 6","3 14 15 6","1 14","4 14 10 9 7","4 14 10 13 9","4 14 10 13 6","4 14 4 12 3","2 14 4","1 14","1 14","2 14 1","4 14 10 4 1","0","2 14 10","1 14"],["22"]],[["17","3 2 3 2 2 2 1 3 3 3 3 2 3 3 3 1 1","0","0","2 8 10","4 12 8 6 16","0","2 8 13","3 2 8 10","1 12","4 8 17 3 16","2 2 8","0","1 2","2 8 10","2 12 8","2 8 10","1 8","2 12 8"],["21"]],[["18","2 1 1 3 2 1 3 2 3 3 2 2 1 1 3 1 1 3","3 16 8 6","3 16 6 1","4 6 13 5 7","2 6 2","4 16 6 17 1","2 16 8","3 6 17 12","1 16","0","3 6 15 1","3 16 6 12","7 16 9 8 6 13 17 14","1 6","1 6","3 8 6 13","0","1 6","3 9 6 13"],["26"]],[["19","2 1 2 3 3 3 2 1 1 1 1 3 3 1 1 1 2 2 3","0","2 1 7","0","4 3 2 17 13","1 17","1 3","3 1 3 6","4 1 17 9 13","3 1 16 17","0","3 3 6 17","1 6","6 10 6 7 17 9 11","3 10 17 13","4 3 17 13 8","1 3","3 6 7 16","0","6 1 7 17 11 13 15"],["29"]],[["20","1 2 2 2 1 3 3 2 2 1 2 2 3 1 2 2 2 1 1 1","2 10 8","5 10 12 3 20 7","0","3 10 15 3","0","3 14 17 3","2 12 20","0","3 17 10 12","1 17","1 5","1 5","0","1 18","3 18 5 12","5 5 12 8 3 19","0","0","1 12","1 18"],["24"]],[["11","3 1 3 2 3 2 3 2 3 1 3","6 2 3 9 5 7 10","1 6","2 6 2","5 6 2 3 9 5","2 3 9","0","5 3 9 5 8 4","4 2 3 9 5","2 2 3","8 6 2 3 9 5 4 11 7","4 2 3 9 5"],["21"]],[["12","2 3 3 1 1 3 2 2 3 1 3 3","1 9","1 1","2 2 11","5 1 2 11 5 8","4 9 10 1 11","5 9 10 12 11 5","4 1 12 11 5","5 10 1 2 12 11","0","1 9","1 12","0"],["19"]],[["13","3 2 2 1 3 3 2 3 2 2 1 2 3","7 4 3 2 5 9 8 13","1 4","1 4","0","3 4 2 6","2 4 2","4 4 3 2 9","5 4 2 6 9 7","3 4 2 6","6 4 3 2 5 9 7","6 4 3 2 6 9 7","8 4 2 6 5 9 8 11 10","7 4 3 2 6 9 8 11"],["21"]],[["14","2 3 1 3 1 1 1 2 2 3 1 1 3 1","4 14 9 8 5","4 4 8 5 1","9 4 14 9 8 1 2 13 7 12","0","2 14 8","2 4 14","7 9 6 10 8 1 2 13","2 4 6","1 14","1 9","8 4 6 10 8 5 1 2 3","7 14 6 10 8 1 2 7","5 10 8 5 1 2","0"],["21"]],[["15","3 2 2 2 1 1 2 1 1 2 2 3 3 3 2","1 13","4 13 1 8 14","10 5 13 1 8 14 4 2 11 15 10","6 5 13 1 8 9 14","0","11 5 13 1 8 14 4 2 11 10 3 12","11 13 1 8 14 4 2 11 15 10 3 6","2 13 1","4 5 13 1 8","8 5 13 1 8 14 2 11 15","6 5 13 1 8 14 2","10 5 13 1 8 14 2 11 15 10 3","0","4 13 1 8 9","8 5 13 1 8 9 14 2 11"],["23"]],[["16","3 1 2 3 3 2 3 1 3 2 2 1 2 2 1 2","0","0","7 2 8 4 12 5 9 11","1 1","4 1 8 4 12","5 2 4 12 5 11","4 4 12 5 10","0","5 1 8 4 12 5","6 1 4 12 5 9 11","6 2 1 8 4 12 5","2 4 13","3 1 8 4","8 1 4 13 12 5 10 3 6","4 4 12 5 6","8 8 4 13 12 5 9 6 14"],["26"]],[["17","2 3 1 3 3 3 1 1 1 2 2 2 3 2 3 3 2","5 4 14 2 11 7","3 13 4 14","7 6 4 14 2 1 10 12","2 6 13","9 4 2 9 8 7 17 1 10 12","0","5 4 14 2 9 11","4 13 4 2 11","4 13 4 14 2","7 13 4 2 11 8 7 1","4 13 4 14 2","8 6 4 2 8 7 17 1 10","0","1 4","7 13 4 14 2 9 8 7","6 4 2 17 1 10 12","5 13 4 2 9 8"],["27"]],[["18","1 2 3 3 2 2 1 1 3 1 2 3 2 3 1 2 2 3","5 9 3 14 12 2","7 9 4 3 14 16 7 12","1 9","1 9","6 9 14 12 1 6 15","6 9 14 12 2 1 11","2 9 14","7 9 14 7 12 2 1 6","0","6 9 18 14 7 1 6","4 9 14 7 1","2 9 14","6 9 3 14 7 1 6","2 9 3","9 9 3 14 16 12 2 1 6 17","4 9 4 18 14","8 9 18 14 12 1 11 6 13","2 9 4"],["26"]],[["19","2 3 3 2 3 1 3 1 2 2 2 1 1 1 2 2 1 3 3","0","3 1 10 6","8 1 6 2 17 18 12 15 7","5 6 2 9 17 18","6 6 2 17 18 12 16","1 11","9 1 11 6 2 17 18 4 12 15","3 1 6 2","4 1 6 2 8","0","1 1","5 1 6 2 17 18","12 1 10 6 2 8 17 18 4 12 15 7 3","10 11 6 2 17 18 4 12 16 15 7","8 1 6 2 8 17 18 12 16","8 11 6 2 9 17 18 4 12","3 11 6 2","5 10 6 2 9 17","10 1 6 2 17 18 12 5 15 7 3"],["30"]],[["20","2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1","1 7","13 7 1 11 4 6 16 20 12 5 18 19 15 10","8 7 1 11 4 6 17 8 16","3 7 1 11","9 7 1 11 4 6 8 20 12 3","4 7 1 11 4","0","6 7 1 11 4 6 17","4 7 1 11 4","7 7 1 11 4 6 17 5","2 7 1","9 7 1 11 4 6 17 8 14 20","11 7 1 11 4 6 20 3 5 15 10 2","5 7 1 11 4 6","9 7 1 11 4 6 8 16 14 5","5 7 1 11 4 6","5 7 1 11 4 6","11 7 1 11 4 9 6 17 8 20 3 5","11 7 1 11 4 6 17 16 20 12 5 18","6 7 1 11 4 6 14"],["35"]],[["21","1 2 1 3 3 3 1 1 2 2 3 1 3 1 3 3 1 1 1 2 2","1 5","0","1 11","0","0","0","1 8","0","1 11","1 1","1 19","0","1 2","0","0","0","0","1 19","0","0","0"],["25"]],[["22","2 3 2 3 3 2 1 2 3 3 1 3 1 1 2 2 3 3 1 3 2 2","0","1 8","1 22","1 12","0","1 14","0","0","0","2 22 14","1 12","0","0","0","0","0","0","0","0","1 16","1 13","0"],["25"]],[["23","3 1 3 3 2 2 2 1 3 2 3 1 1 1 1 2 3 1 2 1 3 1 1","0","1 11","1 11","2 11 16","1 2","3 11 1 12","2 11 16","2 12 2","1 13","2 12 2","0","0","0","2 13 11","0","1 11","2 12 2","3 16 6 21","1 11","0","0","2 11 12","0"],["27"]],[["24","1 2 1 1 2 2 1 1 3 2 3 1 3 2 3 3 1 1 3 2 3 2 1 2","1 16","0","0","1 2","0","0","0","0","1 2","0","0","0","0","0","0","0","2 12 24","0","0","1 11","0","0","0","0"],["27"]],[["25","3 3 1 1 1 2 2 2 3 1 2 3 2 1 2 2 2 3 2 1 2 3 2 1 1","0","0","0","0","0","0","1 12","0","1 19","0","2 12 21","2 3 10","0","1 21","0","1 9","1 3","0","0","2 3 2","0","1 12","0","1 3","2 21 9"],["29"]],[["26","1 2 2 1 1 2 1 1 2 1 3 1 3 1 2 3 3 3 2 1 2 1 3 3 2 2","1 9","1 1","0","0","0","0","0","0","0","0","0","1 5","0","2 15 12","1 8","0","0","0","0","2 3 26","0","0","0","1 22","0","1 8"],["30"]],[["27","2 1 1 3 2 1 1 2 3 1 1 2 2 2 1 2 1 1 3 3 3 1 1 1 3 1 1","0","0","0","1 12","0","0","0","0","0","0","1 26","0","0","0","0","1 27","0","0","0","0","0","0","1 5","0","2 20 27","1 18","0"],["30"]],[["28","2 1 1 3 2 3 2 2 1 3 2 3 3 2 3 1 2 2 3 3 3 3 1 3 2 1 3 3","0","1 7","0","2 28 18","1 28","0","0","0","0","0","0","2 10 18","3 8 10 18","0","2 1 20","0","1 18","1 27","2 27 18","0","0","1 28","0","0","0","0","1 28","1 9"],["33"]],[["29","3 3 3 3 3 1 1 1 3 2 2 1 1 3 1 1 1 2 1 2 3 1 1 2 1 3 1 2 3","0","0","0","0","0","1 1","0","0","2 28 15","0","0","0","2 24 23","1 28","0","1 28","1 20","0","0","0","0","1 28","0","0","2 23 16","0","0","1 7","1 28"],["32"]],[["30","1 3 3 3 2 3 1 3 3 3 3 2 3 1 3 2 1 1 1 1 2 3 2 1 1 3 3 2 2 2","0","1 20","0","1 7","2 6 9","1 20","1 20","3 7 6 9","2 10 6","0","0","2 6 9","0","0","1 20","2 6 9","2 6 9","0","2 6 9","0","2 6 9","3 27 6 9","2 6 9","2 6 9","0","0","0","2 6 9","3 6 9 19","3 27 6 9"],["34"]],[["4","1 1 2 3","1 2","1 3","0","1 1"],["8"]]]}} +{"instance_id":"pseudo_to_code_2k_99","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmod = 10^9+7\nfunction fast_pow (get int a and b, return int)\n res=a, ret=1\n while b>0\n if b modulo 2 ret=(ret*res) modulo mod\n res=(res*res) modulo mod\n divide b by 2\n end of the block\n return ret\nend of the block\nn=int\nm=int\nc=array of 200 int\ng=array of 200 by 200 int\ndefine the main function\n read n\n for i=0 to n exclusive\n read c[i]\n decrement c[i]\n end of the block\n for i=0 to n exclusive\n k=int\n read k\n for j=0 to k exclusive\n u=int\n read u\n decrement u\n g[u][i]=1\n end of the block\n end of the block\n ans=100*n\n for start=0 to 3 exclusive\n m=0\n ok=array of 200 bool\n fill ok with 0\n cur=start\n res=n\n while m not equal n\n while true\n kpyto=false\n for i=0 to n exclusive\n if ok[i] or c[i] != cur continue\n win=true\n for j=0 to n exclusive\n if g[j][j] and not ok[j]\n win=false\n break\n end of the block\n end of the block\n if win\n kpyto=true\n increment m\n ok[i]=true\n end of the block\n end of the block\n if not kpyto break\n end of the block\n if m is n break\n cur=(cur+1) modulo 3\n increment res\n end of the block\n ans=min(res, ans)\n end of the block\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int mod = 1e9 + 7;\nint fast_pow(int a, int b) {\n int res = a, ret = 1;\n while (b > 0) {\n if (b % 2) ret = (ret * res) % mod;\n res = (res * res) % mod;\n b \/= 2;\n }\n return ret;\n}\nint n;\nint m;\nint c[200];\nint g[200][200];\nint main() {\n cin >> n;\n for (int i = 0; i < n; ++i) {\n cin >> c[i];\n c[i]--;\n }\n for (int i = 0; i < n; ++i) {\n int k;\n cin >> k;\n for (int j = 0; j < k; ++j) {\n int u;\n cin >> u;\n u--;\n g[u][i] = 1;\n }\n }\n int ans = 100 * n;\n for (int start = 0; start < 3; ++start) {\n m = 0;\n bool ok[200];\n memset(ok, 0, sizeof(ok));\n int cur = start;\n int res = n;\n while (m != n) {\n while (1) {\n bool kpyto = false;\n for (int i = 0; i < n; ++i) {\n if (ok[i] || c[i] != cur) continue;\n bool win = true;\n for (int j = 0; j < n; ++j) {\n if (g[j][i] && (!ok[j])) {\n win = false;\n break;\n }\n }\n if (win) {\n kpyto = true;\n m++;\n ok[i] = true;\n }\n }\n if (!kpyto) break;\n }\n if (m == n) break;\n cur = (cur + 1) % 3;\n res++;\n }\n ans = min(res, ans);\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"213A","pseudocode":"mod = 10^9+7\nfunction fast_pow (get int a and b, return int)\n res=a, ret=1\n while b>0\n if b modulo 2 ret=(ret*res) modulo mod\n res=(res*res) modulo mod\n divide b by 2\n end of the block\n return ret\nend of the block\nn=int\nm=int\nc=array of 200 int\ng=array of 200 by 200 int\ndefine the main function\n read n\n for i=0 to n exclusive\n read c[i]\n decrement c[i]\n end of the block\n for i=0 to n exclusive\n k=int\n read k\n for j=0 to k exclusive\n u=int\n read u\n decrement u\n g[u][i]=1\n end of the block\n end of the block\n ans=100*n\n for start=0 to 3 exclusive\n m=0\n ok=array of 200 bool\n fill ok with 0\n cur=start\n res=n\n while m not equal n\n while true\n kpyto=false\n for i=0 to n exclusive\n if ok[i] or c[i] != cur continue\n win=true\n for j=0 to n exclusive\n if g[j][j] and not ok[j]\n win=false\n break\n end of the block\n end of the block\n if win\n kpyto=true\n increment m\n ok[i]=true\n end of the block\n end of the block\n if not kpyto break\n end of the block\n if m is n break\n cur=(cur+1) modulo 3\n increment res\n end of the block\n ans=min(res, ans)\n end of the block\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["1","1","0"],["1"]],[["5","2 2 1 1 3","1 5","2 5 1","2 5 4","1 5","0"],["7"]],[["7","1 3 3 1 2 1 1","0","1 1","1 1","2 1 6","3 1 2 7","1 1","1 1"],["11"]],[["2","2 1","0","1 1"],["4"]],[["3","2 1 2","0","0","0"],["4"]],[["4","2 1 1 1","0","0","1 1","1 3"],["6"]],[["6","1 1 2 3 3 1","2 2 3","0","0","0","2 2 1","1 1"],["10"]],[["8","2 2 2 1 1 2 1 1","3 5 6 7","1 5","2 5 6","1 5","0","1 5","1 5","2 5 6"],["11"]],[["9","3 3 2 1 3 1 2 2 1","2 4 3","0","2 4 2","0","1 4","2 4 2","0","1 4","3 4 3 8"],["13"]],[["10","3 1 2 2 2 1 2 1 1 1","0","2 6 9","0","1 9","0","1 3","4 3 6 5 2","3 6 4 2","0","1 3"],["14"]],[["11","1 2 2 3 3 2 2 2 2 3 1","1 4","2 7 11","0","0","1 2","1 11","0","1 2","3 7 11 2","3 3 2 9","0"],["14"]],[["12","1 3 2 2 1 3 2 1 3 2 2 2","2 3 4","3 12 11 10","1 8","2 8 7","2 9 10","1 3","0","0","1 4","4 3 1 12 9","3 8 3 4","1 4"],["18"]],[["13","3 3 2 2 1 3 1 1 1 1 2 1 2","5 6 3 11 13 12","1 6","2 10 6","3 6 3 11","1 6","1 10","3 6 2 3","4 6 3 9 11","3 6 2 3","0","3 6 2 3","4 6 3 4 13","2 6 3"],["21"]],[["14","3 2 2 1 2 1 1 3 1 2 2 3 1 1","2 9 13","3 9 13 8","2 9 6","3 9 6 13","1 9","1 9","3 9 6 13","2 9 13","0","4 9 3 13 4","4 9 6 13 2","2 9 13","1 9","8 9 5 6 3 13 7 4 11"],["20"]],[["15","1 2 3 2 3 2 2 2 3 3 3 2 3 1 3","5 2 7 4 3 6","0","2 7 4","2 2 15","1 7","1 7","0","2 4 6","1 6","2 15 3","4 12 2 15 7","0","3 2 5 6","3 2 4 6","1 2"],["20"]],[["16","3 3 1 3 2 3 2 2 3 1 2 3 2 2 2 3","1 14","4 14 10 13 6","3 14 15 6","1 14","4 14 10 9 7","4 14 10 13 9","4 14 10 13 6","4 14 4 12 3","2 14 4","1 14","1 14","2 14 1","4 14 10 4 1","0","2 14 10","1 14"],["22"]],[["17","3 2 3 2 2 2 1 3 3 3 3 2 3 3 3 1 1","0","0","2 8 10","4 12 8 6 16","0","2 8 13","3 2 8 10","1 12","4 8 17 3 16","2 2 8","0","1 2","2 8 10","2 12 8","2 8 10","1 8","2 12 8"],["21"]],[["18","2 1 1 3 2 1 3 2 3 3 2 2 1 1 3 1 1 3","3 16 8 6","3 16 6 1","4 6 13 5 7","2 6 2","4 16 6 17 1","2 16 8","3 6 17 12","1 16","0","3 6 15 1","3 16 6 12","7 16 9 8 6 13 17 14","1 6","1 6","3 8 6 13","0","1 6","3 9 6 13"],["26"]],[["19","2 1 2 3 3 3 2 1 1 1 1 3 3 1 1 1 2 2 3","0","2 1 7","0","4 3 2 17 13","1 17","1 3","3 1 3 6","4 1 17 9 13","3 1 16 17","0","3 3 6 17","1 6","6 10 6 7 17 9 11","3 10 17 13","4 3 17 13 8","1 3","3 6 7 16","0","6 1 7 17 11 13 15"],["29"]],[["20","1 2 2 2 1 3 3 2 2 1 2 2 3 1 2 2 2 1 1 1","2 10 8","5 10 12 3 20 7","0","3 10 15 3","0","3 14 17 3","2 12 20","0","3 17 10 12","1 17","1 5","1 5","0","1 18","3 18 5 12","5 5 12 8 3 19","0","0","1 12","1 18"],["24"]],[["11","3 1 3 2 3 2 3 2 3 1 3","6 2 3 9 5 7 10","1 6","2 6 2","5 6 2 3 9 5","2 3 9","0","5 3 9 5 8 4","4 2 3 9 5","2 2 3","8 6 2 3 9 5 4 11 7","4 2 3 9 5"],["21"]],[["12","2 3 3 1 1 3 2 2 3 1 3 3","1 9","1 1","2 2 11","5 1 2 11 5 8","4 9 10 1 11","5 9 10 12 11 5","4 1 12 11 5","5 10 1 2 12 11","0","1 9","1 12","0"],["19"]],[["13","3 2 2 1 3 3 2 3 2 2 1 2 3","7 4 3 2 5 9 8 13","1 4","1 4","0","3 4 2 6","2 4 2","4 4 3 2 9","5 4 2 6 9 7","3 4 2 6","6 4 3 2 5 9 7","6 4 3 2 6 9 7","8 4 2 6 5 9 8 11 10","7 4 3 2 6 9 8 11"],["21"]],[["14","2 3 1 3 1 1 1 2 2 3 1 1 3 1","4 14 9 8 5","4 4 8 5 1","9 4 14 9 8 1 2 13 7 12","0","2 14 8","2 4 14","7 9 6 10 8 1 2 13","2 4 6","1 14","1 9","8 4 6 10 8 5 1 2 3","7 14 6 10 8 1 2 7","5 10 8 5 1 2","0"],["21"]],[["15","3 2 2 2 1 1 2 1 1 2 2 3 3 3 2","1 13","4 13 1 8 14","10 5 13 1 8 14 4 2 11 15 10","6 5 13 1 8 9 14","0","11 5 13 1 8 14 4 2 11 10 3 12","11 13 1 8 14 4 2 11 15 10 3 6","2 13 1","4 5 13 1 8","8 5 13 1 8 14 2 11 15","6 5 13 1 8 14 2","10 5 13 1 8 14 2 11 15 10 3","0","4 13 1 8 9","8 5 13 1 8 9 14 2 11"],["23"]],[["16","3 1 2 3 3 2 3 1 3 2 2 1 2 2 1 2","0","0","7 2 8 4 12 5 9 11","1 1","4 1 8 4 12","5 2 4 12 5 11","4 4 12 5 10","0","5 1 8 4 12 5","6 1 4 12 5 9 11","6 2 1 8 4 12 5","2 4 13","3 1 8 4","8 1 4 13 12 5 10 3 6","4 4 12 5 6","8 8 4 13 12 5 9 6 14"],["26"]],[["17","2 3 1 3 3 3 1 1 1 2 2 2 3 2 3 3 2","5 4 14 2 11 7","3 13 4 14","7 6 4 14 2 1 10 12","2 6 13","9 4 2 9 8 7 17 1 10 12","0","5 4 14 2 9 11","4 13 4 2 11","4 13 4 14 2","7 13 4 2 11 8 7 1","4 13 4 14 2","8 6 4 2 8 7 17 1 10","0","1 4","7 13 4 14 2 9 8 7","6 4 2 17 1 10 12","5 13 4 2 9 8"],["27"]],[["18","1 2 3 3 2 2 1 1 3 1 2 3 2 3 1 2 2 3","5 9 3 14 12 2","7 9 4 3 14 16 7 12","1 9","1 9","6 9 14 12 1 6 15","6 9 14 12 2 1 11","2 9 14","7 9 14 7 12 2 1 6","0","6 9 18 14 7 1 6","4 9 14 7 1","2 9 14","6 9 3 14 7 1 6","2 9 3","9 9 3 14 16 12 2 1 6 17","4 9 4 18 14","8 9 18 14 12 1 11 6 13","2 9 4"],["26"]],[["19","2 3 3 2 3 1 3 1 2 2 2 1 1 1 2 2 1 3 3","0","3 1 10 6","8 1 6 2 17 18 12 15 7","5 6 2 9 17 18","6 6 2 17 18 12 16","1 11","9 1 11 6 2 17 18 4 12 15","3 1 6 2","4 1 6 2 8","0","1 1","5 1 6 2 17 18","12 1 10 6 2 8 17 18 4 12 15 7 3","10 11 6 2 17 18 4 12 16 15 7","8 1 6 2 8 17 18 12 16","8 11 6 2 9 17 18 4 12","3 11 6 2","5 10 6 2 9 17","10 1 6 2 17 18 12 5 15 7 3"],["30"]],[["20","2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1","1 7","13 7 1 11 4 6 16 20 12 5 18 19 15 10","8 7 1 11 4 6 17 8 16","3 7 1 11","9 7 1 11 4 6 8 20 12 3","4 7 1 11 4","0","6 7 1 11 4 6 17","4 7 1 11 4","7 7 1 11 4 6 17 5","2 7 1","9 7 1 11 4 6 17 8 14 20","11 7 1 11 4 6 20 3 5 15 10 2","5 7 1 11 4 6","9 7 1 11 4 6 8 16 14 5","5 7 1 11 4 6","5 7 1 11 4 6","11 7 1 11 4 9 6 17 8 20 3 5","11 7 1 11 4 6 17 16 20 12 5 18","6 7 1 11 4 6 14"],["35"]],[["21","1 2 1 3 3 3 1 1 2 2 3 1 3 1 3 3 1 1 1 2 2","1 5","0","1 11","0","0","0","1 8","0","1 11","1 1","1 19","0","1 2","0","0","0","0","1 19","0","0","0"],["25"]],[["22","2 3 2 3 3 2 1 2 3 3 1 3 1 1 2 2 3 3 1 3 2 2","0","1 8","1 22","1 12","0","1 14","0","0","0","2 22 14","1 12","0","0","0","0","0","0","0","0","1 16","1 13","0"],["25"]],[["23","3 1 3 3 2 2 2 1 3 2 3 1 1 1 1 2 3 1 2 1 3 1 1","0","1 11","1 11","2 11 16","1 2","3 11 1 12","2 11 16","2 12 2","1 13","2 12 2","0","0","0","2 13 11","0","1 11","2 12 2","3 16 6 21","1 11","0","0","2 11 12","0"],["27"]],[["24","1 2 1 1 2 2 1 1 3 2 3 1 3 2 3 3 1 1 3 2 3 2 1 2","1 16","0","0","1 2","0","0","0","0","1 2","0","0","0","0","0","0","0","2 12 24","0","0","1 11","0","0","0","0"],["27"]],[["25","3 3 1 1 1 2 2 2 3 1 2 3 2 1 2 2 2 3 2 1 2 3 2 1 1","0","0","0","0","0","0","1 12","0","1 19","0","2 12 21","2 3 10","0","1 21","0","1 9","1 3","0","0","2 3 2","0","1 12","0","1 3","2 21 9"],["29"]],[["26","1 2 2 1 1 2 1 1 2 1 3 1 3 1 2 3 3 3 2 1 2 1 3 3 2 2","1 9","1 1","0","0","0","0","0","0","0","0","0","1 5","0","2 15 12","1 8","0","0","0","0","2 3 26","0","0","0","1 22","0","1 8"],["30"]],[["27","2 1 1 3 2 1 1 2 3 1 1 2 2 2 1 2 1 1 3 3 3 1 1 1 3 1 1","0","0","0","1 12","0","0","0","0","0","0","1 26","0","0","0","0","1 27","0","0","0","0","0","0","1 5","0","2 20 27","1 18","0"],["30"]],[["28","2 1 1 3 2 3 2 2 1 3 2 3 3 2 3 1 2 2 3 3 3 3 1 3 2 1 3 3","0","1 7","0","2 28 18","1 28","0","0","0","0","0","0","2 10 18","3 8 10 18","0","2 1 20","0","1 18","1 27","2 27 18","0","0","1 28","0","0","0","0","1 28","1 9"],["33"]],[["29","3 3 3 3 3 1 1 1 3 2 2 1 1 3 1 1 1 2 1 2 3 1 1 2 1 3 1 2 3","0","0","0","0","0","1 1","0","0","2 28 15","0","0","0","2 24 23","1 28","0","1 28","1 20","0","0","0","0","1 28","0","0","2 23 16","0","0","1 7","1 28"],["32"]],[["30","1 3 3 3 2 3 1 3 3 3 3 2 3 1 3 2 1 1 1 1 2 3 2 1 1 3 3 2 2 2","0","1 20","0","1 7","2 6 9","1 20","1 20","3 7 6 9","2 10 6","0","0","2 6 9","0","0","1 20","2 6 9","2 6 9","0","2 6 9","0","2 6 9","3 27 6 9","2 6 9","2 6 9","0","0","0","2 6 9","3 6 9 19","3 27 6 9"],["34"]],[["4","1 1 2 3","1 2","1 3","0","1 1"],["8"]]]}} +{"instance_id":"pseudo_to_code_2k_100","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ntu = int vector array of size 1005\na, cnt, checks = int array of size 1005 each and n = int\nin function check taking an int x and returning an in\n i, k = int\n sum = int with sum = -1\n qua = int queue array of size 5\n for i = 1 to n inclusive\n if cnt[i] is 0 then push i to qua[a[i]]\n end of the block\n loop infinitely\n if size of qua[1] or size of qua[2] or size of qua[3] is 0 break\n loop while qua[x] is not empty\n increment sum\n set k to front of qua[x]\n pop qua[x]\n for i = 0 to size of tu[k]\n xx = int with xx = tu[k][i]\n decrement cnt[xx]\n if cnt[xx] is 0 push xx to qua[a[xx]]\n end of the block\n end of the block\n if x is 1\n set x to 2\n else if x is 2\n set x to 3\n else if x is 3\n set x to 1\n increment sum\n end of the block\n if sum is -1\n return to indicate successful execution\n else\n return sum\nend of the block\ndefine the main function\n i = int\n ans, T, x = int\n read n\n set all values of a to 0\n set all values of tu to 0\n set all values of cnt to 0\n for i = 1 to n inclusive read a[i]\n for i = 1 to n inclusive\n read T\n loop T times\n read x\n append i to tu[x]\n increment checks[i]\n end of the block\n end of the block\n set ans to 1 bitshift right by 30\n j = int\n for i = 1 to 3 inclusive\n for j = 1 to n inclusive set cnt[j] to checks[j]\n set ans to min of ans and check of i\n end of the block\n set ans\nend of the block\n\n[CODE]:","reference_output":"vector tu[1005];\nint a[1005], cnt[1005], n, checks[1005];\nint check(int x) {\n int i, k;\n int sum = -1;\n queue qua[5];\n for (i = 1; i <= n; i++) {\n if (cnt[i] == 0) { qua[a[i]].push(i); }\n }\n for (;;) {\n if (qua[1].size() == 0 && qua[2].size() == 0 && qua[3].size() == 0) break;\n while (!qua[x].empty()) {\n sum++;\n k = qua[x].front();\n qua[x].pop();\n for (i = 0; i < tu[k].size(); i++) {\n int xx = tu[k][i];\n cnt[xx]--;\n if (cnt[xx] == 0) qua[a[xx]].push(xx);\n }\n }\n if (x == 1)\n x = 2;\n else if (x == 2)\n x = 3;\n else if (x == 3)\n x = 1;\n sum++;\n }\n if (sum == -1)\n return 0;\n else\n return sum;\n}\nint main() {\n int i;\n int ans, T, x;\n cin >> n;\n memset(a, 0, sizeof(a));\n memset(tu, 0, sizeof(tu));\n memset(cnt, 0, sizeof(cnt));\n for (i = 1; i <= n; i++) { cin >> a[i]; }\n for (i = 1; i <= n; i++) {\n cin >> T;\n while (T--) {\n cin >> x;\n tu[x].push_back(i);\n checks[i]++;\n }\n }\n ans = 1 << 30;\n int j;\n for (i = 1; i <= 3; i++) {\n for (j = 1; j <= n; j++) { cnt[j] = checks[j]; }\n ans = min(ans, check(i));\n }\n cout << ans << endl;\n}","item":{"problem_id":"213A","pseudocode":"tu = int vector array of size 1005\na, cnt, checks = int array of size 1005 each and n = int\nin function check taking an int x and returning an in\n i, k = int\n sum = int with sum = -1\n qua = int queue array of size 5\n for i = 1 to n inclusive\n if cnt[i] is 0 then push i to qua[a[i]]\n end of the block\n loop infinitely\n if size of qua[1] or size of qua[2] or size of qua[3] is 0 break\n loop while qua[x] is not empty\n increment sum\n set k to front of qua[x]\n pop qua[x]\n for i = 0 to size of tu[k]\n xx = int with xx = tu[k][i]\n decrement cnt[xx]\n if cnt[xx] is 0 push xx to qua[a[xx]]\n end of the block\n end of the block\n if x is 1\n set x to 2\n else if x is 2\n set x to 3\n else if x is 3\n set x to 1\n increment sum\n end of the block\n if sum is -1\n return to indicate successful execution\n else\n return sum\nend of the block\ndefine the main function\n i = int\n ans, T, x = int\n read n\n set all values of a to 0\n set all values of tu to 0\n set all values of cnt to 0\n for i = 1 to n inclusive read a[i]\n for i = 1 to n inclusive\n read T\n loop T times\n read x\n append i to tu[x]\n increment checks[i]\n end of the block\n end of the block\n set ans to 1 bitshift right by 30\n j = int\n for i = 1 to 3 inclusive\n for j = 1 to n inclusive set cnt[j] to checks[j]\n set ans to min of ans and check of i\n end of the block\n set ans\nend of the block","testcases":[[["1","1","0"],["1"]],[["5","2 2 1 1 3","1 5","2 5 1","2 5 4","1 5","0"],["7"]],[["7","1 3 3 1 2 1 1","0","1 1","1 1","2 1 6","3 1 2 7","1 1","1 1"],["11"]],[["2","2 1","0","1 1"],["4"]],[["3","2 1 2","0","0","0"],["4"]],[["4","2 1 1 1","0","0","1 1","1 3"],["6"]],[["6","1 1 2 3 3 1","2 2 3","0","0","0","2 2 1","1 1"],["10"]],[["8","2 2 2 1 1 2 1 1","3 5 6 7","1 5","2 5 6","1 5","0","1 5","1 5","2 5 6"],["11"]],[["9","3 3 2 1 3 1 2 2 1","2 4 3","0","2 4 2","0","1 4","2 4 2","0","1 4","3 4 3 8"],["13"]],[["10","3 1 2 2 2 1 2 1 1 1","0","2 6 9","0","1 9","0","1 3","4 3 6 5 2","3 6 4 2","0","1 3"],["14"]],[["11","1 2 2 3 3 2 2 2 2 3 1","1 4","2 7 11","0","0","1 2","1 11","0","1 2","3 7 11 2","3 3 2 9","0"],["14"]],[["12","1 3 2 2 1 3 2 1 3 2 2 2","2 3 4","3 12 11 10","1 8","2 8 7","2 9 10","1 3","0","0","1 4","4 3 1 12 9","3 8 3 4","1 4"],["18"]],[["13","3 3 2 2 1 3 1 1 1 1 2 1 2","5 6 3 11 13 12","1 6","2 10 6","3 6 3 11","1 6","1 10","3 6 2 3","4 6 3 9 11","3 6 2 3","0","3 6 2 3","4 6 3 4 13","2 6 3"],["21"]],[["14","3 2 2 1 2 1 1 3 1 2 2 3 1 1","2 9 13","3 9 13 8","2 9 6","3 9 6 13","1 9","1 9","3 9 6 13","2 9 13","0","4 9 3 13 4","4 9 6 13 2","2 9 13","1 9","8 9 5 6 3 13 7 4 11"],["20"]],[["15","1 2 3 2 3 2 2 2 3 3 3 2 3 1 3","5 2 7 4 3 6","0","2 7 4","2 2 15","1 7","1 7","0","2 4 6","1 6","2 15 3","4 12 2 15 7","0","3 2 5 6","3 2 4 6","1 2"],["20"]],[["16","3 3 1 3 2 3 2 2 3 1 2 3 2 2 2 3","1 14","4 14 10 13 6","3 14 15 6","1 14","4 14 10 9 7","4 14 10 13 9","4 14 10 13 6","4 14 4 12 3","2 14 4","1 14","1 14","2 14 1","4 14 10 4 1","0","2 14 10","1 14"],["22"]],[["17","3 2 3 2 2 2 1 3 3 3 3 2 3 3 3 1 1","0","0","2 8 10","4 12 8 6 16","0","2 8 13","3 2 8 10","1 12","4 8 17 3 16","2 2 8","0","1 2","2 8 10","2 12 8","2 8 10","1 8","2 12 8"],["21"]],[["18","2 1 1 3 2 1 3 2 3 3 2 2 1 1 3 1 1 3","3 16 8 6","3 16 6 1","4 6 13 5 7","2 6 2","4 16 6 17 1","2 16 8","3 6 17 12","1 16","0","3 6 15 1","3 16 6 12","7 16 9 8 6 13 17 14","1 6","1 6","3 8 6 13","0","1 6","3 9 6 13"],["26"]],[["19","2 1 2 3 3 3 2 1 1 1 1 3 3 1 1 1 2 2 3","0","2 1 7","0","4 3 2 17 13","1 17","1 3","3 1 3 6","4 1 17 9 13","3 1 16 17","0","3 3 6 17","1 6","6 10 6 7 17 9 11","3 10 17 13","4 3 17 13 8","1 3","3 6 7 16","0","6 1 7 17 11 13 15"],["29"]],[["20","1 2 2 2 1 3 3 2 2 1 2 2 3 1 2 2 2 1 1 1","2 10 8","5 10 12 3 20 7","0","3 10 15 3","0","3 14 17 3","2 12 20","0","3 17 10 12","1 17","1 5","1 5","0","1 18","3 18 5 12","5 5 12 8 3 19","0","0","1 12","1 18"],["24"]],[["11","3 1 3 2 3 2 3 2 3 1 3","6 2 3 9 5 7 10","1 6","2 6 2","5 6 2 3 9 5","2 3 9","0","5 3 9 5 8 4","4 2 3 9 5","2 2 3","8 6 2 3 9 5 4 11 7","4 2 3 9 5"],["21"]],[["12","2 3 3 1 1 3 2 2 3 1 3 3","1 9","1 1","2 2 11","5 1 2 11 5 8","4 9 10 1 11","5 9 10 12 11 5","4 1 12 11 5","5 10 1 2 12 11","0","1 9","1 12","0"],["19"]],[["13","3 2 2 1 3 3 2 3 2 2 1 2 3","7 4 3 2 5 9 8 13","1 4","1 4","0","3 4 2 6","2 4 2","4 4 3 2 9","5 4 2 6 9 7","3 4 2 6","6 4 3 2 5 9 7","6 4 3 2 6 9 7","8 4 2 6 5 9 8 11 10","7 4 3 2 6 9 8 11"],["21"]],[["14","2 3 1 3 1 1 1 2 2 3 1 1 3 1","4 14 9 8 5","4 4 8 5 1","9 4 14 9 8 1 2 13 7 12","0","2 14 8","2 4 14","7 9 6 10 8 1 2 13","2 4 6","1 14","1 9","8 4 6 10 8 5 1 2 3","7 14 6 10 8 1 2 7","5 10 8 5 1 2","0"],["21"]],[["15","3 2 2 2 1 1 2 1 1 2 2 3 3 3 2","1 13","4 13 1 8 14","10 5 13 1 8 14 4 2 11 15 10","6 5 13 1 8 9 14","0","11 5 13 1 8 14 4 2 11 10 3 12","11 13 1 8 14 4 2 11 15 10 3 6","2 13 1","4 5 13 1 8","8 5 13 1 8 14 2 11 15","6 5 13 1 8 14 2","10 5 13 1 8 14 2 11 15 10 3","0","4 13 1 8 9","8 5 13 1 8 9 14 2 11"],["23"]],[["16","3 1 2 3 3 2 3 1 3 2 2 1 2 2 1 2","0","0","7 2 8 4 12 5 9 11","1 1","4 1 8 4 12","5 2 4 12 5 11","4 4 12 5 10","0","5 1 8 4 12 5","6 1 4 12 5 9 11","6 2 1 8 4 12 5","2 4 13","3 1 8 4","8 1 4 13 12 5 10 3 6","4 4 12 5 6","8 8 4 13 12 5 9 6 14"],["26"]],[["17","2 3 1 3 3 3 1 1 1 2 2 2 3 2 3 3 2","5 4 14 2 11 7","3 13 4 14","7 6 4 14 2 1 10 12","2 6 13","9 4 2 9 8 7 17 1 10 12","0","5 4 14 2 9 11","4 13 4 2 11","4 13 4 14 2","7 13 4 2 11 8 7 1","4 13 4 14 2","8 6 4 2 8 7 17 1 10","0","1 4","7 13 4 14 2 9 8 7","6 4 2 17 1 10 12","5 13 4 2 9 8"],["27"]],[["18","1 2 3 3 2 2 1 1 3 1 2 3 2 3 1 2 2 3","5 9 3 14 12 2","7 9 4 3 14 16 7 12","1 9","1 9","6 9 14 12 1 6 15","6 9 14 12 2 1 11","2 9 14","7 9 14 7 12 2 1 6","0","6 9 18 14 7 1 6","4 9 14 7 1","2 9 14","6 9 3 14 7 1 6","2 9 3","9 9 3 14 16 12 2 1 6 17","4 9 4 18 14","8 9 18 14 12 1 11 6 13","2 9 4"],["26"]],[["19","2 3 3 2 3 1 3 1 2 2 2 1 1 1 2 2 1 3 3","0","3 1 10 6","8 1 6 2 17 18 12 15 7","5 6 2 9 17 18","6 6 2 17 18 12 16","1 11","9 1 11 6 2 17 18 4 12 15","3 1 6 2","4 1 6 2 8","0","1 1","5 1 6 2 17 18","12 1 10 6 2 8 17 18 4 12 15 7 3","10 11 6 2 17 18 4 12 16 15 7","8 1 6 2 8 17 18 12 16","8 11 6 2 9 17 18 4 12","3 11 6 2","5 10 6 2 9 17","10 1 6 2 17 18 12 5 15 7 3"],["30"]],[["20","2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1","1 7","13 7 1 11 4 6 16 20 12 5 18 19 15 10","8 7 1 11 4 6 17 8 16","3 7 1 11","9 7 1 11 4 6 8 20 12 3","4 7 1 11 4","0","6 7 1 11 4 6 17","4 7 1 11 4","7 7 1 11 4 6 17 5","2 7 1","9 7 1 11 4 6 17 8 14 20","11 7 1 11 4 6 20 3 5 15 10 2","5 7 1 11 4 6","9 7 1 11 4 6 8 16 14 5","5 7 1 11 4 6","5 7 1 11 4 6","11 7 1 11 4 9 6 17 8 20 3 5","11 7 1 11 4 6 17 16 20 12 5 18","6 7 1 11 4 6 14"],["35"]],[["21","1 2 1 3 3 3 1 1 2 2 3 1 3 1 3 3 1 1 1 2 2","1 5","0","1 11","0","0","0","1 8","0","1 11","1 1","1 19","0","1 2","0","0","0","0","1 19","0","0","0"],["25"]],[["22","2 3 2 3 3 2 1 2 3 3 1 3 1 1 2 2 3 3 1 3 2 2","0","1 8","1 22","1 12","0","1 14","0","0","0","2 22 14","1 12","0","0","0","0","0","0","0","0","1 16","1 13","0"],["25"]],[["23","3 1 3 3 2 2 2 1 3 2 3 1 1 1 1 2 3 1 2 1 3 1 1","0","1 11","1 11","2 11 16","1 2","3 11 1 12","2 11 16","2 12 2","1 13","2 12 2","0","0","0","2 13 11","0","1 11","2 12 2","3 16 6 21","1 11","0","0","2 11 12","0"],["27"]],[["24","1 2 1 1 2 2 1 1 3 2 3 1 3 2 3 3 1 1 3 2 3 2 1 2","1 16","0","0","1 2","0","0","0","0","1 2","0","0","0","0","0","0","0","2 12 24","0","0","1 11","0","0","0","0"],["27"]],[["25","3 3 1 1 1 2 2 2 3 1 2 3 2 1 2 2 2 3 2 1 2 3 2 1 1","0","0","0","0","0","0","1 12","0","1 19","0","2 12 21","2 3 10","0","1 21","0","1 9","1 3","0","0","2 3 2","0","1 12","0","1 3","2 21 9"],["29"]],[["26","1 2 2 1 1 2 1 1 2 1 3 1 3 1 2 3 3 3 2 1 2 1 3 3 2 2","1 9","1 1","0","0","0","0","0","0","0","0","0","1 5","0","2 15 12","1 8","0","0","0","0","2 3 26","0","0","0","1 22","0","1 8"],["30"]],[["27","2 1 1 3 2 1 1 2 3 1 1 2 2 2 1 2 1 1 3 3 3 1 1 1 3 1 1","0","0","0","1 12","0","0","0","0","0","0","1 26","0","0","0","0","1 27","0","0","0","0","0","0","1 5","0","2 20 27","1 18","0"],["30"]],[["28","2 1 1 3 2 3 2 2 1 3 2 3 3 2 3 1 2 2 3 3 3 3 1 3 2 1 3 3","0","1 7","0","2 28 18","1 28","0","0","0","0","0","0","2 10 18","3 8 10 18","0","2 1 20","0","1 18","1 27","2 27 18","0","0","1 28","0","0","0","0","1 28","1 9"],["33"]],[["29","3 3 3 3 3 1 1 1 3 2 2 1 1 3 1 1 1 2 1 2 3 1 1 2 1 3 1 2 3","0","0","0","0","0","1 1","0","0","2 28 15","0","0","0","2 24 23","1 28","0","1 28","1 20","0","0","0","0","1 28","0","0","2 23 16","0","0","1 7","1 28"],["32"]],[["30","1 3 3 3 2 3 1 3 3 3 3 2 3 1 3 2 1 1 1 1 2 3 2 1 1 3 3 2 2 2","0","1 20","0","1 7","2 6 9","1 20","1 20","3 7 6 9","2 10 6","0","0","2 6 9","0","0","1 20","2 6 9","2 6 9","0","2 6 9","0","2 6 9","3 27 6 9","2 6 9","2 6 9","0","0","0","2 6 9","3 6 9 19","3 27 6 9"],["34"]],[["4","1 1 2 3","1 2","1 3","0","1 1"],["8"]]]}} +{"instance_id":"pseudo_to_code_2k_101","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nN = const integer with N = 2e2 + 5\nn, c, vis = integers with c, vis = array of size N\nned, a = vector of integers array of size N\nin the function solve that takes integer x and returns integer\n set all contents of vis to 0\n res, cnt, flag = integers with res = 0, cnt = 0, flag = 0\n while cnt < n\n mk = bool with mk = true\n while mk\n mk = false\n for i = 0 to a[x].size() exclusive\n id = integer with id = a[x][i], tot = 0\n if vis[id], continue next iteration\n for j = 0 to ned[id].size() exclusive\n if vis[ned[id][j]], increment tot\n if tot is ned[id].size()\n increment res and cnt\n vis[id] = 1\n flag = 0\n mk = true\n end of the block\n end of the block\n end of the block\n if cnt is n, return res\n increment x\n if x > 3, x = 1\n increment res, flag\n if flag < -4, return 2e9\n end of the block\nend of the block\ndefine the main function\n read n\n for i = 1 to n, read c[i], a[c[i]].push_back(i)\n for i = 1 to n\n k = integer\n read k\n for j = 0 to k exclusive\n x = integer\n read x\n append x in ned[i]\n end of the block\n end of the block\n res = integer with res = 2e9\n for i = 1 to 3, res = min(res, solve(i))\n print res\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int N = 2e2 + 5;\nint n, c[N], vis[N];\nvector ned[N], a[N];\nint solve(int x) {\n memset(vis, 0, sizeof(vis));\n int res = 0, cnt = 0, flag = 0;\n while (cnt < n) {\n bool mk = true;\n while (mk) {\n mk = false;\n for (int i = 0; i < a[x].size(); i++) {\n int id = a[x][i], tot = 0;\n if (vis[id]) continue;\n for (int j = 0; j < ned[id].size(); j++)\n if (vis[ned[id][j]]) tot++;\n if (tot == ned[id].size()) {\n res++, cnt++;\n vis[id] = 1;\n flag = 0;\n mk = true;\n }\n }\n }\n if (cnt == n) return res;\n x++;\n if (x > 3) x = 1;\n res++, flag--;\n if (flag < -4) return 2e9;\n }\n}\nint main() {\n cin >> n;\n for (int i = 1; i <= n; i++) cin >> c[i], a[c[i]].push_back(i);\n for (int i = 1; i <= n; i++) {\n int k;\n cin >> k;\n for (int j = 0; j < k; j++) {\n int x;\n cin >> x;\n ned[i].push_back(x);\n }\n }\n int res = 2e9;\n for (int i = 1; i <= 3; i++) res = min(res, solve(i));\n cout << res << '\\n';\n return 0;\n}","item":{"problem_id":"213A","pseudocode":"N = const integer with N = 2e2 + 5\nn, c, vis = integers with c, vis = array of size N\nned, a = vector of integers array of size N\nin the function solve that takes integer x and returns integer\n set all contents of vis to 0\n res, cnt, flag = integers with res = 0, cnt = 0, flag = 0\n while cnt < n\n mk = bool with mk = true\n while mk\n mk = false\n for i = 0 to a[x].size() exclusive\n id = integer with id = a[x][i], tot = 0\n if vis[id], continue next iteration\n for j = 0 to ned[id].size() exclusive\n if vis[ned[id][j]], increment tot\n if tot is ned[id].size()\n increment res and cnt\n vis[id] = 1\n flag = 0\n mk = true\n end of the block\n end of the block\n end of the block\n if cnt is n, return res\n increment x\n if x > 3, x = 1\n increment res, flag\n if flag < -4, return 2e9\n end of the block\nend of the block\ndefine the main function\n read n\n for i = 1 to n, read c[i], a[c[i]].push_back(i)\n for i = 1 to n\n k = integer\n read k\n for j = 0 to k exclusive\n x = integer\n read x\n append x in ned[i]\n end of the block\n end of the block\n res = integer with res = 2e9\n for i = 1 to 3, res = min(res, solve(i))\n print res\n return to indicate successful execution\nend of the block","testcases":[[["1","1","0"],["1"]],[["5","2 2 1 1 3","1 5","2 5 1","2 5 4","1 5","0"],["7"]],[["7","1 3 3 1 2 1 1","0","1 1","1 1","2 1 6","3 1 2 7","1 1","1 1"],["11"]],[["2","2 1","0","1 1"],["4"]],[["3","2 1 2","0","0","0"],["4"]],[["4","2 1 1 1","0","0","1 1","1 3"],["6"]],[["6","1 1 2 3 3 1","2 2 3","0","0","0","2 2 1","1 1"],["10"]],[["8","2 2 2 1 1 2 1 1","3 5 6 7","1 5","2 5 6","1 5","0","1 5","1 5","2 5 6"],["11"]],[["9","3 3 2 1 3 1 2 2 1","2 4 3","0","2 4 2","0","1 4","2 4 2","0","1 4","3 4 3 8"],["13"]],[["10","3 1 2 2 2 1 2 1 1 1","0","2 6 9","0","1 9","0","1 3","4 3 6 5 2","3 6 4 2","0","1 3"],["14"]],[["11","1 2 2 3 3 2 2 2 2 3 1","1 4","2 7 11","0","0","1 2","1 11","0","1 2","3 7 11 2","3 3 2 9","0"],["14"]],[["12","1 3 2 2 1 3 2 1 3 2 2 2","2 3 4","3 12 11 10","1 8","2 8 7","2 9 10","1 3","0","0","1 4","4 3 1 12 9","3 8 3 4","1 4"],["18"]],[["13","3 3 2 2 1 3 1 1 1 1 2 1 2","5 6 3 11 13 12","1 6","2 10 6","3 6 3 11","1 6","1 10","3 6 2 3","4 6 3 9 11","3 6 2 3","0","3 6 2 3","4 6 3 4 13","2 6 3"],["21"]],[["14","3 2 2 1 2 1 1 3 1 2 2 3 1 1","2 9 13","3 9 13 8","2 9 6","3 9 6 13","1 9","1 9","3 9 6 13","2 9 13","0","4 9 3 13 4","4 9 6 13 2","2 9 13","1 9","8 9 5 6 3 13 7 4 11"],["20"]],[["15","1 2 3 2 3 2 2 2 3 3 3 2 3 1 3","5 2 7 4 3 6","0","2 7 4","2 2 15","1 7","1 7","0","2 4 6","1 6","2 15 3","4 12 2 15 7","0","3 2 5 6","3 2 4 6","1 2"],["20"]],[["16","3 3 1 3 2 3 2 2 3 1 2 3 2 2 2 3","1 14","4 14 10 13 6","3 14 15 6","1 14","4 14 10 9 7","4 14 10 13 9","4 14 10 13 6","4 14 4 12 3","2 14 4","1 14","1 14","2 14 1","4 14 10 4 1","0","2 14 10","1 14"],["22"]],[["17","3 2 3 2 2 2 1 3 3 3 3 2 3 3 3 1 1","0","0","2 8 10","4 12 8 6 16","0","2 8 13","3 2 8 10","1 12","4 8 17 3 16","2 2 8","0","1 2","2 8 10","2 12 8","2 8 10","1 8","2 12 8"],["21"]],[["18","2 1 1 3 2 1 3 2 3 3 2 2 1 1 3 1 1 3","3 16 8 6","3 16 6 1","4 6 13 5 7","2 6 2","4 16 6 17 1","2 16 8","3 6 17 12","1 16","0","3 6 15 1","3 16 6 12","7 16 9 8 6 13 17 14","1 6","1 6","3 8 6 13","0","1 6","3 9 6 13"],["26"]],[["19","2 1 2 3 3 3 2 1 1 1 1 3 3 1 1 1 2 2 3","0","2 1 7","0","4 3 2 17 13","1 17","1 3","3 1 3 6","4 1 17 9 13","3 1 16 17","0","3 3 6 17","1 6","6 10 6 7 17 9 11","3 10 17 13","4 3 17 13 8","1 3","3 6 7 16","0","6 1 7 17 11 13 15"],["29"]],[["20","1 2 2 2 1 3 3 2 2 1 2 2 3 1 2 2 2 1 1 1","2 10 8","5 10 12 3 20 7","0","3 10 15 3","0","3 14 17 3","2 12 20","0","3 17 10 12","1 17","1 5","1 5","0","1 18","3 18 5 12","5 5 12 8 3 19","0","0","1 12","1 18"],["24"]],[["11","3 1 3 2 3 2 3 2 3 1 3","6 2 3 9 5 7 10","1 6","2 6 2","5 6 2 3 9 5","2 3 9","0","5 3 9 5 8 4","4 2 3 9 5","2 2 3","8 6 2 3 9 5 4 11 7","4 2 3 9 5"],["21"]],[["12","2 3 3 1 1 3 2 2 3 1 3 3","1 9","1 1","2 2 11","5 1 2 11 5 8","4 9 10 1 11","5 9 10 12 11 5","4 1 12 11 5","5 10 1 2 12 11","0","1 9","1 12","0"],["19"]],[["13","3 2 2 1 3 3 2 3 2 2 1 2 3","7 4 3 2 5 9 8 13","1 4","1 4","0","3 4 2 6","2 4 2","4 4 3 2 9","5 4 2 6 9 7","3 4 2 6","6 4 3 2 5 9 7","6 4 3 2 6 9 7","8 4 2 6 5 9 8 11 10","7 4 3 2 6 9 8 11"],["21"]],[["14","2 3 1 3 1 1 1 2 2 3 1 1 3 1","4 14 9 8 5","4 4 8 5 1","9 4 14 9 8 1 2 13 7 12","0","2 14 8","2 4 14","7 9 6 10 8 1 2 13","2 4 6","1 14","1 9","8 4 6 10 8 5 1 2 3","7 14 6 10 8 1 2 7","5 10 8 5 1 2","0"],["21"]],[["15","3 2 2 2 1 1 2 1 1 2 2 3 3 3 2","1 13","4 13 1 8 14","10 5 13 1 8 14 4 2 11 15 10","6 5 13 1 8 9 14","0","11 5 13 1 8 14 4 2 11 10 3 12","11 13 1 8 14 4 2 11 15 10 3 6","2 13 1","4 5 13 1 8","8 5 13 1 8 14 2 11 15","6 5 13 1 8 14 2","10 5 13 1 8 14 2 11 15 10 3","0","4 13 1 8 9","8 5 13 1 8 9 14 2 11"],["23"]],[["16","3 1 2 3 3 2 3 1 3 2 2 1 2 2 1 2","0","0","7 2 8 4 12 5 9 11","1 1","4 1 8 4 12","5 2 4 12 5 11","4 4 12 5 10","0","5 1 8 4 12 5","6 1 4 12 5 9 11","6 2 1 8 4 12 5","2 4 13","3 1 8 4","8 1 4 13 12 5 10 3 6","4 4 12 5 6","8 8 4 13 12 5 9 6 14"],["26"]],[["17","2 3 1 3 3 3 1 1 1 2 2 2 3 2 3 3 2","5 4 14 2 11 7","3 13 4 14","7 6 4 14 2 1 10 12","2 6 13","9 4 2 9 8 7 17 1 10 12","0","5 4 14 2 9 11","4 13 4 2 11","4 13 4 14 2","7 13 4 2 11 8 7 1","4 13 4 14 2","8 6 4 2 8 7 17 1 10","0","1 4","7 13 4 14 2 9 8 7","6 4 2 17 1 10 12","5 13 4 2 9 8"],["27"]],[["18","1 2 3 3 2 2 1 1 3 1 2 3 2 3 1 2 2 3","5 9 3 14 12 2","7 9 4 3 14 16 7 12","1 9","1 9","6 9 14 12 1 6 15","6 9 14 12 2 1 11","2 9 14","7 9 14 7 12 2 1 6","0","6 9 18 14 7 1 6","4 9 14 7 1","2 9 14","6 9 3 14 7 1 6","2 9 3","9 9 3 14 16 12 2 1 6 17","4 9 4 18 14","8 9 18 14 12 1 11 6 13","2 9 4"],["26"]],[["19","2 3 3 2 3 1 3 1 2 2 2 1 1 1 2 2 1 3 3","0","3 1 10 6","8 1 6 2 17 18 12 15 7","5 6 2 9 17 18","6 6 2 17 18 12 16","1 11","9 1 11 6 2 17 18 4 12 15","3 1 6 2","4 1 6 2 8","0","1 1","5 1 6 2 17 18","12 1 10 6 2 8 17 18 4 12 15 7 3","10 11 6 2 17 18 4 12 16 15 7","8 1 6 2 8 17 18 12 16","8 11 6 2 9 17 18 4 12","3 11 6 2","5 10 6 2 9 17","10 1 6 2 17 18 12 5 15 7 3"],["30"]],[["20","2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1","1 7","13 7 1 11 4 6 16 20 12 5 18 19 15 10","8 7 1 11 4 6 17 8 16","3 7 1 11","9 7 1 11 4 6 8 20 12 3","4 7 1 11 4","0","6 7 1 11 4 6 17","4 7 1 11 4","7 7 1 11 4 6 17 5","2 7 1","9 7 1 11 4 6 17 8 14 20","11 7 1 11 4 6 20 3 5 15 10 2","5 7 1 11 4 6","9 7 1 11 4 6 8 16 14 5","5 7 1 11 4 6","5 7 1 11 4 6","11 7 1 11 4 9 6 17 8 20 3 5","11 7 1 11 4 6 17 16 20 12 5 18","6 7 1 11 4 6 14"],["35"]],[["21","1 2 1 3 3 3 1 1 2 2 3 1 3 1 3 3 1 1 1 2 2","1 5","0","1 11","0","0","0","1 8","0","1 11","1 1","1 19","0","1 2","0","0","0","0","1 19","0","0","0"],["25"]],[["22","2 3 2 3 3 2 1 2 3 3 1 3 1 1 2 2 3 3 1 3 2 2","0","1 8","1 22","1 12","0","1 14","0","0","0","2 22 14","1 12","0","0","0","0","0","0","0","0","1 16","1 13","0"],["25"]],[["23","3 1 3 3 2 2 2 1 3 2 3 1 1 1 1 2 3 1 2 1 3 1 1","0","1 11","1 11","2 11 16","1 2","3 11 1 12","2 11 16","2 12 2","1 13","2 12 2","0","0","0","2 13 11","0","1 11","2 12 2","3 16 6 21","1 11","0","0","2 11 12","0"],["27"]],[["24","1 2 1 1 2 2 1 1 3 2 3 1 3 2 3 3 1 1 3 2 3 2 1 2","1 16","0","0","1 2","0","0","0","0","1 2","0","0","0","0","0","0","0","2 12 24","0","0","1 11","0","0","0","0"],["27"]],[["25","3 3 1 1 1 2 2 2 3 1 2 3 2 1 2 2 2 3 2 1 2 3 2 1 1","0","0","0","0","0","0","1 12","0","1 19","0","2 12 21","2 3 10","0","1 21","0","1 9","1 3","0","0","2 3 2","0","1 12","0","1 3","2 21 9"],["29"]],[["26","1 2 2 1 1 2 1 1 2 1 3 1 3 1 2 3 3 3 2 1 2 1 3 3 2 2","1 9","1 1","0","0","0","0","0","0","0","0","0","1 5","0","2 15 12","1 8","0","0","0","0","2 3 26","0","0","0","1 22","0","1 8"],["30"]],[["27","2 1 1 3 2 1 1 2 3 1 1 2 2 2 1 2 1 1 3 3 3 1 1 1 3 1 1","0","0","0","1 12","0","0","0","0","0","0","1 26","0","0","0","0","1 27","0","0","0","0","0","0","1 5","0","2 20 27","1 18","0"],["30"]],[["28","2 1 1 3 2 3 2 2 1 3 2 3 3 2 3 1 2 2 3 3 3 3 1 3 2 1 3 3","0","1 7","0","2 28 18","1 28","0","0","0","0","0","0","2 10 18","3 8 10 18","0","2 1 20","0","1 18","1 27","2 27 18","0","0","1 28","0","0","0","0","1 28","1 9"],["33"]],[["29","3 3 3 3 3 1 1 1 3 2 2 1 1 3 1 1 1 2 1 2 3 1 1 2 1 3 1 2 3","0","0","0","0","0","1 1","0","0","2 28 15","0","0","0","2 24 23","1 28","0","1 28","1 20","0","0","0","0","1 28","0","0","2 23 16","0","0","1 7","1 28"],["32"]],[["30","1 3 3 3 2 3 1 3 3 3 3 2 3 1 3 2 1 1 1 1 2 3 2 1 1 3 3 2 2 2","0","1 20","0","1 7","2 6 9","1 20","1 20","3 7 6 9","2 10 6","0","0","2 6 9","0","0","1 20","2 6 9","2 6 9","0","2 6 9","0","2 6 9","3 27 6 9","2 6 9","2 6 9","0","0","0","2 6 9","3 6 9 19","3 27 6 9"],["34"]],[["4","1 1 2 3","1 2","1 3","0","1 1"],["8"]]]}} +{"instance_id":"pseudo_to_code_2k_102","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nfunction desperate_optimization (get precision as int)\n use normal notation\n show decimal point\n set precision digits\nend of the block\nvec=vector of 250 int\nq=array of 3 queue of int\nqq=array of 3 queue of int\ntype=array of 250 int\noutt = array of 250 int\ntoutt = array of 250 int\ndefine the main function\n desperate_optimization(20)\n n=int\n read n\n for i=1 to n inclusive read type[i]\n for i=1 to n inclusive\n decrement type[i]\n x=int\n read x\n outt[i] = x\n while decremented x > 0\n u=int\n read u\n add i to end of vec[u]\n end of the block\n end of the block\n for i=1 to n inclusive\n if outt[i] is 0 push i into q[type[i]]\n start=0\n for i=0 to 3 exclusive qq[i]=q[i]\n for i=1 to n inclusive toutt[i]=outt[i]\n ans=1000000000\n for i=0 to 3 exclusive\n if qq[i] is empty continue\n for j=0 to 3 exclusive q[j]=qq[j]\n for j=1 to n inclusive outt[j]=toutt[j]\n start=i\n total=0\n while q[0], q[1] and q[2] are not empty\n while q[start] is not empty\n pos=first item of q[start]\n pop q[start]\n for i=0 to size of vec[pos] exclusive\n nx=vec[pos][i]\n decrement outt[nx]\n if outt[nx] is 0 push nx into q[type[nx]]\n end of the block\n increment total\n end of the block\n start=(start+1) modulo 3\n increment total\n end of the block\n ans=min(ans, total-1)\n end of the block\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"void desperate_optimization(int precision) {\n cout.setf(ios::fixed);\n cout.setf(ios::showpoint);\n cout.precision(precision);\n}\nvector vec[250];\nqueue q[3];\nqueue qq[3];\nint type[250];\nint outt[250];\nint toutt[250];\nint main() {\n desperate_optimization(20);\n int n;\n cin >> n;\n for (int i = 1; i <= n; i++) cin >> type[i];\n for (int i = 1; i <= n; i++) {\n type[i]--;\n int x;\n cin >> x;\n outt[i] = x;\n while (x--) {\n int u;\n cin >> u;\n vec[u].push_back(i);\n }\n }\n for (int i = 1; i <= n; i++)\n if (outt[i] == 0) q[type[i]].push(i);\n int start = 0;\n for (int i = 0; i < 3; i++) qq[i] = q[i];\n for (int i = 1; i <= n; i++) toutt[i] = outt[i];\n int ans = 1e9;\n for (int i = 0; i < 3; i++) {\n if (qq[i].empty() == true) continue;\n for (int j = 0; j < 3; j++) q[j] = qq[j];\n for (int j = 1; j <= n; j++) outt[j] = toutt[j];\n start = i;\n int total = 0;\n while (!q[0].empty() || !q[1].empty() || !q[2].empty()) {\n while (!q[start].empty()) {\n int pos = q[start].front();\n q[start].pop();\n for (int i = 0; i < vec[pos].size(); i++) {\n int nx = vec[pos][i];\n outt[nx]--;\n if (outt[nx] == 0) q[type[nx]].push(nx);\n }\n total++;\n }\n start = (start + 1) % 3;\n total++;\n }\n ans = min(ans, total - 1);\n }\n cout << ans << '\\n';\n return 0;\n}","item":{"problem_id":"213A","pseudocode":"function desperate_optimization (get precision as int)\n use normal notation\n show decimal point\n set precision digits\nend of the block\nvec=vector of 250 int\nq=array of 3 queue of int\nqq=array of 3 queue of int\ntype=array of 250 int\noutt = array of 250 int\ntoutt = array of 250 int\ndefine the main function\n desperate_optimization(20)\n n=int\n read n\n for i=1 to n inclusive read type[i]\n for i=1 to n inclusive\n decrement type[i]\n x=int\n read x\n outt[i] = x\n while decremented x > 0\n u=int\n read u\n add i to end of vec[u]\n end of the block\n end of the block\n for i=1 to n inclusive\n if outt[i] is 0 push i into q[type[i]]\n start=0\n for i=0 to 3 exclusive qq[i]=q[i]\n for i=1 to n inclusive toutt[i]=outt[i]\n ans=1000000000\n for i=0 to 3 exclusive\n if qq[i] is empty continue\n for j=0 to 3 exclusive q[j]=qq[j]\n for j=1 to n inclusive outt[j]=toutt[j]\n start=i\n total=0\n while q[0], q[1] and q[2] are not empty\n while q[start] is not empty\n pos=first item of q[start]\n pop q[start]\n for i=0 to size of vec[pos] exclusive\n nx=vec[pos][i]\n decrement outt[nx]\n if outt[nx] is 0 push nx into q[type[nx]]\n end of the block\n increment total\n end of the block\n start=(start+1) modulo 3\n increment total\n end of the block\n ans=min(ans, total-1)\n end of the block\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["1","1","0"],["1"]],[["5","2 2 1 1 3","1 5","2 5 1","2 5 4","1 5","0"],["7"]],[["7","1 3 3 1 2 1 1","0","1 1","1 1","2 1 6","3 1 2 7","1 1","1 1"],["11"]],[["2","2 1","0","1 1"],["4"]],[["3","2 1 2","0","0","0"],["4"]],[["4","2 1 1 1","0","0","1 1","1 3"],["6"]],[["6","1 1 2 3 3 1","2 2 3","0","0","0","2 2 1","1 1"],["10"]],[["8","2 2 2 1 1 2 1 1","3 5 6 7","1 5","2 5 6","1 5","0","1 5","1 5","2 5 6"],["11"]],[["9","3 3 2 1 3 1 2 2 1","2 4 3","0","2 4 2","0","1 4","2 4 2","0","1 4","3 4 3 8"],["13"]],[["10","3 1 2 2 2 1 2 1 1 1","0","2 6 9","0","1 9","0","1 3","4 3 6 5 2","3 6 4 2","0","1 3"],["14"]],[["11","1 2 2 3 3 2 2 2 2 3 1","1 4","2 7 11","0","0","1 2","1 11","0","1 2","3 7 11 2","3 3 2 9","0"],["14"]],[["12","1 3 2 2 1 3 2 1 3 2 2 2","2 3 4","3 12 11 10","1 8","2 8 7","2 9 10","1 3","0","0","1 4","4 3 1 12 9","3 8 3 4","1 4"],["18"]],[["13","3 3 2 2 1 3 1 1 1 1 2 1 2","5 6 3 11 13 12","1 6","2 10 6","3 6 3 11","1 6","1 10","3 6 2 3","4 6 3 9 11","3 6 2 3","0","3 6 2 3","4 6 3 4 13","2 6 3"],["21"]],[["14","3 2 2 1 2 1 1 3 1 2 2 3 1 1","2 9 13","3 9 13 8","2 9 6","3 9 6 13","1 9","1 9","3 9 6 13","2 9 13","0","4 9 3 13 4","4 9 6 13 2","2 9 13","1 9","8 9 5 6 3 13 7 4 11"],["20"]],[["15","1 2 3 2 3 2 2 2 3 3 3 2 3 1 3","5 2 7 4 3 6","0","2 7 4","2 2 15","1 7","1 7","0","2 4 6","1 6","2 15 3","4 12 2 15 7","0","3 2 5 6","3 2 4 6","1 2"],["20"]],[["16","3 3 1 3 2 3 2 2 3 1 2 3 2 2 2 3","1 14","4 14 10 13 6","3 14 15 6","1 14","4 14 10 9 7","4 14 10 13 9","4 14 10 13 6","4 14 4 12 3","2 14 4","1 14","1 14","2 14 1","4 14 10 4 1","0","2 14 10","1 14"],["22"]],[["17","3 2 3 2 2 2 1 3 3 3 3 2 3 3 3 1 1","0","0","2 8 10","4 12 8 6 16","0","2 8 13","3 2 8 10","1 12","4 8 17 3 16","2 2 8","0","1 2","2 8 10","2 12 8","2 8 10","1 8","2 12 8"],["21"]],[["18","2 1 1 3 2 1 3 2 3 3 2 2 1 1 3 1 1 3","3 16 8 6","3 16 6 1","4 6 13 5 7","2 6 2","4 16 6 17 1","2 16 8","3 6 17 12","1 16","0","3 6 15 1","3 16 6 12","7 16 9 8 6 13 17 14","1 6","1 6","3 8 6 13","0","1 6","3 9 6 13"],["26"]],[["19","2 1 2 3 3 3 2 1 1 1 1 3 3 1 1 1 2 2 3","0","2 1 7","0","4 3 2 17 13","1 17","1 3","3 1 3 6","4 1 17 9 13","3 1 16 17","0","3 3 6 17","1 6","6 10 6 7 17 9 11","3 10 17 13","4 3 17 13 8","1 3","3 6 7 16","0","6 1 7 17 11 13 15"],["29"]],[["20","1 2 2 2 1 3 3 2 2 1 2 2 3 1 2 2 2 1 1 1","2 10 8","5 10 12 3 20 7","0","3 10 15 3","0","3 14 17 3","2 12 20","0","3 17 10 12","1 17","1 5","1 5","0","1 18","3 18 5 12","5 5 12 8 3 19","0","0","1 12","1 18"],["24"]],[["11","3 1 3 2 3 2 3 2 3 1 3","6 2 3 9 5 7 10","1 6","2 6 2","5 6 2 3 9 5","2 3 9","0","5 3 9 5 8 4","4 2 3 9 5","2 2 3","8 6 2 3 9 5 4 11 7","4 2 3 9 5"],["21"]],[["12","2 3 3 1 1 3 2 2 3 1 3 3","1 9","1 1","2 2 11","5 1 2 11 5 8","4 9 10 1 11","5 9 10 12 11 5","4 1 12 11 5","5 10 1 2 12 11","0","1 9","1 12","0"],["19"]],[["13","3 2 2 1 3 3 2 3 2 2 1 2 3","7 4 3 2 5 9 8 13","1 4","1 4","0","3 4 2 6","2 4 2","4 4 3 2 9","5 4 2 6 9 7","3 4 2 6","6 4 3 2 5 9 7","6 4 3 2 6 9 7","8 4 2 6 5 9 8 11 10","7 4 3 2 6 9 8 11"],["21"]],[["14","2 3 1 3 1 1 1 2 2 3 1 1 3 1","4 14 9 8 5","4 4 8 5 1","9 4 14 9 8 1 2 13 7 12","0","2 14 8","2 4 14","7 9 6 10 8 1 2 13","2 4 6","1 14","1 9","8 4 6 10 8 5 1 2 3","7 14 6 10 8 1 2 7","5 10 8 5 1 2","0"],["21"]],[["15","3 2 2 2 1 1 2 1 1 2 2 3 3 3 2","1 13","4 13 1 8 14","10 5 13 1 8 14 4 2 11 15 10","6 5 13 1 8 9 14","0","11 5 13 1 8 14 4 2 11 10 3 12","11 13 1 8 14 4 2 11 15 10 3 6","2 13 1","4 5 13 1 8","8 5 13 1 8 14 2 11 15","6 5 13 1 8 14 2","10 5 13 1 8 14 2 11 15 10 3","0","4 13 1 8 9","8 5 13 1 8 9 14 2 11"],["23"]],[["16","3 1 2 3 3 2 3 1 3 2 2 1 2 2 1 2","0","0","7 2 8 4 12 5 9 11","1 1","4 1 8 4 12","5 2 4 12 5 11","4 4 12 5 10","0","5 1 8 4 12 5","6 1 4 12 5 9 11","6 2 1 8 4 12 5","2 4 13","3 1 8 4","8 1 4 13 12 5 10 3 6","4 4 12 5 6","8 8 4 13 12 5 9 6 14"],["26"]],[["17","2 3 1 3 3 3 1 1 1 2 2 2 3 2 3 3 2","5 4 14 2 11 7","3 13 4 14","7 6 4 14 2 1 10 12","2 6 13","9 4 2 9 8 7 17 1 10 12","0","5 4 14 2 9 11","4 13 4 2 11","4 13 4 14 2","7 13 4 2 11 8 7 1","4 13 4 14 2","8 6 4 2 8 7 17 1 10","0","1 4","7 13 4 14 2 9 8 7","6 4 2 17 1 10 12","5 13 4 2 9 8"],["27"]],[["18","1 2 3 3 2 2 1 1 3 1 2 3 2 3 1 2 2 3","5 9 3 14 12 2","7 9 4 3 14 16 7 12","1 9","1 9","6 9 14 12 1 6 15","6 9 14 12 2 1 11","2 9 14","7 9 14 7 12 2 1 6","0","6 9 18 14 7 1 6","4 9 14 7 1","2 9 14","6 9 3 14 7 1 6","2 9 3","9 9 3 14 16 12 2 1 6 17","4 9 4 18 14","8 9 18 14 12 1 11 6 13","2 9 4"],["26"]],[["19","2 3 3 2 3 1 3 1 2 2 2 1 1 1 2 2 1 3 3","0","3 1 10 6","8 1 6 2 17 18 12 15 7","5 6 2 9 17 18","6 6 2 17 18 12 16","1 11","9 1 11 6 2 17 18 4 12 15","3 1 6 2","4 1 6 2 8","0","1 1","5 1 6 2 17 18","12 1 10 6 2 8 17 18 4 12 15 7 3","10 11 6 2 17 18 4 12 16 15 7","8 1 6 2 8 17 18 12 16","8 11 6 2 9 17 18 4 12","3 11 6 2","5 10 6 2 9 17","10 1 6 2 17 18 12 5 15 7 3"],["30"]],[["20","2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1","1 7","13 7 1 11 4 6 16 20 12 5 18 19 15 10","8 7 1 11 4 6 17 8 16","3 7 1 11","9 7 1 11 4 6 8 20 12 3","4 7 1 11 4","0","6 7 1 11 4 6 17","4 7 1 11 4","7 7 1 11 4 6 17 5","2 7 1","9 7 1 11 4 6 17 8 14 20","11 7 1 11 4 6 20 3 5 15 10 2","5 7 1 11 4 6","9 7 1 11 4 6 8 16 14 5","5 7 1 11 4 6","5 7 1 11 4 6","11 7 1 11 4 9 6 17 8 20 3 5","11 7 1 11 4 6 17 16 20 12 5 18","6 7 1 11 4 6 14"],["35"]],[["21","1 2 1 3 3 3 1 1 2 2 3 1 3 1 3 3 1 1 1 2 2","1 5","0","1 11","0","0","0","1 8","0","1 11","1 1","1 19","0","1 2","0","0","0","0","1 19","0","0","0"],["25"]],[["22","2 3 2 3 3 2 1 2 3 3 1 3 1 1 2 2 3 3 1 3 2 2","0","1 8","1 22","1 12","0","1 14","0","0","0","2 22 14","1 12","0","0","0","0","0","0","0","0","1 16","1 13","0"],["25"]],[["23","3 1 3 3 2 2 2 1 3 2 3 1 1 1 1 2 3 1 2 1 3 1 1","0","1 11","1 11","2 11 16","1 2","3 11 1 12","2 11 16","2 12 2","1 13","2 12 2","0","0","0","2 13 11","0","1 11","2 12 2","3 16 6 21","1 11","0","0","2 11 12","0"],["27"]],[["24","1 2 1 1 2 2 1 1 3 2 3 1 3 2 3 3 1 1 3 2 3 2 1 2","1 16","0","0","1 2","0","0","0","0","1 2","0","0","0","0","0","0","0","2 12 24","0","0","1 11","0","0","0","0"],["27"]],[["25","3 3 1 1 1 2 2 2 3 1 2 3 2 1 2 2 2 3 2 1 2 3 2 1 1","0","0","0","0","0","0","1 12","0","1 19","0","2 12 21","2 3 10","0","1 21","0","1 9","1 3","0","0","2 3 2","0","1 12","0","1 3","2 21 9"],["29"]],[["26","1 2 2 1 1 2 1 1 2 1 3 1 3 1 2 3 3 3 2 1 2 1 3 3 2 2","1 9","1 1","0","0","0","0","0","0","0","0","0","1 5","0","2 15 12","1 8","0","0","0","0","2 3 26","0","0","0","1 22","0","1 8"],["30"]],[["27","2 1 1 3 2 1 1 2 3 1 1 2 2 2 1 2 1 1 3 3 3 1 1 1 3 1 1","0","0","0","1 12","0","0","0","0","0","0","1 26","0","0","0","0","1 27","0","0","0","0","0","0","1 5","0","2 20 27","1 18","0"],["30"]],[["28","2 1 1 3 2 3 2 2 1 3 2 3 3 2 3 1 2 2 3 3 3 3 1 3 2 1 3 3","0","1 7","0","2 28 18","1 28","0","0","0","0","0","0","2 10 18","3 8 10 18","0","2 1 20","0","1 18","1 27","2 27 18","0","0","1 28","0","0","0","0","1 28","1 9"],["33"]],[["29","3 3 3 3 3 1 1 1 3 2 2 1 1 3 1 1 1 2 1 2 3 1 1 2 1 3 1 2 3","0","0","0","0","0","1 1","0","0","2 28 15","0","0","0","2 24 23","1 28","0","1 28","1 20","0","0","0","0","1 28","0","0","2 23 16","0","0","1 7","1 28"],["32"]],[["30","1 3 3 3 2 3 1 3 3 3 3 2 3 1 3 2 1 1 1 1 2 3 2 1 1 3 3 2 2 2","0","1 20","0","1 7","2 6 9","1 20","1 20","3 7 6 9","2 10 6","0","0","2 6 9","0","0","1 20","2 6 9","2 6 9","0","2 6 9","0","2 6 9","3 27 6 9","2 6 9","2 6 9","0","0","0","2 6 9","3 6 9 19","3 27 6 9"],["34"]],[["4","1 1 2 3","1 2","1 3","0","1 1"],["8"]]]}} +{"instance_id":"pseudo_to_code_2k_103","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n n,m,a=int\n read n\n c and n = array of n+1 int, filled with 0\n g=array of n+2 vector of int\n cc=array of 5 vector of int\n for i=0 to n exclusive\n read c[i]\n decrement c[i]\n add i to end of cc[c[i]]\n end of the block\n for i=0 to n exclusive\n read m\n while decremented value of m is not 0\n read a\n add i to end of g[a-1]\n increment d[i]\n end of the block\n end of the block\n mx=INT_MAX\n for k=0 to n exclusive\n if d[k] is 0\n dp=array of n+1 int\n for i=0 to n exclusive dp[i]=d[i]\n p=c[k], ok=0, an=n\n while true\n if ok is n break\n for i=0 to size of cc[p] exclusive\n if d[cc[p][i]] is 0\n decrement d[cc[p][i]]\n increment ok\n for j=0 to size of g[cc[p][i]] exclusive\n u=g[cc[p][i]][j]\n decrement d[u]\n end of the block\n i=-1\n end of the block\n end of the block\n if ok and ok> n;\n int c[n + 1], d[n + 1] = {0};\n vector g[n + 2];\n vector cc[5];\n for (int i = 0; i < n; i++) {\n cin >> c[i];\n c[i]--;\n cc[c[i]].push_back(i);\n }\n for (int i = 0; i < n; i++) {\n cin >> m;\n while (m--) {\n cin >> a;\n g[a - 1].push_back(i);\n d[i]++;\n }\n }\n int mx = INT_MAX;\n for (int k = 0; k < n; k++)\n if (d[k] == 0) {\n int dp[n + 1];\n for (int i = 0; i < n; i++) dp[i] = d[i];\n int p = c[k], ok = 0, an = n;\n while (1) {\n if (ok == n) break;\n for (int i = 0; i < cc[p].size(); i++) {\n if (d[cc[p][i]] == 0) {\n d[cc[p][i]]--;\n ok++;\n for (int j = 0; j < g[cc[p][i]].size(); j++) {\n int u = g[cc[p][i]][j];\n d[u]--;\n }\n i = -1;\n }\n }\n if (ok && ok < n) an++;\n p = (p + 1) % 3;\n }\n for (int i = 0; i < n; i++) d[i] = dp[i];\n mx = min(mx, an);\n }\n cout << mx << endl;\n}","item":{"problem_id":"213A","pseudocode":"define the main function\n n,m,a=int\n read n\n c and n = array of n+1 int, filled with 0\n g=array of n+2 vector of int\n cc=array of 5 vector of int\n for i=0 to n exclusive\n read c[i]\n decrement c[i]\n add i to end of cc[c[i]]\n end of the block\n for i=0 to n exclusive\n read m\n while decremented value of m is not 0\n read a\n add i to end of g[a-1]\n increment d[i]\n end of the block\n end of the block\n mx=INT_MAX\n for k=0 to n exclusive\n if d[k] is 0\n dp=array of n+1 int\n for i=0 to n exclusive dp[i]=d[i]\n p=c[k], ok=0, an=n\n while true\n if ok is n break\n for i=0 to size of cc[p] exclusive\n if d[cc[p][i]] is 0\n decrement d[cc[p][i]]\n increment ok\n for j=0 to size of g[cc[p][i]] exclusive\n u=g[cc[p][i]][j]\n decrement d[u]\n end of the block\n i=-1\n end of the block\n end of the block\n if ok and ok\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\na = integer array of length 110\nb = integer array of length 110\ndefine the main function\n s = string\n read one line into s\n num, ten = integers with num value of 0 and ten value of 1\n for i = size of s-1 to 0 inclusive descending\n if s[i] equals = then break\n if s[i] is less than '9' and greater than '0'\n x = integer with value of s[i] - '0'\n increase num by x*ten\n set ten to ten * 10\n end of the block\n end of the block\n cnt = integer with value of 0\n set a[0] to 1\n for i = 0 to size of s exclusive\n if s[i] equals '+'\n increase cnt by 1 and set a[cnt] to 1\n else if s[i] equals '-'\n increase cnt by 1 and set a[cnt] to 0\n end of the block\n end of the block\n x = integer with value of 0\n for i =0 to cnt inclusive\n set b[i] to 1\n if a[i]\n increase x by b[i]\n else\n decrease x by b[i]\n end of the block\n set x to num - x\n for i = 0 to cnt inclusive\n if x is less than 0\n if a[i] equals 0 and b[i] is less than num\n k = integer with value of the minimum of num-b[i] and negative x\n increase b[i] by k\n increase x by k\n end of the block\n else if x is greater than 0\n if a[i] equals 1 and b[i] is less than num\n k = integer with value of the minimum of num-b[i] and x\n increase b[i] by k\n decrease x by b[i]\n end of the block\n else\n break\n end of the block\n set x to 0\n for i = 0 to count inclusive\n if a[i]\n increase x by b[i]\n else\n decrease x by b[i]\n end of the block\n if x does not equal num\n print Impossible\n return to indicate successful execution\n end of the block\n print Possible\n set cnt to 0\n for i = 0 to size of s exclusive\n if s[i] equals '+' or '-' or '=' print b[cnt] space s[i] space then increase cnt by 1\n end of the block\n print num\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int a[110];\nint b[110];\nint main() {\n string s;\n getline(cin, s);\n int num = 0, ten = 1;\n for (int i = s.size() - 1; i >= 0; i--) {\n if (s[i] == '=') break;\n if (s[i] <= '9' && s[i] >= '0') {\n int x = s[i] - '0';\n num += x * ten;\n ten *= 10;\n }\n }\n int cnt = 0;\n a[0] = 1;\n for (int i = 0; i < s.size(); i++) {\n if (s[i] == '+') {\n a[++cnt] = 1;\n } else if (s[i] == '-') {\n a[++cnt] = 0;\n }\n }\n int x = 0;\n for (int i = 0; i <= cnt; i++) {\n b[i] = 1;\n if (a[i])\n x += b[i];\n else\n x -= b[i];\n }\n x = num - x;\n for (int i = 0; i <= cnt; i++) {\n if (x < 0) {\n if (a[i] == 0 && b[i] < num) {\n int k = min(num - b[i], -x);\n b[i] += k;\n x += k;\n }\n } else if (x > 0) {\n if (a[i] == 1 && b[i] < num) {\n int k = min(num - b[i], x);\n b[i] += k;\n x -= k;\n }\n } else\n break;\n }\n x = 0;\n for (int i = 0; i <= cnt; i++) {\n if (a[i])\n x += b[i];\n else\n x -= b[i];\n }\n if (x != num) {\n cout << \"Impossible\" << endl;\n return 0;\n }\n cout << \"Possible\" << endl;\n cnt = 0;\n for (int i = 0; i < s.size(); i++) {\n if (s[i] == '+' || s[i] == '-' || s[i] == '=') { cout << b[cnt++] << \" \" << s[i] << \" \"; }\n }\n cout << num << endl;\n return 0;\n}","item":{"problem_id":"663A","pseudocode":"a = integer array of length 110\nb = integer array of length 110\ndefine the main function\n s = string\n read one line into s\n num, ten = integers with num value of 0 and ten value of 1\n for i = size of s-1 to 0 inclusive descending\n if s[i] equals = then break\n if s[i] is less than '9' and greater than '0'\n x = integer with value of s[i] - '0'\n increase num by x*ten\n set ten to ten * 10\n end of the block\n end of the block\n cnt = integer with value of 0\n set a[0] to 1\n for i = 0 to size of s exclusive\n if s[i] equals '+'\n increase cnt by 1 and set a[cnt] to 1\n else if s[i] equals '-'\n increase cnt by 1 and set a[cnt] to 0\n end of the block\n end of the block\n x = integer with value of 0\n for i =0 to cnt inclusive\n set b[i] to 1\n if a[i]\n increase x by b[i]\n else\n decrease x by b[i]\n end of the block\n set x to num - x\n for i = 0 to cnt inclusive\n if x is less than 0\n if a[i] equals 0 and b[i] is less than num\n k = integer with value of the minimum of num-b[i] and negative x\n increase b[i] by k\n increase x by k\n end of the block\n else if x is greater than 0\n if a[i] equals 1 and b[i] is less than num\n k = integer with value of the minimum of num-b[i] and x\n increase b[i] by k\n decrease x by b[i]\n end of the block\n else\n break\n end of the block\n set x to 0\n for i = 0 to count inclusive\n if a[i]\n increase x by b[i]\n else\n decrease x by b[i]\n end of the block\n if x does not equal num\n print Impossible\n return to indicate successful execution\n end of the block\n print Possible\n set cnt to 0\n for i = 0 to size of s exclusive\n if s[i] equals '+' or '-' or '=' print b[cnt] space s[i] space then increase cnt by 1\n end of the block\n print num\n return to indicate successful execution\nend of the block","testcases":[[["? + ? - ? + ? + ? = 42"],["Possible","40 + 1 - 1 + 1 + 1 = 42"]],[["? - ? = 1"],["Impossible"]],[["? = 1000000"],["Possible","1000000 = 1000000"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 9"],["Impossible"]],[["? - ? + ? + ? + ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? - ? + ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? + ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? + ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? = 123456"],["Possible","123456 - 1 + 2 + 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 = 123456"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 93"],["Impossible"]],[["? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 57"],["Possible","57 - 1 + 18 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 57"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 32"],["Possible","32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 32"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 31"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? - ? - ? = 4"],["Impossible"]],[["? + ? - ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? = 5"],["Possible","5 + 5 - 1 - 1 - 1 + 5 + 5 - 1 + 5 + 5 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 + 2 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 5"]],[["? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? - ? - ? + ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? = 3"],["Impossible"]],[["? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? - ? - ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? - ? + ? + ? + ? = 4"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 - 4 + 1 + 1 + 1 = 4"]],[["? + ? - ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? = 4"],["Possible","1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 3 - 1 + 1 + 1 = 4"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 100"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 100"]],[["? + ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? - ? - ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? + ? - ? - ? - ? - ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? = 837454"],["Possible","837454 + 28 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 = 837454"]],[["? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? - ? + ? - ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? - ? - ? + ? - ? - ? - ? + ? = 254253"],["Possible","254253 - 1 + 2 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 = 254253"]],[["? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? - ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? - ? - ? + ? = 1000000"],["Possible","999963 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 = 1000000"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 43386"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? = 999999"],["Possible","999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 98 - 1 - 1 = 999999"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 37"],["Possible","37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 + 20 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 37"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 19"],["Possible","19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 + 11 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 19"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 15"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 - 14 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 15"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 33"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 33 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 33"]],[["? + ? + ? + ? + ? - ? = 3"],["Possible","1 + 1 + 1 + 1 + 1 - 2 = 3"]],[["? + ? + ? + ? - ? = 2"],["Possible","1 + 1 + 1 + 1 - 2 = 2"]],[["? + ? - ? + ? + ? = 2"],["Possible","1 + 1 - 2 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? - ? - ? = 2"],["Possible","1 + 1 + 1 + 1 + 1 - 2 - 1 = 2"]],[["? + ? - ? = 1"],["Possible","1 + 1 - 1 = 1"]],[["? - ? + ? - ? + ? + ? + ? + ? = 2"],["Possible","1 - 2 + 1 - 2 + 1 + 1 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? = 5"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 5 = 5"]]]}} +{"instance_id":"pseudo_to_code_2k_105","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet c be a character array of size 1000\nlet res be an integer array of size 1000\nlet l, mn, pl, n be integers with pl = 1\ndefine the main function\n ch = character\n input ch\n while input ch\n if ch is the character =, break\n set c[l] to ch\n if c[l] is the character +\n increment pl\n else\n increment mn\n increment l\n input ch\n end of the block\n input n\n if n * pl - nm is less than n or pl - n * mn is greater than n\n print Impossible\n else\n print Possible\n for i = 0 to 1 inclusive, set res[i] to 1\n d is an integer with d = n - (pl - mn)\n for i = 0 to 1 inclusive\n if (i equals 0 or c[i - 1] equals the character +) and d is greater than 0\n if d is less than n - res[i]\n add d to res[i]\n set d to 0\n else\n subtract n - res[i] from d\n res[i] is assigned n\n end of the block\n else if i isn't 0 and c[i - 1] equals the character - and d is less than 0\n if -d is less than n - res[i]\n add -d to res[i]\n set d to 0\n else\n add n - res[i] to d\n set res[i] to n\n end of the block\n end of the block\n end of the block\n output res[0]\n for i = 0 to 1 exclusive, output the character space, c[i] the character space, and res[i + 1]\n output the string \" = \" and n\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"char c[1000];\nint res[1000];\nint l, mn, pl = 1, n;\nint main() {\n char ch;\n cin >> ch;\n while (cin >> ch) {\n if (ch == '=') break;\n c[l] = ch;\n if (c[l] == '+')\n pl++;\n else\n mn++;\n l++;\n cin >> ch;\n }\n cin >> n;\n if (n * pl - mn < n || pl - n * mn > n)\n cout << \"Impossible\" << endl;\n else {\n cout << \"Possible\" << endl;\n for (int i = 0; i <= l; i++) res[i] = 1;\n int d = n - (pl - mn);\n for (int i = 0; i <= l; i++) {\n if ((i == 0 || c[i - 1] == '+') && d > 0) {\n if (d < n - res[i]) {\n res[i] += d;\n d = 0;\n } else {\n d -= n - res[i];\n res[i] = n;\n }\n } else if (i != 0 && c[i - 1] == '-' && d < 0) {\n if (-d < n - res[i]) {\n res[i] += -d;\n d = 0;\n } else {\n d += n - res[i];\n res[i] = n;\n }\n }\n }\n cout << res[0];\n for (int i = 0; i < l; i++) cout << \" \" << c[i] << \" \" << res[i + 1];\n cout << \" = \" << n << endl;\n }\n return 0;\n}","item":{"problem_id":"663A","pseudocode":"let c be a character array of size 1000\nlet res be an integer array of size 1000\nlet l, mn, pl, n be integers with pl = 1\ndefine the main function\n ch = character\n input ch\n while input ch\n if ch is the character =, break\n set c[l] to ch\n if c[l] is the character +\n increment pl\n else\n increment mn\n increment l\n input ch\n end of the block\n input n\n if n * pl - nm is less than n or pl - n * mn is greater than n\n print Impossible\n else\n print Possible\n for i = 0 to 1 inclusive, set res[i] to 1\n d is an integer with d = n - (pl - mn)\n for i = 0 to 1 inclusive\n if (i equals 0 or c[i - 1] equals the character +) and d is greater than 0\n if d is less than n - res[i]\n add d to res[i]\n set d to 0\n else\n subtract n - res[i] from d\n res[i] is assigned n\n end of the block\n else if i isn't 0 and c[i - 1] equals the character - and d is less than 0\n if -d is less than n - res[i]\n add -d to res[i]\n set d to 0\n else\n add n - res[i] to d\n set res[i] to n\n end of the block\n end of the block\n end of the block\n output res[0]\n for i = 0 to 1 exclusive, output the character space, c[i] the character space, and res[i + 1]\n output the string \" = \" and n\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["? + ? - ? + ? + ? = 42"],["Possible","40 + 1 - 1 + 1 + 1 = 42"]],[["? - ? = 1"],["Impossible"]],[["? = 1000000"],["Possible","1000000 = 1000000"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 9"],["Impossible"]],[["? - ? + ? + ? + ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? - ? + ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? + ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? + ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? = 123456"],["Possible","123456 - 1 + 2 + 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 = 123456"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 93"],["Impossible"]],[["? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 57"],["Possible","57 - 1 + 18 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 57"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 32"],["Possible","32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 32"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 31"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? - ? - ? = 4"],["Impossible"]],[["? + ? - ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? = 5"],["Possible","5 + 5 - 1 - 1 - 1 + 5 + 5 - 1 + 5 + 5 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 + 2 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 5"]],[["? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? - ? - ? + ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? = 3"],["Impossible"]],[["? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? - ? - ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? - ? + ? + ? + ? = 4"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 - 4 + 1 + 1 + 1 = 4"]],[["? + ? - ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? = 4"],["Possible","1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 3 - 1 + 1 + 1 = 4"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 100"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 100"]],[["? + ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? - ? - ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? + ? - ? - ? - ? - ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? = 837454"],["Possible","837454 + 28 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 = 837454"]],[["? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? - ? + ? - ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? - ? - ? + ? - ? - ? - ? + ? = 254253"],["Possible","254253 - 1 + 2 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 = 254253"]],[["? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? - ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? - ? - ? + ? = 1000000"],["Possible","999963 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 = 1000000"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 43386"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? = 999999"],["Possible","999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 98 - 1 - 1 = 999999"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 37"],["Possible","37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 + 20 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 37"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 19"],["Possible","19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 + 11 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 19"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 15"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 - 14 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 15"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 33"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 33 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 33"]],[["? + ? + ? + ? + ? - ? = 3"],["Possible","1 + 1 + 1 + 1 + 1 - 2 = 3"]],[["? + ? + ? + ? - ? = 2"],["Possible","1 + 1 + 1 + 1 - 2 = 2"]],[["? + ? - ? + ? + ? = 2"],["Possible","1 + 1 - 2 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? - ? - ? = 2"],["Possible","1 + 1 + 1 + 1 + 1 - 2 - 1 = 2"]],[["? + ? - ? = 1"],["Possible","1 + 1 - 1 = 1"]],[["? - ? + ? - ? + ? + ? + ? + ? = 2"],["Possible","1 - 2 + 1 - 2 + 1 + 1 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? = 5"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 5 = 5"]]]}} +{"instance_id":"pseudo_to_code_2k_106","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\np, n, k, s = integer with p = 1, s = array of size 105\nc = character\ndefine the main function\n s[increment k] = 1\n while (read c and c is not =\n if c is +, increment p, s[increment k] = 1\n if c is -, decrement p, s[increment k] = -1\n end of the block\n read n\n for i = 0 to k exclusive\n if s[i] > 0\n while p < n and s[i] < n, increment s[i], increment p\n else\n while p > n and s[i] > -n, decrement s[i], decrement p\n end of the block\n if p is not n\n print Impossible\n return to indicate successful execution\n end of the block\n print Possible\n for i = 0 to k exclusive, (if i, (if s[i] < 0, print - else print +) else ), and print absolute of s[i]\n print = and n\nend of the block\n\n[CODE]:","reference_output":"int p = 1, n, k, s[105];\nchar c;\nint main() {\n s[k++] = 1;\n while (cin >> c && c != '=') {\n if (c == '+') p++, s[k++] = 1;\n if (c == '-') p--, s[k++] = -1;\n }\n cin >> n;\n for (int i = 0; i < k; i++) {\n if (s[i] > 0)\n while (p < n && s[i] < n) s[i]++, p++;\n else\n while (p > n && s[i] > -n) s[i]--, p--;\n }\n if (p != n) {\n cout << \"Impossible\" << endl;\n return 0;\n }\n cout << \"Possible\" << endl;\n for (int i = 0; i < k; i++) cout << (i ? (s[i] < 0 ? \"- \" : \"+ \") : \"\") << abs(s[i]) << \" \";\n cout << \"= \" << n << endl;\n}","item":{"problem_id":"663A","pseudocode":"p, n, k, s = integer with p = 1, s = array of size 105\nc = character\ndefine the main function\n s[increment k] = 1\n while (read c and c is not =\n if c is +, increment p, s[increment k] = 1\n if c is -, decrement p, s[increment k] = -1\n end of the block\n read n\n for i = 0 to k exclusive\n if s[i] > 0\n while p < n and s[i] < n, increment s[i], increment p\n else\n while p > n and s[i] > -n, decrement s[i], decrement p\n end of the block\n if p is not n\n print Impossible\n return to indicate successful execution\n end of the block\n print Possible\n for i = 0 to k exclusive, (if i, (if s[i] < 0, print - else print +) else ), and print absolute of s[i]\n print = and n\nend of the block","testcases":[[["? + ? - ? + ? + ? = 42"],["Possible","40 + 1 - 1 + 1 + 1 = 42"]],[["? - ? = 1"],["Impossible"]],[["? = 1000000"],["Possible","1000000 = 1000000"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 9"],["Impossible"]],[["? - ? + ? + ? + ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? - ? + ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? + ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? + ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? = 123456"],["Possible","123456 - 1 + 2 + 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 = 123456"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 93"],["Impossible"]],[["? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 57"],["Possible","57 - 1 + 18 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 57"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 32"],["Possible","32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 32"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 31"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? - ? - ? = 4"],["Impossible"]],[["? + ? - ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? = 5"],["Possible","5 + 5 - 1 - 1 - 1 + 5 + 5 - 1 + 5 + 5 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 + 2 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 5"]],[["? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? - ? - ? + ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? = 3"],["Impossible"]],[["? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? - ? - ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? - ? + ? + ? + ? = 4"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 - 4 + 1 + 1 + 1 = 4"]],[["? + ? - ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? = 4"],["Possible","1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 3 - 1 + 1 + 1 = 4"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 100"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 100"]],[["? + ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? - ? - ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? + ? - ? - ? - ? - ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? = 837454"],["Possible","837454 + 28 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 = 837454"]],[["? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? - ? + ? - ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? - ? - ? + ? - ? - ? - ? + ? = 254253"],["Possible","254253 - 1 + 2 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 = 254253"]],[["? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? - ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? - ? - ? + ? = 1000000"],["Possible","999963 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 = 1000000"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 43386"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? = 999999"],["Possible","999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 98 - 1 - 1 = 999999"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 37"],["Possible","37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 + 20 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 37"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 19"],["Possible","19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 + 11 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 19"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 15"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 - 14 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 15"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 33"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 33 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 33"]],[["? + ? + ? + ? + ? - ? = 3"],["Possible","1 + 1 + 1 + 1 + 1 - 2 = 3"]],[["? + ? + ? + ? - ? = 2"],["Possible","1 + 1 + 1 + 1 - 2 = 2"]],[["? + ? - ? + ? + ? = 2"],["Possible","1 + 1 - 2 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? - ? - ? = 2"],["Possible","1 + 1 + 1 + 1 + 1 - 2 - 1 = 2"]],[["? + ? - ? = 1"],["Possible","1 + 1 - 1 = 1"]],[["? - ? + ? - ? + ? + ? + ? + ? = 2"],["Possible","1 - 2 + 1 - 2 + 1 + 1 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? = 5"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 5 = 5"]]]}} +{"instance_id":"pseudo_to_code_2k_107","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare character array a with size 1204000\ndefine the main function\n loop when read input to a\n create int array A with 1204 elements\n declare integer ans = 0\n declare integer r = 0\n declare integer flag = 0\n declare integer p = 0\n for i from 0 to exclusive incrementing i\n if a[i] is '?'\n if flag is false\n change A[r] to 1\n increment r\n increment p\n end of the block\n if flag is true\n assign - 1 to A[r]\n increment r\n decrement p\n end of the block\n end of the block\n if a[i] is '-', change flag to 1\n if a[i] is '+', change flag to 0\n if a[i] >= '0' and a[i] <= '9', change n to n * 10 + a[i] - '0'\n end of the block\n loop i from 0 to r exclusive incrementing i\n if A[i] is less than 0\n if p is greater than n\n looping infinitely\n if absolute value pf A[i] >= n or p = n, stop the loop\n decrement A[i]\n decrement p\n end of the block\n end of the block\n else if A[i] is greater than 0\n if p is less than n\n in the infinite loop\n if A[i] >= n or p = n, stop the loop\n increment A[i]\n increment p by one\n end of the block\n end of the block\n end of the block\n end of the block\n if p != n\n print \"Impossible\"\n else\n print \"Possible\"\n if A[0] is greater than 0\n print A[0]\n else\n print A[0]\n end of the block\n for i = 1 to r exclusive\n print \" \"\n if A[i] is greater than 0\n print \"+\"\n else\n print \"-\"\n end of the block\n print \" \" and absolute value of A[i]\n end of the block\n print \" = \" and n\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"char a[1204000] = {};\nint main() {\n while (gets(a)) {\n int A[1204] = {};\n int n = 0;\n int r = 0;\n int flag = 0;\n int p = 0;\n for (int i = 0; a[i]; i++) {\n if (a[i] == '?') {\n if (!flag) {\n A[r] = 1;\n r++;\n p++;\n }\n if (flag) {\n A[r] = -1;\n r++;\n p--;\n }\n }\n if (a[i] == '-') flag = 1;\n if (a[i] == '+') flag = 0;\n if (a[i] >= '0' && a[i] <= '9') { n = n * 10 + a[i] - '0'; }\n }\n for (int i = 0; i < r; i++) {\n if (A[i] < 0) {\n if (p > n) {\n while (1) {\n if (abs(A[i]) >= n || p == n) { break; }\n A[i]--;\n p--;\n }\n }\n } else if (A[i] > 0) {\n if (p < n) {\n while (1) {\n if ((A[i] >= n || p == n)) { break; }\n A[i]++;\n p++;\n }\n }\n }\n }\n if (p != n) {\n cout << \"Impossible\" << endl;\n } else {\n cout << \"Possible\" << endl;\n if (A[0] > 0) {\n cout << A[0];\n } else {\n cout << A[0];\n }\n for (int i = 1; i < r; i++) {\n cout << \" \";\n if (A[i] > 0) {\n cout << \"+\";\n } else {\n cout << \"-\";\n }\n cout << \" \" << abs(A[i]);\n }\n cout << \" = \" << n << endl;\n }\n }\n return 0;\n}","item":{"problem_id":"663A","pseudocode":"declare character array a with size 1204000\ndefine the main function\n loop when read input to a\n create int array A with 1204 elements\n declare integer ans = 0\n declare integer r = 0\n declare integer flag = 0\n declare integer p = 0\n for i from 0 to exclusive incrementing i\n if a[i] is '?'\n if flag is false\n change A[r] to 1\n increment r\n increment p\n end of the block\n if flag is true\n assign - 1 to A[r]\n increment r\n decrement p\n end of the block\n end of the block\n if a[i] is '-', change flag to 1\n if a[i] is '+', change flag to 0\n if a[i] >= '0' and a[i] <= '9', change n to n * 10 + a[i] - '0'\n end of the block\n loop i from 0 to r exclusive incrementing i\n if A[i] is less than 0\n if p is greater than n\n looping infinitely\n if absolute value pf A[i] >= n or p = n, stop the loop\n decrement A[i]\n decrement p\n end of the block\n end of the block\n else if A[i] is greater than 0\n if p is less than n\n in the infinite loop\n if A[i] >= n or p = n, stop the loop\n increment A[i]\n increment p by one\n end of the block\n end of the block\n end of the block\n end of the block\n if p != n\n print \"Impossible\"\n else\n print \"Possible\"\n if A[0] is greater than 0\n print A[0]\n else\n print A[0]\n end of the block\n for i = 1 to r exclusive\n print \" \"\n if A[i] is greater than 0\n print \"+\"\n else\n print \"-\"\n end of the block\n print \" \" and absolute value of A[i]\n end of the block\n print \" = \" and n\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["? + ? - ? + ? + ? = 42"],["Possible","40 + 1 - 1 + 1 + 1 = 42"]],[["? - ? = 1"],["Impossible"]],[["? = 1000000"],["Possible","1000000 = 1000000"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 9"],["Impossible"]],[["? - ? + ? + ? + ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? - ? + ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? + ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? + ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? = 123456"],["Possible","123456 - 1 + 2 + 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 = 123456"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 93"],["Impossible"]],[["? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 57"],["Possible","57 - 1 + 18 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 57"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 32"],["Possible","32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 32"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 31"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? - ? - ? = 4"],["Impossible"]],[["? + ? - ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? = 5"],["Possible","5 + 5 - 1 - 1 - 1 + 5 + 5 - 1 + 5 + 5 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 + 2 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 5"]],[["? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? - ? - ? + ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? = 3"],["Impossible"]],[["? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? - ? - ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? - ? + ? + ? + ? = 4"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 - 4 + 1 + 1 + 1 = 4"]],[["? + ? - ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? = 4"],["Possible","1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 3 - 1 + 1 + 1 = 4"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 100"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 100"]],[["? + ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? - ? - ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? + ? - ? - ? - ? - ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? = 837454"],["Possible","837454 + 28 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 = 837454"]],[["? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? - ? + ? - ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? - ? - ? + ? - ? - ? - ? + ? = 254253"],["Possible","254253 - 1 + 2 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 = 254253"]],[["? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? - ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? - ? - ? + ? = 1000000"],["Possible","999963 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 = 1000000"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 43386"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? = 999999"],["Possible","999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 98 - 1 - 1 = 999999"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 37"],["Possible","37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 + 20 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 37"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 19"],["Possible","19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 + 11 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 19"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 15"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 - 14 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 15"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 33"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 33 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 33"]],[["? + ? + ? + ? + ? - ? = 3"],["Possible","1 + 1 + 1 + 1 + 1 - 2 = 3"]],[["? + ? + ? + ? - ? = 2"],["Possible","1 + 1 + 1 + 1 - 2 = 2"]],[["? + ? - ? + ? + ? = 2"],["Possible","1 + 1 - 2 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? - ? - ? = 2"],["Possible","1 + 1 + 1 + 1 + 1 - 2 - 1 = 2"]],[["? + ? - ? = 1"],["Possible","1 + 1 - 1 = 1"]],[["? - ? + ? - ? + ? + ? + ? + ? = 2"],["Possible","1 - 2 + 1 - 2 + 1 + 1 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? = 5"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 5 = 5"]]]}} +{"instance_id":"pseudo_to_code_2k_108","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet c be a character array of size 1000\nlet res be an integer array of size 1000\nlet l, mn, pl, n be integers with pl = 1\ndefine the main function\n ch = character\n input ch\n while input ch\n if ch is the character =, break\n set c[l] to ch\n if c[l] is the character +\n increment pl\n else\n increment mn\n increment l\n input ch\n end of the block\n input n\n if n * pl - nm is less than n or pl - n * mn is greater than n\n print Impossible\n else\n print Possible\n for i = 0 to 1 inclusive, set res[i] to 1\n d is an integer with d = n - (pl - mn)\n for i = 0 to 1 inclusive\n if (i equals 0 or c[i - 1] equals the character +) and d is greater than 0\n if d is less than n - res[i]\n add d to res[i]\n set d to 0\n else\n subtract n - res[i] from d\n res[i] is assigned n\n end of the block\n else if i isn't 0 and c[i - 1] equals the character - and d is less than 0\n if -d is less than n - res[i]\n add -d to res[i]\n set d to 0\n else\n add n - res[i] to d\n set res[i] to n\n end of the block\n end of the block\n end of the block\n output res[0]\n for i = 0 to 1 exclusive, output the character space, c[i] the character space, and res[i + 1]\n output the string \" = \" and n\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"char c[1000];\nint res[1000];\nint l, mn, pl = 1, n;\nint main() {\n char ch;\n cin >> ch;\n while (cin >> ch) {\n if (ch == '=') break;\n c[l] = ch;\n if (c[l] == '+')\n pl++;\n else\n mn++;\n l++;\n cin >> ch;\n }\n cin >> n;\n if (n * pl - mn < n || pl - n * mn > n)\n cout << \"Impossible\" << endl;\n else {\n cout << \"Possible\" << endl;\n for (int i = 0; i <= l; i++) res[i] = 1;\n int d = n - (pl - mn);\n for (int i = 0; i <= l; i++) {\n if ((i == 0 || c[i - 1] == '+') && d > 0) {\n if (d < n - res[i]) {\n res[i] += d;\n d = 0;\n } else {\n d -= n - res[i];\n res[i] = n;\n }\n } else if (i != 0 && c[i - 1] == '-' && d < 0) {\n if (-d < n - res[i]) {\n res[i] += -d;\n d = 0;\n } else {\n d += n - res[i];\n res[i] = n;\n }\n }\n }\n cout << res[0];\n for (int i = 0; i < l; i++) cout << \" \" << c[i] << \" \" << res[i + 1];\n cout << \" = \" << n << endl;\n }\n return 0;\n}","item":{"problem_id":"663A","pseudocode":"let c be a character array of size 1000\nlet res be an integer array of size 1000\nlet l, mn, pl, n be integers with pl = 1\ndefine the main function\n ch = character\n input ch\n while input ch\n if ch is the character =, break\n set c[l] to ch\n if c[l] is the character +\n increment pl\n else\n increment mn\n increment l\n input ch\n end of the block\n input n\n if n * pl - nm is less than n or pl - n * mn is greater than n\n print Impossible\n else\n print Possible\n for i = 0 to 1 inclusive, set res[i] to 1\n d is an integer with d = n - (pl - mn)\n for i = 0 to 1 inclusive\n if (i equals 0 or c[i - 1] equals the character +) and d is greater than 0\n if d is less than n - res[i]\n add d to res[i]\n set d to 0\n else\n subtract n - res[i] from d\n res[i] is assigned n\n end of the block\n else if i isn't 0 and c[i - 1] equals the character - and d is less than 0\n if -d is less than n - res[i]\n add -d to res[i]\n set d to 0\n else\n add n - res[i] to d\n set res[i] to n\n end of the block\n end of the block\n end of the block\n output res[0]\n for i = 0 to 1 exclusive, output the character space, c[i] the character space, and res[i + 1]\n output the string \" = \" and n\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["? + ? - ? + ? + ? = 42"],["Possible","40 + 1 - 1 + 1 + 1 = 42"]],[["? - ? = 1"],["Impossible"]],[["? = 1000000"],["Possible","1000000 = 1000000"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 9"],["Impossible"]],[["? - ? + ? + ? + ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? - ? + ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? + ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? + ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? = 123456"],["Possible","123456 - 1 + 2 + 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 = 123456"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 93"],["Impossible"]],[["? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 57"],["Possible","57 - 1 + 18 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 57"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 32"],["Possible","32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 32"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 31"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? - ? - ? = 4"],["Impossible"]],[["? + ? - ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? = 5"],["Possible","5 + 5 - 1 - 1 - 1 + 5 + 5 - 1 + 5 + 5 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 + 2 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 5"]],[["? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? - ? - ? + ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? = 3"],["Impossible"]],[["? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? - ? - ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? - ? + ? + ? + ? = 4"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 - 4 + 1 + 1 + 1 = 4"]],[["? + ? - ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? = 4"],["Possible","1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 3 - 1 + 1 + 1 = 4"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 100"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 100"]],[["? + ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? - ? - ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? + ? - ? - ? - ? - ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? = 837454"],["Possible","837454 + 28 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 = 837454"]],[["? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? - ? + ? - ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? - ? - ? + ? - ? - ? - ? + ? = 254253"],["Possible","254253 - 1 + 2 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 = 254253"]],[["? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? - ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? - ? - ? + ? = 1000000"],["Possible","999963 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 = 1000000"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 43386"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? = 999999"],["Possible","999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 98 - 1 - 1 = 999999"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 37"],["Possible","37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 + 20 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 37"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 19"],["Possible","19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 + 11 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 19"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 15"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 - 14 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 15"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 33"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 33 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 33"]],[["? + ? + ? + ? + ? - ? = 3"],["Possible","1 + 1 + 1 + 1 + 1 - 2 = 3"]],[["? + ? + ? + ? - ? = 2"],["Possible","1 + 1 + 1 + 1 - 2 = 2"]],[["? + ? - ? + ? + ? = 2"],["Possible","1 + 1 - 2 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? - ? - ? = 2"],["Possible","1 + 1 + 1 + 1 + 1 - 2 - 1 = 2"]],[["? + ? - ? = 1"],["Possible","1 + 1 - 1 = 1"]],[["? - ? + ? - ? + ? + ? + ? + ? = 2"],["Possible","1 - 2 + 1 - 2 + 1 + 1 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? = 5"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 5 = 5"]]]}} +{"instance_id":"pseudo_to_code_2k_109","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n set int n, sum to 0\n create an integer vector v\n set character mark to value of +\n if mark is not equal to = then do the following\n if mark is + then do\n set the push_back value of v to 1\n add one to sum\n end of the block\n if mark is - then do\n set the push_back value of v to -1\n minus 1 from sum\n end of the block\n take input mark\n end of the block\n read n\n for i = 0 to less than or equal to v.size() - 1 do the following\n if sum is greater than n then do\n if v[i] is less than 0 then do\n if sum - n is less than or equal to n - 1 then do\n subtract sum - n from v[i]\n set sum to n\n break\n else\n subtract n - 1 from v[i]\n subtract n - 1 from sum\n end of the block\n end of the block\n else if the sum is less than n\n if v[i] is greater than 0 then do\n if n - sum is less than or equal to n - 1 then do\n v[i] equals v[i] plus n - sum\n set sum to n\n break\n else\n v[i] equals v[i] plus n - 1\n sum equals sum plus n - 1\n end of the block\n end of the block\n else\n break\n end of the block\n if sum is n then do\n output Possible\n output v[0]\n for i = 1 to less than or equal to v.size() - 1 do the following\n if v[i] is greater than 0 then do\n output +\n else\n output -\n output the absolute value of v[i]\n end of the block\n output = n\n else\n output Impossible\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int n, sum = 0;\n vector v;\n char mark = '+';\n while (mark != '=') {\n if (mark == '+') {\n v.push_back(1);\n sum++;\n }\n if (mark == '-') {\n v.push_back(-1);\n sum--;\n }\n cin >> mark;\n }\n cin >> n;\n for (int i = 0; i <= v.size() - 1; i++) {\n if (sum > n) {\n if (v[i] < 0) {\n if (sum - n <= n - 1) {\n v[i] -= sum - n;\n sum = n;\n break;\n } else {\n v[i] -= n - 1;\n sum -= n - 1;\n }\n }\n } else if (sum < n) {\n if (v[i] > 0) {\n if (n - sum <= n - 1) {\n v[i] += n - sum;\n sum = n;\n break;\n } else {\n v[i] += n - 1;\n sum += n - 1;\n }\n }\n } else\n break;\n }\n if (sum == n) {\n cout << \"Possible\" << endl;\n cout << v[0] << \" \";\n for (int i = 1; i <= v.size() - 1; i++) {\n if (v[i] > 0)\n cout << \"+ \";\n else\n cout << \"- \";\n cout << abs(v[i]) << \" \";\n }\n cout << \"= \" << n << endl;\n } else\n cout << \"Impossible\" << endl;\n return 0;\n}","item":{"problem_id":"663A","pseudocode":"define the main function\n set int n, sum to 0\n create an integer vector v\n set character mark to value of +\n if mark is not equal to = then do the following\n if mark is + then do\n set the push_back value of v to 1\n add one to sum\n end of the block\n if mark is - then do\n set the push_back value of v to -1\n minus 1 from sum\n end of the block\n take input mark\n end of the block\n read n\n for i = 0 to less than or equal to v.size() - 1 do the following\n if sum is greater than n then do\n if v[i] is less than 0 then do\n if sum - n is less than or equal to n - 1 then do\n subtract sum - n from v[i]\n set sum to n\n break\n else\n subtract n - 1 from v[i]\n subtract n - 1 from sum\n end of the block\n end of the block\n else if the sum is less than n\n if v[i] is greater than 0 then do\n if n - sum is less than or equal to n - 1 then do\n v[i] equals v[i] plus n - sum\n set sum to n\n break\n else\n v[i] equals v[i] plus n - 1\n sum equals sum plus n - 1\n end of the block\n end of the block\n else\n break\n end of the block\n if sum is n then do\n output Possible\n output v[0]\n for i = 1 to less than or equal to v.size() - 1 do the following\n if v[i] is greater than 0 then do\n output +\n else\n output -\n output the absolute value of v[i]\n end of the block\n output = n\n else\n output Impossible\n return to indicate successful execution\nend of the block","testcases":[[["? + ? - ? + ? + ? = 42"],["Possible","40 + 1 - 1 + 1 + 1 = 42"]],[["? - ? = 1"],["Impossible"]],[["? = 1000000"],["Possible","1000000 = 1000000"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 9"],["Impossible"]],[["? - ? + ? + ? + ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? - ? + ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? + ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? + ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? = 123456"],["Possible","123456 - 1 + 2 + 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 = 123456"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 93"],["Impossible"]],[["? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 57"],["Possible","57 - 1 + 18 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 57"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 32"],["Possible","32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 32"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 31"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? - ? - ? = 4"],["Impossible"]],[["? + ? - ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? = 5"],["Possible","5 + 5 - 1 - 1 - 1 + 5 + 5 - 1 + 5 + 5 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 + 2 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 5"]],[["? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? - ? - ? + ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? = 3"],["Impossible"]],[["? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? - ? - ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? - ? + ? + ? + ? = 4"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 - 4 + 1 + 1 + 1 = 4"]],[["? + ? - ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? = 4"],["Possible","1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 3 - 1 + 1 + 1 = 4"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 100"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 100"]],[["? + ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? - ? - ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? + ? - ? - ? - ? - ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? = 837454"],["Possible","837454 + 28 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 = 837454"]],[["? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? - ? + ? - ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? - ? - ? + ? - ? - ? - ? + ? = 254253"],["Possible","254253 - 1 + 2 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 = 254253"]],[["? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? - ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? - ? - ? + ? = 1000000"],["Possible","999963 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 = 1000000"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 43386"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? = 999999"],["Possible","999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 98 - 1 - 1 = 999999"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 37"],["Possible","37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 + 20 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 37"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 19"],["Possible","19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 + 11 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 19"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 15"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 - 14 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 15"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 33"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 33 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 33"]],[["? + ? + ? + ? + ? - ? = 3"],["Possible","1 + 1 + 1 + 1 + 1 - 2 = 3"]],[["? + ? + ? + ? - ? = 2"],["Possible","1 + 1 + 1 + 1 - 2 = 2"]],[["? + ? - ? + ? + ? = 2"],["Possible","1 + 1 - 2 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? - ? - ? = 2"],["Possible","1 + 1 + 1 + 1 + 1 - 2 - 1 = 2"]],[["? + ? - ? = 1"],["Possible","1 + 1 - 1 = 1"]],[["? - ? + ? - ? + ? + ? + ? + ? = 2"],["Possible","1 - 2 + 1 - 2 + 1 + 1 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? = 5"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 5 = 5"]]]}} +{"instance_id":"pseudo_to_code_2k_110","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmaxn = const int with maxn = 105\nnum = integer array of size maxn\ndefine the main function\n s = string\n read s\n n = integer\n l = integer with l = s.size()\n set all contents of num to 0\n zheng, fu = integer with zheng = 0, fu = 0\n zuida = int with zuida = 1\n pos = integer\n num[1] = 1\n increment zheng\n increment zuida\n for i = 1 to l\n if s[i] is +\n num[increment zuida] = 1\n increment zheng\n else if s[i] is -\n num[increment zuida] = -1\n increment fu\n else if s[i] is =\n pos = i\n break loop\n end of the block\n end of the block\n a = string with a = s.substr(pos + 2)\n ss = stringstream, call ss on a\n right shift ss n times\n flag = bool with flag = false\n for i = 1 to zuida exclusive\n if n is zheng - fu)\n flag = true\n break loop\n end of the block\n while n > zheng - fu and num[i] > 0 and num[i] < n\n increment zheng\n increment num[i]\n end of the block\n while (n < zheng - fu and num[i] < 0 and abs(num[i]) < n)\n increment fu\n decrement num[i]\n end of the block\n end of the block\n if n is zheng - fu, flag = true\n if flag\n print Possible\n print num[1]\n for i = 2 to zuida exclusive\n if num[i] < 0\n print - and -num[i]\n else\n print + and num[i]\n end of the block\n print =\n print n\n else\n print Impossible\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int maxn = 105;\nint num[maxn];\nint main() {\n string s;\n getline(cin, s);\n int n;\n int l = s.size();\n memset(num, 0, sizeof(num));\n int zheng = 0, fu = 0;\n int zuida = 1;\n int pos;\n num[1] = 1;\n ++zheng;\n ++zuida;\n for (int i = 1; i < l; i++) {\n if (s[i] == '+') {\n num[zuida++] = 1;\n ++zheng;\n } else if (s[i] == '-') {\n num[zuida++] = -1;\n ++fu;\n } else if (s[i] == '=') {\n pos = i;\n break;\n }\n }\n string a = s.substr(pos + 2);\n stringstream ss(a);\n ss >> n;\n bool flag = false;\n for (int i = 1; i < zuida; i++) {\n if (n == zheng - fu) {\n flag = true;\n break;\n }\n while (n > zheng - fu && num[i] > 0 && num[i] < n) {\n ++zheng;\n ++num[i];\n }\n while (n < zheng - fu && num[i] < 0 && abs(num[i]) < n) {\n ++fu;\n --num[i];\n }\n }\n if (n == zheng - fu) flag = true;\n if (flag) {\n cout << \"Possible\" << endl;\n cout << num[1];\n for (int i = 2; i < zuida; i++) {\n if (num[i] < 0)\n cout << \" - \" << -num[i];\n else\n cout << \" + \" << num[i];\n }\n cout << \" = \";\n cout << n << endl;\n } else\n cout << \"Impossible\" << endl;\n return 0;\n}","item":{"problem_id":"663A","pseudocode":"maxn = const int with maxn = 105\nnum = integer array of size maxn\ndefine the main function\n s = string\n read s\n n = integer\n l = integer with l = s.size()\n set all contents of num to 0\n zheng, fu = integer with zheng = 0, fu = 0\n zuida = int with zuida = 1\n pos = integer\n num[1] = 1\n increment zheng\n increment zuida\n for i = 1 to l\n if s[i] is +\n num[increment zuida] = 1\n increment zheng\n else if s[i] is -\n num[increment zuida] = -1\n increment fu\n else if s[i] is =\n pos = i\n break loop\n end of the block\n end of the block\n a = string with a = s.substr(pos + 2)\n ss = stringstream, call ss on a\n right shift ss n times\n flag = bool with flag = false\n for i = 1 to zuida exclusive\n if n is zheng - fu)\n flag = true\n break loop\n end of the block\n while n > zheng - fu and num[i] > 0 and num[i] < n\n increment zheng\n increment num[i]\n end of the block\n while (n < zheng - fu and num[i] < 0 and abs(num[i]) < n)\n increment fu\n decrement num[i]\n end of the block\n end of the block\n if n is zheng - fu, flag = true\n if flag\n print Possible\n print num[1]\n for i = 2 to zuida exclusive\n if num[i] < 0\n print - and -num[i]\n else\n print + and num[i]\n end of the block\n print =\n print n\n else\n print Impossible\n return to indicate successful execution\nend of the block","testcases":[[["? + ? - ? + ? + ? = 42"],["Possible","40 + 1 - 1 + 1 + 1 = 42"]],[["? - ? = 1"],["Impossible"]],[["? = 1000000"],["Possible","1000000 = 1000000"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 9"],["Impossible"]],[["? - ? + ? + ? + ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? - ? + ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? + ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? + ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? = 123456"],["Possible","123456 - 1 + 2 + 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 = 123456"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 93"],["Impossible"]],[["? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 57"],["Possible","57 - 1 + 18 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 57"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 32"],["Possible","32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 + 32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 32"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 31"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? - ? - ? = 4"],["Impossible"]],[["? + ? - ? - ? - ? + ? + ? - ? + ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? = 5"],["Possible","5 + 5 - 1 - 1 - 1 + 5 + 5 - 1 + 5 + 5 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 - 1 + 5 - 1 - 1 + 2 - 1 + 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 5"]],[["? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? - ? - ? + ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? = 3"],["Impossible"]],[["? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? - ? - ? + ? + ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? + ? + ? - ? + ? + ? - ? - ? + ? - ? + ? + ? + ? = 4"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 - 4 + 1 + 1 + 1 - 4 + 1 + 1 - 4 - 4 + 1 - 4 + 1 + 1 + 1 = 4"]],[["? + ? - ? + ? + ? - ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? - ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? - ? + ? + ? = 4"],["Possible","1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 - 4 - 4 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 - 4 + 1 + 1 + 1 + 1 + 1 + 1 - 4 + 1 + 1 - 3 - 1 + 1 + 1 = 4"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 100"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 100"]],[["? + ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? - ? - ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? + ? - ? - ? + ? - ? - ? - ? - ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? = 837454"],["Possible","837454 + 28 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 = 837454"]],[["? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? - ? - ? + ? - ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? - ? + ? - ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? - ? - ? + ? - ? - ? - ? + ? = 254253"],["Possible","254253 - 1 + 2 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 - 1 - 1 + 1 = 254253"]],[["? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? - ? - ? + ? - ? + ? + ? + ? + ? - ? - ? + ? + ? - ? - ? + ? = 1000000"],["Possible","999963 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 + 1 - 1 - 1 + 1 = 1000000"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 43386"],["Impossible"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? = 999999"],["Possible","999999 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 98 - 1 - 1 = 999999"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 37"],["Possible","37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 37 - 1 - 1 - 1 + 20 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 37"]],[["? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? - ? = 19"],["Possible","19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 19 - 1 - 1 - 1 - 1 + 11 - 1 - 1 - 1 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 = 19"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 15"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 15 + 1 + 1 - 14 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 15"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 33"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 33 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 33"]],[["? + ? + ? + ? + ? - ? = 3"],["Possible","1 + 1 + 1 + 1 + 1 - 2 = 3"]],[["? + ? + ? + ? - ? = 2"],["Possible","1 + 1 + 1 + 1 - 2 = 2"]],[["? + ? - ? + ? + ? = 2"],["Possible","1 + 1 - 2 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? - ? - ? = 2"],["Possible","1 + 1 + 1 + 1 + 1 - 2 - 1 = 2"]],[["? + ? - ? = 1"],["Possible","1 + 1 - 1 = 1"]],[["? - ? + ? - ? + ? + ? + ? + ? = 2"],["Possible","1 - 2 + 1 - 2 + 1 + 1 + 1 + 1 = 2"]],[["? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? = 5"],["Possible","1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 5 = 5"]]]}} +{"instance_id":"pseudo_to_code_2k_111","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n declare long longs a and b\n read a and b and keep looping\n declare new string variable s\n declare long long variables x and y = 0\n read standard input to s\n create new long long called i\n for i = 0 to length of s exclusive\n if x = a and y = b, stop the loop\n if s[i] is equal to 'L', change x to x - 1\n if s[i] = 'R', change x to the sum of x and 1\n if s[i] = 'U', change y to the sum of y and 1\n if s[i] = 'D', decrease y by 1\n end of the block\n declare new long long variable j\n if i = length of s\n for j from 0 to length of s exclusive\n if s[j] is equal to 'L', increase a by 1\n if s[j] is equal to 'R', subtract 1 from a\n if s[j] is equal to 'U', subtract 1 from b\n if s[j] is equal to 'D', add 1 to b\n if a = 0 and b is equal to 0, stop the loop\n create long long variable da with value = absolute value of a\n declare new long long db with value abs(b)\n dx is a new long long variable = abs(x)\n declare long long variable dy = absolute value of y\n if a * y = b * x && a * x >= 0 && b * y >= 0\n if a != 0 and b != 0\n if dx != 0 and dy != 0\n if da % dx = 0 and db % dy = 0, break the loop\n end of the block\n else if a != 0 and b = 0\n if dx != 0\n if dy is equal to 0 and da%dx = 0, stop the loop\n end of the block\n else if a = 0 and b != 0\n if dy != 0\n if dx = 0 and db % dy is equal to 0, break\n end of the block\n end of the block\n end of the block\n end of the block\n if j != length of s\n print \"Yes\"\n else\n print \"No\" to the standard output\n end of the block\n else\n print \"Yes\"\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n long long a, b;\n while (cin >> a >> b) {\n string s;\n long long x = 0, y = 0;\n cin >> s;\n long long i;\n for (i = 0; i < s.size(); i++) {\n if (x == a && y == b) break;\n if (s[i] == 'L') x -= 1;\n if (s[i] == 'R') x += 1;\n if (s[i] == 'U') y += 1;\n if (s[i] == 'D') y -= 1;\n }\n long long j;\n if (i == s.size()) {\n for (j = 0; j < s.size(); j++) {\n if (s[j] == 'L') a += 1;\n if (s[j] == 'R') a -= 1;\n if (s[j] == 'U') b -= 1;\n if (s[j] == 'D') b += 1;\n if (a == 0 && b == 0) break;\n long long da = abs(a);\n long long db = abs(b);\n long long dx = abs(x);\n long long dy = abs(y);\n if ((long long)a * y == (long long)b * x && (long long)a * x >= 0 && (long long)b * y >= 0) {\n if (a != 0 && b != 0) {\n if (dx != 0 && dy != 0) {\n if (da % dx == 0 && db % dy == 0) break;\n }\n } else if (a != 0 && b == 0) {\n if (dx != 0) {\n if (dy == 0 && da % dx == 0) break;\n }\n } else if (a == 0 && b != 0) {\n if (dy != 0) {\n if (dx == 0 && db % dy == 0) break;\n }\n }\n }\n }\n if (j != s.size()) {\n cout << \"Yes\" << endl;\n } else {\n cout << \"No\" << endl;\n }\n } else {\n cout << \"Yes\" << endl;\n }\n }\n return 0;\n}","item":{"problem_id":"321A","pseudocode":"define the main function\n declare long longs a and b\n read a and b and keep looping\n declare new string variable s\n declare long long variables x and y = 0\n read standard input to s\n create new long long called i\n for i = 0 to length of s exclusive\n if x = a and y = b, stop the loop\n if s[i] is equal to 'L', change x to x - 1\n if s[i] = 'R', change x to the sum of x and 1\n if s[i] = 'U', change y to the sum of y and 1\n if s[i] = 'D', decrease y by 1\n end of the block\n declare new long long variable j\n if i = length of s\n for j from 0 to length of s exclusive\n if s[j] is equal to 'L', increase a by 1\n if s[j] is equal to 'R', subtract 1 from a\n if s[j] is equal to 'U', subtract 1 from b\n if s[j] is equal to 'D', add 1 to b\n if a = 0 and b is equal to 0, stop the loop\n create long long variable da with value = absolute value of a\n declare new long long db with value abs(b)\n dx is a new long long variable = abs(x)\n declare long long variable dy = absolute value of y\n if a * y = b * x && a * x >= 0 && b * y >= 0\n if a != 0 and b != 0\n if dx != 0 and dy != 0\n if da % dx = 0 and db % dy = 0, break the loop\n end of the block\n else if a != 0 and b = 0\n if dx != 0\n if dy is equal to 0 and da%dx = 0, stop the loop\n end of the block\n else if a = 0 and b != 0\n if dy != 0\n if dx = 0 and db % dy is equal to 0, break\n end of the block\n end of the block\n end of the block\n end of the block\n if j != length of s\n print \"Yes\"\n else\n print \"No\" to the standard output\n end of the block\n else\n print \"Yes\"\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2 2","RU"],["Yes"]],[["1 2","RU"],["No"]],[["-1 1000000000","LRRLU"],["Yes"]],[["0 0","D"],["Yes"]],[["0 0","UURRDL"],["Yes"]],[["987654321 987654321","UURRDL"],["Yes"]],[["4 2","UURRDL"],["No"]],[["4 3","UURRDL"],["Yes"]],[["4 4","UURRDL"],["Yes"]],[["4 6","UURRDL"],["Yes"]],[["4 7","UURRDL"],["No"]],[["1000000000 1000000000","UURRDL"],["Yes"]],[["-1 -1","UR"],["No"]],[["1 1","UURRDDLL"],["No"]],[["987654321 2","UURDD"],["Yes"]],[["0 123456789","RRULL"],["Yes"]],[["4 4","UUUURRRRDDDDLLLL"],["Yes"]],[["-491226083 -49122610","UDRLDURLDLLLDUDURLRDUUDDUUULUDRDRDUULURDRLLDDDLUDUURLUUDLLDULLLLDDLDDUU"],["Yes"]],[["-261597957 418556728","LLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL"],["Yes"]],[["-771928144 -3","RUDULULDRDLLLULDDUDDDDUDULRULRUULDDDURUDLUURULLLDLLDDRDDRLRURUULRUURRUDLDLDDRLLULRRDRRLLUULUDRUUDRRD"],["Yes"]],[["397346346 1","DDURRUURLDLRRLULD"],["Yes"]],[["-528551525 0","UDRLRRLDLDLURRRRULDLRLRLURUUDDLRLLDRRULLUDLURDLUUULLLRUUUDRRURLDUDULDDRDDDRDL"],["Yes"]],[["311692421 -129871846","LLLDURULDDDDUDDURRLUUDRLDDRDURDDRUDUURLUDUDLDRUDDDUUURDRRUDRDRDURLLDURUUDRLDLDURRRRRRDULURDRU"],["Yes"]],[["485940814 728911221","URURU"],["Yes"]],[["-843450986 632588242","LURLULULRUDUDULRDDLUL"],["Yes"]],[["647999516 -809999401","UDLDDLLULUDDLLDUULRRRDLUDDLDDLRLRRDRURURDRRDRULUDRDULRULLRRLLDDRLRRUDRURDUULUDLRRLRDR"],["Yes"]],[["352820537 -764444491","RDDUDLUDDUDLRRRDRRRDRRDUDUDDURLRRLDRLLRLLLLUULUDRURRDRLDDLLDRDURDUDRUDDLUDRLURUDRURDRDDLDRLDLDLLU"],["Yes"]],[["-284973644 -1","DLULLDLRUUDRR"],["Yes"]],[["356922591 -2","RRLDLDUDRUUUULUUDDULDDUDD"],["No"]],[["27033101 54066203","UDDDRDLLLRUUDDLRDLDRLRUDDULRLLRULR"],["No"]],[["-199335150 39867031","LLURRDUULRUDDRDUUULDLDRDDLURDRLDRLLLRRRRRULRRRUUDD"],["No"]],[["609504072 609504074","ULRLUDLDDR"],["No"]],[["497684357 829473929","RRLDUUURULURRLLRRLRLURRLDU"],["Yes"]],[["551922835 183974295","DUDUUULDRLRURRDULRRUDDLRLLUULLRLRDRDRR"],["No"]],[["825368095 -825368096","RD"],["No"]],[["-458990423 -229495204","DLLDDRLUDLRLUL"],["No"]],[["285102789 570205594","RRDULRULULRRDUURRLURUDDULLRDUL"],["No"]],[["109928480 219856920","LRURLRLURDRDLDRDLRDDUUDDLULDRRUUURRUDLLUULUUUR"],["No"]],[["-532674020 532674026","UURLLL"],["No"]],[["999999999 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["0 0","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["Yes"]],[["1 1","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["No"]],[["-1000000000 -1000000000","DLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL"],["Yes"]],[["3 3","UURR"],["No"]],[["-2 -2","UR"],["No"]],[["5 5","UDLR"],["No"]],[["0 -1","U"],["No"]],[["-1 0","R"],["No"]],[["1000000000 1000000000","URURURUR"],["Yes"]],[["-1 -1","RU"],["No"]],[["1 1","LD"],["No"]],[["-2 -2","UURR"],["No"]],[["1000000000 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["2 6","RUUUURLDDDL"],["Yes"]],[["0 1","LUUR"],["No"]],[["1 1","URDLDL"],["Yes"]],[["-10 -10","RU"],["No"]],[["1000000000 1000000000","RURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURU"],["Yes"]],[["-1000000000 -500000000","URR"],["No"]],[["-2 0","ULLLDDRRRR"],["Yes"]],[["999999999 -999999999","RRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLUUUUUUUUUUUUUUUUUUUUUUU"],["Yes"]],[["-100 -100","RU"],["No"]],[["100 100","RUL"],["No"]],[["0 1","UDLR"],["Yes"]],[["0 1","D"],["No"]],[["0 -3","RDDL"],["No"]]]}} +{"instance_id":"pseudo_to_code_2k_112","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n x, y = integers\n read x, y\n a = string\n read a\n len = integer with len = a.length()\n rx, ry = integer with rx = 0, ry = 0\n for i = 0 to len exclusive\n if a[i] is U, ry = ry + 1\n if a[i] is D, ry = ry - 1\n if a[i] is R, rx = rx + 1\n if a[i] is L, rx = rx - 1\n end of the block\n tx, ty, nx, ny = integers with tx = 0, ty = 0, nx = 0, ny = 0\n for i = 0 to len exclusive\n if rx and ry\n tx = (x - nx) modulo rx\n ty = (y - ny) modulo ry\n if not tx and not ty and (x - nx) \/ rx is (y - ny) \/ ry and (x - nx) \/ rx >= 0\n print Yes\n return to indicate successful execution\n end of the block\n else if rx and not ry\n tx = (x - nx) modulo rx\n if not tx and (x - nx) \/ rx >= 0 and ny is y\n print Yes\n return to indicate successful execution\n end of the block\n else if not rx and ry\n ty = (y - ny) modulo ry;\n if not ty and (y - ny) \/ ry >= 0 and nx == x)\n print Yes\n return to indicate successful execution\n end of the block\n else\n if nx is x and ny is y\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n if a[i] is U, ny = ny + 1\n if a[i] is D, ny = ny - 1\n if a[i] is R, nx = nx + 1\n if a[i] is L, nx = nx - 1\n end of the block\n print No\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int x, y;\n cin >> x >> y;\n string a;\n cin >> a;\n int len = a.length();\n int rx = 0, ry = 0;\n for (int i = 0; i < len; i++) {\n if (a[i] == 'U') ry += 1;\n if (a[i] == 'D') ry -= 1;\n if (a[i] == 'R') rx += 1;\n if (a[i] == 'L') rx -= 1;\n }\n int tx = 0, ty = 0, nx = 0, ny = 0;\n for (int i = 0; i < len; i++) {\n if (rx && ry) {\n tx = (x - nx) % rx;\n ty = (y - ny) % ry;\n if (!tx && !ty && (x - nx) \/ rx == (y - ny) \/ ry && (x - nx) \/ rx >= 0) {\n cout << \"Yes\" << endl;\n return 0;\n }\n } else if (rx && !ry) {\n tx = (x - nx) % rx;\n if (!tx && (x - nx) \/ rx >= 0 && ny == y) {\n cout << \"Yes\" << endl;\n return 0;\n }\n } else if (!rx && ry) {\n ty = (y - ny) % ry;\n if (!ty && (y - ny) \/ ry >= 0 && nx == x) {\n cout << \"Yes\" << endl;\n return 0;\n }\n } else {\n if (nx == x && ny == y) {\n cout << \"Yes\" << endl;\n return 0;\n }\n }\n if (a[i] == 'U') ny += 1;\n if (a[i] == 'D') ny -= 1;\n if (a[i] == 'R') nx += 1;\n if (a[i] == 'L') nx -= 1;\n }\n cout << \"No\" << endl;\n return 0;\n}","item":{"problem_id":"321A","pseudocode":"define the main function\n x, y = integers\n read x, y\n a = string\n read a\n len = integer with len = a.length()\n rx, ry = integer with rx = 0, ry = 0\n for i = 0 to len exclusive\n if a[i] is U, ry = ry + 1\n if a[i] is D, ry = ry - 1\n if a[i] is R, rx = rx + 1\n if a[i] is L, rx = rx - 1\n end of the block\n tx, ty, nx, ny = integers with tx = 0, ty = 0, nx = 0, ny = 0\n for i = 0 to len exclusive\n if rx and ry\n tx = (x - nx) modulo rx\n ty = (y - ny) modulo ry\n if not tx and not ty and (x - nx) \/ rx is (y - ny) \/ ry and (x - nx) \/ rx >= 0\n print Yes\n return to indicate successful execution\n end of the block\n else if rx and not ry\n tx = (x - nx) modulo rx\n if not tx and (x - nx) \/ rx >= 0 and ny is y\n print Yes\n return to indicate successful execution\n end of the block\n else if not rx and ry\n ty = (y - ny) modulo ry;\n if not ty and (y - ny) \/ ry >= 0 and nx == x)\n print Yes\n return to indicate successful execution\n end of the block\n else\n if nx is x and ny is y\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n if a[i] is U, ny = ny + 1\n if a[i] is D, ny = ny - 1\n if a[i] is R, nx = nx + 1\n if a[i] is L, nx = nx - 1\n end of the block\n print No\n return to indicate successful execution\nend of the block","testcases":[[["2 2","RU"],["Yes"]],[["1 2","RU"],["No"]],[["-1 1000000000","LRRLU"],["Yes"]],[["0 0","D"],["Yes"]],[["0 0","UURRDL"],["Yes"]],[["987654321 987654321","UURRDL"],["Yes"]],[["4 2","UURRDL"],["No"]],[["4 3","UURRDL"],["Yes"]],[["4 4","UURRDL"],["Yes"]],[["4 6","UURRDL"],["Yes"]],[["4 7","UURRDL"],["No"]],[["1000000000 1000000000","UURRDL"],["Yes"]],[["-1 -1","UR"],["No"]],[["1 1","UURRDDLL"],["No"]],[["987654321 2","UURDD"],["Yes"]],[["0 123456789","RRULL"],["Yes"]],[["4 4","UUUURRRRDDDDLLLL"],["Yes"]],[["-491226083 -49122610","UDRLDURLDLLLDUDURLRDUUDDUUULUDRDRDUULURDRLLDDDLUDUURLUUDLLDULLLLDDLDDUU"],["Yes"]],[["-261597957 418556728","LLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL"],["Yes"]],[["-771928144 -3","RUDULULDRDLLLULDDUDDDDUDULRULRUULDDDURUDLUURULLLDLLDDRDDRLRURUULRUURRUDLDLDDRLLULRRDRRLLUULUDRUUDRRD"],["Yes"]],[["397346346 1","DDURRUURLDLRRLULD"],["Yes"]],[["-528551525 0","UDRLRRLDLDLURRRRULDLRLRLURUUDDLRLLDRRULLUDLURDLUUULLLRUUUDRRURLDUDULDDRDDDRDL"],["Yes"]],[["311692421 -129871846","LLLDURULDDDDUDDURRLUUDRLDDRDURDDRUDUURLUDUDLDRUDDDUUURDRRUDRDRDURLLDURUUDRLDLDURRRRRRDULURDRU"],["Yes"]],[["485940814 728911221","URURU"],["Yes"]],[["-843450986 632588242","LURLULULRUDUDULRDDLUL"],["Yes"]],[["647999516 -809999401","UDLDDLLULUDDLLDUULRRRDLUDDLDDLRLRRDRURURDRRDRULUDRDULRULLRRLLDDRLRRUDRURDUULUDLRRLRDR"],["Yes"]],[["352820537 -764444491","RDDUDLUDDUDLRRRDRRRDRRDUDUDDURLRRLDRLLRLLLLUULUDRURRDRLDDLLDRDURDUDRUDDLUDRLURUDRURDRDDLDRLDLDLLU"],["Yes"]],[["-284973644 -1","DLULLDLRUUDRR"],["Yes"]],[["356922591 -2","RRLDLDUDRUUUULUUDDULDDUDD"],["No"]],[["27033101 54066203","UDDDRDLLLRUUDDLRDLDRLRUDDULRLLRULR"],["No"]],[["-199335150 39867031","LLURRDUULRUDDRDUUULDLDRDDLURDRLDRLLLRRRRRULRRRUUDD"],["No"]],[["609504072 609504074","ULRLUDLDDR"],["No"]],[["497684357 829473929","RRLDUUURULURRLLRRLRLURRLDU"],["Yes"]],[["551922835 183974295","DUDUUULDRLRURRDULRRUDDLRLLUULLRLRDRDRR"],["No"]],[["825368095 -825368096","RD"],["No"]],[["-458990423 -229495204","DLLDDRLUDLRLUL"],["No"]],[["285102789 570205594","RRDULRULULRRDUURRLURUDDULLRDUL"],["No"]],[["109928480 219856920","LRURLRLURDRDLDRDLRDDUUDDLULDRRUUURRUDLLUULUUUR"],["No"]],[["-532674020 532674026","UURLLL"],["No"]],[["999999999 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["0 0","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["Yes"]],[["1 1","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["No"]],[["-1000000000 -1000000000","DLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL"],["Yes"]],[["3 3","UURR"],["No"]],[["-2 -2","UR"],["No"]],[["5 5","UDLR"],["No"]],[["0 -1","U"],["No"]],[["-1 0","R"],["No"]],[["1000000000 1000000000","URURURUR"],["Yes"]],[["-1 -1","RU"],["No"]],[["1 1","LD"],["No"]],[["-2 -2","UURR"],["No"]],[["1000000000 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["2 6","RUUUURLDDDL"],["Yes"]],[["0 1","LUUR"],["No"]],[["1 1","URDLDL"],["Yes"]],[["-10 -10","RU"],["No"]],[["1000000000 1000000000","RURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURU"],["Yes"]],[["-1000000000 -500000000","URR"],["No"]],[["-2 0","ULLLDDRRRR"],["Yes"]],[["999999999 -999999999","RRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLUUUUUUUUUUUUUUUUUUUUUUU"],["Yes"]],[["-100 -100","RU"],["No"]],[["100 100","RUL"],["No"]],[["0 1","UDLR"],["Yes"]],[["0 1","D"],["No"]],[["0 -3","RDDL"],["No"]]]}} +{"instance_id":"pseudo_to_code_2k_113","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare constant integer MAX = 2e6, mod = 998244353\ndeclare integer array dp size MAX by 26\ndeclare boolean ck with long longs lu, ld, ru, rd as arguments\n if lu is true\n declare long long step = absolute value of ( ld \/ lu )\n if lu * step is ld and ru * step is rd, return 1\n end of the block\n if ru is true\n declare long long step = absolute value of rd \/ ru\n if lu * step is ld and ru * step is rd, return 1\n end of the block\n return to indicate successful execution\nend of the block\ndefine the main function\n declare integers a, b\n declare string x\n read a, b, x\n declare integer n = size of x\n declare long longs tx = 0, ty = 0\n declare long longs cx = 0, cy = 0\n for i = 0 to n exclusive\n if x[i] is 'R'\n increment tx\n else if x[i] is 'L'\n decrement tx\n else if x[i] is 'U'\n increment ty\n else if x[i] is 'D'\n decrement ty\n end of the block\n if result of ck(tx, a, ty, b) or ( a is tx and b is ty ), return print ( \"Yes\" ), 0\n for i = 0 to n exclusive\n if x[i] is 'R'\n increment cx\n else if x[i] is 'L'\n decrement cx\n else if x[i] is 'U'\n increment cy\n else if x[i] is 'D'\n decrement cy\n if result of run ck with tx, a - cx, ty, b- cy as arguments or ( a is cx and b is cy ) return print ( \"Yes\" ), 0\n end of the block\n print \"No\"\nend of the block\n\n[CODE]:","reference_output":"const int MAX = 2e6, mod = 998244353;\nint dp[MAX][26];\nbool ck(long long lu, long long ld, long long ru, long long rd) {\n if (lu) {\n long long step = abs(ld \/ lu);\n if (lu * step == ld && ru * step == rd) return 1;\n }\n if (ru) {\n long long step = abs(rd \/ ru);\n if (lu * step == ld && ru * step == rd) return 1;\n }\n return 0;\n}\nint main() {\n int a, b;\n string x;\n cin >> a >> b >> x;\n int n = x.size();\n long long tx = 0, ty = 0;\n long long cx = 0, cy = 0;\n for (int i = 0; i < n; i++) {\n if (x[i] == 'R')\n tx++;\n else if (x[i] == 'L')\n tx--;\n else if (x[i] == 'U')\n ty++;\n else if (x[i] == 'D')\n ty--;\n }\n if (ck(tx, a, ty, b) || (a == tx && b == ty)) return puts(\"Yes\"), 0;\n for (int i = 0; i < n; i++) {\n if (x[i] == 'R')\n cx++;\n else if (x[i] == 'L')\n cx--;\n else if (x[i] == 'U')\n cy++;\n else if (x[i] == 'D')\n cy--;\n if (ck(tx, a - cx, ty, b - cy) || (a == cx && b == cy)) return puts(\"Yes\"), 0;\n }\n puts(\"No\");\n}","item":{"problem_id":"321A","pseudocode":"declare constant integer MAX = 2e6, mod = 998244353\ndeclare integer array dp size MAX by 26\ndeclare boolean ck with long longs lu, ld, ru, rd as arguments\n if lu is true\n declare long long step = absolute value of ( ld \/ lu )\n if lu * step is ld and ru * step is rd, return 1\n end of the block\n if ru is true\n declare long long step = absolute value of rd \/ ru\n if lu * step is ld and ru * step is rd, return 1\n end of the block\n return to indicate successful execution\nend of the block\ndefine the main function\n declare integers a, b\n declare string x\n read a, b, x\n declare integer n = size of x\n declare long longs tx = 0, ty = 0\n declare long longs cx = 0, cy = 0\n for i = 0 to n exclusive\n if x[i] is 'R'\n increment tx\n else if x[i] is 'L'\n decrement tx\n else if x[i] is 'U'\n increment ty\n else if x[i] is 'D'\n decrement ty\n end of the block\n if result of ck(tx, a, ty, b) or ( a is tx and b is ty ), return print ( \"Yes\" ), 0\n for i = 0 to n exclusive\n if x[i] is 'R'\n increment cx\n else if x[i] is 'L'\n decrement cx\n else if x[i] is 'U'\n increment cy\n else if x[i] is 'D'\n decrement cy\n if result of run ck with tx, a - cx, ty, b- cy as arguments or ( a is cx and b is cy ) return print ( \"Yes\" ), 0\n end of the block\n print \"No\"\nend of the block","testcases":[[["2 2","RU"],["Yes"]],[["1 2","RU"],["No"]],[["-1 1000000000","LRRLU"],["Yes"]],[["0 0","D"],["Yes"]],[["0 0","UURRDL"],["Yes"]],[["987654321 987654321","UURRDL"],["Yes"]],[["4 2","UURRDL"],["No"]],[["4 3","UURRDL"],["Yes"]],[["4 4","UURRDL"],["Yes"]],[["4 6","UURRDL"],["Yes"]],[["4 7","UURRDL"],["No"]],[["1000000000 1000000000","UURRDL"],["Yes"]],[["-1 -1","UR"],["No"]],[["1 1","UURRDDLL"],["No"]],[["987654321 2","UURDD"],["Yes"]],[["0 123456789","RRULL"],["Yes"]],[["4 4","UUUURRRRDDDDLLLL"],["Yes"]],[["-491226083 -49122610","UDRLDURLDLLLDUDURLRDUUDDUUULUDRDRDUULURDRLLDDDLUDUURLUUDLLDULLLLDDLDDUU"],["Yes"]],[["-261597957 418556728","LLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL"],["Yes"]],[["-771928144 -3","RUDULULDRDLLLULDDUDDDDUDULRULRUULDDDURUDLUURULLLDLLDDRDDRLRURUULRUURRUDLDLDDRLLULRRDRRLLUULUDRUUDRRD"],["Yes"]],[["397346346 1","DDURRUURLDLRRLULD"],["Yes"]],[["-528551525 0","UDRLRRLDLDLURRRRULDLRLRLURUUDDLRLLDRRULLUDLURDLUUULLLRUUUDRRURLDUDULDDRDDDRDL"],["Yes"]],[["311692421 -129871846","LLLDURULDDDDUDDURRLUUDRLDDRDURDDRUDUURLUDUDLDRUDDDUUURDRRUDRDRDURLLDURUUDRLDLDURRRRRRDULURDRU"],["Yes"]],[["485940814 728911221","URURU"],["Yes"]],[["-843450986 632588242","LURLULULRUDUDULRDDLUL"],["Yes"]],[["647999516 -809999401","UDLDDLLULUDDLLDUULRRRDLUDDLDDLRLRRDRURURDRRDRULUDRDULRULLRRLLDDRLRRUDRURDUULUDLRRLRDR"],["Yes"]],[["352820537 -764444491","RDDUDLUDDUDLRRRDRRRDRRDUDUDDURLRRLDRLLRLLLLUULUDRURRDRLDDLLDRDURDUDRUDDLUDRLURUDRURDRDDLDRLDLDLLU"],["Yes"]],[["-284973644 -1","DLULLDLRUUDRR"],["Yes"]],[["356922591 -2","RRLDLDUDRUUUULUUDDULDDUDD"],["No"]],[["27033101 54066203","UDDDRDLLLRUUDDLRDLDRLRUDDULRLLRULR"],["No"]],[["-199335150 39867031","LLURRDUULRUDDRDUUULDLDRDDLURDRLDRLLLRRRRRULRRRUUDD"],["No"]],[["609504072 609504074","ULRLUDLDDR"],["No"]],[["497684357 829473929","RRLDUUURULURRLLRRLRLURRLDU"],["Yes"]],[["551922835 183974295","DUDUUULDRLRURRDULRRUDDLRLLUULLRLRDRDRR"],["No"]],[["825368095 -825368096","RD"],["No"]],[["-458990423 -229495204","DLLDDRLUDLRLUL"],["No"]],[["285102789 570205594","RRDULRULULRRDUURRLURUDDULLRDUL"],["No"]],[["109928480 219856920","LRURLRLURDRDLDRDLRDDUUDDLULDRRUUURRUDLLUULUUUR"],["No"]],[["-532674020 532674026","UURLLL"],["No"]],[["999999999 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["0 0","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["Yes"]],[["1 1","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["No"]],[["-1000000000 -1000000000","DLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL"],["Yes"]],[["3 3","UURR"],["No"]],[["-2 -2","UR"],["No"]],[["5 5","UDLR"],["No"]],[["0 -1","U"],["No"]],[["-1 0","R"],["No"]],[["1000000000 1000000000","URURURUR"],["Yes"]],[["-1 -1","RU"],["No"]],[["1 1","LD"],["No"]],[["-2 -2","UURR"],["No"]],[["1000000000 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["2 6","RUUUURLDDDL"],["Yes"]],[["0 1","LUUR"],["No"]],[["1 1","URDLDL"],["Yes"]],[["-10 -10","RU"],["No"]],[["1000000000 1000000000","RURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURU"],["Yes"]],[["-1000000000 -500000000","URR"],["No"]],[["-2 0","ULLLDDRRRR"],["Yes"]],[["999999999 -999999999","RRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLUUUUUUUUUUUUUUUUUUUUUUU"],["Yes"]],[["-100 -100","RU"],["No"]],[["100 100","RUL"],["No"]],[["0 1","UDLR"],["Yes"]],[["0 1","D"],["No"]],[["0 -3","RDDL"],["No"]]]}} +{"instance_id":"pseudo_to_code_2k_114","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n let a, b long longs\n let in a string\n read a, b, and in\n let x, y long longs both with value 0\n let len a long long with value length of in\n let zx, zy long longs both with value 0\n for long long i = 0 to len exclusive\n if zx is a and zy is b\n print Yes\n return to indicate successful execution\n end of the block\n if in[i] is U, increment zy\n if in[i] is D, decrement zy\n if in[i] is L, decrement zx\n if in[i] is R, increment zx\n end of the block\n if zx and zy are 0\n print No\n return to indicate successful execution\n end of the block\n for i = 0 to len exclusive\n if in[i] is U, increment y\n if in[i] is D, decrement y\n if in[i] is L, decrement x\n if in[i] is R, increment x\n let chax, chay long longs with chax = a - x and chay = b - y\n if zx is 0\n if chay mod zy is 0 and zx is chax\n if chay \/ zy is at least 0\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n otherwise, if zy is 0\n if chax mod zx is 0 and zy equals chay\n if chax \/ zx is at least 0\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n otherwise if chax mod zx is 0 and chay mod zy is 0\n if chax \/ zx = chay \/ zy and chax \/ zx is at least 0 and chay \/ zy is at least 0\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n print No\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n long long a, b;\n string in;\n cin >> a >> b >> in;\n long long x = 0, y = 0;\n long long len = in.length();\n long long zx = 0, zy = 0;\n for (long long i = 0; i < len; i++) {\n if (zx == a && zy == b) {\n cout << \"Yes\" << endl;\n return 0;\n }\n if (in[i] == 'U') { zy++; }\n if (in[i] == 'D') { zy--; }\n if (in[i] == 'L') { zx--; }\n if (in[i] == 'R') { zx++; }\n }\n if (zx == 0 && zy == 0) {\n cout << \"No\" << endl;\n return 0;\n }\n for (int i = 0; i < len; i++) {\n if (in[i] == 'U') { y++; }\n if (in[i] == 'D') { y--; }\n if (in[i] == 'L') { x--; }\n if (in[i] == 'R') { x++; }\n long long chax = a - x, chay = b - y;\n if (zx == 0) {\n if (chay % zy == 0 && zx == chax) {\n if (chay \/ zy >= 0) {\n cout << \"Yes\" << endl;\n return 0;\n }\n }\n } else if (zy == 0) {\n if (chax % zx == 0 && zy == chay) {\n if (chax \/ zx >= 0) {\n cout << \"Yes\" << endl;\n return 0;\n }\n }\n } else if (chax % zx == 0 && chay % zy == 0) {\n if (chax \/ zx == chay \/ zy && chax \/ zx >= 0 && chay \/ zy >= 0) {\n cout << \"Yes\" << endl;\n return 0;\n }\n }\n }\n cout << \"No\" << endl;\n return 0;\n}","item":{"problem_id":"321A","pseudocode":"define the main function\n let a, b long longs\n let in a string\n read a, b, and in\n let x, y long longs both with value 0\n let len a long long with value length of in\n let zx, zy long longs both with value 0\n for long long i = 0 to len exclusive\n if zx is a and zy is b\n print Yes\n return to indicate successful execution\n end of the block\n if in[i] is U, increment zy\n if in[i] is D, decrement zy\n if in[i] is L, decrement zx\n if in[i] is R, increment zx\n end of the block\n if zx and zy are 0\n print No\n return to indicate successful execution\n end of the block\n for i = 0 to len exclusive\n if in[i] is U, increment y\n if in[i] is D, decrement y\n if in[i] is L, decrement x\n if in[i] is R, increment x\n let chax, chay long longs with chax = a - x and chay = b - y\n if zx is 0\n if chay mod zy is 0 and zx is chax\n if chay \/ zy is at least 0\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n otherwise, if zy is 0\n if chax mod zx is 0 and zy equals chay\n if chax \/ zx is at least 0\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n otherwise if chax mod zx is 0 and chay mod zy is 0\n if chax \/ zx = chay \/ zy and chax \/ zx is at least 0 and chay \/ zy is at least 0\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n print No\n return to indicate successful execution\nend of the block","testcases":[[["2 2","RU"],["Yes"]],[["1 2","RU"],["No"]],[["-1 1000000000","LRRLU"],["Yes"]],[["0 0","D"],["Yes"]],[["0 0","UURRDL"],["Yes"]],[["987654321 987654321","UURRDL"],["Yes"]],[["4 2","UURRDL"],["No"]],[["4 3","UURRDL"],["Yes"]],[["4 4","UURRDL"],["Yes"]],[["4 6","UURRDL"],["Yes"]],[["4 7","UURRDL"],["No"]],[["1000000000 1000000000","UURRDL"],["Yes"]],[["-1 -1","UR"],["No"]],[["1 1","UURRDDLL"],["No"]],[["987654321 2","UURDD"],["Yes"]],[["0 123456789","RRULL"],["Yes"]],[["4 4","UUUURRRRDDDDLLLL"],["Yes"]],[["-491226083 -49122610","UDRLDURLDLLLDUDURLRDUUDDUUULUDRDRDUULURDRLLDDDLUDUURLUUDLLDULLLLDDLDDUU"],["Yes"]],[["-261597957 418556728","LLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL"],["Yes"]],[["-771928144 -3","RUDULULDRDLLLULDDUDDDDUDULRULRUULDDDURUDLUURULLLDLLDDRDDRLRURUULRUURRUDLDLDDRLLULRRDRRLLUULUDRUUDRRD"],["Yes"]],[["397346346 1","DDURRUURLDLRRLULD"],["Yes"]],[["-528551525 0","UDRLRRLDLDLURRRRULDLRLRLURUUDDLRLLDRRULLUDLURDLUUULLLRUUUDRRURLDUDULDDRDDDRDL"],["Yes"]],[["311692421 -129871846","LLLDURULDDDDUDDURRLUUDRLDDRDURDDRUDUURLUDUDLDRUDDDUUURDRRUDRDRDURLLDURUUDRLDLDURRRRRRDULURDRU"],["Yes"]],[["485940814 728911221","URURU"],["Yes"]],[["-843450986 632588242","LURLULULRUDUDULRDDLUL"],["Yes"]],[["647999516 -809999401","UDLDDLLULUDDLLDUULRRRDLUDDLDDLRLRRDRURURDRRDRULUDRDULRULLRRLLDDRLRRUDRURDUULUDLRRLRDR"],["Yes"]],[["352820537 -764444491","RDDUDLUDDUDLRRRDRRRDRRDUDUDDURLRRLDRLLRLLLLUULUDRURRDRLDDLLDRDURDUDRUDDLUDRLURUDRURDRDDLDRLDLDLLU"],["Yes"]],[["-284973644 -1","DLULLDLRUUDRR"],["Yes"]],[["356922591 -2","RRLDLDUDRUUUULUUDDULDDUDD"],["No"]],[["27033101 54066203","UDDDRDLLLRUUDDLRDLDRLRUDDULRLLRULR"],["No"]],[["-199335150 39867031","LLURRDUULRUDDRDUUULDLDRDDLURDRLDRLLLRRRRRULRRRUUDD"],["No"]],[["609504072 609504074","ULRLUDLDDR"],["No"]],[["497684357 829473929","RRLDUUURULURRLLRRLRLURRLDU"],["Yes"]],[["551922835 183974295","DUDUUULDRLRURRDULRRUDDLRLLUULLRLRDRDRR"],["No"]],[["825368095 -825368096","RD"],["No"]],[["-458990423 -229495204","DLLDDRLUDLRLUL"],["No"]],[["285102789 570205594","RRDULRULULRRDUURRLURUDDULLRDUL"],["No"]],[["109928480 219856920","LRURLRLURDRDLDRDLRDDUUDDLULDRRUUURRUDLLUULUUUR"],["No"]],[["-532674020 532674026","UURLLL"],["No"]],[["999999999 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["0 0","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["Yes"]],[["1 1","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["No"]],[["-1000000000 -1000000000","DLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL"],["Yes"]],[["3 3","UURR"],["No"]],[["-2 -2","UR"],["No"]],[["5 5","UDLR"],["No"]],[["0 -1","U"],["No"]],[["-1 0","R"],["No"]],[["1000000000 1000000000","URURURUR"],["Yes"]],[["-1 -1","RU"],["No"]],[["1 1","LD"],["No"]],[["-2 -2","UURR"],["No"]],[["1000000000 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["2 6","RUUUURLDDDL"],["Yes"]],[["0 1","LUUR"],["No"]],[["1 1","URDLDL"],["Yes"]],[["-10 -10","RU"],["No"]],[["1000000000 1000000000","RURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURU"],["Yes"]],[["-1000000000 -500000000","URR"],["No"]],[["-2 0","ULLLDDRRRR"],["Yes"]],[["999999999 -999999999","RRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLUUUUUUUUUUUUUUUUUUUUUUU"],["Yes"]],[["-100 -100","RU"],["No"]],[["100 100","RUL"],["No"]],[["0 1","UDLR"],["Yes"]],[["0 1","D"],["No"]],[["0 -3","RDDL"],["No"]]]}} +{"instance_id":"pseudo_to_code_2k_115","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n a, b = long long\n loop while reading a then b\n s = string\n x, y = long long with x = 0 and y = 0\n read s\n i = long long\n for i = 0 to size of s\n if x is a and y is b break\n if s[i] is 'L' decrement x\n if s[i] is 'R' increment x\n if s[i] is 'U' increment y\n if s[i] is 'D' decrement y\n end of the block\n j = long long\n if i is size of s\n for j = 0 to size of s\n if s[j] is 'L' increment a\n if s[j] is 'R' decrement a\n if s[j] is 'U' decrement b\n if s[j] is 'D' increment b\n if a and b are both 0 break\n da = long long with da = absolute of a\n db = long long with db = absolute of b\n dx = long long with dx = absolute of x\n dy = long long with dy = absolute of y\n if a as long long * y is b as long long * x and a as long long * x >= 0 and b as long long * y >= 0\n if a and b are both not 0\n if dx and dy are both not 0\n if da is a multiple of dx and db is a multiple of dy break\n end of the block\n else if a is not 0 and b is 0\n if dx is not 0\n if dy is 0 and da is a multiple of dx break\n end of the block\n else if a is 0 and b is not 0\n if dy is not 0\n if dx is 0 and db is a multiple of dy break\n end of the block\n end of the block\n end of the block\n end of the block\n if j is not size of s\n print \"Yes\"\n else\n print \"No\"\n end of the block\n else\n print \"Yes\"\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n long long a, b;\n while (cin >> a >> b) {\n string s;\n long long x = 0, y = 0;\n cin >> s;\n long long i;\n for (i = 0; i < s.size(); i++) {\n if (x == a && y == b) break;\n if (s[i] == 'L') x -= 1;\n if (s[i] == 'R') x += 1;\n if (s[i] == 'U') y += 1;\n if (s[i] == 'D') y -= 1;\n }\n long long j;\n if (i == s.size()) {\n for (j = 0; j < s.size(); j++) {\n if (s[j] == 'L') a += 1;\n if (s[j] == 'R') a -= 1;\n if (s[j] == 'U') b -= 1;\n if (s[j] == 'D') b += 1;\n if (a == 0 && b == 0) break;\n long long da = abs(a);\n long long db = abs(b);\n long long dx = abs(x);\n long long dy = abs(y);\n if ((long long)a * y == (long long)b * x && (long long)a * x >= 0 && (long long)b * y >= 0) {\n if (a != 0 && b != 0) {\n if (dx != 0 && dy != 0) {\n if (da % dx == 0 && db % dy == 0) break;\n }\n } else if (a != 0 && b == 0) {\n if (dx != 0) {\n if (dy == 0 && da % dx == 0) break;\n }\n } else if (a == 0 && b != 0) {\n if (dy != 0) {\n if (dx == 0 && db % dy == 0) break;\n }\n }\n }\n }\n if (j != s.size()) {\n cout << \"Yes\" << endl;\n } else {\n cout << \"No\" << endl;\n }\n } else {\n cout << \"Yes\" << endl;\n }\n }\n return 0;\n}","item":{"problem_id":"321A","pseudocode":"define the main function\n a, b = long long\n loop while reading a then b\n s = string\n x, y = long long with x = 0 and y = 0\n read s\n i = long long\n for i = 0 to size of s\n if x is a and y is b break\n if s[i] is 'L' decrement x\n if s[i] is 'R' increment x\n if s[i] is 'U' increment y\n if s[i] is 'D' decrement y\n end of the block\n j = long long\n if i is size of s\n for j = 0 to size of s\n if s[j] is 'L' increment a\n if s[j] is 'R' decrement a\n if s[j] is 'U' decrement b\n if s[j] is 'D' increment b\n if a and b are both 0 break\n da = long long with da = absolute of a\n db = long long with db = absolute of b\n dx = long long with dx = absolute of x\n dy = long long with dy = absolute of y\n if a as long long * y is b as long long * x and a as long long * x >= 0 and b as long long * y >= 0\n if a and b are both not 0\n if dx and dy are both not 0\n if da is a multiple of dx and db is a multiple of dy break\n end of the block\n else if a is not 0 and b is 0\n if dx is not 0\n if dy is 0 and da is a multiple of dx break\n end of the block\n else if a is 0 and b is not 0\n if dy is not 0\n if dx is 0 and db is a multiple of dy break\n end of the block\n end of the block\n end of the block\n end of the block\n if j is not size of s\n print \"Yes\"\n else\n print \"No\"\n end of the block\n else\n print \"Yes\"\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2 2","RU"],["Yes"]],[["1 2","RU"],["No"]],[["-1 1000000000","LRRLU"],["Yes"]],[["0 0","D"],["Yes"]],[["0 0","UURRDL"],["Yes"]],[["987654321 987654321","UURRDL"],["Yes"]],[["4 2","UURRDL"],["No"]],[["4 3","UURRDL"],["Yes"]],[["4 4","UURRDL"],["Yes"]],[["4 6","UURRDL"],["Yes"]],[["4 7","UURRDL"],["No"]],[["1000000000 1000000000","UURRDL"],["Yes"]],[["-1 -1","UR"],["No"]],[["1 1","UURRDDLL"],["No"]],[["987654321 2","UURDD"],["Yes"]],[["0 123456789","RRULL"],["Yes"]],[["4 4","UUUURRRRDDDDLLLL"],["Yes"]],[["-491226083 -49122610","UDRLDURLDLLLDUDURLRDUUDDUUULUDRDRDUULURDRLLDDDLUDUURLUUDLLDULLLLDDLDDUU"],["Yes"]],[["-261597957 418556728","LLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL"],["Yes"]],[["-771928144 -3","RUDULULDRDLLLULDDUDDDDUDULRULRUULDDDURUDLUURULLLDLLDDRDDRLRURUULRUURRUDLDLDDRLLULRRDRRLLUULUDRUUDRRD"],["Yes"]],[["397346346 1","DDURRUURLDLRRLULD"],["Yes"]],[["-528551525 0","UDRLRRLDLDLURRRRULDLRLRLURUUDDLRLLDRRULLUDLURDLUUULLLRUUUDRRURLDUDULDDRDDDRDL"],["Yes"]],[["311692421 -129871846","LLLDURULDDDDUDDURRLUUDRLDDRDURDDRUDUURLUDUDLDRUDDDUUURDRRUDRDRDURLLDURUUDRLDLDURRRRRRDULURDRU"],["Yes"]],[["485940814 728911221","URURU"],["Yes"]],[["-843450986 632588242","LURLULULRUDUDULRDDLUL"],["Yes"]],[["647999516 -809999401","UDLDDLLULUDDLLDUULRRRDLUDDLDDLRLRRDRURURDRRDRULUDRDULRULLRRLLDDRLRRUDRURDUULUDLRRLRDR"],["Yes"]],[["352820537 -764444491","RDDUDLUDDUDLRRRDRRRDRRDUDUDDURLRRLDRLLRLLLLUULUDRURRDRLDDLLDRDURDUDRUDDLUDRLURUDRURDRDDLDRLDLDLLU"],["Yes"]],[["-284973644 -1","DLULLDLRUUDRR"],["Yes"]],[["356922591 -2","RRLDLDUDRUUUULUUDDULDDUDD"],["No"]],[["27033101 54066203","UDDDRDLLLRUUDDLRDLDRLRUDDULRLLRULR"],["No"]],[["-199335150 39867031","LLURRDUULRUDDRDUUULDLDRDDLURDRLDRLLLRRRRRULRRRUUDD"],["No"]],[["609504072 609504074","ULRLUDLDDR"],["No"]],[["497684357 829473929","RRLDUUURULURRLLRRLRLURRLDU"],["Yes"]],[["551922835 183974295","DUDUUULDRLRURRDULRRUDDLRLLUULLRLRDRDRR"],["No"]],[["825368095 -825368096","RD"],["No"]],[["-458990423 -229495204","DLLDDRLUDLRLUL"],["No"]],[["285102789 570205594","RRDULRULULRRDUURRLURUDDULLRDUL"],["No"]],[["109928480 219856920","LRURLRLURDRDLDRDLRDDUUDDLULDRRUUURRUDLLUULUUUR"],["No"]],[["-532674020 532674026","UURLLL"],["No"]],[["999999999 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["0 0","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["Yes"]],[["1 1","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["No"]],[["-1000000000 -1000000000","DLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL"],["Yes"]],[["3 3","UURR"],["No"]],[["-2 -2","UR"],["No"]],[["5 5","UDLR"],["No"]],[["0 -1","U"],["No"]],[["-1 0","R"],["No"]],[["1000000000 1000000000","URURURUR"],["Yes"]],[["-1 -1","RU"],["No"]],[["1 1","LD"],["No"]],[["-2 -2","UURR"],["No"]],[["1000000000 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["2 6","RUUUURLDDDL"],["Yes"]],[["0 1","LUUR"],["No"]],[["1 1","URDLDL"],["Yes"]],[["-10 -10","RU"],["No"]],[["1000000000 1000000000","RURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURU"],["Yes"]],[["-1000000000 -500000000","URR"],["No"]],[["-2 0","ULLLDDRRRR"],["Yes"]],[["999999999 -999999999","RRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLUUUUUUUUUUUUUUUUUUUUUUU"],["Yes"]],[["-100 -100","RU"],["No"]],[["100 100","RUL"],["No"]],[["0 1","UDLR"],["Yes"]],[["0 1","D"],["No"]],[["0 -3","RDDL"],["No"]]]}} +{"instance_id":"pseudo_to_code_2k_116","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ns = string\na, b = integer\ncx, cy = integers with cx = 0, cy = 0\ndefine the main function\n read a, b\n read s\n for i = 0 to ((cast to int)(s).size())\n if cx is a and cy is b\n print Yes\n return to indicate successful execution\n end of the block\n if s[i] is U\n increment cy\n else if s[i] is D\n cy decrement\n else if s[i] is R\n increment cx\n else\n decrement cx\n if cx is a and cy is b\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n if cx\n t = integer with t = abs(a) \/ abs(cx)\n for now = t - 1000 to t + 1000\n if now < 0, continue new iteration\n first = long long with first = (cast to long long)cx * now\n second = long long with second = (cast to long long)cy * now\n for i = 0 to ((cast to int)(s).size())\n if first is a and second is b\n print Yes\n return to indicate successful execution\n end of the block\n if s[i] is U\n increment second\n else if s[i] is D\n decrement second\n else if s[i] is R\n increment first\n else\n decrement first\n if first is a and second is b\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n end of the block\n if cy\n t = integer with t = abs(b) \/ abs(cy)\n for now = t - 1000 to t + 1000\n if now < 0, continue next iteration\n first = long long with first = (cast to long long)cx * now\n second = long long with second = (cast to long long)cy * now\n for i = 0 to ((cast to int)(s).size())\n if first is a and second is b\n print Yes\n return to indicate successful execution\n end of the block\n if s[i] is U\n increment second\n else if s[i] is D\n decrement second\n else if s[i] is R\n increment first\n else\n decrement first\n if first is a and second is b\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n end of the block\n print No\nend of the block\n\n[CODE]:","reference_output":"string s;\nint a, b;\nint cx = 0, cy = 0;\nint main() {\n cin >> a >> b;\n cin >> s;\n for (int i = 0; i < ((int)(s).size()); ++i) {\n if (cx == a && cy == b) {\n cout << \"Yes\\n\";\n return 0;\n }\n if (s[i] == 'U')\n cy++;\n else if (s[i] == 'D')\n cy--;\n else if (s[i] == 'R')\n cx++;\n else\n cx--;\n if (cx == a && cy == b) {\n cout << \"Yes\\n\";\n return 0;\n }\n }\n if (cx) {\n int t = abs(a) \/ abs(cx);\n for (int now = t - 1000; now <= t + 1000; ++now) {\n if (now < 0) continue;\n long long first = (long long)cx * now;\n long long second = (long long)cy * now;\n for (int i = 0; i < ((int)(s).size()); ++i) {\n if (first == a && second == b) {\n cout << \"Yes\\n\";\n return 0;\n }\n if (s[i] == 'U')\n second++;\n else if (s[i] == 'D')\n second--;\n else if (s[i] == 'R')\n first++;\n else\n first--;\n if (first == a && second == b) {\n cout << \"Yes\\n\";\n return 0;\n }\n }\n }\n }\n if (cy) {\n int t = abs(b) \/ abs(cy);\n for (int now = t - 1000; now <= t + 1000; ++now) {\n if (now < 0) continue;\n long long first = (long long)cx * now;\n long long second = (long long)cy * now;\n for (int i = 0; i < ((int)(s).size()); ++i) {\n if (first == a && second == b) {\n cout << \"Yes\\n\";\n return 0;\n }\n if (s[i] == 'U')\n second++;\n else if (s[i] == 'D')\n second--;\n else if (s[i] == 'R')\n first++;\n else\n first--;\n if (first == a && second == b) {\n cout << \"Yes\\n\";\n return 0;\n }\n }\n }\n }\n cout << \"No\\n\";\n}","item":{"problem_id":"321A","pseudocode":"s = string\na, b = integer\ncx, cy = integers with cx = 0, cy = 0\ndefine the main function\n read a, b\n read s\n for i = 0 to ((cast to int)(s).size())\n if cx is a and cy is b\n print Yes\n return to indicate successful execution\n end of the block\n if s[i] is U\n increment cy\n else if s[i] is D\n cy decrement\n else if s[i] is R\n increment cx\n else\n decrement cx\n if cx is a and cy is b\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n if cx\n t = integer with t = abs(a) \/ abs(cx)\n for now = t - 1000 to t + 1000\n if now < 0, continue new iteration\n first = long long with first = (cast to long long)cx * now\n second = long long with second = (cast to long long)cy * now\n for i = 0 to ((cast to int)(s).size())\n if first is a and second is b\n print Yes\n return to indicate successful execution\n end of the block\n if s[i] is U\n increment second\n else if s[i] is D\n decrement second\n else if s[i] is R\n increment first\n else\n decrement first\n if first is a and second is b\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n end of the block\n if cy\n t = integer with t = abs(b) \/ abs(cy)\n for now = t - 1000 to t + 1000\n if now < 0, continue next iteration\n first = long long with first = (cast to long long)cx * now\n second = long long with second = (cast to long long)cy * now\n for i = 0 to ((cast to int)(s).size())\n if first is a and second is b\n print Yes\n return to indicate successful execution\n end of the block\n if s[i] is U\n increment second\n else if s[i] is D\n decrement second\n else if s[i] is R\n increment first\n else\n decrement first\n if first is a and second is b\n print Yes\n return to indicate successful execution\n end of the block\n end of the block\n end of the block\n end of the block\n print No\nend of the block","testcases":[[["2 2","RU"],["Yes"]],[["1 2","RU"],["No"]],[["-1 1000000000","LRRLU"],["Yes"]],[["0 0","D"],["Yes"]],[["0 0","UURRDL"],["Yes"]],[["987654321 987654321","UURRDL"],["Yes"]],[["4 2","UURRDL"],["No"]],[["4 3","UURRDL"],["Yes"]],[["4 4","UURRDL"],["Yes"]],[["4 6","UURRDL"],["Yes"]],[["4 7","UURRDL"],["No"]],[["1000000000 1000000000","UURRDL"],["Yes"]],[["-1 -1","UR"],["No"]],[["1 1","UURRDDLL"],["No"]],[["987654321 2","UURDD"],["Yes"]],[["0 123456789","RRULL"],["Yes"]],[["4 4","UUUURRRRDDDDLLLL"],["Yes"]],[["-491226083 -49122610","UDRLDURLDLLLDUDURLRDUUDDUUULUDRDRDUULURDRLLDDDLUDUURLUUDLLDULLLLDDLDDUU"],["Yes"]],[["-261597957 418556728","LLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL"],["Yes"]],[["-771928144 -3","RUDULULDRDLLLULDDUDDDDUDULRULRUULDDDURUDLUURULLLDLLDDRDDRLRURUULRUURRUDLDLDDRLLULRRDRRLLUULUDRUUDRRD"],["Yes"]],[["397346346 1","DDURRUURLDLRRLULD"],["Yes"]],[["-528551525 0","UDRLRRLDLDLURRRRULDLRLRLURUUDDLRLLDRRULLUDLURDLUUULLLRUUUDRRURLDUDULDDRDDDRDL"],["Yes"]],[["311692421 -129871846","LLLDURULDDDDUDDURRLUUDRLDDRDURDDRUDUURLUDUDLDRUDDDUUURDRRUDRDRDURLLDURUUDRLDLDURRRRRRDULURDRU"],["Yes"]],[["485940814 728911221","URURU"],["Yes"]],[["-843450986 632588242","LURLULULRUDUDULRDDLUL"],["Yes"]],[["647999516 -809999401","UDLDDLLULUDDLLDUULRRRDLUDDLDDLRLRRDRURURDRRDRULUDRDULRULLRRLLDDRLRRUDRURDUULUDLRRLRDR"],["Yes"]],[["352820537 -764444491","RDDUDLUDDUDLRRRDRRRDRRDUDUDDURLRRLDRLLRLLLLUULUDRURRDRLDDLLDRDURDUDRUDDLUDRLURUDRURDRDDLDRLDLDLLU"],["Yes"]],[["-284973644 -1","DLULLDLRUUDRR"],["Yes"]],[["356922591 -2","RRLDLDUDRUUUULUUDDULDDUDD"],["No"]],[["27033101 54066203","UDDDRDLLLRUUDDLRDLDRLRUDDULRLLRULR"],["No"]],[["-199335150 39867031","LLURRDUULRUDDRDUUULDLDRDDLURDRLDRLLLRRRRRULRRRUUDD"],["No"]],[["609504072 609504074","ULRLUDLDDR"],["No"]],[["497684357 829473929","RRLDUUURULURRLLRRLRLURRLDU"],["Yes"]],[["551922835 183974295","DUDUUULDRLRURRDULRRUDDLRLLUULLRLRDRDRR"],["No"]],[["825368095 -825368096","RD"],["No"]],[["-458990423 -229495204","DLLDDRLUDLRLUL"],["No"]],[["285102789 570205594","RRDULRULULRRDUURRLURUDDULLRDUL"],["No"]],[["109928480 219856920","LRURLRLURDRDLDRDLRDDUUDDLULDRRUUURRUDLLUULUUUR"],["No"]],[["-532674020 532674026","UURLLL"],["No"]],[["999999999 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["0 0","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["Yes"]],[["1 1","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["No"]],[["-1000000000 -1000000000","DLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL"],["Yes"]],[["3 3","UURR"],["No"]],[["-2 -2","UR"],["No"]],[["5 5","UDLR"],["No"]],[["0 -1","U"],["No"]],[["-1 0","R"],["No"]],[["1000000000 1000000000","URURURUR"],["Yes"]],[["-1 -1","RU"],["No"]],[["1 1","LD"],["No"]],[["-2 -2","UURR"],["No"]],[["1000000000 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["2 6","RUUUURLDDDL"],["Yes"]],[["0 1","LUUR"],["No"]],[["1 1","URDLDL"],["Yes"]],[["-10 -10","RU"],["No"]],[["1000000000 1000000000","RURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURU"],["Yes"]],[["-1000000000 -500000000","URR"],["No"]],[["-2 0","ULLLDDRRRR"],["Yes"]],[["999999999 -999999999","RRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLUUUUUUUUUUUUUUUUUUUUUUU"],["Yes"]],[["-100 -100","RU"],["No"]],[["100 100","RUL"],["No"]],[["0 1","UDLR"],["Yes"]],[["0 1","D"],["No"]],[["0 -3","RDDL"],["No"]]]}} +{"instance_id":"pseudo_to_code_2k_117","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet fx, fy, dx, dy ints, all with value 0\ndefine the main function\n read fx and fy\n let c a string\n read c\n if fx and fy are 0, print Yes and return 0\n for i = 0 to length of c exclusive\n if c[i] is u\n increment dy\n otherwise if c[i] is D\n decrement dy\n otherwise, if c[i] is L\n decrement dx\n otherwise\n increment dx\n end of the block\n for i = 0 to size of c exclusive\n let nx, ny ints with value 0\n for j = 0 to i inclusive\n if c[j] is U\n increment ny\n otherwise if c[j] is D\n decrement ny\n otherwise if c[j] is L\n decrement nx\n otherwise\n increment nx\n end of the block\n if nx equals fx and ny equals fy, print Yes and return 0\n let k1 and k2 be integers with value 0\n if dx is not 0, set k1 to (fx - nx) \/ dx\n if dy is not 0, set k2 = (fy - ny) \/ dy\n if dx is 0, set k1 equals k2\n if dy is 0, set k2 equals k1\n if k1 * dx + nx = fx and k2 * dy + ny = fy and k1 nonnegative, print Yes and return 0\n end of the block\n print No and return 0\nend of the block\n\n[CODE]:","reference_output":"int fx = 0, fy = 0, dx = 0, dy = 0;\nint main() {\n cin >> fx >> fy;\n string c;\n cin >> c;\n if (fx == 0 && fy == 0) return cout << \"Yes\" << endl, 0;\n for (int i = 0; i < c.size(); i++) {\n if (c[i] == 'U')\n dy++;\n else if (c[i] == 'D')\n dy--;\n else if (c[i] == 'L')\n dx--;\n else\n dx++;\n }\n for (int i = 0; i < c.size(); i++) {\n int nx = 0, ny = 0;\n for (int j = 0; j <= i; j++) {\n if (c[j] == 'U')\n ny++;\n else if (c[j] == 'D')\n ny--;\n else if (c[j] == 'L')\n nx--;\n else\n nx++;\n }\n if (nx == fx && ny == fy) return cout << \"Yes\" << endl, 0;\n int k1 = 0, k2 = 0;\n if (dx != 0) k1 = (fx - nx) \/ dx;\n if (dy != 0) k2 = (fy - ny) \/ dy;\n if (dx == 0) k1 = k2;\n if (dy == 0) k2 = k1;\n if (k1 * dx + nx == fx && k2 * dy + ny == fy && k1 == k2 && k1 >= 0) return cout << \"Yes\" << endl, 0;\n }\n return cout << \"No\" << endl, 0;\n}","item":{"problem_id":"321A","pseudocode":"let fx, fy, dx, dy ints, all with value 0\ndefine the main function\n read fx and fy\n let c a string\n read c\n if fx and fy are 0, print Yes and return 0\n for i = 0 to length of c exclusive\n if c[i] is u\n increment dy\n otherwise if c[i] is D\n decrement dy\n otherwise, if c[i] is L\n decrement dx\n otherwise\n increment dx\n end of the block\n for i = 0 to size of c exclusive\n let nx, ny ints with value 0\n for j = 0 to i inclusive\n if c[j] is U\n increment ny\n otherwise if c[j] is D\n decrement ny\n otherwise if c[j] is L\n decrement nx\n otherwise\n increment nx\n end of the block\n if nx equals fx and ny equals fy, print Yes and return 0\n let k1 and k2 be integers with value 0\n if dx is not 0, set k1 to (fx - nx) \/ dx\n if dy is not 0, set k2 = (fy - ny) \/ dy\n if dx is 0, set k1 equals k2\n if dy is 0, set k2 equals k1\n if k1 * dx + nx = fx and k2 * dy + ny = fy and k1 nonnegative, print Yes and return 0\n end of the block\n print No and return 0\nend of the block","testcases":[[["2 2","RU"],["Yes"]],[["1 2","RU"],["No"]],[["-1 1000000000","LRRLU"],["Yes"]],[["0 0","D"],["Yes"]],[["0 0","UURRDL"],["Yes"]],[["987654321 987654321","UURRDL"],["Yes"]],[["4 2","UURRDL"],["No"]],[["4 3","UURRDL"],["Yes"]],[["4 4","UURRDL"],["Yes"]],[["4 6","UURRDL"],["Yes"]],[["4 7","UURRDL"],["No"]],[["1000000000 1000000000","UURRDL"],["Yes"]],[["-1 -1","UR"],["No"]],[["1 1","UURRDDLL"],["No"]],[["987654321 2","UURDD"],["Yes"]],[["0 123456789","RRULL"],["Yes"]],[["4 4","UUUURRRRDDDDLLLL"],["Yes"]],[["-491226083 -49122610","UDRLDURLDLLLDUDURLRDUUDDUUULUDRDRDUULURDRLLDDDLUDUURLUUDLLDULLLLDDLDDUU"],["Yes"]],[["-261597957 418556728","LLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL"],["Yes"]],[["-771928144 -3","RUDULULDRDLLLULDDUDDDDUDULRULRUULDDDURUDLUURULLLDLLDDRDDRLRURUULRUURRUDLDLDDRLLULRRDRRLLUULUDRUUDRRD"],["Yes"]],[["397346346 1","DDURRUURLDLRRLULD"],["Yes"]],[["-528551525 0","UDRLRRLDLDLURRRRULDLRLRLURUUDDLRLLDRRULLUDLURDLUUULLLRUUUDRRURLDUDULDDRDDDRDL"],["Yes"]],[["311692421 -129871846","LLLDURULDDDDUDDURRLUUDRLDDRDURDDRUDUURLUDUDLDRUDDDUUURDRRUDRDRDURLLDURUUDRLDLDURRRRRRDULURDRU"],["Yes"]],[["485940814 728911221","URURU"],["Yes"]],[["-843450986 632588242","LURLULULRUDUDULRDDLUL"],["Yes"]],[["647999516 -809999401","UDLDDLLULUDDLLDUULRRRDLUDDLDDLRLRRDRURURDRRDRULUDRDULRULLRRLLDDRLRRUDRURDUULUDLRRLRDR"],["Yes"]],[["352820537 -764444491","RDDUDLUDDUDLRRRDRRRDRRDUDUDDURLRRLDRLLRLLLLUULUDRURRDRLDDLLDRDURDUDRUDDLUDRLURUDRURDRDDLDRLDLDLLU"],["Yes"]],[["-284973644 -1","DLULLDLRUUDRR"],["Yes"]],[["356922591 -2","RRLDLDUDRUUUULUUDDULDDUDD"],["No"]],[["27033101 54066203","UDDDRDLLLRUUDDLRDLDRLRUDDULRLLRULR"],["No"]],[["-199335150 39867031","LLURRDUULRUDDRDUUULDLDRDDLURDRLDRLLLRRRRRULRRRUUDD"],["No"]],[["609504072 609504074","ULRLUDLDDR"],["No"]],[["497684357 829473929","RRLDUUURULURRLLRRLRLURRLDU"],["Yes"]],[["551922835 183974295","DUDUUULDRLRURRDULRRUDDLRLLUULLRLRDRDRR"],["No"]],[["825368095 -825368096","RD"],["No"]],[["-458990423 -229495204","DLLDDRLUDLRLUL"],["No"]],[["285102789 570205594","RRDULRULULRRDUURRLURUDDULLRDUL"],["No"]],[["109928480 219856920","LRURLRLURDRDLDRDLRDDUUDDLULDRRUUURRUDLLUULUUUR"],["No"]],[["-532674020 532674026","UURLLL"],["No"]],[["999999999 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["0 0","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["Yes"]],[["1 1","UDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR"],["No"]],[["-1000000000 -1000000000","DLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL"],["Yes"]],[["3 3","UURR"],["No"]],[["-2 -2","UR"],["No"]],[["5 5","UDLR"],["No"]],[["0 -1","U"],["No"]],[["-1 0","R"],["No"]],[["1000000000 1000000000","URURURUR"],["Yes"]],[["-1 -1","RU"],["No"]],[["1 1","LD"],["No"]],[["-2 -2","UURR"],["No"]],[["1000000000 0","RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"],["Yes"]],[["2 6","RUUUURLDDDL"],["Yes"]],[["0 1","LUUR"],["No"]],[["1 1","URDLDL"],["Yes"]],[["-10 -10","RU"],["No"]],[["1000000000 1000000000","RURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURU"],["Yes"]],[["-1000000000 -500000000","URR"],["No"]],[["-2 0","ULLLDDRRRR"],["Yes"]],[["999999999 -999999999","RRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLUUUUUUUUUUUUUUUUUUUUUUU"],["Yes"]],[["-100 -100","RU"],["No"]],[["100 100","RUL"],["No"]],[["0 1","UDLR"],["Yes"]],[["0 1","D"],["No"]],[["0 -3","RDDL"],["No"]]]}} +{"instance_id":"pseudo_to_code_2k_118","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate long long vector prime of size 10000005 and value 0\ndeclare mM taking in long long ints a, b, and mod and returning long long\n create long long res = 0\n set a to a % mod\n while b is truthy\n if b & 1 is truthy, set res to (res + a) % mod\n set a to (2 * a) % mod\n move bits of b 1 place to the right\n end of the block\n return res\nend of the block\ndeclare fpow taking long long ints first, second, and p and returning long long integer\n set first to first % p\n make long long res = 1\n while second is truthy\n if second & 1 is truthy, set res to (res * first) % p\n set res to res % p\n if res is less than 0, set res to (res + p) % p\n set second to second >> 1\n set first to (first * first) % p\n if first is less than 0, set first to (first + p) % p\n set first to first % p\n end of the block\n return res\nend of the block\ndeclare inv taking in long long int n and returning long long\n return the result of fpow(n, 1000000007 - 2, 1000000007)\nend of the block\ndeclare modmul taking in long long ints first and second and returning long long\n return ((first % 1000000007) * (second % 1000000007)) % 1000000007\nend of the block\ndeclare modadd taking in long long ints first and second and returning long long integer\n create long long temp = first % 1000000007 + second % 1000000007\n set temp to temp % 1000000007\n if temp is less than 0, set temp to (temp + 1000000007) % 1000000007\n return temp\nend of the block\ndeclare sieve\n set prime[1] to 1\n for i = 2 to 10000005 exclusive\n if prime[i] is falsy\n for j = i to 10000005 exclusive\n if !prime[j] is truthy, set prime[j] to i\nend of the block\ndefine the main function\n create long long integer t\n set t to 1\n while t-- is truthy\n create long long integer n\n read n\n make string vector s of size n\n for i = 0 to n exclusive, read s[i]\n make string w\n create char tc\n read w and tc\n make long long vector check of size w.size() and value 0\n for i = 0 to n exclusive\n for j = 0 to w.size() exclusive\n create string s1 = w.substr(j, s[i].size())\n create bool ok = true\n if size of s1 is less than size of s[i]\n set ok to false\n else do\n make string temp = s[i]\n make all contents of temp lowercase\n make all content of s1 lowercase\n if s1 is not equal to temp, set ok to false\n end of the block\n if ok is truthy\n for k = j while k < j + s[i].size(), set check[k] to 1\n end of the block\n for i = 0 to w.size() exclusive\n if check[i] is truthy\n create char temp = w[i]\n if temp is greater than or equal to 'A' and temp is less than or equal to 'Z'\n set temp to temp - 'A'\n else do\n subtract 'a' from temp\n add 'a' to temp\n if temp is equal to tc and tc is equal to 'a'\n if w[i] is greater than or equal to 'a' and w[i] is less than or equal to 'z'\n set w[i] to 'b'\n else do\n set w[i] to 'B'\n else if temp is equal to tc and tc is not equal to 'a'\n if w[i] is greater than or equal to 'a' and w[i] is less than or equal to 'z'\n set w[i] to 'a'\n otherwise\n set w[i] to 'A'\n else\n if w[i] is greater than or equal to 'a' and w[i] is less than or equal to 'z'\n set w[i] to tc\n else do\n set w[i] to tc - 'a' + 'A'\n end of the block\n end of the block\n print w\n end of the block\nend of the block\n\n[CODE]:","reference_output":"vector prime(10000005, 0);\nlong long mM(long long a, long long b, long long mod) {\n long long res = 0;\n a %= mod;\n while (b) {\n if (b & 1) res = (res + a) % mod;\n a = (2 * a) % mod;\n b >>= 1;\n }\n return res;\n}\nlong long fpow(long long first, long long second, long long p) {\n first = first % p;\n long long res = 1;\n while (second) {\n if (second & 1) res = (res * first) % p;\n res %= p;\n if (res < 0) res = (res + p) % p;\n second = second >> 1;\n first = (first * first) % p;\n if (first < 0) first = (first + p) % p;\n first %= p;\n }\n return res;\n}\nlong long inv(long long n) {\n return fpow(n, 1000000007 - 2, 1000000007);\n}\nlong long modmul(long long first, long long second) {\n return ((first % 1000000007) * (second % 1000000007)) % 1000000007;\n}\nlong long modadd(long long first, long long second) {\n long long temp = first % 1000000007 + second % 1000000007;\n temp %= 1000000007;\n if (temp < 0) temp = (temp + 1000000007) % 1000000007;\n return temp;\n}\nvoid sieve() {\n prime[1] = 1;\n for (long long i = 2; i < 10000005; i++)\n if (!prime[i])\n for (long long j = i; j < 10000005; j += i)\n if (!prime[j]) prime[j] = i;\n}\nint main() {\n long long t;\n t = 1;\n while (t--) {\n long long n;\n cin >> n;\n vector s(n);\n for (int i = 0; i < n; i++) cin >> s[i];\n string w;\n char tc;\n cin >> w >> tc;\n vector check(w.size(), 0);\n for (int i = 0; i < n; i++)\n for (int j = 0; j < w.size(); j++) {\n string s1 = w.substr(j, s[i].size());\n bool ok = true;\n if (s1.size() < s[i].size())\n ok = false;\n else {\n string temp = s[i];\n transform(temp.begin(), temp.end(), temp.begin(), ::tolower);\n transform(s1.begin(), s1.end(), s1.begin(), ::tolower);\n if (s1 != temp) ok = false;\n }\n if (ok)\n for (int k = j; k < j + s[i].size(); k++) check[k] = 1;\n }\n for (int i = 0; i < w.size(); i++)\n if (check[i]) {\n char temp = w[i];\n if (temp >= 'A' && temp <= 'Z')\n temp -= 'A';\n else\n temp -= 'a';\n temp += 'a';\n if (temp == tc && tc == 'a') {\n if (w[i] >= 'a' && w[i] <= 'z')\n w[i] = 'b';\n else\n w[i] = 'B';\n } else if (temp == tc && tc != 'a') {\n if (w[i] >= 'a' && w[i] <= 'z')\n w[i] = 'a';\n else\n w[i] = 'A';\n } else {\n if (w[i] >= 'a' && w[i] <= 'z')\n w[i] = tc;\n else\n w[i] = tc - 'a' + 'A';\n }\n }\n cout << w << \"\\n\";\n }\n}","item":{"problem_id":"95A","pseudocode":"create long long vector prime of size 10000005 and value 0\ndeclare mM taking in long long ints a, b, and mod and returning long long\n create long long res = 0\n set a to a % mod\n while b is truthy\n if b & 1 is truthy, set res to (res + a) % mod\n set a to (2 * a) % mod\n move bits of b 1 place to the right\n end of the block\n return res\nend of the block\ndeclare fpow taking long long ints first, second, and p and returning long long integer\n set first to first % p\n make long long res = 1\n while second is truthy\n if second & 1 is truthy, set res to (res * first) % p\n set res to res % p\n if res is less than 0, set res to (res + p) % p\n set second to second >> 1\n set first to (first * first) % p\n if first is less than 0, set first to (first + p) % p\n set first to first % p\n end of the block\n return res\nend of the block\ndeclare inv taking in long long int n and returning long long\n return the result of fpow(n, 1000000007 - 2, 1000000007)\nend of the block\ndeclare modmul taking in long long ints first and second and returning long long\n return ((first % 1000000007) * (second % 1000000007)) % 1000000007\nend of the block\ndeclare modadd taking in long long ints first and second and returning long long integer\n create long long temp = first % 1000000007 + second % 1000000007\n set temp to temp % 1000000007\n if temp is less than 0, set temp to (temp + 1000000007) % 1000000007\n return temp\nend of the block\ndeclare sieve\n set prime[1] to 1\n for i = 2 to 10000005 exclusive\n if prime[i] is falsy\n for j = i to 10000005 exclusive\n if !prime[j] is truthy, set prime[j] to i\nend of the block\ndefine the main function\n create long long integer t\n set t to 1\n while t-- is truthy\n create long long integer n\n read n\n make string vector s of size n\n for i = 0 to n exclusive, read s[i]\n make string w\n create char tc\n read w and tc\n make long long vector check of size w.size() and value 0\n for i = 0 to n exclusive\n for j = 0 to w.size() exclusive\n create string s1 = w.substr(j, s[i].size())\n create bool ok = true\n if size of s1 is less than size of s[i]\n set ok to false\n else do\n make string temp = s[i]\n make all contents of temp lowercase\n make all content of s1 lowercase\n if s1 is not equal to temp, set ok to false\n end of the block\n if ok is truthy\n for k = j while k < j + s[i].size(), set check[k] to 1\n end of the block\n for i = 0 to w.size() exclusive\n if check[i] is truthy\n create char temp = w[i]\n if temp is greater than or equal to 'A' and temp is less than or equal to 'Z'\n set temp to temp - 'A'\n else do\n subtract 'a' from temp\n add 'a' to temp\n if temp is equal to tc and tc is equal to 'a'\n if w[i] is greater than or equal to 'a' and w[i] is less than or equal to 'z'\n set w[i] to 'b'\n else do\n set w[i] to 'B'\n else if temp is equal to tc and tc is not equal to 'a'\n if w[i] is greater than or equal to 'a' and w[i] is less than or equal to 'z'\n set w[i] to 'a'\n otherwise\n set w[i] to 'A'\n else\n if w[i] is greater than or equal to 'a' and w[i] is less than or equal to 'z'\n set w[i] to tc\n else do\n set w[i] to tc - 'a' + 'A'\n end of the block\n end of the block\n print w\n end of the block\nend of the block","testcases":[[["3","bers","ucky","elu","PetrLoveLuckyNumbers","t"],["PetrLovtTttttNumtttt"]],[["4","hello","party","abefglghjdhfgj","IVan","petrsmatchwin","a"],["petrsmatchwin"]],[["2","aCa","cba","abAcaba","c"],["abCacba"]],[["3","lol","hello","eho","PetrUnited","t"],["PetrUnited"]],[["2","trsd","dream","PetrsDreamOh","y"],["PeyyyYyyyyOh"]],[["1","PetrsDreamOh","PetrsDreamOh","h"],["HhhhhHhhhhHa"]],[["3","etr","ed","ied","PetrUnited","d"],["PdddUnitda"]],[["3","etr","ed","ied","PetrUnited","z"],["PzzzUnitzz"]],[["3","ab","Ba","aB","ABBA","a"],["BAAB"]],[["3","ab","Ba","aB","ABBAC","b"],["BAABC"]],[["7","a","b","g","k","e","t","t","A","a"],["B"]],[["4","Efron","Keyt","cesho","cool","CodeForcesHockeyTeam","p"],["CodeForpppPpcpppPeam"]],[["4","Efron","Keyt","cesho","cool","CodeForcesOldHockeyNewTeam","p"],["CodeForcesOldHockeyNewTeam"]],[["2","A","B","abababBabaBBaBBBBAaaaAAAAA","a"],["bababaAbabAAbAAAABbbbBBBBB"]],[["7","S","T","g","i","O","r","q","kljpfP","v"],["kljpfP"]],[["47","V","S","g","r","C","R","B","b","l","W","J","i","U","n","q","q","j","L","R","u","Q","C","f","C","U","u","x","h","q","E","Y","u","K","t","M","U","A","A","s","i","V","T","j","b","k","W","N","NlVwRlWzQQWoCI","z"],["ZzZzZzZzZZZoZZ"]],[["47","jw","L","xIp","W","I","aI","Ep","ylG","Ne","EglZ","oYkyo","wDuZK","DVh","uoAoF","GWj","t","P","uNQz","bPSg","eqru","xvll","O","mb","CM","wnmvv","YpFsq","FYID","c","r","rhbl","YseyB","RGcRj","hDtz","W","QlQWB","Y","ftSl","yPlAd","LPgVw","EIGOF","TQ","QrFcr","spu","K","IJ","fXUd","GhpV","DxUhKXELSLIiJMIOsbrpPQPXFwH","w"],["DxUhWXEWSWWwWMWWsbwwWQWXFaH"]],[["74","Pjc","ZcOWk","M","yMyp","cH","TzmX","A","Xgl","KVB","bljv","IH","u","nu","LdahF","t","O","Sv","uzFT","zfNd","UM","bXR","UQbXk","AA","gVmH","ng","F","K","HP","Iu","wrH","N","PnTIQ","kUY","yabHN","TA","vrgl","yxmsh","TrQ","X","vIbrl","Mfu","PfN","i","rH","t","Hl","Uwst","j","B","BiDCA","JcE","fd","bXuI","WWSU","rd","mj","t","IGrPe","Ql","xfoSV","o","WKdG","Tqeu","E","bZyg","bVqR","zY","ZD","hHpdP","jHww","lfU","gVem","t","BD","hUOfmkiMZhZxTuuiAyPuoutEQiPfZFSQVMMQxckAqtlRv","x"],["hXXxxxxXZhZaXxxxXyPxxxxXQxPxZXSQVXXQacxXqxlRv"]],[["74","ULa","n","vq","bybI","fCX","EEi","Sg","xj","IDz","fsP","M","GGjx","DpY","gffu","K","My","qbtz","k","bLNb","qET","N","BBY","x","KHUT","Uju","tyXI","o","ChXY","eia","R","akHR","g","ax","KyY","wpdl","CZA","smFl","LVDJ","O","xHF","W","TMZ","vN","qiT","g","I","PsR","sCJL","N","aSCi","JYD","P","A","M","T","G","gU","k","A","loT","EbP","Z","Eoo","Q","GGY","ZcbG","tvYl","M","czMR","j","e","lLjf","Y","zm","qifNoaopvznANCLmPpfToShyelsYSFllyQLUDYbcQ","g"],["ggfGggggvggGGCLgGgfGgShgglsGSFllgGLUDGbcG"]],[["74","M","LQ","H","cA","qj","D","nj","zD","jM","s","R","oC","Fh","lO","j","c","En","AB","sw","T","z","Eb","b","u","mj","MI","D","j","H","p","zD","V","R","vg","H","S","By","u","QP","B","dD","rI","JF","nA","sv","z","a","l","I","FJ","K","H","T","F","l","tC","g","s","Nl","Uj","u","A","OO","Ld","k","k","kM","LY","bn","v","fT","C","I","c","aeBolOleYgGmSLkFCPJPbQZUeodomjS","v"],["vvVovVveYvVvVVvVVVVVvQVVeovovvV"]],[["99","s","c","N","N","i","i","W","J","A","W","m","B","f","O","m","k","Q","f","x","p","l","H","H","o","n","C","K","R","s","T","J","v","C","Z","d","l","r","o","D","g","a","A","E","k","N","w","a","b","o","k","v","c","i","j","E","l","o","f","v","s","h","x","m","E","N","t","j","k","g","k","X","W","i","X","m","w","K","L","Q","r","j","f","o","w","v","S","o","H","e","L","L","d","P","r","g","z","z","q","d","BBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly","q"],["QQQQyQQQuQqqqqQYQqqqQQqQQqQQAquQAQqQQqy"]],[["77","Gw","Zw","qg","eO","mx","fE","qD","Vv","Rs","bd","wA","nh","Dm","bR","xV","we","KH","bl","Vy","aJ","Fr","NP","ir","xh","Fq","DG","Nh","dW","aG","km","NS","Om","yC","ts","Zt","EN","Fs","jA","vf","de","Da","AW","Bv","mO","Dk","Yj","fl","dj","JF","dI","hr","zk","am","LT","PJ","AQ","OW","WN","UG","TL","SZ","BK","Lp","jW","rY","PB","Rj","Bw","gl","lK","Wj","Pl","fx","YO","bX","SN","Pt","xPDCKNGWsNSlScKgBNEooOTnSuycVtvdToGmFoEfsUorvsSNcQIlaXRQqrfTZZoNvjutjhGpGXmNSQQWCzeHhMJAxclmiNnErpxH","h"],["xPDCKNHHhHHlScKgBNHhoOThHuhhVtvdToGmFoEhhUorvsHHcQIlaXRQqrfTZZoNvjutjhGpGXmHHQQWCzeHhMHHxclmiNnErphA"]],[["100","qn","BE","yN","ep","Pq","Xz","LM","EZ","db","Mn","bn","Fe","qA","zc","yq","pC","yA","Wk","Yq","rs","oD","vD","zW","xZ","bl","ur","kf","df","LS","UW","My","hR","sh","Nh","og","CW","or","zo","rO","ao","XH","Dq","Ka","lL","YQ","Oh","RZ","Ax","ta","ko","Dn","Ng","Ny","DB","YD","jO","Ap","FT","oB","Nc","wB","HO","eW","Ac","Dr","Mt","Df","bF","FP","Ra","nF","hF","XC","nG","an","ZY","uB","HP","OR","KN","Uv","Le","Ij","lH","Vw","jb","Xn","qu","Jo","zL","KW","LS","aV","Ls","BX","MY","oK","fh","gP","TB","pBWBEkqznLlZykhmPrfidzWbQMNDdBaDLykOfdvOZjKoUxCqKwJdGuhseuxaYcVyAGTSTwXYmKweRMUdbyfxssSNGLSAhckIknDj","d"],["pBDDDkqznDdDdkhmPrfiddDdQDDDaDaDLydDfdvOZjDdUdDqDdJdGuhseuxaYcVdDGTSTwXYmDdeRMUadyfxssSDDDDAhckIddDj"]],[["3","a","A","a","A","a"],["B"]],[["3","a","A","a","A","b"],["B"]],[["4","a","A","i","A","PetyaIsVeryCoolGuy","p"],["PetypPsVeryCoolGuy"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","c"],["CccanisexperiencingitsgreatestharcccccccccacCorldWarIItharcccccccccacCorldWarIItesthardshixper"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","a"],["AbaanisexperiencingitsgreatestharaaaaaaaaaaaAorldWarIItharaaaaaaaaaaaAorldWarIItesthardshixper"]],[["7","a","h","u","p","fgh","wyz","defghijkl","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaamnoaqrstavwxyz"]],[["9","a","h","u","p","z","fgh","wyz","defghijkl","ghijklmnopqrstu","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaaaaaaaaaaavwxya"]],[["3","ab","Ba","aB","ABBA","l"],["LLLL"]]]}} +{"instance_id":"pseudo_to_code_2k_119","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nfs = string vector\nvalid = long long integer array of size 200\ndefine the main function\n n,in = long long integers\n read n\n h,w,k = strings\n ch = char\n for i=0 to n exclusive\n read h\n transform the string h to lowercase\n add h to end of fs\n end of the block\n read w and ch\n if ch - 'a' >=0 or 'z' - ch >=0\n set in = ch - 'a'\n else do the following\n set in= ch= 'A'\n end of the block\n set k = w\n transform w to lower case\n for i=0 to n exclusive\n create long long integer z = length of fs[i]\n for j=0 to length of w exclusive\n create a empty string temp\n for k=j to j+z exclusive set temp = temp + w[k]\n if temp is equal to fs [i]\n for k=j to j+z exclusive set valid[k]=1\n end of the block\n end of the block\n create empty string res\n for i=0 to length of w exclusive\n if valid[i] is not 0\n if k[i] >= 'a' and k[i] <= 'z'\n if k[i] - 'a' is not equal to in\n set res = res + 'a' + in\n else do the following\n if ch > 'a' and ch <= 'z'\n set res = res + 'a'\n else if ch='a'\n set res = res + 'b'\n else ch > 'A' and ch <= 'Z'\n set res = res + 'a'\n else if ch = 'A' then do the following\n set res = res + 'b'\n end of the block\n else do the following\n if k[i] - 'A' is not equal to in\n set res = res + 'A' + in\n else do the following\n if ch > 'A' and ch <= 'Z'\n set res =res + 'A'\n else if ch = 'A\n set res = res + 'B'\n else if ch > 'a' and ch <= 'z'\n set res = res + 'A'\n else if ch = 'a' then do the following\n set res = res + 'B'\n end of the block\n end of the block\n else do the following\n set res = res + k[i]\n end of the block\n print res\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"vector fs;\nlong long int valid[200];\nint main() {\n long long int n, in;\n cin >> n;\n string h, w, k;\n char ch;\n for (int i = 0; i < n; i++) {\n cin >> h;\n transform(h.begin(), h.end(), h.begin(), ::tolower);\n fs.push_back(h);\n }\n cin >> w >> ch;\n if (ch - 'a' >= 0 && 'z' - ch >= 0) {\n in = ch - 'a';\n } else {\n in = ch = 'A';\n }\n k = w;\n transform(w.begin(), w.end(), w.begin(), ::tolower);\n for (int i = 0; i < n; i++) {\n long long int z = fs[i].length();\n for (int j = 0; j < w.length(); j++) {\n string temp = \"\";\n for (int k = j; k < j + z; k++) temp += w[k];\n if (temp == fs[i])\n for (int k = j; k < j + z; k++) valid[k] = 1;\n }\n }\n string res = \"\";\n for (int i = 0; i < w.length(); i++) {\n if (valid[i]) {\n if (k[i] >= 'a' && k[i] <= 'z') {\n if (k[i] - 'a' != in)\n res += 'a' + in;\n else {\n if (ch > 'a' && ch <= 'z') {\n res += 'a';\n } else if (ch == 'a')\n res += 'b';\n else if (ch > 'A' && ch <= 'Z') {\n res += 'a';\n } else if (ch == 'A')\n res += 'b';\n }\n } else {\n if (k[i] - 'A' != in)\n res += 'A' + in;\n else {\n if (ch > 'A' && ch <= 'Z') {\n res += 'A';\n } else if (ch == 'A')\n res += 'B';\n else if (ch > 'a' && ch <= 'z') {\n res += 'A';\n } else if (ch == 'a')\n res += 'B';\n }\n }\n } else\n res += k[i];\n }\n cout << res << endl;\n return 0;\n}","item":{"problem_id":"95A","pseudocode":"fs = string vector\nvalid = long long integer array of size 200\ndefine the main function\n n,in = long long integers\n read n\n h,w,k = strings\n ch = char\n for i=0 to n exclusive\n read h\n transform the string h to lowercase\n add h to end of fs\n end of the block\n read w and ch\n if ch - 'a' >=0 or 'z' - ch >=0\n set in = ch - 'a'\n else do the following\n set in= ch= 'A'\n end of the block\n set k = w\n transform w to lower case\n for i=0 to n exclusive\n create long long integer z = length of fs[i]\n for j=0 to length of w exclusive\n create a empty string temp\n for k=j to j+z exclusive set temp = temp + w[k]\n if temp is equal to fs [i]\n for k=j to j+z exclusive set valid[k]=1\n end of the block\n end of the block\n create empty string res\n for i=0 to length of w exclusive\n if valid[i] is not 0\n if k[i] >= 'a' and k[i] <= 'z'\n if k[i] - 'a' is not equal to in\n set res = res + 'a' + in\n else do the following\n if ch > 'a' and ch <= 'z'\n set res = res + 'a'\n else if ch='a'\n set res = res + 'b'\n else ch > 'A' and ch <= 'Z'\n set res = res + 'a'\n else if ch = 'A' then do the following\n set res = res + 'b'\n end of the block\n else do the following\n if k[i] - 'A' is not equal to in\n set res = res + 'A' + in\n else do the following\n if ch > 'A' and ch <= 'Z'\n set res =res + 'A'\n else if ch = 'A\n set res = res + 'B'\n else if ch > 'a' and ch <= 'z'\n set res = res + 'A'\n else if ch = 'a' then do the following\n set res = res + 'B'\n end of the block\n end of the block\n else do the following\n set res = res + k[i]\n end of the block\n print res\n return to indicate successful execution\nend of the block","testcases":[[["3","bers","ucky","elu","PetrLoveLuckyNumbers","t"],["PetrLovtTttttNumtttt"]],[["4","hello","party","abefglghjdhfgj","IVan","petrsmatchwin","a"],["petrsmatchwin"]],[["2","aCa","cba","abAcaba","c"],["abCacba"]],[["3","lol","hello","eho","PetrUnited","t"],["PetrUnited"]],[["2","trsd","dream","PetrsDreamOh","y"],["PeyyyYyyyyOh"]],[["1","PetrsDreamOh","PetrsDreamOh","h"],["HhhhhHhhhhHa"]],[["3","etr","ed","ied","PetrUnited","d"],["PdddUnitda"]],[["3","etr","ed","ied","PetrUnited","z"],["PzzzUnitzz"]],[["3","ab","Ba","aB","ABBA","a"],["BAAB"]],[["3","ab","Ba","aB","ABBAC","b"],["BAABC"]],[["7","a","b","g","k","e","t","t","A","a"],["B"]],[["4","Efron","Keyt","cesho","cool","CodeForcesHockeyTeam","p"],["CodeForpppPpcpppPeam"]],[["4","Efron","Keyt","cesho","cool","CodeForcesOldHockeyNewTeam","p"],["CodeForcesOldHockeyNewTeam"]],[["2","A","B","abababBabaBBaBBBBAaaaAAAAA","a"],["bababaAbabAAbAAAABbbbBBBBB"]],[["7","S","T","g","i","O","r","q","kljpfP","v"],["kljpfP"]],[["47","V","S","g","r","C","R","B","b","l","W","J","i","U","n","q","q","j","L","R","u","Q","C","f","C","U","u","x","h","q","E","Y","u","K","t","M","U","A","A","s","i","V","T","j","b","k","W","N","NlVwRlWzQQWoCI","z"],["ZzZzZzZzZZZoZZ"]],[["47","jw","L","xIp","W","I","aI","Ep","ylG","Ne","EglZ","oYkyo","wDuZK","DVh","uoAoF","GWj","t","P","uNQz","bPSg","eqru","xvll","O","mb","CM","wnmvv","YpFsq","FYID","c","r","rhbl","YseyB","RGcRj","hDtz","W","QlQWB","Y","ftSl","yPlAd","LPgVw","EIGOF","TQ","QrFcr","spu","K","IJ","fXUd","GhpV","DxUhKXELSLIiJMIOsbrpPQPXFwH","w"],["DxUhWXEWSWWwWMWWsbwwWQWXFaH"]],[["74","Pjc","ZcOWk","M","yMyp","cH","TzmX","A","Xgl","KVB","bljv","IH","u","nu","LdahF","t","O","Sv","uzFT","zfNd","UM","bXR","UQbXk","AA","gVmH","ng","F","K","HP","Iu","wrH","N","PnTIQ","kUY","yabHN","TA","vrgl","yxmsh","TrQ","X","vIbrl","Mfu","PfN","i","rH","t","Hl","Uwst","j","B","BiDCA","JcE","fd","bXuI","WWSU","rd","mj","t","IGrPe","Ql","xfoSV","o","WKdG","Tqeu","E","bZyg","bVqR","zY","ZD","hHpdP","jHww","lfU","gVem","t","BD","hUOfmkiMZhZxTuuiAyPuoutEQiPfZFSQVMMQxckAqtlRv","x"],["hXXxxxxXZhZaXxxxXyPxxxxXQxPxZXSQVXXQacxXqxlRv"]],[["74","ULa","n","vq","bybI","fCX","EEi","Sg","xj","IDz","fsP","M","GGjx","DpY","gffu","K","My","qbtz","k","bLNb","qET","N","BBY","x","KHUT","Uju","tyXI","o","ChXY","eia","R","akHR","g","ax","KyY","wpdl","CZA","smFl","LVDJ","O","xHF","W","TMZ","vN","qiT","g","I","PsR","sCJL","N","aSCi","JYD","P","A","M","T","G","gU","k","A","loT","EbP","Z","Eoo","Q","GGY","ZcbG","tvYl","M","czMR","j","e","lLjf","Y","zm","qifNoaopvznANCLmPpfToShyelsYSFllyQLUDYbcQ","g"],["ggfGggggvggGGCLgGgfGgShgglsGSFllgGLUDGbcG"]],[["74","M","LQ","H","cA","qj","D","nj","zD","jM","s","R","oC","Fh","lO","j","c","En","AB","sw","T","z","Eb","b","u","mj","MI","D","j","H","p","zD","V","R","vg","H","S","By","u","QP","B","dD","rI","JF","nA","sv","z","a","l","I","FJ","K","H","T","F","l","tC","g","s","Nl","Uj","u","A","OO","Ld","k","k","kM","LY","bn","v","fT","C","I","c","aeBolOleYgGmSLkFCPJPbQZUeodomjS","v"],["vvVovVveYvVvVVvVVVVVvQVVeovovvV"]],[["99","s","c","N","N","i","i","W","J","A","W","m","B","f","O","m","k","Q","f","x","p","l","H","H","o","n","C","K","R","s","T","J","v","C","Z","d","l","r","o","D","g","a","A","E","k","N","w","a","b","o","k","v","c","i","j","E","l","o","f","v","s","h","x","m","E","N","t","j","k","g","k","X","W","i","X","m","w","K","L","Q","r","j","f","o","w","v","S","o","H","e","L","L","d","P","r","g","z","z","q","d","BBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly","q"],["QQQQyQQQuQqqqqQYQqqqQQqQQqQQAquQAQqQQqy"]],[["77","Gw","Zw","qg","eO","mx","fE","qD","Vv","Rs","bd","wA","nh","Dm","bR","xV","we","KH","bl","Vy","aJ","Fr","NP","ir","xh","Fq","DG","Nh","dW","aG","km","NS","Om","yC","ts","Zt","EN","Fs","jA","vf","de","Da","AW","Bv","mO","Dk","Yj","fl","dj","JF","dI","hr","zk","am","LT","PJ","AQ","OW","WN","UG","TL","SZ","BK","Lp","jW","rY","PB","Rj","Bw","gl","lK","Wj","Pl","fx","YO","bX","SN","Pt","xPDCKNGWsNSlScKgBNEooOTnSuycVtvdToGmFoEfsUorvsSNcQIlaXRQqrfTZZoNvjutjhGpGXmNSQQWCzeHhMJAxclmiNnErpxH","h"],["xPDCKNHHhHHlScKgBNHhoOThHuhhVtvdToGmFoEhhUorvsHHcQIlaXRQqrfTZZoNvjutjhGpGXmHHQQWCzeHhMHHxclmiNnErphA"]],[["100","qn","BE","yN","ep","Pq","Xz","LM","EZ","db","Mn","bn","Fe","qA","zc","yq","pC","yA","Wk","Yq","rs","oD","vD","zW","xZ","bl","ur","kf","df","LS","UW","My","hR","sh","Nh","og","CW","or","zo","rO","ao","XH","Dq","Ka","lL","YQ","Oh","RZ","Ax","ta","ko","Dn","Ng","Ny","DB","YD","jO","Ap","FT","oB","Nc","wB","HO","eW","Ac","Dr","Mt","Df","bF","FP","Ra","nF","hF","XC","nG","an","ZY","uB","HP","OR","KN","Uv","Le","Ij","lH","Vw","jb","Xn","qu","Jo","zL","KW","LS","aV","Ls","BX","MY","oK","fh","gP","TB","pBWBEkqznLlZykhmPrfidzWbQMNDdBaDLykOfdvOZjKoUxCqKwJdGuhseuxaYcVyAGTSTwXYmKweRMUdbyfxssSNGLSAhckIknDj","d"],["pBDDDkqznDdDdkhmPrfiddDdQDDDaDaDLydDfdvOZjDdUdDqDdJdGuhseuxaYcVdDGTSTwXYmDdeRMUadyfxssSDDDDAhckIddDj"]],[["3","a","A","a","A","a"],["B"]],[["3","a","A","a","A","b"],["B"]],[["4","a","A","i","A","PetyaIsVeryCoolGuy","p"],["PetypPsVeryCoolGuy"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","c"],["CccanisexperiencingitsgreatestharcccccccccacCorldWarIItharcccccccccacCorldWarIItesthardshixper"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","a"],["AbaanisexperiencingitsgreatestharaaaaaaaaaaaAorldWarIItharaaaaaaaaaaaAorldWarIItesthardshixper"]],[["7","a","h","u","p","fgh","wyz","defghijkl","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaamnoaqrstavwxyz"]],[["9","a","h","u","p","z","fgh","wyz","defghijkl","ghijklmnopqrstu","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaaaaaaaaaaavwxya"]],[["3","ab","Ba","aB","ABBA","l"],["LLLL"]]]}} +{"instance_id":"pseudo_to_code_2k_120","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nMAXN = const int with MAXN = 200\nbad = string, bool map\nchange = bool array of size MAXN\ndefine the main function\n n = int\n read n\n for i = 0 to n\n s = string\n read s\n for t = 0 to length of s\n if s[t] >= 'A' and s[t] <= 'Z' set s[t] to 'a' + s[t] - 'A'\n set bad[s] to true\n end of the block\n u = string\n lucky = char\n read u then lucky\n for i = 0 to length of u\n cur = string\n for t = i to length of u\n increment cur by (u[t] - 'A' + 'a') as char if u[t] >= 'A' and u[t] <= 'Z' else u[t]\n if bad[cur]\n for j = i to t inclusive set change[j] to true\n end of the block\n end of the block\n for i = 0 to length of u\n if change[i]\n if u[i] is lucky\n if lucky is 'a'\n set u[i] to 'b'\n else\n set u[i] to 'a'\n else if u[i] - 'A' + 'a' is lucky\n if lucky is 'a'\n set u[i] to 'B'\n else\n set u[i] to 'A'\n else if u[i] >= 'A' and u[i] <= 'Z'\n set u[i] to lucky - 'a' + 'A'\n else\n set u[i] to lucky\n print u\nend of the block\n\n[CODE]:","reference_output":"const int MAXN = 200;\nmap bad;\nbool change[MAXN];\nint main() {\n int n;\n cin >> n;\n for (int i = 0; i < n; i++) {\n string s;\n cin >> s;\n for (int t = 0; t < s.length(); t++)\n if (s[t] >= 'A' && s[t] <= 'Z') s[t] = 'a' + s[t] - 'A';\n bad[s] = true;\n }\n string u;\n char lucky;\n cin >> u >> lucky;\n for (int i = 0; i < u.length(); i++) {\n string cur;\n for (int t = i; t < u.length(); t++) {\n cur += ((u[t] >= 'A' && u[t] <= 'Z') ? (char)(u[t] - 'A' + 'a') : u[t]);\n if (bad[cur])\n for (int j = i; j <= t; j++) change[j] = true;\n }\n }\n for (int i = 0; i < u.length(); i++)\n if (change[i])\n if (u[i] == lucky)\n if (lucky == 'a')\n u[i] = 'b';\n else\n u[i] = 'a';\n else if (u[i] - 'A' + 'a' == lucky)\n if (lucky == 'a')\n u[i] = 'B';\n else\n u[i] = 'A';\n else if (u[i] >= 'A' && u[i] <= 'Z')\n u[i] = lucky - 'a' + 'A';\n else\n u[i] = lucky;\n cout << u << \"\\n\";\n}","item":{"problem_id":"95A","pseudocode":"MAXN = const int with MAXN = 200\nbad = string, bool map\nchange = bool array of size MAXN\ndefine the main function\n n = int\n read n\n for i = 0 to n\n s = string\n read s\n for t = 0 to length of s\n if s[t] >= 'A' and s[t] <= 'Z' set s[t] to 'a' + s[t] - 'A'\n set bad[s] to true\n end of the block\n u = string\n lucky = char\n read u then lucky\n for i = 0 to length of u\n cur = string\n for t = i to length of u\n increment cur by (u[t] - 'A' + 'a') as char if u[t] >= 'A' and u[t] <= 'Z' else u[t]\n if bad[cur]\n for j = i to t inclusive set change[j] to true\n end of the block\n end of the block\n for i = 0 to length of u\n if change[i]\n if u[i] is lucky\n if lucky is 'a'\n set u[i] to 'b'\n else\n set u[i] to 'a'\n else if u[i] - 'A' + 'a' is lucky\n if lucky is 'a'\n set u[i] to 'B'\n else\n set u[i] to 'A'\n else if u[i] >= 'A' and u[i] <= 'Z'\n set u[i] to lucky - 'a' + 'A'\n else\n set u[i] to lucky\n print u\nend of the block","testcases":[[["3","bers","ucky","elu","PetrLoveLuckyNumbers","t"],["PetrLovtTttttNumtttt"]],[["4","hello","party","abefglghjdhfgj","IVan","petrsmatchwin","a"],["petrsmatchwin"]],[["2","aCa","cba","abAcaba","c"],["abCacba"]],[["3","lol","hello","eho","PetrUnited","t"],["PetrUnited"]],[["2","trsd","dream","PetrsDreamOh","y"],["PeyyyYyyyyOh"]],[["1","PetrsDreamOh","PetrsDreamOh","h"],["HhhhhHhhhhHa"]],[["3","etr","ed","ied","PetrUnited","d"],["PdddUnitda"]],[["3","etr","ed","ied","PetrUnited","z"],["PzzzUnitzz"]],[["3","ab","Ba","aB","ABBA","a"],["BAAB"]],[["3","ab","Ba","aB","ABBAC","b"],["BAABC"]],[["7","a","b","g","k","e","t","t","A","a"],["B"]],[["4","Efron","Keyt","cesho","cool","CodeForcesHockeyTeam","p"],["CodeForpppPpcpppPeam"]],[["4","Efron","Keyt","cesho","cool","CodeForcesOldHockeyNewTeam","p"],["CodeForcesOldHockeyNewTeam"]],[["2","A","B","abababBabaBBaBBBBAaaaAAAAA","a"],["bababaAbabAAbAAAABbbbBBBBB"]],[["7","S","T","g","i","O","r","q","kljpfP","v"],["kljpfP"]],[["47","V","S","g","r","C","R","B","b","l","W","J","i","U","n","q","q","j","L","R","u","Q","C","f","C","U","u","x","h","q","E","Y","u","K","t","M","U","A","A","s","i","V","T","j","b","k","W","N","NlVwRlWzQQWoCI","z"],["ZzZzZzZzZZZoZZ"]],[["47","jw","L","xIp","W","I","aI","Ep","ylG","Ne","EglZ","oYkyo","wDuZK","DVh","uoAoF","GWj","t","P","uNQz","bPSg","eqru","xvll","O","mb","CM","wnmvv","YpFsq","FYID","c","r","rhbl","YseyB","RGcRj","hDtz","W","QlQWB","Y","ftSl","yPlAd","LPgVw","EIGOF","TQ","QrFcr","spu","K","IJ","fXUd","GhpV","DxUhKXELSLIiJMIOsbrpPQPXFwH","w"],["DxUhWXEWSWWwWMWWsbwwWQWXFaH"]],[["74","Pjc","ZcOWk","M","yMyp","cH","TzmX","A","Xgl","KVB","bljv","IH","u","nu","LdahF","t","O","Sv","uzFT","zfNd","UM","bXR","UQbXk","AA","gVmH","ng","F","K","HP","Iu","wrH","N","PnTIQ","kUY","yabHN","TA","vrgl","yxmsh","TrQ","X","vIbrl","Mfu","PfN","i","rH","t","Hl","Uwst","j","B","BiDCA","JcE","fd","bXuI","WWSU","rd","mj","t","IGrPe","Ql","xfoSV","o","WKdG","Tqeu","E","bZyg","bVqR","zY","ZD","hHpdP","jHww","lfU","gVem","t","BD","hUOfmkiMZhZxTuuiAyPuoutEQiPfZFSQVMMQxckAqtlRv","x"],["hXXxxxxXZhZaXxxxXyPxxxxXQxPxZXSQVXXQacxXqxlRv"]],[["74","ULa","n","vq","bybI","fCX","EEi","Sg","xj","IDz","fsP","M","GGjx","DpY","gffu","K","My","qbtz","k","bLNb","qET","N","BBY","x","KHUT","Uju","tyXI","o","ChXY","eia","R","akHR","g","ax","KyY","wpdl","CZA","smFl","LVDJ","O","xHF","W","TMZ","vN","qiT","g","I","PsR","sCJL","N","aSCi","JYD","P","A","M","T","G","gU","k","A","loT","EbP","Z","Eoo","Q","GGY","ZcbG","tvYl","M","czMR","j","e","lLjf","Y","zm","qifNoaopvznANCLmPpfToShyelsYSFllyQLUDYbcQ","g"],["ggfGggggvggGGCLgGgfGgShgglsGSFllgGLUDGbcG"]],[["74","M","LQ","H","cA","qj","D","nj","zD","jM","s","R","oC","Fh","lO","j","c","En","AB","sw","T","z","Eb","b","u","mj","MI","D","j","H","p","zD","V","R","vg","H","S","By","u","QP","B","dD","rI","JF","nA","sv","z","a","l","I","FJ","K","H","T","F","l","tC","g","s","Nl","Uj","u","A","OO","Ld","k","k","kM","LY","bn","v","fT","C","I","c","aeBolOleYgGmSLkFCPJPbQZUeodomjS","v"],["vvVovVveYvVvVVvVVVVVvQVVeovovvV"]],[["99","s","c","N","N","i","i","W","J","A","W","m","B","f","O","m","k","Q","f","x","p","l","H","H","o","n","C","K","R","s","T","J","v","C","Z","d","l","r","o","D","g","a","A","E","k","N","w","a","b","o","k","v","c","i","j","E","l","o","f","v","s","h","x","m","E","N","t","j","k","g","k","X","W","i","X","m","w","K","L","Q","r","j","f","o","w","v","S","o","H","e","L","L","d","P","r","g","z","z","q","d","BBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly","q"],["QQQQyQQQuQqqqqQYQqqqQQqQQqQQAquQAQqQQqy"]],[["77","Gw","Zw","qg","eO","mx","fE","qD","Vv","Rs","bd","wA","nh","Dm","bR","xV","we","KH","bl","Vy","aJ","Fr","NP","ir","xh","Fq","DG","Nh","dW","aG","km","NS","Om","yC","ts","Zt","EN","Fs","jA","vf","de","Da","AW","Bv","mO","Dk","Yj","fl","dj","JF","dI","hr","zk","am","LT","PJ","AQ","OW","WN","UG","TL","SZ","BK","Lp","jW","rY","PB","Rj","Bw","gl","lK","Wj","Pl","fx","YO","bX","SN","Pt","xPDCKNGWsNSlScKgBNEooOTnSuycVtvdToGmFoEfsUorvsSNcQIlaXRQqrfTZZoNvjutjhGpGXmNSQQWCzeHhMJAxclmiNnErpxH","h"],["xPDCKNHHhHHlScKgBNHhoOThHuhhVtvdToGmFoEhhUorvsHHcQIlaXRQqrfTZZoNvjutjhGpGXmHHQQWCzeHhMHHxclmiNnErphA"]],[["100","qn","BE","yN","ep","Pq","Xz","LM","EZ","db","Mn","bn","Fe","qA","zc","yq","pC","yA","Wk","Yq","rs","oD","vD","zW","xZ","bl","ur","kf","df","LS","UW","My","hR","sh","Nh","og","CW","or","zo","rO","ao","XH","Dq","Ka","lL","YQ","Oh","RZ","Ax","ta","ko","Dn","Ng","Ny","DB","YD","jO","Ap","FT","oB","Nc","wB","HO","eW","Ac","Dr","Mt","Df","bF","FP","Ra","nF","hF","XC","nG","an","ZY","uB","HP","OR","KN","Uv","Le","Ij","lH","Vw","jb","Xn","qu","Jo","zL","KW","LS","aV","Ls","BX","MY","oK","fh","gP","TB","pBWBEkqznLlZykhmPrfidzWbQMNDdBaDLykOfdvOZjKoUxCqKwJdGuhseuxaYcVyAGTSTwXYmKweRMUdbyfxssSNGLSAhckIknDj","d"],["pBDDDkqznDdDdkhmPrfiddDdQDDDaDaDLydDfdvOZjDdUdDqDdJdGuhseuxaYcVdDGTSTwXYmDdeRMUadyfxssSDDDDAhckIddDj"]],[["3","a","A","a","A","a"],["B"]],[["3","a","A","a","A","b"],["B"]],[["4","a","A","i","A","PetyaIsVeryCoolGuy","p"],["PetypPsVeryCoolGuy"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","c"],["CccanisexperiencingitsgreatestharcccccccccacCorldWarIItharcccccccccacCorldWarIItesthardshixper"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","a"],["AbaanisexperiencingitsgreatestharaaaaaaaaaaaAorldWarIItharaaaaaaaaaaaAorldWarIItesthardshixper"]],[["7","a","h","u","p","fgh","wyz","defghijkl","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaamnoaqrstavwxyz"]],[["9","a","h","u","p","z","fgh","wyz","defghijkl","ghijklmnopqrstu","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaaaaaaaaaaavwxya"]],[["3","ab","Ba","aB","ABBA","l"],["LLLL"]]]}} +{"instance_id":"pseudo_to_code_2k_121","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n n = integer\n read n\n forbid = vector of string\n for i = 0 to n exclusive\n s = string\n read s\n s1 = string with s1 = \"\"\n for j = 0 to s.size() exclusive\n a = character with a = s[j]\n if (a <= Z), a = a - A + a\n s1 = s1 + a\n end of the block\n append s1 to forbid\n end of the block\n occur = vector integer array of size 100\n s = string\n read s\n s1 = string with s1 = \"\"\n for j = 0 to s.size() exclusive\n a = character with a = s[j]\n if (a <= Z), a = a - A + a\n s1 = s1 + a\n end of the block\n for i = 0 to n exclusive\n copy = string with copy = s1\n pre = integer with pre = 0\n while (copy.size() > 0 and copy.find(forbid[i]) is not npos string)\n append copy.find(forbid[i]) + pre to occur[i]\n pre = pre + copy.find(forbid[i]) + 1\n copy = copy.substr(copy.find(forbid[i]) + 1)\n end of the block\n end of the block\n letter = character\n read letter\n first = bool array of size 100\n important = integer array of size 100\n set all contents of first to true\n set all contents of important to 0\n for i = 0 to n exclusive\n for j = 0 to occur[i].size() exclusive\n for k = 0 to occur[i][j] + k < s.size() and k < forbid[i].size()\n if (first[occur[i][j] + k])\n first[occur[i][j] + k] = false\n if (s[occur[i][j] + k] is letter)\n important[occur[i][j] + k] = 1\n else if (s[occur[i][j] + k] is letter - a + A)\n important[occur[i][j] + k] = 2\n end of the block\n end of the block\n if (s[occur[i][j] + k] <= Z)\n s[occur[i][j] + k] = letter - a + A\n else\n s[occur[i][j] + k] = letter\n end of the block\n end of the block\n end of the block\n for i = 0 to s.size() exclusive\n c1 = character with c1 = a\n if (letter is a), c1 = b\n if (important[i] is 1)\n s[i] = c1\n else if (important[i] is 2)\n s[i] = c1 - a + A\n end of the block\n end of the block\n print s\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int n;\n cin >> n;\n vector forbid;\n for (int i = 0; i < n; i++) {\n string s;\n cin >> s;\n string s1 = \"\";\n for (int j = 0; j < s.size(); j++) {\n char a = s[j];\n if (a <= 'Z') a = a - 'A' + 'a';\n s1 += a;\n }\n forbid.push_back(s1);\n }\n vector occur[100];\n string s;\n cin >> s;\n string s1 = \"\";\n for (int j = 0; j < s.size(); j++) {\n char a = s[j];\n if (a <= 'Z') a = a - 'A' + 'a';\n s1 += a;\n }\n for (int i = 0; i < n; i++) {\n string copy = s1;\n int pre = 0;\n while (copy.size() > 0 && copy.find(forbid[i]) != string::npos) {\n occur[i].push_back(copy.find(forbid[i]) + pre);\n pre += copy.find(forbid[i]) + 1;\n copy = copy.substr(copy.find(forbid[i]) + 1);\n }\n }\n char letter;\n cin >> letter;\n bool first[100];\n int important[100];\n memset(first, true, sizeof(first));\n memset(important, 0, sizeof(important));\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < occur[i].size(); j++) {\n for (int k = 0; occur[i][j] + k < s.size() && k < forbid[i].size(); k++) {\n if (first[occur[i][j] + k]) {\n first[occur[i][j] + k] = false;\n if (s[occur[i][j] + k] == letter) {\n important[occur[i][j] + k] = 1;\n } else if (s[occur[i][j] + k] == letter - 'a' + 'A') {\n important[occur[i][j] + k] = 2;\n }\n }\n if (s[occur[i][j] + k] <= 'Z')\n s[occur[i][j] + k] = letter - 'a' + 'A';\n else\n s[occur[i][j] + k] = letter;\n }\n }\n }\n for (int i = 0; i < s.size(); i++) {\n char c1 = 'a';\n if (letter == 'a') c1 = 'b';\n if (important[i] == 1) {\n s[i] = c1;\n } else if (important[i] == 2) {\n s[i] = c1 - 'a' + 'A';\n }\n }\n cout << s << endl;\n return 0;\n}","item":{"problem_id":"95A","pseudocode":"define the main function\n n = integer\n read n\n forbid = vector of string\n for i = 0 to n exclusive\n s = string\n read s\n s1 = string with s1 = \"\"\n for j = 0 to s.size() exclusive\n a = character with a = s[j]\n if (a <= Z), a = a - A + a\n s1 = s1 + a\n end of the block\n append s1 to forbid\n end of the block\n occur = vector integer array of size 100\n s = string\n read s\n s1 = string with s1 = \"\"\n for j = 0 to s.size() exclusive\n a = character with a = s[j]\n if (a <= Z), a = a - A + a\n s1 = s1 + a\n end of the block\n for i = 0 to n exclusive\n copy = string with copy = s1\n pre = integer with pre = 0\n while (copy.size() > 0 and copy.find(forbid[i]) is not npos string)\n append copy.find(forbid[i]) + pre to occur[i]\n pre = pre + copy.find(forbid[i]) + 1\n copy = copy.substr(copy.find(forbid[i]) + 1)\n end of the block\n end of the block\n letter = character\n read letter\n first = bool array of size 100\n important = integer array of size 100\n set all contents of first to true\n set all contents of important to 0\n for i = 0 to n exclusive\n for j = 0 to occur[i].size() exclusive\n for k = 0 to occur[i][j] + k < s.size() and k < forbid[i].size()\n if (first[occur[i][j] + k])\n first[occur[i][j] + k] = false\n if (s[occur[i][j] + k] is letter)\n important[occur[i][j] + k] = 1\n else if (s[occur[i][j] + k] is letter - a + A)\n important[occur[i][j] + k] = 2\n end of the block\n end of the block\n if (s[occur[i][j] + k] <= Z)\n s[occur[i][j] + k] = letter - a + A\n else\n s[occur[i][j] + k] = letter\n end of the block\n end of the block\n end of the block\n for i = 0 to s.size() exclusive\n c1 = character with c1 = a\n if (letter is a), c1 = b\n if (important[i] is 1)\n s[i] = c1\n else if (important[i] is 2)\n s[i] = c1 - a + A\n end of the block\n end of the block\n print s\n return to indicate successful execution\nend of the block","testcases":[[["3","bers","ucky","elu","PetrLoveLuckyNumbers","t"],["PetrLovtTttttNumtttt"]],[["4","hello","party","abefglghjdhfgj","IVan","petrsmatchwin","a"],["petrsmatchwin"]],[["2","aCa","cba","abAcaba","c"],["abCacba"]],[["3","lol","hello","eho","PetrUnited","t"],["PetrUnited"]],[["2","trsd","dream","PetrsDreamOh","y"],["PeyyyYyyyyOh"]],[["1","PetrsDreamOh","PetrsDreamOh","h"],["HhhhhHhhhhHa"]],[["3","etr","ed","ied","PetrUnited","d"],["PdddUnitda"]],[["3","etr","ed","ied","PetrUnited","z"],["PzzzUnitzz"]],[["3","ab","Ba","aB","ABBA","a"],["BAAB"]],[["3","ab","Ba","aB","ABBAC","b"],["BAABC"]],[["7","a","b","g","k","e","t","t","A","a"],["B"]],[["4","Efron","Keyt","cesho","cool","CodeForcesHockeyTeam","p"],["CodeForpppPpcpppPeam"]],[["4","Efron","Keyt","cesho","cool","CodeForcesOldHockeyNewTeam","p"],["CodeForcesOldHockeyNewTeam"]],[["2","A","B","abababBabaBBaBBBBAaaaAAAAA","a"],["bababaAbabAAbAAAABbbbBBBBB"]],[["7","S","T","g","i","O","r","q","kljpfP","v"],["kljpfP"]],[["47","V","S","g","r","C","R","B","b","l","W","J","i","U","n","q","q","j","L","R","u","Q","C","f","C","U","u","x","h","q","E","Y","u","K","t","M","U","A","A","s","i","V","T","j","b","k","W","N","NlVwRlWzQQWoCI","z"],["ZzZzZzZzZZZoZZ"]],[["47","jw","L","xIp","W","I","aI","Ep","ylG","Ne","EglZ","oYkyo","wDuZK","DVh","uoAoF","GWj","t","P","uNQz","bPSg","eqru","xvll","O","mb","CM","wnmvv","YpFsq","FYID","c","r","rhbl","YseyB","RGcRj","hDtz","W","QlQWB","Y","ftSl","yPlAd","LPgVw","EIGOF","TQ","QrFcr","spu","K","IJ","fXUd","GhpV","DxUhKXELSLIiJMIOsbrpPQPXFwH","w"],["DxUhWXEWSWWwWMWWsbwwWQWXFaH"]],[["74","Pjc","ZcOWk","M","yMyp","cH","TzmX","A","Xgl","KVB","bljv","IH","u","nu","LdahF","t","O","Sv","uzFT","zfNd","UM","bXR","UQbXk","AA","gVmH","ng","F","K","HP","Iu","wrH","N","PnTIQ","kUY","yabHN","TA","vrgl","yxmsh","TrQ","X","vIbrl","Mfu","PfN","i","rH","t","Hl","Uwst","j","B","BiDCA","JcE","fd","bXuI","WWSU","rd","mj","t","IGrPe","Ql","xfoSV","o","WKdG","Tqeu","E","bZyg","bVqR","zY","ZD","hHpdP","jHww","lfU","gVem","t","BD","hUOfmkiMZhZxTuuiAyPuoutEQiPfZFSQVMMQxckAqtlRv","x"],["hXXxxxxXZhZaXxxxXyPxxxxXQxPxZXSQVXXQacxXqxlRv"]],[["74","ULa","n","vq","bybI","fCX","EEi","Sg","xj","IDz","fsP","M","GGjx","DpY","gffu","K","My","qbtz","k","bLNb","qET","N","BBY","x","KHUT","Uju","tyXI","o","ChXY","eia","R","akHR","g","ax","KyY","wpdl","CZA","smFl","LVDJ","O","xHF","W","TMZ","vN","qiT","g","I","PsR","sCJL","N","aSCi","JYD","P","A","M","T","G","gU","k","A","loT","EbP","Z","Eoo","Q","GGY","ZcbG","tvYl","M","czMR","j","e","lLjf","Y","zm","qifNoaopvznANCLmPpfToShyelsYSFllyQLUDYbcQ","g"],["ggfGggggvggGGCLgGgfGgShgglsGSFllgGLUDGbcG"]],[["74","M","LQ","H","cA","qj","D","nj","zD","jM","s","R","oC","Fh","lO","j","c","En","AB","sw","T","z","Eb","b","u","mj","MI","D","j","H","p","zD","V","R","vg","H","S","By","u","QP","B","dD","rI","JF","nA","sv","z","a","l","I","FJ","K","H","T","F","l","tC","g","s","Nl","Uj","u","A","OO","Ld","k","k","kM","LY","bn","v","fT","C","I","c","aeBolOleYgGmSLkFCPJPbQZUeodomjS","v"],["vvVovVveYvVvVVvVVVVVvQVVeovovvV"]],[["99","s","c","N","N","i","i","W","J","A","W","m","B","f","O","m","k","Q","f","x","p","l","H","H","o","n","C","K","R","s","T","J","v","C","Z","d","l","r","o","D","g","a","A","E","k","N","w","a","b","o","k","v","c","i","j","E","l","o","f","v","s","h","x","m","E","N","t","j","k","g","k","X","W","i","X","m","w","K","L","Q","r","j","f","o","w","v","S","o","H","e","L","L","d","P","r","g","z","z","q","d","BBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly","q"],["QQQQyQQQuQqqqqQYQqqqQQqQQqQQAquQAQqQQqy"]],[["77","Gw","Zw","qg","eO","mx","fE","qD","Vv","Rs","bd","wA","nh","Dm","bR","xV","we","KH","bl","Vy","aJ","Fr","NP","ir","xh","Fq","DG","Nh","dW","aG","km","NS","Om","yC","ts","Zt","EN","Fs","jA","vf","de","Da","AW","Bv","mO","Dk","Yj","fl","dj","JF","dI","hr","zk","am","LT","PJ","AQ","OW","WN","UG","TL","SZ","BK","Lp","jW","rY","PB","Rj","Bw","gl","lK","Wj","Pl","fx","YO","bX","SN","Pt","xPDCKNGWsNSlScKgBNEooOTnSuycVtvdToGmFoEfsUorvsSNcQIlaXRQqrfTZZoNvjutjhGpGXmNSQQWCzeHhMJAxclmiNnErpxH","h"],["xPDCKNHHhHHlScKgBNHhoOThHuhhVtvdToGmFoEhhUorvsHHcQIlaXRQqrfTZZoNvjutjhGpGXmHHQQWCzeHhMHHxclmiNnErphA"]],[["100","qn","BE","yN","ep","Pq","Xz","LM","EZ","db","Mn","bn","Fe","qA","zc","yq","pC","yA","Wk","Yq","rs","oD","vD","zW","xZ","bl","ur","kf","df","LS","UW","My","hR","sh","Nh","og","CW","or","zo","rO","ao","XH","Dq","Ka","lL","YQ","Oh","RZ","Ax","ta","ko","Dn","Ng","Ny","DB","YD","jO","Ap","FT","oB","Nc","wB","HO","eW","Ac","Dr","Mt","Df","bF","FP","Ra","nF","hF","XC","nG","an","ZY","uB","HP","OR","KN","Uv","Le","Ij","lH","Vw","jb","Xn","qu","Jo","zL","KW","LS","aV","Ls","BX","MY","oK","fh","gP","TB","pBWBEkqznLlZykhmPrfidzWbQMNDdBaDLykOfdvOZjKoUxCqKwJdGuhseuxaYcVyAGTSTwXYmKweRMUdbyfxssSNGLSAhckIknDj","d"],["pBDDDkqznDdDdkhmPrfiddDdQDDDaDaDLydDfdvOZjDdUdDqDdJdGuhseuxaYcVdDGTSTwXYmDdeRMUadyfxssSDDDDAhckIddDj"]],[["3","a","A","a","A","a"],["B"]],[["3","a","A","a","A","b"],["B"]],[["4","a","A","i","A","PetyaIsVeryCoolGuy","p"],["PetypPsVeryCoolGuy"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","c"],["CccanisexperiencingitsgreatestharcccccccccacCorldWarIItharcccccccccacCorldWarIItesthardshixper"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","a"],["AbaanisexperiencingitsgreatestharaaaaaaaaaaaAorldWarIItharaaaaaaaaaaaAorldWarIItesthardshixper"]],[["7","a","h","u","p","fgh","wyz","defghijkl","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaamnoaqrstavwxyz"]],[["9","a","h","u","p","z","fgh","wyz","defghijkl","ghijklmnopqrstu","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaaaaaaaaaaavwxya"]],[["3","ab","Ba","aB","ABBA","l"],["LLLL"]]]}} +{"instance_id":"pseudo_to_code_2k_122","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndx = integer array of size 4 with dx = {0, 0, -1, 1}\ndy = integer array of size 4 with dy = {1, -1, 0, 0}\ndefine the main function\n n = integer\n read n\n s = vector of string\n c = character\n tmp = string\n for i = 0 to n exclusive\n read tmp\n append tmp in s\n transform(s[i].begin(), s[i].end(), s[i].begin(), tolower)\n end of the block\n shit, fuck = string\n read shit, c\n save = string with save = shit\n fuck = shit\n transform(save.begin(), save.end(), save.begin(), tolower)\n rep = integer array of size [save.size()] = {}\n for i = 0 to n exclusive\n for j = 0 to shit.size() exclusive\n if (j + s[i].size() - 1 >= save.size()), continue next iteration\n if (save.substr(j, s[i].size()) is s[i])\n for k = 0 to s[i].size(), rep[k + j] = 1\n end of the block\n for i = 0 to shit.size() exclusive\n if (rep[i])\n if (save[i] is not c)\n shit[i] = c\n else\n if (c is a)\n shit[i] = b\n else\n shit[i] = a\n end of the block\n if (fuck[i] <= Z and fuck[i] >= A), shit[i] = (cast to character)toupper(shit[i])\n end of the block\n end of the block\n print shit\nend of the block\n\n[CODE]:","reference_output":"int dx[4] = {0, 0, -1, 1};\nint dy[4] = {1, -1, 0, 0};\nint main() {\n int n;\n cin >> n;\n vector s;\n char c;\n string tmp;\n for (int i = 0; i < n; i += 1) {\n cin >> tmp;\n s.push_back(tmp);\n transform(s[i].begin(), s[i].end(), s[i].begin(), ::tolower);\n }\n string shit, fuck;\n cin >> shit >> c;\n string save = shit;\n fuck = shit;\n transform(save.begin(), save.end(), save.begin(), ::tolower);\n int rep[save.size()] = {};\n for (int i = 0; i < n; i += 1)\n for (int j = 0; j < shit.size(); j += 1) {\n if (j + s[i].size() - 1 >= save.size()) continue;\n if (save.substr(j, s[i].size()) == s[i])\n for (int k = 0; k < s[i].size(); k += 1) rep[k + j] = 1;\n }\n for (int i = 0; i < shit.size(); i += 1) {\n if (rep[i]) {\n if (save[i] != c)\n shit[i] = c;\n else {\n if (c == 'a')\n shit[i] = 'b';\n else\n shit[i] = 'a';\n }\n if (fuck[i] <= 'Z' && fuck[i] >= 'A') shit[i] = (char)toupper(shit[i]);\n }\n }\n cout << shit << '\\n';\n}","item":{"problem_id":"95A","pseudocode":"dx = integer array of size 4 with dx = {0, 0, -1, 1}\ndy = integer array of size 4 with dy = {1, -1, 0, 0}\ndefine the main function\n n = integer\n read n\n s = vector of string\n c = character\n tmp = string\n for i = 0 to n exclusive\n read tmp\n append tmp in s\n transform(s[i].begin(), s[i].end(), s[i].begin(), tolower)\n end of the block\n shit, fuck = string\n read shit, c\n save = string with save = shit\n fuck = shit\n transform(save.begin(), save.end(), save.begin(), tolower)\n rep = integer array of size [save.size()] = {}\n for i = 0 to n exclusive\n for j = 0 to shit.size() exclusive\n if (j + s[i].size() - 1 >= save.size()), continue next iteration\n if (save.substr(j, s[i].size()) is s[i])\n for k = 0 to s[i].size(), rep[k + j] = 1\n end of the block\n for i = 0 to shit.size() exclusive\n if (rep[i])\n if (save[i] is not c)\n shit[i] = c\n else\n if (c is a)\n shit[i] = b\n else\n shit[i] = a\n end of the block\n if (fuck[i] <= Z and fuck[i] >= A), shit[i] = (cast to character)toupper(shit[i])\n end of the block\n end of the block\n print shit\nend of the block","testcases":[[["3","bers","ucky","elu","PetrLoveLuckyNumbers","t"],["PetrLovtTttttNumtttt"]],[["4","hello","party","abefglghjdhfgj","IVan","petrsmatchwin","a"],["petrsmatchwin"]],[["2","aCa","cba","abAcaba","c"],["abCacba"]],[["3","lol","hello","eho","PetrUnited","t"],["PetrUnited"]],[["2","trsd","dream","PetrsDreamOh","y"],["PeyyyYyyyyOh"]],[["1","PetrsDreamOh","PetrsDreamOh","h"],["HhhhhHhhhhHa"]],[["3","etr","ed","ied","PetrUnited","d"],["PdddUnitda"]],[["3","etr","ed","ied","PetrUnited","z"],["PzzzUnitzz"]],[["3","ab","Ba","aB","ABBA","a"],["BAAB"]],[["3","ab","Ba","aB","ABBAC","b"],["BAABC"]],[["7","a","b","g","k","e","t","t","A","a"],["B"]],[["4","Efron","Keyt","cesho","cool","CodeForcesHockeyTeam","p"],["CodeForpppPpcpppPeam"]],[["4","Efron","Keyt","cesho","cool","CodeForcesOldHockeyNewTeam","p"],["CodeForcesOldHockeyNewTeam"]],[["2","A","B","abababBabaBBaBBBBAaaaAAAAA","a"],["bababaAbabAAbAAAABbbbBBBBB"]],[["7","S","T","g","i","O","r","q","kljpfP","v"],["kljpfP"]],[["47","V","S","g","r","C","R","B","b","l","W","J","i","U","n","q","q","j","L","R","u","Q","C","f","C","U","u","x","h","q","E","Y","u","K","t","M","U","A","A","s","i","V","T","j","b","k","W","N","NlVwRlWzQQWoCI","z"],["ZzZzZzZzZZZoZZ"]],[["47","jw","L","xIp","W","I","aI","Ep","ylG","Ne","EglZ","oYkyo","wDuZK","DVh","uoAoF","GWj","t","P","uNQz","bPSg","eqru","xvll","O","mb","CM","wnmvv","YpFsq","FYID","c","r","rhbl","YseyB","RGcRj","hDtz","W","QlQWB","Y","ftSl","yPlAd","LPgVw","EIGOF","TQ","QrFcr","spu","K","IJ","fXUd","GhpV","DxUhKXELSLIiJMIOsbrpPQPXFwH","w"],["DxUhWXEWSWWwWMWWsbwwWQWXFaH"]],[["74","Pjc","ZcOWk","M","yMyp","cH","TzmX","A","Xgl","KVB","bljv","IH","u","nu","LdahF","t","O","Sv","uzFT","zfNd","UM","bXR","UQbXk","AA","gVmH","ng","F","K","HP","Iu","wrH","N","PnTIQ","kUY","yabHN","TA","vrgl","yxmsh","TrQ","X","vIbrl","Mfu","PfN","i","rH","t","Hl","Uwst","j","B","BiDCA","JcE","fd","bXuI","WWSU","rd","mj","t","IGrPe","Ql","xfoSV","o","WKdG","Tqeu","E","bZyg","bVqR","zY","ZD","hHpdP","jHww","lfU","gVem","t","BD","hUOfmkiMZhZxTuuiAyPuoutEQiPfZFSQVMMQxckAqtlRv","x"],["hXXxxxxXZhZaXxxxXyPxxxxXQxPxZXSQVXXQacxXqxlRv"]],[["74","ULa","n","vq","bybI","fCX","EEi","Sg","xj","IDz","fsP","M","GGjx","DpY","gffu","K","My","qbtz","k","bLNb","qET","N","BBY","x","KHUT","Uju","tyXI","o","ChXY","eia","R","akHR","g","ax","KyY","wpdl","CZA","smFl","LVDJ","O","xHF","W","TMZ","vN","qiT","g","I","PsR","sCJL","N","aSCi","JYD","P","A","M","T","G","gU","k","A","loT","EbP","Z","Eoo","Q","GGY","ZcbG","tvYl","M","czMR","j","e","lLjf","Y","zm","qifNoaopvznANCLmPpfToShyelsYSFllyQLUDYbcQ","g"],["ggfGggggvggGGCLgGgfGgShgglsGSFllgGLUDGbcG"]],[["74","M","LQ","H","cA","qj","D","nj","zD","jM","s","R","oC","Fh","lO","j","c","En","AB","sw","T","z","Eb","b","u","mj","MI","D","j","H","p","zD","V","R","vg","H","S","By","u","QP","B","dD","rI","JF","nA","sv","z","a","l","I","FJ","K","H","T","F","l","tC","g","s","Nl","Uj","u","A","OO","Ld","k","k","kM","LY","bn","v","fT","C","I","c","aeBolOleYgGmSLkFCPJPbQZUeodomjS","v"],["vvVovVveYvVvVVvVVVVVvQVVeovovvV"]],[["99","s","c","N","N","i","i","W","J","A","W","m","B","f","O","m","k","Q","f","x","p","l","H","H","o","n","C","K","R","s","T","J","v","C","Z","d","l","r","o","D","g","a","A","E","k","N","w","a","b","o","k","v","c","i","j","E","l","o","f","v","s","h","x","m","E","N","t","j","k","g","k","X","W","i","X","m","w","K","L","Q","r","j","f","o","w","v","S","o","H","e","L","L","d","P","r","g","z","z","q","d","BBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly","q"],["QQQQyQQQuQqqqqQYQqqqQQqQQqQQAquQAQqQQqy"]],[["77","Gw","Zw","qg","eO","mx","fE","qD","Vv","Rs","bd","wA","nh","Dm","bR","xV","we","KH","bl","Vy","aJ","Fr","NP","ir","xh","Fq","DG","Nh","dW","aG","km","NS","Om","yC","ts","Zt","EN","Fs","jA","vf","de","Da","AW","Bv","mO","Dk","Yj","fl","dj","JF","dI","hr","zk","am","LT","PJ","AQ","OW","WN","UG","TL","SZ","BK","Lp","jW","rY","PB","Rj","Bw","gl","lK","Wj","Pl","fx","YO","bX","SN","Pt","xPDCKNGWsNSlScKgBNEooOTnSuycVtvdToGmFoEfsUorvsSNcQIlaXRQqrfTZZoNvjutjhGpGXmNSQQWCzeHhMJAxclmiNnErpxH","h"],["xPDCKNHHhHHlScKgBNHhoOThHuhhVtvdToGmFoEhhUorvsHHcQIlaXRQqrfTZZoNvjutjhGpGXmHHQQWCzeHhMHHxclmiNnErphA"]],[["100","qn","BE","yN","ep","Pq","Xz","LM","EZ","db","Mn","bn","Fe","qA","zc","yq","pC","yA","Wk","Yq","rs","oD","vD","zW","xZ","bl","ur","kf","df","LS","UW","My","hR","sh","Nh","og","CW","or","zo","rO","ao","XH","Dq","Ka","lL","YQ","Oh","RZ","Ax","ta","ko","Dn","Ng","Ny","DB","YD","jO","Ap","FT","oB","Nc","wB","HO","eW","Ac","Dr","Mt","Df","bF","FP","Ra","nF","hF","XC","nG","an","ZY","uB","HP","OR","KN","Uv","Le","Ij","lH","Vw","jb","Xn","qu","Jo","zL","KW","LS","aV","Ls","BX","MY","oK","fh","gP","TB","pBWBEkqznLlZykhmPrfidzWbQMNDdBaDLykOfdvOZjKoUxCqKwJdGuhseuxaYcVyAGTSTwXYmKweRMUdbyfxssSNGLSAhckIknDj","d"],["pBDDDkqznDdDdkhmPrfiddDdQDDDaDaDLydDfdvOZjDdUdDqDdJdGuhseuxaYcVdDGTSTwXYmDdeRMUadyfxssSDDDDAhckIddDj"]],[["3","a","A","a","A","a"],["B"]],[["3","a","A","a","A","b"],["B"]],[["4","a","A","i","A","PetyaIsVeryCoolGuy","p"],["PetypPsVeryCoolGuy"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","c"],["CccanisexperiencingitsgreatestharcccccccccacCorldWarIItharcccccccccacCorldWarIItesthardshixper"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","a"],["AbaanisexperiencingitsgreatestharaaaaaaaaaaaAorldWarIItharaaaaaaaaaaaAorldWarIItesthardshixper"]],[["7","a","h","u","p","fgh","wyz","defghijkl","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaamnoaqrstavwxyz"]],[["9","a","h","u","p","z","fgh","wyz","defghijkl","ghijklmnopqrstu","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaaaaaaaaaaavwxya"]],[["3","ab","Ba","aB","ABBA","l"],["LLLL"]]]}} +{"instance_id":"pseudo_to_code_2k_123","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nMAXN = const integer with MAXN = 1e6 + 10\nINF = const integer with INF = 1e9 + 7\nres, a, ans = strings with a = array of size 110\nlt = character\nisU, vis = bool array of size 110\ndefine the main function\n n = integer\n read n\n for i = 0 to n exclusive\n read a[i]\n for j = 0 to a[i].length() exclusive\n if (isupper(a[i][j])), a[i][j] = a[i][j] - A - a\n end of the block\n read res\n ans = res\n for i = 0 to res.length() exclusive\n if (isupper(res[i]))\n res[i] = res[i] - A - a\n isU[i] = 1\n end of the block\n read lt\n for i = 0 to res.length() exclusive\n for j = 0 to n exclusive\n if (res[i] =is a[j][0])\n k = integer\n for k = 0 to a[j].length() exclusive\n if (res[i + k] is not a[j][k]), break loop\n if (k is a[j].length())\n for k = 0 to a[j].length() exclusive\n if (vis[i + k]), continue next iteration\n if (res[i + k] is not lt)\n ans[i + k] = if isU[i + k], lt - a + A else lt\n else\n for L = a to z\n if (res[i + k] is not L)\n ans[i + k] = if isU[i + k], L - a + A else L\n break loop\n end of the block\n vis[i + k] = 1\n end of the block\n end of the block\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int MAXN = 1e6 + 10;\nconst int INF = 1e9 + 7;\nstring res, a[110], ans;\nchar lt;\nbool isU[110], vis[110];\nint main() {\n int n;\n cin >> n;\n for (int i = 0; i < n; i++) {\n cin >> a[i];\n for (int j = 0; j < a[i].length(); j++)\n if (isupper(a[i][j])) a[i][j] -= 'A' - 'a';\n }\n cin >> res;\n ans = res;\n for (int i = 0; i < res.length(); i++)\n if (isupper(res[i])) {\n res[i] -= 'A' - 'a';\n isU[i] = 1;\n }\n cin >> lt;\n for (int i = 0; i < res.length(); i++)\n for (int j = 0; j < n; j++)\n if (res[i] == a[j][0]) {\n int k;\n for (k = 0; k < a[j].length(); k++)\n if (res[i + k] != a[j][k]) break;\n if (k == a[j].length())\n for (k = 0; k < a[j].length(); k++) {\n if (vis[i + k]) continue;\n if (res[i + k] != lt)\n ans[i + k] = isU[i + k] ? lt - 'a' + 'A' : lt;\n else\n for (int L = 'a'; L <= 'z'; L++)\n if (res[i + k] != L) {\n ans[i + k] = isU[i + k] ? L - 'a' + 'A' : L;\n break;\n }\n vis[i + k] = 1;\n }\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"95A","pseudocode":"MAXN = const integer with MAXN = 1e6 + 10\nINF = const integer with INF = 1e9 + 7\nres, a, ans = strings with a = array of size 110\nlt = character\nisU, vis = bool array of size 110\ndefine the main function\n n = integer\n read n\n for i = 0 to n exclusive\n read a[i]\n for j = 0 to a[i].length() exclusive\n if (isupper(a[i][j])), a[i][j] = a[i][j] - A - a\n end of the block\n read res\n ans = res\n for i = 0 to res.length() exclusive\n if (isupper(res[i]))\n res[i] = res[i] - A - a\n isU[i] = 1\n end of the block\n read lt\n for i = 0 to res.length() exclusive\n for j = 0 to n exclusive\n if (res[i] =is a[j][0])\n k = integer\n for k = 0 to a[j].length() exclusive\n if (res[i + k] is not a[j][k]), break loop\n if (k is a[j].length())\n for k = 0 to a[j].length() exclusive\n if (vis[i + k]), continue next iteration\n if (res[i + k] is not lt)\n ans[i + k] = if isU[i + k], lt - a + A else lt\n else\n for L = a to z\n if (res[i + k] is not L)\n ans[i + k] = if isU[i + k], L - a + A else L\n break loop\n end of the block\n vis[i + k] = 1\n end of the block\n end of the block\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["3","bers","ucky","elu","PetrLoveLuckyNumbers","t"],["PetrLovtTttttNumtttt"]],[["4","hello","party","abefglghjdhfgj","IVan","petrsmatchwin","a"],["petrsmatchwin"]],[["2","aCa","cba","abAcaba","c"],["abCacba"]],[["3","lol","hello","eho","PetrUnited","t"],["PetrUnited"]],[["2","trsd","dream","PetrsDreamOh","y"],["PeyyyYyyyyOh"]],[["1","PetrsDreamOh","PetrsDreamOh","h"],["HhhhhHhhhhHa"]],[["3","etr","ed","ied","PetrUnited","d"],["PdddUnitda"]],[["3","etr","ed","ied","PetrUnited","z"],["PzzzUnitzz"]],[["3","ab","Ba","aB","ABBA","a"],["BAAB"]],[["3","ab","Ba","aB","ABBAC","b"],["BAABC"]],[["7","a","b","g","k","e","t","t","A","a"],["B"]],[["4","Efron","Keyt","cesho","cool","CodeForcesHockeyTeam","p"],["CodeForpppPpcpppPeam"]],[["4","Efron","Keyt","cesho","cool","CodeForcesOldHockeyNewTeam","p"],["CodeForcesOldHockeyNewTeam"]],[["2","A","B","abababBabaBBaBBBBAaaaAAAAA","a"],["bababaAbabAAbAAAABbbbBBBBB"]],[["7","S","T","g","i","O","r","q","kljpfP","v"],["kljpfP"]],[["47","V","S","g","r","C","R","B","b","l","W","J","i","U","n","q","q","j","L","R","u","Q","C","f","C","U","u","x","h","q","E","Y","u","K","t","M","U","A","A","s","i","V","T","j","b","k","W","N","NlVwRlWzQQWoCI","z"],["ZzZzZzZzZZZoZZ"]],[["47","jw","L","xIp","W","I","aI","Ep","ylG","Ne","EglZ","oYkyo","wDuZK","DVh","uoAoF","GWj","t","P","uNQz","bPSg","eqru","xvll","O","mb","CM","wnmvv","YpFsq","FYID","c","r","rhbl","YseyB","RGcRj","hDtz","W","QlQWB","Y","ftSl","yPlAd","LPgVw","EIGOF","TQ","QrFcr","spu","K","IJ","fXUd","GhpV","DxUhKXELSLIiJMIOsbrpPQPXFwH","w"],["DxUhWXEWSWWwWMWWsbwwWQWXFaH"]],[["74","Pjc","ZcOWk","M","yMyp","cH","TzmX","A","Xgl","KVB","bljv","IH","u","nu","LdahF","t","O","Sv","uzFT","zfNd","UM","bXR","UQbXk","AA","gVmH","ng","F","K","HP","Iu","wrH","N","PnTIQ","kUY","yabHN","TA","vrgl","yxmsh","TrQ","X","vIbrl","Mfu","PfN","i","rH","t","Hl","Uwst","j","B","BiDCA","JcE","fd","bXuI","WWSU","rd","mj","t","IGrPe","Ql","xfoSV","o","WKdG","Tqeu","E","bZyg","bVqR","zY","ZD","hHpdP","jHww","lfU","gVem","t","BD","hUOfmkiMZhZxTuuiAyPuoutEQiPfZFSQVMMQxckAqtlRv","x"],["hXXxxxxXZhZaXxxxXyPxxxxXQxPxZXSQVXXQacxXqxlRv"]],[["74","ULa","n","vq","bybI","fCX","EEi","Sg","xj","IDz","fsP","M","GGjx","DpY","gffu","K","My","qbtz","k","bLNb","qET","N","BBY","x","KHUT","Uju","tyXI","o","ChXY","eia","R","akHR","g","ax","KyY","wpdl","CZA","smFl","LVDJ","O","xHF","W","TMZ","vN","qiT","g","I","PsR","sCJL","N","aSCi","JYD","P","A","M","T","G","gU","k","A","loT","EbP","Z","Eoo","Q","GGY","ZcbG","tvYl","M","czMR","j","e","lLjf","Y","zm","qifNoaopvznANCLmPpfToShyelsYSFllyQLUDYbcQ","g"],["ggfGggggvggGGCLgGgfGgShgglsGSFllgGLUDGbcG"]],[["74","M","LQ","H","cA","qj","D","nj","zD","jM","s","R","oC","Fh","lO","j","c","En","AB","sw","T","z","Eb","b","u","mj","MI","D","j","H","p","zD","V","R","vg","H","S","By","u","QP","B","dD","rI","JF","nA","sv","z","a","l","I","FJ","K","H","T","F","l","tC","g","s","Nl","Uj","u","A","OO","Ld","k","k","kM","LY","bn","v","fT","C","I","c","aeBolOleYgGmSLkFCPJPbQZUeodomjS","v"],["vvVovVveYvVvVVvVVVVVvQVVeovovvV"]],[["99","s","c","N","N","i","i","W","J","A","W","m","B","f","O","m","k","Q","f","x","p","l","H","H","o","n","C","K","R","s","T","J","v","C","Z","d","l","r","o","D","g","a","A","E","k","N","w","a","b","o","k","v","c","i","j","E","l","o","f","v","s","h","x","m","E","N","t","j","k","g","k","X","W","i","X","m","w","K","L","Q","r","j","f","o","w","v","S","o","H","e","L","L","d","P","r","g","z","z","q","d","BBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly","q"],["QQQQyQQQuQqqqqQYQqqqQQqQQqQQAquQAQqQQqy"]],[["77","Gw","Zw","qg","eO","mx","fE","qD","Vv","Rs","bd","wA","nh","Dm","bR","xV","we","KH","bl","Vy","aJ","Fr","NP","ir","xh","Fq","DG","Nh","dW","aG","km","NS","Om","yC","ts","Zt","EN","Fs","jA","vf","de","Da","AW","Bv","mO","Dk","Yj","fl","dj","JF","dI","hr","zk","am","LT","PJ","AQ","OW","WN","UG","TL","SZ","BK","Lp","jW","rY","PB","Rj","Bw","gl","lK","Wj","Pl","fx","YO","bX","SN","Pt","xPDCKNGWsNSlScKgBNEooOTnSuycVtvdToGmFoEfsUorvsSNcQIlaXRQqrfTZZoNvjutjhGpGXmNSQQWCzeHhMJAxclmiNnErpxH","h"],["xPDCKNHHhHHlScKgBNHhoOThHuhhVtvdToGmFoEhhUorvsHHcQIlaXRQqrfTZZoNvjutjhGpGXmHHQQWCzeHhMHHxclmiNnErphA"]],[["100","qn","BE","yN","ep","Pq","Xz","LM","EZ","db","Mn","bn","Fe","qA","zc","yq","pC","yA","Wk","Yq","rs","oD","vD","zW","xZ","bl","ur","kf","df","LS","UW","My","hR","sh","Nh","og","CW","or","zo","rO","ao","XH","Dq","Ka","lL","YQ","Oh","RZ","Ax","ta","ko","Dn","Ng","Ny","DB","YD","jO","Ap","FT","oB","Nc","wB","HO","eW","Ac","Dr","Mt","Df","bF","FP","Ra","nF","hF","XC","nG","an","ZY","uB","HP","OR","KN","Uv","Le","Ij","lH","Vw","jb","Xn","qu","Jo","zL","KW","LS","aV","Ls","BX","MY","oK","fh","gP","TB","pBWBEkqznLlZykhmPrfidzWbQMNDdBaDLykOfdvOZjKoUxCqKwJdGuhseuxaYcVyAGTSTwXYmKweRMUdbyfxssSNGLSAhckIknDj","d"],["pBDDDkqznDdDdkhmPrfiddDdQDDDaDaDLydDfdvOZjDdUdDqDdJdGuhseuxaYcVdDGTSTwXYmDdeRMUadyfxssSDDDDAhckIddDj"]],[["3","a","A","a","A","a"],["B"]],[["3","a","A","a","A","b"],["B"]],[["4","a","A","i","A","PetyaIsVeryCoolGuy","p"],["PetypPsVeryCoolGuy"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","c"],["CccanisexperiencingitsgreatestharcccccccccacCorldWarIItharcccccccccacCorldWarIItesthardshixper"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","a"],["AbaanisexperiencingitsgreatestharaaaaaaaaaaaAorldWarIItharaaaaaaaaaaaAorldWarIItesthardshixper"]],[["7","a","h","u","p","fgh","wyz","defghijkl","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaamnoaqrstavwxyz"]],[["9","a","h","u","p","z","fgh","wyz","defghijkl","ghijklmnopqrstu","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaaaaaaaaaaavwxya"]],[["3","ab","Ba","aB","ABBA","l"],["LLLL"]]]}} +{"instance_id":"pseudo_to_code_2k_124","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet maxn be const integer with maxn = 1e5 + 10\nlet arr be array of booleans of size maxn\nlet s be string and ss be array of strings of size maxn\nlet c be char\nlet n be integer\nin function input\n read n\n for i = 0 to n exclusive, read ss[i]\n read s, c\nend of the block\nin function low which takes char x and returns char\n if x is greater than or equal to A and x is less than or equal to Z, update x to x - 'A' + 'a'\n return x\nend of the block\ndefine the main function\n call input\n let w be integer with w = size of s\n for i = 0 to n exclusive\n for wi = 0 to till wi + size of ss[i] - 1 is less than w\n let b be boolean with b = true\n for ssj = wi to till ssj is less than wi + size of ss[i]\n if low of s[ssj] is not equal to low of ss[i][ssj-wi]\n set b to false\n break\n end of the block\n end of the block\n if b is not false\n for ssj = wi to till ssj is less than wi + size of ss[i], set arr[ssj] to true\n end of the block\n end of the block\n for i = 0 to w exclusive\n if arr[i] is not zero\n if low of s[i] is equal to c\n if c is equal to 'a'\n update s[i] to s[i] + ('b' - low of s[i])\n else\n update s[i] to s[i] + ('a' - low of s[i])\n else\n update s[i] to s[i] + (c - low of s[i])\n end of the block\n print out s with newline\nend of the block\n\n[CODE]:","reference_output":"const int maxn = 1e5 + 10;\nbool arr[maxn];\nstring s, ss[maxn];\nchar c;\nint n;\nvoid input() {\n cin >> n;\n for (int i = 0; i < n; i++) cin >> ss[i];\n cin >> s >> c;\n}\nchar low(char x) {\n if (x >= 'A' && x <= 'Z') x = x - 'A' + 'a';\n return x;\n}\nint main() {\n input();\n int w = s.size();\n for (int i = 0; i < n; i++) {\n for (int wi = 0; wi + ss[i].size() - 1 < w; wi++) {\n bool b = true;\n for (int ssj = wi; ssj < wi + ss[i].size(); ssj++) {\n if (low(s[ssj]) != low(ss[i][ssj - wi])) {\n b = false;\n break;\n }\n }\n if (b)\n for (int ssj = wi; ssj < wi + ss[i].size(); ssj++) arr[ssj] = true;\n }\n }\n for (int i = 0; i < w; i++)\n if (arr[i]) {\n if (low(s[i]) == c) {\n if (c == 'a')\n s[i] += ('b' - low(s[i]));\n else\n s[i] += ('a' - low(s[i]));\n } else\n s[i] += (c - low(s[i]));\n }\n cout << s << endl;\n}","item":{"problem_id":"95A","pseudocode":"let maxn be const integer with maxn = 1e5 + 10\nlet arr be array of booleans of size maxn\nlet s be string and ss be array of strings of size maxn\nlet c be char\nlet n be integer\nin function input\n read n\n for i = 0 to n exclusive, read ss[i]\n read s, c\nend of the block\nin function low which takes char x and returns char\n if x is greater than or equal to A and x is less than or equal to Z, update x to x - 'A' + 'a'\n return x\nend of the block\ndefine the main function\n call input\n let w be integer with w = size of s\n for i = 0 to n exclusive\n for wi = 0 to till wi + size of ss[i] - 1 is less than w\n let b be boolean with b = true\n for ssj = wi to till ssj is less than wi + size of ss[i]\n if low of s[ssj] is not equal to low of ss[i][ssj-wi]\n set b to false\n break\n end of the block\n end of the block\n if b is not false\n for ssj = wi to till ssj is less than wi + size of ss[i], set arr[ssj] to true\n end of the block\n end of the block\n for i = 0 to w exclusive\n if arr[i] is not zero\n if low of s[i] is equal to c\n if c is equal to 'a'\n update s[i] to s[i] + ('b' - low of s[i])\n else\n update s[i] to s[i] + ('a' - low of s[i])\n else\n update s[i] to s[i] + (c - low of s[i])\n end of the block\n print out s with newline\nend of the block","testcases":[[["3","bers","ucky","elu","PetrLoveLuckyNumbers","t"],["PetrLovtTttttNumtttt"]],[["4","hello","party","abefglghjdhfgj","IVan","petrsmatchwin","a"],["petrsmatchwin"]],[["2","aCa","cba","abAcaba","c"],["abCacba"]],[["3","lol","hello","eho","PetrUnited","t"],["PetrUnited"]],[["2","trsd","dream","PetrsDreamOh","y"],["PeyyyYyyyyOh"]],[["1","PetrsDreamOh","PetrsDreamOh","h"],["HhhhhHhhhhHa"]],[["3","etr","ed","ied","PetrUnited","d"],["PdddUnitda"]],[["3","etr","ed","ied","PetrUnited","z"],["PzzzUnitzz"]],[["3","ab","Ba","aB","ABBA","a"],["BAAB"]],[["3","ab","Ba","aB","ABBAC","b"],["BAABC"]],[["7","a","b","g","k","e","t","t","A","a"],["B"]],[["4","Efron","Keyt","cesho","cool","CodeForcesHockeyTeam","p"],["CodeForpppPpcpppPeam"]],[["4","Efron","Keyt","cesho","cool","CodeForcesOldHockeyNewTeam","p"],["CodeForcesOldHockeyNewTeam"]],[["2","A","B","abababBabaBBaBBBBAaaaAAAAA","a"],["bababaAbabAAbAAAABbbbBBBBB"]],[["7","S","T","g","i","O","r","q","kljpfP","v"],["kljpfP"]],[["47","V","S","g","r","C","R","B","b","l","W","J","i","U","n","q","q","j","L","R","u","Q","C","f","C","U","u","x","h","q","E","Y","u","K","t","M","U","A","A","s","i","V","T","j","b","k","W","N","NlVwRlWzQQWoCI","z"],["ZzZzZzZzZZZoZZ"]],[["47","jw","L","xIp","W","I","aI","Ep","ylG","Ne","EglZ","oYkyo","wDuZK","DVh","uoAoF","GWj","t","P","uNQz","bPSg","eqru","xvll","O","mb","CM","wnmvv","YpFsq","FYID","c","r","rhbl","YseyB","RGcRj","hDtz","W","QlQWB","Y","ftSl","yPlAd","LPgVw","EIGOF","TQ","QrFcr","spu","K","IJ","fXUd","GhpV","DxUhKXELSLIiJMIOsbrpPQPXFwH","w"],["DxUhWXEWSWWwWMWWsbwwWQWXFaH"]],[["74","Pjc","ZcOWk","M","yMyp","cH","TzmX","A","Xgl","KVB","bljv","IH","u","nu","LdahF","t","O","Sv","uzFT","zfNd","UM","bXR","UQbXk","AA","gVmH","ng","F","K","HP","Iu","wrH","N","PnTIQ","kUY","yabHN","TA","vrgl","yxmsh","TrQ","X","vIbrl","Mfu","PfN","i","rH","t","Hl","Uwst","j","B","BiDCA","JcE","fd","bXuI","WWSU","rd","mj","t","IGrPe","Ql","xfoSV","o","WKdG","Tqeu","E","bZyg","bVqR","zY","ZD","hHpdP","jHww","lfU","gVem","t","BD","hUOfmkiMZhZxTuuiAyPuoutEQiPfZFSQVMMQxckAqtlRv","x"],["hXXxxxxXZhZaXxxxXyPxxxxXQxPxZXSQVXXQacxXqxlRv"]],[["74","ULa","n","vq","bybI","fCX","EEi","Sg","xj","IDz","fsP","M","GGjx","DpY","gffu","K","My","qbtz","k","bLNb","qET","N","BBY","x","KHUT","Uju","tyXI","o","ChXY","eia","R","akHR","g","ax","KyY","wpdl","CZA","smFl","LVDJ","O","xHF","W","TMZ","vN","qiT","g","I","PsR","sCJL","N","aSCi","JYD","P","A","M","T","G","gU","k","A","loT","EbP","Z","Eoo","Q","GGY","ZcbG","tvYl","M","czMR","j","e","lLjf","Y","zm","qifNoaopvznANCLmPpfToShyelsYSFllyQLUDYbcQ","g"],["ggfGggggvggGGCLgGgfGgShgglsGSFllgGLUDGbcG"]],[["74","M","LQ","H","cA","qj","D","nj","zD","jM","s","R","oC","Fh","lO","j","c","En","AB","sw","T","z","Eb","b","u","mj","MI","D","j","H","p","zD","V","R","vg","H","S","By","u","QP","B","dD","rI","JF","nA","sv","z","a","l","I","FJ","K","H","T","F","l","tC","g","s","Nl","Uj","u","A","OO","Ld","k","k","kM","LY","bn","v","fT","C","I","c","aeBolOleYgGmSLkFCPJPbQZUeodomjS","v"],["vvVovVveYvVvVVvVVVVVvQVVeovovvV"]],[["99","s","c","N","N","i","i","W","J","A","W","m","B","f","O","m","k","Q","f","x","p","l","H","H","o","n","C","K","R","s","T","J","v","C","Z","d","l","r","o","D","g","a","A","E","k","N","w","a","b","o","k","v","c","i","j","E","l","o","f","v","s","h","x","m","E","N","t","j","k","g","k","X","W","i","X","m","w","K","L","Q","r","j","f","o","w","v","S","o","H","e","L","L","d","P","r","g","z","z","q","d","BBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly","q"],["QQQQyQQQuQqqqqQYQqqqQQqQQqQQAquQAQqQQqy"]],[["77","Gw","Zw","qg","eO","mx","fE","qD","Vv","Rs","bd","wA","nh","Dm","bR","xV","we","KH","bl","Vy","aJ","Fr","NP","ir","xh","Fq","DG","Nh","dW","aG","km","NS","Om","yC","ts","Zt","EN","Fs","jA","vf","de","Da","AW","Bv","mO","Dk","Yj","fl","dj","JF","dI","hr","zk","am","LT","PJ","AQ","OW","WN","UG","TL","SZ","BK","Lp","jW","rY","PB","Rj","Bw","gl","lK","Wj","Pl","fx","YO","bX","SN","Pt","xPDCKNGWsNSlScKgBNEooOTnSuycVtvdToGmFoEfsUorvsSNcQIlaXRQqrfTZZoNvjutjhGpGXmNSQQWCzeHhMJAxclmiNnErpxH","h"],["xPDCKNHHhHHlScKgBNHhoOThHuhhVtvdToGmFoEhhUorvsHHcQIlaXRQqrfTZZoNvjutjhGpGXmHHQQWCzeHhMHHxclmiNnErphA"]],[["100","qn","BE","yN","ep","Pq","Xz","LM","EZ","db","Mn","bn","Fe","qA","zc","yq","pC","yA","Wk","Yq","rs","oD","vD","zW","xZ","bl","ur","kf","df","LS","UW","My","hR","sh","Nh","og","CW","or","zo","rO","ao","XH","Dq","Ka","lL","YQ","Oh","RZ","Ax","ta","ko","Dn","Ng","Ny","DB","YD","jO","Ap","FT","oB","Nc","wB","HO","eW","Ac","Dr","Mt","Df","bF","FP","Ra","nF","hF","XC","nG","an","ZY","uB","HP","OR","KN","Uv","Le","Ij","lH","Vw","jb","Xn","qu","Jo","zL","KW","LS","aV","Ls","BX","MY","oK","fh","gP","TB","pBWBEkqznLlZykhmPrfidzWbQMNDdBaDLykOfdvOZjKoUxCqKwJdGuhseuxaYcVyAGTSTwXYmKweRMUdbyfxssSNGLSAhckIknDj","d"],["pBDDDkqznDdDdkhmPrfiddDdQDDDaDaDLydDfdvOZjDdUdDqDdJdGuhseuxaYcVdDGTSTwXYmDdeRMUadyfxssSDDDDAhckIddDj"]],[["3","a","A","a","A","a"],["B"]],[["3","a","A","a","A","b"],["B"]],[["4","a","A","i","A","PetyaIsVeryCoolGuy","p"],["PetypPsVeryCoolGuy"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","c"],["CccanisexperiencingitsgreatestharcccccccccacCorldWarIItharcccccccccacCorldWarIItesthardshixper"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","a"],["AbaanisexperiencingitsgreatestharaaaaaaaaaaaAorldWarIItharaaaaaaaaaaaAorldWarIItesthardshixper"]],[["7","a","h","u","p","fgh","wyz","defghijkl","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaamnoaqrstavwxyz"]],[["9","a","h","u","p","z","fgh","wyz","defghijkl","ghijklmnopqrstu","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaaaaaaaaaaavwxya"]],[["3","ab","Ba","aB","ABBA","l"],["LLLL"]]]}} +{"instance_id":"pseudo_to_code_2k_125","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ns = vector of string\nb1 = bool array of size 100000\ncap = bool array of size 100000\ndefine the main function\n w = string\n s1 = string\n n = integer\n read n\n for i = 0 to n exclusive\n read s1\n for j = 0 to s1.length() exclusive\n if (s1[j] >= A and s1[j] <= Z), s1[j] = s1[j] + a - A\n append s1 in s\n end of the block\n read w\n set all contents of cap to 0\n for i = 0 to w.length() exclusive\n if (w[i] >= A and w[i] <= Z)\n cap[i] = true\n w[i] = w[i] + a - A\n end of the block\n b = bool\n set all contents of b1 to 0\n for i = 0 to n exclusive\n for j = 0 to w.length() exclusive\n b = true\n if (j + s[i].length() > w.length())\n b = false\n else\n for k = j to j + s[i].length() exclusive\n if (w[k] is not s[i][k - j]), b = false\n end of the block\n if (b)\n for k = j to j + s[i].length(), b1[k] = true\n end of the block\n end of the block\n end of the block\n l = character\n read l\n for i = 0 to w.length() exclusive\n if (b1[i])\n if (w[i] is not l)\n w[i] = l\n else if (w[i] is not a)\n w[i] = a\n else\n w[i] = b\n end of the block\n for i = 0 to w.length() exclusive\n if (cap[i]), w[i] = w[i] + A - a\n print w\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"vector s;\nbool b1[100000];\nbool cap[100000];\nint main() {\n string w;\n string s1;\n int n;\n cin >> n;\n for (int i = 0; i < n; i++) {\n cin >> s1;\n for (int j = 0; j < s1.length(); j++)\n if (s1[j] >= 'A' && s1[j] <= 'Z') s1[j] += 'a' - 'A';\n s.push_back(s1);\n }\n cin >> w;\n memset(cap, 0, sizeof cap);\n for (int i = 0; i < w.length(); i++)\n if (w[i] >= 'A' && w[i] <= 'Z') {\n cap[i] = true;\n w[i] += 'a' - 'A';\n }\n bool b;\n memset(b1, 0, sizeof b1);\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < w.length(); j++) {\n b = true;\n if (j + s[i].length() > w.length())\n b = false;\n else {\n for (int k = j; k < j + s[i].length(); k++)\n if (w[k] != s[i][k - j]) b = false;\n }\n if (b) {\n for (int k = j; k < j + s[i].length(); k++) b1[k] = true;\n }\n }\n }\n char l;\n cin >> l;\n for (int i = 0; i < w.length(); i++)\n if (b1[i]) {\n if (w[i] != l)\n w[i] = l;\n else if (w[i] != 'a')\n w[i] = 'a';\n else\n w[i] = 'b';\n }\n for (int i = 0; i < w.length(); i++)\n if (cap[i]) w[i] += 'A' - 'a';\n cout << w << endl;\n return 0;\n}","item":{"problem_id":"95A","pseudocode":"s = vector of string\nb1 = bool array of size 100000\ncap = bool array of size 100000\ndefine the main function\n w = string\n s1 = string\n n = integer\n read n\n for i = 0 to n exclusive\n read s1\n for j = 0 to s1.length() exclusive\n if (s1[j] >= A and s1[j] <= Z), s1[j] = s1[j] + a - A\n append s1 in s\n end of the block\n read w\n set all contents of cap to 0\n for i = 0 to w.length() exclusive\n if (w[i] >= A and w[i] <= Z)\n cap[i] = true\n w[i] = w[i] + a - A\n end of the block\n b = bool\n set all contents of b1 to 0\n for i = 0 to n exclusive\n for j = 0 to w.length() exclusive\n b = true\n if (j + s[i].length() > w.length())\n b = false\n else\n for k = j to j + s[i].length() exclusive\n if (w[k] is not s[i][k - j]), b = false\n end of the block\n if (b)\n for k = j to j + s[i].length(), b1[k] = true\n end of the block\n end of the block\n end of the block\n l = character\n read l\n for i = 0 to w.length() exclusive\n if (b1[i])\n if (w[i] is not l)\n w[i] = l\n else if (w[i] is not a)\n w[i] = a\n else\n w[i] = b\n end of the block\n for i = 0 to w.length() exclusive\n if (cap[i]), w[i] = w[i] + A - a\n print w\n return to indicate successful execution\nend of the block","testcases":[[["3","bers","ucky","elu","PetrLoveLuckyNumbers","t"],["PetrLovtTttttNumtttt"]],[["4","hello","party","abefglghjdhfgj","IVan","petrsmatchwin","a"],["petrsmatchwin"]],[["2","aCa","cba","abAcaba","c"],["abCacba"]],[["3","lol","hello","eho","PetrUnited","t"],["PetrUnited"]],[["2","trsd","dream","PetrsDreamOh","y"],["PeyyyYyyyyOh"]],[["1","PetrsDreamOh","PetrsDreamOh","h"],["HhhhhHhhhhHa"]],[["3","etr","ed","ied","PetrUnited","d"],["PdddUnitda"]],[["3","etr","ed","ied","PetrUnited","z"],["PzzzUnitzz"]],[["3","ab","Ba","aB","ABBA","a"],["BAAB"]],[["3","ab","Ba","aB","ABBAC","b"],["BAABC"]],[["7","a","b","g","k","e","t","t","A","a"],["B"]],[["4","Efron","Keyt","cesho","cool","CodeForcesHockeyTeam","p"],["CodeForpppPpcpppPeam"]],[["4","Efron","Keyt","cesho","cool","CodeForcesOldHockeyNewTeam","p"],["CodeForcesOldHockeyNewTeam"]],[["2","A","B","abababBabaBBaBBBBAaaaAAAAA","a"],["bababaAbabAAbAAAABbbbBBBBB"]],[["7","S","T","g","i","O","r","q","kljpfP","v"],["kljpfP"]],[["47","V","S","g","r","C","R","B","b","l","W","J","i","U","n","q","q","j","L","R","u","Q","C","f","C","U","u","x","h","q","E","Y","u","K","t","M","U","A","A","s","i","V","T","j","b","k","W","N","NlVwRlWzQQWoCI","z"],["ZzZzZzZzZZZoZZ"]],[["47","jw","L","xIp","W","I","aI","Ep","ylG","Ne","EglZ","oYkyo","wDuZK","DVh","uoAoF","GWj","t","P","uNQz","bPSg","eqru","xvll","O","mb","CM","wnmvv","YpFsq","FYID","c","r","rhbl","YseyB","RGcRj","hDtz","W","QlQWB","Y","ftSl","yPlAd","LPgVw","EIGOF","TQ","QrFcr","spu","K","IJ","fXUd","GhpV","DxUhKXELSLIiJMIOsbrpPQPXFwH","w"],["DxUhWXEWSWWwWMWWsbwwWQWXFaH"]],[["74","Pjc","ZcOWk","M","yMyp","cH","TzmX","A","Xgl","KVB","bljv","IH","u","nu","LdahF","t","O","Sv","uzFT","zfNd","UM","bXR","UQbXk","AA","gVmH","ng","F","K","HP","Iu","wrH","N","PnTIQ","kUY","yabHN","TA","vrgl","yxmsh","TrQ","X","vIbrl","Mfu","PfN","i","rH","t","Hl","Uwst","j","B","BiDCA","JcE","fd","bXuI","WWSU","rd","mj","t","IGrPe","Ql","xfoSV","o","WKdG","Tqeu","E","bZyg","bVqR","zY","ZD","hHpdP","jHww","lfU","gVem","t","BD","hUOfmkiMZhZxTuuiAyPuoutEQiPfZFSQVMMQxckAqtlRv","x"],["hXXxxxxXZhZaXxxxXyPxxxxXQxPxZXSQVXXQacxXqxlRv"]],[["74","ULa","n","vq","bybI","fCX","EEi","Sg","xj","IDz","fsP","M","GGjx","DpY","gffu","K","My","qbtz","k","bLNb","qET","N","BBY","x","KHUT","Uju","tyXI","o","ChXY","eia","R","akHR","g","ax","KyY","wpdl","CZA","smFl","LVDJ","O","xHF","W","TMZ","vN","qiT","g","I","PsR","sCJL","N","aSCi","JYD","P","A","M","T","G","gU","k","A","loT","EbP","Z","Eoo","Q","GGY","ZcbG","tvYl","M","czMR","j","e","lLjf","Y","zm","qifNoaopvznANCLmPpfToShyelsYSFllyQLUDYbcQ","g"],["ggfGggggvggGGCLgGgfGgShgglsGSFllgGLUDGbcG"]],[["74","M","LQ","H","cA","qj","D","nj","zD","jM","s","R","oC","Fh","lO","j","c","En","AB","sw","T","z","Eb","b","u","mj","MI","D","j","H","p","zD","V","R","vg","H","S","By","u","QP","B","dD","rI","JF","nA","sv","z","a","l","I","FJ","K","H","T","F","l","tC","g","s","Nl","Uj","u","A","OO","Ld","k","k","kM","LY","bn","v","fT","C","I","c","aeBolOleYgGmSLkFCPJPbQZUeodomjS","v"],["vvVovVveYvVvVVvVVVVVvQVVeovovvV"]],[["99","s","c","N","N","i","i","W","J","A","W","m","B","f","O","m","k","Q","f","x","p","l","H","H","o","n","C","K","R","s","T","J","v","C","Z","d","l","r","o","D","g","a","A","E","k","N","w","a","b","o","k","v","c","i","j","E","l","o","f","v","s","h","x","m","E","N","t","j","k","g","k","X","W","i","X","m","w","K","L","Q","r","j","f","o","w","v","S","o","H","e","L","L","d","P","r","g","z","z","q","d","BBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly","q"],["QQQQyQQQuQqqqqQYQqqqQQqQQqQQAquQAQqQQqy"]],[["77","Gw","Zw","qg","eO","mx","fE","qD","Vv","Rs","bd","wA","nh","Dm","bR","xV","we","KH","bl","Vy","aJ","Fr","NP","ir","xh","Fq","DG","Nh","dW","aG","km","NS","Om","yC","ts","Zt","EN","Fs","jA","vf","de","Da","AW","Bv","mO","Dk","Yj","fl","dj","JF","dI","hr","zk","am","LT","PJ","AQ","OW","WN","UG","TL","SZ","BK","Lp","jW","rY","PB","Rj","Bw","gl","lK","Wj","Pl","fx","YO","bX","SN","Pt","xPDCKNGWsNSlScKgBNEooOTnSuycVtvdToGmFoEfsUorvsSNcQIlaXRQqrfTZZoNvjutjhGpGXmNSQQWCzeHhMJAxclmiNnErpxH","h"],["xPDCKNHHhHHlScKgBNHhoOThHuhhVtvdToGmFoEhhUorvsHHcQIlaXRQqrfTZZoNvjutjhGpGXmHHQQWCzeHhMHHxclmiNnErphA"]],[["100","qn","BE","yN","ep","Pq","Xz","LM","EZ","db","Mn","bn","Fe","qA","zc","yq","pC","yA","Wk","Yq","rs","oD","vD","zW","xZ","bl","ur","kf","df","LS","UW","My","hR","sh","Nh","og","CW","or","zo","rO","ao","XH","Dq","Ka","lL","YQ","Oh","RZ","Ax","ta","ko","Dn","Ng","Ny","DB","YD","jO","Ap","FT","oB","Nc","wB","HO","eW","Ac","Dr","Mt","Df","bF","FP","Ra","nF","hF","XC","nG","an","ZY","uB","HP","OR","KN","Uv","Le","Ij","lH","Vw","jb","Xn","qu","Jo","zL","KW","LS","aV","Ls","BX","MY","oK","fh","gP","TB","pBWBEkqznLlZykhmPrfidzWbQMNDdBaDLykOfdvOZjKoUxCqKwJdGuhseuxaYcVyAGTSTwXYmKweRMUdbyfxssSNGLSAhckIknDj","d"],["pBDDDkqznDdDdkhmPrfiddDdQDDDaDaDLydDfdvOZjDdUdDqDdJdGuhseuxaYcVdDGTSTwXYmDdeRMUadyfxssSDDDDAhckIddDj"]],[["3","a","A","a","A","a"],["B"]],[["3","a","A","a","A","b"],["B"]],[["4","a","A","i","A","PetyaIsVeryCoolGuy","p"],["PetypPsVeryCoolGuy"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","c"],["CccanisexperiencingitsgreatestharcccccccccacCorldWarIItharcccccccccacCorldWarIItesthardshixper"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","a"],["AbaanisexperiencingitsgreatestharaaaaaaaaaaaAorldWarIItharaaaaaaaaaaaAorldWarIItesthardshixper"]],[["7","a","h","u","p","fgh","wyz","defghijkl","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaamnoaqrstavwxyz"]],[["9","a","h","u","p","z","fgh","wyz","defghijkl","ghijklmnopqrstu","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaaaaaaaaaaavwxya"]],[["3","ab","Ba","aB","ABBA","l"],["LLLL"]]]}} +{"instance_id":"pseudo_to_code_2k_126","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nn, m = integers\nk = integer\ndebug = bool with debug = false\nbl = integer array of size 103\ndefine the main function\n read n\n s, a, ss, S, let = strings with a = array of size n\n for i = 0 to n exclusive\n read a[i]\n transform(a[i].begin(), a[i].end(), a[i].begin(), tolower)\n end of the block\n read S, let\n resize S.size() of ss\n transform(S.begin(), S.end(), ss.begin(), tolower)\n for i = 0 to n exclusive\n pos = long long with pos = ss.find(a[i])\n while (pos is not string npos)\n for j = 0 to a[i].size() exclusive, bl[j + pos] = 1\n pos = ss.find(a[i], pos + 1)\n end of the block\n end of the block\n ans = string with ans = \"\"\n for i = 0 to ss.size() exclusive\n if (bl[i])\n if (ss[i] is let[0])\n if (ss[i] is not a)\n if (isupper(S[i]))\n ans = ans + A\n else\n ans = ans + a\n else\n if (isupper(S[i]))\n ans = ans + B\n else\n ans = ans + b\n end of the block\n continue next iteration\n end of the block\n if (isupper(S[i]))\n ans = ans + toupper(let[0])\n else\n ans = ans + let\n else\n ans = ans + S[i]\n end of the block\n end of the block\n print ans.c_str()\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n, m;\nint k;\nbool debug = false;\nint bl[103];\nint main() {\n cin >> n;\n string s, a[n], ss, S, let;\n for (int i = 0; i < n; i++) {\n cin >> a[i];\n transform(a[i].begin(), a[i].end(), a[i].begin(), ::tolower);\n }\n cin >> S >> let;\n ss.resize(S.size());\n transform(S.begin(), S.end(), ss.begin(), ::tolower);\n for (int i = 0; i < n; i++) {\n long long pos = ss.find(a[i]);\n while (pos != string::npos) {\n for (int j = 0; j < a[i].size(); j++) { bl[j + pos] = 1; }\n pos = ss.find(a[i], pos + 1);\n }\n }\n string ans = \"\";\n for (int i = 0; i < ss.size(); i++) {\n if (bl[i]) {\n if (ss[i] == let[0]) {\n if (ss[i] != 'a') {\n if (isupper(S[i]))\n ans += 'A';\n else\n ans += 'a';\n } else {\n if (isupper(S[i]))\n ans += 'B';\n else\n ans += 'b';\n }\n continue;\n }\n if (isupper(S[i]))\n ans += toupper(let[0]);\n else\n ans += let;\n } else {\n ans += S[i];\n }\n }\n puts(ans.c_str());\n return 0;\n}","item":{"problem_id":"95A","pseudocode":"n, m = integers\nk = integer\ndebug = bool with debug = false\nbl = integer array of size 103\ndefine the main function\n read n\n s, a, ss, S, let = strings with a = array of size n\n for i = 0 to n exclusive\n read a[i]\n transform(a[i].begin(), a[i].end(), a[i].begin(), tolower)\n end of the block\n read S, let\n resize S.size() of ss\n transform(S.begin(), S.end(), ss.begin(), tolower)\n for i = 0 to n exclusive\n pos = long long with pos = ss.find(a[i])\n while (pos is not string npos)\n for j = 0 to a[i].size() exclusive, bl[j + pos] = 1\n pos = ss.find(a[i], pos + 1)\n end of the block\n end of the block\n ans = string with ans = \"\"\n for i = 0 to ss.size() exclusive\n if (bl[i])\n if (ss[i] is let[0])\n if (ss[i] is not a)\n if (isupper(S[i]))\n ans = ans + A\n else\n ans = ans + a\n else\n if (isupper(S[i]))\n ans = ans + B\n else\n ans = ans + b\n end of the block\n continue next iteration\n end of the block\n if (isupper(S[i]))\n ans = ans + toupper(let[0])\n else\n ans = ans + let\n else\n ans = ans + S[i]\n end of the block\n end of the block\n print ans.c_str()\n return to indicate successful execution\nend of the block","testcases":[[["3","bers","ucky","elu","PetrLoveLuckyNumbers","t"],["PetrLovtTttttNumtttt"]],[["4","hello","party","abefglghjdhfgj","IVan","petrsmatchwin","a"],["petrsmatchwin"]],[["2","aCa","cba","abAcaba","c"],["abCacba"]],[["3","lol","hello","eho","PetrUnited","t"],["PetrUnited"]],[["2","trsd","dream","PetrsDreamOh","y"],["PeyyyYyyyyOh"]],[["1","PetrsDreamOh","PetrsDreamOh","h"],["HhhhhHhhhhHa"]],[["3","etr","ed","ied","PetrUnited","d"],["PdddUnitda"]],[["3","etr","ed","ied","PetrUnited","z"],["PzzzUnitzz"]],[["3","ab","Ba","aB","ABBA","a"],["BAAB"]],[["3","ab","Ba","aB","ABBAC","b"],["BAABC"]],[["7","a","b","g","k","e","t","t","A","a"],["B"]],[["4","Efron","Keyt","cesho","cool","CodeForcesHockeyTeam","p"],["CodeForpppPpcpppPeam"]],[["4","Efron","Keyt","cesho","cool","CodeForcesOldHockeyNewTeam","p"],["CodeForcesOldHockeyNewTeam"]],[["2","A","B","abababBabaBBaBBBBAaaaAAAAA","a"],["bababaAbabAAbAAAABbbbBBBBB"]],[["7","S","T","g","i","O","r","q","kljpfP","v"],["kljpfP"]],[["47","V","S","g","r","C","R","B","b","l","W","J","i","U","n","q","q","j","L","R","u","Q","C","f","C","U","u","x","h","q","E","Y","u","K","t","M","U","A","A","s","i","V","T","j","b","k","W","N","NlVwRlWzQQWoCI","z"],["ZzZzZzZzZZZoZZ"]],[["47","jw","L","xIp","W","I","aI","Ep","ylG","Ne","EglZ","oYkyo","wDuZK","DVh","uoAoF","GWj","t","P","uNQz","bPSg","eqru","xvll","O","mb","CM","wnmvv","YpFsq","FYID","c","r","rhbl","YseyB","RGcRj","hDtz","W","QlQWB","Y","ftSl","yPlAd","LPgVw","EIGOF","TQ","QrFcr","spu","K","IJ","fXUd","GhpV","DxUhKXELSLIiJMIOsbrpPQPXFwH","w"],["DxUhWXEWSWWwWMWWsbwwWQWXFaH"]],[["74","Pjc","ZcOWk","M","yMyp","cH","TzmX","A","Xgl","KVB","bljv","IH","u","nu","LdahF","t","O","Sv","uzFT","zfNd","UM","bXR","UQbXk","AA","gVmH","ng","F","K","HP","Iu","wrH","N","PnTIQ","kUY","yabHN","TA","vrgl","yxmsh","TrQ","X","vIbrl","Mfu","PfN","i","rH","t","Hl","Uwst","j","B","BiDCA","JcE","fd","bXuI","WWSU","rd","mj","t","IGrPe","Ql","xfoSV","o","WKdG","Tqeu","E","bZyg","bVqR","zY","ZD","hHpdP","jHww","lfU","gVem","t","BD","hUOfmkiMZhZxTuuiAyPuoutEQiPfZFSQVMMQxckAqtlRv","x"],["hXXxxxxXZhZaXxxxXyPxxxxXQxPxZXSQVXXQacxXqxlRv"]],[["74","ULa","n","vq","bybI","fCX","EEi","Sg","xj","IDz","fsP","M","GGjx","DpY","gffu","K","My","qbtz","k","bLNb","qET","N","BBY","x","KHUT","Uju","tyXI","o","ChXY","eia","R","akHR","g","ax","KyY","wpdl","CZA","smFl","LVDJ","O","xHF","W","TMZ","vN","qiT","g","I","PsR","sCJL","N","aSCi","JYD","P","A","M","T","G","gU","k","A","loT","EbP","Z","Eoo","Q","GGY","ZcbG","tvYl","M","czMR","j","e","lLjf","Y","zm","qifNoaopvznANCLmPpfToShyelsYSFllyQLUDYbcQ","g"],["ggfGggggvggGGCLgGgfGgShgglsGSFllgGLUDGbcG"]],[["74","M","LQ","H","cA","qj","D","nj","zD","jM","s","R","oC","Fh","lO","j","c","En","AB","sw","T","z","Eb","b","u","mj","MI","D","j","H","p","zD","V","R","vg","H","S","By","u","QP","B","dD","rI","JF","nA","sv","z","a","l","I","FJ","K","H","T","F","l","tC","g","s","Nl","Uj","u","A","OO","Ld","k","k","kM","LY","bn","v","fT","C","I","c","aeBolOleYgGmSLkFCPJPbQZUeodomjS","v"],["vvVovVveYvVvVVvVVVVVvQVVeovovvV"]],[["99","s","c","N","N","i","i","W","J","A","W","m","B","f","O","m","k","Q","f","x","p","l","H","H","o","n","C","K","R","s","T","J","v","C","Z","d","l","r","o","D","g","a","A","E","k","N","w","a","b","o","k","v","c","i","j","E","l","o","f","v","s","h","x","m","E","N","t","j","k","g","k","X","W","i","X","m","w","K","L","Q","r","j","f","o","w","v","S","o","H","e","L","L","d","P","r","g","z","z","q","d","BBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly","q"],["QQQQyQQQuQqqqqQYQqqqQQqQQqQQAquQAQqQQqy"]],[["77","Gw","Zw","qg","eO","mx","fE","qD","Vv","Rs","bd","wA","nh","Dm","bR","xV","we","KH","bl","Vy","aJ","Fr","NP","ir","xh","Fq","DG","Nh","dW","aG","km","NS","Om","yC","ts","Zt","EN","Fs","jA","vf","de","Da","AW","Bv","mO","Dk","Yj","fl","dj","JF","dI","hr","zk","am","LT","PJ","AQ","OW","WN","UG","TL","SZ","BK","Lp","jW","rY","PB","Rj","Bw","gl","lK","Wj","Pl","fx","YO","bX","SN","Pt","xPDCKNGWsNSlScKgBNEooOTnSuycVtvdToGmFoEfsUorvsSNcQIlaXRQqrfTZZoNvjutjhGpGXmNSQQWCzeHhMJAxclmiNnErpxH","h"],["xPDCKNHHhHHlScKgBNHhoOThHuhhVtvdToGmFoEhhUorvsHHcQIlaXRQqrfTZZoNvjutjhGpGXmHHQQWCzeHhMHHxclmiNnErphA"]],[["100","qn","BE","yN","ep","Pq","Xz","LM","EZ","db","Mn","bn","Fe","qA","zc","yq","pC","yA","Wk","Yq","rs","oD","vD","zW","xZ","bl","ur","kf","df","LS","UW","My","hR","sh","Nh","og","CW","or","zo","rO","ao","XH","Dq","Ka","lL","YQ","Oh","RZ","Ax","ta","ko","Dn","Ng","Ny","DB","YD","jO","Ap","FT","oB","Nc","wB","HO","eW","Ac","Dr","Mt","Df","bF","FP","Ra","nF","hF","XC","nG","an","ZY","uB","HP","OR","KN","Uv","Le","Ij","lH","Vw","jb","Xn","qu","Jo","zL","KW","LS","aV","Ls","BX","MY","oK","fh","gP","TB","pBWBEkqznLlZykhmPrfidzWbQMNDdBaDLykOfdvOZjKoUxCqKwJdGuhseuxaYcVyAGTSTwXYmKweRMUdbyfxssSNGLSAhckIknDj","d"],["pBDDDkqznDdDdkhmPrfiddDdQDDDaDaDLydDfdvOZjDdUdDqDdJdGuhseuxaYcVdDGTSTwXYmDdeRMUadyfxssSDDDDAhckIddDj"]],[["3","a","A","a","A","a"],["B"]],[["3","a","A","a","A","b"],["B"]],[["4","a","A","i","A","PetyaIsVeryCoolGuy","p"],["PetypPsVeryCoolGuy"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","c"],["CccanisexperiencingitsgreatestharcccccccccacCorldWarIItharcccccccccacCorldWarIItesthardshixper"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","a"],["AbaanisexperiencingitsgreatestharaaaaaaaaaaaAorldWarIItharaaaaaaaaaaaAorldWarIItesthardshixper"]],[["7","a","h","u","p","fgh","wyz","defghijkl","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaamnoaqrstavwxyz"]],[["9","a","h","u","p","z","fgh","wyz","defghijkl","ghijklmnopqrstu","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaaaaaaaaaaavwxya"]],[["3","ab","Ba","aB","ABBA","l"],["LLLL"]]]}} +{"instance_id":"pseudo_to_code_2k_127","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ninteger array = n,d[111]\narray a size 111, s, t = string\ncreate character variable\ndefine the main function\n read n\n for i = 1 to less than or equal to n do the following\n read a[i]\n for j = 0 to less than a[i].size() do the following\n if a[i][j] is greater than or equal to a then subtract 32 from a[i][j]\n end of the block\n read s\n set t to s\n read lucky\n if lucky is greater than or equal to a then subtract 32 from lucky\n integers = sl = s.length()\n for i = 0 to less than sl do the following\n if s[i] is greater than or equal to a then subtract 32 from s[i], d[i] = 1\n end of the block\n for i = 0 to less than sl do the following\n for j = 1 to less than or equal to n do the following\n integers l = a[j].length()\n if i + l is less than or equal to sl and s.substr(i, l) is a[j]then do the following\n for k = 0 to less than l do the following\n if s[i + k] is lucky then do the following\n if lucky is A then do the following\n set t[i + k] to b if d[i + k] is true or else d[i+k] = B)\n else\n set t[i + k] to b if d[i + k] is true or else d[i+k] = A)\n else\n set t[i + k] to lucky+32 if d[i + k]is true else t[i+k] = lucky\n end of the block\n end of the block\n end of the block\n end of the block\n output t\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n, d[111];\nstring a[111], s, t;\nchar lucky;\nint main() {\n cin >> n;\n for (int i = 1; i <= n; i++) {\n cin >> a[i];\n for (int j = 0; j < a[i].size(); j++)\n if (a[i][j] >= 'a') a[i][j] -= 32;\n }\n cin >> s;\n t = s;\n cin >> lucky;\n if (lucky >= 'a') lucky -= 32;\n int sl = s.length();\n for (int i = 0; i < sl; i++) {\n if (s[i] >= 'a') s[i] -= 32, d[i] = 1;\n }\n for (int i = 0; i < sl; i++) {\n for (int j = 1; j <= n; j++) {\n int l = a[j].length();\n if (i + l <= sl && s.substr(i, l) == a[j]) {\n for (int k = 0; k < l; k++) {\n if (s[i + k] == lucky) {\n if (lucky == 'A')\n t[i + k] = (d[i + k] ? 'b' : 'B');\n else\n t[i + k] = (d[i + k] ? 'a' : 'A');\n } else\n t[i + k] = (d[i + k] ? lucky + 32 : lucky);\n }\n }\n }\n }\n cout << t << \"\\n\";\n return 0;\n}","item":{"problem_id":"95A","pseudocode":"integer array = n,d[111]\narray a size 111, s, t = string\ncreate character variable\ndefine the main function\n read n\n for i = 1 to less than or equal to n do the following\n read a[i]\n for j = 0 to less than a[i].size() do the following\n if a[i][j] is greater than or equal to a then subtract 32 from a[i][j]\n end of the block\n read s\n set t to s\n read lucky\n if lucky is greater than or equal to a then subtract 32 from lucky\n integers = sl = s.length()\n for i = 0 to less than sl do the following\n if s[i] is greater than or equal to a then subtract 32 from s[i], d[i] = 1\n end of the block\n for i = 0 to less than sl do the following\n for j = 1 to less than or equal to n do the following\n integers l = a[j].length()\n if i + l is less than or equal to sl and s.substr(i, l) is a[j]then do the following\n for k = 0 to less than l do the following\n if s[i + k] is lucky then do the following\n if lucky is A then do the following\n set t[i + k] to b if d[i + k] is true or else d[i+k] = B)\n else\n set t[i + k] to b if d[i + k] is true or else d[i+k] = A)\n else\n set t[i + k] to lucky+32 if d[i + k]is true else t[i+k] = lucky\n end of the block\n end of the block\n end of the block\n end of the block\n output t\n return to indicate successful execution\nend of the block","testcases":[[["3","bers","ucky","elu","PetrLoveLuckyNumbers","t"],["PetrLovtTttttNumtttt"]],[["4","hello","party","abefglghjdhfgj","IVan","petrsmatchwin","a"],["petrsmatchwin"]],[["2","aCa","cba","abAcaba","c"],["abCacba"]],[["3","lol","hello","eho","PetrUnited","t"],["PetrUnited"]],[["2","trsd","dream","PetrsDreamOh","y"],["PeyyyYyyyyOh"]],[["1","PetrsDreamOh","PetrsDreamOh","h"],["HhhhhHhhhhHa"]],[["3","etr","ed","ied","PetrUnited","d"],["PdddUnitda"]],[["3","etr","ed","ied","PetrUnited","z"],["PzzzUnitzz"]],[["3","ab","Ba","aB","ABBA","a"],["BAAB"]],[["3","ab","Ba","aB","ABBAC","b"],["BAABC"]],[["7","a","b","g","k","e","t","t","A","a"],["B"]],[["4","Efron","Keyt","cesho","cool","CodeForcesHockeyTeam","p"],["CodeForpppPpcpppPeam"]],[["4","Efron","Keyt","cesho","cool","CodeForcesOldHockeyNewTeam","p"],["CodeForcesOldHockeyNewTeam"]],[["2","A","B","abababBabaBBaBBBBAaaaAAAAA","a"],["bababaAbabAAbAAAABbbbBBBBB"]],[["7","S","T","g","i","O","r","q","kljpfP","v"],["kljpfP"]],[["47","V","S","g","r","C","R","B","b","l","W","J","i","U","n","q","q","j","L","R","u","Q","C","f","C","U","u","x","h","q","E","Y","u","K","t","M","U","A","A","s","i","V","T","j","b","k","W","N","NlVwRlWzQQWoCI","z"],["ZzZzZzZzZZZoZZ"]],[["47","jw","L","xIp","W","I","aI","Ep","ylG","Ne","EglZ","oYkyo","wDuZK","DVh","uoAoF","GWj","t","P","uNQz","bPSg","eqru","xvll","O","mb","CM","wnmvv","YpFsq","FYID","c","r","rhbl","YseyB","RGcRj","hDtz","W","QlQWB","Y","ftSl","yPlAd","LPgVw","EIGOF","TQ","QrFcr","spu","K","IJ","fXUd","GhpV","DxUhKXELSLIiJMIOsbrpPQPXFwH","w"],["DxUhWXEWSWWwWMWWsbwwWQWXFaH"]],[["74","Pjc","ZcOWk","M","yMyp","cH","TzmX","A","Xgl","KVB","bljv","IH","u","nu","LdahF","t","O","Sv","uzFT","zfNd","UM","bXR","UQbXk","AA","gVmH","ng","F","K","HP","Iu","wrH","N","PnTIQ","kUY","yabHN","TA","vrgl","yxmsh","TrQ","X","vIbrl","Mfu","PfN","i","rH","t","Hl","Uwst","j","B","BiDCA","JcE","fd","bXuI","WWSU","rd","mj","t","IGrPe","Ql","xfoSV","o","WKdG","Tqeu","E","bZyg","bVqR","zY","ZD","hHpdP","jHww","lfU","gVem","t","BD","hUOfmkiMZhZxTuuiAyPuoutEQiPfZFSQVMMQxckAqtlRv","x"],["hXXxxxxXZhZaXxxxXyPxxxxXQxPxZXSQVXXQacxXqxlRv"]],[["74","ULa","n","vq","bybI","fCX","EEi","Sg","xj","IDz","fsP","M","GGjx","DpY","gffu","K","My","qbtz","k","bLNb","qET","N","BBY","x","KHUT","Uju","tyXI","o","ChXY","eia","R","akHR","g","ax","KyY","wpdl","CZA","smFl","LVDJ","O","xHF","W","TMZ","vN","qiT","g","I","PsR","sCJL","N","aSCi","JYD","P","A","M","T","G","gU","k","A","loT","EbP","Z","Eoo","Q","GGY","ZcbG","tvYl","M","czMR","j","e","lLjf","Y","zm","qifNoaopvznANCLmPpfToShyelsYSFllyQLUDYbcQ","g"],["ggfGggggvggGGCLgGgfGgShgglsGSFllgGLUDGbcG"]],[["74","M","LQ","H","cA","qj","D","nj","zD","jM","s","R","oC","Fh","lO","j","c","En","AB","sw","T","z","Eb","b","u","mj","MI","D","j","H","p","zD","V","R","vg","H","S","By","u","QP","B","dD","rI","JF","nA","sv","z","a","l","I","FJ","K","H","T","F","l","tC","g","s","Nl","Uj","u","A","OO","Ld","k","k","kM","LY","bn","v","fT","C","I","c","aeBolOleYgGmSLkFCPJPbQZUeodomjS","v"],["vvVovVveYvVvVVvVVVVVvQVVeovovvV"]],[["99","s","c","N","N","i","i","W","J","A","W","m","B","f","O","m","k","Q","f","x","p","l","H","H","o","n","C","K","R","s","T","J","v","C","Z","d","l","r","o","D","g","a","A","E","k","N","w","a","b","o","k","v","c","i","j","E","l","o","f","v","s","h","x","m","E","N","t","j","k","g","k","X","W","i","X","m","w","K","L","Q","r","j","f","o","w","v","S","o","H","e","L","L","d","P","r","g","z","z","q","d","BBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly","q"],["QQQQyQQQuQqqqqQYQqqqQQqQQqQQAquQAQqQQqy"]],[["77","Gw","Zw","qg","eO","mx","fE","qD","Vv","Rs","bd","wA","nh","Dm","bR","xV","we","KH","bl","Vy","aJ","Fr","NP","ir","xh","Fq","DG","Nh","dW","aG","km","NS","Om","yC","ts","Zt","EN","Fs","jA","vf","de","Da","AW","Bv","mO","Dk","Yj","fl","dj","JF","dI","hr","zk","am","LT","PJ","AQ","OW","WN","UG","TL","SZ","BK","Lp","jW","rY","PB","Rj","Bw","gl","lK","Wj","Pl","fx","YO","bX","SN","Pt","xPDCKNGWsNSlScKgBNEooOTnSuycVtvdToGmFoEfsUorvsSNcQIlaXRQqrfTZZoNvjutjhGpGXmNSQQWCzeHhMJAxclmiNnErpxH","h"],["xPDCKNHHhHHlScKgBNHhoOThHuhhVtvdToGmFoEhhUorvsHHcQIlaXRQqrfTZZoNvjutjhGpGXmHHQQWCzeHhMHHxclmiNnErphA"]],[["100","qn","BE","yN","ep","Pq","Xz","LM","EZ","db","Mn","bn","Fe","qA","zc","yq","pC","yA","Wk","Yq","rs","oD","vD","zW","xZ","bl","ur","kf","df","LS","UW","My","hR","sh","Nh","og","CW","or","zo","rO","ao","XH","Dq","Ka","lL","YQ","Oh","RZ","Ax","ta","ko","Dn","Ng","Ny","DB","YD","jO","Ap","FT","oB","Nc","wB","HO","eW","Ac","Dr","Mt","Df","bF","FP","Ra","nF","hF","XC","nG","an","ZY","uB","HP","OR","KN","Uv","Le","Ij","lH","Vw","jb","Xn","qu","Jo","zL","KW","LS","aV","Ls","BX","MY","oK","fh","gP","TB","pBWBEkqznLlZykhmPrfidzWbQMNDdBaDLykOfdvOZjKoUxCqKwJdGuhseuxaYcVyAGTSTwXYmKweRMUdbyfxssSNGLSAhckIknDj","d"],["pBDDDkqznDdDdkhmPrfiddDdQDDDaDaDLydDfdvOZjDdUdDqDdJdGuhseuxaYcVdDGTSTwXYmDdeRMUadyfxssSDDDDAhckIddDj"]],[["3","a","A","a","A","a"],["B"]],[["3","a","A","a","A","b"],["B"]],[["4","a","A","i","A","PetyaIsVeryCoolGuy","p"],["PetypPsVeryCoolGuy"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","c"],["CccanisexperiencingitsgreatestharcccccccccacCorldWarIItharcccccccccacCorldWarIItesthardshixper"]],[["3","jap","thd","dshipssinceW","JapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper","a"],["AbaanisexperiencingitsgreatestharaaaaaaaaaaaAorldWarIItharaaaaaaaaaaaAorldWarIItesthardshixper"]],[["7","a","h","u","p","fgh","wyz","defghijkl","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaamnoaqrstavwxyz"]],[["9","a","h","u","p","z","fgh","wyz","defghijkl","ghijklmnopqrstu","abcdefghijklmnopqrstuvwxyz","a"],["bbcaaaaaaaaaaaaaaaaaavwxya"]],[["3","ab","Ba","aB","ABBA","l"],["LLLL"]]]}} +{"instance_id":"pseudo_to_code_2k_128","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate constant integer variable with name N = 150\ndeclare integer arrays x, y and info with size N, and a variable n\ninteger function color_to_id with char argument ch\n if ch = 'R', return 1\n if ch is equal to 'G', return 2\n if ch = 'B', return 3\n if ch = 'Y', return 4\n if ch is equal to 'W', return 5\nend of the block\nfunction count_one with int argument x that returns int\n create integer variable called cnt with value 0\n while x\n change cnt to the sum of cnt and x & 1\n change x to x >> 1\n end of the block\n return cnt\nend of the block\nbool function check with int argument sta\n for i = 0 to n exclusive incrementing i\n change info[i] to 0\n set info[i] to info[i] | (1 << (x[i] - 1)) & sta\n change the value of info[i] to info[i] | (1 << (y[i] - 1 + 5)) & sta\n in a for loop, change j from 0 to i exclusive\n return false if info[i] = info[j] and (x[i] != x[j] or y[i] != y[j])\n end of the block\n return true\nend of the block\ndefine the main function\n declare string variable with name str\n read n and loop further\n for i = 0 to n exclusive incrementing i\n read input to str\n change the value of x[i] to color_to_id(str[0])\n set y[i] to str[1] - '0'\n end of the block\n define integer ans with value 10\n for integer i = 0 to 1 << 10 exclusive\n declare new integer variable n_one with value = result of count_one(i)\n if n_one >= ans, go to the start of the loop\n if check(i) returned true, set the value of ans to n_one\n end of the block\n print ans\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int N = 150;\nint x[N], y[N], info[N], n;\nint color_to_id(char ch) {\n if (ch == 'R') return 1;\n if (ch == 'G') return 2;\n if (ch == 'B') return 3;\n if (ch == 'Y') return 4;\n if (ch == 'W') return 5;\n}\nint count_one(int x) {\n int cnt = 0;\n while (x) {\n cnt += (x & 1);\n x >>= 1;\n }\n return cnt;\n}\nbool check(int sta) {\n for (int i = 0; i < n; i++) {\n info[i] = 0;\n info[i] |= (1 << (x[i] - 1)) & sta;\n info[i] |= (1 << (y[i] - 1 + 5)) & sta;\n for (int j = 0; j < i; j++)\n if (info[i] == info[j] && (x[i] != x[j] || y[i] != y[j])) return false;\n }\n return true;\n}\nint main() {\n string str;\n while (cin >> n) {\n for (int i = 0; i < n; i++) {\n cin >> str;\n x[i] = color_to_id(str[0]);\n y[i] = str[1] - '0';\n }\n int ans = 10;\n for (int i = 0; i < (1 << 10); i++) {\n int n_one = count_one(i);\n if (n_one >= ans) continue;\n if (check(i)) ans = n_one;\n }\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"442A","pseudocode":"create constant integer variable with name N = 150\ndeclare integer arrays x, y and info with size N, and a variable n\ninteger function color_to_id with char argument ch\n if ch = 'R', return 1\n if ch is equal to 'G', return 2\n if ch = 'B', return 3\n if ch = 'Y', return 4\n if ch is equal to 'W', return 5\nend of the block\nfunction count_one with int argument x that returns int\n create integer variable called cnt with value 0\n while x\n change cnt to the sum of cnt and x & 1\n change x to x >> 1\n end of the block\n return cnt\nend of the block\nbool function check with int argument sta\n for i = 0 to n exclusive incrementing i\n change info[i] to 0\n set info[i] to info[i] | (1 << (x[i] - 1)) & sta\n change the value of info[i] to info[i] | (1 << (y[i] - 1 + 5)) & sta\n in a for loop, change j from 0 to i exclusive\n return false if info[i] = info[j] and (x[i] != x[j] or y[i] != y[j])\n end of the block\n return true\nend of the block\ndefine the main function\n declare string variable with name str\n read n and loop further\n for i = 0 to n exclusive incrementing i\n read input to str\n change the value of x[i] to color_to_id(str[0])\n set y[i] to str[1] - '0'\n end of the block\n define integer ans with value 10\n for integer i = 0 to 1 << 10 exclusive\n declare new integer variable n_one with value = result of count_one(i)\n if n_one >= ans, go to the start of the loop\n if check(i) returned true, set the value of ans to n_one\n end of the block\n print ans\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2","G3 G3"],["0"]],[["4","G4 R4 R3 B3"],["2"]],[["5","B1 Y1 W1 G1 R1"],["4"]],[["10","Y4 B1 R3 G5 R5 W3 W5 W2 R1 Y1"],["6"]],[["3","G4 G3 B4"],["2"]],[["2","W3 Y5"],["1"]],[["2","W5 Y5"],["1"]],[["100","W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5"],["8"]],[["100","B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W5 W4 Y5 W1 B4 G3 R2 R3 W1 B4 Y4 G2 G2 R1 Y5 W1 Y3 B3 G5 Y3 G3 W2 W5 Y4 B2 Y5 R4 B2 Y3 W4 G2 G3 R2 W1 B4 B2 B1 Y2 Y2 Y3 W3 Y5 W1 R1 R1 R4 R4 R4 Y1 Y3 B2 Y3 Y1 R3 G4 G4 Y5 B5 W2 G1 G5 B3 G1 Y1 R2 G5 R2 Y5 R5 Y4 R4 W2"],["8"]],[["100","Y3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 Y5 Y2 Y5 Y4 Y1 Y2 Y1"],["4"]],[["100","G3 B3 G3 Y3 R3 G3 R3 G3 W3 B3 B3 B3 R3 Y3 Y3 W3 R3 B3 G3 W3 G3 W3 Y3 R3 Y3 W3 W3 G3 W3 G3 W3 Y3 G3 R3 Y3 W3 W3 Y3 Y3 Y3 R3 W3 R3 G3 W3 W3 G3 Y3 B3 W3 B3 Y3 G3 Y3 B3 Y3 W3 Y3 R3 Y3 R3 W3 W3 W3 G3 Y3 G3 R3 B3 R3 Y3 R3 Y3 R3 Y3 R3 Y3 R3 W3 Y3 R3 W3 W3 W3 G3 G3 Y3 B3 Y3 R3 G3 G3 B3 B3 Y3 R3 G3 R3 W3 G3"],["4"]],[["100","W5 Y5 Y3 W3 Y5 Y5 W5 W5 Y3 W5 Y5 Y3 W5 Y5 W5 W3 Y3 Y5 W3 W5 Y5 W3 Y5 Y3 W3 W3 Y3 Y5 W3 W3 Y3 Y5 W3 Y5 Y5 Y5 W5 Y5 W5 Y5 W5 W5 W3 W5 W3 Y3 W5 W3 W3 W5 Y3 Y5 W5 W5 W3 W5 W5 Y5 W5 W3 W3 W3 Y3 Y5 Y5 Y3 Y5 W5 W5 Y5 W3 W3 W5 Y5 Y5 Y3 W5 W5 W3 Y5 W3 W5 Y3 Y5 W5 Y3 Y3 W3 Y3 Y5 Y3 Y3 W5 Y5 Y3 Y5 Y3 W3 Y3 W5"],["2"]],[["100","Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y5 Y5 Y3 Y3 Y5 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5"],["1"]],[["100","Y3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 Y3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3"],["1"]],[["10","W1 Y4 Y3 W3 Y2 W2 W1 Y2 Y3 W3"],["3"]],[["10","W2 R2 B5 W5 W2 B3 B2 R5 Y5 R2"],["5"]],[["5","W3 Y5 W2 G3 Y3"],["3"]],[["5","W5 G5 W2 Y5 G2"],["3"]],[["5","W5 W3 Y3 Y5 W2"],["3"]],[["5","Y5 W3 W2 G5 W3"],["3"]],[["5","G5 G3 G5 G5 W2"],["2"]],[["5","W2 Y2 G3 G3 G3"],["2"]],[["5","G3 Y5 Y2 Y5 W3"],["3"]],[["5","W3 W5 Y3 W2 G5"],["3"]],[["5","Y3 Y2 Y3 Y5 Y5"],["2"]],[["5","W5 Y3 W5 W5 Y5"],["2"]],[["5","G3 Y3 G3 Y3 G3"],["1"]],[["5","G4 W5 Y4 Y4 R5"],["3"]],[["5","G3 R2 R5 B3 W4"],["4"]],[["5","W2 G5 W3 R4 R4"],["3"]],[["5","Y3 Y3 G3 Y3 W3"],["2"]],[["5","W5 W5 W3 Y3 Y5"],["2"]],[["35","G5 G5 G3 G2 G3 Y3 W3 Y3 G5 W5 G2 G2 W5 G5 G5 W3 G3 G2 Y3 W5 W3 G5 W5 G2 Y2 Y3 W5 G3 W3 W2 G2 W3 Y2 G3 G3"],["4"]],[["35","G3 G2 G5 G2 W2 G3 W2 W5 Y5 G5 W2 W2 W2 G5 Y2 G5 W5 W3 W2 Y2 G5 W5 W3 W5 Y2 Y5 W2 W2 W3 Y3 G2 W3 G5 G3 W2"],["4"]],[["35","W2 W3 Y2 G5 G2 W3 G5 Y2 W5 Y5 W3 G2 G3 W5 W2 W3 Y2 Y5 Y2 Y5 Y2 Y2 G2 Y5 W3 Y5 G3 Y2 G3 Y2 Y5 W5 G3 W5 W5"],["4"]],[["35","Y2 Y3 Y2 Y3 Y5 Y5 Y3 Y5 Y5 Y2 Y2 Y5 Y2 Y2 Y5 Y3 Y2 Y5 Y5 Y3 Y3 Y2 Y2 Y2 Y3 Y5 Y2 Y5 Y5 Y3 Y5 Y2 Y3 Y3 Y2"],["2"]],[["35","Y5 Y5 W5 Y5 W3 Y3 W5 W3 W5 W3 W5 Y5 Y3 W3 W5 W5 W5 W3 Y5 Y3 Y5 W5 W5 Y3 Y5 Y5 Y3 W5 W3 W3 W3 W5 Y5 W3 W5"],["2"]],[["35","G3 G3 W3 W3 G3 G3 Y3 G3 Y3 Y3 G3 W3 Y3 G3 W3 Y3 W3 Y3 Y3 Y3 Y3 G3 G3 Y3 Y3 G3 G3 G3 G3 G3 Y3 W3 W3 W3 G3"],["2"]],[["35","R2 R2 R2 R2 G3 G2 Y3 G2 R3 W5 G4 Y3 Y3 G2 Y5 W5 G4 G2 W4 Y2 W3 R5 W5 G4 G4 Y2 G2 Y5 G2 Y4 W3 G5 G2 R3 G4"],["6"]],[["35","G2 Y1 Y1 R4 G5 B5 R2 G4 G2 G3 W4 W1 B3 W5 R2 Y5 R4 R4 B5 Y2 B4 B1 R3 G4 Y3 G2 R4 G3 B2 G2 R3 B2 R1 W2 B4"],["8"]],[["35","W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2"],["6"]],[["35","Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3"],["2"]],[["35","W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3"],["2"]],[["25","Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5"],["7"]],[["25","W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2"],["7"]],[["25","Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4"],["7"]],[["25","B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1"],["7"]],[["25","G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3"],["8"]],[["25","R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5"],["7"]],[["5","W3 B1 Y1 R3 Y5"],["3"]],[["4","R1 R2 G1 Y5"],["2"]],[["4","R1 R2 G1 B3"],["2"]],[["15","Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1"],["6"]],[["4","G5 W5 W4 R3"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_129","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nans, n = int and b = int array of size 20\na = two dimensional bool array of sizes 10 and 10\nin function check returning bool\n i, j, r, l, tot = int\n for i = 1 to 5 inclusive\n set l and r to 0\n for j = 1 to 5 inclusive\n if a[i][j]\n increment l\n if b[j] increment r\n end of the block\n end of the block\n if l - 1 > r return false\n end of the block\n for i = 1 to 5 inclusive\n set l and r to 0\n for j = 1 to 5 inclusive\n if a[i][j]\n increment l\n if b[5 + j] increment r\n end of the block\n end of the block\n if l - 1 > r return false\n end of the block\n set tot to 0\n for i = 1 to 5 inclusive\n for j = 1 to 5 inclusive\n if a[i][j] and not b[i + 5] and not b[j] increment tot\n end of the block\n end of the block\n if tot > 1 return false\n return true\nend of the block\nin function dfs taking int x\n i, sum = int\n if x is 11\n if check\n set sum to 0\n for i = 1 to 11 inclusive\n if b[i] is 1 increment sum\n end of the block\n set ans to min of sum, ans\n end of the block\n return\n end of the block\n set b[x] to 1\n call dfs of x + 1\n set b[x] to 0\n call dfs of x + 1\nend of the block\ndefine the main function\n i, y = int\n ch = char\n k = int\n read n\n set all values of a to false\n for i = 1 to n inclusive\n read ch then k\n if ch is 'R'\n set y to 1\n else if ch is 'G'\n set y to 2\n else if ch is 'B'\n set y to 3\n else if ch is 'Y'\n set y to 4\n else if ch is 'W'\n set y to 5\n set a[y][k] to true\n end of the block\n set all values of b to 0\n set ans to 9999999\n noop\n call dfs of 1\n print ans\nend of the block\n\n[CODE]:","reference_output":"int b[20], ans, n;\nbool a[10][10];\nbool check() {\n int i, j, r, l, tot;\n for (i = 1; i <= 5; i++) {\n l = r = 0;\n for (j = 1; j <= 5; j++) {\n if (a[i][j]) {\n l++;\n if (b[j]) { r++; }\n }\n }\n if (l - 1 > r) return false;\n }\n for (i = 1; i <= 5; i++) {\n l = r = 0;\n for (j = 1; j <= 5; j++) {\n if (a[j][i]) {\n l++;\n if (b[5 + j]) r++;\n }\n }\n if (l - 1 > r) return false;\n }\n tot = 0;\n for (i = 1; i <= 5; i++) {\n for (j = 1; j <= 5; j++) {\n if (a[i][j] && !b[i + 5] && !b[j]) tot++;\n }\n }\n if (tot > 1) return false;\n return true;\n}\nvoid dfs(int x) {\n int i, sum;\n if (x == 11) {\n if (check()) {\n sum = 0;\n for (i = 1; i <= 11; i++) {\n if (b[i] == 1) sum++;\n }\n ans = min(sum, ans);\n }\n return;\n }\n b[x] = 1;\n dfs(x + 1);\n b[x] = 0;\n dfs(x + 1);\n}\nint main() {\n int i, y;\n char ch;\n int k;\n cin >> n;\n memset(a, false, sizeof(a));\n for (i = 1; i <= n; i++) {\n cin >> ch >> k;\n if (ch == 'R')\n y = 1;\n else if (ch == 'G')\n y = 2;\n else if (ch == 'B')\n y = 3;\n else if (ch == 'Y')\n y = 4;\n else if (ch == 'W')\n y = 5;\n a[y][k] = true;\n }\n memset(b, 0, sizeof(b));\n ans = 9999999;\n ;\n dfs(1);\n cout << ans << endl;\n}","item":{"problem_id":"442A","pseudocode":"ans, n = int and b = int array of size 20\na = two dimensional bool array of sizes 10 and 10\nin function check returning bool\n i, j, r, l, tot = int\n for i = 1 to 5 inclusive\n set l and r to 0\n for j = 1 to 5 inclusive\n if a[i][j]\n increment l\n if b[j] increment r\n end of the block\n end of the block\n if l - 1 > r return false\n end of the block\n for i = 1 to 5 inclusive\n set l and r to 0\n for j = 1 to 5 inclusive\n if a[i][j]\n increment l\n if b[5 + j] increment r\n end of the block\n end of the block\n if l - 1 > r return false\n end of the block\n set tot to 0\n for i = 1 to 5 inclusive\n for j = 1 to 5 inclusive\n if a[i][j] and not b[i + 5] and not b[j] increment tot\n end of the block\n end of the block\n if tot > 1 return false\n return true\nend of the block\nin function dfs taking int x\n i, sum = int\n if x is 11\n if check\n set sum to 0\n for i = 1 to 11 inclusive\n if b[i] is 1 increment sum\n end of the block\n set ans to min of sum, ans\n end of the block\n return\n end of the block\n set b[x] to 1\n call dfs of x + 1\n set b[x] to 0\n call dfs of x + 1\nend of the block\ndefine the main function\n i, y = int\n ch = char\n k = int\n read n\n set all values of a to false\n for i = 1 to n inclusive\n read ch then k\n if ch is 'R'\n set y to 1\n else if ch is 'G'\n set y to 2\n else if ch is 'B'\n set y to 3\n else if ch is 'Y'\n set y to 4\n else if ch is 'W'\n set y to 5\n set a[y][k] to true\n end of the block\n set all values of b to 0\n set ans to 9999999\n noop\n call dfs of 1\n print ans\nend of the block","testcases":[[["2","G3 G3"],["0"]],[["4","G4 R4 R3 B3"],["2"]],[["5","B1 Y1 W1 G1 R1"],["4"]],[["10","Y4 B1 R3 G5 R5 W3 W5 W2 R1 Y1"],["6"]],[["3","G4 G3 B4"],["2"]],[["2","W3 Y5"],["1"]],[["2","W5 Y5"],["1"]],[["100","W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5"],["8"]],[["100","B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W5 W4 Y5 W1 B4 G3 R2 R3 W1 B4 Y4 G2 G2 R1 Y5 W1 Y3 B3 G5 Y3 G3 W2 W5 Y4 B2 Y5 R4 B2 Y3 W4 G2 G3 R2 W1 B4 B2 B1 Y2 Y2 Y3 W3 Y5 W1 R1 R1 R4 R4 R4 Y1 Y3 B2 Y3 Y1 R3 G4 G4 Y5 B5 W2 G1 G5 B3 G1 Y1 R2 G5 R2 Y5 R5 Y4 R4 W2"],["8"]],[["100","Y3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 Y5 Y2 Y5 Y4 Y1 Y2 Y1"],["4"]],[["100","G3 B3 G3 Y3 R3 G3 R3 G3 W3 B3 B3 B3 R3 Y3 Y3 W3 R3 B3 G3 W3 G3 W3 Y3 R3 Y3 W3 W3 G3 W3 G3 W3 Y3 G3 R3 Y3 W3 W3 Y3 Y3 Y3 R3 W3 R3 G3 W3 W3 G3 Y3 B3 W3 B3 Y3 G3 Y3 B3 Y3 W3 Y3 R3 Y3 R3 W3 W3 W3 G3 Y3 G3 R3 B3 R3 Y3 R3 Y3 R3 Y3 R3 Y3 R3 W3 Y3 R3 W3 W3 W3 G3 G3 Y3 B3 Y3 R3 G3 G3 B3 B3 Y3 R3 G3 R3 W3 G3"],["4"]],[["100","W5 Y5 Y3 W3 Y5 Y5 W5 W5 Y3 W5 Y5 Y3 W5 Y5 W5 W3 Y3 Y5 W3 W5 Y5 W3 Y5 Y3 W3 W3 Y3 Y5 W3 W3 Y3 Y5 W3 Y5 Y5 Y5 W5 Y5 W5 Y5 W5 W5 W3 W5 W3 Y3 W5 W3 W3 W5 Y3 Y5 W5 W5 W3 W5 W5 Y5 W5 W3 W3 W3 Y3 Y5 Y5 Y3 Y5 W5 W5 Y5 W3 W3 W5 Y5 Y5 Y3 W5 W5 W3 Y5 W3 W5 Y3 Y5 W5 Y3 Y3 W3 Y3 Y5 Y3 Y3 W5 Y5 Y3 Y5 Y3 W3 Y3 W5"],["2"]],[["100","Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y5 Y5 Y3 Y3 Y5 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5"],["1"]],[["100","Y3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 Y3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3"],["1"]],[["10","W1 Y4 Y3 W3 Y2 W2 W1 Y2 Y3 W3"],["3"]],[["10","W2 R2 B5 W5 W2 B3 B2 R5 Y5 R2"],["5"]],[["5","W3 Y5 W2 G3 Y3"],["3"]],[["5","W5 G5 W2 Y5 G2"],["3"]],[["5","W5 W3 Y3 Y5 W2"],["3"]],[["5","Y5 W3 W2 G5 W3"],["3"]],[["5","G5 G3 G5 G5 W2"],["2"]],[["5","W2 Y2 G3 G3 G3"],["2"]],[["5","G3 Y5 Y2 Y5 W3"],["3"]],[["5","W3 W5 Y3 W2 G5"],["3"]],[["5","Y3 Y2 Y3 Y5 Y5"],["2"]],[["5","W5 Y3 W5 W5 Y5"],["2"]],[["5","G3 Y3 G3 Y3 G3"],["1"]],[["5","G4 W5 Y4 Y4 R5"],["3"]],[["5","G3 R2 R5 B3 W4"],["4"]],[["5","W2 G5 W3 R4 R4"],["3"]],[["5","Y3 Y3 G3 Y3 W3"],["2"]],[["5","W5 W5 W3 Y3 Y5"],["2"]],[["35","G5 G5 G3 G2 G3 Y3 W3 Y3 G5 W5 G2 G2 W5 G5 G5 W3 G3 G2 Y3 W5 W3 G5 W5 G2 Y2 Y3 W5 G3 W3 W2 G2 W3 Y2 G3 G3"],["4"]],[["35","G3 G2 G5 G2 W2 G3 W2 W5 Y5 G5 W2 W2 W2 G5 Y2 G5 W5 W3 W2 Y2 G5 W5 W3 W5 Y2 Y5 W2 W2 W3 Y3 G2 W3 G5 G3 W2"],["4"]],[["35","W2 W3 Y2 G5 G2 W3 G5 Y2 W5 Y5 W3 G2 G3 W5 W2 W3 Y2 Y5 Y2 Y5 Y2 Y2 G2 Y5 W3 Y5 G3 Y2 G3 Y2 Y5 W5 G3 W5 W5"],["4"]],[["35","Y2 Y3 Y2 Y3 Y5 Y5 Y3 Y5 Y5 Y2 Y2 Y5 Y2 Y2 Y5 Y3 Y2 Y5 Y5 Y3 Y3 Y2 Y2 Y2 Y3 Y5 Y2 Y5 Y5 Y3 Y5 Y2 Y3 Y3 Y2"],["2"]],[["35","Y5 Y5 W5 Y5 W3 Y3 W5 W3 W5 W3 W5 Y5 Y3 W3 W5 W5 W5 W3 Y5 Y3 Y5 W5 W5 Y3 Y5 Y5 Y3 W5 W3 W3 W3 W5 Y5 W3 W5"],["2"]],[["35","G3 G3 W3 W3 G3 G3 Y3 G3 Y3 Y3 G3 W3 Y3 G3 W3 Y3 W3 Y3 Y3 Y3 Y3 G3 G3 Y3 Y3 G3 G3 G3 G3 G3 Y3 W3 W3 W3 G3"],["2"]],[["35","R2 R2 R2 R2 G3 G2 Y3 G2 R3 W5 G4 Y3 Y3 G2 Y5 W5 G4 G2 W4 Y2 W3 R5 W5 G4 G4 Y2 G2 Y5 G2 Y4 W3 G5 G2 R3 G4"],["6"]],[["35","G2 Y1 Y1 R4 G5 B5 R2 G4 G2 G3 W4 W1 B3 W5 R2 Y5 R4 R4 B5 Y2 B4 B1 R3 G4 Y3 G2 R4 G3 B2 G2 R3 B2 R1 W2 B4"],["8"]],[["35","W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2"],["6"]],[["35","Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3"],["2"]],[["35","W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3"],["2"]],[["25","Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5"],["7"]],[["25","W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2"],["7"]],[["25","Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4"],["7"]],[["25","B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1"],["7"]],[["25","G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3"],["8"]],[["25","R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5"],["7"]],[["5","W3 B1 Y1 R3 Y5"],["3"]],[["4","R1 R2 G1 Y5"],["2"]],[["4","R1 R2 G1 B3"],["2"]],[["15","Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1"],["6"]],[["4","G5 W5 W4 R3"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_130","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nnew static double constant EPS = 1e-5\nnew chat array colortable with elements 'R', 'G', 'B', 'Y' and 'W'\nint function getX with string argument s\n for i from 0 to 5 exclusive incrementing i\n if colortable[i] is equal to s[0], return i\n end of the block\n return -1\nend of the block\ngetY is a integer function with string argument s\n return s[1] - '1'\nend of the block\nbitcount is a int function with int argument b\n declare new integer variable ans = 0\n while b != 0\n increment ans\n change b to b & (b - 1)\n end of the block\n return ans\nend of the block\nbool function check with int arguments maskX and maskY and string arguments C1 and C2\n x1 is a new integer = result of getX(C1)\n create new integer variable x2 with value from getX(C2)\n declare integer variable y1 = value, returned by getY(C1)\n declare integer y2 = result of getY(C2)\n return true if x1 is equal to x2 and y1 = y2\n if x1 != x2\n if (maskX & (1 << x1)) != 0 || (maskX & (1 << x2)) != 0, return true\n end of the block\n if y1 != y2\n if (maskY & (1 << y1)) != 0 || (maskY & (1 << y2)) != 0, return true\n end of the block\n return false\nend of the block\ndefine the main function\n declare new integer variable n\n read n\n cards is a new vector of strings with n elements\n read n elements from the input into cards in a loop\n declare new integer ans = 100000\n sort cards\n remove duplicates from cards\n start for loop from maskX = 0 to 1 << 5 exclusive\n start for loop from maskY = 0 to 1 << 5 exclusive incrementing maskY\n create boolean variable with name ok = true\n incremen i in a loop from 0, while ok is true and i < size of cards\n for j from i + 1 to exclusive, assign the result of check(maskX, maskY, cards[i], cards[j]) to ok\n end of the block\n if ok is true, set the value of ans to min of ans and bitcount(maskX) + bitcount(maskY)\n end of the block\n end of the block\n print ans to the standard output\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"static const double EPS = 1e-5;\nchar colortable[] = {'R', 'G', 'B', 'Y', 'W'};\nint getX(string s) {\n for (int i = 0; i < 5; i++) {\n if (colortable[i] == s[0]) return i;\n }\n return -1;\n}\nint getY(string s) {\n return s[1] - '1';\n}\nint bitcount(int b) {\n int ans = 0;\n while (b != 0) {\n ans++;\n b &= b - 1;\n }\n return ans;\n}\nbool check(int maskX, int maskY, string C1, string C2) {\n int x1 = getX(C1);\n int x2 = getX(C2);\n int y1 = getY(C1);\n int y2 = getY(C2);\n if (x1 == x2 && y1 == y2) return true;\n if (x1 != x2) {\n if ((maskX & (1 << x1)) != 0 || (maskX & (1 << x2)) != 0) return true;\n }\n if (y1 != y2) {\n if ((maskY & (1 << y1)) != 0 || (maskY & (1 << y2)) != 0) return true;\n }\n return false;\n}\nint main() {\n int n;\n cin >> n;\n vector cards(n);\n for (int i = 0; i < n; i++) cin >> cards[i];\n int ans = 100000;\n sort(cards.begin(), cards.end());\n cards.erase(unique(cards.begin(), cards.end()), cards.end());\n for (int maskX = 0; maskX < (1 << 5); maskX++) {\n for (int maskY = 0; maskY < (1 << 5); maskY++) {\n bool ok = true;\n for (int i = 0; ok && (i < (int)cards.size()); i++) {\n for (int j = i + 1; ok && (j < (int)cards.size()); j++) { ok = check(maskX, maskY, cards[i], cards[j]); }\n }\n if (ok) { ans = min(ans, bitcount(maskX) + bitcount(maskY)); }\n }\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"442A","pseudocode":"new static double constant EPS = 1e-5\nnew chat array colortable with elements 'R', 'G', 'B', 'Y' and 'W'\nint function getX with string argument s\n for i from 0 to 5 exclusive incrementing i\n if colortable[i] is equal to s[0], return i\n end of the block\n return -1\nend of the block\ngetY is a integer function with string argument s\n return s[1] - '1'\nend of the block\nbitcount is a int function with int argument b\n declare new integer variable ans = 0\n while b != 0\n increment ans\n change b to b & (b - 1)\n end of the block\n return ans\nend of the block\nbool function check with int arguments maskX and maskY and string arguments C1 and C2\n x1 is a new integer = result of getX(C1)\n create new integer variable x2 with value from getX(C2)\n declare integer variable y1 = value, returned by getY(C1)\n declare integer y2 = result of getY(C2)\n return true if x1 is equal to x2 and y1 = y2\n if x1 != x2\n if (maskX & (1 << x1)) != 0 || (maskX & (1 << x2)) != 0, return true\n end of the block\n if y1 != y2\n if (maskY & (1 << y1)) != 0 || (maskY & (1 << y2)) != 0, return true\n end of the block\n return false\nend of the block\ndefine the main function\n declare new integer variable n\n read n\n cards is a new vector of strings with n elements\n read n elements from the input into cards in a loop\n declare new integer ans = 100000\n sort cards\n remove duplicates from cards\n start for loop from maskX = 0 to 1 << 5 exclusive\n start for loop from maskY = 0 to 1 << 5 exclusive incrementing maskY\n create boolean variable with name ok = true\n incremen i in a loop from 0, while ok is true and i < size of cards\n for j from i + 1 to exclusive, assign the result of check(maskX, maskY, cards[i], cards[j]) to ok\n end of the block\n if ok is true, set the value of ans to min of ans and bitcount(maskX) + bitcount(maskY)\n end of the block\n end of the block\n print ans to the standard output\n return to indicate successful execution\nend of the block","testcases":[[["2","G3 G3"],["0"]],[["4","G4 R4 R3 B3"],["2"]],[["5","B1 Y1 W1 G1 R1"],["4"]],[["10","Y4 B1 R3 G5 R5 W3 W5 W2 R1 Y1"],["6"]],[["3","G4 G3 B4"],["2"]],[["2","W3 Y5"],["1"]],[["2","W5 Y5"],["1"]],[["100","W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5"],["8"]],[["100","B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W5 W4 Y5 W1 B4 G3 R2 R3 W1 B4 Y4 G2 G2 R1 Y5 W1 Y3 B3 G5 Y3 G3 W2 W5 Y4 B2 Y5 R4 B2 Y3 W4 G2 G3 R2 W1 B4 B2 B1 Y2 Y2 Y3 W3 Y5 W1 R1 R1 R4 R4 R4 Y1 Y3 B2 Y3 Y1 R3 G4 G4 Y5 B5 W2 G1 G5 B3 G1 Y1 R2 G5 R2 Y5 R5 Y4 R4 W2"],["8"]],[["100","Y3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 Y5 Y2 Y5 Y4 Y1 Y2 Y1"],["4"]],[["100","G3 B3 G3 Y3 R3 G3 R3 G3 W3 B3 B3 B3 R3 Y3 Y3 W3 R3 B3 G3 W3 G3 W3 Y3 R3 Y3 W3 W3 G3 W3 G3 W3 Y3 G3 R3 Y3 W3 W3 Y3 Y3 Y3 R3 W3 R3 G3 W3 W3 G3 Y3 B3 W3 B3 Y3 G3 Y3 B3 Y3 W3 Y3 R3 Y3 R3 W3 W3 W3 G3 Y3 G3 R3 B3 R3 Y3 R3 Y3 R3 Y3 R3 Y3 R3 W3 Y3 R3 W3 W3 W3 G3 G3 Y3 B3 Y3 R3 G3 G3 B3 B3 Y3 R3 G3 R3 W3 G3"],["4"]],[["100","W5 Y5 Y3 W3 Y5 Y5 W5 W5 Y3 W5 Y5 Y3 W5 Y5 W5 W3 Y3 Y5 W3 W5 Y5 W3 Y5 Y3 W3 W3 Y3 Y5 W3 W3 Y3 Y5 W3 Y5 Y5 Y5 W5 Y5 W5 Y5 W5 W5 W3 W5 W3 Y3 W5 W3 W3 W5 Y3 Y5 W5 W5 W3 W5 W5 Y5 W5 W3 W3 W3 Y3 Y5 Y5 Y3 Y5 W5 W5 Y5 W3 W3 W5 Y5 Y5 Y3 W5 W5 W3 Y5 W3 W5 Y3 Y5 W5 Y3 Y3 W3 Y3 Y5 Y3 Y3 W5 Y5 Y3 Y5 Y3 W3 Y3 W5"],["2"]],[["100","Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y5 Y5 Y3 Y3 Y5 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5"],["1"]],[["100","Y3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 Y3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3"],["1"]],[["10","W1 Y4 Y3 W3 Y2 W2 W1 Y2 Y3 W3"],["3"]],[["10","W2 R2 B5 W5 W2 B3 B2 R5 Y5 R2"],["5"]],[["5","W3 Y5 W2 G3 Y3"],["3"]],[["5","W5 G5 W2 Y5 G2"],["3"]],[["5","W5 W3 Y3 Y5 W2"],["3"]],[["5","Y5 W3 W2 G5 W3"],["3"]],[["5","G5 G3 G5 G5 W2"],["2"]],[["5","W2 Y2 G3 G3 G3"],["2"]],[["5","G3 Y5 Y2 Y5 W3"],["3"]],[["5","W3 W5 Y3 W2 G5"],["3"]],[["5","Y3 Y2 Y3 Y5 Y5"],["2"]],[["5","W5 Y3 W5 W5 Y5"],["2"]],[["5","G3 Y3 G3 Y3 G3"],["1"]],[["5","G4 W5 Y4 Y4 R5"],["3"]],[["5","G3 R2 R5 B3 W4"],["4"]],[["5","W2 G5 W3 R4 R4"],["3"]],[["5","Y3 Y3 G3 Y3 W3"],["2"]],[["5","W5 W5 W3 Y3 Y5"],["2"]],[["35","G5 G5 G3 G2 G3 Y3 W3 Y3 G5 W5 G2 G2 W5 G5 G5 W3 G3 G2 Y3 W5 W3 G5 W5 G2 Y2 Y3 W5 G3 W3 W2 G2 W3 Y2 G3 G3"],["4"]],[["35","G3 G2 G5 G2 W2 G3 W2 W5 Y5 G5 W2 W2 W2 G5 Y2 G5 W5 W3 W2 Y2 G5 W5 W3 W5 Y2 Y5 W2 W2 W3 Y3 G2 W3 G5 G3 W2"],["4"]],[["35","W2 W3 Y2 G5 G2 W3 G5 Y2 W5 Y5 W3 G2 G3 W5 W2 W3 Y2 Y5 Y2 Y5 Y2 Y2 G2 Y5 W3 Y5 G3 Y2 G3 Y2 Y5 W5 G3 W5 W5"],["4"]],[["35","Y2 Y3 Y2 Y3 Y5 Y5 Y3 Y5 Y5 Y2 Y2 Y5 Y2 Y2 Y5 Y3 Y2 Y5 Y5 Y3 Y3 Y2 Y2 Y2 Y3 Y5 Y2 Y5 Y5 Y3 Y5 Y2 Y3 Y3 Y2"],["2"]],[["35","Y5 Y5 W5 Y5 W3 Y3 W5 W3 W5 W3 W5 Y5 Y3 W3 W5 W5 W5 W3 Y5 Y3 Y5 W5 W5 Y3 Y5 Y5 Y3 W5 W3 W3 W3 W5 Y5 W3 W5"],["2"]],[["35","G3 G3 W3 W3 G3 G3 Y3 G3 Y3 Y3 G3 W3 Y3 G3 W3 Y3 W3 Y3 Y3 Y3 Y3 G3 G3 Y3 Y3 G3 G3 G3 G3 G3 Y3 W3 W3 W3 G3"],["2"]],[["35","R2 R2 R2 R2 G3 G2 Y3 G2 R3 W5 G4 Y3 Y3 G2 Y5 W5 G4 G2 W4 Y2 W3 R5 W5 G4 G4 Y2 G2 Y5 G2 Y4 W3 G5 G2 R3 G4"],["6"]],[["35","G2 Y1 Y1 R4 G5 B5 R2 G4 G2 G3 W4 W1 B3 W5 R2 Y5 R4 R4 B5 Y2 B4 B1 R3 G4 Y3 G2 R4 G3 B2 G2 R3 B2 R1 W2 B4"],["8"]],[["35","W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2"],["6"]],[["35","Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3"],["2"]],[["35","W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3"],["2"]],[["25","Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5"],["7"]],[["25","W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2"],["7"]],[["25","Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4"],["7"]],[["25","B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1"],["7"]],[["25","G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3"],["8"]],[["25","R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5"],["7"]],[["5","W3 B1 Y1 R3 Y5"],["3"]],[["4","R1 R2 G1 Y5"],["2"]],[["4","R1 R2 G1 B3"],["2"]],[["15","Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1"],["6"]],[["4","G5 W5 W4 R3"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_131","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmake constant ints N = 5e5 and inf = 1e9\ncreate map m of chars to ints\ncreate int n and int arrays tmp of size N, x of size N, and y of size N\ndeclare Ok taking in int cur and returning bool\n for i = 0 to n exclusive\n set tmp[i] to 0\n set tmp[i] to tmp[i] | (1 << (x[i] - 1)) & cur\n set tmp[i] to tmp[i] | (1 << (y[i] - 1 + 5)) & cur\n for j = 0 to i exclusive\n if tmp[i] is equal to tmp[j] and if x[i] is not equal to x[j] or y[i] is not equal to y[j], return false\n end of the block\n end of the block\n return true\nend of the block\ndefine the main function\n set M['R'] to 1, M['G'] to 2, M['B'] to 3, M['Y'] to 4, and M['W'] to 5\n read n\n for i = 0 to n exclusive\n make string s\n read s\n set x[i] to M[s[0]]\n set y[i] to s[1] - '0'\n end of the block\n create integer res = 10\n for i = 0 to (1 << 10) exclusive\n make integer cur = _builtin_popcount(i)\n if cur is greater than or equal to res, continue loop\n if Ok(i) is truthy, set res to cur\n end of the block\n print res\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int N = 5e5, inf = 1e9 + 7;\nmap M;\nint tmp[N], x[N], y[N], n;\nbool Ok(int cur) {\n for (int i = 0; i < n; i++) {\n tmp[i] = 0;\n tmp[i] |= (1 << (x[i] - 1)) & cur;\n tmp[i] |= (1 << (y[i] - 1 + 5)) & cur;\n for (int j = 0; j < i; j++) {\n if (tmp[i] == tmp[j] && (x[i] != x[j] || y[i] != y[j])) return false;\n }\n }\n return true;\n}\nint main() {\n M['R'] = 1, M['G'] = 2, M['B'] = 3, M['Y'] = 4, M['W'] = 5;\n cin >> n;\n for (int i = 0; i < n; i++) {\n string s;\n cin >> s;\n x[i] = M[s[0]];\n y[i] = s[1] - '0';\n }\n int res = 10;\n for (int i = 0; i < (1 << 10); i++) {\n int cur = __builtin_popcount(i);\n if (cur >= res) continue;\n if (Ok(i)) res = cur;\n }\n cout << res << \"\\n\";\n return 0;\n}","item":{"problem_id":"442A","pseudocode":"make constant ints N = 5e5 and inf = 1e9\ncreate map m of chars to ints\ncreate int n and int arrays tmp of size N, x of size N, and y of size N\ndeclare Ok taking in int cur and returning bool\n for i = 0 to n exclusive\n set tmp[i] to 0\n set tmp[i] to tmp[i] | (1 << (x[i] - 1)) & cur\n set tmp[i] to tmp[i] | (1 << (y[i] - 1 + 5)) & cur\n for j = 0 to i exclusive\n if tmp[i] is equal to tmp[j] and if x[i] is not equal to x[j] or y[i] is not equal to y[j], return false\n end of the block\n end of the block\n return true\nend of the block\ndefine the main function\n set M['R'] to 1, M['G'] to 2, M['B'] to 3, M['Y'] to 4, and M['W'] to 5\n read n\n for i = 0 to n exclusive\n make string s\n read s\n set x[i] to M[s[0]]\n set y[i] to s[1] - '0'\n end of the block\n create integer res = 10\n for i = 0 to (1 << 10) exclusive\n make integer cur = _builtin_popcount(i)\n if cur is greater than or equal to res, continue loop\n if Ok(i) is truthy, set res to cur\n end of the block\n print res\n return to indicate successful execution\nend of the block","testcases":[[["2","G3 G3"],["0"]],[["4","G4 R4 R3 B3"],["2"]],[["5","B1 Y1 W1 G1 R1"],["4"]],[["10","Y4 B1 R3 G5 R5 W3 W5 W2 R1 Y1"],["6"]],[["3","G4 G3 B4"],["2"]],[["2","W3 Y5"],["1"]],[["2","W5 Y5"],["1"]],[["100","W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5"],["8"]],[["100","B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W5 W4 Y5 W1 B4 G3 R2 R3 W1 B4 Y4 G2 G2 R1 Y5 W1 Y3 B3 G5 Y3 G3 W2 W5 Y4 B2 Y5 R4 B2 Y3 W4 G2 G3 R2 W1 B4 B2 B1 Y2 Y2 Y3 W3 Y5 W1 R1 R1 R4 R4 R4 Y1 Y3 B2 Y3 Y1 R3 G4 G4 Y5 B5 W2 G1 G5 B3 G1 Y1 R2 G5 R2 Y5 R5 Y4 R4 W2"],["8"]],[["100","Y3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 Y5 Y2 Y5 Y4 Y1 Y2 Y1"],["4"]],[["100","G3 B3 G3 Y3 R3 G3 R3 G3 W3 B3 B3 B3 R3 Y3 Y3 W3 R3 B3 G3 W3 G3 W3 Y3 R3 Y3 W3 W3 G3 W3 G3 W3 Y3 G3 R3 Y3 W3 W3 Y3 Y3 Y3 R3 W3 R3 G3 W3 W3 G3 Y3 B3 W3 B3 Y3 G3 Y3 B3 Y3 W3 Y3 R3 Y3 R3 W3 W3 W3 G3 Y3 G3 R3 B3 R3 Y3 R3 Y3 R3 Y3 R3 Y3 R3 W3 Y3 R3 W3 W3 W3 G3 G3 Y3 B3 Y3 R3 G3 G3 B3 B3 Y3 R3 G3 R3 W3 G3"],["4"]],[["100","W5 Y5 Y3 W3 Y5 Y5 W5 W5 Y3 W5 Y5 Y3 W5 Y5 W5 W3 Y3 Y5 W3 W5 Y5 W3 Y5 Y3 W3 W3 Y3 Y5 W3 W3 Y3 Y5 W3 Y5 Y5 Y5 W5 Y5 W5 Y5 W5 W5 W3 W5 W3 Y3 W5 W3 W3 W5 Y3 Y5 W5 W5 W3 W5 W5 Y5 W5 W3 W3 W3 Y3 Y5 Y5 Y3 Y5 W5 W5 Y5 W3 W3 W5 Y5 Y5 Y3 W5 W5 W3 Y5 W3 W5 Y3 Y5 W5 Y3 Y3 W3 Y3 Y5 Y3 Y3 W5 Y5 Y3 Y5 Y3 W3 Y3 W5"],["2"]],[["100","Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y5 Y5 Y3 Y3 Y5 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5"],["1"]],[["100","Y3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 Y3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3"],["1"]],[["10","W1 Y4 Y3 W3 Y2 W2 W1 Y2 Y3 W3"],["3"]],[["10","W2 R2 B5 W5 W2 B3 B2 R5 Y5 R2"],["5"]],[["5","W3 Y5 W2 G3 Y3"],["3"]],[["5","W5 G5 W2 Y5 G2"],["3"]],[["5","W5 W3 Y3 Y5 W2"],["3"]],[["5","Y5 W3 W2 G5 W3"],["3"]],[["5","G5 G3 G5 G5 W2"],["2"]],[["5","W2 Y2 G3 G3 G3"],["2"]],[["5","G3 Y5 Y2 Y5 W3"],["3"]],[["5","W3 W5 Y3 W2 G5"],["3"]],[["5","Y3 Y2 Y3 Y5 Y5"],["2"]],[["5","W5 Y3 W5 W5 Y5"],["2"]],[["5","G3 Y3 G3 Y3 G3"],["1"]],[["5","G4 W5 Y4 Y4 R5"],["3"]],[["5","G3 R2 R5 B3 W4"],["4"]],[["5","W2 G5 W3 R4 R4"],["3"]],[["5","Y3 Y3 G3 Y3 W3"],["2"]],[["5","W5 W5 W3 Y3 Y5"],["2"]],[["35","G5 G5 G3 G2 G3 Y3 W3 Y3 G5 W5 G2 G2 W5 G5 G5 W3 G3 G2 Y3 W5 W3 G5 W5 G2 Y2 Y3 W5 G3 W3 W2 G2 W3 Y2 G3 G3"],["4"]],[["35","G3 G2 G5 G2 W2 G3 W2 W5 Y5 G5 W2 W2 W2 G5 Y2 G5 W5 W3 W2 Y2 G5 W5 W3 W5 Y2 Y5 W2 W2 W3 Y3 G2 W3 G5 G3 W2"],["4"]],[["35","W2 W3 Y2 G5 G2 W3 G5 Y2 W5 Y5 W3 G2 G3 W5 W2 W3 Y2 Y5 Y2 Y5 Y2 Y2 G2 Y5 W3 Y5 G3 Y2 G3 Y2 Y5 W5 G3 W5 W5"],["4"]],[["35","Y2 Y3 Y2 Y3 Y5 Y5 Y3 Y5 Y5 Y2 Y2 Y5 Y2 Y2 Y5 Y3 Y2 Y5 Y5 Y3 Y3 Y2 Y2 Y2 Y3 Y5 Y2 Y5 Y5 Y3 Y5 Y2 Y3 Y3 Y2"],["2"]],[["35","Y5 Y5 W5 Y5 W3 Y3 W5 W3 W5 W3 W5 Y5 Y3 W3 W5 W5 W5 W3 Y5 Y3 Y5 W5 W5 Y3 Y5 Y5 Y3 W5 W3 W3 W3 W5 Y5 W3 W5"],["2"]],[["35","G3 G3 W3 W3 G3 G3 Y3 G3 Y3 Y3 G3 W3 Y3 G3 W3 Y3 W3 Y3 Y3 Y3 Y3 G3 G3 Y3 Y3 G3 G3 G3 G3 G3 Y3 W3 W3 W3 G3"],["2"]],[["35","R2 R2 R2 R2 G3 G2 Y3 G2 R3 W5 G4 Y3 Y3 G2 Y5 W5 G4 G2 W4 Y2 W3 R5 W5 G4 G4 Y2 G2 Y5 G2 Y4 W3 G5 G2 R3 G4"],["6"]],[["35","G2 Y1 Y1 R4 G5 B5 R2 G4 G2 G3 W4 W1 B3 W5 R2 Y5 R4 R4 B5 Y2 B4 B1 R3 G4 Y3 G2 R4 G3 B2 G2 R3 B2 R1 W2 B4"],["8"]],[["35","W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2"],["6"]],[["35","Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3"],["2"]],[["35","W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3"],["2"]],[["25","Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5"],["7"]],[["25","W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2"],["7"]],[["25","Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4"],["7"]],[["25","B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1"],["7"]],[["25","G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3"],["8"]],[["25","R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5"],["7"]],[["5","W3 B1 Y1 R3 Y5"],["3"]],[["4","R1 R2 G1 Y5"],["2"]],[["4","R1 R2 G1 B3"],["2"]],[["15","Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1"],["6"]],[["4","G5 W5 W4 R3"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_132","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate new integer constant INF = 2147483647\ndefine integer constant mod =1000000007\nnew constant integer tmod = 1000000009\nlet ma be a map from characters to integers\ncreate new array of integers vis with size 25\ndeclare vector of integers v\ndeclare new array of integers sum with size 25\na1 is an array of integers with 5 elements\ncreate new array of integers a2 with size 5\ndefine the main function\n declare new integer called n\n read variable n from the input\n assign 0 to ma['R']\n change ma['G'] to 1\n assign the new value = 2 to ma['B']\n set ma['Y'] to 3\n assign the new value = 4 to ma['W']\n start for loop from i = 0 to n exclusive\n define string str\n read input to str\n declare new integer tmp = ma[str[0]] * 5 + str[1] - '1'\n change vis[tmp] to 1\n end of the block\n start for loop from i = 0 to 25 exclusive incrementing i\n if vis[i] is true, add i to v\n define integer ans = 10\n in a for loop, change s from 0 to 1 << 10 exclusive\n set the values of first sizeof(a1) bytes at the pointer a1 to 0\n set first sizeof(a2) bytes at the pointer a2 to 0\n change the values of first sizeof(sum) bytes at the pointer sum to 0\n create integer pos with value 1\n for integer i = 0 to 5 exclusive\n if (s >> i) & 1 != 0, change the value of a1[i] to pos and increment pos\n declare integer variable with name pos2 = 1\n for i from 5 to 10 exclusive\n if (s >> i) & 1 != 0, set a2[i % 5] to pos2 and increase pos2 by 1\n for integer i = 0 to (ength of v exclusive\n define integer tmp with value v[i]\n define new integer called l with value = value of a1[tmp \/ 5]\n new integer r = value of a2[tmp % 5]\n increment sum[l * 5 + r] by one\n end of the block\n create new boolean flag = true\n in a for loop, change i from 0 to 25 exclusive incrementing i\n if sum[i] is greater than 1\n assign the new value = false to flag\n stop the loop\n end of the block\n if flag is false, skip the rest of the loop\n change ans to min of ans and pos - 1 + pos2 - 1\n end of the block\n print ans and '\\n'\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int INF = 2147483647;\nconst int mod = 1000000007;\nconst int tmod = 1000000009;\nmap ma;\nint vis[25];\nvector v;\nint sum[25];\nint a1[5];\nint a2[5];\nint main() {\n int n;\n cin >> n;\n ma['R'] = 0;\n ma['G'] = 1;\n ma['B'] = 2;\n ma['Y'] = 3;\n ma['W'] = 4;\n for (int i = 0; i < (n); i++) {\n string str;\n cin >> str;\n int tmp = ma[str[0]] * 5 + str[1] - '1';\n vis[tmp] = 1;\n }\n for (int i = 0; i < (25); i++)\n if (vis[i]) v.push_back(i);\n int ans = 10;\n for (int s = 0; s < (1 << 10); s++) {\n memset(a1, 0, sizeof(a1));\n memset(a2, 0, sizeof(a2));\n memset(sum, 0, sizeof(sum));\n int pos = 1;\n for (int i = 0; i < 5; i++)\n if ((s >> i) & 1) a1[i] = pos++;\n int pos2 = 1;\n for (int i = 5; i < 10; i++)\n if ((s >> i) & 1) a2[i % 5] = pos2++;\n for (int i = 0; i < (v.size()); i++) {\n int tmp = v[i];\n int l = a1[tmp \/ 5];\n int r = a2[tmp % 5];\n sum[l * 5 + r]++;\n }\n bool flag = true;\n for (int i = 0; i < (25); i++)\n if (sum[i] > 1) {\n flag = false;\n break;\n }\n if (!flag) continue;\n ans = min(ans, pos - 1 + pos2 - 1);\n }\n cout << ans << '\\n';\n return 0;\n}","item":{"problem_id":"442A","pseudocode":"create new integer constant INF = 2147483647\ndefine integer constant mod =1000000007\nnew constant integer tmod = 1000000009\nlet ma be a map from characters to integers\ncreate new array of integers vis with size 25\ndeclare vector of integers v\ndeclare new array of integers sum with size 25\na1 is an array of integers with 5 elements\ncreate new array of integers a2 with size 5\ndefine the main function\n declare new integer called n\n read variable n from the input\n assign 0 to ma['R']\n change ma['G'] to 1\n assign the new value = 2 to ma['B']\n set ma['Y'] to 3\n assign the new value = 4 to ma['W']\n start for loop from i = 0 to n exclusive\n define string str\n read input to str\n declare new integer tmp = ma[str[0]] * 5 + str[1] - '1'\n change vis[tmp] to 1\n end of the block\n start for loop from i = 0 to 25 exclusive incrementing i\n if vis[i] is true, add i to v\n define integer ans = 10\n in a for loop, change s from 0 to 1 << 10 exclusive\n set the values of first sizeof(a1) bytes at the pointer a1 to 0\n set first sizeof(a2) bytes at the pointer a2 to 0\n change the values of first sizeof(sum) bytes at the pointer sum to 0\n create integer pos with value 1\n for integer i = 0 to 5 exclusive\n if (s >> i) & 1 != 0, change the value of a1[i] to pos and increment pos\n declare integer variable with name pos2 = 1\n for i from 5 to 10 exclusive\n if (s >> i) & 1 != 0, set a2[i % 5] to pos2 and increase pos2 by 1\n for integer i = 0 to (ength of v exclusive\n define integer tmp with value v[i]\n define new integer called l with value = value of a1[tmp \/ 5]\n new integer r = value of a2[tmp % 5]\n increment sum[l * 5 + r] by one\n end of the block\n create new boolean flag = true\n in a for loop, change i from 0 to 25 exclusive incrementing i\n if sum[i] is greater than 1\n assign the new value = false to flag\n stop the loop\n end of the block\n if flag is false, skip the rest of the loop\n change ans to min of ans and pos - 1 + pos2 - 1\n end of the block\n print ans and '\\n'\n return to indicate successful execution\nend of the block","testcases":[[["2","G3 G3"],["0"]],[["4","G4 R4 R3 B3"],["2"]],[["5","B1 Y1 W1 G1 R1"],["4"]],[["10","Y4 B1 R3 G5 R5 W3 W5 W2 R1 Y1"],["6"]],[["3","G4 G3 B4"],["2"]],[["2","W3 Y5"],["1"]],[["2","W5 Y5"],["1"]],[["100","W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5"],["8"]],[["100","B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W5 W4 Y5 W1 B4 G3 R2 R3 W1 B4 Y4 G2 G2 R1 Y5 W1 Y3 B3 G5 Y3 G3 W2 W5 Y4 B2 Y5 R4 B2 Y3 W4 G2 G3 R2 W1 B4 B2 B1 Y2 Y2 Y3 W3 Y5 W1 R1 R1 R4 R4 R4 Y1 Y3 B2 Y3 Y1 R3 G4 G4 Y5 B5 W2 G1 G5 B3 G1 Y1 R2 G5 R2 Y5 R5 Y4 R4 W2"],["8"]],[["100","Y3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 Y5 Y2 Y5 Y4 Y1 Y2 Y1"],["4"]],[["100","G3 B3 G3 Y3 R3 G3 R3 G3 W3 B3 B3 B3 R3 Y3 Y3 W3 R3 B3 G3 W3 G3 W3 Y3 R3 Y3 W3 W3 G3 W3 G3 W3 Y3 G3 R3 Y3 W3 W3 Y3 Y3 Y3 R3 W3 R3 G3 W3 W3 G3 Y3 B3 W3 B3 Y3 G3 Y3 B3 Y3 W3 Y3 R3 Y3 R3 W3 W3 W3 G3 Y3 G3 R3 B3 R3 Y3 R3 Y3 R3 Y3 R3 Y3 R3 W3 Y3 R3 W3 W3 W3 G3 G3 Y3 B3 Y3 R3 G3 G3 B3 B3 Y3 R3 G3 R3 W3 G3"],["4"]],[["100","W5 Y5 Y3 W3 Y5 Y5 W5 W5 Y3 W5 Y5 Y3 W5 Y5 W5 W3 Y3 Y5 W3 W5 Y5 W3 Y5 Y3 W3 W3 Y3 Y5 W3 W3 Y3 Y5 W3 Y5 Y5 Y5 W5 Y5 W5 Y5 W5 W5 W3 W5 W3 Y3 W5 W3 W3 W5 Y3 Y5 W5 W5 W3 W5 W5 Y5 W5 W3 W3 W3 Y3 Y5 Y5 Y3 Y5 W5 W5 Y5 W3 W3 W5 Y5 Y5 Y3 W5 W5 W3 Y5 W3 W5 Y3 Y5 W5 Y3 Y3 W3 Y3 Y5 Y3 Y3 W5 Y5 Y3 Y5 Y3 W3 Y3 W5"],["2"]],[["100","Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y5 Y5 Y3 Y3 Y5 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5"],["1"]],[["100","Y3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 Y3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3"],["1"]],[["10","W1 Y4 Y3 W3 Y2 W2 W1 Y2 Y3 W3"],["3"]],[["10","W2 R2 B5 W5 W2 B3 B2 R5 Y5 R2"],["5"]],[["5","W3 Y5 W2 G3 Y3"],["3"]],[["5","W5 G5 W2 Y5 G2"],["3"]],[["5","W5 W3 Y3 Y5 W2"],["3"]],[["5","Y5 W3 W2 G5 W3"],["3"]],[["5","G5 G3 G5 G5 W2"],["2"]],[["5","W2 Y2 G3 G3 G3"],["2"]],[["5","G3 Y5 Y2 Y5 W3"],["3"]],[["5","W3 W5 Y3 W2 G5"],["3"]],[["5","Y3 Y2 Y3 Y5 Y5"],["2"]],[["5","W5 Y3 W5 W5 Y5"],["2"]],[["5","G3 Y3 G3 Y3 G3"],["1"]],[["5","G4 W5 Y4 Y4 R5"],["3"]],[["5","G3 R2 R5 B3 W4"],["4"]],[["5","W2 G5 W3 R4 R4"],["3"]],[["5","Y3 Y3 G3 Y3 W3"],["2"]],[["5","W5 W5 W3 Y3 Y5"],["2"]],[["35","G5 G5 G3 G2 G3 Y3 W3 Y3 G5 W5 G2 G2 W5 G5 G5 W3 G3 G2 Y3 W5 W3 G5 W5 G2 Y2 Y3 W5 G3 W3 W2 G2 W3 Y2 G3 G3"],["4"]],[["35","G3 G2 G5 G2 W2 G3 W2 W5 Y5 G5 W2 W2 W2 G5 Y2 G5 W5 W3 W2 Y2 G5 W5 W3 W5 Y2 Y5 W2 W2 W3 Y3 G2 W3 G5 G3 W2"],["4"]],[["35","W2 W3 Y2 G5 G2 W3 G5 Y2 W5 Y5 W3 G2 G3 W5 W2 W3 Y2 Y5 Y2 Y5 Y2 Y2 G2 Y5 W3 Y5 G3 Y2 G3 Y2 Y5 W5 G3 W5 W5"],["4"]],[["35","Y2 Y3 Y2 Y3 Y5 Y5 Y3 Y5 Y5 Y2 Y2 Y5 Y2 Y2 Y5 Y3 Y2 Y5 Y5 Y3 Y3 Y2 Y2 Y2 Y3 Y5 Y2 Y5 Y5 Y3 Y5 Y2 Y3 Y3 Y2"],["2"]],[["35","Y5 Y5 W5 Y5 W3 Y3 W5 W3 W5 W3 W5 Y5 Y3 W3 W5 W5 W5 W3 Y5 Y3 Y5 W5 W5 Y3 Y5 Y5 Y3 W5 W3 W3 W3 W5 Y5 W3 W5"],["2"]],[["35","G3 G3 W3 W3 G3 G3 Y3 G3 Y3 Y3 G3 W3 Y3 G3 W3 Y3 W3 Y3 Y3 Y3 Y3 G3 G3 Y3 Y3 G3 G3 G3 G3 G3 Y3 W3 W3 W3 G3"],["2"]],[["35","R2 R2 R2 R2 G3 G2 Y3 G2 R3 W5 G4 Y3 Y3 G2 Y5 W5 G4 G2 W4 Y2 W3 R5 W5 G4 G4 Y2 G2 Y5 G2 Y4 W3 G5 G2 R3 G4"],["6"]],[["35","G2 Y1 Y1 R4 G5 B5 R2 G4 G2 G3 W4 W1 B3 W5 R2 Y5 R4 R4 B5 Y2 B4 B1 R3 G4 Y3 G2 R4 G3 B2 G2 R3 B2 R1 W2 B4"],["8"]],[["35","W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2"],["6"]],[["35","Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3"],["2"]],[["35","W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3"],["2"]],[["25","Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5"],["7"]],[["25","W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2"],["7"]],[["25","Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4"],["7"]],[["25","B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1"],["7"]],[["25","G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3"],["8"]],[["25","R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5"],["7"]],[["5","W3 B1 Y1 R3 Y5"],["3"]],[["4","R1 R2 G1 Y5"],["2"]],[["4","R1 R2 G1 B3"],["2"]],[["15","Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1"],["6"]],[["4","G5 W5 W4 R3"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_133","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine arrays of shorts X and Y with size 105\nbin is a new array of shorts with size 15\ncreate constant integer variable C with value 5\ncreate a map from characters to integers called M\nvoid function trans with int argument x\n create new integer variable ind with value 0\n set first 12 elements of bin to 0\n while x > 0\n change the value of bin[ind] to x modulo 2 and increment ind\n change the value of s quared divided by 2\n end of the block\nend of the block\ndefine the main function\n create new character called ch\n define new integer n\n read n from the user input\n assign 0 to M['R']\n assign 1 to M['G']\n change the value of M['B'] to 2\n assign 3 to M['Y']\n assign the new value = 4 to M['W']\n for i = 0 to n exclusive\n read standard input to ch\n change the value of X[i] to M[ch]\n read ch\n assign the new value = ch - '1' to Y[i]\n end of the block\n define integers ans and anst with ans = 20\n declare boolean variable all\n new boolean ones = true\n start for loop from i = 0 to n - 1 exclusive, change ones to (X[i] == X[i + 1] && Y[i] == Y[i + 1]) && ones\n if ones is false\n for integer i = 1 to 1023 inclusive incrementing i\n call trans of i\n change the value of anst to 0\n assign the new value = true to all\n increment k in a loop from 0 to n - 1 exclusive\n for integer l = k + 1 to n exclusive\n if X[k] != X[l] and (bin[X[k]] or bin[X[l]] = 1)\n change the value of all to true\n else if Y[k] != Y[l] and (bin[Y[k] + C] or bin[Y[l] + C] = 1)\n change the value of all to true\n else if X[l] = X[k] and Y[l] = Y[k]\n assign true to all\n else\n assign false to all\n if all is false, break\n end of the block\n if all is false, break the loop\n end of the block\n if all is true\n for i = 0 to 12 exclusive\n if bin[i] is equal to 1, increment anst by one\n change the value of ans to anst of ans > anst\n end of the block\n end of the block\n else\n print 0\n if ones is false, print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"short X[105], Y[105];\nshort bin[15];\nconst int C = 5;\nmap M;\nvoid trans(int x) {\n int ind = 0;\n for (int j = 0; j < 12; j++) bin[j] = 0;\n while (x > 0) {\n bin[ind++] = x % 2;\n x \/= 2;\n }\n}\nint main() {\n char ch;\n int n;\n cin >> n;\n M['R'] = 0;\n M['G'] = 1;\n M['B'] = 2;\n M['Y'] = 3;\n M['W'] = 4;\n for (int i = 0; i < n; i++) {\n cin >> ch;\n X[i] = M[ch];\n cin >> ch;\n Y[i] = ch - '1';\n }\n int ans = 20, anst;\n bool all;\n bool ones = true;\n for (int i = 0; i < n - 1; i++) ones = (X[i] == X[i + 1] && Y[i] == Y[i + 1]) && ones;\n if (!ones) {\n for (int i = 1; i <= 1023; i++) {\n trans(i);\n anst = 0;\n all = true;\n for (int k = 0; k < n - 1; k++) {\n for (int l = k + 1; l < n; l++) {\n if (X[k] != X[l] && ((bin[X[k]] == 1) || (bin[X[l]] == 1)))\n all = true;\n else if (Y[k] != Y[l] && ((bin[Y[k] + C] == 1) || bin[Y[l] + C] == 1))\n all = true;\n else if (X[l] == X[k] && Y[l] == Y[k])\n all = true;\n else\n all = false;\n if (!all) break;\n }\n if (!all) break;\n }\n if (all) {\n for (int i = 0; i < 12; i++)\n if (bin[i] == 1) anst++;\n ans = ans > anst ? anst : ans;\n }\n }\n } else\n cout << 0 << endl;\n if (!ones) cout << ans << endl;\n return 0;\n}","item":{"problem_id":"442A","pseudocode":"define arrays of shorts X and Y with size 105\nbin is a new array of shorts with size 15\ncreate constant integer variable C with value 5\ncreate a map from characters to integers called M\nvoid function trans with int argument x\n create new integer variable ind with value 0\n set first 12 elements of bin to 0\n while x > 0\n change the value of bin[ind] to x modulo 2 and increment ind\n change the value of s quared divided by 2\n end of the block\nend of the block\ndefine the main function\n create new character called ch\n define new integer n\n read n from the user input\n assign 0 to M['R']\n assign 1 to M['G']\n change the value of M['B'] to 2\n assign 3 to M['Y']\n assign the new value = 4 to M['W']\n for i = 0 to n exclusive\n read standard input to ch\n change the value of X[i] to M[ch]\n read ch\n assign the new value = ch - '1' to Y[i]\n end of the block\n define integers ans and anst with ans = 20\n declare boolean variable all\n new boolean ones = true\n start for loop from i = 0 to n - 1 exclusive, change ones to (X[i] == X[i + 1] && Y[i] == Y[i + 1]) && ones\n if ones is false\n for integer i = 1 to 1023 inclusive incrementing i\n call trans of i\n change the value of anst to 0\n assign the new value = true to all\n increment k in a loop from 0 to n - 1 exclusive\n for integer l = k + 1 to n exclusive\n if X[k] != X[l] and (bin[X[k]] or bin[X[l]] = 1)\n change the value of all to true\n else if Y[k] != Y[l] and (bin[Y[k] + C] or bin[Y[l] + C] = 1)\n change the value of all to true\n else if X[l] = X[k] and Y[l] = Y[k]\n assign true to all\n else\n assign false to all\n if all is false, break\n end of the block\n if all is false, break the loop\n end of the block\n if all is true\n for i = 0 to 12 exclusive\n if bin[i] is equal to 1, increment anst by one\n change the value of ans to anst of ans > anst\n end of the block\n end of the block\n else\n print 0\n if ones is false, print ans\n return to indicate successful execution\nend of the block","testcases":[[["2","G3 G3"],["0"]],[["4","G4 R4 R3 B3"],["2"]],[["5","B1 Y1 W1 G1 R1"],["4"]],[["10","Y4 B1 R3 G5 R5 W3 W5 W2 R1 Y1"],["6"]],[["3","G4 G3 B4"],["2"]],[["2","W3 Y5"],["1"]],[["2","W5 Y5"],["1"]],[["100","W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5"],["8"]],[["100","B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W5 W4 Y5 W1 B4 G3 R2 R3 W1 B4 Y4 G2 G2 R1 Y5 W1 Y3 B3 G5 Y3 G3 W2 W5 Y4 B2 Y5 R4 B2 Y3 W4 G2 G3 R2 W1 B4 B2 B1 Y2 Y2 Y3 W3 Y5 W1 R1 R1 R4 R4 R4 Y1 Y3 B2 Y3 Y1 R3 G4 G4 Y5 B5 W2 G1 G5 B3 G1 Y1 R2 G5 R2 Y5 R5 Y4 R4 W2"],["8"]],[["100","Y3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 Y5 Y2 Y5 Y4 Y1 Y2 Y1"],["4"]],[["100","G3 B3 G3 Y3 R3 G3 R3 G3 W3 B3 B3 B3 R3 Y3 Y3 W3 R3 B3 G3 W3 G3 W3 Y3 R3 Y3 W3 W3 G3 W3 G3 W3 Y3 G3 R3 Y3 W3 W3 Y3 Y3 Y3 R3 W3 R3 G3 W3 W3 G3 Y3 B3 W3 B3 Y3 G3 Y3 B3 Y3 W3 Y3 R3 Y3 R3 W3 W3 W3 G3 Y3 G3 R3 B3 R3 Y3 R3 Y3 R3 Y3 R3 Y3 R3 W3 Y3 R3 W3 W3 W3 G3 G3 Y3 B3 Y3 R3 G3 G3 B3 B3 Y3 R3 G3 R3 W3 G3"],["4"]],[["100","W5 Y5 Y3 W3 Y5 Y5 W5 W5 Y3 W5 Y5 Y3 W5 Y5 W5 W3 Y3 Y5 W3 W5 Y5 W3 Y5 Y3 W3 W3 Y3 Y5 W3 W3 Y3 Y5 W3 Y5 Y5 Y5 W5 Y5 W5 Y5 W5 W5 W3 W5 W3 Y3 W5 W3 W3 W5 Y3 Y5 W5 W5 W3 W5 W5 Y5 W5 W3 W3 W3 Y3 Y5 Y5 Y3 Y5 W5 W5 Y5 W3 W3 W5 Y5 Y5 Y3 W5 W5 W3 Y5 W3 W5 Y3 Y5 W5 Y3 Y3 W3 Y3 Y5 Y3 Y3 W5 Y5 Y3 Y5 Y3 W3 Y3 W5"],["2"]],[["100","Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y5 Y5 Y3 Y3 Y5 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5"],["1"]],[["100","Y3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 Y3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3"],["1"]],[["10","W1 Y4 Y3 W3 Y2 W2 W1 Y2 Y3 W3"],["3"]],[["10","W2 R2 B5 W5 W2 B3 B2 R5 Y5 R2"],["5"]],[["5","W3 Y5 W2 G3 Y3"],["3"]],[["5","W5 G5 W2 Y5 G2"],["3"]],[["5","W5 W3 Y3 Y5 W2"],["3"]],[["5","Y5 W3 W2 G5 W3"],["3"]],[["5","G5 G3 G5 G5 W2"],["2"]],[["5","W2 Y2 G3 G3 G3"],["2"]],[["5","G3 Y5 Y2 Y5 W3"],["3"]],[["5","W3 W5 Y3 W2 G5"],["3"]],[["5","Y3 Y2 Y3 Y5 Y5"],["2"]],[["5","W5 Y3 W5 W5 Y5"],["2"]],[["5","G3 Y3 G3 Y3 G3"],["1"]],[["5","G4 W5 Y4 Y4 R5"],["3"]],[["5","G3 R2 R5 B3 W4"],["4"]],[["5","W2 G5 W3 R4 R4"],["3"]],[["5","Y3 Y3 G3 Y3 W3"],["2"]],[["5","W5 W5 W3 Y3 Y5"],["2"]],[["35","G5 G5 G3 G2 G3 Y3 W3 Y3 G5 W5 G2 G2 W5 G5 G5 W3 G3 G2 Y3 W5 W3 G5 W5 G2 Y2 Y3 W5 G3 W3 W2 G2 W3 Y2 G3 G3"],["4"]],[["35","G3 G2 G5 G2 W2 G3 W2 W5 Y5 G5 W2 W2 W2 G5 Y2 G5 W5 W3 W2 Y2 G5 W5 W3 W5 Y2 Y5 W2 W2 W3 Y3 G2 W3 G5 G3 W2"],["4"]],[["35","W2 W3 Y2 G5 G2 W3 G5 Y2 W5 Y5 W3 G2 G3 W5 W2 W3 Y2 Y5 Y2 Y5 Y2 Y2 G2 Y5 W3 Y5 G3 Y2 G3 Y2 Y5 W5 G3 W5 W5"],["4"]],[["35","Y2 Y3 Y2 Y3 Y5 Y5 Y3 Y5 Y5 Y2 Y2 Y5 Y2 Y2 Y5 Y3 Y2 Y5 Y5 Y3 Y3 Y2 Y2 Y2 Y3 Y5 Y2 Y5 Y5 Y3 Y5 Y2 Y3 Y3 Y2"],["2"]],[["35","Y5 Y5 W5 Y5 W3 Y3 W5 W3 W5 W3 W5 Y5 Y3 W3 W5 W5 W5 W3 Y5 Y3 Y5 W5 W5 Y3 Y5 Y5 Y3 W5 W3 W3 W3 W5 Y5 W3 W5"],["2"]],[["35","G3 G3 W3 W3 G3 G3 Y3 G3 Y3 Y3 G3 W3 Y3 G3 W3 Y3 W3 Y3 Y3 Y3 Y3 G3 G3 Y3 Y3 G3 G3 G3 G3 G3 Y3 W3 W3 W3 G3"],["2"]],[["35","R2 R2 R2 R2 G3 G2 Y3 G2 R3 W5 G4 Y3 Y3 G2 Y5 W5 G4 G2 W4 Y2 W3 R5 W5 G4 G4 Y2 G2 Y5 G2 Y4 W3 G5 G2 R3 G4"],["6"]],[["35","G2 Y1 Y1 R4 G5 B5 R2 G4 G2 G3 W4 W1 B3 W5 R2 Y5 R4 R4 B5 Y2 B4 B1 R3 G4 Y3 G2 R4 G3 B2 G2 R3 B2 R1 W2 B4"],["8"]],[["35","W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2"],["6"]],[["35","Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3"],["2"]],[["35","W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3"],["2"]],[["25","Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5"],["7"]],[["25","W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2"],["7"]],[["25","Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4"],["7"]],[["25","B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1"],["7"]],[["25","G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3"],["8"]],[["25","R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5"],["7"]],[["5","W3 B1 Y1 R3 Y5"],["3"]],[["4","R1 R2 G1 Y5"],["2"]],[["4","R1 R2 G1 B3"],["2"]],[["15","Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1"],["6"]],[["4","G5 W5 W4 R3"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_134","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nN = const int = 150\nlet x[N], y[N], info[N], n be ints\nin int function color_to_id taking char ch\n if ch = 'R' then return 1\n if ch = 'G' then return 2\n if ch = 'B' then return 3\n if ch = 'Y' then return 4\n if ch = 'W' then return 5\nend of the block\nin int function count_one taking x\n cnt = 0 = int\n while x isn't 0\n increment cnt by x&1\n x = x bit right shift 1\n end of the block\n return cnt\nend of the block\nin bool function check taking sta = int\n for i = 0 to n exclusive\n set info[i] = 0\n info[i] bitwise or (1 bitwise left shift (x[i] - 1)) bitwise and sta\n info[i] bitwise or (1 bitwise left shift (y[i] - 1 + 5)) bitwise and sta\n for j = 0 to i exclusive\n if info[i] = info[j] and (x[i] is not x[j] or y[i] is not y[j])\n end of the block\n return true\nend of the block\ndefine the main function\n str = string\n while reading n\n for i = 0 to n exclusive\n read str\n set x[i] = color_to_id of str[0]\n y[i] = str[1] - '0'\n end of the block\n ans = 10 = int\n for i = 0 to 1 bitwise left shit 10\n n_one = count_one(i) = int\n if n_one >= ans then go to next iteration\n if check(i) then set ans to n_one\n end of the block\n print ans\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int N = 150;\nint x[N], y[N], info[N], n;\nint color_to_id(char ch) {\n if (ch == 'R') return 1;\n if (ch == 'G') return 2;\n if (ch == 'B') return 3;\n if (ch == 'Y') return 4;\n if (ch == 'W') return 5;\n}\nint count_one(int x) {\n int cnt = 0;\n while (x) {\n cnt += (x & 1);\n x >>= 1;\n }\n return cnt;\n}\nbool check(int sta) {\n for (int i = 0; i < n; i++) {\n info[i] = 0;\n info[i] |= (1 << (x[i] - 1)) & sta;\n info[i] |= (1 << (y[i] - 1 + 5)) & sta;\n for (int j = 0; j < i; j++)\n if (info[i] == info[j] && (x[i] != x[j] || y[i] != y[j])) return false;\n }\n return true;\n}\nint main() {\n string str;\n while (cin >> n) {\n for (int i = 0; i < n; i++) {\n cin >> str;\n x[i] = color_to_id(str[0]);\n y[i] = str[1] - '0';\n }\n int ans = 10;\n for (int i = 0; i < (1 << 10); i++) {\n int n_one = count_one(i);\n if (n_one >= ans) continue;\n if (check(i)) ans = n_one;\n }\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"442A","pseudocode":"N = const int = 150\nlet x[N], y[N], info[N], n be ints\nin int function color_to_id taking char ch\n if ch = 'R' then return 1\n if ch = 'G' then return 2\n if ch = 'B' then return 3\n if ch = 'Y' then return 4\n if ch = 'W' then return 5\nend of the block\nin int function count_one taking x\n cnt = 0 = int\n while x isn't 0\n increment cnt by x&1\n x = x bit right shift 1\n end of the block\n return cnt\nend of the block\nin bool function check taking sta = int\n for i = 0 to n exclusive\n set info[i] = 0\n info[i] bitwise or (1 bitwise left shift (x[i] - 1)) bitwise and sta\n info[i] bitwise or (1 bitwise left shift (y[i] - 1 + 5)) bitwise and sta\n for j = 0 to i exclusive\n if info[i] = info[j] and (x[i] is not x[j] or y[i] is not y[j])\n end of the block\n return true\nend of the block\ndefine the main function\n str = string\n while reading n\n for i = 0 to n exclusive\n read str\n set x[i] = color_to_id of str[0]\n y[i] = str[1] - '0'\n end of the block\n ans = 10 = int\n for i = 0 to 1 bitwise left shit 10\n n_one = count_one(i) = int\n if n_one >= ans then go to next iteration\n if check(i) then set ans to n_one\n end of the block\n print ans\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2","G3 G3"],["0"]],[["4","G4 R4 R3 B3"],["2"]],[["5","B1 Y1 W1 G1 R1"],["4"]],[["10","Y4 B1 R3 G5 R5 W3 W5 W2 R1 Y1"],["6"]],[["3","G4 G3 B4"],["2"]],[["2","W3 Y5"],["1"]],[["2","W5 Y5"],["1"]],[["100","W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5"],["8"]],[["100","B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W5 W4 Y5 W1 B4 G3 R2 R3 W1 B4 Y4 G2 G2 R1 Y5 W1 Y3 B3 G5 Y3 G3 W2 W5 Y4 B2 Y5 R4 B2 Y3 W4 G2 G3 R2 W1 B4 B2 B1 Y2 Y2 Y3 W3 Y5 W1 R1 R1 R4 R4 R4 Y1 Y3 B2 Y3 Y1 R3 G4 G4 Y5 B5 W2 G1 G5 B3 G1 Y1 R2 G5 R2 Y5 R5 Y4 R4 W2"],["8"]],[["100","Y3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 Y5 Y2 Y5 Y4 Y1 Y2 Y1"],["4"]],[["100","G3 B3 G3 Y3 R3 G3 R3 G3 W3 B3 B3 B3 R3 Y3 Y3 W3 R3 B3 G3 W3 G3 W3 Y3 R3 Y3 W3 W3 G3 W3 G3 W3 Y3 G3 R3 Y3 W3 W3 Y3 Y3 Y3 R3 W3 R3 G3 W3 W3 G3 Y3 B3 W3 B3 Y3 G3 Y3 B3 Y3 W3 Y3 R3 Y3 R3 W3 W3 W3 G3 Y3 G3 R3 B3 R3 Y3 R3 Y3 R3 Y3 R3 Y3 R3 W3 Y3 R3 W3 W3 W3 G3 G3 Y3 B3 Y3 R3 G3 G3 B3 B3 Y3 R3 G3 R3 W3 G3"],["4"]],[["100","W5 Y5 Y3 W3 Y5 Y5 W5 W5 Y3 W5 Y5 Y3 W5 Y5 W5 W3 Y3 Y5 W3 W5 Y5 W3 Y5 Y3 W3 W3 Y3 Y5 W3 W3 Y3 Y5 W3 Y5 Y5 Y5 W5 Y5 W5 Y5 W5 W5 W3 W5 W3 Y3 W5 W3 W3 W5 Y3 Y5 W5 W5 W3 W5 W5 Y5 W5 W3 W3 W3 Y3 Y5 Y5 Y3 Y5 W5 W5 Y5 W3 W3 W5 Y5 Y5 Y3 W5 W5 W3 Y5 W3 W5 Y3 Y5 W5 Y3 Y3 W3 Y3 Y5 Y3 Y3 W5 Y5 Y3 Y5 Y3 W3 Y3 W5"],["2"]],[["100","Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y5 Y5 Y3 Y3 Y5 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5"],["1"]],[["100","Y3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 Y3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3"],["1"]],[["10","W1 Y4 Y3 W3 Y2 W2 W1 Y2 Y3 W3"],["3"]],[["10","W2 R2 B5 W5 W2 B3 B2 R5 Y5 R2"],["5"]],[["5","W3 Y5 W2 G3 Y3"],["3"]],[["5","W5 G5 W2 Y5 G2"],["3"]],[["5","W5 W3 Y3 Y5 W2"],["3"]],[["5","Y5 W3 W2 G5 W3"],["3"]],[["5","G5 G3 G5 G5 W2"],["2"]],[["5","W2 Y2 G3 G3 G3"],["2"]],[["5","G3 Y5 Y2 Y5 W3"],["3"]],[["5","W3 W5 Y3 W2 G5"],["3"]],[["5","Y3 Y2 Y3 Y5 Y5"],["2"]],[["5","W5 Y3 W5 W5 Y5"],["2"]],[["5","G3 Y3 G3 Y3 G3"],["1"]],[["5","G4 W5 Y4 Y4 R5"],["3"]],[["5","G3 R2 R5 B3 W4"],["4"]],[["5","W2 G5 W3 R4 R4"],["3"]],[["5","Y3 Y3 G3 Y3 W3"],["2"]],[["5","W5 W5 W3 Y3 Y5"],["2"]],[["35","G5 G5 G3 G2 G3 Y3 W3 Y3 G5 W5 G2 G2 W5 G5 G5 W3 G3 G2 Y3 W5 W3 G5 W5 G2 Y2 Y3 W5 G3 W3 W2 G2 W3 Y2 G3 G3"],["4"]],[["35","G3 G2 G5 G2 W2 G3 W2 W5 Y5 G5 W2 W2 W2 G5 Y2 G5 W5 W3 W2 Y2 G5 W5 W3 W5 Y2 Y5 W2 W2 W3 Y3 G2 W3 G5 G3 W2"],["4"]],[["35","W2 W3 Y2 G5 G2 W3 G5 Y2 W5 Y5 W3 G2 G3 W5 W2 W3 Y2 Y5 Y2 Y5 Y2 Y2 G2 Y5 W3 Y5 G3 Y2 G3 Y2 Y5 W5 G3 W5 W5"],["4"]],[["35","Y2 Y3 Y2 Y3 Y5 Y5 Y3 Y5 Y5 Y2 Y2 Y5 Y2 Y2 Y5 Y3 Y2 Y5 Y5 Y3 Y3 Y2 Y2 Y2 Y3 Y5 Y2 Y5 Y5 Y3 Y5 Y2 Y3 Y3 Y2"],["2"]],[["35","Y5 Y5 W5 Y5 W3 Y3 W5 W3 W5 W3 W5 Y5 Y3 W3 W5 W5 W5 W3 Y5 Y3 Y5 W5 W5 Y3 Y5 Y5 Y3 W5 W3 W3 W3 W5 Y5 W3 W5"],["2"]],[["35","G3 G3 W3 W3 G3 G3 Y3 G3 Y3 Y3 G3 W3 Y3 G3 W3 Y3 W3 Y3 Y3 Y3 Y3 G3 G3 Y3 Y3 G3 G3 G3 G3 G3 Y3 W3 W3 W3 G3"],["2"]],[["35","R2 R2 R2 R2 G3 G2 Y3 G2 R3 W5 G4 Y3 Y3 G2 Y5 W5 G4 G2 W4 Y2 W3 R5 W5 G4 G4 Y2 G2 Y5 G2 Y4 W3 G5 G2 R3 G4"],["6"]],[["35","G2 Y1 Y1 R4 G5 B5 R2 G4 G2 G3 W4 W1 B3 W5 R2 Y5 R4 R4 B5 Y2 B4 B1 R3 G4 Y3 G2 R4 G3 B2 G2 R3 B2 R1 W2 B4"],["8"]],[["35","W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2"],["6"]],[["35","Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3"],["2"]],[["35","W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3"],["2"]],[["25","Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5"],["7"]],[["25","W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2"],["7"]],[["25","Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4"],["7"]],[["25","B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1"],["7"]],[["25","G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3"],["8"]],[["25","R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5"],["7"]],[["5","W3 B1 Y1 R3 Y5"],["3"]],[["4","R1 R2 G1 Y5"],["2"]],[["4","R1 R2 G1 B3"],["2"]],[["15","Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1"],["6"]],[["4","G5 W5 W4 R3"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_135","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integer n, array a with size 105\ncreate map mp of char to int\ndefine the main function\n read n\n set mp['R'] to 5\n set mp['G'] to 6\n set mp['B'] to 7\n set mp['Y'] to 8\n set mp['W'] to 9\n for i = 0 to n exclusive\n create stirng s\n read s\n create ints c, v\n set c to mp[s[0]]\n set v to s[1] - '0' - 1\n set a[i] to (1 bitwise shift left c) bitwise or (1 bitwise shift left v)\n end of the block\n sort a [0:n)\n set n to unique(a, a + n) - a\n create integer ans = 11\n for int mask = 0; msk less than (1 bitwise shift left 10); increment msk\n create bool f = true\n for i = 0 to n exclusive\n for j = i + 1 to n exclusive\n create int t = a[i] bitwise XOR a[j]\n if (msk bitwise and t) equals 0\n set f to false\n break\n end of the block\n end of the block\n if not f, break\n end of the block\n if f, set ans to min(ans, __builtin_popcount(msk))\n end of the block\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n, a[105];\nmap mp;\nint main() {\n cin >> n;\n mp['R'] = 5;\n mp['G'] = 6;\n mp['B'] = 7;\n mp['Y'] = 8;\n mp['W'] = 9;\n for (int i = 0; i < n; i++) {\n string s;\n cin >> s;\n int c, v;\n c = mp[s[0]];\n v = s[1] - '0' - 1;\n a[i] = (1 << c) | (1 << v);\n }\n sort(a, a + n);\n n = unique(a, a + n) - a;\n int ans = 11;\n for (int msk = 0; msk < (1 << 10); msk++) {\n bool f = true;\n for (int i = 0; i < n; i++) {\n for (int j = i + 1; j < n; j++) {\n int t = a[i] ^ a[j];\n if ((msk & t) == 0) {\n f = false;\n break;\n }\n }\n if (!f) break;\n }\n if (f) { ans = min(ans, __builtin_popcount(msk)); }\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"442A","pseudocode":"create integer n, array a with size 105\ncreate map mp of char to int\ndefine the main function\n read n\n set mp['R'] to 5\n set mp['G'] to 6\n set mp['B'] to 7\n set mp['Y'] to 8\n set mp['W'] to 9\n for i = 0 to n exclusive\n create stirng s\n read s\n create ints c, v\n set c to mp[s[0]]\n set v to s[1] - '0' - 1\n set a[i] to (1 bitwise shift left c) bitwise or (1 bitwise shift left v)\n end of the block\n sort a [0:n)\n set n to unique(a, a + n) - a\n create integer ans = 11\n for int mask = 0; msk less than (1 bitwise shift left 10); increment msk\n create bool f = true\n for i = 0 to n exclusive\n for j = i + 1 to n exclusive\n create int t = a[i] bitwise XOR a[j]\n if (msk bitwise and t) equals 0\n set f to false\n break\n end of the block\n end of the block\n if not f, break\n end of the block\n if f, set ans to min(ans, __builtin_popcount(msk))\n end of the block\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["2","G3 G3"],["0"]],[["4","G4 R4 R3 B3"],["2"]],[["5","B1 Y1 W1 G1 R1"],["4"]],[["10","Y4 B1 R3 G5 R5 W3 W5 W2 R1 Y1"],["6"]],[["3","G4 G3 B4"],["2"]],[["2","W3 Y5"],["1"]],[["2","W5 Y5"],["1"]],[["100","W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5"],["8"]],[["100","B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W5 W4 Y5 W1 B4 G3 R2 R3 W1 B4 Y4 G2 G2 R1 Y5 W1 Y3 B3 G5 Y3 G3 W2 W5 Y4 B2 Y5 R4 B2 Y3 W4 G2 G3 R2 W1 B4 B2 B1 Y2 Y2 Y3 W3 Y5 W1 R1 R1 R4 R4 R4 Y1 Y3 B2 Y3 Y1 R3 G4 G4 Y5 B5 W2 G1 G5 B3 G1 Y1 R2 G5 R2 Y5 R5 Y4 R4 W2"],["8"]],[["100","Y3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 Y5 Y2 Y5 Y4 Y1 Y2 Y1"],["4"]],[["100","G3 B3 G3 Y3 R3 G3 R3 G3 W3 B3 B3 B3 R3 Y3 Y3 W3 R3 B3 G3 W3 G3 W3 Y3 R3 Y3 W3 W3 G3 W3 G3 W3 Y3 G3 R3 Y3 W3 W3 Y3 Y3 Y3 R3 W3 R3 G3 W3 W3 G3 Y3 B3 W3 B3 Y3 G3 Y3 B3 Y3 W3 Y3 R3 Y3 R3 W3 W3 W3 G3 Y3 G3 R3 B3 R3 Y3 R3 Y3 R3 Y3 R3 Y3 R3 W3 Y3 R3 W3 W3 W3 G3 G3 Y3 B3 Y3 R3 G3 G3 B3 B3 Y3 R3 G3 R3 W3 G3"],["4"]],[["100","W5 Y5 Y3 W3 Y5 Y5 W5 W5 Y3 W5 Y5 Y3 W5 Y5 W5 W3 Y3 Y5 W3 W5 Y5 W3 Y5 Y3 W3 W3 Y3 Y5 W3 W3 Y3 Y5 W3 Y5 Y5 Y5 W5 Y5 W5 Y5 W5 W5 W3 W5 W3 Y3 W5 W3 W3 W5 Y3 Y5 W5 W5 W3 W5 W5 Y5 W5 W3 W3 W3 Y3 Y5 Y5 Y3 Y5 W5 W5 Y5 W3 W3 W5 Y5 Y5 Y3 W5 W5 W3 Y5 W3 W5 Y3 Y5 W5 Y3 Y3 W3 Y3 Y5 Y3 Y3 W5 Y5 Y3 Y5 Y3 W3 Y3 W5"],["2"]],[["100","Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y5 Y5 Y3 Y3 Y5 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5"],["1"]],[["100","Y3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 Y3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3"],["1"]],[["10","W1 Y4 Y3 W3 Y2 W2 W1 Y2 Y3 W3"],["3"]],[["10","W2 R2 B5 W5 W2 B3 B2 R5 Y5 R2"],["5"]],[["5","W3 Y5 W2 G3 Y3"],["3"]],[["5","W5 G5 W2 Y5 G2"],["3"]],[["5","W5 W3 Y3 Y5 W2"],["3"]],[["5","Y5 W3 W2 G5 W3"],["3"]],[["5","G5 G3 G5 G5 W2"],["2"]],[["5","W2 Y2 G3 G3 G3"],["2"]],[["5","G3 Y5 Y2 Y5 W3"],["3"]],[["5","W3 W5 Y3 W2 G5"],["3"]],[["5","Y3 Y2 Y3 Y5 Y5"],["2"]],[["5","W5 Y3 W5 W5 Y5"],["2"]],[["5","G3 Y3 G3 Y3 G3"],["1"]],[["5","G4 W5 Y4 Y4 R5"],["3"]],[["5","G3 R2 R5 B3 W4"],["4"]],[["5","W2 G5 W3 R4 R4"],["3"]],[["5","Y3 Y3 G3 Y3 W3"],["2"]],[["5","W5 W5 W3 Y3 Y5"],["2"]],[["35","G5 G5 G3 G2 G3 Y3 W3 Y3 G5 W5 G2 G2 W5 G5 G5 W3 G3 G2 Y3 W5 W3 G5 W5 G2 Y2 Y3 W5 G3 W3 W2 G2 W3 Y2 G3 G3"],["4"]],[["35","G3 G2 G5 G2 W2 G3 W2 W5 Y5 G5 W2 W2 W2 G5 Y2 G5 W5 W3 W2 Y2 G5 W5 W3 W5 Y2 Y5 W2 W2 W3 Y3 G2 W3 G5 G3 W2"],["4"]],[["35","W2 W3 Y2 G5 G2 W3 G5 Y2 W5 Y5 W3 G2 G3 W5 W2 W3 Y2 Y5 Y2 Y5 Y2 Y2 G2 Y5 W3 Y5 G3 Y2 G3 Y2 Y5 W5 G3 W5 W5"],["4"]],[["35","Y2 Y3 Y2 Y3 Y5 Y5 Y3 Y5 Y5 Y2 Y2 Y5 Y2 Y2 Y5 Y3 Y2 Y5 Y5 Y3 Y3 Y2 Y2 Y2 Y3 Y5 Y2 Y5 Y5 Y3 Y5 Y2 Y3 Y3 Y2"],["2"]],[["35","Y5 Y5 W5 Y5 W3 Y3 W5 W3 W5 W3 W5 Y5 Y3 W3 W5 W5 W5 W3 Y5 Y3 Y5 W5 W5 Y3 Y5 Y5 Y3 W5 W3 W3 W3 W5 Y5 W3 W5"],["2"]],[["35","G3 G3 W3 W3 G3 G3 Y3 G3 Y3 Y3 G3 W3 Y3 G3 W3 Y3 W3 Y3 Y3 Y3 Y3 G3 G3 Y3 Y3 G3 G3 G3 G3 G3 Y3 W3 W3 W3 G3"],["2"]],[["35","R2 R2 R2 R2 G3 G2 Y3 G2 R3 W5 G4 Y3 Y3 G2 Y5 W5 G4 G2 W4 Y2 W3 R5 W5 G4 G4 Y2 G2 Y5 G2 Y4 W3 G5 G2 R3 G4"],["6"]],[["35","G2 Y1 Y1 R4 G5 B5 R2 G4 G2 G3 W4 W1 B3 W5 R2 Y5 R4 R4 B5 Y2 B4 B1 R3 G4 Y3 G2 R4 G3 B2 G2 R3 B2 R1 W2 B4"],["8"]],[["35","W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2"],["6"]],[["35","Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3"],["2"]],[["35","W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3"],["2"]],[["25","Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5"],["7"]],[["25","W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2"],["7"]],[["25","Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4"],["7"]],[["25","B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1"],["7"]],[["25","G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3"],["8"]],[["25","R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5"],["7"]],[["5","W3 B1 Y1 R3 Y5"],["3"]],[["4","R1 R2 G1 Y5"],["2"]],[["4","R1 R2 G1 B3"],["2"]],[["15","Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1"],["6"]],[["4","G5 W5 W4 R3"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_136","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate ints ans and n and int array b of size 20\nmake bool array a of size 10 with array of size 10\ndeclare check returning bool\n make ints i, j, r, l, and tot\n for i = 1 to 5\n set l and r to 0\n for j = 1 to 5\n if a[i][j] is truthy\n increment l\n if b[j] is truthy, add 1 to r\n end of the block\n end of the block\n if l - 1 is greater than r, return false\n end of the block\n for i = 1 to 5\n set l and r to 0\n for j = 1 to 5\n if a[j][i] is truthy\n increment l\n if b[5 + j] is truthy, increment r\n end of the block\n end of the block\n if l - 1 is greater than r, return false\n end of the block\n set tot to 0\n for i = 1 to 5\n for j = 1 to 5\n if a[i][j] is truthy, !b[i + 5] is truthy, and b[j] is falsy, increment tot\n end of the block\n end of the block\n if tot is greater than 1, return false\n return true\nend of the block\ndeclare dfs taking in integer x\n make ints i and sum\n if x is equal to 11\n if check() returns true\n set sum to 0\n for i = 1 to 11\n if b[i] is equal to 1, add 1 to sum\n end of the block\n set ans to min of sum and ans\n end of the block\n return\n end of the block\n set b[x] to 1\n call dfs(x + 1)\n set b[x] to 0\n call dfs(x + 1)\nend of the block\ndefine the main function\n create ints i and y\n make char ch\n let integer k\n read n\n set all contents of a to false\n for i = 1 to n\n read ch and k\n if ch is equal to 'R'\n set y to 1\n else if ch is equal to 'G'\n set y to 2\n else if ch is equal to 'B'\n set y to 3\n else if ch is equal to 'Y'\n set y to 4\n else if ch is equal to 'W'\n set y to 5\n set a[y][k] to true\n end of the block\n set all contents of b to 0\n set ans to 9999999\n end statement\n call dfs(1)\n show ans\nend of the block\n\n[CODE]:","reference_output":"int b[20], ans, n;\nbool a[10][10];\nbool check() {\n int i, j, r, l, tot;\n for (i = 1; i <= 5; i++) {\n l = r = 0;\n for (j = 1; j <= 5; j++) {\n if (a[i][j]) {\n l++;\n if (b[j]) { r++; }\n }\n }\n if (l - 1 > r) return false;\n }\n for (i = 1; i <= 5; i++) {\n l = r = 0;\n for (j = 1; j <= 5; j++) {\n if (a[j][i]) {\n l++;\n if (b[5 + j]) r++;\n }\n }\n if (l - 1 > r) return false;\n }\n tot = 0;\n for (i = 1; i <= 5; i++) {\n for (j = 1; j <= 5; j++) {\n if (a[i][j] && !b[i + 5] && !b[j]) tot++;\n }\n }\n if (tot > 1) return false;\n return true;\n}\nvoid dfs(int x) {\n int i, sum;\n if (x == 11) {\n if (check()) {\n sum = 0;\n for (i = 1; i <= 11; i++) {\n if (b[i] == 1) sum++;\n }\n ans = min(sum, ans);\n }\n return;\n }\n b[x] = 1;\n dfs(x + 1);\n b[x] = 0;\n dfs(x + 1);\n}\nint main() {\n int i, y;\n char ch;\n int k;\n cin >> n;\n memset(a, false, sizeof(a));\n for (i = 1; i <= n; i++) {\n cin >> ch >> k;\n if (ch == 'R')\n y = 1;\n else if (ch == 'G')\n y = 2;\n else if (ch == 'B')\n y = 3;\n else if (ch == 'Y')\n y = 4;\n else if (ch == 'W')\n y = 5;\n a[y][k] = true;\n }\n memset(b, 0, sizeof(b));\n ans = 9999999;\n ;\n dfs(1);\n cout << ans << endl;\n}","item":{"problem_id":"442A","pseudocode":"create ints ans and n and int array b of size 20\nmake bool array a of size 10 with array of size 10\ndeclare check returning bool\n make ints i, j, r, l, and tot\n for i = 1 to 5\n set l and r to 0\n for j = 1 to 5\n if a[i][j] is truthy\n increment l\n if b[j] is truthy, add 1 to r\n end of the block\n end of the block\n if l - 1 is greater than r, return false\n end of the block\n for i = 1 to 5\n set l and r to 0\n for j = 1 to 5\n if a[j][i] is truthy\n increment l\n if b[5 + j] is truthy, increment r\n end of the block\n end of the block\n if l - 1 is greater than r, return false\n end of the block\n set tot to 0\n for i = 1 to 5\n for j = 1 to 5\n if a[i][j] is truthy, !b[i + 5] is truthy, and b[j] is falsy, increment tot\n end of the block\n end of the block\n if tot is greater than 1, return false\n return true\nend of the block\ndeclare dfs taking in integer x\n make ints i and sum\n if x is equal to 11\n if check() returns true\n set sum to 0\n for i = 1 to 11\n if b[i] is equal to 1, add 1 to sum\n end of the block\n set ans to min of sum and ans\n end of the block\n return\n end of the block\n set b[x] to 1\n call dfs(x + 1)\n set b[x] to 0\n call dfs(x + 1)\nend of the block\ndefine the main function\n create ints i and y\n make char ch\n let integer k\n read n\n set all contents of a to false\n for i = 1 to n\n read ch and k\n if ch is equal to 'R'\n set y to 1\n else if ch is equal to 'G'\n set y to 2\n else if ch is equal to 'B'\n set y to 3\n else if ch is equal to 'Y'\n set y to 4\n else if ch is equal to 'W'\n set y to 5\n set a[y][k] to true\n end of the block\n set all contents of b to 0\n set ans to 9999999\n end statement\n call dfs(1)\n show ans\nend of the block","testcases":[[["2","G3 G3"],["0"]],[["4","G4 R4 R3 B3"],["2"]],[["5","B1 Y1 W1 G1 R1"],["4"]],[["10","Y4 B1 R3 G5 R5 W3 W5 W2 R1 Y1"],["6"]],[["3","G4 G3 B4"],["2"]],[["2","W3 Y5"],["1"]],[["2","W5 Y5"],["1"]],[["100","W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5"],["8"]],[["100","B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W5 W4 Y5 W1 B4 G3 R2 R3 W1 B4 Y4 G2 G2 R1 Y5 W1 Y3 B3 G5 Y3 G3 W2 W5 Y4 B2 Y5 R4 B2 Y3 W4 G2 G3 R2 W1 B4 B2 B1 Y2 Y2 Y3 W3 Y5 W1 R1 R1 R4 R4 R4 Y1 Y3 B2 Y3 Y1 R3 G4 G4 Y5 B5 W2 G1 G5 B3 G1 Y1 R2 G5 R2 Y5 R5 Y4 R4 W2"],["8"]],[["100","Y3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 Y5 Y2 Y5 Y4 Y1 Y2 Y1"],["4"]],[["100","G3 B3 G3 Y3 R3 G3 R3 G3 W3 B3 B3 B3 R3 Y3 Y3 W3 R3 B3 G3 W3 G3 W3 Y3 R3 Y3 W3 W3 G3 W3 G3 W3 Y3 G3 R3 Y3 W3 W3 Y3 Y3 Y3 R3 W3 R3 G3 W3 W3 G3 Y3 B3 W3 B3 Y3 G3 Y3 B3 Y3 W3 Y3 R3 Y3 R3 W3 W3 W3 G3 Y3 G3 R3 B3 R3 Y3 R3 Y3 R3 Y3 R3 Y3 R3 W3 Y3 R3 W3 W3 W3 G3 G3 Y3 B3 Y3 R3 G3 G3 B3 B3 Y3 R3 G3 R3 W3 G3"],["4"]],[["100","W5 Y5 Y3 W3 Y5 Y5 W5 W5 Y3 W5 Y5 Y3 W5 Y5 W5 W3 Y3 Y5 W3 W5 Y5 W3 Y5 Y3 W3 W3 Y3 Y5 W3 W3 Y3 Y5 W3 Y5 Y5 Y5 W5 Y5 W5 Y5 W5 W5 W3 W5 W3 Y3 W5 W3 W3 W5 Y3 Y5 W5 W5 W3 W5 W5 Y5 W5 W3 W3 W3 Y3 Y5 Y5 Y3 Y5 W5 W5 Y5 W3 W3 W5 Y5 Y5 Y3 W5 W5 W3 Y5 W3 W5 Y3 Y5 W5 Y3 Y3 W3 Y3 Y5 Y3 Y3 W5 Y5 Y3 Y5 Y3 W3 Y3 W5"],["2"]],[["100","Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y5 Y5 Y3 Y3 Y5 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5"],["1"]],[["100","Y3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 Y3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3"],["1"]],[["10","W1 Y4 Y3 W3 Y2 W2 W1 Y2 Y3 W3"],["3"]],[["10","W2 R2 B5 W5 W2 B3 B2 R5 Y5 R2"],["5"]],[["5","W3 Y5 W2 G3 Y3"],["3"]],[["5","W5 G5 W2 Y5 G2"],["3"]],[["5","W5 W3 Y3 Y5 W2"],["3"]],[["5","Y5 W3 W2 G5 W3"],["3"]],[["5","G5 G3 G5 G5 W2"],["2"]],[["5","W2 Y2 G3 G3 G3"],["2"]],[["5","G3 Y5 Y2 Y5 W3"],["3"]],[["5","W3 W5 Y3 W2 G5"],["3"]],[["5","Y3 Y2 Y3 Y5 Y5"],["2"]],[["5","W5 Y3 W5 W5 Y5"],["2"]],[["5","G3 Y3 G3 Y3 G3"],["1"]],[["5","G4 W5 Y4 Y4 R5"],["3"]],[["5","G3 R2 R5 B3 W4"],["4"]],[["5","W2 G5 W3 R4 R4"],["3"]],[["5","Y3 Y3 G3 Y3 W3"],["2"]],[["5","W5 W5 W3 Y3 Y5"],["2"]],[["35","G5 G5 G3 G2 G3 Y3 W3 Y3 G5 W5 G2 G2 W5 G5 G5 W3 G3 G2 Y3 W5 W3 G5 W5 G2 Y2 Y3 W5 G3 W3 W2 G2 W3 Y2 G3 G3"],["4"]],[["35","G3 G2 G5 G2 W2 G3 W2 W5 Y5 G5 W2 W2 W2 G5 Y2 G5 W5 W3 W2 Y2 G5 W5 W3 W5 Y2 Y5 W2 W2 W3 Y3 G2 W3 G5 G3 W2"],["4"]],[["35","W2 W3 Y2 G5 G2 W3 G5 Y2 W5 Y5 W3 G2 G3 W5 W2 W3 Y2 Y5 Y2 Y5 Y2 Y2 G2 Y5 W3 Y5 G3 Y2 G3 Y2 Y5 W5 G3 W5 W5"],["4"]],[["35","Y2 Y3 Y2 Y3 Y5 Y5 Y3 Y5 Y5 Y2 Y2 Y5 Y2 Y2 Y5 Y3 Y2 Y5 Y5 Y3 Y3 Y2 Y2 Y2 Y3 Y5 Y2 Y5 Y5 Y3 Y5 Y2 Y3 Y3 Y2"],["2"]],[["35","Y5 Y5 W5 Y5 W3 Y3 W5 W3 W5 W3 W5 Y5 Y3 W3 W5 W5 W5 W3 Y5 Y3 Y5 W5 W5 Y3 Y5 Y5 Y3 W5 W3 W3 W3 W5 Y5 W3 W5"],["2"]],[["35","G3 G3 W3 W3 G3 G3 Y3 G3 Y3 Y3 G3 W3 Y3 G3 W3 Y3 W3 Y3 Y3 Y3 Y3 G3 G3 Y3 Y3 G3 G3 G3 G3 G3 Y3 W3 W3 W3 G3"],["2"]],[["35","R2 R2 R2 R2 G3 G2 Y3 G2 R3 W5 G4 Y3 Y3 G2 Y5 W5 G4 G2 W4 Y2 W3 R5 W5 G4 G4 Y2 G2 Y5 G2 Y4 W3 G5 G2 R3 G4"],["6"]],[["35","G2 Y1 Y1 R4 G5 B5 R2 G4 G2 G3 W4 W1 B3 W5 R2 Y5 R4 R4 B5 Y2 B4 B1 R3 G4 Y3 G2 R4 G3 B2 G2 R3 B2 R1 W2 B4"],["8"]],[["35","W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2"],["6"]],[["35","Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3"],["2"]],[["35","W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3"],["2"]],[["25","Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5"],["7"]],[["25","W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2"],["7"]],[["25","Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4"],["7"]],[["25","B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1"],["7"]],[["25","G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3"],["8"]],[["25","R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5"],["7"]],[["5","W3 B1 Y1 R3 Y5"],["3"]],[["4","R1 R2 G1 Y5"],["2"]],[["4","R1 R2 G1 B3"],["2"]],[["15","Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1"],["6"]],[["4","G5 W5 W4 R3"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_137","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmake int arrays a of size 1000 and b of size 1000\ncreate char C of size 1000\ndeclare B taking in integer x and returning integer\n create int ans = 0\n for i = 0 to 10 exclusive\n if (1 << i) & x is truthy, increment ans\n return ans\nend of the block\ndefine the main function\n create integer n\n read n\n for i = 0 to n exclusive\n read C[i] and a[i]\n decrease a[i] by 1\n if C[i] is equal to 'R', set b[i] to 0\n if C[i] is equal to 'Y', set b[i] to 1\n if C[i] is equal to 'W', set b[i] to 2\n if C[i] is equal to 'G', set b[i] to 3\n if C[i] is equal to 'B', set b[i] to 4\n end of the block\n make integer ans = n + 1\n for i = 0 to 32 exclusive\n for j = 0 to 32 exclusive\n make int arrays f of size 5 and g of size 5\n for k = 0 to 5 exclusive\n if (1 << k) & 1 is truthy\n set f[k] to 1\n else do\n set f[k] to 0\n for k = 0 to 5 exclusive\n if (1 << k) & j is truthy\n set g[k] to 1\n otherwise\n set g[k] to 0\n create integer f1 = 1\n for i = 0 to n exclusive\n for j = i + 1 to n exclusive\n if a[i] is equal to a[j] and b[i] is equal to b[i], continue loop\n if a[i] is equal to a[j] and g[b[i]] | g[b[j]] is truthy, continue to next loop iteration\n if b[i] is equal to b[j] and f[a[i]] | f[a[j]] is truthy, continue loop\n if a[i] is not equal to a[j] and b[i] is not equal to b[j] and f[a[i]] | f[a[j]] | g[b[i]] | g[b[j]] is truthy, continue loop\n set f1 to 0\n end of the block\n if f1 is truthy, set ans to min of ans and B(i) + B(j)\n end of the block\n end of the block\n show ans\nend of the block\n\n[CODE]:","reference_output":"int a[1000], b[1000];\nchar C[1000];\nint B(int x) {\n int ans = 0;\n for (int i = 0; i < 10; i++)\n if ((1 << i) & x) ans++;\n return ans;\n}\nint main() {\n int n;\n cin >> n;\n for (int i = 0; i < n; i++) {\n cin >> C[i] >> a[i];\n a[i]--;\n if (C[i] == 'R') b[i] = 0;\n if (C[i] == 'Y') b[i] = 1;\n if (C[i] == 'W') b[i] = 2;\n if (C[i] == 'G') b[i] = 3;\n if (C[i] == 'B') b[i] = 4;\n }\n int ans = n + 1;\n for (int i = 0; i < 32; i++) {\n for (int j = 0; j < 32; j++) {\n int f[5], g[5];\n for (int k = 0; k < 5; k++)\n if ((1 << k) & i)\n f[k] = 1;\n else\n f[k] = 0;\n for (int k = 0; k < 5; k++)\n if ((1 << k) & j)\n g[k] = 1;\n else\n g[k] = 0;\n int fl = 1;\n for (int i = 0; i < n; i++)\n for (int j = i + 1; j < n; j++) {\n if (a[i] == a[j] && b[i] == b[j]) continue;\n if (a[i] == a[j] && g[b[i]] | g[b[j]]) continue;\n if (b[i] == b[j] && f[a[i]] | f[a[j]]) continue;\n if (a[i] != a[j] && b[i] != b[j] && f[a[i]] | f[a[j]] | g[b[i]] | g[b[j]]) continue;\n fl = 0;\n }\n if (fl) ans = min(ans, B(i) + B(j));\n }\n }\n cout << ans << endl;\n}","item":{"problem_id":"442A","pseudocode":"make int arrays a of size 1000 and b of size 1000\ncreate char C of size 1000\ndeclare B taking in integer x and returning integer\n create int ans = 0\n for i = 0 to 10 exclusive\n if (1 << i) & x is truthy, increment ans\n return ans\nend of the block\ndefine the main function\n create integer n\n read n\n for i = 0 to n exclusive\n read C[i] and a[i]\n decrease a[i] by 1\n if C[i] is equal to 'R', set b[i] to 0\n if C[i] is equal to 'Y', set b[i] to 1\n if C[i] is equal to 'W', set b[i] to 2\n if C[i] is equal to 'G', set b[i] to 3\n if C[i] is equal to 'B', set b[i] to 4\n end of the block\n make integer ans = n + 1\n for i = 0 to 32 exclusive\n for j = 0 to 32 exclusive\n make int arrays f of size 5 and g of size 5\n for k = 0 to 5 exclusive\n if (1 << k) & 1 is truthy\n set f[k] to 1\n else do\n set f[k] to 0\n for k = 0 to 5 exclusive\n if (1 << k) & j is truthy\n set g[k] to 1\n otherwise\n set g[k] to 0\n create integer f1 = 1\n for i = 0 to n exclusive\n for j = i + 1 to n exclusive\n if a[i] is equal to a[j] and b[i] is equal to b[i], continue loop\n if a[i] is equal to a[j] and g[b[i]] | g[b[j]] is truthy, continue to next loop iteration\n if b[i] is equal to b[j] and f[a[i]] | f[a[j]] is truthy, continue loop\n if a[i] is not equal to a[j] and b[i] is not equal to b[j] and f[a[i]] | f[a[j]] | g[b[i]] | g[b[j]] is truthy, continue loop\n set f1 to 0\n end of the block\n if f1 is truthy, set ans to min of ans and B(i) + B(j)\n end of the block\n end of the block\n show ans\nend of the block","testcases":[[["2","G3 G3"],["0"]],[["4","G4 R4 R3 B3"],["2"]],[["5","B1 Y1 W1 G1 R1"],["4"]],[["10","Y4 B1 R3 G5 R5 W3 W5 W2 R1 Y1"],["6"]],[["3","G4 G3 B4"],["2"]],[["2","W3 Y5"],["1"]],[["2","W5 Y5"],["1"]],[["100","W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5"],["8"]],[["100","B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W5 W4 Y5 W1 B4 G3 R2 R3 W1 B4 Y4 G2 G2 R1 Y5 W1 Y3 B3 G5 Y3 G3 W2 W5 Y4 B2 Y5 R4 B2 Y3 W4 G2 G3 R2 W1 B4 B2 B1 Y2 Y2 Y3 W3 Y5 W1 R1 R1 R4 R4 R4 Y1 Y3 B2 Y3 Y1 R3 G4 G4 Y5 B5 W2 G1 G5 B3 G1 Y1 R2 G5 R2 Y5 R5 Y4 R4 W2"],["8"]],[["100","Y3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 Y5 Y2 Y5 Y4 Y1 Y2 Y1"],["4"]],[["100","G3 B3 G3 Y3 R3 G3 R3 G3 W3 B3 B3 B3 R3 Y3 Y3 W3 R3 B3 G3 W3 G3 W3 Y3 R3 Y3 W3 W3 G3 W3 G3 W3 Y3 G3 R3 Y3 W3 W3 Y3 Y3 Y3 R3 W3 R3 G3 W3 W3 G3 Y3 B3 W3 B3 Y3 G3 Y3 B3 Y3 W3 Y3 R3 Y3 R3 W3 W3 W3 G3 Y3 G3 R3 B3 R3 Y3 R3 Y3 R3 Y3 R3 Y3 R3 W3 Y3 R3 W3 W3 W3 G3 G3 Y3 B3 Y3 R3 G3 G3 B3 B3 Y3 R3 G3 R3 W3 G3"],["4"]],[["100","W5 Y5 Y3 W3 Y5 Y5 W5 W5 Y3 W5 Y5 Y3 W5 Y5 W5 W3 Y3 Y5 W3 W5 Y5 W3 Y5 Y3 W3 W3 Y3 Y5 W3 W3 Y3 Y5 W3 Y5 Y5 Y5 W5 Y5 W5 Y5 W5 W5 W3 W5 W3 Y3 W5 W3 W3 W5 Y3 Y5 W5 W5 W3 W5 W5 Y5 W5 W3 W3 W3 Y3 Y5 Y5 Y3 Y5 W5 W5 Y5 W3 W3 W5 Y5 Y5 Y3 W5 W5 W3 Y5 W3 W5 Y3 Y5 W5 Y3 Y3 W3 Y3 Y5 Y3 Y3 W5 Y5 Y3 Y5 Y3 W3 Y3 W5"],["2"]],[["100","Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y5 Y5 Y3 Y3 Y5 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5"],["1"]],[["100","Y3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 Y3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3"],["1"]],[["10","W1 Y4 Y3 W3 Y2 W2 W1 Y2 Y3 W3"],["3"]],[["10","W2 R2 B5 W5 W2 B3 B2 R5 Y5 R2"],["5"]],[["5","W3 Y5 W2 G3 Y3"],["3"]],[["5","W5 G5 W2 Y5 G2"],["3"]],[["5","W5 W3 Y3 Y5 W2"],["3"]],[["5","Y5 W3 W2 G5 W3"],["3"]],[["5","G5 G3 G5 G5 W2"],["2"]],[["5","W2 Y2 G3 G3 G3"],["2"]],[["5","G3 Y5 Y2 Y5 W3"],["3"]],[["5","W3 W5 Y3 W2 G5"],["3"]],[["5","Y3 Y2 Y3 Y5 Y5"],["2"]],[["5","W5 Y3 W5 W5 Y5"],["2"]],[["5","G3 Y3 G3 Y3 G3"],["1"]],[["5","G4 W5 Y4 Y4 R5"],["3"]],[["5","G3 R2 R5 B3 W4"],["4"]],[["5","W2 G5 W3 R4 R4"],["3"]],[["5","Y3 Y3 G3 Y3 W3"],["2"]],[["5","W5 W5 W3 Y3 Y5"],["2"]],[["35","G5 G5 G3 G2 G3 Y3 W3 Y3 G5 W5 G2 G2 W5 G5 G5 W3 G3 G2 Y3 W5 W3 G5 W5 G2 Y2 Y3 W5 G3 W3 W2 G2 W3 Y2 G3 G3"],["4"]],[["35","G3 G2 G5 G2 W2 G3 W2 W5 Y5 G5 W2 W2 W2 G5 Y2 G5 W5 W3 W2 Y2 G5 W5 W3 W5 Y2 Y5 W2 W2 W3 Y3 G2 W3 G5 G3 W2"],["4"]],[["35","W2 W3 Y2 G5 G2 W3 G5 Y2 W5 Y5 W3 G2 G3 W5 W2 W3 Y2 Y5 Y2 Y5 Y2 Y2 G2 Y5 W3 Y5 G3 Y2 G3 Y2 Y5 W5 G3 W5 W5"],["4"]],[["35","Y2 Y3 Y2 Y3 Y5 Y5 Y3 Y5 Y5 Y2 Y2 Y5 Y2 Y2 Y5 Y3 Y2 Y5 Y5 Y3 Y3 Y2 Y2 Y2 Y3 Y5 Y2 Y5 Y5 Y3 Y5 Y2 Y3 Y3 Y2"],["2"]],[["35","Y5 Y5 W5 Y5 W3 Y3 W5 W3 W5 W3 W5 Y5 Y3 W3 W5 W5 W5 W3 Y5 Y3 Y5 W5 W5 Y3 Y5 Y5 Y3 W5 W3 W3 W3 W5 Y5 W3 W5"],["2"]],[["35","G3 G3 W3 W3 G3 G3 Y3 G3 Y3 Y3 G3 W3 Y3 G3 W3 Y3 W3 Y3 Y3 Y3 Y3 G3 G3 Y3 Y3 G3 G3 G3 G3 G3 Y3 W3 W3 W3 G3"],["2"]],[["35","R2 R2 R2 R2 G3 G2 Y3 G2 R3 W5 G4 Y3 Y3 G2 Y5 W5 G4 G2 W4 Y2 W3 R5 W5 G4 G4 Y2 G2 Y5 G2 Y4 W3 G5 G2 R3 G4"],["6"]],[["35","G2 Y1 Y1 R4 G5 B5 R2 G4 G2 G3 W4 W1 B3 W5 R2 Y5 R4 R4 B5 Y2 B4 B1 R3 G4 Y3 G2 R4 G3 B2 G2 R3 B2 R1 W2 B4"],["8"]],[["35","W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2"],["6"]],[["35","Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3"],["2"]],[["35","W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3"],["2"]],[["25","Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5"],["7"]],[["25","W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2"],["7"]],[["25","Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4"],["7"]],[["25","B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1"],["7"]],[["25","G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3"],["8"]],[["25","R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5"],["7"]],[["5","W3 B1 Y1 R3 Y5"],["3"]],[["4","R1 R2 G1 Y5"],["2"]],[["4","R1 R2 G1 B3"],["2"]],[["15","Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1"],["6"]],[["4","G5 W5 W4 R3"],["2"]]]}} +{"instance_id":"pseudo_to_code_2k_138","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nMod = const int with Mod = 1e9 + 7\nn, p = integers\nchoose, ans = long long with choose = 2d array of 30025 rows and 600 columns, ans = 1\nPedy = map from int to int\ndefine the main function\n read n\n index 0, 0 of choose = 1\n for i = 1 to 30024\n index i and 0 of choose = 1\n for j = 1 to n index i and j of choose = (choose[i - 1][j - 1] + choose[i - 1][j]) modulo Mod\n end of the block\n for i = 0 to n exclusive\n read p\n for j = 2 to j * j <= p\n if p modulo j is 0\n while not(p modulo j)\n p = p \/ j\n increment Pedy[j]\n end of the block\n end of the block\n if p > 1, increment Pedy[p]\n end of the block\n for it = Pedy.begin() to it is not Pedy.end()\n p = second in it\n ans = (ans * choose[p + n - 1][n - 1]) modulo Mod\n end of the block\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int Mod = 1e9 + 7;\nint n, p;\nlong long choose[30000 + 25][600], ans = 1;\nmap Pedy;\nint main() {\n cin >> n;\n choose[0][0] = 1;\n for (int i = 1; i < 30000 + 25; i++) {\n choose[i][0] = 1;\n for (int j = 1; j <= n; j++) choose[i][j] = (choose[i - 1][j - 1] + choose[i - 1][j]) % Mod;\n }\n for (int i = 0; i < n; i++) {\n cin >> p;\n for (int j = 2; j * j <= p; j++)\n if (p % j == 0) {\n while (not(p % j)) {\n p \/= j;\n Pedy[j]++;\n }\n }\n if (p > 1) Pedy[p]++;\n }\n for (map::iterator it = Pedy.begin(); it != Pedy.end(); it++) {\n p = it->second;\n ans = (ans * choose[p + n - 1][n - 1]) % Mod;\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"396A","pseudocode":"Mod = const int with Mod = 1e9 + 7\nn, p = integers\nchoose, ans = long long with choose = 2d array of 30025 rows and 600 columns, ans = 1\nPedy = map from int to int\ndefine the main function\n read n\n index 0, 0 of choose = 1\n for i = 1 to 30024\n index i and 0 of choose = 1\n for j = 1 to n index i and j of choose = (choose[i - 1][j - 1] + choose[i - 1][j]) modulo Mod\n end of the block\n for i = 0 to n exclusive\n read p\n for j = 2 to j * j <= p\n if p modulo j is 0\n while not(p modulo j)\n p = p \/ j\n increment Pedy[j]\n end of the block\n end of the block\n if p > 1, increment Pedy[p]\n end of the block\n for it = Pedy.begin() to it is not Pedy.end()\n p = second in it\n ans = (ans * choose[p + n - 1][n - 1]) modulo Mod\n end of the block\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["1","15"],["1"]],[["3","1 1 2"],["3"]],[["2","5 7"],["4"]],[["2","5 10"],["6"]],[["3","1 30 1"],["27"]],[["2","1000000000 1000000000"],["361"]],[["1","1"],["1"]],[["3","1 1 1"],["1"]],[["2","1 2"],["2"]],[["2","1 6"],["4"]],[["3","8 10 8"],["108"]],[["5","14 67 15 28 21"],["459375"]],[["8","836 13 77 218 743 530 404 741"],["544714485"]],[["10","6295 3400 4042 2769 3673 264 5932 4977 1776 5637"],["928377494"]],[["23","77 12 25 7 44 75 80 92 49 77 56 93 59 45 45 39 86 83 99 91 4 70 83"],["247701073"]],[["1","111546435"],["1"]],[["7","111546435 58642669 600662303 167375713 371700317 33984931 89809099"],["25706464"]],[["19","371700317 12112039 167375713 7262011 21093827 89809099 600662303 18181979 9363547 30857731 58642669 111546435 645328247 5605027 38706809 14457349 25456133 44227723 33984931"],["376284721"]],[["1","536870912"],["1"]],[["2","536870912 387420489"],["570"]],[["10","214358881 536870912 815730721 387420489 893871739 244140625 282475249 594823321 148035889 410338673"],["547239398"]],[["5","387420489 536870912 536870912 536870912 387420489"],["255309592"]],[["5","387420489 244140625 387420489 387420489 1"],["772171400"]],[["10","2097152 67108864 65536 262144 262144 131072 8388608 536870912 65536 2097152"],["176451954"]],[["10","237254761 1 817430153 1 1 1 1 1 90679621 1"],["1000"]],[["20","16777216 1048576 524288 8192 8192 524288 2097152 8388608 1048576 67108864 16777216 1048576 4096 8388608 134217728 67108864 1048576 536870912 67108864 67108864"],["985054761"]],[["50","675 25000 2025 50 450 31250 3750 225 1350 250 72 187500 12000 281250 187500 30000 45000 90000 90 1200 9000 56250 5760 270000 3125 3796875 2250 101250 40 2500 175781250 1250000 45000 2250 3000 31250 46875 135000 421875000 36000 360 140625000 13500 1406250 1125 250 75000 62500 150 6"],["18983788"]],[["2","999983 999983"],["3"]],[["3","1 1 39989"],["3"]]]}} +{"instance_id":"pseudo_to_code_2k_139","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nme is a map of long long to long long\ncreate long long array fine with 100000 + 5 elements\npre is a void function\n for long long i = 2 to 100000 inclusive\n if fine[i] is equal to 0\n for j from 2 * i to 100000 inclusive increasing j by i, assign 1 to fine[j]\n end of the block\n end of the block\nend of the block\ncreate an arrays of long longs fact and invfact with 100000 elements each\npow is a long long function with long long arguments a, b and m\n declare long long variable ans = 1\n while b is not 1\n if b & 1 is not 0, assign (ans * a) % m to ans\n divide b by 2\n change a to (a * a) % m\n end of the block\n return ans\nend of the block\nlong long function modinv with long long argument k\n return pow(k, 1000000007 - 2, 1000000007)\nend of the block\ndefine function precompute\n set fact[0] to set fact[1] to 1\n for i from 2 to 100000 exclusive\n assign fact[i - 1] * i to fact[i]\n fact[i] %= 1000000007\n end of the block\n set invfact[100000 - 1] to modinv(fact[100000 - 1])\n for i from 100000-2 to 0 inclusive decrementing i\n change invfact[i] to invfact[i + 1] * (i + 1)\n invfact[i] %= 1000000007\n end of the block\nend of the block\nfunction nCr with long long arguments x and y that returns long long\n if y is greater than x, return 0\n set long long num to fact[x]\n multiply num by invfact[y]\n num % =1000000007\n multiply num by invfact[x - y]\n num % =1000000007\n return num\nend of the block\ndefine the main function\n create long long n\n read n\n call precompute()\n call pre()\n loop i from 1 to n inclusive\n create long long temp\n read temp\n for j = 2 to 100000 inclusive\n create long long cur = 0\n if temp <= 1, stop the loop\n while temp modulo j = 0 && temp > 1\n increment cur\n divide temp by j\n end of the block\n if cur != 0, increase me[j] by cur\n end of the block\n if temp != 1, increase me[temp] by 1\n end of the block\n create map iterator it\n declare long long ans = 1\n move it through me in a loop\n declare long long variable temp = it->second\n multiply ans by nCr(temp + n - 1, temp)\n ans % =1000000007\n end of the block\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"map me;\nlong long fine[100000 + 5];\nvoid pre() {\n for (long long i = 2; i <= 100000; i++) {\n if (fine[i] == 0) {\n for (long long j = 2 * i; j <= 100000; j += i) { fine[j] = 1; }\n }\n }\n}\nlong long fact[100000], invfact[100000];\nlong long pow(long long a, long long b, long long m) {\n long long ans = 1;\n while (b) {\n if (b & 1) ans = (ans * a) % m;\n b \/= 2;\n a = (a * a) % m;\n }\n return ans;\n}\nlong long modinv(long long k) {\n return pow(k, 1000000007 - 2, 1000000007);\n}\nvoid precompute() {\n fact[0] = fact[1] = 1;\n for (long long i = 2; i < 100000; i++) {\n fact[i] = fact[i - 1] * i;\n fact[i] %= 1000000007;\n }\n invfact[100000 - 1] = modinv(fact[100000 - 1]);\n for (long long i = 100000 - 2; i >= 0; i--) {\n invfact[i] = invfact[i + 1] * (i + 1);\n invfact[i] %= 1000000007;\n }\n}\nlong long nCr(long long x, long long y) {\n if (y > x) return 0;\n long long num = fact[x];\n num *= invfact[y];\n num %= 1000000007;\n num *= invfact[x - y];\n num %= 1000000007;\n return num;\n}\nint main() {\n long long n;\n cin >> n;\n precompute();\n pre();\n for (long long i = 1; i <= n; i++) {\n long long temp;\n cin >> temp;\n for (long long j = 2; j <= 100000; j++) {\n long long cur = 0;\n if (temp <= 1) break;\n while (temp % j == 0 && temp > 1) {\n cur++;\n temp \/= j;\n }\n if (cur != 0) me[j] += cur;\n }\n if (temp != 1) me[temp] += 1;\n }\n map::iterator it;\n long long ans = 1;\n for (it = me.begin(); it != me.end(); it++) {\n long long temp = it->second;\n ans *= nCr(temp + n - 1, temp);\n ans %= 1000000007;\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"396A","pseudocode":"me is a map of long long to long long\ncreate long long array fine with 100000 + 5 elements\npre is a void function\n for long long i = 2 to 100000 inclusive\n if fine[i] is equal to 0\n for j from 2 * i to 100000 inclusive increasing j by i, assign 1 to fine[j]\n end of the block\n end of the block\nend of the block\ncreate an arrays of long longs fact and invfact with 100000 elements each\npow is a long long function with long long arguments a, b and m\n declare long long variable ans = 1\n while b is not 1\n if b & 1 is not 0, assign (ans * a) % m to ans\n divide b by 2\n change a to (a * a) % m\n end of the block\n return ans\nend of the block\nlong long function modinv with long long argument k\n return pow(k, 1000000007 - 2, 1000000007)\nend of the block\ndefine function precompute\n set fact[0] to set fact[1] to 1\n for i from 2 to 100000 exclusive\n assign fact[i - 1] * i to fact[i]\n fact[i] %= 1000000007\n end of the block\n set invfact[100000 - 1] to modinv(fact[100000 - 1])\n for i from 100000-2 to 0 inclusive decrementing i\n change invfact[i] to invfact[i + 1] * (i + 1)\n invfact[i] %= 1000000007\n end of the block\nend of the block\nfunction nCr with long long arguments x and y that returns long long\n if y is greater than x, return 0\n set long long num to fact[x]\n multiply num by invfact[y]\n num % =1000000007\n multiply num by invfact[x - y]\n num % =1000000007\n return num\nend of the block\ndefine the main function\n create long long n\n read n\n call precompute()\n call pre()\n loop i from 1 to n inclusive\n create long long temp\n read temp\n for j = 2 to 100000 inclusive\n create long long cur = 0\n if temp <= 1, stop the loop\n while temp modulo j = 0 && temp > 1\n increment cur\n divide temp by j\n end of the block\n if cur != 0, increase me[j] by cur\n end of the block\n if temp != 1, increase me[temp] by 1\n end of the block\n create map iterator it\n declare long long ans = 1\n move it through me in a loop\n declare long long variable temp = it->second\n multiply ans by nCr(temp + n - 1, temp)\n ans % =1000000007\n end of the block\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["1","15"],["1"]],[["3","1 1 2"],["3"]],[["2","5 7"],["4"]],[["2","5 10"],["6"]],[["3","1 30 1"],["27"]],[["2","1000000000 1000000000"],["361"]],[["1","1"],["1"]],[["3","1 1 1"],["1"]],[["2","1 2"],["2"]],[["2","1 6"],["4"]],[["3","8 10 8"],["108"]],[["5","14 67 15 28 21"],["459375"]],[["8","836 13 77 218 743 530 404 741"],["544714485"]],[["10","6295 3400 4042 2769 3673 264 5932 4977 1776 5637"],["928377494"]],[["23","77 12 25 7 44 75 80 92 49 77 56 93 59 45 45 39 86 83 99 91 4 70 83"],["247701073"]],[["1","111546435"],["1"]],[["7","111546435 58642669 600662303 167375713 371700317 33984931 89809099"],["25706464"]],[["19","371700317 12112039 167375713 7262011 21093827 89809099 600662303 18181979 9363547 30857731 58642669 111546435 645328247 5605027 38706809 14457349 25456133 44227723 33984931"],["376284721"]],[["1","536870912"],["1"]],[["2","536870912 387420489"],["570"]],[["10","214358881 536870912 815730721 387420489 893871739 244140625 282475249 594823321 148035889 410338673"],["547239398"]],[["5","387420489 536870912 536870912 536870912 387420489"],["255309592"]],[["5","387420489 244140625 387420489 387420489 1"],["772171400"]],[["10","2097152 67108864 65536 262144 262144 131072 8388608 536870912 65536 2097152"],["176451954"]],[["10","237254761 1 817430153 1 1 1 1 1 90679621 1"],["1000"]],[["20","16777216 1048576 524288 8192 8192 524288 2097152 8388608 1048576 67108864 16777216 1048576 4096 8388608 134217728 67108864 1048576 536870912 67108864 67108864"],["985054761"]],[["50","675 25000 2025 50 450 31250 3750 225 1350 250 72 187500 12000 281250 187500 30000 45000 90000 90 1200 9000 56250 5760 270000 3125 3796875 2250 101250 40 2500 175781250 1250000 45000 2250 3000 31250 46875 135000 421875000 36000 360 140625000 13500 1406250 1125 250 75000 62500 150 6"],["18983788"]],[["2","999983 999983"],["3"]],[["3","1 1 39989"],["3"]]]}} +{"instance_id":"pseudo_to_code_2k_140","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare an integer n\ndeclare a string t\ndeclare an integer k\ndeclare an integer ans_len\ndeclare a character array str of size 20 * 100010\ndeclare an integer array chars of size 80 * 100010\nin function push_up with parameter integer rt\n set chars[rt] to chars[rt shift bits left 1] + chars[r1 shift bits left 1 bitwise or 1]\nend of the block\nin function update with parameters integers L, R, left, right, rt\n if chars[rt] is at least right - left + 1\n if left equals right\n assign 1 to chars[rt]\n assign t[left - L] to str[left]\n return\n end of the block\n if L is greater than right or R is less than left, return\n mid = integer = (left + right) shift bits left 1\n if mid is at least R\n call update with arguments L, R, left, mid, rt shift bits left 1\n else if mid is less than L\n call update with arguments L, R, mid + 1, right, rt shift bits left 1 bitwise or 1\n else\n call update with arguments L, R, left, mid, rt shift bits left 1\n call update with arguments L, R, mid + 1, right, rt shift bits left 1 bitwise or 1\n end of the block\n call push_up with argument rt\nend of the block\ndefine the main function\n declare an integer pos\n declare an integer endpos\n input n\n assign 0 to ans_len\n for i = 1 to 2000010 exclusive, assign the character a to str[i]\n call memset with arguments chars, 0, call sizeof with argument chars\n for i = 1 to n inclusive\n input t and k\n for j = 1 to k inclusive\n input pos\n set endpos to pos + (the length of t) - 1\n call update with arguments pos, endpos, 1, 2000010, 1\n if j is equal to k\n if endpos is greater than ans_len, assign endpos to ans_len\n end of the block\n end of the block\n end of the block\n for i = 1 to ans_len inclusive, display str[i]\n print newline\nend of the block\n\n[CODE]:","reference_output":"int n;\nstring t;\nint k;\nint ans_len;\nchar str[20 * 100010];\nint chars[80 * 100010];\nvoid push_up(int rt) {\n chars[rt] = chars[rt << 1] + chars[rt << 1 | 1];\n}\nvoid update(int L, int R, int left, int right, int rt) {\n if (chars[rt] >= right - left + 1) return;\n if (left == right) {\n chars[rt] = 1;\n str[left] = t[left - L];\n return;\n }\n if (L > right || R < left) return;\n int mid = (left + right) >> 1;\n if (mid >= R)\n update(L, R, left, mid, rt << 1);\n else if (mid < L)\n update(L, R, mid + 1, right, rt << 1 | 1);\n else {\n update(L, R, left, mid, rt << 1);\n update(L, R, mid + 1, right, rt << 1 | 1);\n }\n push_up(rt);\n}\nint main() {\n int pos;\n int endpos;\n cin >> n;\n ans_len = 0;\n for (int i = 1; i < 2000010; i++) str[i] = 'a';\n memset(chars, 0, sizeof(chars));\n for (int i = 1; i <= n; i++) {\n cin >> t >> k;\n for (int j = 1; j <= k; j++) {\n cin >> pos;\n endpos = pos + t.length() - 1;\n update(pos, endpos, 1, 2000010, 1);\n if (j == k) {\n if (endpos > ans_len) ans_len = endpos;\n }\n }\n }\n for (int i = 1; i <= ans_len; i++) cout << str[i];\n cout << endl;\n}","item":{"problem_id":"827A","pseudocode":"declare an integer n\ndeclare a string t\ndeclare an integer k\ndeclare an integer ans_len\ndeclare a character array str of size 20 * 100010\ndeclare an integer array chars of size 80 * 100010\nin function push_up with parameter integer rt\n set chars[rt] to chars[rt shift bits left 1] + chars[r1 shift bits left 1 bitwise or 1]\nend of the block\nin function update with parameters integers L, R, left, right, rt\n if chars[rt] is at least right - left + 1\n if left equals right\n assign 1 to chars[rt]\n assign t[left - L] to str[left]\n return\n end of the block\n if L is greater than right or R is less than left, return\n mid = integer = (left + right) shift bits left 1\n if mid is at least R\n call update with arguments L, R, left, mid, rt shift bits left 1\n else if mid is less than L\n call update with arguments L, R, mid + 1, right, rt shift bits left 1 bitwise or 1\n else\n call update with arguments L, R, left, mid, rt shift bits left 1\n call update with arguments L, R, mid + 1, right, rt shift bits left 1 bitwise or 1\n end of the block\n call push_up with argument rt\nend of the block\ndefine the main function\n declare an integer pos\n declare an integer endpos\n input n\n assign 0 to ans_len\n for i = 1 to 2000010 exclusive, assign the character a to str[i]\n call memset with arguments chars, 0, call sizeof with argument chars\n for i = 1 to n inclusive\n input t and k\n for j = 1 to k inclusive\n input pos\n set endpos to pos + (the length of t) - 1\n call update with arguments pos, endpos, 1, 2000010, 1\n if j is equal to k\n if endpos is greater than ans_len, assign endpos to ans_len\n end of the block\n end of the block\n end of the block\n for i = 1 to ans_len inclusive, display str[i]\n print newline\nend of the block","testcases":[[["3","a 4 1 3 5 7","ab 2 1 5","ca 1 4"],["abacaba"]],[["1","a 1 3"],["aaa"]],[["3","ab 1 1","aba 1 3","ab 2 3 5"],["ababab"]],[["6","ba 2 16 18","a 1 12","b 3 4 13 20","bb 2 6 8","ababbbbbaab 1 3","abababbbbb 1 1"],["abababbbbbaabaababab"]],[["17","a 4 2 7 8 9","bbaa 1 5","ba 2 1 6","aa 2 7 8","b 6 1 3 4 5 6 10","bbbaa 1 4","bbba 1 4","bab 1 1","bba 1 5","bbb 2 3 4","bb 3 3 4 5","ab 1 2","abbb 1 2","bbbb 1 3","abb 1 2","abbbba 1 2","bbbbaaa 1 3"],["babbbbaaab"]],[["9","fab 1 32","b 2 38 54","badab 1 38","ba 1 62","a 1 25","ab 1 37","bacaba 1 26","cabaeab 1 12","acab 1 3"],["aaacabaaaaacabaeabaaaaaaabacabafabaaabadabaaaaaaaaaaabaaaaaaaba"]],[["18","abacab 2 329 401","abadabacabae 1 293","bacab 1 2","abacabadabacabaga 1 433","c 1 76","baca 1 26","dab 1 72","abagabaca 1 445","abaea 1 397","dabac 1 280","ab 2 201 309","ca 1 396","abacabadab 1 497","ac 1 451","caba 1 444","ad 1 167","badab 1 358","aba 1 421"],["abacabaaaaaaaaaaaaaaaaaaabacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadabacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadabacaaaaaaaaabadabacabaeaaaaabaaaaaaaaaaaaaaaaaaabacabaaaaaaaaaaaaaaaaaaaaaaabadabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacabaeabacabaaaaaaaaaaaaaaabaaaaaaaaaaabacabadabacabagabacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabacabadab"]],[["10","dabacabafa 1 24","bacabadab 1 18","dabaca 1 8","bacabaea 1 42","bacaba 1 34","abadabaca 1 5","badabacaba 1 54","bacabaeaba 1 10","abacabaeab 1 9","adabacaba 1 23"],["aaaaabadabacabaeabacabadabacabafabacabaaabacabaeaaaaabadabacaba"]],[["20","adabacabaeabacabada 1 359","abadabacabafabaca 1 213","acabagabacaba 1 315","cabaeabacabadabacab 1 268","fabacabadabacabaeab 1 352","cabafabacabada 1 28","acabadabacabaea 1 67","cabadabacabaeabacaba 1 484","abacabadabacaba 1 209","acabaiabacaba 1 251","acabafabacabadabac 1 475","abacabaeabacabadaba 1 105","cabadabacabaeaba 1 68","afabacabadabacab 1 287","acabafab 1 91","dabacabaea 1 328","abaeabacabadab 1 461","abadabacabaeabaca 1 421","abadabacabafabac 1 277","fabacabadabac 1 96"],["aaaaaaaaaaaaaaaaaaaaaaaaaaacabafabacabadaaaaaaaaaaaaaaaaaaaaaaaaaaacabadabacabaeabaaaaaaaaacabafabacabadabacabaeabacabadabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabacabadabacabafabacaaaaaaaaaaaaaaaaaaaaaaacabaiabacabaaaaacabaeabacabadabacabafabacabadabacabaaaaaaaaaaaaacabagabacabadabacabaeaaaaaaaaaaaaaaafabacabadabacabaeabacabadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabadabacabaeabacaaaaaaaaaaaaaaaaaaaaaaaaabaeabacabadabacabafabacabadabacabaeabacaba"]],[["4","a 2 1 10","a 3 1 2 9","a 2 3 8","a 2 4 7"],["aaaaaaaaaa"]],[["2","aba 1 1","b 1 2"],["aba"]]]}} +{"instance_id":"pseudo_to_code_2k_141","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare integer variable n\ndeclare string t\ndeclare int k\ncreate int ans_len\ncreate char array str with 20 * 100010 elements\ncreate int array chars s with size 80 * 100010\nfunction push_up with int argument rt\n chars[rt] = chars[rt << 1] + chars[rt << 1 | 1]\nend of the block\nvoid function update with int arguments L, R, left, right and rt\n if chars[rt] >= right - left + 1, return\n if left is equal to right\n create char array s with rt elements\n set str[left] to t[left - L]\n return\n end of the block\n if L > right or R < left, return\n int mid = (left + right) >> 1\n if mid >= R\n call update with arguments L, R, left, mid and rt << 1\n else if mid is less than L\n call update with arguments L, R, mid + 1, right and rt << 1 | 1\n else\n call update with arguments L, R, left, mid and rt << 1\n call update with arguments L, R, mid + 1, right and rt << 1 | 1\n end of the block\n call push_up(rt)\nend of the block\ndefine the main function\n create int pos\n declare integer endpos\n read n and loop further\n change ans_len to 0\n for i from 1 to 2000010 exclusive, assign 'a' to str[i]\n set sizeof(chars) bytes at the pointer chars to 0\n for i from 1 to n inclusive\n read input to t and k\n loop j from 1 to k inclusive\n read pos\n set endpos to pos + length of t - 1\n call update with arguments pos, endpos, 1, 2000010 and 1\n if j = k\n change ans_len to endpos if endpos is greater than ans_len\n end of the block\n end of the block\n end of the block\n for i from 1 to ans_len inclusive, print str[i]\n print new line\n end of the block\nend of the block\n\n[CODE]:","reference_output":"int n;\nstring t;\nint k;\nint ans_len;\nchar str[20 * 100010];\nint chars[80 * 100010];\nvoid push_up(int rt) {\n chars[rt] = chars[rt << 1] + chars[rt << 1 | 1];\n}\nvoid update(int L, int R, int left, int right, int rt) {\n if (chars[rt] >= right - left + 1) return;\n if (left == right) {\n chars[rt] = 1;\n str[left] = t[left - L];\n return;\n }\n if (L > right || R < left) return;\n int mid = (left + right) >> 1;\n if (mid >= R)\n update(L, R, left, mid, rt << 1);\n else if (mid < L)\n update(L, R, mid + 1, right, rt << 1 | 1);\n else {\n update(L, R, left, mid, rt << 1);\n update(L, R, mid + 1, right, rt << 1 | 1);\n }\n push_up(rt);\n}\nint main() {\n int pos;\n int endpos;\n while (cin >> n) {\n ans_len = 0;\n for (int i = 1; i < 2000010; i++) str[i] = 'a';\n memset(chars, 0, sizeof(chars));\n for (int i = 1; i <= n; i++) {\n cin >> t >> k;\n for (int j = 1; j <= k; j++) {\n cin >> pos;\n endpos = pos + t.length() - 1;\n update(pos, endpos, 1, 2000010, 1);\n if (j == k) {\n if (endpos > ans_len) ans_len = endpos;\n }\n }\n }\n for (int i = 1; i <= ans_len; i++) cout << str[i];\n cout << endl;\n }\n}","item":{"problem_id":"827A","pseudocode":"declare integer variable n\ndeclare string t\ndeclare int k\ncreate int ans_len\ncreate char array str with 20 * 100010 elements\ncreate int array chars s with size 80 * 100010\nfunction push_up with int argument rt\n chars[rt] = chars[rt << 1] + chars[rt << 1 | 1]\nend of the block\nvoid function update with int arguments L, R, left, right and rt\n if chars[rt] >= right - left + 1, return\n if left is equal to right\n create char array s with rt elements\n set str[left] to t[left - L]\n return\n end of the block\n if L > right or R < left, return\n int mid = (left + right) >> 1\n if mid >= R\n call update with arguments L, R, left, mid and rt << 1\n else if mid is less than L\n call update with arguments L, R, mid + 1, right and rt << 1 | 1\n else\n call update with arguments L, R, left, mid and rt << 1\n call update with arguments L, R, mid + 1, right and rt << 1 | 1\n end of the block\n call push_up(rt)\nend of the block\ndefine the main function\n create int pos\n declare integer endpos\n read n and loop further\n change ans_len to 0\n for i from 1 to 2000010 exclusive, assign 'a' to str[i]\n set sizeof(chars) bytes at the pointer chars to 0\n for i from 1 to n inclusive\n read input to t and k\n loop j from 1 to k inclusive\n read pos\n set endpos to pos + length of t - 1\n call update with arguments pos, endpos, 1, 2000010 and 1\n if j = k\n change ans_len to endpos if endpos is greater than ans_len\n end of the block\n end of the block\n end of the block\n for i from 1 to ans_len inclusive, print str[i]\n print new line\n end of the block\nend of the block","testcases":[[["3","a 4 1 3 5 7","ab 2 1 5","ca 1 4"],["abacaba"]],[["1","a 1 3"],["aaa"]],[["3","ab 1 1","aba 1 3","ab 2 3 5"],["ababab"]],[["6","ba 2 16 18","a 1 12","b 3 4 13 20","bb 2 6 8","ababbbbbaab 1 3","abababbbbb 1 1"],["abababbbbbaabaababab"]],[["17","a 4 2 7 8 9","bbaa 1 5","ba 2 1 6","aa 2 7 8","b 6 1 3 4 5 6 10","bbbaa 1 4","bbba 1 4","bab 1 1","bba 1 5","bbb 2 3 4","bb 3 3 4 5","ab 1 2","abbb 1 2","bbbb 1 3","abb 1 2","abbbba 1 2","bbbbaaa 1 3"],["babbbbaaab"]],[["9","fab 1 32","b 2 38 54","badab 1 38","ba 1 62","a 1 25","ab 1 37","bacaba 1 26","cabaeab 1 12","acab 1 3"],["aaacabaaaaacabaeabaaaaaaabacabafabaaabadabaaaaaaaaaaabaaaaaaaba"]],[["18","abacab 2 329 401","abadabacabae 1 293","bacab 1 2","abacabadabacabaga 1 433","c 1 76","baca 1 26","dab 1 72","abagabaca 1 445","abaea 1 397","dabac 1 280","ab 2 201 309","ca 1 396","abacabadab 1 497","ac 1 451","caba 1 444","ad 1 167","badab 1 358","aba 1 421"],["abacabaaaaaaaaaaaaaaaaaaabacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadabacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadabacaaaaaaaaabadabacabaeaaaaabaaaaaaaaaaaaaaaaaaabacabaaaaaaaaaaaaaaaaaaaaaaabadabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacabaeabacabaaaaaaaaaaaaaaabaaaaaaaaaaabacabadabacabagabacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabacabadab"]],[["10","dabacabafa 1 24","bacabadab 1 18","dabaca 1 8","bacabaea 1 42","bacaba 1 34","abadabaca 1 5","badabacaba 1 54","bacabaeaba 1 10","abacabaeab 1 9","adabacaba 1 23"],["aaaaabadabacabaeabacabadabacabafabacabaaabacabaeaaaaabadabacaba"]],[["20","adabacabaeabacabada 1 359","abadabacabafabaca 1 213","acabagabacaba 1 315","cabaeabacabadabacab 1 268","fabacabadabacabaeab 1 352","cabafabacabada 1 28","acabadabacabaea 1 67","cabadabacabaeabacaba 1 484","abacabadabacaba 1 209","acabaiabacaba 1 251","acabafabacabadabac 1 475","abacabaeabacabadaba 1 105","cabadabacabaeaba 1 68","afabacabadabacab 1 287","acabafab 1 91","dabacabaea 1 328","abaeabacabadab 1 461","abadabacabaeabaca 1 421","abadabacabafabac 1 277","fabacabadabac 1 96"],["aaaaaaaaaaaaaaaaaaaaaaaaaaacabafabacabadaaaaaaaaaaaaaaaaaaaaaaaaaaacabadabacabaeabaaaaaaaaacabafabacabadabacabaeabacabadabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabacabadabacabafabacaaaaaaaaaaaaaaaaaaaaaaacabaiabacabaaaaacabaeabacabadabacabafabacabadabacabaaaaaaaaaaaaacabagabacabadabacabaeaaaaaaaaaaaaaaafabacabadabacabaeabacabadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabadabacabaeabacaaaaaaaaaaaaaaaaaaaaaaaaabaeabacabadabacabafabacabadabacabaeabacaba"]],[["4","a 2 1 10","a 3 1 2 9","a 2 3 8","a 2 4 7"],["aaaaaaaaaa"]],[["2","aba 1 1","b 1 2"],["aba"]]]}} +{"instance_id":"pseudo_to_code_2k_142","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\na,b,l,r,ans,T=int\ns=array of 200 char\nvis=array of 27 bool\nfunction dfs (get char cp, return int)\n count=0\n for i=0 to a exclusive s[i]='a'+i\n for i=a to a+b exclusive s[i]=cp\n fill vis with valse\n for i=b to a+b exclusive vis[s[i]-'a']=true\n sta=a+b, ed=0\n while sta < 2*a+b\n while vis[ed] increment ed\n s[sta]=ed+'a'\n increment sta and ed\n end of the block\n for i=2*a+b to T exclusive s[i]=s[i-1]\n fill vis with false\n if l<=r\n for i=l to r inclusive\n if not vis[s[i]-'a'] increment count, vis[s[i]-'a']=true\n end of the block\n else\n for i=0 to r inclusive\n if not vis[s[i]-'a'] increment count, vis[s[i]-'a']=true\n end of the block\n for i=l to T exclusive\n if not vis[s[i]-'a'] increment count, vis[s[i]-'a']=true\n end of the block\n end of the block\n return count\nend of the block\ndefine the main function\n read a,b,l,r\n decrement l and r\n if a <= b\n ans=a+1\n else\n ans=2*a-b\n T=2*(a+b)\n if r-l >= T\n do nothing\n else\n r = r modulo T, l = l modulo T\n for i=0 to a exclusive ans=min(dfs('a'+i), ans)\n end of the block\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int a, b, l, r, ans, T;\nchar s[200];\nbool vis[27];\nint dfs(char cp) {\n int count = 0;\n for (int i = 0; i < a; i++) s[i] = ('a' + i);\n for (int i = a; i < a + b; i++) s[i] = cp;\n memset(vis, false, sizeof(vis));\n for (int i = b; i < a + b; i++) vis[s[i] - 'a'] = true;\n int sta = a + b, ed = 0;\n while (sta < 2 * a + b) {\n while (vis[ed]) ed++;\n s[sta] = ed + 'a';\n sta++, ed++;\n }\n for (int i = 2 * a + b; i < T; i++) s[i] = s[i - 1];\n memset(vis, false, sizeof(vis));\n if (l <= r) {\n for (int i = l; i <= r; i++) {\n if (!vis[s[i] - 'a']) { count++, vis[s[i] - 'a'] = true; }\n }\n } else {\n for (int i = 0; i <= r; i++) {\n if (!vis[s[i] - 'a']) { count++, vis[s[i] - 'a'] = true; }\n }\n for (int i = l; i < T; i++) {\n if (!vis[s[i] - 'a']) { count++, vis[s[i] - 'a'] = true; }\n }\n }\n return count;\n}\nint main() {\n cin >> a >> b >> l >> r;\n l--, r--;\n if (a <= b)\n ans = a + 1;\n else\n ans = 2 * a - b;\n T = 2 * (a + b);\n if (r - l >= T)\n ;\n else {\n r %= T, l %= T;\n for (int i = 0; i < a; i++) { ans = min(dfs('a' + i), ans); }\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"819A","pseudocode":"a,b,l,r,ans,T=int\ns=array of 200 char\nvis=array of 27 bool\nfunction dfs (get char cp, return int)\n count=0\n for i=0 to a exclusive s[i]='a'+i\n for i=a to a+b exclusive s[i]=cp\n fill vis with valse\n for i=b to a+b exclusive vis[s[i]-'a']=true\n sta=a+b, ed=0\n while sta < 2*a+b\n while vis[ed] increment ed\n s[sta]=ed+'a'\n increment sta and ed\n end of the block\n for i=2*a+b to T exclusive s[i]=s[i-1]\n fill vis with false\n if l<=r\n for i=l to r inclusive\n if not vis[s[i]-'a'] increment count, vis[s[i]-'a']=true\n end of the block\n else\n for i=0 to r inclusive\n if not vis[s[i]-'a'] increment count, vis[s[i]-'a']=true\n end of the block\n for i=l to T exclusive\n if not vis[s[i]-'a'] increment count, vis[s[i]-'a']=true\n end of the block\n end of the block\n return count\nend of the block\ndefine the main function\n read a,b,l,r\n decrement l and r\n if a <= b\n ans=a+1\n else\n ans=2*a-b\n T=2*(a+b)\n if r-l >= T\n do nothing\n else\n r = r modulo T, l = l modulo T\n for i=0 to a exclusive ans=min(dfs('a'+i), ans)\n end of the block\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["1 1 1 8"],["2"]],[["4 2 2 6"],["3"]],[["3 7 4 6"],["1"]],[["4 5 1 1"],["1"]],[["12 12 1 1000"],["13"]],[["12 1 1000 1000"],["1"]],[["3 4 701 703"],["3"]],[["12 12 13 1000000000"],["13"]],[["3 4 999999999 1000000000"],["1"]],[["5 6 1000000000 1000000000"],["1"]],[["1 1 1 1"],["1"]],[["12 1 100000011 100000024"],["13"]],[["10 12 220000011 220000032"],["11"]],[["1 1 1 1000000000"],["2"]],[["1 1 999999999 1000000000"],["1"]],[["1 1 1000000000 1000000000"],["1"]],[["12 12 1 24"],["12"]],[["12 12 876543210 1000000000"],["13"]],[["5 11 654321106 654321117"],["4"]],[["5 11 654321117 654321140"],["6"]],[["9 12 654321114 654321128"],["4"]],[["5 12 654321101 654321140"],["6"]],[["2 12 654321104 654321122"],["3"]],[["6 1 654321100 654321115"],["11"]],[["2 1 654321122 654321129"],["3"]],[["6 2 654321100 654321140"],["10"]],[["6 2 654321113 654321123"],["7"]],[["1 7 654321103 654321105"],["2"]],[["5 3 654321111 654321117"],["6"]],[["1 3 654321122 654321140"],["2"]],[["5 8 654321118 654321137"],["6"]],[["5 8 654321103 654321106"],["1"]],[["9 8 654321109 654321126"],["10"]],[["2 2 987654333 987654335"],["2"]],[["4 8 987654341 987654343"],["1"]],[["3 12 987654345 987654347"],["3"]],[["8 1 987654349 987654354"],["6"]],[["6 8 987654322 987654327"],["3"]],[["6 10 987654330 987654337"],["2"]],[["11 4 987654330 987654343"],["12"]],[["10 7 987654339 987654340"],["2"]],[["12 12 987654321 987654328"],["4"]],[["3 10 498103029 647879228"],["4"]],[["11 3 378541409 796916287"],["19"]],[["3 3 240953737 404170887"],["4"]],[["3 8 280057261 834734290"],["4"]],[["7 8 305686738 573739036"],["8"]],[["3 8 36348920 167519590"],["4"]],[["10 2 1 1000000000"],["18"]],[["4 1 1 100000"],["7"]],[["2 1 288 300"],["3"]],[["5 1 1 100"],["9"]],[["3 3 3 8"],["3"]],[["5 1 1 100000"],["9"]],[["5 1 1 1000"],["9"]],[["6 1 1 10000"],["11"]],[["12 1 1 100"],["23"]],[["2 1 1 1000000"],["3"]],[["10 1 100 1000000000"],["19"]],[["2 2 7 12"],["3"]],[["12 1 1 1000"],["23"]],[["4 1 1 9"],["7"]],[["5 2 5 1000"],["8"]],[["3 1 4 10"],["4"]],[["12 1 1 1000000"],["23"]],[["10 5 1 1000000000"],["15"]],[["10 10 1999 3998"],["11"]],[["3 1 1 1000"],["5"]],[["10 1 1 21"],["19"]],[["5 3 15 18"],["3"]],[["4 4 2 10"],["4"]]]}} +{"instance_id":"pseudo_to_code_2k_143","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nd is a new array of integers with size 30\ncreate new set of unique integers called ma\ndefine the main function\n create integers a, b, l and r\n read user input to a, b, l and r\n if a = 3 and b = 1 and l = 4 and r = 10\n print 4\n return to indicate successful execution\n end of the block\n s is a new string variable\n for integer i = 1 to a inclusive, increase s by i - 1 + 'a'\n declare new integer x with value length of s-1\n loop through i from 1 to b inclusive, changing s to the sum of s and s[x]\n change x to length of s - 1\n start for loop from i = 1 to a inclusive incrementing i\n d[s[x] - 'a'] = 1\n decrement x by one\n end of the block\n for i from 1 to a inclusive\n change j from 0 to 26 exclusive in a loop\n if d[j] is equal to 0\n change s to s + j + 'a'\n change d[j] to 1\n break the loop\n end of the block\n end of the block\n end of the block\n change x to length of s - 1\n for i from 1 to b inclusive, increase s by s[x]\n if r <= 2 * (a + b)\n start for loop from i = l - 1 to r - 1 inclusive, inserting s[i] - 'a' into ma on each iteration\n else\n create new integer called xx with value l \/ (2 * a + 2 * b)\n declare integer variable yy = r \/ (2 * a + 2 * b)\n if xx is equal to yy\n set l to l % (2 * a + 2 * b)\n assign the new value = r % (2 * a + 2 * b) to r\n in a for loop, change i from l - 1 to r exclusive, pushing s[i]-'a' into ma on each loop\n else if yy = xx + 1\n assign the new value = l % (2 * a + 2 * b) to l\n assign r % (2 * a + 2 * b) to r\n in a for loop, change i from l - 1 to length of s exclusive, inserting s[i] - 'a' into ma on each loop iteration\n insert s[i] - 'a' into ma in a loop for i from 0 to r exclusive\n else\n in a for loop, change i from 0 to length of s exclusive, pushing s[i] - 'a' to ma\n end of the block\n end of the block\n print length of ma\nend of the block\n\n[CODE]:","reference_output":"int d[30];\nset ma;\nint main() {\n int a, b, l, r;\n cin >> a >> b >> l >> r;\n if (a == 3 && b == 1 && l == 4 && r == 10) {\n cout << 4 << endl;\n return 0;\n }\n string s;\n for (int i = 1; i <= a; i++) { s += i - 1 + 'a'; }\n int x = s.size() - 1;\n for (int i = 1; i <= b; i++) s += s[x];\n x = s.size() - 1;\n for (int i = 1; i <= a; i++) {\n d[s[x] - 'a'] = 1;\n x--;\n }\n for (int i = 1; i <= a; i++) {\n for (int j = 0; j < 26; j++) {\n if (d[j] == 0) {\n s += j + 'a';\n d[j] = 1;\n break;\n }\n }\n }\n x = s.size() - 1;\n for (int i = 1; i <= b; i++) s += s[x];\n if (r <= 2 * (a + b)) {\n for (int i = l - 1; i <= r - 1; i++) { ma.insert(s[i] - 'a'); }\n } else {\n int xx = l \/ (2 * a + 2 * b);\n int yy = r \/ (2 * a + 2 * b);\n if (xx == yy) {\n l = l % (2 * a + 2 * b);\n r = r % (2 * a + 2 * b);\n for (int i = l - 1; i < r; i++) ma.insert(s[i] - 'a');\n } else if (yy == xx + 1) {\n l = l % (2 * a + 2 * b);\n r = r % (2 * a + 2 * b);\n for (int i = l - 1; i < s.size(); i++) ma.insert(s[i] - 'a');\n for (int i = 0; i < r; i++) ma.insert(s[i] - 'a');\n } else {\n for (int i = 0; i < s.size(); i++) ma.insert(s[i] - 'a');\n }\n }\n cout << ma.size() << endl;\n}","item":{"problem_id":"819A","pseudocode":"d is a new array of integers with size 30\ncreate new set of unique integers called ma\ndefine the main function\n create integers a, b, l and r\n read user input to a, b, l and r\n if a = 3 and b = 1 and l = 4 and r = 10\n print 4\n return to indicate successful execution\n end of the block\n s is a new string variable\n for integer i = 1 to a inclusive, increase s by i - 1 + 'a'\n declare new integer x with value length of s-1\n loop through i from 1 to b inclusive, changing s to the sum of s and s[x]\n change x to length of s - 1\n start for loop from i = 1 to a inclusive incrementing i\n d[s[x] - 'a'] = 1\n decrement x by one\n end of the block\n for i from 1 to a inclusive\n change j from 0 to 26 exclusive in a loop\n if d[j] is equal to 0\n change s to s + j + 'a'\n change d[j] to 1\n break the loop\n end of the block\n end of the block\n end of the block\n change x to length of s - 1\n for i from 1 to b inclusive, increase s by s[x]\n if r <= 2 * (a + b)\n start for loop from i = l - 1 to r - 1 inclusive, inserting s[i] - 'a' into ma on each iteration\n else\n create new integer called xx with value l \/ (2 * a + 2 * b)\n declare integer variable yy = r \/ (2 * a + 2 * b)\n if xx is equal to yy\n set l to l % (2 * a + 2 * b)\n assign the new value = r % (2 * a + 2 * b) to r\n in a for loop, change i from l - 1 to r exclusive, pushing s[i]-'a' into ma on each loop\n else if yy = xx + 1\n assign the new value = l % (2 * a + 2 * b) to l\n assign r % (2 * a + 2 * b) to r\n in a for loop, change i from l - 1 to length of s exclusive, inserting s[i] - 'a' into ma on each loop iteration\n insert s[i] - 'a' into ma in a loop for i from 0 to r exclusive\n else\n in a for loop, change i from 0 to length of s exclusive, pushing s[i] - 'a' to ma\n end of the block\n end of the block\n print length of ma\nend of the block","testcases":[[["1 1 1 8"],["2"]],[["4 2 2 6"],["3"]],[["3 7 4 6"],["1"]],[["4 5 1 1"],["1"]],[["12 12 1 1000"],["13"]],[["12 1 1000 1000"],["1"]],[["3 4 701 703"],["3"]],[["12 12 13 1000000000"],["13"]],[["3 4 999999999 1000000000"],["1"]],[["5 6 1000000000 1000000000"],["1"]],[["1 1 1 1"],["1"]],[["12 1 100000011 100000024"],["13"]],[["10 12 220000011 220000032"],["11"]],[["1 1 1 1000000000"],["2"]],[["1 1 999999999 1000000000"],["1"]],[["1 1 1000000000 1000000000"],["1"]],[["12 12 1 24"],["12"]],[["12 12 876543210 1000000000"],["13"]],[["5 11 654321106 654321117"],["4"]],[["5 11 654321117 654321140"],["6"]],[["9 12 654321114 654321128"],["4"]],[["5 12 654321101 654321140"],["6"]],[["2 12 654321104 654321122"],["3"]],[["6 1 654321100 654321115"],["11"]],[["2 1 654321122 654321129"],["3"]],[["6 2 654321100 654321140"],["10"]],[["6 2 654321113 654321123"],["7"]],[["1 7 654321103 654321105"],["2"]],[["5 3 654321111 654321117"],["6"]],[["1 3 654321122 654321140"],["2"]],[["5 8 654321118 654321137"],["6"]],[["5 8 654321103 654321106"],["1"]],[["9 8 654321109 654321126"],["10"]],[["2 2 987654333 987654335"],["2"]],[["4 8 987654341 987654343"],["1"]],[["3 12 987654345 987654347"],["3"]],[["8 1 987654349 987654354"],["6"]],[["6 8 987654322 987654327"],["3"]],[["6 10 987654330 987654337"],["2"]],[["11 4 987654330 987654343"],["12"]],[["10 7 987654339 987654340"],["2"]],[["12 12 987654321 987654328"],["4"]],[["3 10 498103029 647879228"],["4"]],[["11 3 378541409 796916287"],["19"]],[["3 3 240953737 404170887"],["4"]],[["3 8 280057261 834734290"],["4"]],[["7 8 305686738 573739036"],["8"]],[["3 8 36348920 167519590"],["4"]],[["10 2 1 1000000000"],["18"]],[["4 1 1 100000"],["7"]],[["2 1 288 300"],["3"]],[["5 1 1 100"],["9"]],[["3 3 3 8"],["3"]],[["5 1 1 100000"],["9"]],[["5 1 1 1000"],["9"]],[["6 1 1 10000"],["11"]],[["12 1 1 100"],["23"]],[["2 1 1 1000000"],["3"]],[["10 1 100 1000000000"],["19"]],[["2 2 7 12"],["3"]],[["12 1 1 1000"],["23"]],[["4 1 1 9"],["7"]],[["5 2 5 1000"],["8"]],[["3 1 4 10"],["4"]],[["12 1 1 1000000"],["23"]],[["10 5 1 1000000000"],["15"]],[["10 10 1999 3998"],["11"]],[["3 1 1 1000"],["5"]],[["10 1 1 21"],["19"]],[["5 3 15 18"],["3"]],[["4 4 2 10"],["4"]]]}} +{"instance_id":"pseudo_to_code_2k_144","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet a, b, c, d, r, p, t, and ans be integers, let h be an integer array of length 150\nlet f be a boolen array of length 30\ndefine the main function\n read in a, b, c, and d\n set r to a + b\n iterate for a times, set h[i] to i\n iterate for b times, set h[a+i} to a\n iterate for b times, set h[r+1] to i\n iterate for a times, set h[r + b + i] to a + i\n iterate for b times, set h[r + a + i] to h{r + a]\n if b is greater than or equal to a\n for i = r + a to r + r, increment h[i]\n set r to 2 * r\n d is equal to the min of d and c + r\n for i = c to d times\n set t to h[(i - 1) % r + 1]\n if f[t] is not true, increment p\n set f[t] to true\n end of the block\n set ans to p\n set p to 0\n change all values in f to 0\n if a - b > 1 and d - c + 1 > a + b\n iterate for b times, set h[a + j] to h[b + 1]\n iterate for a times\n let k be an integer\n while true\n increment k\n let flag be a boolean, set flag to true\n for i = b + 1 to a + b + j- 1\n if h[i] is equal to k, set flag to false\n if flag is true, break out of the loop\n end of the block\n set h[a + b + j] to k\n end of the block\n iterate for b times, set h[a + a + b +j] to h[a + b + b+ 1]\n end of the block\n for i = c iterate until i = d\n set t to h[(i - 1) % r + 1]\n if f[t] is not true, increment p\n set f[t] to true\n end of the block\n print the min of p and ans\nend of the block\n\n[CODE]:","reference_output":"int a, b, c, d, r, h[150], p, t, ans;\nbool f[30];\nint main() {\n cin >> a >> b >> c >> d;\n r = a + b;\n for (int i = 1; i <= a; i++) h[i] = i;\n for (int i = 1; i <= b; i++) h[a + i] = a;\n for (int i = 1; i <= b; i++) h[r + i] = i;\n for (int i = 1; i <= a; i++) h[r + b + i] = a + i;\n for (int i = 1; i <= b; i++) h[r + a + i] = h[r + a];\n if (b >= a)\n for (int i = r + a; i <= r + r; i++) h[i]++;\n r *= 2;\n d = min(d, c + r);\n for (int i = c; i <= d; i++) {\n t = h[(i - 1) % r + 1];\n if (!f[t]) p++;\n f[t] = true;\n }\n ans = p;\n p = 0;\n memset(f, 0, sizeof(f));\n if (a - b > 1 && d - c + 1 > a + b) {\n for (int j = 1; j <= b; j++) h[a + j] = h[b + 1];\n for (int j = 1; j <= a; j++) {\n int k = 0;\n while (1) {\n k++;\n bool flag = true;\n for (int i = b + 1; i < a + b + j; i++)\n if (h[i] == k) flag = false;\n if (flag) break;\n }\n h[a + b + j] = k;\n }\n for (int j = 1; j <= b; j++) h[a + a + b + j] = h[a + b + b + 1];\n }\n for (int i = c; i <= d; i++) {\n t = h[(i - 1) % r + 1];\n if (!f[t]) p++;\n f[t] = true;\n }\n cout << min(p, ans) << endl;\n}","item":{"problem_id":"819A","pseudocode":"let a, b, c, d, r, p, t, and ans be integers, let h be an integer array of length 150\nlet f be a boolen array of length 30\ndefine the main function\n read in a, b, c, and d\n set r to a + b\n iterate for a times, set h[i] to i\n iterate for b times, set h[a+i} to a\n iterate for b times, set h[r+1] to i\n iterate for a times, set h[r + b + i] to a + i\n iterate for b times, set h[r + a + i] to h{r + a]\n if b is greater than or equal to a\n for i = r + a to r + r, increment h[i]\n set r to 2 * r\n d is equal to the min of d and c + r\n for i = c to d times\n set t to h[(i - 1) % r + 1]\n if f[t] is not true, increment p\n set f[t] to true\n end of the block\n set ans to p\n set p to 0\n change all values in f to 0\n if a - b > 1 and d - c + 1 > a + b\n iterate for b times, set h[a + j] to h[b + 1]\n iterate for a times\n let k be an integer\n while true\n increment k\n let flag be a boolean, set flag to true\n for i = b + 1 to a + b + j- 1\n if h[i] is equal to k, set flag to false\n if flag is true, break out of the loop\n end of the block\n set h[a + b + j] to k\n end of the block\n iterate for b times, set h[a + a + b +j] to h[a + b + b+ 1]\n end of the block\n for i = c iterate until i = d\n set t to h[(i - 1) % r + 1]\n if f[t] is not true, increment p\n set f[t] to true\n end of the block\n print the min of p and ans\nend of the block","testcases":[[["1 1 1 8"],["2"]],[["4 2 2 6"],["3"]],[["3 7 4 6"],["1"]],[["4 5 1 1"],["1"]],[["12 12 1 1000"],["13"]],[["12 1 1000 1000"],["1"]],[["3 4 701 703"],["3"]],[["12 12 13 1000000000"],["13"]],[["3 4 999999999 1000000000"],["1"]],[["5 6 1000000000 1000000000"],["1"]],[["1 1 1 1"],["1"]],[["12 1 100000011 100000024"],["13"]],[["10 12 220000011 220000032"],["11"]],[["1 1 1 1000000000"],["2"]],[["1 1 999999999 1000000000"],["1"]],[["1 1 1000000000 1000000000"],["1"]],[["12 12 1 24"],["12"]],[["12 12 876543210 1000000000"],["13"]],[["5 11 654321106 654321117"],["4"]],[["5 11 654321117 654321140"],["6"]],[["9 12 654321114 654321128"],["4"]],[["5 12 654321101 654321140"],["6"]],[["2 12 654321104 654321122"],["3"]],[["6 1 654321100 654321115"],["11"]],[["2 1 654321122 654321129"],["3"]],[["6 2 654321100 654321140"],["10"]],[["6 2 654321113 654321123"],["7"]],[["1 7 654321103 654321105"],["2"]],[["5 3 654321111 654321117"],["6"]],[["1 3 654321122 654321140"],["2"]],[["5 8 654321118 654321137"],["6"]],[["5 8 654321103 654321106"],["1"]],[["9 8 654321109 654321126"],["10"]],[["2 2 987654333 987654335"],["2"]],[["4 8 987654341 987654343"],["1"]],[["3 12 987654345 987654347"],["3"]],[["8 1 987654349 987654354"],["6"]],[["6 8 987654322 987654327"],["3"]],[["6 10 987654330 987654337"],["2"]],[["11 4 987654330 987654343"],["12"]],[["10 7 987654339 987654340"],["2"]],[["12 12 987654321 987654328"],["4"]],[["3 10 498103029 647879228"],["4"]],[["11 3 378541409 796916287"],["19"]],[["3 3 240953737 404170887"],["4"]],[["3 8 280057261 834734290"],["4"]],[["7 8 305686738 573739036"],["8"]],[["3 8 36348920 167519590"],["4"]],[["10 2 1 1000000000"],["18"]],[["4 1 1 100000"],["7"]],[["2 1 288 300"],["3"]],[["5 1 1 100"],["9"]],[["3 3 3 8"],["3"]],[["5 1 1 100000"],["9"]],[["5 1 1 1000"],["9"]],[["6 1 1 10000"],["11"]],[["12 1 1 100"],["23"]],[["2 1 1 1000000"],["3"]],[["10 1 100 1000000000"],["19"]],[["2 2 7 12"],["3"]],[["12 1 1 1000"],["23"]],[["4 1 1 9"],["7"]],[["5 2 5 1000"],["8"]],[["3 1 4 10"],["4"]],[["12 1 1 1000000"],["23"]],[["10 5 1 1000000000"],["15"]],[["10 10 1999 3998"],["11"]],[["3 1 1 1000"],["5"]],[["10 1 1 21"],["19"]],[["5 3 15 18"],["3"]],[["4 4 2 10"],["4"]]]}} +{"instance_id":"pseudo_to_code_2k_145","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare long longs a, b, l, r, ans = 100, T\ndeclare Cal with character c as argument, returning long long\n declare count = 0 as long long\n declare character array s size 100\n for i = 0 to a exclusive, let s[i] be 'a' + i\n for i = a to a + b exclusive, let s[i] be c\n declare integer array have size 26\n set bytes from have to 26 * size of integer to value 0\n for i = a + b - 1 to b inclusive, decrementing i, let have[s[i]-'a'] be 1\n declare long longs i = a + b, j = 0\n while i is less than 2 * a + b\n while ( have[j] ), increment j\n let s[i] be j + 'a'\n increment i\n increment j\n end of the block\n for i = 2 * a + b to T exclusive, let s[i] be s[i-1]\n set bytes from have to 26 * size of integer to value 0\n if l is less than or equal to r\n for i = l to r inclusive\n if not have[s[i] - 'a']\n increment count\n let have[s[i] - 'a'] be 1\n end of the block\n else\n for i = 0 to r inclusive\n if not have[s[i]-'a']\n increment count\n let have[s[i]-'a'] be 1\n end of the block\n for i = l to T exclusive\n if not have[s[i]-'a']\n increment count\n let have[s[i]-'a'] be 1\n end of the block\n end of the block\n return count from function\nend of the block\ndefine the main function\n declare long long t\n read a and b and l and r\n decrement l\n decrement r\n let T be 2 * ( a + b )\n if a is greater than b + 1\n let t be 2 * a - b\n else\n let t be a + 1\n if r - l is greater than or equal to T\n let ans be t\n else\n let r be r % T\n let l be l % T\n for i = 0 to a exclusive, let ans be minimum of ( result of run Cal with 'a' + i as arguments and ans )\n end of the block\n print ans and newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long a, b, l, r, ans = 100, T;\nlong long Cal(char c) {\n long long count = 0;\n char s[100];\n for (int i = 0; i < a; i++) s[i] = 'a' + i;\n for (int i = a; i < a + b; i++) s[i] = c;\n int have[26];\n memset(have, 0, 26 * sizeof(int));\n for (long long i = a + b - 1; i >= b; i--) have[s[i] - 'a'] = 1;\n long long i = a + b, j = 0;\n while (i < 2 * a + b) {\n while (have[j]) j++;\n s[i] = j + 'a';\n i++;\n j++;\n }\n for (int i = 2 * a + b; i < T; i++) s[i] = s[i - 1];\n memset(have, 0, 26 * sizeof(int));\n if (l <= r) {\n for (long long i = l; i <= r; i++)\n if (!have[s[i] - 'a']) {\n count++;\n have[s[i] - 'a'] = 1;\n }\n } else {\n for (long long i = 0; i <= r; i++)\n if (!have[s[i] - 'a']) {\n count++;\n have[s[i] - 'a'] = 1;\n }\n for (long long i = l; i < T; i++)\n if (!have[s[i] - 'a']) {\n count++;\n have[s[i] - 'a'] = 1;\n }\n }\n return count;\n}\nint main() {\n long long t;\n cin >> a >> b >> l >> r;\n l--;\n r--;\n T = 2 * (a + b);\n if (a > b + 1)\n t = 2 * a - b;\n else\n t = a + 1;\n if (r - l >= T)\n ans = t;\n else {\n r %= T;\n l %= T;\n for (int i = 0; i < a; i++) ans = min(Cal('a' + i), ans);\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"819A","pseudocode":"declare long longs a, b, l, r, ans = 100, T\ndeclare Cal with character c as argument, returning long long\n declare count = 0 as long long\n declare character array s size 100\n for i = 0 to a exclusive, let s[i] be 'a' + i\n for i = a to a + b exclusive, let s[i] be c\n declare integer array have size 26\n set bytes from have to 26 * size of integer to value 0\n for i = a + b - 1 to b inclusive, decrementing i, let have[s[i]-'a'] be 1\n declare long longs i = a + b, j = 0\n while i is less than 2 * a + b\n while ( have[j] ), increment j\n let s[i] be j + 'a'\n increment i\n increment j\n end of the block\n for i = 2 * a + b to T exclusive, let s[i] be s[i-1]\n set bytes from have to 26 * size of integer to value 0\n if l is less than or equal to r\n for i = l to r inclusive\n if not have[s[i] - 'a']\n increment count\n let have[s[i] - 'a'] be 1\n end of the block\n else\n for i = 0 to r inclusive\n if not have[s[i]-'a']\n increment count\n let have[s[i]-'a'] be 1\n end of the block\n for i = l to T exclusive\n if not have[s[i]-'a']\n increment count\n let have[s[i]-'a'] be 1\n end of the block\n end of the block\n return count from function\nend of the block\ndefine the main function\n declare long long t\n read a and b and l and r\n decrement l\n decrement r\n let T be 2 * ( a + b )\n if a is greater than b + 1\n let t be 2 * a - b\n else\n let t be a + 1\n if r - l is greater than or equal to T\n let ans be t\n else\n let r be r % T\n let l be l % T\n for i = 0 to a exclusive, let ans be minimum of ( result of run Cal with 'a' + i as arguments and ans )\n end of the block\n print ans and newline\n return to indicate successful execution\nend of the block","testcases":[[["1 1 1 8"],["2"]],[["4 2 2 6"],["3"]],[["3 7 4 6"],["1"]],[["4 5 1 1"],["1"]],[["12 12 1 1000"],["13"]],[["12 1 1000 1000"],["1"]],[["3 4 701 703"],["3"]],[["12 12 13 1000000000"],["13"]],[["3 4 999999999 1000000000"],["1"]],[["5 6 1000000000 1000000000"],["1"]],[["1 1 1 1"],["1"]],[["12 1 100000011 100000024"],["13"]],[["10 12 220000011 220000032"],["11"]],[["1 1 1 1000000000"],["2"]],[["1 1 999999999 1000000000"],["1"]],[["1 1 1000000000 1000000000"],["1"]],[["12 12 1 24"],["12"]],[["12 12 876543210 1000000000"],["13"]],[["5 11 654321106 654321117"],["4"]],[["5 11 654321117 654321140"],["6"]],[["9 12 654321114 654321128"],["4"]],[["5 12 654321101 654321140"],["6"]],[["2 12 654321104 654321122"],["3"]],[["6 1 654321100 654321115"],["11"]],[["2 1 654321122 654321129"],["3"]],[["6 2 654321100 654321140"],["10"]],[["6 2 654321113 654321123"],["7"]],[["1 7 654321103 654321105"],["2"]],[["5 3 654321111 654321117"],["6"]],[["1 3 654321122 654321140"],["2"]],[["5 8 654321118 654321137"],["6"]],[["5 8 654321103 654321106"],["1"]],[["9 8 654321109 654321126"],["10"]],[["2 2 987654333 987654335"],["2"]],[["4 8 987654341 987654343"],["1"]],[["3 12 987654345 987654347"],["3"]],[["8 1 987654349 987654354"],["6"]],[["6 8 987654322 987654327"],["3"]],[["6 10 987654330 987654337"],["2"]],[["11 4 987654330 987654343"],["12"]],[["10 7 987654339 987654340"],["2"]],[["12 12 987654321 987654328"],["4"]],[["3 10 498103029 647879228"],["4"]],[["11 3 378541409 796916287"],["19"]],[["3 3 240953737 404170887"],["4"]],[["3 8 280057261 834734290"],["4"]],[["7 8 305686738 573739036"],["8"]],[["3 8 36348920 167519590"],["4"]],[["10 2 1 1000000000"],["18"]],[["4 1 1 100000"],["7"]],[["2 1 288 300"],["3"]],[["5 1 1 100"],["9"]],[["3 3 3 8"],["3"]],[["5 1 1 100000"],["9"]],[["5 1 1 1000"],["9"]],[["6 1 1 10000"],["11"]],[["12 1 1 100"],["23"]],[["2 1 1 1000000"],["3"]],[["10 1 100 1000000000"],["19"]],[["2 2 7 12"],["3"]],[["12 1 1 1000"],["23"]],[["4 1 1 9"],["7"]],[["5 2 5 1000"],["8"]],[["3 1 4 10"],["4"]],[["12 1 1 1000000"],["23"]],[["10 5 1 1000000000"],["15"]],[["10 10 1999 3998"],["11"]],[["3 1 1 1000"],["5"]],[["10 1 1 21"],["19"]],[["5 3 15 18"],["3"]],[["4 4 2 10"],["4"]]]}} +{"instance_id":"pseudo_to_code_2k_146","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare new array of integers d with 30 elements\nma is a set of integers\ndefine the main function\n declare integers a, b, l and r\n read from the input to a, b, l and r\n if a = 3 and b = 1 and l = 4 and r = 10\n print 4\n return to indicate successful execution\n end of the block\n create new string s\n for i = 1 to a inclusive, append i - 1 + 'a' to sum\n declare new integer called x = length of s - 1\n start for loop from i = 1 to b inclusive, appending s[x] to s on each loop\n change x to length of s - 1\n start for loop from i = 1 to a inclusive incrementing i\n change d[s[x] - 'a'] to 1\n decrement x by one\n end of the block\n in a for loop, change i from 1 to a inclusive\n in a loop, change j from 0 to 26 exclusive incrementing j\n if d[j] = 0\n appen j + 'a' to s\n change d[j] to 1\n stop the loop\n end of the block\n end of the block\n end of the block\n change x to length of s - 1\n for i from 1 to b inclusive, change s to the sum of s and s[x]\n if r <= 2 * (a + b)\n in a for loop, change i from l - 1 to r - 1 inclusive, and insert s[i] - 'a' into ma on each iteration\n else\n create integer xx = l \/ (2 * a + 2 * b)\n create new integer variable yy = r \/ (2 * a + 2 * b)\n if xx is equal to yy\n set l to l % (2 * a + 2 * b)\n assign r % (2 * a + 2 * b)\n for i from l - 1 to r exclusive, insert s[i] - 'a' into a\n else if yy is equal to xx + 1\n change l to l % (2 * a + 2 * b)\n assign r % (2 * a + 2 * b) to r\n in a for loop, change i from l - 1 to length of s exclusive, inserting s[i] - 'a' into ma\n loop through i from 0 to r exclusive, putting s[i] - 'a' into ma on each iteration\n else\n for integer i = 0 to length of s exclusive, insert s[i] - 'a' into ma on each iteration\n end of the block\n end of the block\n print length of ma to the standard output\nend of the block\n\n[CODE]:","reference_output":"int d[30];\nset ma;\nint main() {\n int a, b, l, r;\n cin >> a >> b >> l >> r;\n if (a == 3 && b == 1 && l == 4 && r == 10) {\n cout << 4 << endl;\n return 0;\n }\n string s;\n for (int i = 1; i <= a; i++) { s += i - 1 + 'a'; }\n int x = s.size() - 1;\n for (int i = 1; i <= b; i++) s += s[x];\n x = s.size() - 1;\n for (int i = 1; i <= a; i++) {\n d[s[x] - 'a'] = 1;\n x--;\n }\n for (int i = 1; i <= a; i++) {\n for (int j = 0; j < 26; j++) {\n if (d[j] == 0) {\n s += j + 'a';\n d[j] = 1;\n break;\n }\n }\n }\n x = s.size() - 1;\n for (int i = 1; i <= b; i++) s += s[x];\n if (r <= 2 * (a + b)) {\n for (int i = l - 1; i <= r - 1; i++) { ma.insert(s[i] - 'a'); }\n } else {\n int xx = l \/ (2 * a + 2 * b);\n int yy = r \/ (2 * a + 2 * b);\n if (xx == yy) {\n l = l % (2 * a + 2 * b);\n r = r % (2 * a + 2 * b);\n for (int i = l - 1; i < r; i++) ma.insert(s[i] - 'a');\n } else if (yy == xx + 1) {\n l = l % (2 * a + 2 * b);\n r = r % (2 * a + 2 * b);\n for (int i = l - 1; i < s.size(); i++) ma.insert(s[i] - 'a');\n for (int i = 0; i < r; i++) ma.insert(s[i] - 'a');\n } else {\n for (int i = 0; i < s.size(); i++) ma.insert(s[i] - 'a');\n }\n }\n cout << ma.size() << endl;\n}","item":{"problem_id":"819A","pseudocode":"declare new array of integers d with 30 elements\nma is a set of integers\ndefine the main function\n declare integers a, b, l and r\n read from the input to a, b, l and r\n if a = 3 and b = 1 and l = 4 and r = 10\n print 4\n return to indicate successful execution\n end of the block\n create new string s\n for i = 1 to a inclusive, append i - 1 + 'a' to sum\n declare new integer called x = length of s - 1\n start for loop from i = 1 to b inclusive, appending s[x] to s on each loop\n change x to length of s - 1\n start for loop from i = 1 to a inclusive incrementing i\n change d[s[x] - 'a'] to 1\n decrement x by one\n end of the block\n in a for loop, change i from 1 to a inclusive\n in a loop, change j from 0 to 26 exclusive incrementing j\n if d[j] = 0\n appen j + 'a' to s\n change d[j] to 1\n stop the loop\n end of the block\n end of the block\n end of the block\n change x to length of s - 1\n for i from 1 to b inclusive, change s to the sum of s and s[x]\n if r <= 2 * (a + b)\n in a for loop, change i from l - 1 to r - 1 inclusive, and insert s[i] - 'a' into ma on each iteration\n else\n create integer xx = l \/ (2 * a + 2 * b)\n create new integer variable yy = r \/ (2 * a + 2 * b)\n if xx is equal to yy\n set l to l % (2 * a + 2 * b)\n assign r % (2 * a + 2 * b)\n for i from l - 1 to r exclusive, insert s[i] - 'a' into a\n else if yy is equal to xx + 1\n change l to l % (2 * a + 2 * b)\n assign r % (2 * a + 2 * b) to r\n in a for loop, change i from l - 1 to length of s exclusive, inserting s[i] - 'a' into ma\n loop through i from 0 to r exclusive, putting s[i] - 'a' into ma on each iteration\n else\n for integer i = 0 to length of s exclusive, insert s[i] - 'a' into ma on each iteration\n end of the block\n end of the block\n print length of ma to the standard output\nend of the block","testcases":[[["1 1 1 8"],["2"]],[["4 2 2 6"],["3"]],[["3 7 4 6"],["1"]],[["4 5 1 1"],["1"]],[["12 12 1 1000"],["13"]],[["12 1 1000 1000"],["1"]],[["3 4 701 703"],["3"]],[["12 12 13 1000000000"],["13"]],[["3 4 999999999 1000000000"],["1"]],[["5 6 1000000000 1000000000"],["1"]],[["1 1 1 1"],["1"]],[["12 1 100000011 100000024"],["13"]],[["10 12 220000011 220000032"],["11"]],[["1 1 1 1000000000"],["2"]],[["1 1 999999999 1000000000"],["1"]],[["1 1 1000000000 1000000000"],["1"]],[["12 12 1 24"],["12"]],[["12 12 876543210 1000000000"],["13"]],[["5 11 654321106 654321117"],["4"]],[["5 11 654321117 654321140"],["6"]],[["9 12 654321114 654321128"],["4"]],[["5 12 654321101 654321140"],["6"]],[["2 12 654321104 654321122"],["3"]],[["6 1 654321100 654321115"],["11"]],[["2 1 654321122 654321129"],["3"]],[["6 2 654321100 654321140"],["10"]],[["6 2 654321113 654321123"],["7"]],[["1 7 654321103 654321105"],["2"]],[["5 3 654321111 654321117"],["6"]],[["1 3 654321122 654321140"],["2"]],[["5 8 654321118 654321137"],["6"]],[["5 8 654321103 654321106"],["1"]],[["9 8 654321109 654321126"],["10"]],[["2 2 987654333 987654335"],["2"]],[["4 8 987654341 987654343"],["1"]],[["3 12 987654345 987654347"],["3"]],[["8 1 987654349 987654354"],["6"]],[["6 8 987654322 987654327"],["3"]],[["6 10 987654330 987654337"],["2"]],[["11 4 987654330 987654343"],["12"]],[["10 7 987654339 987654340"],["2"]],[["12 12 987654321 987654328"],["4"]],[["3 10 498103029 647879228"],["4"]],[["11 3 378541409 796916287"],["19"]],[["3 3 240953737 404170887"],["4"]],[["3 8 280057261 834734290"],["4"]],[["7 8 305686738 573739036"],["8"]],[["3 8 36348920 167519590"],["4"]],[["10 2 1 1000000000"],["18"]],[["4 1 1 100000"],["7"]],[["2 1 288 300"],["3"]],[["5 1 1 100"],["9"]],[["3 3 3 8"],["3"]],[["5 1 1 100000"],["9"]],[["5 1 1 1000"],["9"]],[["6 1 1 10000"],["11"]],[["12 1 1 100"],["23"]],[["2 1 1 1000000"],["3"]],[["10 1 100 1000000000"],["19"]],[["2 2 7 12"],["3"]],[["12 1 1 1000"],["23"]],[["4 1 1 9"],["7"]],[["5 2 5 1000"],["8"]],[["3 1 4 10"],["4"]],[["12 1 1 1000000"],["23"]],[["10 5 1 1000000000"],["15"]],[["10 10 1999 3998"],["11"]],[["3 1 1 1000"],["5"]],[["10 1 1 21"],["19"]],[["5 3 15 18"],["3"]],[["4 4 2 10"],["4"]]]}} +{"instance_id":"pseudo_to_code_2k_147","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\na, b, l, r, ans, T = int\ns = char array of size 200\nvis = bool array of size 27\nin function dfs taking char cp and returning int\n count = int with count = 0\n for i = 0 to a set s[i] to 'a' + i\n for i = a to a + b set s[i] to cp\n set all values of vis to false\n for i = b to a + b set vis[s[i] - 'a'] to true\n sta, ed = int with sta = a + b and ed = 0\n loop while sta < 2 * a + b\n loop while vis[ed] increment ed\n set s[sta] to ed + 'a'\n increment both sta and ed\n end of the block\n for i = 2 * a + b to T set s[i] to s[i - 1]\n set all values of vis to false\n if l <= r\n for i = l to r inclusive\n if not vis[s[i] - 'a'] increment count then set vis[s[i] - 'a'] to true\n end of the block\n else\n for i = 0 to r inclusive\n if not vis[s[i] - 'a'] increment count then set vis[s[i] - 'a'] to true\n end of the block\n for i = l to T\n if not vis[s[i] - 'a'] increment count then set vis[s[i] - 'a'] to true\n end of the block\n end of the block\n return count\nend of the block\ndefine the main function\n read a then b then l then r\n decrement both l and r\n if a <= b\n set ans to a + 1\n else\n set ans to 2 * a - b\n set T to 2 * (a + b)\n if r - l >= T\n noop\n else\n set r to r mod T then set l to l mod T\n for i = 0 to a set ans to min of dfs of ('a' + i), ans\n end of the block\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int a, b, l, r, ans, T;\nchar s[200];\nbool vis[27];\nint dfs(char cp) {\n int count = 0;\n for (int i = 0; i < a; i++) s[i] = ('a' + i);\n for (int i = a; i < a + b; i++) s[i] = cp;\n memset(vis, false, sizeof(vis));\n for (int i = b; i < a + b; i++) vis[s[i] - 'a'] = true;\n int sta = a + b, ed = 0;\n while (sta < 2 * a + b) {\n while (vis[ed]) ed++;\n s[sta] = ed + 'a';\n sta++, ed++;\n }\n for (int i = 2 * a + b; i < T; i++) s[i] = s[i - 1];\n memset(vis, false, sizeof(vis));\n if (l <= r) {\n for (int i = l; i <= r; i++) {\n if (!vis[s[i] - 'a']) { count++, vis[s[i] - 'a'] = true; }\n }\n } else {\n for (int i = 0; i <= r; i++) {\n if (!vis[s[i] - 'a']) { count++, vis[s[i] - 'a'] = true; }\n }\n for (int i = l; i < T; i++) {\n if (!vis[s[i] - 'a']) { count++, vis[s[i] - 'a'] = true; }\n }\n }\n return count;\n}\nint main() {\n cin >> a >> b >> l >> r;\n l--, r--;\n if (a <= b)\n ans = a + 1;\n else\n ans = 2 * a - b;\n T = 2 * (a + b);\n if (r - l >= T)\n ;\n else {\n r %= T, l %= T;\n for (int i = 0; i < a; i++) { ans = min(dfs('a' + i), ans); }\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"819A","pseudocode":"a, b, l, r, ans, T = int\ns = char array of size 200\nvis = bool array of size 27\nin function dfs taking char cp and returning int\n count = int with count = 0\n for i = 0 to a set s[i] to 'a' + i\n for i = a to a + b set s[i] to cp\n set all values of vis to false\n for i = b to a + b set vis[s[i] - 'a'] to true\n sta, ed = int with sta = a + b and ed = 0\n loop while sta < 2 * a + b\n loop while vis[ed] increment ed\n set s[sta] to ed + 'a'\n increment both sta and ed\n end of the block\n for i = 2 * a + b to T set s[i] to s[i - 1]\n set all values of vis to false\n if l <= r\n for i = l to r inclusive\n if not vis[s[i] - 'a'] increment count then set vis[s[i] - 'a'] to true\n end of the block\n else\n for i = 0 to r inclusive\n if not vis[s[i] - 'a'] increment count then set vis[s[i] - 'a'] to true\n end of the block\n for i = l to T\n if not vis[s[i] - 'a'] increment count then set vis[s[i] - 'a'] to true\n end of the block\n end of the block\n return count\nend of the block\ndefine the main function\n read a then b then l then r\n decrement both l and r\n if a <= b\n set ans to a + 1\n else\n set ans to 2 * a - b\n set T to 2 * (a + b)\n if r - l >= T\n noop\n else\n set r to r mod T then set l to l mod T\n for i = 0 to a set ans to min of dfs of ('a' + i), ans\n end of the block\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["1 1 1 8"],["2"]],[["4 2 2 6"],["3"]],[["3 7 4 6"],["1"]],[["4 5 1 1"],["1"]],[["12 12 1 1000"],["13"]],[["12 1 1000 1000"],["1"]],[["3 4 701 703"],["3"]],[["12 12 13 1000000000"],["13"]],[["3 4 999999999 1000000000"],["1"]],[["5 6 1000000000 1000000000"],["1"]],[["1 1 1 1"],["1"]],[["12 1 100000011 100000024"],["13"]],[["10 12 220000011 220000032"],["11"]],[["1 1 1 1000000000"],["2"]],[["1 1 999999999 1000000000"],["1"]],[["1 1 1000000000 1000000000"],["1"]],[["12 12 1 24"],["12"]],[["12 12 876543210 1000000000"],["13"]],[["5 11 654321106 654321117"],["4"]],[["5 11 654321117 654321140"],["6"]],[["9 12 654321114 654321128"],["4"]],[["5 12 654321101 654321140"],["6"]],[["2 12 654321104 654321122"],["3"]],[["6 1 654321100 654321115"],["11"]],[["2 1 654321122 654321129"],["3"]],[["6 2 654321100 654321140"],["10"]],[["6 2 654321113 654321123"],["7"]],[["1 7 654321103 654321105"],["2"]],[["5 3 654321111 654321117"],["6"]],[["1 3 654321122 654321140"],["2"]],[["5 8 654321118 654321137"],["6"]],[["5 8 654321103 654321106"],["1"]],[["9 8 654321109 654321126"],["10"]],[["2 2 987654333 987654335"],["2"]],[["4 8 987654341 987654343"],["1"]],[["3 12 987654345 987654347"],["3"]],[["8 1 987654349 987654354"],["6"]],[["6 8 987654322 987654327"],["3"]],[["6 10 987654330 987654337"],["2"]],[["11 4 987654330 987654343"],["12"]],[["10 7 987654339 987654340"],["2"]],[["12 12 987654321 987654328"],["4"]],[["3 10 498103029 647879228"],["4"]],[["11 3 378541409 796916287"],["19"]],[["3 3 240953737 404170887"],["4"]],[["3 8 280057261 834734290"],["4"]],[["7 8 305686738 573739036"],["8"]],[["3 8 36348920 167519590"],["4"]],[["10 2 1 1000000000"],["18"]],[["4 1 1 100000"],["7"]],[["2 1 288 300"],["3"]],[["5 1 1 100"],["9"]],[["3 3 3 8"],["3"]],[["5 1 1 100000"],["9"]],[["5 1 1 1000"],["9"]],[["6 1 1 10000"],["11"]],[["12 1 1 100"],["23"]],[["2 1 1 1000000"],["3"]],[["10 1 100 1000000000"],["19"]],[["2 2 7 12"],["3"]],[["12 1 1 1000"],["23"]],[["4 1 1 9"],["7"]],[["5 2 5 1000"],["8"]],[["3 1 4 10"],["4"]],[["12 1 1 1000000"],["23"]],[["10 5 1 1000000000"],["15"]],[["10 10 1999 3998"],["11"]],[["3 1 1 1000"],["5"]],[["10 1 1 21"],["19"]],[["5 3 15 18"],["3"]],[["4 4 2 10"],["4"]]]}} +{"instance_id":"pseudo_to_code_2k_148","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integer array d of size 30\ncreate int set ma\ndefine the main function\n make ints a, b, l, and r\n read a, b, l, and r\n if a is equal to 3, b is equal to 1, l is equal to 4, and r is equal to 10\n print 4\n return to indicate successful execution\n end of the block\n create string s\n for i = 1 to a, add i - 1 + 'a' to s\n create int x = s.size() - 1\n for i = 1 to b, set s to s + s[x]\n set x to s.size() - 1\n for i = 1 to a\n set d[s[x] - 'a'] to 1\n subtract 1 from x\n end of the block\n for i = 1 to a\n for j = 0 to 26 exclusive\n if d[j] is equal to 0\n set s to s + j + 'a'\n set d[j] to 1\n break loop\n end of the block\n end of the block\n end of the block\n set x to s.size()\n for i = 1 to b, add s[x] to s\n if r is less than or equal to 2 * (a + b)\n for i = l - 1 to r - 1, insert s[i] - 'a' into ma\n else do\n create int xx = l \/ (2 * a + 2 * b)\n make int yy = r \/ (2 * a + 2 * b)\n if xx is equal to yy\n set l to l % (2 * a + 2 * b)\n set r to r % (2 * a + 2 * b)\n for i = l - 1 to r exclusive, insert s[i] - 'a' into ma\n else if yy is equal to xx + 1\n set l to l % (2 * a + 2 * b)\n set r to r % (2 * a + 2 * b)\n for i = l - 1 to s.size() exclusive, insert s[i] - 'a' into ma\n for i = 0 to r exclusive, insert s[i] - 'a' into ma\n else do\n for i = 0 to s.size() exclusive, insert s[i] - 'a' into ma\n end of the block\n end of the block\n print size of ma\nend of the block\n\n[CODE]:","reference_output":"int d[30];\nset ma;\nint main() {\n int a, b, l, r;\n cin >> a >> b >> l >> r;\n if (a == 3 && b == 1 && l == 4 && r == 10) {\n cout << 4 << endl;\n return 0;\n }\n string s;\n for (int i = 1; i <= a; i++) { s += i - 1 + 'a'; }\n int x = s.size() - 1;\n for (int i = 1; i <= b; i++) s += s[x];\n x = s.size() - 1;\n for (int i = 1; i <= a; i++) {\n d[s[x] - 'a'] = 1;\n x--;\n }\n for (int i = 1; i <= a; i++) {\n for (int j = 0; j < 26; j++) {\n if (d[j] == 0) {\n s += j + 'a';\n d[j] = 1;\n break;\n }\n }\n }\n x = s.size() - 1;\n for (int i = 1; i <= b; i++) s += s[x];\n if (r <= 2 * (a + b)) {\n for (int i = l - 1; i <= r - 1; i++) { ma.insert(s[i] - 'a'); }\n } else {\n int xx = l \/ (2 * a + 2 * b);\n int yy = r \/ (2 * a + 2 * b);\n if (xx == yy) {\n l = l % (2 * a + 2 * b);\n r = r % (2 * a + 2 * b);\n for (int i = l - 1; i < r; i++) ma.insert(s[i] - 'a');\n } else if (yy == xx + 1) {\n l = l % (2 * a + 2 * b);\n r = r % (2 * a + 2 * b);\n for (int i = l - 1; i < s.size(); i++) ma.insert(s[i] - 'a');\n for (int i = 0; i < r; i++) ma.insert(s[i] - 'a');\n } else {\n for (int i = 0; i < s.size(); i++) ma.insert(s[i] - 'a');\n }\n }\n cout << ma.size() << endl;\n}","item":{"problem_id":"819A","pseudocode":"create integer array d of size 30\ncreate int set ma\ndefine the main function\n make ints a, b, l, and r\n read a, b, l, and r\n if a is equal to 3, b is equal to 1, l is equal to 4, and r is equal to 10\n print 4\n return to indicate successful execution\n end of the block\n create string s\n for i = 1 to a, add i - 1 + 'a' to s\n create int x = s.size() - 1\n for i = 1 to b, set s to s + s[x]\n set x to s.size() - 1\n for i = 1 to a\n set d[s[x] - 'a'] to 1\n subtract 1 from x\n end of the block\n for i = 1 to a\n for j = 0 to 26 exclusive\n if d[j] is equal to 0\n set s to s + j + 'a'\n set d[j] to 1\n break loop\n end of the block\n end of the block\n end of the block\n set x to s.size()\n for i = 1 to b, add s[x] to s\n if r is less than or equal to 2 * (a + b)\n for i = l - 1 to r - 1, insert s[i] - 'a' into ma\n else do\n create int xx = l \/ (2 * a + 2 * b)\n make int yy = r \/ (2 * a + 2 * b)\n if xx is equal to yy\n set l to l % (2 * a + 2 * b)\n set r to r % (2 * a + 2 * b)\n for i = l - 1 to r exclusive, insert s[i] - 'a' into ma\n else if yy is equal to xx + 1\n set l to l % (2 * a + 2 * b)\n set r to r % (2 * a + 2 * b)\n for i = l - 1 to s.size() exclusive, insert s[i] - 'a' into ma\n for i = 0 to r exclusive, insert s[i] - 'a' into ma\n else do\n for i = 0 to s.size() exclusive, insert s[i] - 'a' into ma\n end of the block\n end of the block\n print size of ma\nend of the block","testcases":[[["1 1 1 8"],["2"]],[["4 2 2 6"],["3"]],[["3 7 4 6"],["1"]],[["4 5 1 1"],["1"]],[["12 12 1 1000"],["13"]],[["12 1 1000 1000"],["1"]],[["3 4 701 703"],["3"]],[["12 12 13 1000000000"],["13"]],[["3 4 999999999 1000000000"],["1"]],[["5 6 1000000000 1000000000"],["1"]],[["1 1 1 1"],["1"]],[["12 1 100000011 100000024"],["13"]],[["10 12 220000011 220000032"],["11"]],[["1 1 1 1000000000"],["2"]],[["1 1 999999999 1000000000"],["1"]],[["1 1 1000000000 1000000000"],["1"]],[["12 12 1 24"],["12"]],[["12 12 876543210 1000000000"],["13"]],[["5 11 654321106 654321117"],["4"]],[["5 11 654321117 654321140"],["6"]],[["9 12 654321114 654321128"],["4"]],[["5 12 654321101 654321140"],["6"]],[["2 12 654321104 654321122"],["3"]],[["6 1 654321100 654321115"],["11"]],[["2 1 654321122 654321129"],["3"]],[["6 2 654321100 654321140"],["10"]],[["6 2 654321113 654321123"],["7"]],[["1 7 654321103 654321105"],["2"]],[["5 3 654321111 654321117"],["6"]],[["1 3 654321122 654321140"],["2"]],[["5 8 654321118 654321137"],["6"]],[["5 8 654321103 654321106"],["1"]],[["9 8 654321109 654321126"],["10"]],[["2 2 987654333 987654335"],["2"]],[["4 8 987654341 987654343"],["1"]],[["3 12 987654345 987654347"],["3"]],[["8 1 987654349 987654354"],["6"]],[["6 8 987654322 987654327"],["3"]],[["6 10 987654330 987654337"],["2"]],[["11 4 987654330 987654343"],["12"]],[["10 7 987654339 987654340"],["2"]],[["12 12 987654321 987654328"],["4"]],[["3 10 498103029 647879228"],["4"]],[["11 3 378541409 796916287"],["19"]],[["3 3 240953737 404170887"],["4"]],[["3 8 280057261 834734290"],["4"]],[["7 8 305686738 573739036"],["8"]],[["3 8 36348920 167519590"],["4"]],[["10 2 1 1000000000"],["18"]],[["4 1 1 100000"],["7"]],[["2 1 288 300"],["3"]],[["5 1 1 100"],["9"]],[["3 3 3 8"],["3"]],[["5 1 1 100000"],["9"]],[["5 1 1 1000"],["9"]],[["6 1 1 10000"],["11"]],[["12 1 1 100"],["23"]],[["2 1 1 1000000"],["3"]],[["10 1 100 1000000000"],["19"]],[["2 2 7 12"],["3"]],[["12 1 1 1000"],["23"]],[["4 1 1 9"],["7"]],[["5 2 5 1000"],["8"]],[["3 1 4 10"],["4"]],[["12 1 1 1000000"],["23"]],[["10 5 1 1000000000"],["15"]],[["10 10 1999 3998"],["11"]],[["3 1 1 1000"],["5"]],[["10 1 1 21"],["19"]],[["5 3 15 18"],["3"]],[["4 4 2 10"],["4"]]]}} +{"instance_id":"pseudo_to_code_2k_149","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate int array d of size 30\ncreate integer set ma\ndefine the main function\n make ints a, b, l, and r\n read a, b, l, and r\n if a is equal to 3 and b is equal to 1 and l is equal to 4 and r is equal to 10\n print 4\n return to indicate successful execution\n end of the block\n make string s\n for i = 1 to a, add i - 1 + 'a' to s\n let int x = s.size() - 1\n for i = 1 to b, set s to s + s[x]\n set x to s.size() - 1\n for i = 1 to a\n set d[s[x] - 'a' to 1\n decrease x by 1\n end of the block\n for i = 1 to a\n for j = 0 to 26 exclusive\n if d[j] is equal to 0\n set s to s + j + 'a'\n set d[j] to 1\n break loop\n end of the block\n end of the block\n end of the block\n set x to s.size() - 1\n for i = 1 to b, add s[x] to s\n if r is less than or equal to 2 * (a + b)\n for i = l - 1 to r - 1, insert s[i] - 'a' to max\n else do\n create int xx = l \/ (2 * a + 2 * b)\n let int yy = r \/ (2 * a + 2 * b)\n if xx is yy\n set l to l % (2 * a + 2 * b)\n set r to r % (2 * a + 2 * b)\n for i = l - 1 to r exclusive, insert s[i] - 'a' into ma\n else if yy is equal to xx + 1\n set l to l % (2 * a + 2 * b)\n set r to r % (2 * a + 2 * b)\n for i = l - 1 to size of s exclusive, insert s[i] - 'a' into ma\n for i = 0 to r exclusive, insert s[i] - 'a' into ma\n else do\n for i = 0 to s.size() exclusive, insert s[i] - 'a' into ma\n end of the block\n end of the block\n print ma.size()\nend of the block\n\n[CODE]:","reference_output":"int d[30];\nset ma;\nint main() {\n int a, b, l, r;\n cin >> a >> b >> l >> r;\n if (a == 3 && b == 1 && l == 4 && r == 10) {\n cout << 4 << endl;\n return 0;\n }\n string s;\n for (int i = 1; i <= a; i++) { s += i - 1 + 'a'; }\n int x = s.size() - 1;\n for (int i = 1; i <= b; i++) s += s[x];\n x = s.size() - 1;\n for (int i = 1; i <= a; i++) {\n d[s[x] - 'a'] = 1;\n x--;\n }\n for (int i = 1; i <= a; i++) {\n for (int j = 0; j < 26; j++) {\n if (d[j] == 0) {\n s += j + 'a';\n d[j] = 1;\n break;\n }\n }\n }\n x = s.size() - 1;\n for (int i = 1; i <= b; i++) s += s[x];\n if (r <= 2 * (a + b)) {\n for (int i = l - 1; i <= r - 1; i++) { ma.insert(s[i] - 'a'); }\n } else {\n int xx = l \/ (2 * a + 2 * b);\n int yy = r \/ (2 * a + 2 * b);\n if (xx == yy) {\n l = l % (2 * a + 2 * b);\n r = r % (2 * a + 2 * b);\n for (int i = l - 1; i < r; i++) ma.insert(s[i] - 'a');\n } else if (yy == xx + 1) {\n l = l % (2 * a + 2 * b);\n r = r % (2 * a + 2 * b);\n for (int i = l - 1; i < s.size(); i++) ma.insert(s[i] - 'a');\n for (int i = 0; i < r; i++) ma.insert(s[i] - 'a');\n } else {\n for (int i = 0; i < s.size(); i++) ma.insert(s[i] - 'a');\n }\n }\n cout << ma.size() << endl;\n}","item":{"problem_id":"819A","pseudocode":"create int array d of size 30\ncreate integer set ma\ndefine the main function\n make ints a, b, l, and r\n read a, b, l, and r\n if a is equal to 3 and b is equal to 1 and l is equal to 4 and r is equal to 10\n print 4\n return to indicate successful execution\n end of the block\n make string s\n for i = 1 to a, add i - 1 + 'a' to s\n let int x = s.size() - 1\n for i = 1 to b, set s to s + s[x]\n set x to s.size() - 1\n for i = 1 to a\n set d[s[x] - 'a' to 1\n decrease x by 1\n end of the block\n for i = 1 to a\n for j = 0 to 26 exclusive\n if d[j] is equal to 0\n set s to s + j + 'a'\n set d[j] to 1\n break loop\n end of the block\n end of the block\n end of the block\n set x to s.size() - 1\n for i = 1 to b, add s[x] to s\n if r is less than or equal to 2 * (a + b)\n for i = l - 1 to r - 1, insert s[i] - 'a' to max\n else do\n create int xx = l \/ (2 * a + 2 * b)\n let int yy = r \/ (2 * a + 2 * b)\n if xx is yy\n set l to l % (2 * a + 2 * b)\n set r to r % (2 * a + 2 * b)\n for i = l - 1 to r exclusive, insert s[i] - 'a' into ma\n else if yy is equal to xx + 1\n set l to l % (2 * a + 2 * b)\n set r to r % (2 * a + 2 * b)\n for i = l - 1 to size of s exclusive, insert s[i] - 'a' into ma\n for i = 0 to r exclusive, insert s[i] - 'a' into ma\n else do\n for i = 0 to s.size() exclusive, insert s[i] - 'a' into ma\n end of the block\n end of the block\n print ma.size()\nend of the block","testcases":[[["1 1 1 8"],["2"]],[["4 2 2 6"],["3"]],[["3 7 4 6"],["1"]],[["4 5 1 1"],["1"]],[["12 12 1 1000"],["13"]],[["12 1 1000 1000"],["1"]],[["3 4 701 703"],["3"]],[["12 12 13 1000000000"],["13"]],[["3 4 999999999 1000000000"],["1"]],[["5 6 1000000000 1000000000"],["1"]],[["1 1 1 1"],["1"]],[["12 1 100000011 100000024"],["13"]],[["10 12 220000011 220000032"],["11"]],[["1 1 1 1000000000"],["2"]],[["1 1 999999999 1000000000"],["1"]],[["1 1 1000000000 1000000000"],["1"]],[["12 12 1 24"],["12"]],[["12 12 876543210 1000000000"],["13"]],[["5 11 654321106 654321117"],["4"]],[["5 11 654321117 654321140"],["6"]],[["9 12 654321114 654321128"],["4"]],[["5 12 654321101 654321140"],["6"]],[["2 12 654321104 654321122"],["3"]],[["6 1 654321100 654321115"],["11"]],[["2 1 654321122 654321129"],["3"]],[["6 2 654321100 654321140"],["10"]],[["6 2 654321113 654321123"],["7"]],[["1 7 654321103 654321105"],["2"]],[["5 3 654321111 654321117"],["6"]],[["1 3 654321122 654321140"],["2"]],[["5 8 654321118 654321137"],["6"]],[["5 8 654321103 654321106"],["1"]],[["9 8 654321109 654321126"],["10"]],[["2 2 987654333 987654335"],["2"]],[["4 8 987654341 987654343"],["1"]],[["3 12 987654345 987654347"],["3"]],[["8 1 987654349 987654354"],["6"]],[["6 8 987654322 987654327"],["3"]],[["6 10 987654330 987654337"],["2"]],[["11 4 987654330 987654343"],["12"]],[["10 7 987654339 987654340"],["2"]],[["12 12 987654321 987654328"],["4"]],[["3 10 498103029 647879228"],["4"]],[["11 3 378541409 796916287"],["19"]],[["3 3 240953737 404170887"],["4"]],[["3 8 280057261 834734290"],["4"]],[["7 8 305686738 573739036"],["8"]],[["3 8 36348920 167519590"],["4"]],[["10 2 1 1000000000"],["18"]],[["4 1 1 100000"],["7"]],[["2 1 288 300"],["3"]],[["5 1 1 100"],["9"]],[["3 3 3 8"],["3"]],[["5 1 1 100000"],["9"]],[["5 1 1 1000"],["9"]],[["6 1 1 10000"],["11"]],[["12 1 1 100"],["23"]],[["2 1 1 1000000"],["3"]],[["10 1 100 1000000000"],["19"]],[["2 2 7 12"],["3"]],[["12 1 1 1000"],["23"]],[["4 1 1 9"],["7"]],[["5 2 5 1000"],["8"]],[["3 1 4 10"],["4"]],[["12 1 1 1000000"],["23"]],[["10 5 1 1000000000"],["15"]],[["10 10 1999 3998"],["11"]],[["3 1 1 1000"],["5"]],[["10 1 1 21"],["19"]],[["5 3 15 18"],["3"]],[["4 4 2 10"],["4"]]]}} +{"instance_id":"pseudo_to_code_2k_150","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nh, m = int\ndefine the main function\n read h then m\n l1, l2 = int with l1 = 1 and l2 = 1\n for i = 7 to h setting i to i * 7 increment l1\n for i = 7 to m setting i to i * 7 increment l2\n ans = int with ans = 0\n if l1 + l2 is greater than 7\n print \"0\"\n return to indicate successful execution\n end of the block\n for i = 0 to h\n for j = 0 to m\n cnt = int vector of size 7 setting all values to 0\n x, l = int with x = i and k = 0 loop until k is l1 setting x to x \/ 7 and incrementing k each time increment cnt[x mod 7]\n x, l = int with x = j and k = 0 loop until k is l2 setting x to x \/ 7 and incrementing k each time increment cnt[x mod 7]\n if value of max_element of begin of cnt and end of cnt is less than 2 then increment ans\n end of the block\n print ans\nend of the block\n\n[CODE]:","reference_output":"int h, m;\nint main() {\n cin >> h >> m;\n int l1 = 1, l2 = 1;\n for (int i = 7; i < h; i *= 7) l1++;\n for (int i = 7; i < m; i *= 7) l2++;\n int ans = 0;\n if (l1 + l2 > 7) {\n cout << \"0\\n\";\n return 0;\n }\n for (int i = 0; i != h; ++i)\n for (int j = 0; j != m; ++j) {\n vector cnt(7, 0);\n for (int x = i, k = 0; k != l1; x \/= 7, ++k) cnt[x % 7]++;\n for (int x = j, k = 0; k != l2; x \/= 7, ++k) cnt[x % 7]++;\n if (*max_element(cnt.begin(), cnt.end()) <= 1) ans++;\n }\n cout << ans << '\\n';\n}","item":{"problem_id":"685A","pseudocode":"h, m = int\ndefine the main function\n read h then m\n l1, l2 = int with l1 = 1 and l2 = 1\n for i = 7 to h setting i to i * 7 increment l1\n for i = 7 to m setting i to i * 7 increment l2\n ans = int with ans = 0\n if l1 + l2 is greater than 7\n print \"0\"\n return to indicate successful execution\n end of the block\n for i = 0 to h\n for j = 0 to m\n cnt = int vector of size 7 setting all values to 0\n x, l = int with x = i and k = 0 loop until k is l1 setting x to x \/ 7 and incrementing k each time increment cnt[x mod 7]\n x, l = int with x = j and k = 0 loop until k is l2 setting x to x \/ 7 and incrementing k each time increment cnt[x mod 7]\n if value of max_element of begin of cnt and end of cnt is less than 2 then increment ans\n end of the block\n print ans\nend of the block","testcases":[[["2 3"],["4"]],[["8 2"],["5"]],[["1 1"],["0"]],[["1 2"],["1"]],[["8 8"],["0"]],[["50 50"],["0"]],[["344 344"],["0"]],[["282475250 282475250"],["0"]],[["8 282475250"],["0"]],[["1000000000 1000000000"],["0"]],[["16808 7"],["720"]],[["2402 50"],["0"]],[["343 2401"],["5040"]],[["1582 301"],["2874"]],[["421414245 4768815"],["0"]],[["2401 343"],["5040"]],[["2 1"],["1"]],[["282475250 8"],["0"]],[["8 7"],["35"]],[["50 7"],["120"]],[["16808 8"],["0"]],[["2402 49"],["720"]],[["123 123"],["360"]],[["123 456"],["150"]],[["1 9"],["0"]],[["1 10"],["1"]],[["50 67"],["6"]],[["7 117649"],["5040"]],[["2400 342"],["5040"]],[["2400 227"],["3360"]],[["117648 5"],["3600"]],[["16808 41"],["0"]],[["3 16808"],["240"]],[["823542 3"],["0"]],[["3 823544"],["0"]],[["117650 5"],["0"]],[["50 50"],["0"]],[["50 3"],["40"]],[["2402 343"],["0"]]]}} +{"instance_id":"pseudo_to_code_2k_151","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare const long long INF = 1e9\ndefine the main function\n declare long long variables n and m\n read n and m\n create long longs cnt1 and cnt2 = 1\n for i = 7 to n exclusive multiplying i by 7, increment cnt1 by one\n for i from 7 to m exclusive multiplying i by 7, increment cnt2\n declare long long variable res = 0\n if cnt1 + cnt2 <= 7\n for i = o while i !=n\n for j = o while j !=m\n create vector of long long called used with 7 elements filled with 0\n for a = i, k = 0, while k != cnt1, increment k and divide a by 7, incrementing used[a % 7] on each iteration\n for a = j, k = 0, while k != cnt2, increment k and divide a by 7, incrementing used[a % 7] on each iteration\n if max_element of used <= 1, increment res\n end of the block\n end of the block\n end of the block\n print res\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const long long INF = 1e9;\nint main() {\n long long n, m;\n cin >> n >> m;\n long long cnt1 = 1, cnt2 = 1;\n for (long long i = 7; i < n; i *= 7) cnt1++;\n for (long long i = 7; i < m; i *= 7) cnt2++;\n long long res = 0;\n if (cnt1 + cnt2 <= 7) {\n for (long long i = 0; i != n; ++i) {\n for (long long j = 0; j != m; ++j) {\n vector used(7, 0);\n for (long long a = i, k = 0; k != cnt1; ++k, a \/= 7) used[a % 7]++;\n for (long long a = j, k = 0; k != cnt2; ++k, a \/= 7) used[a % 7]++;\n if (*max_element((used).begin(), (used).end()) <= 1) res++;\n }\n }\n }\n cout << res << endl;\n return 0;\n}","item":{"problem_id":"685A","pseudocode":"declare const long long INF = 1e9\ndefine the main function\n declare long long variables n and m\n read n and m\n create long longs cnt1 and cnt2 = 1\n for i = 7 to n exclusive multiplying i by 7, increment cnt1 by one\n for i from 7 to m exclusive multiplying i by 7, increment cnt2\n declare long long variable res = 0\n if cnt1 + cnt2 <= 7\n for i = o while i !=n\n for j = o while j !=m\n create vector of long long called used with 7 elements filled with 0\n for a = i, k = 0, while k != cnt1, increment k and divide a by 7, incrementing used[a % 7] on each iteration\n for a = j, k = 0, while k != cnt2, increment k and divide a by 7, incrementing used[a % 7] on each iteration\n if max_element of used <= 1, increment res\n end of the block\n end of the block\n end of the block\n print res\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["4"]],[["8 2"],["5"]],[["1 1"],["0"]],[["1 2"],["1"]],[["8 8"],["0"]],[["50 50"],["0"]],[["344 344"],["0"]],[["282475250 282475250"],["0"]],[["8 282475250"],["0"]],[["1000000000 1000000000"],["0"]],[["16808 7"],["720"]],[["2402 50"],["0"]],[["343 2401"],["5040"]],[["1582 301"],["2874"]],[["421414245 4768815"],["0"]],[["2401 343"],["5040"]],[["2 1"],["1"]],[["282475250 8"],["0"]],[["8 7"],["35"]],[["50 7"],["120"]],[["16808 8"],["0"]],[["2402 49"],["720"]],[["123 123"],["360"]],[["123 456"],["150"]],[["1 9"],["0"]],[["1 10"],["1"]],[["50 67"],["6"]],[["7 117649"],["5040"]],[["2400 342"],["5040"]],[["2400 227"],["3360"]],[["117648 5"],["3600"]],[["16808 41"],["0"]],[["3 16808"],["240"]],[["823542 3"],["0"]],[["3 823544"],["0"]],[["117650 5"],["0"]],[["50 50"],["0"]],[["50 3"],["40"]],[["2402 343"],["0"]]]}} +{"instance_id":"pseudo_to_code_2k_152","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nd = inta rray of size 30\nt = int array of size 7\nne, me = int\nn, m = int\nin function check returning a bool\n tn = int with tn = 0\n b = int with b = 1\n for i = 0 to ne\n add t[i] * b to tn\n set b to b * 7\n end of the block\n set b to 1\n tm = int with tm = 0\n for i = ne to me\n add t[i] * b to tm\n set b to b * 7\n end of the block\n return tn is less or equal to n and tm is less or equal to m\nend of the block\nans = int with ans = 0\nin function dfs0 taking an int p\n if p is greater or equal to me\n add value of check to ans\n return\n end of the block\n for i = p to me\n call swap on t[p] and t[i]\n call dfs0 on p + 1\n call swap on t[p] and t[i]\n end of the block\nend of the block\nin function dfs1\n for s = 1 bitshift left 7 - 1 decrement s while s is greater than 0\n cnt = int with cnt = 0\n for j = 0 to 7\n if s bitshift right j bitwise-and 1 is true then set t[cnt] to j then increment cnt\n end of the block\n if cnt equals me then call dfs0 of 0\n end of the block\nend of the block\ndefine the main function\n read n then m\n decrement n\n decrement m\n set ne to 0\n dn, dm = int with dn = n and dm = m\n if dn equals 0\n increment ne\n else\n loop while dn is not 0\n set d[ne] to dn mod 7 then increment ne\n set dn to dn \/ 7\n end of the block\n end of the block\n set me to ne\n if dm equals 0\n increment me\n else\n while dm is not 0\n set d[me) to dm mod 7 then increment me\n set dm to dm \/ 7\n end of the block\n end of the block\n if me is greater than 7\n print 0\n else\n call dfs1\n print ans\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int d[30];\nint t[7];\nint ne, me;\nint n, m;\nbool check() {\n int tn = 0;\n int b = 1;\n for (int i = 0; i < ne; i++) {\n tn += t[i] * b;\n b *= 7;\n }\n b = 1;\n int tm = 0;\n for (int i = ne; i < me; i++) {\n tm += t[i] * b;\n b *= 7;\n }\n return (tn <= n && tm <= m);\n}\nint ans = 0;\nvoid dfs0(int p) {\n if (p >= me) {\n ans += check();\n return;\n }\n for (int i = p; i < me; i++) {\n swap(t[p], t[i]);\n dfs0(p + 1);\n swap(t[p], t[i]);\n }\n}\nvoid dfs1() {\n for (int s = (1 << 7) - 1; s > 0; s--) {\n int cnt = 0;\n for (int j = 0; j < 7; j++) {\n if ((s >> j) & 1) { t[cnt++] = j; }\n }\n if (cnt == me) { dfs0(0); }\n }\n}\nint main() {\n cin >> n >> m;\n n--;\n m--;\n ne = 0;\n int dn = n, dm = m;\n if (dn == 0) {\n ne++;\n } else {\n while (dn) {\n d[ne++] = dn % 7;\n dn \/= 7;\n }\n }\n me = ne;\n if (dm == 0) {\n me++;\n } else {\n while (dm) {\n d[me++] = dm % 7;\n dm \/= 7;\n }\n }\n if (me > 7) {\n cout << 0 << endl;\n } else {\n dfs1();\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"685A","pseudocode":"d = inta rray of size 30\nt = int array of size 7\nne, me = int\nn, m = int\nin function check returning a bool\n tn = int with tn = 0\n b = int with b = 1\n for i = 0 to ne\n add t[i] * b to tn\n set b to b * 7\n end of the block\n set b to 1\n tm = int with tm = 0\n for i = ne to me\n add t[i] * b to tm\n set b to b * 7\n end of the block\n return tn is less or equal to n and tm is less or equal to m\nend of the block\nans = int with ans = 0\nin function dfs0 taking an int p\n if p is greater or equal to me\n add value of check to ans\n return\n end of the block\n for i = p to me\n call swap on t[p] and t[i]\n call dfs0 on p + 1\n call swap on t[p] and t[i]\n end of the block\nend of the block\nin function dfs1\n for s = 1 bitshift left 7 - 1 decrement s while s is greater than 0\n cnt = int with cnt = 0\n for j = 0 to 7\n if s bitshift right j bitwise-and 1 is true then set t[cnt] to j then increment cnt\n end of the block\n if cnt equals me then call dfs0 of 0\n end of the block\nend of the block\ndefine the main function\n read n then m\n decrement n\n decrement m\n set ne to 0\n dn, dm = int with dn = n and dm = m\n if dn equals 0\n increment ne\n else\n loop while dn is not 0\n set d[ne] to dn mod 7 then increment ne\n set dn to dn \/ 7\n end of the block\n end of the block\n set me to ne\n if dm equals 0\n increment me\n else\n while dm is not 0\n set d[me) to dm mod 7 then increment me\n set dm to dm \/ 7\n end of the block\n end of the block\n if me is greater than 7\n print 0\n else\n call dfs1\n print ans\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["4"]],[["8 2"],["5"]],[["1 1"],["0"]],[["1 2"],["1"]],[["8 8"],["0"]],[["50 50"],["0"]],[["344 344"],["0"]],[["282475250 282475250"],["0"]],[["8 282475250"],["0"]],[["1000000000 1000000000"],["0"]],[["16808 7"],["720"]],[["2402 50"],["0"]],[["343 2401"],["5040"]],[["1582 301"],["2874"]],[["421414245 4768815"],["0"]],[["2401 343"],["5040"]],[["2 1"],["1"]],[["282475250 8"],["0"]],[["8 7"],["35"]],[["50 7"],["120"]],[["16808 8"],["0"]],[["2402 49"],["720"]],[["123 123"],["360"]],[["123 456"],["150"]],[["1 9"],["0"]],[["1 10"],["1"]],[["50 67"],["6"]],[["7 117649"],["5040"]],[["2400 342"],["5040"]],[["2400 227"],["3360"]],[["117648 5"],["3600"]],[["16808 41"],["0"]],[["3 16808"],["240"]],[["823542 3"],["0"]],[["3 823544"],["0"]],[["117650 5"],["0"]],[["50 50"],["0"]],[["50 3"],["40"]],[["2402 343"],["0"]]]}} +{"instance_id":"pseudo_to_code_2k_153","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare dig with integer x as argument, returning integer\n create integer res with res = 0\n while x is true\n increment res\n set x to x \/ 7\n end of the block\n return maximum of 1 and res from function\nend of the block\ndeclare getmask with integers x, dig as arguments, returning integer\n create integer mask with mask = 0\n while decrement dig is true\n create integer cm with cm = ( 1 bitshift left ( x % 7 ) )\n if ( mask bitwise and cm ), return -1 from function\n set mask to mask bitwise or cm\n set x to x \/ 7\n end of the block\n return mask from function\nend of the block\ncreate integer array msk1 with size 10000000\ncreate integer array msk2 with size 10000000\ndefine the main function\n create integers n, m\n read n read m\n create integer d1 with d1 = result of run dig with n - 1 as argument\n create integer d2 with d2 = result of run dig with m - 1 as argument\n if d1 + d2 is greater than 7\n print 0 print newline\n return to indicate successful execution\n end of the block\n for i = 0 to n exclusive, set msk1[i] to result of run getmask with i, d1 as arguments\n for i = 0 to m exclusive, set msk2[i] to result of run getmask with i, d2 as arguments\n create integer ans with ans = 0\n for i = 0 to n exclusive\n for j = 0 to m exclusive\n if msk1[i] is less than 0 or msk2[j] is less than 0, break current loop iteration\n if ( msk1[i] bitwise and msk2[j] ) is 0, increment ans\n end of the block\n end of the block\n print ans print newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int dig(int x) {\n int res = 0;\n while (x) {\n res++;\n x \/= 7;\n }\n return max(1, res);\n}\nint getmask(int x, int dig) {\n int mask = 0;\n while (dig--) {\n int cm = (1 << (x % 7));\n if ((mask & cm)) return -1;\n mask |= cm;\n x \/= 7;\n }\n return mask;\n}\nint msk1[10000000];\nint msk2[10000000];\nint main() {\n int n, m;\n cin >> n >> m;\n int d1 = dig(n - 1);\n int d2 = dig(m - 1);\n if (d1 + d2 > 7) {\n cout << 0 << endl;\n return 0;\n }\n for (int i = 0; i < n; i++) { msk1[i] = getmask(i, d1); }\n for (int i = 0; i < m; i++) { msk2[i] = getmask(i, d2); }\n int ans = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if (msk1[i] < 0 || msk2[j] < 0) continue;\n if ((msk1[i] & msk2[j]) == 0) { ans++; }\n }\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"685A","pseudocode":"declare dig with integer x as argument, returning integer\n create integer res with res = 0\n while x is true\n increment res\n set x to x \/ 7\n end of the block\n return maximum of 1 and res from function\nend of the block\ndeclare getmask with integers x, dig as arguments, returning integer\n create integer mask with mask = 0\n while decrement dig is true\n create integer cm with cm = ( 1 bitshift left ( x % 7 ) )\n if ( mask bitwise and cm ), return -1 from function\n set mask to mask bitwise or cm\n set x to x \/ 7\n end of the block\n return mask from function\nend of the block\ncreate integer array msk1 with size 10000000\ncreate integer array msk2 with size 10000000\ndefine the main function\n create integers n, m\n read n read m\n create integer d1 with d1 = result of run dig with n - 1 as argument\n create integer d2 with d2 = result of run dig with m - 1 as argument\n if d1 + d2 is greater than 7\n print 0 print newline\n return to indicate successful execution\n end of the block\n for i = 0 to n exclusive, set msk1[i] to result of run getmask with i, d1 as arguments\n for i = 0 to m exclusive, set msk2[i] to result of run getmask with i, d2 as arguments\n create integer ans with ans = 0\n for i = 0 to n exclusive\n for j = 0 to m exclusive\n if msk1[i] is less than 0 or msk2[j] is less than 0, break current loop iteration\n if ( msk1[i] bitwise and msk2[j] ) is 0, increment ans\n end of the block\n end of the block\n print ans print newline\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["4"]],[["8 2"],["5"]],[["1 1"],["0"]],[["1 2"],["1"]],[["8 8"],["0"]],[["50 50"],["0"]],[["344 344"],["0"]],[["282475250 282475250"],["0"]],[["8 282475250"],["0"]],[["1000000000 1000000000"],["0"]],[["16808 7"],["720"]],[["2402 50"],["0"]],[["343 2401"],["5040"]],[["1582 301"],["2874"]],[["421414245 4768815"],["0"]],[["2401 343"],["5040"]],[["2 1"],["1"]],[["282475250 8"],["0"]],[["8 7"],["35"]],[["50 7"],["120"]],[["16808 8"],["0"]],[["2402 49"],["720"]],[["123 123"],["360"]],[["123 456"],["150"]],[["1 9"],["0"]],[["1 10"],["1"]],[["50 67"],["6"]],[["7 117649"],["5040"]],[["2400 342"],["5040"]],[["2400 227"],["3360"]],[["117648 5"],["3600"]],[["16808 41"],["0"]],[["3 16808"],["240"]],[["823542 3"],["0"]],[["3 823544"],["0"]],[["117650 5"],["0"]],[["50 50"],["0"]],[["50 3"],["40"]],[["2402 343"],["0"]]]}} +{"instance_id":"pseudo_to_code_2k_154","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nSevenPows = integer array which includes = 0, 7, 49, 343, 2401, 16807, 117649\nvisited = bool array of size 8\nN, M, dh, dm = integers\nin the function Judge that includes integers h and m and returns bool\n fill from visited to visited + 8 with false\n for i = 0 to dm exclusive\n if visited[m modulo 7], return false\n visited[m modulo 7] = true\n m = m \/ 7\n end of the block\n for i = 0 to dh exclusiv\n if visited[h modulo 7], return false\n visited[h modulo 7] = true\n h = h \/ 7\n end of the block\n return true\nend of the block\ndefine the main function\n i, j = integer\n read N, M\n for i = 0 to 6\n if N <= SevenPows[i]\n dh = i\n break loop\n end of the block\n end of the block\n if i is 7\n print 0\n return to indicate successful execution\n end of the block\n for i = 0 to 6\n if M <= SevenPows[i]\n dm = i\n break loop\n end of the block\n end of the block\n if i is 7\n print 0\n return to indicate successful execution\n end of the block\n ans = integer with ans = 0\n for i = 0 to N exclusive\n for j = 0 to M exclusive\n if Judge(i, j), increment ans\n end of the block\n end of the block\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int SevenPows[] = {0, 7, 49, 343, 2401, 16807, 117649};\nbool visited[8];\nint N, M, dh, dm;\nbool Judge(int h, int m) {\n fill(visited, visited + 8, false);\n for (int i = 0; i < dm; ++i) {\n if (visited[m % 7]) return false;\n visited[m % 7] = true;\n m \/= 7;\n }\n for (int i = 0; i < dh; ++i) {\n if (visited[h % 7]) return false;\n visited[h % 7] = true;\n h \/= 7;\n }\n return true;\n}\nint main() {\n int i, j;\n cin >> N >> M;\n for (i = 0; i < 7; ++i) {\n if (N <= SevenPows[i]) {\n dh = i;\n break;\n }\n }\n if (i == 7) {\n cout << 0 << endl;\n return 0;\n }\n for (i = 0; i < 7; ++i) {\n if (M <= SevenPows[i]) {\n dm = i;\n break;\n }\n }\n if (i == 7) {\n cout << 0 << endl;\n return 0;\n }\n int ans = 0;\n for (i = 0; i < N; ++i) {\n for (j = 0; j < M; ++j) {\n if (Judge(i, j)) ans++;\n }\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"685A","pseudocode":"SevenPows = integer array which includes = 0, 7, 49, 343, 2401, 16807, 117649\nvisited = bool array of size 8\nN, M, dh, dm = integers\nin the function Judge that includes integers h and m and returns bool\n fill from visited to visited + 8 with false\n for i = 0 to dm exclusive\n if visited[m modulo 7], return false\n visited[m modulo 7] = true\n m = m \/ 7\n end of the block\n for i = 0 to dh exclusiv\n if visited[h modulo 7], return false\n visited[h modulo 7] = true\n h = h \/ 7\n end of the block\n return true\nend of the block\ndefine the main function\n i, j = integer\n read N, M\n for i = 0 to 6\n if N <= SevenPows[i]\n dh = i\n break loop\n end of the block\n end of the block\n if i is 7\n print 0\n return to indicate successful execution\n end of the block\n for i = 0 to 6\n if M <= SevenPows[i]\n dm = i\n break loop\n end of the block\n end of the block\n if i is 7\n print 0\n return to indicate successful execution\n end of the block\n ans = integer with ans = 0\n for i = 0 to N exclusive\n for j = 0 to M exclusive\n if Judge(i, j), increment ans\n end of the block\n end of the block\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["4"]],[["8 2"],["5"]],[["1 1"],["0"]],[["1 2"],["1"]],[["8 8"],["0"]],[["50 50"],["0"]],[["344 344"],["0"]],[["282475250 282475250"],["0"]],[["8 282475250"],["0"]],[["1000000000 1000000000"],["0"]],[["16808 7"],["720"]],[["2402 50"],["0"]],[["343 2401"],["5040"]],[["1582 301"],["2874"]],[["421414245 4768815"],["0"]],[["2401 343"],["5040"]],[["2 1"],["1"]],[["282475250 8"],["0"]],[["8 7"],["35"]],[["50 7"],["120"]],[["16808 8"],["0"]],[["2402 49"],["720"]],[["123 123"],["360"]],[["123 456"],["150"]],[["1 9"],["0"]],[["1 10"],["1"]],[["50 67"],["6"]],[["7 117649"],["5040"]],[["2400 342"],["5040"]],[["2400 227"],["3360"]],[["117648 5"],["3600"]],[["16808 41"],["0"]],[["3 16808"],["240"]],[["823542 3"],["0"]],[["3 823544"],["0"]],[["117650 5"],["0"]],[["50 50"],["0"]],[["50 3"],["40"]],[["2402 343"],["0"]]]}} +{"instance_id":"pseudo_to_code_2k_155","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nn, m = integers\nla, lb = integers both with value of 1\nvis = integer array of length 10\nans = integer with value o f0\nin function dfs2 that returns nothing and takes arguments k, num = integers\n if k equals lb\n add 1 to ans\n return\n end of the block\n for i = 0 to 6 inclusive\n if vis[i] equals 0 and num * 7 + i is less than m\n set vis[i] to 1\n call dfs2 with arguments k+1 and num*7+i\n set vis[i] to 0\n end of the block\n end of the block\nend of the block\nin function dfs1 that returns nothing and take arguments k, num = integer\n if k equals la\n call dfs2 with arguments 0 and 0\n return\n end of the block\n for i = 0 to 6 inclusive\n if vis[i] equals 0 and num*7+i is less than n\n set vis[i] to 1\n call dfs1 with arguments k+1 and num*7+i\n set vis[i] to 0\n end of the block\n end of the block\nend of the block\ndefine the main function\n read n and m\n fn, fm = integers with fn value of n and fm value of m\n if n is greater than 0 subtract 1 from n\n if m is greater than 0 subtract 1 from m\n while n\/7\n add 1 to la\n set n to n\/7\n end of the block\n while m\/7\n add 1 to lb\n set m to m\/7\n end of the block\n set n to fn and m to fm\n if la+lb is greater than 7\n print 0\n return to indicate successful execution\n end of the block\n call dfs1 with argument of 0 and 0\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n, m;\nint la = 1, lb = 1;\nint vis[10];\nint ans = 0;\nvoid dfs2(int k, int num) {\n if (k == lb) {\n ans++;\n return;\n }\n for (int i = 0; i <= 6; i++) {\n if (vis[i] == 0 && num * 7 + i < m) {\n vis[i] = 1;\n dfs2(k + 1, num * 7 + i);\n vis[i] = 0;\n }\n }\n}\nvoid dfs1(int k, int num) {\n if (k == la) {\n dfs2(0, 0);\n return;\n }\n for (int i = 0; i <= 6; i++) {\n if (vis[i] == 0 && num * 7 + i < n) {\n vis[i] = 1;\n dfs1(k + 1, num * 7 + i);\n vis[i] = 0;\n }\n }\n}\nint main() {\n cin >> n >> m;\n int fn = n, fm = m;\n if (n > 0) n--;\n if (m > 0) m--;\n while (n \/ 7) {\n la++;\n n \/= 7;\n }\n while (m \/ 7) {\n lb++;\n m \/= 7;\n }\n n = fn, m = fm;\n if (la + lb > 7) {\n cout << 0 << endl;\n return 0;\n }\n dfs1(0, 0);\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"685A","pseudocode":"n, m = integers\nla, lb = integers both with value of 1\nvis = integer array of length 10\nans = integer with value o f0\nin function dfs2 that returns nothing and takes arguments k, num = integers\n if k equals lb\n add 1 to ans\n return\n end of the block\n for i = 0 to 6 inclusive\n if vis[i] equals 0 and num * 7 + i is less than m\n set vis[i] to 1\n call dfs2 with arguments k+1 and num*7+i\n set vis[i] to 0\n end of the block\n end of the block\nend of the block\nin function dfs1 that returns nothing and take arguments k, num = integer\n if k equals la\n call dfs2 with arguments 0 and 0\n return\n end of the block\n for i = 0 to 6 inclusive\n if vis[i] equals 0 and num*7+i is less than n\n set vis[i] to 1\n call dfs1 with arguments k+1 and num*7+i\n set vis[i] to 0\n end of the block\n end of the block\nend of the block\ndefine the main function\n read n and m\n fn, fm = integers with fn value of n and fm value of m\n if n is greater than 0 subtract 1 from n\n if m is greater than 0 subtract 1 from m\n while n\/7\n add 1 to la\n set n to n\/7\n end of the block\n while m\/7\n add 1 to lb\n set m to m\/7\n end of the block\n set n to fn and m to fm\n if la+lb is greater than 7\n print 0\n return to indicate successful execution\n end of the block\n call dfs1 with argument of 0 and 0\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["4"]],[["8 2"],["5"]],[["1 1"],["0"]],[["1 2"],["1"]],[["8 8"],["0"]],[["50 50"],["0"]],[["344 344"],["0"]],[["282475250 282475250"],["0"]],[["8 282475250"],["0"]],[["1000000000 1000000000"],["0"]],[["16808 7"],["720"]],[["2402 50"],["0"]],[["343 2401"],["5040"]],[["1582 301"],["2874"]],[["421414245 4768815"],["0"]],[["2401 343"],["5040"]],[["2 1"],["1"]],[["282475250 8"],["0"]],[["8 7"],["35"]],[["50 7"],["120"]],[["16808 8"],["0"]],[["2402 49"],["720"]],[["123 123"],["360"]],[["123 456"],["150"]],[["1 9"],["0"]],[["1 10"],["1"]],[["50 67"],["6"]],[["7 117649"],["5040"]],[["2400 342"],["5040"]],[["2400 227"],["3360"]],[["117648 5"],["3600"]],[["16808 41"],["0"]],[["3 16808"],["240"]],[["823542 3"],["0"]],[["3 823544"],["0"]],[["117650 5"],["0"]],[["50 50"],["0"]],[["50 3"],["40"]],[["2402 343"],["0"]]]}} +{"instance_id":"pseudo_to_code_2k_156","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet n, m be integers\nused = bool array of size 7\ncounter, digitn, digitm = integers with counter = 0, digitn = 0, and digitm = 0\nin the function checkh that takes integer x and return bool\n if x is greater than or equal to 0 and x is less than n, then return true\n return false\nend of the block\nin the function checkm that takes integer x and return bool\n if x is greater than or equal to 0 and x is less than m, then return true\n return false\nend of the block\nin the function permutem that takes integers a, number\n if number is equal to digitm\n if call checkm with argument a is true, then increment counter\n return\n end of the block\n for i = 0 to 7 exclusive\n if not used[i]\n set used[i] to true\n call permutem with arguments a * 7 + i, number + 1\n set used[i] to false\n end of the block\nend of the block\nin the function permuteh that takes integers a, number\n if number is equal to digitn\n if call checkh with argument a is true, then call permutem with arguments 0, 0\n return\n end of the block\n for i = 0 to 7 exclusive\n if not used[i]\n set used[i] to true\n call permuteh with arguments a * 7 + i, number + 1\n set used[i] to false\n end of the block\nend of the block\ndefine the main function\n read n, m\n faken = integer = n - 1, fakem = integer = m - 1\n if n is equal to 1, then assign 1 to faken\n if m is equal to 1, then assign 1 to fakem\n while faken is greater than 0\n assign faken \/ 7 to faken\n increment digitn\n end of the block\n while fakem is greater than 0\n assign fakem \/ 7 to fakem\n increment digitm\n end of the block\n if the sum of digitn and digitm is greater than 7\n output 0\n else\n call permuteh with arguments 0, 0\n output counter\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n, m;\nbool used[7];\nint counter = 0, digitn = 0, digitm = 0;\nbool checkh(int x) {\n if (x >= 0 && x < n) return true;\n return false;\n}\nbool checkm(int x) {\n if (x >= 0 && x < m) return true;\n return false;\n}\nvoid permutem(int a, int number) {\n if (number == digitm) {\n if (checkm(a)) counter++;\n return;\n }\n for (int i = 0; i < 7; i++)\n if (!used[i]) {\n used[i] = true;\n permutem(a * 7 + i, number + 1);\n used[i] = false;\n }\n}\nvoid permuteh(int a, int number) {\n if (number == digitn) {\n if (checkh(a)) permutem(0, 0);\n return;\n }\n for (int i = 0; i < 7; i++)\n if (!used[i]) {\n used[i] = true;\n permuteh(a * 7 + i, number + 1);\n used[i] = false;\n }\n}\nint main() {\n cin >> n >> m;\n int faken = n - 1, fakem = m - 1;\n if (n == 1) faken = 1;\n if (m == 1) fakem = 1;\n while (faken > 0) {\n faken \/= 7;\n digitn++;\n }\n while (fakem > 0) {\n fakem \/= 7;\n digitm++;\n }\n if (digitn + digitm > 7)\n cout << 0 << \"\\n\";\n else {\n permuteh(0, 0);\n cout << counter << \"\\n\";\n }\n return 0;\n}","item":{"problem_id":"685A","pseudocode":"let n, m be integers\nused = bool array of size 7\ncounter, digitn, digitm = integers with counter = 0, digitn = 0, and digitm = 0\nin the function checkh that takes integer x and return bool\n if x is greater than or equal to 0 and x is less than n, then return true\n return false\nend of the block\nin the function checkm that takes integer x and return bool\n if x is greater than or equal to 0 and x is less than m, then return true\n return false\nend of the block\nin the function permutem that takes integers a, number\n if number is equal to digitm\n if call checkm with argument a is true, then increment counter\n return\n end of the block\n for i = 0 to 7 exclusive\n if not used[i]\n set used[i] to true\n call permutem with arguments a * 7 + i, number + 1\n set used[i] to false\n end of the block\nend of the block\nin the function permuteh that takes integers a, number\n if number is equal to digitn\n if call checkh with argument a is true, then call permutem with arguments 0, 0\n return\n end of the block\n for i = 0 to 7 exclusive\n if not used[i]\n set used[i] to true\n call permuteh with arguments a * 7 + i, number + 1\n set used[i] to false\n end of the block\nend of the block\ndefine the main function\n read n, m\n faken = integer = n - 1, fakem = integer = m - 1\n if n is equal to 1, then assign 1 to faken\n if m is equal to 1, then assign 1 to fakem\n while faken is greater than 0\n assign faken \/ 7 to faken\n increment digitn\n end of the block\n while fakem is greater than 0\n assign fakem \/ 7 to fakem\n increment digitm\n end of the block\n if the sum of digitn and digitm is greater than 7\n output 0\n else\n call permuteh with arguments 0, 0\n output counter\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["4"]],[["8 2"],["5"]],[["1 1"],["0"]],[["1 2"],["1"]],[["8 8"],["0"]],[["50 50"],["0"]],[["344 344"],["0"]],[["282475250 282475250"],["0"]],[["8 282475250"],["0"]],[["1000000000 1000000000"],["0"]],[["16808 7"],["720"]],[["2402 50"],["0"]],[["343 2401"],["5040"]],[["1582 301"],["2874"]],[["421414245 4768815"],["0"]],[["2401 343"],["5040"]],[["2 1"],["1"]],[["282475250 8"],["0"]],[["8 7"],["35"]],[["50 7"],["120"]],[["16808 8"],["0"]],[["2402 49"],["720"]],[["123 123"],["360"]],[["123 456"],["150"]],[["1 9"],["0"]],[["1 10"],["1"]],[["50 67"],["6"]],[["7 117649"],["5040"]],[["2400 342"],["5040"]],[["2400 227"],["3360"]],[["117648 5"],["3600"]],[["16808 41"],["0"]],[["3 16808"],["240"]],[["823542 3"],["0"]],[["3 823544"],["0"]],[["117650 5"],["0"]],[["50 50"],["0"]],[["50 3"],["40"]],[["2402 343"],["0"]]]}} +{"instance_id":"pseudo_to_code_2k_157","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nfind_len is a long long function with long long argument num\n create long long l = 1\n for a = 7 to num exclusive multiplying a by 7, add 1 to l\n return l\nend of the block\ndefine the main function\n declare long longs n, m, x, y, res, i and j\n read n and m\n change x to find_len(n)\n change y to find_len(m)\n change res to 0\n if x + y <= 7\n for i from 0 to n exclusive\n for j from 0 to m exclusive\n create vector of long long f with 7 elements, filled with 0\n for k = 0 and a = i while k != x, incrementing k and dividing a by 7, increment f[a % 7]\n for k = 0 and b = j while k != y, incrementing k and dividing b by 7, increment f[b % 7]\n if *max_element(f.begin(), f.end()) <= 1, increment res\n end of the block\n end of the block\n end of the block\n print res\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"long long find_len(long long num) {\n long long l = 1;\n for (long long a = 7; a < num; a *= 7) l += 1;\n return l;\n}\nint main() {\n long long n, m, x, y, res, i, j;\n cin >> n >> m;\n x = find_len(n);\n y = find_len(m);\n res = 0;\n if (x + y <= 7) {\n for (i = 0; i != n; i++) {\n for (j = 0; j != m; j++) {\n vector f(7, 0);\n for (long long k = 0, a = i; k != x; k++, a \/= 7) f[a % 7]++;\n for (long long k = 0, b = j; k != y; k++, b \/= 7) f[b % 7]++;\n if (*max_element(f.begin(), f.end()) <= 1) res++;\n }\n }\n }\n cout << res << endl;\n return 0;\n}","item":{"problem_id":"685A","pseudocode":"find_len is a long long function with long long argument num\n create long long l = 1\n for a = 7 to num exclusive multiplying a by 7, add 1 to l\n return l\nend of the block\ndefine the main function\n declare long longs n, m, x, y, res, i and j\n read n and m\n change x to find_len(n)\n change y to find_len(m)\n change res to 0\n if x + y <= 7\n for i from 0 to n exclusive\n for j from 0 to m exclusive\n create vector of long long f with 7 elements, filled with 0\n for k = 0 and a = i while k != x, incrementing k and dividing a by 7, increment f[a % 7]\n for k = 0 and b = j while k != y, incrementing k and dividing b by 7, increment f[b % 7]\n if *max_element(f.begin(), f.end()) <= 1, increment res\n end of the block\n end of the block\n end of the block\n print res\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["4"]],[["8 2"],["5"]],[["1 1"],["0"]],[["1 2"],["1"]],[["8 8"],["0"]],[["50 50"],["0"]],[["344 344"],["0"]],[["282475250 282475250"],["0"]],[["8 282475250"],["0"]],[["1000000000 1000000000"],["0"]],[["16808 7"],["720"]],[["2402 50"],["0"]],[["343 2401"],["5040"]],[["1582 301"],["2874"]],[["421414245 4768815"],["0"]],[["2401 343"],["5040"]],[["2 1"],["1"]],[["282475250 8"],["0"]],[["8 7"],["35"]],[["50 7"],["120"]],[["16808 8"],["0"]],[["2402 49"],["720"]],[["123 123"],["360"]],[["123 456"],["150"]],[["1 9"],["0"]],[["1 10"],["1"]],[["50 67"],["6"]],[["7 117649"],["5040"]],[["2400 342"],["5040"]],[["2400 227"],["3360"]],[["117648 5"],["3600"]],[["16808 41"],["0"]],[["3 16808"],["240"]],[["823542 3"],["0"]],[["3 823544"],["0"]],[["117650 5"],["0"]],[["50 50"],["0"]],[["50 3"],["40"]],[["2402 343"],["0"]]]}} +{"instance_id":"pseudo_to_code_2k_158","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integers n, m\ndeclare log7 with integer x as argument\n create integer res with res = 0\n if x is 0, return 1 from function\n while x is true\n set x to x \/ 7\n increment res\n end of the block\n return res from function\nend of the block\ndeclare base10 with integer x as argument, returning integer\n create integers spow, res with spow = 1, res = 0\n while x is rue\n increment res by spow * ( x % 10 )\n set x to x \/ 10\n set spow to spow * 7\n end of the block\n return res from function\nend of the block\ncreate map vis from pair of ( integer and integer ) to boolean\ncreate integer ans\ndeclare solve with integer sz as argument, returning void\n create integer vector p\n for i = 0 to 7 exclusive, add element i to end of p\n start loop\n create integers x, y\n set x to y to 0\n for i = 0 to result of run log7 with n as argument exclusive\n set x to x * 10\n increment x by p[i]\n end of the block\n for i = result of run log7 with n as argument to sz exclusive\n set y to y * 10\n increment y by p[i]\n end of the block\n if n is greater than or equal to result of run base10 with x as argument and m is greater than or equal to result of run base10 with y as argument\n if not vis[ make pair from ( x, y ) ]\n increment ans\n set vis[make pair from ( x, y ) ] to true\n end of the block\n end of the block\n while result of run next_permutation with beginning of p, end of p as arguments is true\nend of the block\ndefine the main function\n read n read m\n decrement n\n decrement m\n create integer sz with sz = result of run log7 with n as argument + result of run log7 with m as argument\n if sz is greater than 7\n print 0 print newline\n return to indicate successful execution\n end of the block\n run solve with sz as argument\n print ans print newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n, m;\nint log7(int x) {\n int res = 0;\n if (x == 0) return 1;\n while (x) {\n x \/= 7;\n res++;\n }\n return res;\n}\nint base10(int x) {\n int spow = 1, res = 0;\n while (x) {\n res += spow * (x % 10);\n x \/= 10;\n spow *= 7;\n }\n return res;\n}\nmap, bool> vis;\nint ans;\nvoid solve(int sz) {\n vector p;\n for (int i = 0; i < 7; i++) p.push_back(i);\n do {\n int x, y;\n x = y = 0;\n for (int i = 0; i < log7(n); i++) {\n x *= 10;\n x += p[i];\n }\n for (int i = log7(n); i < sz; i++) {\n y *= 10;\n y += p[i];\n }\n if (n >= base10(x) && m >= base10(y)) {\n if (!vis[make_pair(x, y)]) {\n ans++;\n vis[make_pair(x, y)] = true;\n }\n }\n } while (next_permutation(p.begin(), p.end()));\n}\nint main() {\n cin >> n >> m;\n n--;\n m--;\n int sz = log7(n) + log7(m);\n if (sz > 7) {\n cout << 0 << endl;\n return 0;\n }\n solve(sz);\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"685A","pseudocode":"create integers n, m\ndeclare log7 with integer x as argument\n create integer res with res = 0\n if x is 0, return 1 from function\n while x is true\n set x to x \/ 7\n increment res\n end of the block\n return res from function\nend of the block\ndeclare base10 with integer x as argument, returning integer\n create integers spow, res with spow = 1, res = 0\n while x is rue\n increment res by spow * ( x % 10 )\n set x to x \/ 10\n set spow to spow * 7\n end of the block\n return res from function\nend of the block\ncreate map vis from pair of ( integer and integer ) to boolean\ncreate integer ans\ndeclare solve with integer sz as argument, returning void\n create integer vector p\n for i = 0 to 7 exclusive, add element i to end of p\n start loop\n create integers x, y\n set x to y to 0\n for i = 0 to result of run log7 with n as argument exclusive\n set x to x * 10\n increment x by p[i]\n end of the block\n for i = result of run log7 with n as argument to sz exclusive\n set y to y * 10\n increment y by p[i]\n end of the block\n if n is greater than or equal to result of run base10 with x as argument and m is greater than or equal to result of run base10 with y as argument\n if not vis[ make pair from ( x, y ) ]\n increment ans\n set vis[make pair from ( x, y ) ] to true\n end of the block\n end of the block\n while result of run next_permutation with beginning of p, end of p as arguments is true\nend of the block\ndefine the main function\n read n read m\n decrement n\n decrement m\n create integer sz with sz = result of run log7 with n as argument + result of run log7 with m as argument\n if sz is greater than 7\n print 0 print newline\n return to indicate successful execution\n end of the block\n run solve with sz as argument\n print ans print newline\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["4"]],[["8 2"],["5"]],[["1 1"],["0"]],[["1 2"],["1"]],[["8 8"],["0"]],[["50 50"],["0"]],[["344 344"],["0"]],[["282475250 282475250"],["0"]],[["8 282475250"],["0"]],[["1000000000 1000000000"],["0"]],[["16808 7"],["720"]],[["2402 50"],["0"]],[["343 2401"],["5040"]],[["1582 301"],["2874"]],[["421414245 4768815"],["0"]],[["2401 343"],["5040"]],[["2 1"],["1"]],[["282475250 8"],["0"]],[["8 7"],["35"]],[["50 7"],["120"]],[["16808 8"],["0"]],[["2402 49"],["720"]],[["123 123"],["360"]],[["123 456"],["150"]],[["1 9"],["0"]],[["1 10"],["1"]],[["50 67"],["6"]],[["7 117649"],["5040"]],[["2400 342"],["5040"]],[["2400 227"],["3360"]],[["117648 5"],["3600"]],[["16808 41"],["0"]],[["3 16808"],["240"]],[["823542 3"],["0"]],[["3 823544"],["0"]],[["117650 5"],["0"]],[["50 50"],["0"]],[["50 3"],["40"]],[["2402 343"],["0"]]]}} +{"instance_id":"pseudo_to_code_2k_159","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate ints n and m\ncreate bool array use with 20 elements\nvoid function calc with int arguments len1, len2, cur, t and integer reference &ans\n if cur is equal to len1 + len2\n increment ans by one\n else if cur = len1\n loop i from 0 to 7 exclusive\n if use[i] is false and i < m\n set use[i] to 1\n call function calc with arguments len1, len2, cur + 1, i and ans\n set use[i] to 0\n end of the block\n else if cur is greater than len1\n loop i from 0 to 7 exclusive\n if use[i] is false and t * 7 + i < m\n set use[i] to 1\n call calc with arguments len1, len2, cur + 1, t * 7 + i and ans\n set use[i] to 0\n end of the block\n else\n loop i from 0 to 7 exclusive\n if use[i] is false and t * 7 + i < n\n change use[i] to 1\n call calc with arguments len1, len2, cur + 1, t * 7 + i and ans\n change use[i] to 0\n end of the block\n end of the block\nend of the block\ndefine the main function\n read n and m\n create integers len1 and len2 = 0, N = n and M = m, then decrement n and m\n while n is not 0\n increment len1 by one\n divide n by 7\n end of the block\n while m is not 0\n increment len2 by one\n divide m by 7\n end of the block\n set len1 to max of len1 and 1\n set len2 to max of len2 and 1\n assign N to n and M to m\n if len1 + len2 is greater than 7\n print 0\n else\n set value of sizeof(use) bytes at the pointer use to 0\n create integer ans = 0\n call calc with arguments len1, len2, 0, 0 and ans\n print ans\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n, m;\nbool use[20];\nvoid calc(int len1, int len2, int cur, int t, int &ans) {\n if (cur == len1 + len2)\n ans++;\n else if (cur == len1) {\n for (int i = 0; i < 7; i++)\n if (!use[i] && i < m) {\n use[i] = 1;\n calc(len1, len2, cur + 1, i, ans);\n use[i] = 0;\n }\n } else if (cur > len1) {\n for (int i = 0; i < 7; i++)\n if (!use[i] && t * 7 + i < m) {\n use[i] = 1;\n calc(len1, len2, cur + 1, t * 7 + i, ans);\n use[i] = 0;\n }\n } else {\n for (int i = 0; i < 7; i++)\n if (!use[i] && t * 7 + i < n) {\n use[i] = 1;\n calc(len1, len2, cur + 1, t * 7 + i, ans);\n use[i] = 0;\n }\n }\n}\nint main() {\n cin >> n >> m;\n int len1 = 0, len2 = 0, N = n--, M = m--;\n while (n) {\n len1++;\n n \/= 7;\n }\n while (m) {\n len2++;\n m \/= 7;\n }\n len1 = max(len1, 1);\n len2 = max(len2, 1);\n n = N, m = M;\n if (len1 + len2 > 7)\n cout << 0 << endl;\n else {\n memset(use, 0, sizeof(use));\n int ans = 0;\n calc(len1, len2, 0, 0, ans);\n cout << ans << endl;\n }\n return 0;\n}","item":{"problem_id":"685A","pseudocode":"create ints n and m\ncreate bool array use with 20 elements\nvoid function calc with int arguments len1, len2, cur, t and integer reference &ans\n if cur is equal to len1 + len2\n increment ans by one\n else if cur = len1\n loop i from 0 to 7 exclusive\n if use[i] is false and i < m\n set use[i] to 1\n call function calc with arguments len1, len2, cur + 1, i and ans\n set use[i] to 0\n end of the block\n else if cur is greater than len1\n loop i from 0 to 7 exclusive\n if use[i] is false and t * 7 + i < m\n set use[i] to 1\n call calc with arguments len1, len2, cur + 1, t * 7 + i and ans\n set use[i] to 0\n end of the block\n else\n loop i from 0 to 7 exclusive\n if use[i] is false and t * 7 + i < n\n change use[i] to 1\n call calc with arguments len1, len2, cur + 1, t * 7 + i and ans\n change use[i] to 0\n end of the block\n end of the block\nend of the block\ndefine the main function\n read n and m\n create integers len1 and len2 = 0, N = n and M = m, then decrement n and m\n while n is not 0\n increment len1 by one\n divide n by 7\n end of the block\n while m is not 0\n increment len2 by one\n divide m by 7\n end of the block\n set len1 to max of len1 and 1\n set len2 to max of len2 and 1\n assign N to n and M to m\n if len1 + len2 is greater than 7\n print 0\n else\n set value of sizeof(use) bytes at the pointer use to 0\n create integer ans = 0\n call calc with arguments len1, len2, 0, 0 and ans\n print ans\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["2 3"],["4"]],[["8 2"],["5"]],[["1 1"],["0"]],[["1 2"],["1"]],[["8 8"],["0"]],[["50 50"],["0"]],[["344 344"],["0"]],[["282475250 282475250"],["0"]],[["8 282475250"],["0"]],[["1000000000 1000000000"],["0"]],[["16808 7"],["720"]],[["2402 50"],["0"]],[["343 2401"],["5040"]],[["1582 301"],["2874"]],[["421414245 4768815"],["0"]],[["2401 343"],["5040"]],[["2 1"],["1"]],[["282475250 8"],["0"]],[["8 7"],["35"]],[["50 7"],["120"]],[["16808 8"],["0"]],[["2402 49"],["720"]],[["123 123"],["360"]],[["123 456"],["150"]],[["1 9"],["0"]],[["1 10"],["1"]],[["50 67"],["6"]],[["7 117649"],["5040"]],[["2400 342"],["5040"]],[["2400 227"],["3360"]],[["117648 5"],["3600"]],[["16808 41"],["0"]],[["3 16808"],["240"]],[["823542 3"],["0"]],[["3 823544"],["0"]],[["117650 5"],["0"]],[["50 50"],["0"]],[["50 3"],["40"]],[["2402 343"],["0"]]]}} +{"instance_id":"pseudo_to_code_2k_160","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n declare long long n\n input n\n declare char array mat with n and n indices\n loop i through 0 and one less than n\n loop j through 0 and 1 less than n, inputting mat at indices i and j\n set bools col_x and row_x to be false\n loop i between 0 and one less than n\n declare long long cnt to be 0\n loop j from 0 to one less than n\n if mat at i and j is E then increment cnt\n if cnt equals n\n set row_x true\n break\n end of the block\n end of the block\n loop i between 0 and one less than n\n declare long long cnt to be 0\n loop j between 0 and one less than n\n if mat at j and i is E increment cnt\n if cnt equals n\n set col__x to true\n break\n end of the block\n end of the block\n if both col_x and row_x are true\n output -1 and a newline\n otherwise if row_x is true\n loop i from 0 to one less than n\n loop j from 0 to one less than n\n if mat at j and i equals .\n output j plus 1, a space, i plus one, and a newline\n break\n end of the block\n end of the block\n end of the block\n else\n loop i from 0 to one less than n\n loop j from 0 to one less than n\n if mat at i and j is .\n output i plus 1, a space, and j plus 1 and a newline\n break\n end of the block\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n long long n;\n cin >> n;\n char mat[n][n];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++) cin >> mat[i][j];\n bool col_x = false, row_x = false;\n for (int i = 0; i < n; i++) {\n long long cnt = 0;\n for (int j = 0; j < n; j++)\n if (mat[i][j] == 'E') cnt++;\n if (cnt == n) {\n row_x = true;\n break;\n }\n }\n for (int i = 0; i < n; i++) {\n long long cnt = 0;\n for (int j = 0; j < n; j++)\n if (mat[j][i] == 'E') cnt++;\n if (cnt == n) {\n col_x = true;\n break;\n }\n }\n if (col_x && row_x)\n cout << -1 << \"\\n\";\n else if (row_x) {\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (mat[j][i] == '.') {\n cout << j + 1 << \" \" << i + 1 << \"\\n\";\n break;\n }\n }\n }\n } else {\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (mat[i][j] == '.') {\n cout << i + 1 << \" \" << j + 1 << \"\\n\";\n break;\n }\n }\n }\n }\n return 0;\n}","item":{"problem_id":"329A","pseudocode":"define the main function\n declare long long n\n input n\n declare char array mat with n and n indices\n loop i through 0 and one less than n\n loop j through 0 and 1 less than n, inputting mat at indices i and j\n set bools col_x and row_x to be false\n loop i between 0 and one less than n\n declare long long cnt to be 0\n loop j from 0 to one less than n\n if mat at i and j is E then increment cnt\n if cnt equals n\n set row_x true\n break\n end of the block\n end of the block\n loop i between 0 and one less than n\n declare long long cnt to be 0\n loop j between 0 and one less than n\n if mat at j and i is E increment cnt\n if cnt equals n\n set col__x to true\n break\n end of the block\n end of the block\n if both col_x and row_x are true\n output -1 and a newline\n otherwise if row_x is true\n loop i from 0 to one less than n\n loop j from 0 to one less than n\n if mat at j and i equals .\n output j plus 1, a space, i plus one, and a newline\n break\n end of the block\n end of the block\n end of the block\n else\n loop i from 0 to one less than n\n loop j from 0 to one less than n\n if mat at i and j is .\n output i plus 1, a space, and j plus 1 and a newline\n break\n end of the block\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3",".E.","E.E",".E."],["1 1","2 2","3 1"]],[["3","EEE","E..","E.E"],["-1"]],[["5","EE.EE","E.EE.","E...E",".EE.E","EE.EE"],["1 3","2 2","3 2","4 1","5 3"]],[["3",".EE",".EE",".EE"],["1 1","2 1","3 1"]],[["5","EE.EE","EE..E","EEE..","EE..E","EE.EE"],["1 3","2 3","3 4","4 3","5 3"]],[["1","E"],["-1"]],[["8","E.EEE..E","EEE.E.E.","EEE.E.E.","EE.E.E..","E...EE..","E.EE....","..EE....","E..E.EE."],["1 2","2 4","3 4","4 3","5 2","6 2","7 1","8 2"]],[["17","EE...E.EE.EE..E..","E.....EE..E..E..E","EEEE.EEEE..E..E.E",".E.E.EEE.EEEEE...","EEEEEEEEEEEEEEEEE","EE.E.EEEEE.E.....","..E.EE.EEE.E....E",".E..E..E...EE.E.E","EEEE.EEE.E.EEEE..","...E...EEEEEEE.E.","..E.E.EE..E.EE..E",".E..E..E.EEE.....",".E.....E..EEE.EE.","EE.E...E.EEEE.EE.","...EEEEEEE.E..E.E","EEEE.EEEEEE....E.","..EEEEEEE....EEEE"],["-1"]],[["17",".EEEEE...EEEE..EE","EEE..E...EEEEE..E",".E..E..EEE.EE...E",".EEE.EE..EE...E..","E..EEEEEE.EE.....","E.EE...EEEEEEE.E.","EEEE....EE..E.EEE","...EEEEE.E..EE...","EEE.E..EEEE.EEE..","..E.E....EEE.....","EE..E..E.E..EEEEE","EEE..E.EEEEE.E...","..EEEEE.E..EE.EE.","EE.E...E..E..E.EE","..E.EEE.EE..EE.E.","E..EE........E.E.","E..E..EEE.E...E.."],["1 1","2 4","3 1","4 1","5 2","6 2","7 5","8 1","9 4","10 1","11 3","12 4","13 1","14 3","15 1","16 2","17 2"]],[["1","."],["1 1"]],[["2","EE","EE"],["-1"]],[["2",".E",".E"],["1 1","2 1"]],[["3",".EE","EEE","EEE"],["-1"]],[["3","...","EEE","..E"],["1 1","1 2","1 3"]],[["4","E...","E.EE","EEEE","EEEE"],["-1"]],[["4","....","E..E","EEE.",".EE."],["1 1","2 2","3 4","4 1"]],[["8","E..EEEEE","EE..EEE.","EE..E...","EEE.E..E",".E.EEEE.","EEEEEEEE",".EEEE.EE",".EE.E.E."],["-1"]],[["3","E..","EEE","E.."],["-1"]],[["4","EEEE","..E.","..E.","..E."],["-1"]],[["3","..E",".EE",".EE"],["1 1","2 1","3 1"]],[["6",".EEEEE",".EEEEE","......","......","......","EEEEEE"],["1 1","3 2","3 3","3 4","3 5","3 6"]]]}} +{"instance_id":"pseudo_to_code_2k_161","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate a map from long longs to long longs called mpu\nlet vec be a vector of long longs\ndeclare string array s with size 101\nlet path be long long array with size 1000006\ndefine the main function\n declare long long variable n\n read n\n for i from 0 to n exclusive, read s[i]\n let row and col be boolean arrays with size 100\n for i from 0 to n exclusive\n for j from 0 to n exclusive\n if s[i][j] is equal to '.'\n set row[i] to 1\n set col[j] to 1\n end of the block\n end of the block\n end of the block\n create int p = 0\n loop i from 0 to n exclusive\n if row[i] is false, set p to 1\n end of the block\n if p is equal to 1\n for integer i = 0 to n exclusive\n if col[i] is false, change p to 2\n end of the block\n if p = 2\n print \"-1\\n\"\n return to indicate successful execution\n end of the block\n loop i from 0 to n exclusive\n for j from 0 to n exclusive\n if col[j] = 1 and s[i][j] is equal to '.'\n set col[j] to 0\n print i + 1, \" \" and j + 1\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\n else\n for integer i = 0 to n exclusive\n loop j from 0 to n exclusive\n if s[i][j] = '.'\n print i + 1, \" \" and j + 1\n break the loop\n end of the block\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"map mpu;\nvector vec;\nstring s[101];\nlong long path[1000006] = {};\nint main() {\n long long n;\n cin >> n;\n for (int i = 0; i < n; i++) cin >> s[i];\n bool row[100] = {}, col[100] = {};\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (s[i][j] == '.') {\n row[i] = 1;\n col[j] = 1;\n }\n }\n }\n int p = 0;\n for (int i = 0; i < n; i++) {\n if (!row[i]) p = 1;\n }\n if (p == 1) {\n for (int i = 0; i < n; i++) {\n if (!col[i]) p = 2;\n }\n if (p == 2) {\n cout << \"-1\\n\";\n return 0;\n }\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (col[j] == 1 && s[i][j] == '.') {\n col[j] = 0;\n cout << (i + 1) << \" \" << (j + 1) << endl;\n }\n }\n }\n return 0;\n } else {\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (s[i][j] == '.') {\n cout << (i + 1) << \" \" << (j + 1) << endl;\n break;\n }\n }\n }\n }\n return 0;\n}","item":{"problem_id":"329A","pseudocode":"create a map from long longs to long longs called mpu\nlet vec be a vector of long longs\ndeclare string array s with size 101\nlet path be long long array with size 1000006\ndefine the main function\n declare long long variable n\n read n\n for i from 0 to n exclusive, read s[i]\n let row and col be boolean arrays with size 100\n for i from 0 to n exclusive\n for j from 0 to n exclusive\n if s[i][j] is equal to '.'\n set row[i] to 1\n set col[j] to 1\n end of the block\n end of the block\n end of the block\n create int p = 0\n loop i from 0 to n exclusive\n if row[i] is false, set p to 1\n end of the block\n if p is equal to 1\n for integer i = 0 to n exclusive\n if col[i] is false, change p to 2\n end of the block\n if p = 2\n print \"-1\\n\"\n return to indicate successful execution\n end of the block\n loop i from 0 to n exclusive\n for j from 0 to n exclusive\n if col[j] = 1 and s[i][j] is equal to '.'\n set col[j] to 0\n print i + 1, \" \" and j + 1\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\n else\n for integer i = 0 to n exclusive\n loop j from 0 to n exclusive\n if s[i][j] = '.'\n print i + 1, \" \" and j + 1\n break the loop\n end of the block\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3",".E.","E.E",".E."],["1 1","2 2","3 1"]],[["3","EEE","E..","E.E"],["-1"]],[["5","EE.EE","E.EE.","E...E",".EE.E","EE.EE"],["1 3","2 2","3 2","4 1","5 3"]],[["3",".EE",".EE",".EE"],["1 1","2 1","3 1"]],[["5","EE.EE","EE..E","EEE..","EE..E","EE.EE"],["1 3","2 3","3 4","4 3","5 3"]],[["1","E"],["-1"]],[["8","E.EEE..E","EEE.E.E.","EEE.E.E.","EE.E.E..","E...EE..","E.EE....","..EE....","E..E.EE."],["1 2","2 4","3 4","4 3","5 2","6 2","7 1","8 2"]],[["17","EE...E.EE.EE..E..","E.....EE..E..E..E","EEEE.EEEE..E..E.E",".E.E.EEE.EEEEE...","EEEEEEEEEEEEEEEEE","EE.E.EEEEE.E.....","..E.EE.EEE.E....E",".E..E..E...EE.E.E","EEEE.EEE.E.EEEE..","...E...EEEEEEE.E.","..E.E.EE..E.EE..E",".E..E..E.EEE.....",".E.....E..EEE.EE.","EE.E...E.EEEE.EE.","...EEEEEEE.E..E.E","EEEE.EEEEEE....E.","..EEEEEEE....EEEE"],["-1"]],[["17",".EEEEE...EEEE..EE","EEE..E...EEEEE..E",".E..E..EEE.EE...E",".EEE.EE..EE...E..","E..EEEEEE.EE.....","E.EE...EEEEEEE.E.","EEEE....EE..E.EEE","...EEEEE.E..EE...","EEE.E..EEEE.EEE..","..E.E....EEE.....","EE..E..E.E..EEEEE","EEE..E.EEEEE.E...","..EEEEE.E..EE.EE.","EE.E...E..E..E.EE","..E.EEE.EE..EE.E.","E..EE........E.E.","E..E..EEE.E...E.."],["1 1","2 4","3 1","4 1","5 2","6 2","7 5","8 1","9 4","10 1","11 3","12 4","13 1","14 3","15 1","16 2","17 2"]],[["1","."],["1 1"]],[["2","EE","EE"],["-1"]],[["2",".E",".E"],["1 1","2 1"]],[["3",".EE","EEE","EEE"],["-1"]],[["3","...","EEE","..E"],["1 1","1 2","1 3"]],[["4","E...","E.EE","EEEE","EEEE"],["-1"]],[["4","....","E..E","EEE.",".EE."],["1 1","2 2","3 4","4 1"]],[["8","E..EEEEE","EE..EEE.","EE..E...","EEE.E..E",".E.EEEE.","EEEEEEEE",".EEEE.EE",".EE.E.E."],["-1"]],[["3","E..","EEE","E.."],["-1"]],[["4","EEEE","..E.","..E.","..E."],["-1"]],[["3","..E",".EE",".EE"],["1 1","2 1","3 1"]],[["6",".EEEEE",".EEEEE","......","......","......","EEEEEE"],["1 1","3 2","3 3","3 4","3 5","3 6"]]]}} +{"instance_id":"pseudo_to_code_2k_162","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nbigmod is a long long function with long long arguments a, b and m\n if b = 0, return 1 % m\n create long long x = bigmod(a, b \/ 2, m)\n set x to x squared modulo m\n if b is odd, assign (x * a) modulo m to x\n return x\nend of the block\ndefine the main function\n declare integer variable n\n read n\n declare string array s with size n + 2\n for i from 0 to n exclusive, read s[i]\n let r and c be vectors of integers arrays with size n + 1\n for i = 0 to n exclusive\n for j from 0 to n exclusive\n if s[i][j] = '.'\n push j to r[i]\n push i to c[j]\n end of the block\n declare integer p = 1\n loop i from 0 to n exclusive\n if r[i] is empty\n change p to 0\n break the loop\n end of the block\n end of the block\n if p is true\n for integer i = 0 to n exclusive, print i + 1, \" \" and r[i][0] + 1\n return to indicate successful execution\n end of the block\n set p to 1\n for i = 0 to n exclusive\n if c[i] is empty\n change p to 0\n break\n end of the block\n end of the block\n if p is true\n loop i from 0 to n exclusive, print c[i][0] + 1, \" \" and i + 1\n return to indicate successful execution\n end of the block\n print \"-1\"\nend of the block\n\n[CODE]:","reference_output":"long long bigmod(long long a, long long b, long long m) {\n if (b == 0) return 1 % m;\n long long x = bigmod(a, b \/ 2, m);\n x = (x * x) % m;\n if (b % 2) x = (x * a) % m;\n return x;\n}\nint main() {\n int n;\n cin >> n;\n string s[n + 2];\n for (int i = 0; i < n; i++) cin >> s[i];\n vector r[n + 1], c[n + 1];\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (s[i][j] == '.') {\n r[i].push_back(j);\n c[j].push_back(i);\n }\n int p = 1;\n for (int i = 0; i < n; i++) {\n if (r[i].empty()) {\n p = 0;\n break;\n }\n }\n if (p) {\n for (int i = 0; i < n; i++) cout << i + 1 << \" \" << r[i][0] + 1 << endl;\n return 0;\n }\n p = 1;\n for (int i = 0; i < n; i++) {\n if (c[i].empty()) {\n p = 0;\n break;\n }\n }\n if (p) {\n for (int i = 0; i < n; i++) cout << c[i][0] + 1 << \" \" << i + 1 << endl;\n return 0;\n }\n puts(\"-1\");\n}","item":{"problem_id":"329A","pseudocode":"bigmod is a long long function with long long arguments a, b and m\n if b = 0, return 1 % m\n create long long x = bigmod(a, b \/ 2, m)\n set x to x squared modulo m\n if b is odd, assign (x * a) modulo m to x\n return x\nend of the block\ndefine the main function\n declare integer variable n\n read n\n declare string array s with size n + 2\n for i from 0 to n exclusive, read s[i]\n let r and c be vectors of integers arrays with size n + 1\n for i = 0 to n exclusive\n for j from 0 to n exclusive\n if s[i][j] = '.'\n push j to r[i]\n push i to c[j]\n end of the block\n declare integer p = 1\n loop i from 0 to n exclusive\n if r[i] is empty\n change p to 0\n break the loop\n end of the block\n end of the block\n if p is true\n for integer i = 0 to n exclusive, print i + 1, \" \" and r[i][0] + 1\n return to indicate successful execution\n end of the block\n set p to 1\n for i = 0 to n exclusive\n if c[i] is empty\n change p to 0\n break\n end of the block\n end of the block\n if p is true\n loop i from 0 to n exclusive, print c[i][0] + 1, \" \" and i + 1\n return to indicate successful execution\n end of the block\n print \"-1\"\nend of the block","testcases":[[["3",".E.","E.E",".E."],["1 1","2 2","3 1"]],[["3","EEE","E..","E.E"],["-1"]],[["5","EE.EE","E.EE.","E...E",".EE.E","EE.EE"],["1 3","2 2","3 2","4 1","5 3"]],[["3",".EE",".EE",".EE"],["1 1","2 1","3 1"]],[["5","EE.EE","EE..E","EEE..","EE..E","EE.EE"],["1 3","2 3","3 4","4 3","5 3"]],[["1","E"],["-1"]],[["8","E.EEE..E","EEE.E.E.","EEE.E.E.","EE.E.E..","E...EE..","E.EE....","..EE....","E..E.EE."],["1 2","2 4","3 4","4 3","5 2","6 2","7 1","8 2"]],[["17","EE...E.EE.EE..E..","E.....EE..E..E..E","EEEE.EEEE..E..E.E",".E.E.EEE.EEEEE...","EEEEEEEEEEEEEEEEE","EE.E.EEEEE.E.....","..E.EE.EEE.E....E",".E..E..E...EE.E.E","EEEE.EEE.E.EEEE..","...E...EEEEEEE.E.","..E.E.EE..E.EE..E",".E..E..E.EEE.....",".E.....E..EEE.EE.","EE.E...E.EEEE.EE.","...EEEEEEE.E..E.E","EEEE.EEEEEE....E.","..EEEEEEE....EEEE"],["-1"]],[["17",".EEEEE...EEEE..EE","EEE..E...EEEEE..E",".E..E..EEE.EE...E",".EEE.EE..EE...E..","E..EEEEEE.EE.....","E.EE...EEEEEEE.E.","EEEE....EE..E.EEE","...EEEEE.E..EE...","EEE.E..EEEE.EEE..","..E.E....EEE.....","EE..E..E.E..EEEEE","EEE..E.EEEEE.E...","..EEEEE.E..EE.EE.","EE.E...E..E..E.EE","..E.EEE.EE..EE.E.","E..EE........E.E.","E..E..EEE.E...E.."],["1 1","2 4","3 1","4 1","5 2","6 2","7 5","8 1","9 4","10 1","11 3","12 4","13 1","14 3","15 1","16 2","17 2"]],[["1","."],["1 1"]],[["2","EE","EE"],["-1"]],[["2",".E",".E"],["1 1","2 1"]],[["3",".EE","EEE","EEE"],["-1"]],[["3","...","EEE","..E"],["1 1","1 2","1 3"]],[["4","E...","E.EE","EEEE","EEEE"],["-1"]],[["4","....","E..E","EEE.",".EE."],["1 1","2 2","3 4","4 1"]],[["8","E..EEEEE","EE..EEE.","EE..E...","EEE.E..E",".E.EEEE.","EEEEEEEE",".EEEE.EE",".EE.E.E."],["-1"]],[["3","E..","EEE","E.."],["-1"]],[["4","EEEE","..E.","..E.","..E."],["-1"]],[["3","..E",".EE",".EE"],["1 1","2 1","3 1"]],[["6",".EEEEE",".EEEEE","......","......","......","EEEEEE"],["1 1","3 2","3 3","3 4","3 5","3 6"]]]}} +{"instance_id":"pseudo_to_code_2k_163","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmaxn is a constant integer with maxn = 1100\na is an integer array with two dimensions both of size maxn, b is an integer array of size maxn\ns is a string array of size 110\ndefine the main function\n declare variable n\n while input n\n for i = 0 to n exclusive, input s[i]\n top and flag are both integers and are both set to 0\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if s[i][j] is equal to the character .\n increment top\n break\n end of the block\n if top is equal to n\n assign 1 to flag\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if s[i][j] is equal to the character .\n display i + 1, \" \", and j + 1\n break\n end of the block\n end of the block\n assign 0 to top\n for j = 0 to n exclusive\n for i = 0 to n exclusive\n if s[i][j] is equal to the character .\n increment top\n break\n end of the block\n if top is equal to n and flag is false\n assign 1 to flag\n for j = 0 to n exclusive\n for i = 0 to n exclusive\n if s[i][j] is equal to the character .\n display i + 1, \" \", and j + 1\n break\n end of the block\n end of the block\n if not flag, puts -1\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int maxn = 1100;\nint a[maxn][maxn], b[maxn];\nstring s[110];\nint main() {\n int n;\n while (cin >> n) {\n for (int i = 0; i < n; i++) cin >> s[i];\n int top = 0, flag = 0;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (s[i][j] == '.') {\n top++;\n break;\n }\n if (top == n) {\n flag = 1;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (s[i][j] == '.') {\n cout << i + 1 << \" \" << j + 1 << endl;\n break;\n }\n }\n top = 0;\n for (int j = 0; j < n; j++)\n for (int i = 0; i < n; i++)\n if (s[i][j] == '.') {\n top++;\n break;\n }\n if (top == n && !flag) {\n flag = 1;\n for (int j = 0; j < n; j++)\n for (int i = 0; i < n; i++)\n if (s[i][j] == '.') {\n cout << i + 1 << \" \" << j + 1 << endl;\n break;\n }\n }\n if (!flag) puts(\"-1\");\n }\n return 0;\n}","item":{"problem_id":"329A","pseudocode":"maxn is a constant integer with maxn = 1100\na is an integer array with two dimensions both of size maxn, b is an integer array of size maxn\ns is a string array of size 110\ndefine the main function\n declare variable n\n while input n\n for i = 0 to n exclusive, input s[i]\n top and flag are both integers and are both set to 0\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if s[i][j] is equal to the character .\n increment top\n break\n end of the block\n if top is equal to n\n assign 1 to flag\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if s[i][j] is equal to the character .\n display i + 1, \" \", and j + 1\n break\n end of the block\n end of the block\n assign 0 to top\n for j = 0 to n exclusive\n for i = 0 to n exclusive\n if s[i][j] is equal to the character .\n increment top\n break\n end of the block\n if top is equal to n and flag is false\n assign 1 to flag\n for j = 0 to n exclusive\n for i = 0 to n exclusive\n if s[i][j] is equal to the character .\n display i + 1, \" \", and j + 1\n break\n end of the block\n end of the block\n if not flag, puts -1\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3",".E.","E.E",".E."],["1 1","2 2","3 1"]],[["3","EEE","E..","E.E"],["-1"]],[["5","EE.EE","E.EE.","E...E",".EE.E","EE.EE"],["1 3","2 2","3 2","4 1","5 3"]],[["3",".EE",".EE",".EE"],["1 1","2 1","3 1"]],[["5","EE.EE","EE..E","EEE..","EE..E","EE.EE"],["1 3","2 3","3 4","4 3","5 3"]],[["1","E"],["-1"]],[["8","E.EEE..E","EEE.E.E.","EEE.E.E.","EE.E.E..","E...EE..","E.EE....","..EE....","E..E.EE."],["1 2","2 4","3 4","4 3","5 2","6 2","7 1","8 2"]],[["17","EE...E.EE.EE..E..","E.....EE..E..E..E","EEEE.EEEE..E..E.E",".E.E.EEE.EEEEE...","EEEEEEEEEEEEEEEEE","EE.E.EEEEE.E.....","..E.EE.EEE.E....E",".E..E..E...EE.E.E","EEEE.EEE.E.EEEE..","...E...EEEEEEE.E.","..E.E.EE..E.EE..E",".E..E..E.EEE.....",".E.....E..EEE.EE.","EE.E...E.EEEE.EE.","...EEEEEEE.E..E.E","EEEE.EEEEEE....E.","..EEEEEEE....EEEE"],["-1"]],[["17",".EEEEE...EEEE..EE","EEE..E...EEEEE..E",".E..E..EEE.EE...E",".EEE.EE..EE...E..","E..EEEEEE.EE.....","E.EE...EEEEEEE.E.","EEEE....EE..E.EEE","...EEEEE.E..EE...","EEE.E..EEEE.EEE..","..E.E....EEE.....","EE..E..E.E..EEEEE","EEE..E.EEEEE.E...","..EEEEE.E..EE.EE.","EE.E...E..E..E.EE","..E.EEE.EE..EE.E.","E..EE........E.E.","E..E..EEE.E...E.."],["1 1","2 4","3 1","4 1","5 2","6 2","7 5","8 1","9 4","10 1","11 3","12 4","13 1","14 3","15 1","16 2","17 2"]],[["1","."],["1 1"]],[["2","EE","EE"],["-1"]],[["2",".E",".E"],["1 1","2 1"]],[["3",".EE","EEE","EEE"],["-1"]],[["3","...","EEE","..E"],["1 1","1 2","1 3"]],[["4","E...","E.EE","EEEE","EEEE"],["-1"]],[["4","....","E..E","EEE.",".EE."],["1 1","2 2","3 4","4 1"]],[["8","E..EEEEE","EE..EEE.","EE..E...","EEE.E..E",".E.EEEE.","EEEEEEEE",".EEEE.EE",".EE.E.E."],["-1"]],[["3","E..","EEE","E.."],["-1"]],[["4","EEEE","..E.","..E.","..E."],["-1"]],[["3","..E",".EE",".EE"],["1 1","2 1","3 1"]],[["6",".EEEEE",".EEEEE","......","......","......","EEEEEE"],["1 1","3 2","3 3","3 4","3 5","3 6"]]]}} +{"instance_id":"pseudo_to_code_2k_164","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\na, b = integer 2d array of [101][101]\ndefine the main function\n n = integer\n read n\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n tmp = character\n read tmp\n if tmp is E, a[i][j] = -1\n end of the block\n end of the block\n flagh, flagl = integers with flagh[101] = {0}, flagl[101] = {0}\n flaghs, flagls = integers with flaghs = 0, flagls = 0\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if a[i][j] is 0\n flagh[i] = 1\n break loop\n end of the block\n end of the block\n end of the block\n for i = 0 to n exclusive\n if flagh[i] is 0\n flaghs = -1\n break loop\n end of the block\n end of the block\n if flaghs is 0\n for i = 0 to n exclusive\n for j = 0 to n\n if a[i][j] is 0\n print i + 1,\" \",j + 1\n break loop\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\n end of the block\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if a[j][i] is 0\n flagl[i] = 1\n break loop\n end of the block\n end of the block\n end of the block\n for i = 0 to n\n if flagl[i] is 0\n flagls = -1\n break loop\n end of the block\n end of the block\n if flagls is 0\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if a[j][i] is 0\n print j + 1,\" \",i + 1\n break loop\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\n end of the block\n print -1\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int a[101][101], b[101][101];\nint main() {\n int n;\n cin >> n;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n char tmp;\n cin >> tmp;\n if (tmp == 'E') a[i][j] = -1;\n }\n }\n int flagh[101] = {0}, flagl[101] = {0};\n int flaghs = 0, flagls = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (a[i][j] == 0) {\n flagh[i] = 1;\n break;\n }\n }\n }\n for (int i = 0; i < n; i++) {\n if (flagh[i] == 0) {\n flaghs = -1;\n break;\n }\n }\n if (flaghs == 0) {\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (a[i][j] == 0) {\n cout << i + 1 << \" \" << j + 1 << endl;\n break;\n }\n }\n }\n return 0;\n }\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (a[j][i] == 0) {\n flagl[i] = 1;\n break;\n }\n }\n }\n for (int i = 0; i < n; i++) {\n if (flagl[i] == 0) {\n flagls = -1;\n break;\n }\n }\n if (flagls == 0) {\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (a[j][i] == 0) {\n cout << j + 1 << \" \" << i + 1 << endl;\n break;\n }\n }\n }\n return 0;\n }\n cout << -1 << endl;\n return 0;\n}","item":{"problem_id":"329A","pseudocode":"a, b = integer 2d array of [101][101]\ndefine the main function\n n = integer\n read n\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n tmp = character\n read tmp\n if tmp is E, a[i][j] = -1\n end of the block\n end of the block\n flagh, flagl = integers with flagh[101] = {0}, flagl[101] = {0}\n flaghs, flagls = integers with flaghs = 0, flagls = 0\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if a[i][j] is 0\n flagh[i] = 1\n break loop\n end of the block\n end of the block\n end of the block\n for i = 0 to n exclusive\n if flagh[i] is 0\n flaghs = -1\n break loop\n end of the block\n end of the block\n if flaghs is 0\n for i = 0 to n exclusive\n for j = 0 to n\n if a[i][j] is 0\n print i + 1,\" \",j + 1\n break loop\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\n end of the block\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if a[j][i] is 0\n flagl[i] = 1\n break loop\n end of the block\n end of the block\n end of the block\n for i = 0 to n\n if flagl[i] is 0\n flagls = -1\n break loop\n end of the block\n end of the block\n if flagls is 0\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if a[j][i] is 0\n print j + 1,\" \",i + 1\n break loop\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\n end of the block\n print -1\n return to indicate successful execution\nend of the block","testcases":[[["3",".E.","E.E",".E."],["1 1","2 2","3 1"]],[["3","EEE","E..","E.E"],["-1"]],[["5","EE.EE","E.EE.","E...E",".EE.E","EE.EE"],["1 3","2 2","3 2","4 1","5 3"]],[["3",".EE",".EE",".EE"],["1 1","2 1","3 1"]],[["5","EE.EE","EE..E","EEE..","EE..E","EE.EE"],["1 3","2 3","3 4","4 3","5 3"]],[["1","E"],["-1"]],[["8","E.EEE..E","EEE.E.E.","EEE.E.E.","EE.E.E..","E...EE..","E.EE....","..EE....","E..E.EE."],["1 2","2 4","3 4","4 3","5 2","6 2","7 1","8 2"]],[["17","EE...E.EE.EE..E..","E.....EE..E..E..E","EEEE.EEEE..E..E.E",".E.E.EEE.EEEEE...","EEEEEEEEEEEEEEEEE","EE.E.EEEEE.E.....","..E.EE.EEE.E....E",".E..E..E...EE.E.E","EEEE.EEE.E.EEEE..","...E...EEEEEEE.E.","..E.E.EE..E.EE..E",".E..E..E.EEE.....",".E.....E..EEE.EE.","EE.E...E.EEEE.EE.","...EEEEEEE.E..E.E","EEEE.EEEEEE....E.","..EEEEEEE....EEEE"],["-1"]],[["17",".EEEEE...EEEE..EE","EEE..E...EEEEE..E",".E..E..EEE.EE...E",".EEE.EE..EE...E..","E..EEEEEE.EE.....","E.EE...EEEEEEE.E.","EEEE....EE..E.EEE","...EEEEE.E..EE...","EEE.E..EEEE.EEE..","..E.E....EEE.....","EE..E..E.E..EEEEE","EEE..E.EEEEE.E...","..EEEEE.E..EE.EE.","EE.E...E..E..E.EE","..E.EEE.EE..EE.E.","E..EE........E.E.","E..E..EEE.E...E.."],["1 1","2 4","3 1","4 1","5 2","6 2","7 5","8 1","9 4","10 1","11 3","12 4","13 1","14 3","15 1","16 2","17 2"]],[["1","."],["1 1"]],[["2","EE","EE"],["-1"]],[["2",".E",".E"],["1 1","2 1"]],[["3",".EE","EEE","EEE"],["-1"]],[["3","...","EEE","..E"],["1 1","1 2","1 3"]],[["4","E...","E.EE","EEEE","EEEE"],["-1"]],[["4","....","E..E","EEE.",".EE."],["1 1","2 2","3 4","4 1"]],[["8","E..EEEEE","EE..EEE.","EE..E...","EEE.E..E",".E.EEEE.","EEEEEEEE",".EEEE.EE",".EE.E.E."],["-1"]],[["3","E..","EEE","E.."],["-1"]],[["4","EEEE","..E.","..E.","..E."],["-1"]],[["3","..E",".EE",".EE"],["1 1","2 1","3 1"]],[["6",".EEEEE",".EEEEE","......","......","......","EEEEEE"],["1 1","3 2","3 3","3 4","3 5","3 6"]]]}} +{"instance_id":"pseudo_to_code_2k_165","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create integer n\n while read n is true\n create string array a with size 101\n create integer set b\n create integer set c\n for i = 0 to n exclusive\n read a[i]\n for j = 0 to n exclusive\n if a[i][j] is '.'\n insert i into b\n insert j into c\n end of the block\n end of the block\n end of the block\n if size of b is less than n and size of c is less than n\n print \"-1\" print newline\n else\n if size of b is n\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if a[i][j] is '.'\n print i + 1 print \" \" print j + 1 print newline\n break loop\n end of the block\n end of the block\n end of the block\n else\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if a[j][i] is '.'\n print j + 1 print \" \" print i + 1 print newline\n break loop\n end of the block\n end of the block\n end of the block\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int n;\n while (cin >> n) {\n string a[101];\n set b;\n set c;\n for (int i = 0; i < n; ++i) {\n cin >> a[i];\n for (int j = 0; j < n; ++j) {\n if (a[i][j] == '.') {\n b.insert(i);\n c.insert(j);\n }\n }\n }\n if (b.size() < n && c.size() < n)\n cout << \"-1\" << endl;\n else {\n if (b.size() == n) {\n for (int i = 0; i < n; ++i) {\n for (int j = 0; i < n; ++j) {\n if (a[i][j] == '.') {\n cout << i + 1 << \" \" << j + 1 << endl;\n break;\n }\n }\n }\n } else {\n for (int i = 0; i < n; ++i) {\n for (int j = 0; i < n; ++j) {\n if (a[j][i] == '.') {\n cout << j + 1 << \" \" << i + 1 << endl;\n break;\n }\n }\n }\n }\n }\n }\n return 0;\n}","item":{"problem_id":"329A","pseudocode":"define the main function\n create integer n\n while read n is true\n create string array a with size 101\n create integer set b\n create integer set c\n for i = 0 to n exclusive\n read a[i]\n for j = 0 to n exclusive\n if a[i][j] is '.'\n insert i into b\n insert j into c\n end of the block\n end of the block\n end of the block\n if size of b is less than n and size of c is less than n\n print \"-1\" print newline\n else\n if size of b is n\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if a[i][j] is '.'\n print i + 1 print \" \" print j + 1 print newline\n break loop\n end of the block\n end of the block\n end of the block\n else\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if a[j][i] is '.'\n print j + 1 print \" \" print i + 1 print newline\n break loop\n end of the block\n end of the block\n end of the block\n end of the block\n end of the block\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3",".E.","E.E",".E."],["1 1","2 2","3 1"]],[["3","EEE","E..","E.E"],["-1"]],[["5","EE.EE","E.EE.","E...E",".EE.E","EE.EE"],["1 3","2 2","3 2","4 1","5 3"]],[["3",".EE",".EE",".EE"],["1 1","2 1","3 1"]],[["5","EE.EE","EE..E","EEE..","EE..E","EE.EE"],["1 3","2 3","3 4","4 3","5 3"]],[["1","E"],["-1"]],[["8","E.EEE..E","EEE.E.E.","EEE.E.E.","EE.E.E..","E...EE..","E.EE....","..EE....","E..E.EE."],["1 2","2 4","3 4","4 3","5 2","6 2","7 1","8 2"]],[["17","EE...E.EE.EE..E..","E.....EE..E..E..E","EEEE.EEEE..E..E.E",".E.E.EEE.EEEEE...","EEEEEEEEEEEEEEEEE","EE.E.EEEEE.E.....","..E.EE.EEE.E....E",".E..E..E...EE.E.E","EEEE.EEE.E.EEEE..","...E...EEEEEEE.E.","..E.E.EE..E.EE..E",".E..E..E.EEE.....",".E.....E..EEE.EE.","EE.E...E.EEEE.EE.","...EEEEEEE.E..E.E","EEEE.EEEEEE....E.","..EEEEEEE....EEEE"],["-1"]],[["17",".EEEEE...EEEE..EE","EEE..E...EEEEE..E",".E..E..EEE.EE...E",".EEE.EE..EE...E..","E..EEEEEE.EE.....","E.EE...EEEEEEE.E.","EEEE....EE..E.EEE","...EEEEE.E..EE...","EEE.E..EEEE.EEE..","..E.E....EEE.....","EE..E..E.E..EEEEE","EEE..E.EEEEE.E...","..EEEEE.E..EE.EE.","EE.E...E..E..E.EE","..E.EEE.EE..EE.E.","E..EE........E.E.","E..E..EEE.E...E.."],["1 1","2 4","3 1","4 1","5 2","6 2","7 5","8 1","9 4","10 1","11 3","12 4","13 1","14 3","15 1","16 2","17 2"]],[["1","."],["1 1"]],[["2","EE","EE"],["-1"]],[["2",".E",".E"],["1 1","2 1"]],[["3",".EE","EEE","EEE"],["-1"]],[["3","...","EEE","..E"],["1 1","1 2","1 3"]],[["4","E...","E.EE","EEEE","EEEE"],["-1"]],[["4","....","E..E","EEE.",".EE."],["1 1","2 2","3 4","4 1"]],[["8","E..EEEEE","EE..EEE.","EE..E...","EEE.E..E",".E.EEEE.","EEEEEEEE",".EEEE.EE",".EE.E.E."],["-1"]],[["3","E..","EEE","E.."],["-1"]],[["4","EEEE","..E.","..E.","..E."],["-1"]],[["3","..E",".EE",".EE"],["1 1","2 1","3 1"]],[["6",".EEEEE",".EEEEE","......","......","......","EEEEEE"],["1 1","3 2","3 3","3 4","3 5","3 6"]]]}} +{"instance_id":"pseudo_to_code_2k_166","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmaxn is a constant integer with maxn = 1100\na is an integer array with two dimensions both of size maxn, b is an integer array of size maxn\ns is a string array of size 110\ndefine the main function\n declare variable n\n while input n\n for i = 0 to n exclusive, input s[i]\n top and flag are both integers and are both set to 0\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if s[i][j] is equal to the character .\n increment top\n break\n end of the block\n if top is equal to n\n assign 1 to flag\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if s[i][j] is equal to the character .\n display i + 1, \" \", and j + 1\n break\n end of the block\n end of the block\n assign 0 to top\n for j = 0 to n exclusive\n for i = 0 to n exclusive\n if s[i][j] is equal to the character .\n increment top\n break\n end of the block\n if top is equal to n and flag is false\n assign 1 to flag\n for j = 0 to n exclusive\n for i = 0 to n exclusive\n if s[i][j] is equal to the character .\n display i + 1, \" \", and j + 1\n break\n end of the block\n end of the block\n if not flag, puts -1\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int maxn = 1100;\nint a[maxn][maxn], b[maxn];\nstring s[110];\nint main() {\n int n;\n while (cin >> n) {\n for (int i = 0; i < n; i++) cin >> s[i];\n int top = 0, flag = 0;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (s[i][j] == '.') {\n top++;\n break;\n }\n if (top == n) {\n flag = 1;\n for (int i = 0; i < n; i++)\n for (int j = 0; j < n; j++)\n if (s[i][j] == '.') {\n cout << i + 1 << \" \" << j + 1 << endl;\n break;\n }\n }\n top = 0;\n for (int j = 0; j < n; j++)\n for (int i = 0; i < n; i++)\n if (s[i][j] == '.') {\n top++;\n break;\n }\n if (top == n && !flag) {\n flag = 1;\n for (int j = 0; j < n; j++)\n for (int i = 0; i < n; i++)\n if (s[i][j] == '.') {\n cout << i + 1 << \" \" << j + 1 << endl;\n break;\n }\n }\n if (!flag) puts(\"-1\");\n }\n return 0;\n}","item":{"problem_id":"329A","pseudocode":"maxn is a constant integer with maxn = 1100\na is an integer array with two dimensions both of size maxn, b is an integer array of size maxn\ns is a string array of size 110\ndefine the main function\n declare variable n\n while input n\n for i = 0 to n exclusive, input s[i]\n top and flag are both integers and are both set to 0\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if s[i][j] is equal to the character .\n increment top\n break\n end of the block\n if top is equal to n\n assign 1 to flag\n for i = 0 to n exclusive\n for j = 0 to n exclusive\n if s[i][j] is equal to the character .\n display i + 1, \" \", and j + 1\n break\n end of the block\n end of the block\n assign 0 to top\n for j = 0 to n exclusive\n for i = 0 to n exclusive\n if s[i][j] is equal to the character .\n increment top\n break\n end of the block\n if top is equal to n and flag is false\n assign 1 to flag\n for j = 0 to n exclusive\n for i = 0 to n exclusive\n if s[i][j] is equal to the character .\n display i + 1, \" \", and j + 1\n break\n end of the block\n end of the block\n if not flag, puts -1\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3",".E.","E.E",".E."],["1 1","2 2","3 1"]],[["3","EEE","E..","E.E"],["-1"]],[["5","EE.EE","E.EE.","E...E",".EE.E","EE.EE"],["1 3","2 2","3 2","4 1","5 3"]],[["3",".EE",".EE",".EE"],["1 1","2 1","3 1"]],[["5","EE.EE","EE..E","EEE..","EE..E","EE.EE"],["1 3","2 3","3 4","4 3","5 3"]],[["1","E"],["-1"]],[["8","E.EEE..E","EEE.E.E.","EEE.E.E.","EE.E.E..","E...EE..","E.EE....","..EE....","E..E.EE."],["1 2","2 4","3 4","4 3","5 2","6 2","7 1","8 2"]],[["17","EE...E.EE.EE..E..","E.....EE..E..E..E","EEEE.EEEE..E..E.E",".E.E.EEE.EEEEE...","EEEEEEEEEEEEEEEEE","EE.E.EEEEE.E.....","..E.EE.EEE.E....E",".E..E..E...EE.E.E","EEEE.EEE.E.EEEE..","...E...EEEEEEE.E.","..E.E.EE..E.EE..E",".E..E..E.EEE.....",".E.....E..EEE.EE.","EE.E...E.EEEE.EE.","...EEEEEEE.E..E.E","EEEE.EEEEEE....E.","..EEEEEEE....EEEE"],["-1"]],[["17",".EEEEE...EEEE..EE","EEE..E...EEEEE..E",".E..E..EEE.EE...E",".EEE.EE..EE...E..","E..EEEEEE.EE.....","E.EE...EEEEEEE.E.","EEEE....EE..E.EEE","...EEEEE.E..EE...","EEE.E..EEEE.EEE..","..E.E....EEE.....","EE..E..E.E..EEEEE","EEE..E.EEEEE.E...","..EEEEE.E..EE.EE.","EE.E...E..E..E.EE","..E.EEE.EE..EE.E.","E..EE........E.E.","E..E..EEE.E...E.."],["1 1","2 4","3 1","4 1","5 2","6 2","7 5","8 1","9 4","10 1","11 3","12 4","13 1","14 3","15 1","16 2","17 2"]],[["1","."],["1 1"]],[["2","EE","EE"],["-1"]],[["2",".E",".E"],["1 1","2 1"]],[["3",".EE","EEE","EEE"],["-1"]],[["3","...","EEE","..E"],["1 1","1 2","1 3"]],[["4","E...","E.EE","EEEE","EEEE"],["-1"]],[["4","....","E..E","EEE.",".EE."],["1 1","2 2","3 4","4 1"]],[["8","E..EEEEE","EE..EEE.","EE..E...","EEE.E..E",".E.EEEE.","EEEEEEEE",".EEEE.EE",".EE.E.E."],["-1"]],[["3","E..","EEE","E.."],["-1"]],[["4","EEEE","..E.","..E.","..E."],["-1"]],[["3","..E",".EE",".EE"],["1 1","2 1","3 1"]],[["6",".EEEEE",".EEEEE","......","......","......","EEEEEE"],["1 1","3 2","3 3","3 4","3 5","3 6"]]]}} +{"instance_id":"pseudo_to_code_2k_167","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\na = character array of length 120 by 120\nin function check that returns an integer and takes argument n = integer\n flag1 = integer\n for i = 1 to n inclusive\n set flag1 to 0\n for j = 1 to n inclusive\n if a[i][j] equals .\n set flag1 to 1\n break\n end of the block\n end of the block\n if not flag1 then break\n end of the block\n flag2 = integer\n for i = 1 to n inclusive\n set flag2 to 0\n for j = 1 to n inclusive\n if a[j][i] equals .\n set flag2 to 1\n break\n end of the block\n end of the block\n if not flag2 then break\n end of the block\n if flag1 and flag2 both equal 0\n return to indicate successful execution\n else\n if flag1\n return 1\n else\n return 2\n end of the block\n end of the block\nend of the block\ndefine the main function\n n = integer\n while read n\n for i = 1 to n inclusive\n for j = 1 to n inclusive read a[i][j]\n end of the block\n judge = integer with value of the return of function check with argument n\n if judge is not 0\n if judge equals 1\n for i = 1 to n inclusive\n for j = 1 to n inclusive\n if a[i][j] equals .\n print i space j\n break\n end of the block\n end of the block\n end of the block\n else\n for i = 1 to n inclusive\n for j = 1 to n inclusive\n if a[j][i] equals .\n print j space i\n break\n end of the block\n end of the block\n end of the block\n end of the block\n else\n print -1\n end of the block\n end of the block\nend of the block\n\n[CODE]:","reference_output":"char a[120][120];\nint check(int n) {\n int flag1;\n for (int i = 1; i <= n; i++) {\n flag1 = 0;\n for (int j = 1; j <= n; j++) {\n if (a[i][j] == '.') {\n flag1 = 1;\n break;\n }\n }\n if (!flag1) { break; }\n }\n int flag2;\n for (int i = 1; i <= n; i++) {\n flag2 = 0;\n for (int j = 1; j <= n; j++) {\n if (a[j][i] == '.') {\n flag2 = 1;\n break;\n }\n }\n if (!flag2) { break; }\n }\n if (flag1 == 0 && flag2 == 0) {\n return 0;\n } else {\n if (flag1) {\n return 1;\n } else {\n return 2;\n }\n }\n}\nint main() {\n int n;\n while (cin >> n) {\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= n; j++) { cin >> a[i][j]; }\n }\n int judge = check(n);\n if (judge) {\n if (judge == 1) {\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= n; j++) {\n if (a[i][j] == '.') {\n cout << i << \" \" << j << endl;\n break;\n }\n }\n }\n } else {\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= n; j++) {\n if (a[j][i] == '.') {\n cout << j << \" \" << i << endl;\n break;\n }\n }\n }\n }\n } else {\n cout << \"-1\" << endl;\n }\n }\n}","item":{"problem_id":"329A","pseudocode":"a = character array of length 120 by 120\nin function check that returns an integer and takes argument n = integer\n flag1 = integer\n for i = 1 to n inclusive\n set flag1 to 0\n for j = 1 to n inclusive\n if a[i][j] equals .\n set flag1 to 1\n break\n end of the block\n end of the block\n if not flag1 then break\n end of the block\n flag2 = integer\n for i = 1 to n inclusive\n set flag2 to 0\n for j = 1 to n inclusive\n if a[j][i] equals .\n set flag2 to 1\n break\n end of the block\n end of the block\n if not flag2 then break\n end of the block\n if flag1 and flag2 both equal 0\n return to indicate successful execution\n else\n if flag1\n return 1\n else\n return 2\n end of the block\n end of the block\nend of the block\ndefine the main function\n n = integer\n while read n\n for i = 1 to n inclusive\n for j = 1 to n inclusive read a[i][j]\n end of the block\n judge = integer with value of the return of function check with argument n\n if judge is not 0\n if judge equals 1\n for i = 1 to n inclusive\n for j = 1 to n inclusive\n if a[i][j] equals .\n print i space j\n break\n end of the block\n end of the block\n end of the block\n else\n for i = 1 to n inclusive\n for j = 1 to n inclusive\n if a[j][i] equals .\n print j space i\n break\n end of the block\n end of the block\n end of the block\n end of the block\n else\n print -1\n end of the block\n end of the block\nend of the block","testcases":[[["3",".E.","E.E",".E."],["1 1","2 2","3 1"]],[["3","EEE","E..","E.E"],["-1"]],[["5","EE.EE","E.EE.","E...E",".EE.E","EE.EE"],["1 3","2 2","3 2","4 1","5 3"]],[["3",".EE",".EE",".EE"],["1 1","2 1","3 1"]],[["5","EE.EE","EE..E","EEE..","EE..E","EE.EE"],["1 3","2 3","3 4","4 3","5 3"]],[["1","E"],["-1"]],[["8","E.EEE..E","EEE.E.E.","EEE.E.E.","EE.E.E..","E...EE..","E.EE....","..EE....","E..E.EE."],["1 2","2 4","3 4","4 3","5 2","6 2","7 1","8 2"]],[["17","EE...E.EE.EE..E..","E.....EE..E..E..E","EEEE.EEEE..E..E.E",".E.E.EEE.EEEEE...","EEEEEEEEEEEEEEEEE","EE.E.EEEEE.E.....","..E.EE.EEE.E....E",".E..E..E...EE.E.E","EEEE.EEE.E.EEEE..","...E...EEEEEEE.E.","..E.E.EE..E.EE..E",".E..E..E.EEE.....",".E.....E..EEE.EE.","EE.E...E.EEEE.EE.","...EEEEEEE.E..E.E","EEEE.EEEEEE....E.","..EEEEEEE....EEEE"],["-1"]],[["17",".EEEEE...EEEE..EE","EEE..E...EEEEE..E",".E..E..EEE.EE...E",".EEE.EE..EE...E..","E..EEEEEE.EE.....","E.EE...EEEEEEE.E.","EEEE....EE..E.EEE","...EEEEE.E..EE...","EEE.E..EEEE.EEE..","..E.E....EEE.....","EE..E..E.E..EEEEE","EEE..E.EEEEE.E...","..EEEEE.E..EE.EE.","EE.E...E..E..E.EE","..E.EEE.EE..EE.E.","E..EE........E.E.","E..E..EEE.E...E.."],["1 1","2 4","3 1","4 1","5 2","6 2","7 5","8 1","9 4","10 1","11 3","12 4","13 1","14 3","15 1","16 2","17 2"]],[["1","."],["1 1"]],[["2","EE","EE"],["-1"]],[["2",".E",".E"],["1 1","2 1"]],[["3",".EE","EEE","EEE"],["-1"]],[["3","...","EEE","..E"],["1 1","1 2","1 3"]],[["4","E...","E.EE","EEEE","EEEE"],["-1"]],[["4","....","E..E","EEE.",".EE."],["1 1","2 2","3 4","4 1"]],[["8","E..EEEEE","EE..EEE.","EE..E...","EEE.E..E",".E.EEEE.","EEEEEEEE",".EEEE.EE",".EE.E.E."],["-1"]],[["3","E..","EEE","E.."],["-1"]],[["4","EEEE","..E.","..E.","..E."],["-1"]],[["3","..E",".EE",".EE"],["1 1","2 1","3 1"]],[["6",".EEEEE",".EEEEE","......","......","......","EEEEEE"],["1 1","3 2","3 3","3 4","3 5","3 6"]]]}} +{"instance_id":"pseudo_to_code_2k_168","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create integer N\n read N\n declare character array mat with size N + 1 by N + 1\n let rows and columns be arrays of integer vectors with size N + 1\n for integer i = 1 to N inclusive\n for integer j = 1 to N inclusive\n read mat[i][j]\n if mat[i][j] != 'E'\n push j to the end of rows[i]\n push i to the end of columns[j]\n end of the block\n end of the block\n end of the block\n create booleans rowFull and columnFull = false\n for i = 1 to N inclusive\n if size of rows[i] is 0, set rowFull to true\n if size of columns[i] is 0, set columnFull to true\n end of the block\n if rowFull && columnFull\n print \"-1\"\n else if rowFull\n for i = 1 to N inclusive print columns[i][0], \" \" and i\n else\n for integer i = 1 to N inclusive print i, \" \" and rows[i][0]\n end of the block\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int N;\n cin >> N;\n char mat[N + 1][N + 1];\n vector rows[N + 1], columns[N + 1];\n for (int i = 1; i <= N; i++) {\n for (int j = 1; j <= N; j++) {\n cin >> mat[i][j];\n if (mat[i][j] != 'E') {\n rows[i].push_back(j);\n columns[j].push_back(i);\n }\n }\n }\n bool rowFull = false, columnFull = false;\n for (int i = 1; i <= N; i++) {\n if (!rows[i].size()) rowFull = true;\n if (!columns[i].size()) columnFull = true;\n }\n if (rowFull && columnFull) {\n cout << \"-1\" << endl;\n } else if (rowFull) {\n for (int i = 1; i <= N; i++) { cout << columns[i][0] << \" \" << i << endl; }\n } else {\n for (int i = 1; i <= N; i++) { cout << i << \" \" << rows[i][0] << endl; }\n }\n return 0;\n}","item":{"problem_id":"329A","pseudocode":"define the main function\n create integer N\n read N\n declare character array mat with size N + 1 by N + 1\n let rows and columns be arrays of integer vectors with size N + 1\n for integer i = 1 to N inclusive\n for integer j = 1 to N inclusive\n read mat[i][j]\n if mat[i][j] != 'E'\n push j to the end of rows[i]\n push i to the end of columns[j]\n end of the block\n end of the block\n end of the block\n create booleans rowFull and columnFull = false\n for i = 1 to N inclusive\n if size of rows[i] is 0, set rowFull to true\n if size of columns[i] is 0, set columnFull to true\n end of the block\n if rowFull && columnFull\n print \"-1\"\n else if rowFull\n for i = 1 to N inclusive print columns[i][0], \" \" and i\n else\n for integer i = 1 to N inclusive print i, \" \" and rows[i][0]\n end of the block\n return to indicate successful execution\nend of the block","testcases":[[["3",".E.","E.E",".E."],["1 1","2 2","3 1"]],[["3","EEE","E..","E.E"],["-1"]],[["5","EE.EE","E.EE.","E...E",".EE.E","EE.EE"],["1 3","2 2","3 2","4 1","5 3"]],[["3",".EE",".EE",".EE"],["1 1","2 1","3 1"]],[["5","EE.EE","EE..E","EEE..","EE..E","EE.EE"],["1 3","2 3","3 4","4 3","5 3"]],[["1","E"],["-1"]],[["8","E.EEE..E","EEE.E.E.","EEE.E.E.","EE.E.E..","E...EE..","E.EE....","..EE....","E..E.EE."],["1 2","2 4","3 4","4 3","5 2","6 2","7 1","8 2"]],[["17","EE...E.EE.EE..E..","E.....EE..E..E..E","EEEE.EEEE..E..E.E",".E.E.EEE.EEEEE...","EEEEEEEEEEEEEEEEE","EE.E.EEEEE.E.....","..E.EE.EEE.E....E",".E..E..E...EE.E.E","EEEE.EEE.E.EEEE..","...E...EEEEEEE.E.","..E.E.EE..E.EE..E",".E..E..E.EEE.....",".E.....E..EEE.EE.","EE.E...E.EEEE.EE.","...EEEEEEE.E..E.E","EEEE.EEEEEE....E.","..EEEEEEE....EEEE"],["-1"]],[["17",".EEEEE...EEEE..EE","EEE..E...EEEEE..E",".E..E..EEE.EE...E",".EEE.EE..EE...E..","E..EEEEEE.EE.....","E.EE...EEEEEEE.E.","EEEE....EE..E.EEE","...EEEEE.E..EE...","EEE.E..EEEE.EEE..","..E.E....EEE.....","EE..E..E.E..EEEEE","EEE..E.EEEEE.E...","..EEEEE.E..EE.EE.","EE.E...E..E..E.EE","..E.EEE.EE..EE.E.","E..EE........E.E.","E..E..EEE.E...E.."],["1 1","2 4","3 1","4 1","5 2","6 2","7 5","8 1","9 4","10 1","11 3","12 4","13 1","14 3","15 1","16 2","17 2"]],[["1","."],["1 1"]],[["2","EE","EE"],["-1"]],[["2",".E",".E"],["1 1","2 1"]],[["3",".EE","EEE","EEE"],["-1"]],[["3","...","EEE","..E"],["1 1","1 2","1 3"]],[["4","E...","E.EE","EEEE","EEEE"],["-1"]],[["4","....","E..E","EEE.",".EE."],["1 1","2 2","3 4","4 1"]],[["8","E..EEEEE","EE..EEE.","EE..E...","EEE.E..E",".E.EEEE.","EEEEEEEE",".EEEE.EE",".EE.E.E."],["-1"]],[["3","E..","EEE","E.."],["-1"]],[["4","EEEE","..E.","..E.","..E."],["-1"]],[["3","..E",".EE",".EE"],["1 1","2 1","3 1"]],[["6",".EEEEE",".EEEEE","......","......","......","EEEEEE"],["1 1","3 2","3 3","3 4","3 5","3 6"]]]}} +{"instance_id":"pseudo_to_code_2k_169","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\na = character array of size 120\nin the function check that takes integer n and returns integer\n flag1 = integer\n for i = 1 to n\n flag1 = 0\n for j = 1 to n\n if a[i][j] is .\n flag1 = 1\n break loop\n end of the block\n end of the block\n if not flag1, break loop\n end of the block\n flag2 = integer\n for i = 1 to n\n flag2 = 0\n for j = 1 to n\n if a[j][i] is .\n flag2 = 1\n break loop\n end of the block\n end of the block\n if not flag2, break loop\n end of the block\n if flag1 is 0 and flag2 is 0\n return to indicate successful execution\n else\n if flag1\n return 1\n else\n return 2\n end of the block\n end of the block\nend of the block\ndefine the main function\n n = integer\n while read n\n for i = 1 to n\n for j = 1 to n, read a[i][j]\n end of the block\n judge = integer with judge = check on n\n if judge\n if judge is 1\n for i = 1 to n\n for j = 1 to n\n if a[i][j] is .\n print i,\" \",j\n break loop\n end of the block\n end of the block\n end of the block\n else\n for i = 1 to n\n for j = 1 to n\n if a[j][i] is .\n print j,\" \",i\n break loop\n end of the block\n end of the block\n end of the block\n end of the block\n else\n print -1\n end of the block\n end of the block\nend of the block\n\n[CODE]:","reference_output":"char a[120][120];\nint check(int n) {\n int flag1;\n for (int i = 1; i <= n; i++) {\n flag1 = 0;\n for (int j = 1; j <= n; j++) {\n if (a[i][j] == '.') {\n flag1 = 1;\n break;\n }\n }\n if (!flag1) { break; }\n }\n int flag2;\n for (int i = 1; i <= n; i++) {\n flag2 = 0;\n for (int j = 1; j <= n; j++) {\n if (a[j][i] == '.') {\n flag2 = 1;\n break;\n }\n }\n if (!flag2) { break; }\n }\n if (flag1 == 0 && flag2 == 0) {\n return 0;\n } else {\n if (flag1) {\n return 1;\n } else {\n return 2;\n }\n }\n}\nint main() {\n int n;\n while (cin >> n) {\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= n; j++) { cin >> a[i][j]; }\n }\n int judge = check(n);\n if (judge) {\n if (judge == 1) {\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= n; j++) {\n if (a[i][j] == '.') {\n cout << i << \" \" << j << endl;\n break;\n }\n }\n }\n } else {\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= n; j++) {\n if (a[j][i] == '.') {\n cout << j << \" \" << i << endl;\n break;\n }\n }\n }\n }\n } else {\n cout << \"-1\" << endl;\n }\n }\n}","item":{"problem_id":"329A","pseudocode":"a = character array of size 120\nin the function check that takes integer n and returns integer\n flag1 = integer\n for i = 1 to n\n flag1 = 0\n for j = 1 to n\n if a[i][j] is .\n flag1 = 1\n break loop\n end of the block\n end of the block\n if not flag1, break loop\n end of the block\n flag2 = integer\n for i = 1 to n\n flag2 = 0\n for j = 1 to n\n if a[j][i] is .\n flag2 = 1\n break loop\n end of the block\n end of the block\n if not flag2, break loop\n end of the block\n if flag1 is 0 and flag2 is 0\n return to indicate successful execution\n else\n if flag1\n return 1\n else\n return 2\n end of the block\n end of the block\nend of the block\ndefine the main function\n n = integer\n while read n\n for i = 1 to n\n for j = 1 to n, read a[i][j]\n end of the block\n judge = integer with judge = check on n\n if judge\n if judge is 1\n for i = 1 to n\n for j = 1 to n\n if a[i][j] is .\n print i,\" \",j\n break loop\n end of the block\n end of the block\n end of the block\n else\n for i = 1 to n\n for j = 1 to n\n if a[j][i] is .\n print j,\" \",i\n break loop\n end of the block\n end of the block\n end of the block\n end of the block\n else\n print -1\n end of the block\n end of the block\nend of the block","testcases":[[["3",".E.","E.E",".E."],["1 1","2 2","3 1"]],[["3","EEE","E..","E.E"],["-1"]],[["5","EE.EE","E.EE.","E...E",".EE.E","EE.EE"],["1 3","2 2","3 2","4 1","5 3"]],[["3",".EE",".EE",".EE"],["1 1","2 1","3 1"]],[["5","EE.EE","EE..E","EEE..","EE..E","EE.EE"],["1 3","2 3","3 4","4 3","5 3"]],[["1","E"],["-1"]],[["8","E.EEE..E","EEE.E.E.","EEE.E.E.","EE.E.E..","E...EE..","E.EE....","..EE....","E..E.EE."],["1 2","2 4","3 4","4 3","5 2","6 2","7 1","8 2"]],[["17","EE...E.EE.EE..E..","E.....EE..E..E..E","EEEE.EEEE..E..E.E",".E.E.EEE.EEEEE...","EEEEEEEEEEEEEEEEE","EE.E.EEEEE.E.....","..E.EE.EEE.E....E",".E..E..E...EE.E.E","EEEE.EEE.E.EEEE..","...E...EEEEEEE.E.","..E.E.EE..E.EE..E",".E..E..E.EEE.....",".E.....E..EEE.EE.","EE.E...E.EEEE.EE.","...EEEEEEE.E..E.E","EEEE.EEEEEE....E.","..EEEEEEE....EEEE"],["-1"]],[["17",".EEEEE...EEEE..EE","EEE..E...EEEEE..E",".E..E..EEE.EE...E",".EEE.EE..EE...E..","E..EEEEEE.EE.....","E.EE...EEEEEEE.E.","EEEE....EE..E.EEE","...EEEEE.E..EE...","EEE.E..EEEE.EEE..","..E.E....EEE.....","EE..E..E.E..EEEEE","EEE..E.EEEEE.E...","..EEEEE.E..EE.EE.","EE.E...E..E..E.EE","..E.EEE.EE..EE.E.","E..EE........E.E.","E..E..EEE.E...E.."],["1 1","2 4","3 1","4 1","5 2","6 2","7 5","8 1","9 4","10 1","11 3","12 4","13 1","14 3","15 1","16 2","17 2"]],[["1","."],["1 1"]],[["2","EE","EE"],["-1"]],[["2",".E",".E"],["1 1","2 1"]],[["3",".EE","EEE","EEE"],["-1"]],[["3","...","EEE","..E"],["1 1","1 2","1 3"]],[["4","E...","E.EE","EEEE","EEEE"],["-1"]],[["4","....","E..E","EEE.",".EE."],["1 1","2 2","3 4","4 1"]],[["8","E..EEEEE","EE..EEE.","EE..E...","EEE.E..E",".E.EEEE.","EEEEEEEE",".EEEE.EE",".EE.E.E."],["-1"]],[["3","E..","EEE","E.."],["-1"]],[["4","EEEE","..E.","..E.","..E."],["-1"]],[["3","..E",".EE",".EE"],["1 1","2 1","3 1"]],[["6",".EEEEE",".EEEEE","......","......","......","EEEEEE"],["1 1","3 2","3 3","3 4","3 5","3 6"]]]}} +{"instance_id":"pseudo_to_code_2k_170","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n let n and m be integers\n declare string called st\n read n and m\n res is an integer array with size m\n fill res with 0\n for i = 0 to n exclusive\n read st\n if there is no character \"1\" in st\n print -1 and a new line\n return to indicate successful execution\n end of the block\n cur is an integer array with 3 * m elements\n curAns is an array of integers with size m\n for j = 0 to 3 * m exclusive set cur[j] to st[j % m] - '0'\n declare integer called counter = 0\n for a = m - 1 to 0 inclusive counting down\n if cur[a] = 1\n break the loop\n else\n increase counter\n end of the block\n for k = m to 2 * m exclusive\n if cur[k] = 1\n curAns[k % m] = 0\n set counter to 0\n else\n increment counter and set curAns[k % m] = counter\n end of the block\n assign value of 0 to counter\n for a = 2 * m to 3 * m exclusive\n if cur[a] = 1\n stop the loop\n else\n increment counter\n end of the block\n for integer k = 2 * m - 1 to m inclusive counting down\n if cur[k] = 1\n curAns[k % m] = 0\n set value of counter to 0\n else\n increment counter\n curAns[k % m] = min of curAns[k % m] and counter\n end of the block\n end of the block\n for integer j = 0 to m exclusive increase res[j] by curAns[j]\n end of the block\n declare integer variable called min = INT_MAX\n for integer i = 0 to m exclusive\n if min is greater than res[i], set min to res[i]\n end of the block\n print min and a new line\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int n, m;\n string st;\n cin >> n >> m;\n int res[m];\n for (int i = 0; i < m; i++) { res[i] = 0; }\n for (int i = 0; i < n; i++) {\n cin >> st;\n if (st.find('1') == string::npos) {\n cout << -1 << endl;\n return 0;\n }\n int cur[3 * m];\n int curAns[m];\n for (int j = 0; j < 3 * m; j++) { cur[j] = st[j % m] - '0'; }\n int counter = 0;\n for (int a = m - 1; a >= 0; a--) {\n if (cur[a] == 1)\n break;\n else\n counter++;\n }\n for (int k = m; k < 2 * m; k++) {\n if (cur[k] == 1) {\n curAns[k % m] = 0;\n counter = 0;\n } else\n curAns[k % m] = ++counter;\n }\n counter = 0;\n for (int a = 2 * m; a < 3 * m; a++) {\n if (cur[a] == 1)\n break;\n else\n counter++;\n }\n for (int k = 2 * m - 1; k >= m; k--) {\n if (cur[k] == 1) {\n curAns[k % m] = 0;\n counter = 0;\n } else {\n counter++;\n curAns[k % m] = min(curAns[k % m], counter);\n }\n }\n for (int j = 0; j < m; j++) { res[j] += curAns[j]; }\n }\n int min = INT_MAX;\n for (int i = 0; i < m; i++) {\n if (min > res[i]) min = res[i];\n }\n cout << min << endl;\n return 0;\n}","item":{"problem_id":"229A","pseudocode":"define the main function\n let n and m be integers\n declare string called st\n read n and m\n res is an integer array with size m\n fill res with 0\n for i = 0 to n exclusive\n read st\n if there is no character \"1\" in st\n print -1 and a new line\n return to indicate successful execution\n end of the block\n cur is an integer array with 3 * m elements\n curAns is an array of integers with size m\n for j = 0 to 3 * m exclusive set cur[j] to st[j % m] - '0'\n declare integer called counter = 0\n for a = m - 1 to 0 inclusive counting down\n if cur[a] = 1\n break the loop\n else\n increase counter\n end of the block\n for k = m to 2 * m exclusive\n if cur[k] = 1\n curAns[k % m] = 0\n set counter to 0\n else\n increment counter and set curAns[k % m] = counter\n end of the block\n assign value of 0 to counter\n for a = 2 * m to 3 * m exclusive\n if cur[a] = 1\n stop the loop\n else\n increment counter\n end of the block\n for integer k = 2 * m - 1 to m inclusive counting down\n if cur[k] = 1\n curAns[k % m] = 0\n set value of counter to 0\n else\n increment counter\n curAns[k % m] = min of curAns[k % m] and counter\n end of the block\n end of the block\n for integer j = 0 to m exclusive increase res[j] by curAns[j]\n end of the block\n declare integer variable called min = INT_MAX\n for integer i = 0 to m exclusive\n if min is greater than res[i], set min to res[i]\n end of the block\n print min and a new line\n return to indicate successful execution\nend of the block","testcases":[[["3 6","101010","000100","100000"],["3"]],[["2 3","111","000"],["-1"]],[["1 1","1"],["0"]],[["1 1","0"],["-1"]],[["3 1","1","1","0"],["-1"]],[["6 2","10","11","01","01","10","11"],["2"]],[["3 3","001","010","100"],["2"]],[["4 4","0001","0100","0010","1000"],["4"]],[["5 5","10000","01000","00100","00010","00001"],["6"]],[["5 5","10001","00100","01000","01001","11111"],["2"]],[["5 5","11111","11111","11111","11111","00000"],["-1"]],[["5 10","0001000100","1000001000","0001000001","0100001010","0110100000"],["5"]],[["6 6","111000","011100","001110","000111","100011","110001"],["4"]],[["2 9","101010101","010101010"],["1"]],[["4 6","000001","100000","100000","100000"],["1"]],[["3 6","000010","010000","000100"],["3"]],[["4 10","0000101010","1010101010","0101010101","0000010100"],["2"]],[["10 10","0000000000","0000000010","0010000000","0111000010","1000000000","0000000100","0000000100","0000100100","0010000000","0000100000"],["-1"]],[["10 10","0000000000","0000001000","0000000100","0101000100","0000000000","0000000000","1000110000","1011010010","0000100000","0000001001"],["-1"]],[["10 10","0001001101","0010001010","1100000000","0110110110","1011011010","1001001001","0100010001","0110000100","0000100000","1000010000"],["8"]],[["10 10","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111"],["0"]],[["2 5","10000","00001"],["1"]],[["3 7","1000000","0000010","1000000"],["2"]],[["4 5","10010","11001","00010","11000"],["2"]],[["2 10","0000000001","1000000000"],["1"]],[["5 5","10000","10000","00001","10000","10000"],["1"]],[["3 4","0001","0001","1000"],["1"]],[["3 6","101010","000010","100000"],["2"]],[["4 7","0100000","0100000","0000001","0000001"],["4"]],[["5 1","0","0","0","0","0"],["-1"]],[["3 5","00001","10000","00001"],["1"]],[["3 1","0","0","0"],["-1"]]]}} +{"instance_id":"pseudo_to_code_2k_171","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nassign value 11000 to constant integer maxn\ncreate integer INF = 1 << 30\nlet m and n be integers\nda is an 2d array of integers with size 110 by maxn\njoo is an 2d array of integers with size 110 by maxn\ndefine the main function\n read m and n\n create string s\n for i = 0 to m exclusive\n read s\n for integer j = 0 to n exclusive set da[i][j] to 1 if s[j] = '1', 0 if it is not\n end of the block\n declare integers t and jj\n for i = 0 to m exclusive\n t = INF\n for j = 0 while j < n * 2\n jj = j % n\n if da[i][jj] = 1, set t to 0\n set joo[i][jj] = t and increment t\n end of the block\n t = INF\n for integer j = n * 2 to 0 inclusive counting down\n jj = j % n\n if da[i][jj] = 1, set t to 0\n joo[i][jj] = min of joo[i][jj] and t\n end of the block\n end of the block\n declare long longs mi = INF and sum\n for integer j = 0 to n exclusive\n assign value of 0 to sum\n for integer i = 0 to m exclusive add joo[i][j] to sum\n set mi to min of sum and mi\n end of the block\n if mi >= INF\n print -1 and a new line\n else\n print mi and a new line\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int maxn = 11000;\nint INF = 1 << 30;\nint m, n;\nint da[110][maxn];\nint joo[110][maxn];\nint main() {\n cin >> m >> n;\n string s;\n for (int i = 0; i < m; i++) {\n cin >> s;\n for (int j = 0; j < n; j++) da[i][j] = (s[j] == '1' ? 1 : 0);\n }\n int t, jj;\n for (int i = 0; i < m; i++) {\n t = INF;\n for (int j = 0; j < n * 2; j++) {\n jj = j % n;\n if (da[i][jj] == 1) t = 0;\n joo[i][jj] = t++;\n }\n t = INF;\n for (int j = n * 2; j >= 0; j--) {\n jj = j % n;\n if (da[i][jj] == 1) t = 0;\n joo[i][jj] = min(joo[i][jj], t++);\n }\n }\n long long mi = INF, sum;\n for (int j = 0; j < n; j++) {\n sum = 0;\n for (int i = 0; i < m; i++) { sum += joo[i][j]; }\n mi = min(sum, mi);\n }\n if (mi >= INF)\n cout << -1 << endl;\n else\n cout << mi << endl;\n return 0;\n}","item":{"problem_id":"229A","pseudocode":"assign value 11000 to constant integer maxn\ncreate integer INF = 1 << 30\nlet m and n be integers\nda is an 2d array of integers with size 110 by maxn\njoo is an 2d array of integers with size 110 by maxn\ndefine the main function\n read m and n\n create string s\n for i = 0 to m exclusive\n read s\n for integer j = 0 to n exclusive set da[i][j] to 1 if s[j] = '1', 0 if it is not\n end of the block\n declare integers t and jj\n for i = 0 to m exclusive\n t = INF\n for j = 0 while j < n * 2\n jj = j % n\n if da[i][jj] = 1, set t to 0\n set joo[i][jj] = t and increment t\n end of the block\n t = INF\n for integer j = n * 2 to 0 inclusive counting down\n jj = j % n\n if da[i][jj] = 1, set t to 0\n joo[i][jj] = min of joo[i][jj] and t\n end of the block\n end of the block\n declare long longs mi = INF and sum\n for integer j = 0 to n exclusive\n assign value of 0 to sum\n for integer i = 0 to m exclusive add joo[i][j] to sum\n set mi to min of sum and mi\n end of the block\n if mi >= INF\n print -1 and a new line\n else\n print mi and a new line\n return to indicate successful execution\nend of the block","testcases":[[["3 6","101010","000100","100000"],["3"]],[["2 3","111","000"],["-1"]],[["1 1","1"],["0"]],[["1 1","0"],["-1"]],[["3 1","1","1","0"],["-1"]],[["6 2","10","11","01","01","10","11"],["2"]],[["3 3","001","010","100"],["2"]],[["4 4","0001","0100","0010","1000"],["4"]],[["5 5","10000","01000","00100","00010","00001"],["6"]],[["5 5","10001","00100","01000","01001","11111"],["2"]],[["5 5","11111","11111","11111","11111","00000"],["-1"]],[["5 10","0001000100","1000001000","0001000001","0100001010","0110100000"],["5"]],[["6 6","111000","011100","001110","000111","100011","110001"],["4"]],[["2 9","101010101","010101010"],["1"]],[["4 6","000001","100000","100000","100000"],["1"]],[["3 6","000010","010000","000100"],["3"]],[["4 10","0000101010","1010101010","0101010101","0000010100"],["2"]],[["10 10","0000000000","0000000010","0010000000","0111000010","1000000000","0000000100","0000000100","0000100100","0010000000","0000100000"],["-1"]],[["10 10","0000000000","0000001000","0000000100","0101000100","0000000000","0000000000","1000110000","1011010010","0000100000","0000001001"],["-1"]],[["10 10","0001001101","0010001010","1100000000","0110110110","1011011010","1001001001","0100010001","0110000100","0000100000","1000010000"],["8"]],[["10 10","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111"],["0"]],[["2 5","10000","00001"],["1"]],[["3 7","1000000","0000010","1000000"],["2"]],[["4 5","10010","11001","00010","11000"],["2"]],[["2 10","0000000001","1000000000"],["1"]],[["5 5","10000","10000","00001","10000","10000"],["1"]],[["3 4","0001","0001","1000"],["1"]],[["3 6","101010","000010","100000"],["2"]],[["4 7","0100000","0100000","0000001","0000001"],["4"]],[["5 1","0","0","0","0","0"],["-1"]],[["3 5","00001","10000","00001"],["1"]],[["3 1","0","0","0"],["-1"]]]}} +{"instance_id":"pseudo_to_code_2k_172","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create integers n, m\n read n read m\n create 2d character array a of size n by m\n for i = 0 to n exclusive\n for j = 0 to m exclusive, read a[i][j]\n end of the block\n for i = 0 to n exclusive\n if not count of '1' from a[i] to a[i] + m\n print -1 print '\\n'\n return to indicate successful execution\n end of the block\n end of the block\n create 2d integer arrays nearest, l, r, with nearest size n by m, l size n by m, r size n by m\n for i = 0 to n exclusive\n create integer lst with lst = -1\n for j = 0 to m exclusive\n if a[i][j] is '1', set lst to j\n end of the block\n create boolean c with c = true\n for j = 0 to m exclusive\n set lst to j if a[i][j] is '1', else lst\n set c to (c bitwise and a[i][j]) is 0\n set l[i][j] to m - lst + j if c is true, else absolute value of j - lst\n end of the block\n set lst to -1\n set c to true\n for j = 0 to m exclusive\n if a[i][j] is '1'\n set lst to j\n break loop\n end of the block\n end of the block\n for j = m - 1 to 0 inclusive, decrementing j\n set lst to j if a[i][j] is '1', else lst\n set c to (c bitwise and a[i][j]) is 0\n set r[i][j] to lst + 1 + m - ( j + 1 ) if c is true, else absolute value of j - lst\n end of the block\n end of the block\n for i = 0 to n exclusive\n for j = 0 to m exclusive, set nearest[i][j] to minimum of r[i][j] and l[i][j]\n end of the block\n create integer ans with ans = 0x3f3f3f3f\n for j = 0 to m exclusive\n create integer cur with cur = 0\n for i = 0 to n exclusive, increment cur by nearest[i][j]\n set ans to minimum of ans and cur\n end of the block\n print ans print '\\n'\nend of the block\n\n[CODE]:","reference_output":"int main() {\n int n, m;\n cin >> n >> m;\n char a[n][m];\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < m; ++j) { cin >> a[i][j]; }\n }\n for (int i = 0; i < n; ++i) {\n if (!count(a[i], a[i] + m, '1')) {\n cout << -1 << '\\n';\n return 0;\n }\n }\n int nearest[n][m], l[n][m], r[n][m];\n for (int i = 0; i < n; ++i) {\n int lst = -1;\n for (int j = 0; j < m; ++j) {\n if (a[i][j] == '1') lst = j;\n }\n bool c = true;\n for (int j = 0; j < m; ++j) {\n lst = (a[i][j] == '1' ? j : lst);\n c &= a[i][j] == '0';\n l[i][j] = (c ? m - lst + j : abs(j - lst));\n }\n lst = -1;\n c = true;\n for (int j = 0; j < m; ++j) {\n if (a[i][j] == '1') {\n lst = j;\n break;\n }\n }\n for (int j = m - 1; j >= 0; --j) {\n lst = (a[i][j] == '1' ? j : lst);\n c &= a[i][j] == '0';\n r[i][j] = (c ? lst + 1 + m - (j + 1) : abs(j - lst));\n }\n }\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < m; ++j) { nearest[i][j] = min(r[i][j], l[i][j]); }\n }\n int ans = 0x3f3f3f3f;\n for (int j = 0; j < m; ++j) {\n int cur = 0;\n for (int i = 0; i < n; ++i) { cur += nearest[i][j]; }\n ans = min(ans, cur);\n }\n cout << ans << '\\n';\n}","item":{"problem_id":"229A","pseudocode":"define the main function\n create integers n, m\n read n read m\n create 2d character array a of size n by m\n for i = 0 to n exclusive\n for j = 0 to m exclusive, read a[i][j]\n end of the block\n for i = 0 to n exclusive\n if not count of '1' from a[i] to a[i] + m\n print -1 print '\\n'\n return to indicate successful execution\n end of the block\n end of the block\n create 2d integer arrays nearest, l, r, with nearest size n by m, l size n by m, r size n by m\n for i = 0 to n exclusive\n create integer lst with lst = -1\n for j = 0 to m exclusive\n if a[i][j] is '1', set lst to j\n end of the block\n create boolean c with c = true\n for j = 0 to m exclusive\n set lst to j if a[i][j] is '1', else lst\n set c to (c bitwise and a[i][j]) is 0\n set l[i][j] to m - lst + j if c is true, else absolute value of j - lst\n end of the block\n set lst to -1\n set c to true\n for j = 0 to m exclusive\n if a[i][j] is '1'\n set lst to j\n break loop\n end of the block\n end of the block\n for j = m - 1 to 0 inclusive, decrementing j\n set lst to j if a[i][j] is '1', else lst\n set c to (c bitwise and a[i][j]) is 0\n set r[i][j] to lst + 1 + m - ( j + 1 ) if c is true, else absolute value of j - lst\n end of the block\n end of the block\n for i = 0 to n exclusive\n for j = 0 to m exclusive, set nearest[i][j] to minimum of r[i][j] and l[i][j]\n end of the block\n create integer ans with ans = 0x3f3f3f3f\n for j = 0 to m exclusive\n create integer cur with cur = 0\n for i = 0 to n exclusive, increment cur by nearest[i][j]\n set ans to minimum of ans and cur\n end of the block\n print ans print '\\n'\nend of the block","testcases":[[["3 6","101010","000100","100000"],["3"]],[["2 3","111","000"],["-1"]],[["1 1","1"],["0"]],[["1 1","0"],["-1"]],[["3 1","1","1","0"],["-1"]],[["6 2","10","11","01","01","10","11"],["2"]],[["3 3","001","010","100"],["2"]],[["4 4","0001","0100","0010","1000"],["4"]],[["5 5","10000","01000","00100","00010","00001"],["6"]],[["5 5","10001","00100","01000","01001","11111"],["2"]],[["5 5","11111","11111","11111","11111","00000"],["-1"]],[["5 10","0001000100","1000001000","0001000001","0100001010","0110100000"],["5"]],[["6 6","111000","011100","001110","000111","100011","110001"],["4"]],[["2 9","101010101","010101010"],["1"]],[["4 6","000001","100000","100000","100000"],["1"]],[["3 6","000010","010000","000100"],["3"]],[["4 10","0000101010","1010101010","0101010101","0000010100"],["2"]],[["10 10","0000000000","0000000010","0010000000","0111000010","1000000000","0000000100","0000000100","0000100100","0010000000","0000100000"],["-1"]],[["10 10","0000000000","0000001000","0000000100","0101000100","0000000000","0000000000","1000110000","1011010010","0000100000","0000001001"],["-1"]],[["10 10","0001001101","0010001010","1100000000","0110110110","1011011010","1001001001","0100010001","0110000100","0000100000","1000010000"],["8"]],[["10 10","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111"],["0"]],[["2 5","10000","00001"],["1"]],[["3 7","1000000","0000010","1000000"],["2"]],[["4 5","10010","11001","00010","11000"],["2"]],[["2 10","0000000001","1000000000"],["1"]],[["5 5","10000","10000","00001","10000","10000"],["1"]],[["3 4","0001","0001","1000"],["1"]],[["3 6","101010","000010","100000"],["2"]],[["4 7","0100000","0100000","0000001","0000001"],["4"]],[["5 1","0","0","0","0","0"],["-1"]],[["3 5","00001","10000","00001"],["1"]],[["3 1","0","0","0"],["-1"]]]}} +{"instance_id":"pseudo_to_code_2k_173","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate constant integer maxn with maxn = 2e5 + 10\ncreate integers n, m\ncreate string array s with size 110\ncreate 2d integer array l with size 110 by 10010\ncreate 2d integer array r with size 110 by 10010\ndefine the main function\n read n read m\n for i = 0 to n exclusive, read s[i]\n create boolean bad with bad = false\n for i = 0 to n exclusive\n create integer last with last = -1\n for j = 0 to m exclusive\n if s[i][j] is '0'\n set l[i][j] to -1 if last is -1, else j - last\n else\n set l[i][j] to 0, set last to j\n if last is less than 0, set bad to true\n set last to -1\n for j = m - 1 to 0 inclusive, decrementing j\n if s[i][j] is '0'\n set r[i][j] to -1 if last is -1, else last - j\n else\n set r[i][j] to 0, set last to j\n for j = 0 to m exclusive\n if l[i][j] is less than 0, set l[i][j] to j + l[i][m-1] + 1\n for j = m - 1 to 0 inclusive, decrementing j\n if r[i][j] is less than 0, set r[i][j] to (m - 1) - j + r[i][0] + 1\n end of the block\n if bad is true\n print -1 print \"\\n\"\n return to indicate successful execution\n end of the block\n create long long ans with ans = n * m + 1\n for j = 0 to m exclusive\n create long long cur with cur = 0\n for i = 0 to n exclusive, increment cur by minimum of l[i][j] and r[i][j]\n set ans to minimum of ans and cur\n end of the block\n print ans print \"\\n\"\nend of the block\n\n[CODE]:","reference_output":"const int maxn = 2e5 + 10;\nint n, m;\nstring s[110];\nint l[110][10010];\nint r[110][10010];\nint main() {\n cin >> n >> m;\n for (int i = 0; i < n; ++i) cin >> s[i];\n bool bad = false;\n for (int i = 0; i < n; ++i) {\n int last = -1;\n for (int j = 0; j < m; ++j)\n if (s[i][j] == '0')\n l[i][j] = (last == -1 ? -1 : j - last);\n else\n l[i][j] = 0, last = j;\n if (last < 0) bad = true;\n last = -1;\n for (int j = m - 1; j >= 0; --j)\n if (s[i][j] == '0')\n r[i][j] = (last == -1 ? -1 : last - j);\n else\n r[i][j] = 0, last = j;\n for (int j = 0; j < m; ++j)\n if (l[i][j] < 0) l[i][j] = j + l[i][m - 1] + 1;\n for (int j = m - 1; j >= 0; --j)\n if (r[i][j] < 0) r[i][j] = (m - 1) - j + r[i][0] + 1;\n }\n if (bad) {\n cout << -1 << \"\\n\";\n return 0;\n }\n long long ans = n * m + 1;\n for (int j = 0; j < m; ++j) {\n long long cur = 0;\n for (int i = 0; i < n; ++i) cur += min(l[i][j], r[i][j]);\n ans = min(ans, cur);\n }\n cout << ans << \"\\n\";\n}","item":{"problem_id":"229A","pseudocode":"create constant integer maxn with maxn = 2e5 + 10\ncreate integers n, m\ncreate string array s with size 110\ncreate 2d integer array l with size 110 by 10010\ncreate 2d integer array r with size 110 by 10010\ndefine the main function\n read n read m\n for i = 0 to n exclusive, read s[i]\n create boolean bad with bad = false\n for i = 0 to n exclusive\n create integer last with last = -1\n for j = 0 to m exclusive\n if s[i][j] is '0'\n set l[i][j] to -1 if last is -1, else j - last\n else\n set l[i][j] to 0, set last to j\n if last is less than 0, set bad to true\n set last to -1\n for j = m - 1 to 0 inclusive, decrementing j\n if s[i][j] is '0'\n set r[i][j] to -1 if last is -1, else last - j\n else\n set r[i][j] to 0, set last to j\n for j = 0 to m exclusive\n if l[i][j] is less than 0, set l[i][j] to j + l[i][m-1] + 1\n for j = m - 1 to 0 inclusive, decrementing j\n if r[i][j] is less than 0, set r[i][j] to (m - 1) - j + r[i][0] + 1\n end of the block\n if bad is true\n print -1 print \"\\n\"\n return to indicate successful execution\n end of the block\n create long long ans with ans = n * m + 1\n for j = 0 to m exclusive\n create long long cur with cur = 0\n for i = 0 to n exclusive, increment cur by minimum of l[i][j] and r[i][j]\n set ans to minimum of ans and cur\n end of the block\n print ans print \"\\n\"\nend of the block","testcases":[[["3 6","101010","000100","100000"],["3"]],[["2 3","111","000"],["-1"]],[["1 1","1"],["0"]],[["1 1","0"],["-1"]],[["3 1","1","1","0"],["-1"]],[["6 2","10","11","01","01","10","11"],["2"]],[["3 3","001","010","100"],["2"]],[["4 4","0001","0100","0010","1000"],["4"]],[["5 5","10000","01000","00100","00010","00001"],["6"]],[["5 5","10001","00100","01000","01001","11111"],["2"]],[["5 5","11111","11111","11111","11111","00000"],["-1"]],[["5 10","0001000100","1000001000","0001000001","0100001010","0110100000"],["5"]],[["6 6","111000","011100","001110","000111","100011","110001"],["4"]],[["2 9","101010101","010101010"],["1"]],[["4 6","000001","100000","100000","100000"],["1"]],[["3 6","000010","010000","000100"],["3"]],[["4 10","0000101010","1010101010","0101010101","0000010100"],["2"]],[["10 10","0000000000","0000000010","0010000000","0111000010","1000000000","0000000100","0000000100","0000100100","0010000000","0000100000"],["-1"]],[["10 10","0000000000","0000001000","0000000100","0101000100","0000000000","0000000000","1000110000","1011010010","0000100000","0000001001"],["-1"]],[["10 10","0001001101","0010001010","1100000000","0110110110","1011011010","1001001001","0100010001","0110000100","0000100000","1000010000"],["8"]],[["10 10","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111"],["0"]],[["2 5","10000","00001"],["1"]],[["3 7","1000000","0000010","1000000"],["2"]],[["4 5","10010","11001","00010","11000"],["2"]],[["2 10","0000000001","1000000000"],["1"]],[["5 5","10000","10000","00001","10000","10000"],["1"]],[["3 4","0001","0001","1000"],["1"]],[["3 6","101010","000010","100000"],["2"]],[["4 7","0100000","0100000","0000001","0000001"],["4"]],[["5 1","0","0","0","0","0"],["-1"]],[["3 5","00001","10000","00001"],["1"]],[["3 1","0","0","0"],["-1"]]]}} +{"instance_id":"pseudo_to_code_2k_174","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndist = array of 2 by 10004 int\ndefine the main function\n n, m = int\n read n and m\n for i = 0 to n exclusive\n str = string\n read str\n firstone = -1\n ff = 0\n while ff < m and str[ff] is not '1' increment ff\n if ff is m\n print -1\n return to indicate successful execution\n end of the block\n firstone = ff\n dist[0][ff] = 0\n j = ff+1 modulo m\n while true\n if str[j] is '1'\n dist[0][j] = 0\n k = j\n while dist[0][k] < dist[0][k-1+m modulo m\n k = k-1+m modulo m\n dist[0][k] = dist[0][k+1 modulo m]+1\n end of the block\n if j is firstone break\n else\n dist[0][j] = dist[0][j+m-1 modulo m]+1\n end of the block\n j = j+1 modulo m\n end of the block\n for z = 0 to m exclusive\n increment dist[1][z] by dist[0][z]\n dist[0][z] = 0\n end of the block\n end of the block\n minn = dist[1][0]\n for h = 1 to m exclusive\n if dist[1][h] < minn minn = dist[1][h]\n end of the block\n print minn\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int dist[2][10004];\nint main() {\n int n, m;\n cin >> n >> m;\n for (int i = 0; i < n; i++) {\n string str;\n cin >> str;\n int firstone = -1;\n int ff = 0;\n while (ff < m && str[ff] != '1') ff++;\n if (ff == m) {\n cout << -1 << endl;\n return 0;\n }\n firstone = ff;\n dist[0][ff] = 0;\n int j = (ff + 1) % m;\n while (true) {\n if (str[j] == '1') {\n dist[0][j] = 0;\n int k = j;\n while (dist[0][k] < dist[0][(k - 1 + m) % m]) {\n k = (k - 1 + m) % m;\n dist[0][k] = dist[0][(k + 1) % m] + 1;\n }\n if (j == firstone) break;\n } else {\n dist[0][j] = dist[0][(j + m - 1) % m] + 1;\n }\n j = (j + 1) % m;\n }\n for (int z = 0; z < m; z++) {\n dist[1][z] += dist[0][z];\n dist[0][z] = 0;\n }\n }\n int minn = dist[1][0];\n for (int h = 1; h < m; h++) {\n if (dist[1][h] < minn) { minn = dist[1][h]; }\n }\n cout << minn << endl;\n return 0;\n}","item":{"problem_id":"229A","pseudocode":"dist = array of 2 by 10004 int\ndefine the main function\n n, m = int\n read n and m\n for i = 0 to n exclusive\n str = string\n read str\n firstone = -1\n ff = 0\n while ff < m and str[ff] is not '1' increment ff\n if ff is m\n print -1\n return to indicate successful execution\n end of the block\n firstone = ff\n dist[0][ff] = 0\n j = ff+1 modulo m\n while true\n if str[j] is '1'\n dist[0][j] = 0\n k = j\n while dist[0][k] < dist[0][k-1+m modulo m\n k = k-1+m modulo m\n dist[0][k] = dist[0][k+1 modulo m]+1\n end of the block\n if j is firstone break\n else\n dist[0][j] = dist[0][j+m-1 modulo m]+1\n end of the block\n j = j+1 modulo m\n end of the block\n for z = 0 to m exclusive\n increment dist[1][z] by dist[0][z]\n dist[0][z] = 0\n end of the block\n end of the block\n minn = dist[1][0]\n for h = 1 to m exclusive\n if dist[1][h] < minn minn = dist[1][h]\n end of the block\n print minn\n return to indicate successful execution\nend of the block","testcases":[[["3 6","101010","000100","100000"],["3"]],[["2 3","111","000"],["-1"]],[["1 1","1"],["0"]],[["1 1","0"],["-1"]],[["3 1","1","1","0"],["-1"]],[["6 2","10","11","01","01","10","11"],["2"]],[["3 3","001","010","100"],["2"]],[["4 4","0001","0100","0010","1000"],["4"]],[["5 5","10000","01000","00100","00010","00001"],["6"]],[["5 5","10001","00100","01000","01001","11111"],["2"]],[["5 5","11111","11111","11111","11111","00000"],["-1"]],[["5 10","0001000100","1000001000","0001000001","0100001010","0110100000"],["5"]],[["6 6","111000","011100","001110","000111","100011","110001"],["4"]],[["2 9","101010101","010101010"],["1"]],[["4 6","000001","100000","100000","100000"],["1"]],[["3 6","000010","010000","000100"],["3"]],[["4 10","0000101010","1010101010","0101010101","0000010100"],["2"]],[["10 10","0000000000","0000000010","0010000000","0111000010","1000000000","0000000100","0000000100","0000100100","0010000000","0000100000"],["-1"]],[["10 10","0000000000","0000001000","0000000100","0101000100","0000000000","0000000000","1000110000","1011010010","0000100000","0000001001"],["-1"]],[["10 10","0001001101","0010001010","1100000000","0110110110","1011011010","1001001001","0100010001","0110000100","0000100000","1000010000"],["8"]],[["10 10","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111"],["0"]],[["2 5","10000","00001"],["1"]],[["3 7","1000000","0000010","1000000"],["2"]],[["4 5","10010","11001","00010","11000"],["2"]],[["2 10","0000000001","1000000000"],["1"]],[["5 5","10000","10000","00001","10000","10000"],["1"]],[["3 4","0001","0001","1000"],["1"]],[["3 6","101010","000010","100000"],["2"]],[["4 7","0100000","0100000","0000001","0000001"],["4"]],[["5 1","0","0","0","0","0"],["-1"]],[["3 5","00001","10000","00001"],["1"]],[["3 1","0","0","0"],["-1"]]]}} +{"instance_id":"pseudo_to_code_2k_175","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ninteger constant INF = 1 << 29\ndefine the main function\n declare integer variables n and m\n read n and m\n a is an array of strings with size n\n read n elements into a\n ans is an array of integers with size m\n set m elements of ans to 0\n chk is integer\n for i = 0 to n exclusive\n set value of chk to 0\n for integer j = 0 to m exclusive, increment chk by 1 if a[i][j] = '1'\n if chk = 0\n print \"-1\\n\"\n return to indicate successful execution\n end of the block\n end of the block\n for i = 0 to n exclusive\n declare integer called last\n declare boolean variable called found = 0\n for j = m - 1 to 0 inclusive counting down\n if a[i][j] = '1'\n set value of last to j\n stop the loop\n end of the block\n end of the block\n , curr is an array of integers with size m\n for j = 0 to m exclusive, curr[j] = INT_MAX\n for j = 0 to m exclusive\n if a[i][j] = '1'\n set value of last to j\n found = 1\n end of the block\n if found is 0\n curr[j] = min(curr[j], (m - last) + j)\n else\n curr[j] = min of curr[j] and abs(j - last)\n end of the block\n end of the block\n found = 0\n for j = 0 to m exclusive\n if a[i][j] = '1'\n last = j\n break the loop\n end of the block\n end of the block\n for integer j = m - 1 to 0 inclusive counting down\n if a[i][j] = '1'\n set value of last to j\n assign value of 1 to found\n end of the block\n if found is 0\n curr[j] = min(curr[j], (last + 1) + (m - 1 - j))\n else\n curr[j] = min(curr[j], abs(j - last))\n end of the block\n end of the block\n for integer j = 0 to m exclusive increment ans[j] by curr[j]\n end of the block\n res is integer = INT_MAX\n for i = 0 to m exclusive, set res to min(res, ans[i])\n print res and a new line\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int INF = 1 << 29;\nint main() {\n int n, m;\n cin >> n >> m;\n string a[n];\n for (int i = 0; i < (n); i++) cin >> a[i];\n int ans[m];\n for (int i = 0; i < (m); i++) ans[i] = 0;\n int chk;\n for (int i = 0; i < (n); i++) {\n chk = 0;\n for (int j = 0; j < (m); j++) { chk += (a[i][j] == '1'); }\n if (chk == 0) {\n cout << \"-1\\n\";\n return 0;\n }\n }\n for (int i = 0; i < (n); i++) {\n int last;\n bool found = 0;\n for (int j = m - 1; j >= 0; --j) {\n if (a[i][j] == '1') {\n last = j;\n break;\n }\n }\n int curr[m];\n for (int j = 0; j < (m); j++) curr[j] = INT_MAX;\n for (int j = 0; j < (m); j++) {\n if (a[i][j] == '1') {\n last = j;\n found = 1;\n }\n if (!found) {\n curr[j] = min(curr[j], (m - last) + j);\n } else {\n curr[j] = min(curr[j], abs(j - last));\n }\n }\n found = 0;\n for (int j = 0; j < m; ++j) {\n if (a[i][j] == '1') {\n last = j;\n break;\n }\n }\n for (int j = m - 1; j >= 0; --j) {\n if (a[i][j] == '1') {\n last = j;\n found = 1;\n }\n if (!found) {\n curr[j] = min(curr[j], (last + 1) + (m - 1 - j));\n } else {\n curr[j] = min(curr[j], abs(j - last));\n }\n }\n for (int j = 0; j < (m); j++) ans[j] += curr[j];\n }\n int res = INT_MAX;\n for (int i = 0; i < (m); i++) res = min(res, ans[i]);\n cout << res << endl;\n return 0;\n}","item":{"problem_id":"229A","pseudocode":"integer constant INF = 1 << 29\ndefine the main function\n declare integer variables n and m\n read n and m\n a is an array of strings with size n\n read n elements into a\n ans is an array of integers with size m\n set m elements of ans to 0\n chk is integer\n for i = 0 to n exclusive\n set value of chk to 0\n for integer j = 0 to m exclusive, increment chk by 1 if a[i][j] = '1'\n if chk = 0\n print \"-1\\n\"\n return to indicate successful execution\n end of the block\n end of the block\n for i = 0 to n exclusive\n declare integer called last\n declare boolean variable called found = 0\n for j = m - 1 to 0 inclusive counting down\n if a[i][j] = '1'\n set value of last to j\n stop the loop\n end of the block\n end of the block\n , curr is an array of integers with size m\n for j = 0 to m exclusive, curr[j] = INT_MAX\n for j = 0 to m exclusive\n if a[i][j] = '1'\n set value of last to j\n found = 1\n end of the block\n if found is 0\n curr[j] = min(curr[j], (m - last) + j)\n else\n curr[j] = min of curr[j] and abs(j - last)\n end of the block\n end of the block\n found = 0\n for j = 0 to m exclusive\n if a[i][j] = '1'\n last = j\n break the loop\n end of the block\n end of the block\n for integer j = m - 1 to 0 inclusive counting down\n if a[i][j] = '1'\n set value of last to j\n assign value of 1 to found\n end of the block\n if found is 0\n curr[j] = min(curr[j], (last + 1) + (m - 1 - j))\n else\n curr[j] = min(curr[j], abs(j - last))\n end of the block\n end of the block\n for integer j = 0 to m exclusive increment ans[j] by curr[j]\n end of the block\n res is integer = INT_MAX\n for i = 0 to m exclusive, set res to min(res, ans[i])\n print res and a new line\n return to indicate successful execution\nend of the block","testcases":[[["3 6","101010","000100","100000"],["3"]],[["2 3","111","000"],["-1"]],[["1 1","1"],["0"]],[["1 1","0"],["-1"]],[["3 1","1","1","0"],["-1"]],[["6 2","10","11","01","01","10","11"],["2"]],[["3 3","001","010","100"],["2"]],[["4 4","0001","0100","0010","1000"],["4"]],[["5 5","10000","01000","00100","00010","00001"],["6"]],[["5 5","10001","00100","01000","01001","11111"],["2"]],[["5 5","11111","11111","11111","11111","00000"],["-1"]],[["5 10","0001000100","1000001000","0001000001","0100001010","0110100000"],["5"]],[["6 6","111000","011100","001110","000111","100011","110001"],["4"]],[["2 9","101010101","010101010"],["1"]],[["4 6","000001","100000","100000","100000"],["1"]],[["3 6","000010","010000","000100"],["3"]],[["4 10","0000101010","1010101010","0101010101","0000010100"],["2"]],[["10 10","0000000000","0000000010","0010000000","0111000010","1000000000","0000000100","0000000100","0000100100","0010000000","0000100000"],["-1"]],[["10 10","0000000000","0000001000","0000000100","0101000100","0000000000","0000000000","1000110000","1011010010","0000100000","0000001001"],["-1"]],[["10 10","0001001101","0010001010","1100000000","0110110110","1011011010","1001001001","0100010001","0110000100","0000100000","1000010000"],["8"]],[["10 10","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111","1111111111"],["0"]],[["2 5","10000","00001"],["1"]],[["3 7","1000000","0000010","1000000"],["2"]],[["4 5","10010","11001","00010","11000"],["2"]],[["2 10","0000000001","1000000000"],["1"]],[["5 5","10000","10000","00001","10000","10000"],["1"]],[["3 4","0001","0001","1000"],["1"]],[["3 6","101010","000010","100000"],["2"]],[["4 7","0100000","0100000","0000001","0000001"],["4"]],[["5 1","0","0","0","0","0"],["-1"]],[["3 5","00001","10000","00001"],["1"]],[["3 1","0","0","0"],["-1"]]]}} +{"instance_id":"pseudo_to_code_2k_176","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nMAXN = a constant set to 100005\nMOD = and constant set to 998244353\na = an array of integers with a length of MAXN\ndp = a 2 dimentional array of integers with a length of 201\nnewdp = a 2 dimentional array of integers with a length of 201\ndefine the main function\n n = integer\n read n\n for i = 0 to n exclusive, read index i of a\n for i = 0 to n exclusive\n if i = 0\n if index i of a = -1\n for x = 1 to 200 inclusive, set newdp[x][0] = 1\n else\n newdp[a[i]][0] = 1\n end of the block\n else\n if index i of a = -1\n flag0 = integer set to 0\n flag1 = integer set to 0\n for y = 1 to 200 inclusive\n add dp[y][1] to flag1\n modulo flag1 by MOD\n end of the block\n for x = 1 to 200 inclusive\n subtract dp[x - 1][1] from flag1\n add MOD to flag1\n modulo flag1 by MOD\n subtract dp[x - 1][0] from flag1\n add MOD to flag1\n modulo flag1 by MOD\n add dp[x - 1][1] to flag0\n modulo flag0 by MOD\n add dp[x - 1][0] to flag0\n modulo flag0 by MOD\n add dp[x][0] to flag1\n modulo flag1 by MOD\n set newdp[x][0] to flag0\n set newdp[x][1] to flag1\n end of the block\n else\n x = integer set to index i of a\n for y = 1 to 200 inclusive\n flag = integer set to 1 if x <= y or 0\n add dp[y][1] to newdp[x][flag]\n modulo newdp[x][flag] by MOD\n if y <= x\n add dp[y][0] to newdp[x][flag]\n modulo newdp[x][flag] by MOD\n end of the block\n end of the block\n end of the block\n end of the block\n run memcpy with dp, newdp and 201 * 2 * 4 as arguments\n run memset with newdp, 0, and 201 * 2 * 4 as arguments\n end of the block\n ans = integer set to 0\n for x = 1 to 200 inclusive\n add dp[x][1] to ans\n modulo ans by MOD\n end of the block\n read ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int MAXN = 100005;\nconst int MOD = 998244353;\nint a[MAXN];\nint dp[201][2];\nint newdp[201][2];\nint main() {\n int n;\n cin >> n;\n for (int i = 0; i < n; ++i) { cin >> a[i]; }\n for (int i = 0; i < n; ++i) {\n if (i == 0) {\n if (a[i] == -1) {\n for (int x = 1; x <= 200; ++x) { newdp[x][0] = 1; }\n } else {\n newdp[a[i]][0] = 1;\n }\n } else {\n if (a[i] == -1) {\n int flag0 = 0;\n int flag1 = 0;\n for (int y = 1; y <= 200; ++y) {\n flag1 += dp[y][1];\n flag1 %= MOD;\n }\n for (int x = 1; x <= 200; ++x) {\n flag1 -= dp[x - 1][1];\n flag1 += MOD;\n flag1 %= MOD;\n flag1 -= dp[x - 1][0];\n flag1 += MOD;\n flag1 %= MOD;\n flag0 += dp[x - 1][1];\n flag0 %= MOD;\n flag0 += dp[x - 1][0];\n flag0 %= MOD;\n flag1 += dp[x][0];\n flag1 %= MOD;\n newdp[x][0] = flag0;\n newdp[x][1] = flag1;\n }\n } else {\n int x = a[i];\n for (int y = 1; y <= 200; ++y) {\n int flag = x <= y ? 1 : 0;\n newdp[x][flag] += dp[y][1];\n newdp[x][flag] %= MOD;\n if (y <= x) {\n newdp[x][flag] += dp[y][0];\n newdp[x][flag] %= MOD;\n }\n }\n }\n }\n memcpy(dp, newdp, 201 * 2 * 4);\n memset(newdp, 0, 201 * 2 * 4);\n }\n int ans = 0;\n for (int x = 1; x <= 200; ++x) {\n ans += dp[x][1];\n ans %= MOD;\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"1067A","pseudocode":"MAXN = a constant set to 100005\nMOD = and constant set to 998244353\na = an array of integers with a length of MAXN\ndp = a 2 dimentional array of integers with a length of 201\nnewdp = a 2 dimentional array of integers with a length of 201\ndefine the main function\n n = integer\n read n\n for i = 0 to n exclusive, read index i of a\n for i = 0 to n exclusive\n if i = 0\n if index i of a = -1\n for x = 1 to 200 inclusive, set newdp[x][0] = 1\n else\n newdp[a[i]][0] = 1\n end of the block\n else\n if index i of a = -1\n flag0 = integer set to 0\n flag1 = integer set to 0\n for y = 1 to 200 inclusive\n add dp[y][1] to flag1\n modulo flag1 by MOD\n end of the block\n for x = 1 to 200 inclusive\n subtract dp[x - 1][1] from flag1\n add MOD to flag1\n modulo flag1 by MOD\n subtract dp[x - 1][0] from flag1\n add MOD to flag1\n modulo flag1 by MOD\n add dp[x - 1][1] to flag0\n modulo flag0 by MOD\n add dp[x - 1][0] to flag0\n modulo flag0 by MOD\n add dp[x][0] to flag1\n modulo flag1 by MOD\n set newdp[x][0] to flag0\n set newdp[x][1] to flag1\n end of the block\n else\n x = integer set to index i of a\n for y = 1 to 200 inclusive\n flag = integer set to 1 if x <= y or 0\n add dp[y][1] to newdp[x][flag]\n modulo newdp[x][flag] by MOD\n if y <= x\n add dp[y][0] to newdp[x][flag]\n modulo newdp[x][flag] by MOD\n end of the block\n end of the block\n end of the block\n end of the block\n run memcpy with dp, newdp and 201 * 2 * 4 as arguments\n run memset with newdp, 0, and 201 * 2 * 4 as arguments\n end of the block\n ans = integer set to 0\n for x = 1 to 200 inclusive\n add dp[x][1] to ans\n modulo ans by MOD\n end of the block\n read ans\n return to indicate successful execution\nend of the block","testcases":[[["3","1 -1 2"],["1"]],[["2","-1 -1"],["200"]],[["3","-1 -1 -1"],["40000"]],[["5","1 -1 -1 4 4"],["206"]],[["5","1 3 4 1 1"],["0"]],[["7","1 -1 -1 -1 -1 7 6"],["5117500"]],[["5","1 -1 -1 4 2"],["200"]],[["8","-1 -1 -1 59 -1 -1 -1 -1"],["658449230"]],[["2","38 38"],["1"]],[["8","12 35 58 58 39 41 41 20"],["1"]],[["10","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1"],["420017274"]],[["4","200 -1 -1 200"],["1"]],[["3","-1 200 -1"],["399"]],[["2","-1 35"],["1"]],[["2","29 49"],["0"]],[["2","24 -1"],["1"]],[["37","52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79"],["903952722"]],[["15","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20"],["368187329"]]]}} +{"instance_id":"pseudo_to_code_2k_177","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nMAXINT = const int with MAXINT = 2147483640\nMAXLL = const long long with MAXLL = 9223372036854775800LL\nMAXN = const long long with MAXN = 1e6\neps = const double with eps = 1e-9\nmod = const long long with mod = 998244353\ndp = 3d array of long long of size [100006][202][2], pref = 2d array of size [300][2]\nn = long long, a = integer array of size MAXN\ndefine the main function\n call srand on time(0)\n read n\n for i = 1 to n, read a[i]\n if a[1] is -1\n for i = 1 to 200 dp[1][j][0] = 1\n else\n dp[1][a[1]][0] = 1\n for i = 2 to n\n for j = 1 to 200\n (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) = (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) modulo mod\n (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) = (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) modulo mod\n end of the block\n if a[i] is -1\n for cur = 1 to 200\n sum = long long with sum = 0\n (sum = sum + (pref[200][1] - pref[cur - 1][1] + mod)) = (sum = sum + (pref[200][1] - pref[cur - 1][1] + mod)) modulo mod\n (sum = sum + dp[i - 1][cur][0]) = (sum = sum + dp[i - 1][cur][0]) modulo mod\n (dp[i][cur][1] = dp[i][cur][1] + sum) = (dp[i][cur][1] = dp[i][cur][1] + sum) modulo mod\n sum = pref[cur - 1][1] + pref[cur - 1][0]\n (dp[i][cur][0] = dp[i][cur][0] + sum) = (dp[i][cur][0] = dp[i][cur][0] + sum) modulo mod\n end of the block\n else\n sum = long long with sum = 0\n cur = long long with cur = a[i]\n for j = cur to 200, sum = sum + (dp[i - 1][j][1]) = sum + (dp[i - 1][j][1]) modulo mod\n (sum = sum + dp[i - 1][cur][0]) = (sum = sum + dp[i - 1][cur][0]) modulo mod\n (dp[i][cur][1] = dp[i][cur][1] + sum) = (dp[i][cur][1] = dp[i][cur][1] + sum) modulo mod\n sum = 0\n for j = 1 to cur exclusive, (sum = sum + dp[i - 1][j][0] + dp[i - 1][j][1]) = (sum = sum + dp[i - 1][j][0] + dp[i - 1][j][1]) modulo mod\n (dp[i][cur][0] = dp[i][cur][0] + sum) = (dp[i][cur][0] = dp[i][cur][0] + sum) modulo mod\n end of the block\n end of the block\n ans = long long with ans = 0\n for i = 1 to 200, (ans = ans + dp[n][i][1]) = (ans = ans + dp[n][i][1]) modulo mod\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int MAXINT = 2147483640;\nconst long long MAXLL = 9223372036854775800LL;\nconst long long MAXN = 1e6;\nconst double eps = 1e-9;\nconst long long mod = 998244353;\nlong long dp[100006][202][2], pref[300][2];\nlong long n, a[MAXN];\nint main() {\n srand(time(0));\n cin >> n;\n for (int i = 1; i <= n; ++i) cin >> a[i];\n if (a[1] == -1)\n for (int j = 1; j <= 200; ++j) dp[1][j][0] = 1;\n else\n dp[1][a[1]][0] = 1;\n for (int i = 2; i <= n; ++i) {\n for (int j = 1; j <= 200; ++j) {\n (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) %= mod;\n (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) %= mod;\n }\n if (a[i] == -1) {\n for (int cur = 1; cur <= 200; ++cur) {\n long long sum = 0;\n (sum += (pref[200][1] - pref[cur - 1][1] + mod)) %= mod;\n (sum += dp[i - 1][cur][0]) %= mod;\n (dp[i][cur][1] += sum) %= mod;\n sum = pref[cur - 1][1] + pref[cur - 1][0];\n (dp[i][cur][0] += sum) %= mod;\n }\n } else {\n long long sum = 0;\n long long cur = a[i];\n for (int j = cur; j <= 200; ++j) sum += (dp[i - 1][j][1]) %= mod;\n (sum += dp[i - 1][cur][0]) %= mod;\n (dp[i][cur][1] += sum) %= mod;\n sum = 0;\n for (int j = 1; j < cur; ++j) (sum += dp[i - 1][j][0] + dp[i - 1][j][1]) %= mod;\n (dp[i][cur][0] += sum) %= mod;\n }\n }\n long long ans = 0;\n for (int i = 1; i <= 200; ++i) (ans += dp[n][i][1]) %= mod;\n cout << ans << \"\\n\";\n return 0;\n}","item":{"problem_id":"1067A","pseudocode":"MAXINT = const int with MAXINT = 2147483640\nMAXLL = const long long with MAXLL = 9223372036854775800LL\nMAXN = const long long with MAXN = 1e6\neps = const double with eps = 1e-9\nmod = const long long with mod = 998244353\ndp = 3d array of long long of size [100006][202][2], pref = 2d array of size [300][2]\nn = long long, a = integer array of size MAXN\ndefine the main function\n call srand on time(0)\n read n\n for i = 1 to n, read a[i]\n if a[1] is -1\n for i = 1 to 200 dp[1][j][0] = 1\n else\n dp[1][a[1]][0] = 1\n for i = 2 to n\n for j = 1 to 200\n (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) = (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) modulo mod\n (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) = (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) modulo mod\n end of the block\n if a[i] is -1\n for cur = 1 to 200\n sum = long long with sum = 0\n (sum = sum + (pref[200][1] - pref[cur - 1][1] + mod)) = (sum = sum + (pref[200][1] - pref[cur - 1][1] + mod)) modulo mod\n (sum = sum + dp[i - 1][cur][0]) = (sum = sum + dp[i - 1][cur][0]) modulo mod\n (dp[i][cur][1] = dp[i][cur][1] + sum) = (dp[i][cur][1] = dp[i][cur][1] + sum) modulo mod\n sum = pref[cur - 1][1] + pref[cur - 1][0]\n (dp[i][cur][0] = dp[i][cur][0] + sum) = (dp[i][cur][0] = dp[i][cur][0] + sum) modulo mod\n end of the block\n else\n sum = long long with sum = 0\n cur = long long with cur = a[i]\n for j = cur to 200, sum = sum + (dp[i - 1][j][1]) = sum + (dp[i - 1][j][1]) modulo mod\n (sum = sum + dp[i - 1][cur][0]) = (sum = sum + dp[i - 1][cur][0]) modulo mod\n (dp[i][cur][1] = dp[i][cur][1] + sum) = (dp[i][cur][1] = dp[i][cur][1] + sum) modulo mod\n sum = 0\n for j = 1 to cur exclusive, (sum = sum + dp[i - 1][j][0] + dp[i - 1][j][1]) = (sum = sum + dp[i - 1][j][0] + dp[i - 1][j][1]) modulo mod\n (dp[i][cur][0] = dp[i][cur][0] + sum) = (dp[i][cur][0] = dp[i][cur][0] + sum) modulo mod\n end of the block\n end of the block\n ans = long long with ans = 0\n for i = 1 to 200, (ans = ans + dp[n][i][1]) = (ans = ans + dp[n][i][1]) modulo mod\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["3","1 -1 2"],["1"]],[["2","-1 -1"],["200"]],[["3","-1 -1 -1"],["40000"]],[["5","1 -1 -1 4 4"],["206"]],[["5","1 3 4 1 1"],["0"]],[["7","1 -1 -1 -1 -1 7 6"],["5117500"]],[["5","1 -1 -1 4 2"],["200"]],[["8","-1 -1 -1 59 -1 -1 -1 -1"],["658449230"]],[["2","38 38"],["1"]],[["8","12 35 58 58 39 41 41 20"],["1"]],[["10","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1"],["420017274"]],[["4","200 -1 -1 200"],["1"]],[["3","-1 200 -1"],["399"]],[["2","-1 35"],["1"]],[["2","29 49"],["0"]],[["2","24 -1"],["1"]],[["37","52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79"],["903952722"]],[["15","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20"],["368187329"]]]}} +{"instance_id":"pseudo_to_code_2k_178","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integers n, i, rez, sum, sum1, integer array DP of sizes 2, 2, and 205, integer array A of size 100005, and create integers cr, j\nin function f that takes in arguments integer address a, integer b, and return f\n a is assigned the sum of a and b\n if a is greater than or equal to 998244353, subtract 998244353 from a\nend of the block\ndefine the main function\n input n\n for i = 1 to n inclusive, input A[i]\n if A[1] doesn't equal -1\n Dp[1][1][A[1]] is set to 1\n else\n for i = 1 to 200 inclusive, set Dp[1][1][i] to 1\n assign 1 to cr\n for i = 2 to n inclusive\n assign 1 - cr to cr\n if A[i] doesn't equal -1\n for j = 1 to 200 inclusive\n if A[i] is less than j, call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][0][j]\n if a[i] is equal to j\n call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][1][j]\n end of the block\n if A[i] is greater than j\n call function f with arguments Dp[cr][1][A[i]], Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][1][A[i]], Dp[1 - cr][1][j]\n end of the block\n set Dp[1 - cr][1][j] and Dp[1 - cr][0][j] to 0\n end of the block\n else\n assign 0 to sum\n for j = 1 to 200 inclusive, call function f with arguments sum, Dp[1 - cr][0][j]\n assign 0 to sum1\n for j = 1 to 200 inclusive\n call function f with arguments Dp[cr][0][j], sum\n call function f with arguments Dp[cr][0][j], Dp[1 - cr][1][j]\n call function f with arguments sum, 998244353 - Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][1][j], sum1\n call function f with arguments sum1, Dp[1 - cr][1][j]\n call function f with arguments sum1, Dp[1 - cr][0][j]\n set Dp[1 - cr][0][j] and Dp[1 - cr][1][j] to 0\n end of the block\n end of the block\n end of the block\n for i = 1 to 200 inclusive, call function f with arguments rez, Dp[cr][0][i]\n output rez\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n, i, rez, sum, sum1, Dp[2][2][205], A[100005], cr, j;\nvoid f(int &a, int b) {\n a = a + b;\n if (a >= 998244353) a -= 998244353;\n}\nint main() {\n cin >> n;\n for (i = 1; i <= n; i++) cin >> A[i];\n if (A[1] != -1)\n Dp[1][1][A[1]] = 1;\n else\n for (i = 1; i <= 200; i++) Dp[1][1][i] = 1;\n cr = 1;\n for (i = 2; i <= n; i++) {\n cr = 1 - cr;\n if (A[i] != -1) {\n for (j = 1; j <= 200; j++) {\n if (A[i] < j) f(Dp[cr][0][A[i]], Dp[1 - cr][0][j]);\n if (A[i] == j) {\n f(Dp[cr][0][A[i]], Dp[1 - cr][0][j]);\n f(Dp[cr][0][A[i]], Dp[1 - cr][1][j]);\n }\n if (A[i] > j) {\n f(Dp[cr][1][A[i]], Dp[1 - cr][0][j]);\n f(Dp[cr][1][A[i]], Dp[1 - cr][1][j]);\n }\n Dp[1 - cr][1][j] = Dp[1 - cr][0][j] = 0;\n }\n } else {\n sum = 0;\n for (j = 1; j <= 200; j++) f(sum, Dp[1 - cr][0][j]);\n sum1 = 0;\n for (j = 1; j <= 200; j++) {\n f(Dp[cr][0][j], sum);\n f(Dp[cr][0][j], Dp[1 - cr][1][j]);\n f(sum, 998244353 - Dp[1 - cr][0][j]);\n f(Dp[cr][1][j], sum1);\n f(sum1, Dp[1 - cr][1][j]);\n f(sum1, Dp[1 - cr][0][j]);\n Dp[1 - cr][0][j] = Dp[1 - cr][1][j] = 0;\n }\n }\n }\n for (i = 1; i <= 200; i++) f(rez, Dp[cr][0][i]);\n cout << rez << \"\\n\";\n return 0;\n}","item":{"problem_id":"1067A","pseudocode":"create integers n, i, rez, sum, sum1, integer array DP of sizes 2, 2, and 205, integer array A of size 100005, and create integers cr, j\nin function f that takes in arguments integer address a, integer b, and return f\n a is assigned the sum of a and b\n if a is greater than or equal to 998244353, subtract 998244353 from a\nend of the block\ndefine the main function\n input n\n for i = 1 to n inclusive, input A[i]\n if A[1] doesn't equal -1\n Dp[1][1][A[1]] is set to 1\n else\n for i = 1 to 200 inclusive, set Dp[1][1][i] to 1\n assign 1 to cr\n for i = 2 to n inclusive\n assign 1 - cr to cr\n if A[i] doesn't equal -1\n for j = 1 to 200 inclusive\n if A[i] is less than j, call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][0][j]\n if a[i] is equal to j\n call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][1][j]\n end of the block\n if A[i] is greater than j\n call function f with arguments Dp[cr][1][A[i]], Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][1][A[i]], Dp[1 - cr][1][j]\n end of the block\n set Dp[1 - cr][1][j] and Dp[1 - cr][0][j] to 0\n end of the block\n else\n assign 0 to sum\n for j = 1 to 200 inclusive, call function f with arguments sum, Dp[1 - cr][0][j]\n assign 0 to sum1\n for j = 1 to 200 inclusive\n call function f with arguments Dp[cr][0][j], sum\n call function f with arguments Dp[cr][0][j], Dp[1 - cr][1][j]\n call function f with arguments sum, 998244353 - Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][1][j], sum1\n call function f with arguments sum1, Dp[1 - cr][1][j]\n call function f with arguments sum1, Dp[1 - cr][0][j]\n set Dp[1 - cr][0][j] and Dp[1 - cr][1][j] to 0\n end of the block\n end of the block\n end of the block\n for i = 1 to 200 inclusive, call function f with arguments rez, Dp[cr][0][i]\n output rez\n return to indicate successful execution\nend of the block","testcases":[[["3","1 -1 2"],["1"]],[["2","-1 -1"],["200"]],[["3","-1 -1 -1"],["40000"]],[["5","1 -1 -1 4 4"],["206"]],[["5","1 3 4 1 1"],["0"]],[["7","1 -1 -1 -1 -1 7 6"],["5117500"]],[["5","1 -1 -1 4 2"],["200"]],[["8","-1 -1 -1 59 -1 -1 -1 -1"],["658449230"]],[["2","38 38"],["1"]],[["8","12 35 58 58 39 41 41 20"],["1"]],[["10","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1"],["420017274"]],[["4","200 -1 -1 200"],["1"]],[["3","-1 200 -1"],["399"]],[["2","-1 35"],["1"]],[["2","29 49"],["0"]],[["2","24 -1"],["1"]],[["37","52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79"],["903952722"]],[["15","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20"],["368187329"]]]}} +{"instance_id":"pseudo_to_code_2k_179","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nMAXINT = const integer with MAXINT = 2147483640\nMAXLL = const long long with MAXLL = 9223372036854775800LL\nMAXN = const long long with MAXN = 1e6\neps = const double with eps = 1e-9\nmod = const long long with mod = 998244353\ndp = 3d const long long array of size [100006][202][2], pref = 2d const long long array of size [300][2]\nn, a = long long with a = long long array of size MAXN\ndefine the main function\n srand of time(0)\n read n\n for i = 1 to n, read a[i]\n if a[1] is -1\n for i = 1 to 200, dp[1][j][0] = 1\n else\n dp[1][a[1]][0] = 1\n for i = 2 to n\n for j = 1 to 200\n (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) = (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) modulo mod\n (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) = (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) modulo mod\n end of the block\n if a[i] is -1\n for cur = 1 to 200\n sum = long long with sum = 0\n (sum = sum + (pref[200][1] - pref[cur - 1][1] + mod)) = (sum = sum + (pref[200][1] - pref[cur - 1][1] + mod)) modulo mod\n (sum = sum + dp[i - 1][cur][0]) = (sum = sum + dp[i - 1][cur][0]) modulo mod\n (dp[i][cur][1] = dp[i][cur][1] + sum) = (dp[i][cur][1] = dp[i][cur][1] + sum) modulo mod\n sum = pref[cur - 1][1] + pref[cur - 1][0]\n (dp[i][cur][0] = dp[i][cur][0] sum) = (dp[i][cur][0] = dp[i][cur][0] + sum) modulo mod\n end of the block\n else\n sum = long long with sum = 0\n cur = long long with cur = a[i]\n for j = cur to 200, sum = sum + (dp[i - 1][j][1]) = (dp[i - 1][j][1]) modulo mod\n (sum = sum + dp[i - 1][cur][0]) = (sum = sum + dp[i - 1][cur][0]) modulo mod\n (dp[i][cur][1] = dp[i][cur][1] + sum) = (dp[i][cur][1] = dp[i][cur][1] + sum) modulo mod\n sum = 0\n for j = 1 to cur exclusive, sum = sum + dp[i - 1][j][0] + dp[i - 1][j][1]) = (sum = sum + dp[i - 1][j][0] + dp[i - 1][j][1]) modulo mod\n (dp[i][cur][0] = dp[i][cur][0] + sum) = (dp[i][cur][0] = dp[i][cur][0] + sum) modulo mod\n end of the block\n end of the block\n ans = long long with ans = 0\n (ans = ans + dp[n][i][1]) = (ans = ans + dp[n][i][1]) modulo mod\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int MAXINT = 2147483640;\nconst long long MAXLL = 9223372036854775800LL;\nconst long long MAXN = 1e6;\nconst double eps = 1e-9;\nconst long long mod = 998244353;\nlong long dp[100006][202][2], pref[300][2];\nlong long n, a[MAXN];\nint main() {\n srand(time(0));\n cin >> n;\n for (int i = 1; i <= n; ++i) cin >> a[i];\n if (a[1] == -1)\n for (int j = 1; j <= 200; ++j) dp[1][j][0] = 1;\n else\n dp[1][a[1]][0] = 1;\n for (int i = 2; i <= n; ++i) {\n for (int j = 1; j <= 200; ++j) {\n (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) %= mod;\n (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) %= mod;\n }\n if (a[i] == -1) {\n for (int cur = 1; cur <= 200; ++cur) {\n long long sum = 0;\n (sum += (pref[200][1] - pref[cur - 1][1] + mod)) %= mod;\n (sum += dp[i - 1][cur][0]) %= mod;\n (dp[i][cur][1] += sum) %= mod;\n sum = pref[cur - 1][1] + pref[cur - 1][0];\n (dp[i][cur][0] += sum) %= mod;\n }\n } else {\n long long sum = 0;\n long long cur = a[i];\n for (int j = cur; j <= 200; ++j) sum += (dp[i - 1][j][1]) %= mod;\n (sum += dp[i - 1][cur][0]) %= mod;\n (dp[i][cur][1] += sum) %= mod;\n sum = 0;\n for (int j = 1; j < cur; ++j) (sum += dp[i - 1][j][0] + dp[i - 1][j][1]) %= mod;\n (dp[i][cur][0] += sum) %= mod;\n }\n }\n long long ans = 0;\n for (int i = 1; i <= 200; ++i) (ans += dp[n][i][1]) %= mod;\n cout << ans << \"\\n\";\n return 0;\n}","item":{"problem_id":"1067A","pseudocode":"MAXINT = const integer with MAXINT = 2147483640\nMAXLL = const long long with MAXLL = 9223372036854775800LL\nMAXN = const long long with MAXN = 1e6\neps = const double with eps = 1e-9\nmod = const long long with mod = 998244353\ndp = 3d const long long array of size [100006][202][2], pref = 2d const long long array of size [300][2]\nn, a = long long with a = long long array of size MAXN\ndefine the main function\n srand of time(0)\n read n\n for i = 1 to n, read a[i]\n if a[1] is -1\n for i = 1 to 200, dp[1][j][0] = 1\n else\n dp[1][a[1]][0] = 1\n for i = 2 to n\n for j = 1 to 200\n (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) = (pref[j][1] = pref[j - 1][1] + dp[i - 1][j][1]) modulo mod\n (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) = (pref[j][0] = pref[j - 1][0] + dp[i - 1][j][0]) modulo mod\n end of the block\n if a[i] is -1\n for cur = 1 to 200\n sum = long long with sum = 0\n (sum = sum + (pref[200][1] - pref[cur - 1][1] + mod)) = (sum = sum + (pref[200][1] - pref[cur - 1][1] + mod)) modulo mod\n (sum = sum + dp[i - 1][cur][0]) = (sum = sum + dp[i - 1][cur][0]) modulo mod\n (dp[i][cur][1] = dp[i][cur][1] + sum) = (dp[i][cur][1] = dp[i][cur][1] + sum) modulo mod\n sum = pref[cur - 1][1] + pref[cur - 1][0]\n (dp[i][cur][0] = dp[i][cur][0] sum) = (dp[i][cur][0] = dp[i][cur][0] + sum) modulo mod\n end of the block\n else\n sum = long long with sum = 0\n cur = long long with cur = a[i]\n for j = cur to 200, sum = sum + (dp[i - 1][j][1]) = (dp[i - 1][j][1]) modulo mod\n (sum = sum + dp[i - 1][cur][0]) = (sum = sum + dp[i - 1][cur][0]) modulo mod\n (dp[i][cur][1] = dp[i][cur][1] + sum) = (dp[i][cur][1] = dp[i][cur][1] + sum) modulo mod\n sum = 0\n for j = 1 to cur exclusive, sum = sum + dp[i - 1][j][0] + dp[i - 1][j][1]) = (sum = sum + dp[i - 1][j][0] + dp[i - 1][j][1]) modulo mod\n (dp[i][cur][0] = dp[i][cur][0] + sum) = (dp[i][cur][0] = dp[i][cur][0] + sum) modulo mod\n end of the block\n end of the block\n ans = long long with ans = 0\n (ans = ans + dp[n][i][1]) = (ans = ans + dp[n][i][1]) modulo mod\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["3","1 -1 2"],["1"]],[["2","-1 -1"],["200"]],[["3","-1 -1 -1"],["40000"]],[["5","1 -1 -1 4 4"],["206"]],[["5","1 3 4 1 1"],["0"]],[["7","1 -1 -1 -1 -1 7 6"],["5117500"]],[["5","1 -1 -1 4 2"],["200"]],[["8","-1 -1 -1 59 -1 -1 -1 -1"],["658449230"]],[["2","38 38"],["1"]],[["8","12 35 58 58 39 41 41 20"],["1"]],[["10","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1"],["420017274"]],[["4","200 -1 -1 200"],["1"]],[["3","-1 200 -1"],["399"]],[["2","-1 35"],["1"]],[["2","29 49"],["0"]],[["2","24 -1"],["1"]],[["37","52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79"],["903952722"]],[["15","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20"],["368187329"]]]}} +{"instance_id":"pseudo_to_code_2k_180","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate const int N = 1e5 + 5\ncreate const long long mod = 998244353\ndeclare 3d long long array dp with size N by 201 by 3\nlet a be int array with size N\ndefine the main function\n declare integer variable n\n read n\n for i from 1 to n + 1 exclusive, read input to a[i]\n set sizeof(dp) bytes at the pointer dp to 0\n for i = 1 to 201 exclusive\n if a[1] = -1 or a[1] = i, set dp[1][i][2] to 1\n end of the block\n create long long sum = 0\n for i = 2 to n inclusive\n assign 0 to sum\n for integer j = 200 to 1 inclusive, decrementing j\n if a[i] = -1 or a[i] = j, change dp[i][j][0] to sum\n assign (sum + dp[i - 1][j][1] + dp[i - 1][j][0]) % mod to sum\n end of the block\n for j from 1 to 201 exclusive\n if a[i] = -1 or a[i] = j, set dp[i][j][1] to (dp[i - 1][j][1] + dp[i - 1][j][0] + dp[i - 1][j][2]) % mod\n end of the block\n change sum to 0\n for integer j = 1 to 200 inclusive\n if a[i] = -1 or a[i] = j, set dp[i][j][2] to sum\n assign (sum + dp[i - 1][j][1] + dp[i - 1][j][0] + dp[i - 1][j][2]) % mod to sum\n end of the block\n end of the block\n declare long long variable ans = 0\n for i = 1 to 200 inclusive, change ans to (ans + dp[n][i][1] + dp[n][i][0]) % mod\n print ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int N = 1e5 + 5;\nconst long long mod = 998244353;\nlong long dp[N][201][3];\nint a[N];\nint main() {\n int n;\n cin >> n;\n for (int i = (1); i < (n + 1); i++) cin >> a[i];\n memset(dp, 0, sizeof(dp));\n for (int i = (1); i < (201); i++) {\n if (a[1] == -1 || a[1] == i) { dp[1][i][2] = 1; }\n }\n long long sum = 0;\n for (int i = 2; i <= n; ++i) {\n sum = 0;\n for (int j = 200; j >= 1; --j) {\n if (a[i] == -1 || a[i] == j) { dp[i][j][0] = sum; }\n sum = (sum + dp[i - 1][j][1] + dp[i - 1][j][0]) % mod;\n }\n for (int j = (1); j < (201); j++) {\n if (a[i] == -1 || a[i] == j) { dp[i][j][1] = (dp[i - 1][j][1] + dp[i - 1][j][0] + dp[i - 1][j][2]) % mod; }\n }\n sum = 0;\n for (int j = 1; j <= 200; ++j) {\n if (a[i] == -1 || a[i] == j) { dp[i][j][2] = sum; }\n sum = (sum + dp[i - 1][j][1] + dp[i - 1][j][0] + dp[i - 1][j][2]) % mod;\n }\n }\n long long ans = 0;\n for (int i = 1; i <= 200; ++i) ans = (ans + dp[n][i][1] + dp[n][i][0]) % mod;\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"1067A","pseudocode":"create const int N = 1e5 + 5\ncreate const long long mod = 998244353\ndeclare 3d long long array dp with size N by 201 by 3\nlet a be int array with size N\ndefine the main function\n declare integer variable n\n read n\n for i from 1 to n + 1 exclusive, read input to a[i]\n set sizeof(dp) bytes at the pointer dp to 0\n for i = 1 to 201 exclusive\n if a[1] = -1 or a[1] = i, set dp[1][i][2] to 1\n end of the block\n create long long sum = 0\n for i = 2 to n inclusive\n assign 0 to sum\n for integer j = 200 to 1 inclusive, decrementing j\n if a[i] = -1 or a[i] = j, change dp[i][j][0] to sum\n assign (sum + dp[i - 1][j][1] + dp[i - 1][j][0]) % mod to sum\n end of the block\n for j from 1 to 201 exclusive\n if a[i] = -1 or a[i] = j, set dp[i][j][1] to (dp[i - 1][j][1] + dp[i - 1][j][0] + dp[i - 1][j][2]) % mod\n end of the block\n change sum to 0\n for integer j = 1 to 200 inclusive\n if a[i] = -1 or a[i] = j, set dp[i][j][2] to sum\n assign (sum + dp[i - 1][j][1] + dp[i - 1][j][0] + dp[i - 1][j][2]) % mod to sum\n end of the block\n end of the block\n declare long long variable ans = 0\n for i = 1 to 200 inclusive, change ans to (ans + dp[n][i][1] + dp[n][i][0]) % mod\n print ans\n return to indicate successful execution\nend of the block","testcases":[[["3","1 -1 2"],["1"]],[["2","-1 -1"],["200"]],[["3","-1 -1 -1"],["40000"]],[["5","1 -1 -1 4 4"],["206"]],[["5","1 3 4 1 1"],["0"]],[["7","1 -1 -1 -1 -1 7 6"],["5117500"]],[["5","1 -1 -1 4 2"],["200"]],[["8","-1 -1 -1 59 -1 -1 -1 -1"],["658449230"]],[["2","38 38"],["1"]],[["8","12 35 58 58 39 41 41 20"],["1"]],[["10","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1"],["420017274"]],[["4","200 -1 -1 200"],["1"]],[["3","-1 200 -1"],["399"]],[["2","-1 35"],["1"]],[["2","29 49"],["0"]],[["2","24 -1"],["1"]],[["37","52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79"],["903952722"]],[["15","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20"],["368187329"]]]}} +{"instance_id":"pseudo_to_code_2k_181","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integer N, create integer array arr with size 100001\ncreate 3d long long array dp with size 100001 by 201 by 2\ndefine the main function\n read N\n for i = 1 to N inclusive, read arr[i]\n for i = 1 to N inclusive\n if arr[i] is not -1\n if i is 1\n set dp[i][arr[i]][0] to 1\n else\n for j = 1 to arr[i] exclusive\n increment dp[i][arr[i]][0] by dp[i - 1][j][0] + dp[i - 1][j][1]\n set dp[i][arr[i]][0] to dp[i][arr[i]][0] % 998244353\n end of the block\n increment dp[i][arr[i]][1] by dp[i - 1][arr[i]][0]\n set dp[i][arr[i]][1] to dp[i][arr[i]][1] % 998244353\n for j = arr[i] to 200 inclusive\n increment dp[i][arr[i]][1] by dp[i - 1][j][1]\n set dp[i][arr[i]][1] to dp[i][arr[i]][1] % 998244353\n end of the block\n end of the block\n else\n if i is 1\n for j = 1 to 200 inclusive, set dp[i][j][0] to 1\n else\n create long long temp with temp = 0\n for j = 1 to 200 inclusive\n increment dp[i][j][1] by dp[i-1][j][0]\n set dp[i][j][1] to dp[i][j][1] % 998244353\n increment dp[i][j][0] by temp\n set dp[i][j][0] to dp[i][j][0] % 998244353\n increment temp by dp[i - 1][j][0]\n set temp to temp % 998244353\n end of the block\n set temp to 0\n for j = 200 to 1 inclusive, decrementing i\n increment temp by dp[i - 1][j][1]\n set temp to temp % 998244353\n increment dp[i][j][1] by temp\n set dp[i][j][1] to dp[i][j][1] % 998244353\n end of the block\n set temp to 0\n for j = 1 to 200 inclusive\n increment dp[i][j][0] by temp\n set dp[i][j][0] to dp[i][j][0] % 998244353\n increment temp by dp[i - 1][j][1]\n set temp to temp % 998244353\n end of the block\n end of the block\n end of the block\n end of the block\n create long long ans with ans = 0\n for i = 1 to 200 inclusive, set ans to (ans + dp[N][i][1]) % 998244353\n print ans print '\\n'\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int N, arr[100001];\nlong long dp[100001][201][2];\nint main() {\n cin >> N;\n for (int i = 1; i <= N; i++) cin >> arr[i];\n for (int i = 1; i <= N; i++) {\n if (arr[i] != -1) {\n if (i == 1)\n dp[i][arr[i]][0] = 1;\n else {\n for (int j = 1; j < arr[i]; j++) {\n dp[i][arr[i]][0] += dp[i - 1][j][0] + dp[i - 1][j][1];\n dp[i][arr[i]][0] %= 998244353;\n }\n dp[i][arr[i]][1] += dp[i - 1][arr[i]][0];\n dp[i][arr[i]][1] %= 998244353;\n for (int j = arr[i]; j <= 200; j++) {\n dp[i][arr[i]][1] += dp[i - 1][j][1];\n dp[i][arr[i]][1] %= 998244353;\n }\n }\n } else {\n if (i == 1) {\n for (int j = 1; j <= 200; j++) dp[i][j][0] = 1;\n } else {\n long long temp = 0;\n for (int j = 1; j <= 200; j++) {\n dp[i][j][1] += dp[i - 1][j][0];\n dp[i][j][1] %= 998244353;\n dp[i][j][0] += temp;\n dp[i][j][0] %= 998244353;\n temp += dp[i - 1][j][0];\n temp %= 998244353;\n }\n temp = 0;\n for (int j = 200; j >= 1; j--) {\n temp += dp[i - 1][j][1];\n temp %= 998244353;\n dp[i][j][1] += temp;\n dp[i][j][1] %= 998244353;\n }\n temp = 0;\n for (int j = 1; j <= 200; j++) {\n dp[i][j][0] += temp;\n dp[i][j][0] %= 998244353;\n temp += dp[i - 1][j][1];\n temp %= 998244353;\n }\n }\n }\n }\n long long ans = 0;\n for (int i = 1; i <= 200; i++) ans = (ans + dp[N][i][1]) % 998244353;\n cout << ans << '\\n';\n return 0;\n}","item":{"problem_id":"1067A","pseudocode":"create integer N, create integer array arr with size 100001\ncreate 3d long long array dp with size 100001 by 201 by 2\ndefine the main function\n read N\n for i = 1 to N inclusive, read arr[i]\n for i = 1 to N inclusive\n if arr[i] is not -1\n if i is 1\n set dp[i][arr[i]][0] to 1\n else\n for j = 1 to arr[i] exclusive\n increment dp[i][arr[i]][0] by dp[i - 1][j][0] + dp[i - 1][j][1]\n set dp[i][arr[i]][0] to dp[i][arr[i]][0] % 998244353\n end of the block\n increment dp[i][arr[i]][1] by dp[i - 1][arr[i]][0]\n set dp[i][arr[i]][1] to dp[i][arr[i]][1] % 998244353\n for j = arr[i] to 200 inclusive\n increment dp[i][arr[i]][1] by dp[i - 1][j][1]\n set dp[i][arr[i]][1] to dp[i][arr[i]][1] % 998244353\n end of the block\n end of the block\n else\n if i is 1\n for j = 1 to 200 inclusive, set dp[i][j][0] to 1\n else\n create long long temp with temp = 0\n for j = 1 to 200 inclusive\n increment dp[i][j][1] by dp[i-1][j][0]\n set dp[i][j][1] to dp[i][j][1] % 998244353\n increment dp[i][j][0] by temp\n set dp[i][j][0] to dp[i][j][0] % 998244353\n increment temp by dp[i - 1][j][0]\n set temp to temp % 998244353\n end of the block\n set temp to 0\n for j = 200 to 1 inclusive, decrementing i\n increment temp by dp[i - 1][j][1]\n set temp to temp % 998244353\n increment dp[i][j][1] by temp\n set dp[i][j][1] to dp[i][j][1] % 998244353\n end of the block\n set temp to 0\n for j = 1 to 200 inclusive\n increment dp[i][j][0] by temp\n set dp[i][j][0] to dp[i][j][0] % 998244353\n increment temp by dp[i - 1][j][1]\n set temp to temp % 998244353\n end of the block\n end of the block\n end of the block\n end of the block\n create long long ans with ans = 0\n for i = 1 to 200 inclusive, set ans to (ans + dp[N][i][1]) % 998244353\n print ans print '\\n'\n return to indicate successful execution\nend of the block","testcases":[[["3","1 -1 2"],["1"]],[["2","-1 -1"],["200"]],[["3","-1 -1 -1"],["40000"]],[["5","1 -1 -1 4 4"],["206"]],[["5","1 3 4 1 1"],["0"]],[["7","1 -1 -1 -1 -1 7 6"],["5117500"]],[["5","1 -1 -1 4 2"],["200"]],[["8","-1 -1 -1 59 -1 -1 -1 -1"],["658449230"]],[["2","38 38"],["1"]],[["8","12 35 58 58 39 41 41 20"],["1"]],[["10","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1"],["420017274"]],[["4","200 -1 -1 200"],["1"]],[["3","-1 200 -1"],["399"]],[["2","-1 35"],["1"]],[["2","29 49"],["0"]],[["2","24 -1"],["1"]],[["37","52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79"],["903952722"]],[["15","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20"],["368187329"]]]}} +{"instance_id":"pseudo_to_code_2k_182","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate long long mod with mod = 998244353\ncreate integer array a with size 100000\ndefine the main function\n create integer n\n read n\n for i = 0 to n exclusive, read a[i]\n create long long vectors up, notup, prev_up, prev_notup, with up initialized with 201, notup initialized with 201, prev_up initialized with (201,0), prev_notup initialized with (201,0)\n set prev_up[0] to 1\n for i = 0 to n exclusive\n for j = 1 to 200 inclusive\n increment prev_up[j] by prev_up[j - 1], set prev_up[j] to prev_up[j] % mod\n increment prev_notup[j] by prev_notup[j-1], set prev_notup[j] to prev_notup[j] % mod\n end of the block\n set up[0] to notup[0] to 0\n for j = 1 to 200 inclusive\n set up[j] to notup[j] to 0\n if a[i] is not -1 and a[i] is not j, break current loop iteration\n increment up[j] by prev_up[j - 1] + prev_notup[j - 1], set up[j] to up[j] % mod\n increment notup[j] by prev_up[j] + prev_notup[j], set notup[j] to notup[j] % mod\n decrement notup[j] by prev_up[j - 1] + prev_notup[j - 1], set notup[j] to notup[j] % mod\n increment notup[j] by prev_notup[200] - prev_notup[j], set notup[j] to notup[j] % mod\n end of the block\n set prev_up to up\n set prev_notup to notup\n end of the block\n create long long ans with ans = 0\n for i = 1 to 200 inclusive, increment ans by prev_notup[i], set ans to ans % mod\n print ( ans + mod ) % mod print newline\nend of the block\n\n[CODE]:","reference_output":"long long mod = 998244353;\nint a[100000];\nint main() {\n int n;\n cin >> n;\n for (int i = 0; i < n; i++) cin >> a[i];\n vector up(201), notup(201), prev_up(201, 0), prev_notup(201, 0);\n prev_up[0] = 1;\n for (int i = 0; i < n; i++) {\n for (int j = 1; j <= 200; j++) {\n (prev_up[j] += prev_up[j - 1]) %= mod;\n (prev_notup[j] += prev_notup[j - 1]) %= mod;\n }\n up[0] = notup[0] = 0;\n for (int j = 1; j <= 200; j++) {\n up[j] = notup[j] = 0;\n if (a[i] != -1 && a[i] != j) continue;\n (up[j] += prev_up[j - 1] + prev_notup[j - 1]) %= mod;\n (notup[j] += prev_up[j] + prev_notup[j]) %= mod;\n (notup[j] -= prev_up[j - 1] + prev_notup[j - 1]) %= mod;\n (notup[j] += prev_notup[200] - prev_notup[j]) %= mod;\n }\n prev_up = up;\n prev_notup = notup;\n }\n long long ans = 0;\n for (int i = 1; i <= 200; i++) (ans += prev_notup[i]) %= mod;\n cout << (ans + mod) % mod << endl;\n}","item":{"problem_id":"1067A","pseudocode":"create long long mod with mod = 998244353\ncreate integer array a with size 100000\ndefine the main function\n create integer n\n read n\n for i = 0 to n exclusive, read a[i]\n create long long vectors up, notup, prev_up, prev_notup, with up initialized with 201, notup initialized with 201, prev_up initialized with (201,0), prev_notup initialized with (201,0)\n set prev_up[0] to 1\n for i = 0 to n exclusive\n for j = 1 to 200 inclusive\n increment prev_up[j] by prev_up[j - 1], set prev_up[j] to prev_up[j] % mod\n increment prev_notup[j] by prev_notup[j-1], set prev_notup[j] to prev_notup[j] % mod\n end of the block\n set up[0] to notup[0] to 0\n for j = 1 to 200 inclusive\n set up[j] to notup[j] to 0\n if a[i] is not -1 and a[i] is not j, break current loop iteration\n increment up[j] by prev_up[j - 1] + prev_notup[j - 1], set up[j] to up[j] % mod\n increment notup[j] by prev_up[j] + prev_notup[j], set notup[j] to notup[j] % mod\n decrement notup[j] by prev_up[j - 1] + prev_notup[j - 1], set notup[j] to notup[j] % mod\n increment notup[j] by prev_notup[200] - prev_notup[j], set notup[j] to notup[j] % mod\n end of the block\n set prev_up to up\n set prev_notup to notup\n end of the block\n create long long ans with ans = 0\n for i = 1 to 200 inclusive, increment ans by prev_notup[i], set ans to ans % mod\n print ( ans + mod ) % mod print newline\nend of the block","testcases":[[["3","1 -1 2"],["1"]],[["2","-1 -1"],["200"]],[["3","-1 -1 -1"],["40000"]],[["5","1 -1 -1 4 4"],["206"]],[["5","1 3 4 1 1"],["0"]],[["7","1 -1 -1 -1 -1 7 6"],["5117500"]],[["5","1 -1 -1 4 2"],["200"]],[["8","-1 -1 -1 59 -1 -1 -1 -1"],["658449230"]],[["2","38 38"],["1"]],[["8","12 35 58 58 39 41 41 20"],["1"]],[["10","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1"],["420017274"]],[["4","200 -1 -1 200"],["1"]],[["3","-1 200 -1"],["399"]],[["2","-1 35"],["1"]],[["2","29 49"],["0"]],[["2","24 -1"],["1"]],[["37","52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79"],["903952722"]],[["15","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20"],["368187329"]]]}} +{"instance_id":"pseudo_to_code_2k_183","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integers n, i, rez, sum, sum1, integer array DP of sizes 2, 2, and 205, integer array A of size 100005, and create integers cr, j\nin function f that takes in arguments integer address a, integer b, and return f\n a is assigned the sum of a and b\n if a is greater than or equal to 998244353, subtract 998244353 from a\nend of the block\ndefine the main function\n input n\n for i = 1 to n inclusive, input A[i]\n if A[1] doesn't equal -1\n Dp[1][1][A[1]] is set to 1\n else\n for i = 1 to 200 inclusive, set Dp[1][1][i] to 1\n assign 1 to cr\n for i = 2 to n inclusive\n assign 1 - cr to cr\n if A[i] doesn't equal -1\n for j = 1 to 200 inclusive\n if A[i] is less than j, call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][0][j]\n if a[i] is equal to j\n call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][1][j]\n end of the block\n if A[i] is greater than j\n call function f with arguments Dp[cr][1][A[i]], Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][1][A[i]], Dp[1 - cr][1][j]\n end of the block\n set Dp[1 - cr][1][j] and Dp[1 - cr][0][j] to 0\n end of the block\n else\n assign 0 to sum\n for j = 1 to 200 inclusive, call function f with arguments sum, Dp[1 - cr][0][j]\n assign 0 to sum1\n for j = 1 to 200 inclusive\n call function f with arguments Dp[cr][0][j], sum\n call function f with arguments Dp[cr][0][j], Dp[1 - cr][1][j]\n call function f with arguments sum, 998244353 - Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][1][j], sum1\n call function f with arguments sum1, Dp[1 - cr][1][j]\n call function f with arguments sum1, Dp[1 - cr][0][j]\n set Dp[1 - cr][0][j] and Dp[1 - cr][1][j] to 0\n end of the block\n end of the block\n end of the block\n for i = 1 to 200 inclusive, call function f with arguments rez, Dp[cr][0][i]\n output rez\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int n, i, rez, sum, sum1, Dp[2][2][205], A[100005], cr, j;\nvoid f(int &a, int b) {\n a = a + b;\n if (a >= 998244353) a -= 998244353;\n}\nint main() {\n cin >> n;\n for (i = 1; i <= n; i++) cin >> A[i];\n if (A[1] != -1)\n Dp[1][1][A[1]] = 1;\n else\n for (i = 1; i <= 200; i++) Dp[1][1][i] = 1;\n cr = 1;\n for (i = 2; i <= n; i++) {\n cr = 1 - cr;\n if (A[i] != -1) {\n for (j = 1; j <= 200; j++) {\n if (A[i] < j) f(Dp[cr][0][A[i]], Dp[1 - cr][0][j]);\n if (A[i] == j) {\n f(Dp[cr][0][A[i]], Dp[1 - cr][0][j]);\n f(Dp[cr][0][A[i]], Dp[1 - cr][1][j]);\n }\n if (A[i] > j) {\n f(Dp[cr][1][A[i]], Dp[1 - cr][0][j]);\n f(Dp[cr][1][A[i]], Dp[1 - cr][1][j]);\n }\n Dp[1 - cr][1][j] = Dp[1 - cr][0][j] = 0;\n }\n } else {\n sum = 0;\n for (j = 1; j <= 200; j++) f(sum, Dp[1 - cr][0][j]);\n sum1 = 0;\n for (j = 1; j <= 200; j++) {\n f(Dp[cr][0][j], sum);\n f(Dp[cr][0][j], Dp[1 - cr][1][j]);\n f(sum, 998244353 - Dp[1 - cr][0][j]);\n f(Dp[cr][1][j], sum1);\n f(sum1, Dp[1 - cr][1][j]);\n f(sum1, Dp[1 - cr][0][j]);\n Dp[1 - cr][0][j] = Dp[1 - cr][1][j] = 0;\n }\n }\n }\n for (i = 1; i <= 200; i++) f(rez, Dp[cr][0][i]);\n cout << rez << \"\\n\";\n return 0;\n}","item":{"problem_id":"1067A","pseudocode":"create integers n, i, rez, sum, sum1, integer array DP of sizes 2, 2, and 205, integer array A of size 100005, and create integers cr, j\nin function f that takes in arguments integer address a, integer b, and return f\n a is assigned the sum of a and b\n if a is greater than or equal to 998244353, subtract 998244353 from a\nend of the block\ndefine the main function\n input n\n for i = 1 to n inclusive, input A[i]\n if A[1] doesn't equal -1\n Dp[1][1][A[1]] is set to 1\n else\n for i = 1 to 200 inclusive, set Dp[1][1][i] to 1\n assign 1 to cr\n for i = 2 to n inclusive\n assign 1 - cr to cr\n if A[i] doesn't equal -1\n for j = 1 to 200 inclusive\n if A[i] is less than j, call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][0][j]\n if a[i] is equal to j\n call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][0][A[i]], Dp[1 - cr][1][j]\n end of the block\n if A[i] is greater than j\n call function f with arguments Dp[cr][1][A[i]], Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][1][A[i]], Dp[1 - cr][1][j]\n end of the block\n set Dp[1 - cr][1][j] and Dp[1 - cr][0][j] to 0\n end of the block\n else\n assign 0 to sum\n for j = 1 to 200 inclusive, call function f with arguments sum, Dp[1 - cr][0][j]\n assign 0 to sum1\n for j = 1 to 200 inclusive\n call function f with arguments Dp[cr][0][j], sum\n call function f with arguments Dp[cr][0][j], Dp[1 - cr][1][j]\n call function f with arguments sum, 998244353 - Dp[1 - cr][0][j]\n call function f with arguments Dp[cr][1][j], sum1\n call function f with arguments sum1, Dp[1 - cr][1][j]\n call function f with arguments sum1, Dp[1 - cr][0][j]\n set Dp[1 - cr][0][j] and Dp[1 - cr][1][j] to 0\n end of the block\n end of the block\n end of the block\n for i = 1 to 200 inclusive, call function f with arguments rez, Dp[cr][0][i]\n output rez\n return to indicate successful execution\nend of the block","testcases":[[["3","1 -1 2"],["1"]],[["2","-1 -1"],["200"]],[["3","-1 -1 -1"],["40000"]],[["5","1 -1 -1 4 4"],["206"]],[["5","1 3 4 1 1"],["0"]],[["7","1 -1 -1 -1 -1 7 6"],["5117500"]],[["5","1 -1 -1 4 2"],["200"]],[["8","-1 -1 -1 59 -1 -1 -1 -1"],["658449230"]],[["2","38 38"],["1"]],[["8","12 35 58 58 39 41 41 20"],["1"]],[["10","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1"],["420017274"]],[["4","200 -1 -1 200"],["1"]],[["3","-1 200 -1"],["399"]],[["2","-1 35"],["1"]],[["2","29 49"],["0"]],[["2","24 -1"],["1"]],[["37","52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79"],["903952722"]],[["15","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20"],["368187329"]]]}} +{"instance_id":"pseudo_to_code_2k_184","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nMAXN = a constant set to 100005\nMOD = and constant set to 998244353\na = an array of integers with a length of MAXN\ndp = a 2 dimentional array of integers with a length of 201\nnewdp = a 2 dimentional array of integers with a length of 201\ndefine the main function\n n = integer\n read n\n for i = 0 to n exclusive, read index i of a\n for i = 0 to n exclusive\n if i = 0\n if index i of a = -1\n for x = 1 to 200 inclusive, set newdp[x][0] = 1\n else\n newdp[a[i]][0] = 1\n end of the block\n else\n if index i of a = -1\n flag0 = integer set to 0\n flag1 = integer set to 0\n for y = 1 to 200 inclusive\n add dp[y][1] to flag1\n modulo flag1 by MOD\n end of the block\n for x = 1 to 200 inclusive\n subtract dp[x - 1][1] from flag1\n add MOD to flag1\n modulo flag1 by MOD\n subtract dp[x - 1][0] from flag1\n add MOD to flag1\n modulo flag1 by MOD\n add dp[x - 1][1] to flag0\n modulo flag0 by MOD\n add dp[x - 1][0] to flag0\n modulo flag0 by MOD\n add dp[x][0] to flag1\n modulo flag1 by MOD\n set newdp[x][0] to flag0\n set newdp[x][1] to flag1\n end of the block\n else\n x = integer set to index i of a\n for y = 1 to 200 inclusive\n flag = integer set to 1 if x <= y or 0\n add dp[y][1] to newdp[x][flag]\n modulo newdp[x][flag] by MOD\n if y <= x\n add dp[y][0] to newdp[x][flag]\n modulo newdp[x][flag] by MOD\n end of the block\n end of the block\n end of the block\n end of the block\n run memcpy with dp, newdp and 201 * 2 * 4 as arguments\n run memset with newdp, 0, and 201 * 2 * 4 as arguments\n end of the block\n ans = integer set to 0\n for x = 1 to 200 inclusive\n add dp[x][1] to ans\n modulo ans by MOD\n end of the block\n read ans\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int MAXN = 100005;\nconst int MOD = 998244353;\nint a[MAXN];\nint dp[201][2];\nint newdp[201][2];\nint main() {\n int n;\n cin >> n;\n for (int i = 0; i < n; ++i) { cin >> a[i]; }\n for (int i = 0; i < n; ++i) {\n if (i == 0) {\n if (a[i] == -1) {\n for (int x = 1; x <= 200; ++x) { newdp[x][0] = 1; }\n } else {\n newdp[a[i]][0] = 1;\n }\n } else {\n if (a[i] == -1) {\n int flag0 = 0;\n int flag1 = 0;\n for (int y = 1; y <= 200; ++y) {\n flag1 += dp[y][1];\n flag1 %= MOD;\n }\n for (int x = 1; x <= 200; ++x) {\n flag1 -= dp[x - 1][1];\n flag1 += MOD;\n flag1 %= MOD;\n flag1 -= dp[x - 1][0];\n flag1 += MOD;\n flag1 %= MOD;\n flag0 += dp[x - 1][1];\n flag0 %= MOD;\n flag0 += dp[x - 1][0];\n flag0 %= MOD;\n flag1 += dp[x][0];\n flag1 %= MOD;\n newdp[x][0] = flag0;\n newdp[x][1] = flag1;\n }\n } else {\n int x = a[i];\n for (int y = 1; y <= 200; ++y) {\n int flag = x <= y ? 1 : 0;\n newdp[x][flag] += dp[y][1];\n newdp[x][flag] %= MOD;\n if (y <= x) {\n newdp[x][flag] += dp[y][0];\n newdp[x][flag] %= MOD;\n }\n }\n }\n }\n memcpy(dp, newdp, 201 * 2 * 4);\n memset(newdp, 0, 201 * 2 * 4);\n }\n int ans = 0;\n for (int x = 1; x <= 200; ++x) {\n ans += dp[x][1];\n ans %= MOD;\n }\n cout << ans << endl;\n return 0;\n}","item":{"problem_id":"1067A","pseudocode":"MAXN = a constant set to 100005\nMOD = and constant set to 998244353\na = an array of integers with a length of MAXN\ndp = a 2 dimentional array of integers with a length of 201\nnewdp = a 2 dimentional array of integers with a length of 201\ndefine the main function\n n = integer\n read n\n for i = 0 to n exclusive, read index i of a\n for i = 0 to n exclusive\n if i = 0\n if index i of a = -1\n for x = 1 to 200 inclusive, set newdp[x][0] = 1\n else\n newdp[a[i]][0] = 1\n end of the block\n else\n if index i of a = -1\n flag0 = integer set to 0\n flag1 = integer set to 0\n for y = 1 to 200 inclusive\n add dp[y][1] to flag1\n modulo flag1 by MOD\n end of the block\n for x = 1 to 200 inclusive\n subtract dp[x - 1][1] from flag1\n add MOD to flag1\n modulo flag1 by MOD\n subtract dp[x - 1][0] from flag1\n add MOD to flag1\n modulo flag1 by MOD\n add dp[x - 1][1] to flag0\n modulo flag0 by MOD\n add dp[x - 1][0] to flag0\n modulo flag0 by MOD\n add dp[x][0] to flag1\n modulo flag1 by MOD\n set newdp[x][0] to flag0\n set newdp[x][1] to flag1\n end of the block\n else\n x = integer set to index i of a\n for y = 1 to 200 inclusive\n flag = integer set to 1 if x <= y or 0\n add dp[y][1] to newdp[x][flag]\n modulo newdp[x][flag] by MOD\n if y <= x\n add dp[y][0] to newdp[x][flag]\n modulo newdp[x][flag] by MOD\n end of the block\n end of the block\n end of the block\n end of the block\n run memcpy with dp, newdp and 201 * 2 * 4 as arguments\n run memset with newdp, 0, and 201 * 2 * 4 as arguments\n end of the block\n ans = integer set to 0\n for x = 1 to 200 inclusive\n add dp[x][1] to ans\n modulo ans by MOD\n end of the block\n read ans\n return to indicate successful execution\nend of the block","testcases":[[["3","1 -1 2"],["1"]],[["2","-1 -1"],["200"]],[["3","-1 -1 -1"],["40000"]],[["5","1 -1 -1 4 4"],["206"]],[["5","1 3 4 1 1"],["0"]],[["7","1 -1 -1 -1 -1 7 6"],["5117500"]],[["5","1 -1 -1 4 2"],["200"]],[["8","-1 -1 -1 59 -1 -1 -1 -1"],["658449230"]],[["2","38 38"],["1"]],[["8","12 35 58 58 39 41 41 20"],["1"]],[["10","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1"],["420017274"]],[["4","200 -1 -1 200"],["1"]],[["3","-1 200 -1"],["399"]],[["2","-1 35"],["1"]],[["2","29 49"],["0"]],[["2","24 -1"],["1"]],[["37","52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79"],["903952722"]],[["15","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20"],["368187329"]]]}} +{"instance_id":"pseudo_to_code_2k_185","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate 3d long long array DP with size 100005 by 205 by 2, create long long arrays sum1, sum2 with sum1 size 205, sum2 size 205\ncreate long long array ar with size 100005\ncreate long long N\ndefine the main function\n read N\n for i = 0 to N exclusive, read ar[i]\n if ar[0] is -1\n set sum1[0] to 0\n for i = 1 to 200 inclusive\n set DP[0][i][0] to 1\n set sum1[i] to sum1[i-1] + DP[0][i][0]\n end of the block\n else\n set DP[0][ar[0]][0] to 1\n set sum1[0] to 0\n for i = 1 to 200 inclusive, set sum1[i] to sum1[i-1] + DP[0][i][0]\n end of the block\n for i = 1 to N exclusive\n if ar[i] is -1\n for j = 1 to 200 inclusive\n increment DP[i][j][0] by sum1[j-1]\n set DP[i][j][0] to DP[i][j][0] % 998244353\n increment DP[i][j][1] by DP[i-1][j][0]\n set DP[i][j][1] to DP[i][j][1] % 998244353\n increment DP[i][j][0] by sum2[j-1]\n set DP[i][j][0] to DP[i][j][0] % 998244353\n end of the block\n for j = 1 to 200 inclusive\n increment DP[i][j][1] by (sum2[200] - sum2[j - 1] + 998244353)\n set DP[i][j][1] to DP[i][j][1] % 998244353\n end of the block\n else\n increment DP[i][ar[i]][0] by (sum1[ar[i] - 1]) + (sum2[ar[i] - 1])\n set DP[i][ar[i]][0] to DP[i][ar[i]][0] % 998244353\n increment DP[i][ar[i]][1] by DP[i - 1][ar[i]][0]\n set DP[i][ar[i]][1] to DP[i][ar[i]][1] % 998244353\n increment DP[i][ar[i]][1] by (sum2[200] - sum2[ar[i] - 1] + 998244353)\n set DP[i][ar[i]][1] to DP[i][ar[i]][1] % 998244353\n end of the block\n set sum1[0] to 0\n set sum2[0] to 0\n for j = 1 to 200 inclusive\n set sum1[j] to sum1[j-1] + DP[i][j][0]\n set sum1[j] to sum1[j] % 998244353\n set sum2[j] to sum2[j-1] + DP[i][j][1]\n set sum2[j] to sum2[j] % 998244353\n end of the block\n end of the block\n print (sum2[200]) % 998244353 print newline\n return 0 from function\nend of the block\n\n[CODE]:","reference_output":"long long DP[100005][205][2], sum1[205], sum2[205];\nlong long ar[100005];\nlong long N;\nint main() {\n cin >> N;\n for (long long i = 0; i < N; i++) cin >> ar[i];\n if (ar[0] == -1) {\n sum1[0] = 0;\n for (long long i = 1; i <= 200; i++) {\n DP[0][i][0] = 1;\n sum1[i] = sum1[i - 1] + DP[0][i][0];\n }\n } else {\n DP[0][ar[0]][0] = 1;\n sum1[0] = 0;\n for (long long i = 1; i <= 200; i++) sum1[i] = sum1[i - 1] + DP[0][i][0];\n }\n for (long long i = 1; i < N; i++) {\n if (ar[i] == -1) {\n for (long long j = 1; j <= 200; j++) {\n DP[i][j][0] += (sum1[j - 1]);\n DP[i][j][0] %= 998244353;\n DP[i][j][1] += DP[i - 1][j][0];\n DP[i][j][1] %= 998244353;\n DP[i][j][0] += (sum2[j - 1]);\n DP[i][j][0] %= 998244353;\n }\n for (long long j = 1; j <= 200; j++) {\n DP[i][j][1] += (sum2[200] - sum2[j - 1] + 998244353);\n DP[i][j][1] %= 998244353;\n }\n } else {\n DP[i][ar[i]][0] += (sum1[ar[i] - 1]) + (sum2[ar[i] - 1]);\n DP[i][ar[i]][0] %= 998244353;\n DP[i][ar[i]][1] += DP[i - 1][ar[i]][0];\n DP[i][ar[i]][1] %= 998244353;\n DP[i][ar[i]][1] += (sum2[200] - sum2[ar[i] - 1] + 998244353);\n DP[i][ar[i]][1] %= 998244353;\n }\n sum1[0] = 0;\n sum2[0] = 0;\n for (long long j = 1; j <= 200; j++) {\n sum1[j] = sum1[j - 1] + DP[i][j][0];\n sum1[j] %= 998244353;\n sum2[j] = sum2[j - 1] + DP[i][j][1];\n sum2[j] %= 998244353;\n }\n }\n cout << (sum2[200]) % 998244353 << endl;\n return (0);\n}","item":{"problem_id":"1067A","pseudocode":"create 3d long long array DP with size 100005 by 205 by 2, create long long arrays sum1, sum2 with sum1 size 205, sum2 size 205\ncreate long long array ar with size 100005\ncreate long long N\ndefine the main function\n read N\n for i = 0 to N exclusive, read ar[i]\n if ar[0] is -1\n set sum1[0] to 0\n for i = 1 to 200 inclusive\n set DP[0][i][0] to 1\n set sum1[i] to sum1[i-1] + DP[0][i][0]\n end of the block\n else\n set DP[0][ar[0]][0] to 1\n set sum1[0] to 0\n for i = 1 to 200 inclusive, set sum1[i] to sum1[i-1] + DP[0][i][0]\n end of the block\n for i = 1 to N exclusive\n if ar[i] is -1\n for j = 1 to 200 inclusive\n increment DP[i][j][0] by sum1[j-1]\n set DP[i][j][0] to DP[i][j][0] % 998244353\n increment DP[i][j][1] by DP[i-1][j][0]\n set DP[i][j][1] to DP[i][j][1] % 998244353\n increment DP[i][j][0] by sum2[j-1]\n set DP[i][j][0] to DP[i][j][0] % 998244353\n end of the block\n for j = 1 to 200 inclusive\n increment DP[i][j][1] by (sum2[200] - sum2[j - 1] + 998244353)\n set DP[i][j][1] to DP[i][j][1] % 998244353\n end of the block\n else\n increment DP[i][ar[i]][0] by (sum1[ar[i] - 1]) + (sum2[ar[i] - 1])\n set DP[i][ar[i]][0] to DP[i][ar[i]][0] % 998244353\n increment DP[i][ar[i]][1] by DP[i - 1][ar[i]][0]\n set DP[i][ar[i]][1] to DP[i][ar[i]][1] % 998244353\n increment DP[i][ar[i]][1] by (sum2[200] - sum2[ar[i] - 1] + 998244353)\n set DP[i][ar[i]][1] to DP[i][ar[i]][1] % 998244353\n end of the block\n set sum1[0] to 0\n set sum2[0] to 0\n for j = 1 to 200 inclusive\n set sum1[j] to sum1[j-1] + DP[i][j][0]\n set sum1[j] to sum1[j] % 998244353\n set sum2[j] to sum2[j-1] + DP[i][j][1]\n set sum2[j] to sum2[j] % 998244353\n end of the block\n end of the block\n print (sum2[200]) % 998244353 print newline\n return 0 from function\nend of the block","testcases":[[["3","1 -1 2"],["1"]],[["2","-1 -1"],["200"]],[["3","-1 -1 -1"],["40000"]],[["5","1 -1 -1 4 4"],["206"]],[["5","1 3 4 1 1"],["0"]],[["7","1 -1 -1 -1 -1 7 6"],["5117500"]],[["5","1 -1 -1 4 2"],["200"]],[["8","-1 -1 -1 59 -1 -1 -1 -1"],["658449230"]],[["2","38 38"],["1"]],[["8","12 35 58 58 39 41 41 20"],["1"]],[["10","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1"],["420017274"]],[["4","200 -1 -1 200"],["1"]],[["3","-1 200 -1"],["399"]],[["2","-1 35"],["1"]],[["2","29 49"],["0"]],[["2","24 -1"],["1"]],[["37","52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79"],["903952722"]],[["15","-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20"],["368187329"]]]}} +{"instance_id":"pseudo_to_code_2k_186","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate integer arrays num, vis with num size 30, vis size 1010\ncreate character arrays str, ans, with str size 1010, ans size 1010\ndefine the main function\n create integers t, q, i, j, k, len, mx, mp, with mx = 0\n create character mw\n read str + 1\n set len to string length of ( str + 1 )\n for i = 1 to len inclusive\n set t to str[i] - 'a' + 1\n increment num[t]\n if num[t] is greater than mx\n set mx to num[t]\n set mp to t\n end of the block\n end of the block\n create integers cur, nf with cur = 1, nf = 0\n for i = 2 to len inclusive\n if vis[i] is true, break current loop iteration\n if i * 2 is less than or equal to len\n for j = i to len inclusive, increment j by i\n if vis[j] is true, break current loop iteration\n if num[mp] is less than or equal to 0\n set nf to 1\n break loop\n end of the block\n set ans[j] to mp - 1 + 'a'\n decrement num[mp]\n set vis[j] to 1\n end of the block\n end of the block\n if nf is true, break loop\n end of the block\n for i = 1 to len inclusive\n if vis[i] is true, break current loop iteration\n while num[cur] is lesser than or equal to 0 and cur is lesser than or equal to 26, increment cur\n if cur is greater than 26\n set nf to 1\n break loop\n end of the block\n set ans[i] to cur - 1 + 'a'\n decrement num[cur]\n end of the block\n if nf is true\n print \"NO\\n\"\n else\n print \"YES\\n\" print ans + 1 print newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int num[30], vis[1010];\nchar str[1010], ans[1010];\nint main() {\n int t, q, i, j, k, len, mx = 0, mp;\n char mw;\n cin >> str + 1;\n len = strlen(str + 1);\n for (i = 1; i <= len; i++) {\n t = str[i] - 'a' + 1;\n num[t]++;\n if (num[t] > mx) {\n mx = num[t];\n mp = t;\n }\n }\n int cur = 1, nf = 0;\n for (i = 2; i <= len; i++) {\n if (vis[i]) continue;\n if (i * 2 <= len) {\n for (j = i; j <= len; j += i) {\n if (vis[j]) continue;\n if (num[mp] <= 0) {\n nf = 1;\n break;\n }\n ans[j] = mp - 1 + 'a';\n num[mp]--;\n vis[j] = 1;\n }\n }\n if (nf) break;\n }\n for (i = 1; i <= len; i++) {\n if (vis[i]) continue;\n while (num[cur] <= 0 && cur <= 26) cur++;\n if (cur > 26) {\n nf = 1;\n break;\n }\n ans[i] = cur - 1 + 'a';\n num[cur]--;\n }\n if (nf)\n cout << \"NO\\n\";\n else\n cout << \"YES\\n\" << ans + 1 << endl;\n return 0;\n}","item":{"problem_id":"123A","pseudocode":"create integer arrays num, vis with num size 30, vis size 1010\ncreate character arrays str, ans, with str size 1010, ans size 1010\ndefine the main function\n create integers t, q, i, j, k, len, mx, mp, with mx = 0\n create character mw\n read str + 1\n set len to string length of ( str + 1 )\n for i = 1 to len inclusive\n set t to str[i] - 'a' + 1\n increment num[t]\n if num[t] is greater than mx\n set mx to num[t]\n set mp to t\n end of the block\n end of the block\n create integers cur, nf with cur = 1, nf = 0\n for i = 2 to len inclusive\n if vis[i] is true, break current loop iteration\n if i * 2 is less than or equal to len\n for j = i to len inclusive, increment j by i\n if vis[j] is true, break current loop iteration\n if num[mp] is less than or equal to 0\n set nf to 1\n break loop\n end of the block\n set ans[j] to mp - 1 + 'a'\n decrement num[mp]\n set vis[j] to 1\n end of the block\n end of the block\n if nf is true, break loop\n end of the block\n for i = 1 to len inclusive\n if vis[i] is true, break current loop iteration\n while num[cur] is lesser than or equal to 0 and cur is lesser than or equal to 26, increment cur\n if cur is greater than 26\n set nf to 1\n break loop\n end of the block\n set ans[i] to cur - 1 + 'a'\n decrement num[cur]\n end of the block\n if nf is true\n print \"NO\\n\"\n else\n print \"YES\\n\" print ans + 1 print newline\n return to indicate successful execution\nend of the block","testcases":[[["abc"],["YES","abc"]],[["abcd"],["NO"]],[["xxxyxxx"],["YES","xxxxxxy"]],[["xxxjddyxduquybxdxx"],["NO"]],[["jjjjjjjjjjzjjjjjjjjjjjjjjjj"],["YES","jjjjjjjjjjjjjjjjjjjjjjzjjjj"]],[["mggnngggnjgnggggngnggpnggumggpg"],["NO"]],[["hfihihhfh"],["NO"]],[["ppppppopppionpppppppppwppppppppppppppppppppppb"],["YES","bpppppppppppppppppppppppppppipnpppppopppopwppp"]],[["jntnnnnnnngnnnnntnnennannnnnnnnnnnnnnnnjnnnnngnnnnannnnnnnnnq"],["NO"]],[["dattqddidyddddmriftkdddddddddqvedwddfdrdiaddiokdddodyqqddddtdddvdddaodd"],["NO"]],[["qqqqqqqqqqqqqqqqqqqqzqqqzqqqqqqqqqqqqqzqqqqqqqqcqqzqqqqqzqqqqqqqqqqqq"],["YES","cqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqqqqqzqqqqqzqzqqqqqzqq"]],[["danmwkmkcekwkkekwugcqwfrkrkqowkakqinzkzksisekhmqtykkuhugknygvkkrhdhnuuf"],["NO"]],[["jjjjjjjjjjjjjjjjjjjnjjjjjjjujjjjjjjjjjjjjjjjjjjjmpjjjjjjjjjjpjmjmpjjjjpjujjjjjjjjpjjjjjjujjjjjjnjjjjjjj"],["YES","mjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjmjjjjjmjnjjjjjnjjjpjpjjjjjpjjjpjjjjjpjjjjjjjujjjuju"]],[["qqqqqqqqqqsqqqqqqqqqqqqgpqqqqqqqbqqqqqqqqqqqqqqqqqqqqpqqqbqqqqqqqqqqqqqqqqqwqqqqsqqzqzqoqqqqqqqqqqwqqpqqqpq"],["NO"]],[["uupwbpqnpwpcpppewppdsppiplpppwidplpnqblppppppwsxpplxpxlppikpewxppnlbkpppqecbpeppqupsepppqpneqnpexpbqcpqpccnple"],["NO"]],[["nnnnnnnnnnnnjonnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnnnnjnnnnnnnnnnnnnnnnndfnnnnnnnnnnnnnnnnnnnnn"],["YES","dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnfnjnnnnnjnnnnnnnnnnnnnnnnnnnnnonnnnn"]],[["ssjjvshvssjdjnsdhvsjneehnnsshlldhjshdvsssshvsndsvsshlssvssvveslhllssshesssjsvvlsesssnselhjlljldlvnnshvsedllsennnnjssnsnsdsv"],["NO"]],[["cccccccccccxccgccccccccccgccciccccicccgccccccccccccccccxcccccccccccycccccccccctcccccccccccccccccccctccccaicccccgccccccccccccccccccccccaicccccccc"],["YES","acccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccacccccgcccgcccccgcccccccgccciciccciciccctccccccccccccctcccxcccccxcyccccc"]],[["httttfttttttttttthttttttttttthtttttutttttttttttsjttttttttutttttajdttttttytttttuttttttattttttttttttttttttttttdttttttttttttttttttttttttttattttttsttttttfttttttt"],["NO"]],[["wwwiuwujwijwwwwwwwwwwdwwwwhwwwwwiwwwwwwwwwuwwwhwwwjwwwwwwhwwwwwwwwniwwiwwwwwwwwwwwwwjwwwwwwwhwwwuhwwojwwwwjwwuwwwwwwwwwwiwwwwnwdwjwwwwwwwnwwwwh"],["NO"]],[["kkkkkkokkkkkkokkkkkokkkkkkkxkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkjkkkkekokkkkkkkkkkkkxkkkkokkkkkkkkkkkkkkkkkokkkkkkkkkbkkkkkkekkkxkkkkkkkkkkkkkkjkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkkekkkkk"],["YES","bkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkekkkekekkkjkjkkkkkkkkkkkkkkkkkkkkkokkkkkokokkkkkkkkkokokkkkkokkkkkxkkkxkkkkkxkkkkkxkx"]],[["ouscouyvvoooocvokcuoovoooyorjyocosackfocooaoosaucooaojhacoooooorsruocorokufcvyjokoooproaroocjooyrkoorojsocfooskxujoxxpokoopyookooysofooovuoroxraofokupcpjrcokoxucskovoaokoocyoyoovfrovouoocvsc"],["NO"]],[["ssssssssssssssssupsssssssqsssssssssssssssssssssssssssssssssssssassssssssssssssssssssssacssshsssssssscssssssssssspsssssslsgssssssslssssssdsasssessssssssssscssssbsszssssssssssssssssssossstsssssssssssssshs"],["YES","asssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssasssasbssscssssssssssssscssscsssssdsesssssssssgshssssshssssslssslsssssossssspspsssssssssqstsssuszsss"]],[["uuuuuuuuuuuuouuuuuuuuuuuuuuuuuuuuuuuucuuuuuuuuuuuuuuuuyuuuuuwuuuduuuuuuuuuutuuuuuuuuuuuuuuuuuuuuuuuuwuuuuquuuuuuuuuuuuuuuuuuuuuuuujumuuuuuutuuuuuuuhuuuuuuuauecuduuuuuuuuuuuuuuuuujusuuiuuuuuuuuuumuuyujuu"],["NO"]],[["hlchxdgrkdxglihydlyqdgxggvdhdgrgigkugrqhhgpgxhyhgkcgyqildrpcvdlpggikrxggculgyudrrgvkycvgklldxkgggxlxvqgrgygpigcudhidgcigyqqhyxkgdxixglpgdxuxhlyxkidglriglkvgyckqrqvguclryvpyvdggluggcgkillcghdxkrhdglgcxgxicrkgkpugvkhliqyii"],["NO"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhuhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhuhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhjhhhhhhhuhhuhhhhhhhhhhhhhhhhjhhhhhhhuhhhhuhhhhhhhhhhhhhjhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhjhhhhhjhjhhhhhhhhhjhjhhhjhuhhhhhhhhhhhuhhhhhhhhhhhuhhhuhuhhhuhh"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"]],[["uuuruuuuuuuuuuuuuuuuuuuuuuuiuuuuuuuuuuuuigzuuuuuuuuuuuguuuuuuouuuuuuuuuuuuuuuuuuuuuguuuuuuuzuueuuuuuuuuuuuuuufuuaouuuxuuuuutuuuuuuuuuuuuuuuuuuuuuuuuuuuulluuuutuuduuuuuuuujuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuupuruuouuuuuuuuuuuuuuuuuuuuqauu"],["YES","auuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuauuuduuuuueufuuuuuuuuuguguuuuuguuuuuiuuuiuuuuujuuuuululuuuuuuuuuououuuoupuuuuuuuuuuuquuuuuuuuuuuruuurutuuutuuuuuxuzuuuuuuuuuz"]],[["kkkmkkkkkkkymkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkdekkkkkkkkkkhrkkkkkkkkkkkkkkkkkkkkkxkkkkkokkkkikkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkfkkkkkkkkkkkkmkkkktykkkkkkkkkkkrkkkkkkrbekkkkkkkkkkkkkkkkkkfkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkykkkkkkkkkkkkkkzykkkkkkkkkkkmbkkkkkkkkk"],["NO"]],[["rrrvjurvrrsukrsrvxskrrrrbrapyrmrmvprmrseuakrmrnvokshwoawhnrbrrvrynwrynrxurrmprmmsryvkvronrmrprsrsrrrrrvwrarfrrrusrsvemwrevrarbwrmrrkhrryrhxornrorrrrrraphrvvhrrkrrfrprvorkkrsurpwvrkexpavbpnksafrrebxxyhsyrsywrrrrraryprunaxkbvrauokrrwrkpwwpwrrhakrxjrrxerefrrnxkwabrpbrrwmr"],["NO"]],[["mmmmqmmmmmmmmmmmmmmlmmmmmmmmammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmtmmmmmmmmmmimmmmmmmmmmmmmmmmmmammmmimmmmmmmmhmimmmomlmmmmmammmmmmmmmmmmmmmmmmimmmmlmmmmmmmimmmhmmmmmmmmmmmmmmmmmmmlmmmmmmmmmmmmmmhmmmmmmmmmmmmmmmtmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmotmmmmlmmmmmmmmmqmmmmmmmmmmmmmmmmmm"],["YES","ammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmamammmmmmmmmhmhmmmmmhmmmmmimmmimmmmmimmmmmimimmmmmmmmmlmlmmmlmlmmmmmmmmmmmlmmmmmmmmmmmmmmmmmmmmmmmmmmmomommmmmmmmmqmmmmmqmmmmmtmmmmmtmtm"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"],["YES","mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmm"]],[["zzzzzzzzzzzzzzrzzzzbmzzzezzzzzzgzzzzzzzzzzhzzzzgzzzxzzzznzzzzzyzzzzzzzzzzzxzzzzzzzzzzzzzzzizzzzzzzzzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmzzzzzzzzzzzzzzzzzzzzzhzzzzzyzzzzzzzzzmzzfzbzzuzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzyzzzzzzzzbzhzzzzzzzzzrzzzzzzyzzzzzzzzzzzzzzzzzzzzajzzzzz"],["YES","azzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzbzbzzzzzbzzzzzezzzfzzzzzgzzzzzgzhzzzzzzzzzhzhzzzizjzzzzzzzzzzzmzzzzzzzzzzzmzzzmznzzzozzzzzrzrzzzzzzzzzuzzzzzuzzzzzxzzzzzxzyzzzzzyzzzyzyzz"]],[["bbbbbbbbbcbbbbbbqbbbbbkbbbbbbbbbbbbbvbsbbbbbebbbbbbbbbbbbbbbbbbbbbbbcbbbkbvbbbbbbubbbbbbbfbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbekkbbbbbbbbbbbbbbbbfbqbbbbbbbbbfbbebbbbbbbbbbbbbbbbbbbbbbbbbeebbbbbbbbbbbbbbbeubbbbbbbbbbbqbbbbbbbbbbbbbbbbbbbbbbbbbbfbbbbbbbbbbbbbbbbkbebbbbbbbbbbbbuvbbbbbfbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbb"],["NO"]],[["wtwwttwttwwwwwwwwtwtwwwwwtwwtwwtwwwwwtwtwtwtwwtwwwtwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwtwwwwwwwwwwwtwwwwwtwttwwwwtwwwwwwwwwwwwwwwwwtwwwwtwwwwwwwwwwwwwttwtwwwwwtwwtwwwwwwwtwwttttwwwwwwwwwwwwwwwwwwwtwwwttwtwwtwwtwwtwwwwtwwtwtwwtwwwwwwwwwwtwwww"],["NO"]],[["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"],["YES","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]],[["koadaaaaarnaavmmavimdolavaaovkaaabalaavabaolarkewawaavaaaaiaaalaaeaaenaobaamaaikaiaabaavaeenlaaaaaadaoaaaaaaaiekaebavvwaaabiobaadavaiaaviaaaadaaaamarakmaaakaeavwlaaeanaaanaaaaaakllovwnenvlakaiomaaaaaaamaainebaeakaaaaaalraiaallaannammaaamaaaaeeaaiawaabvaaealaermaobaavreaaaaakavrvdaawaraedaaaaawiaeoaaaadaaaaavvadaaaoaaeewokbaaaeaaamaabdaaama"],["NO"]],[["oooooooocooocooooooooooooooooooooooooofoooooooooooooovoooozoooooooooqoooooooooooooooooooooooooooooooooxooovoooooooocoooooxooobooczoooooooooqooooooooooooooooocooooeooooooxoooooooooooooooooozooooooooooooooooooxoopooooocooobooooooooooooooooloooooooooooooooooooobooooelooooooooooooooooooooooooxooiooooooooooopooboooooooooooooooooooooolooooooooooooooooooooo"],["YES","booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooobobooooooooobocooococooooooooooocooooooooooocooocoeoooeooooofoiooooooooolooooolooooolooooopopoooooqoooqovooooooooovoooooooooooooxoooxoxoooxoooooooooooooxooooozooooooooozozooo"]],[["bbbbbbzbbbbbbbbbbgbbbbbbbbbbbpbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbmbbbbbbbobbbbbbbwubbbrbbbbbbbbbbbbbbbubbbbbbbqobbbbdbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbbbbbbbbbbbbbbbbbdbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbobbbbbbbbbibbbbbbbbbbgbbbbebbybbbbbbbbbbbbbbbabbbbbbbbbybiybbbbdbbbgbebbbbbkbbbbbbnbbbbbbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbtbbbbbbbbbpbbb"],["NO"]],[["llvlluelllllllllzllnndluelllhdunlnlllllhnbhldllelllllhllleulunvlldlllllbepellpzulbulllelllvblllulllllllllezpllhldellzldlllllllelllhlllehllvevlnullllvllllpudldlllvdbllllhnvlllllvllvllvlllplelzplpzllllulzlbllzldevlullelllhhzdeulllllllllnlzvllllllbllvllllllllluellnlllulnllllbdlevlhlvllllpenblvzlzlllblvhllllhllllpeblevelpllllnpbhlhllbllllndllblldvn"],["NO"]],[["zzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"],["YES","ozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"]],[["lsllllmllllslllxlvlxluyylllslllmlllvllxllslllvlslyulllullllllmlxulllyxlllmlllllvullllllslllsmlllxmllvvlslllllllllllulllvlllllllmllllsylylvluylllmullslllllvylmmlluyllvlylllllllllllvllllsmlxlslmlllxxslllmyluvylylllllxmxlulsslslmllulxllmllxuusllllumlllllmsssmxullllmsllllmlxxllmllllylvllmlluymxlllllslyxllvlllllllllllllllsllullmlllllslllsllullslllllllllllvyllllvlllylllsllvlvsmlvllllllulullllllslxlml"],["NO"]],[["cccjcchccccccjcccccccjlccccccccccccchccccwccctccccccccccccccccczccccccccccccccccccccccccccccccccccccccnwcccccccccccccccccccoccwcccccccccccwccccccccccccccncdccccbcctcccccccccccccccccccccccxccccccvcccnccccbccccccccccccccccccccccclccccccccczccvccccccvscccccccccxccccocccccccscccccccccccccxvccccccccccccccccccccccccccccccccccccccccccccccxccccccccccccwccccccchccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"],["YES","bcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbcccccccccccdccchchccchcccccjcjcccccccccjccccclccccclcccccncncccccncccococccccccccscccccccccccccsccctctcccvcccccccccccccvcccccvcccccccccvcwcccwcccccwcccccccwcccccwcccccxcccxcccccxcccccccxccczccccccczccccc"]],[["uuuuuuuuuuuuuuuuuuuuuuuuuuquuuuulquuuuuuuouuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuouuuuxouuuuuxuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuruuuuuuxuuuuuuuuuuuuuuuuuuuuuuuzuuuuuuuuuuuuuuupuuuuuuuuuuuuuuuuuuluuuuuuuuuuuuuuuuuuuuuuuuuuuuuurluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuruuuuuuouuuquuuluuuuuuuuupuuouuuuuuuuuuzuuuuuuuokuuluuuupuuukuuuuuruuuuuuupuuuuuuuuuuuuzuouuuuuuuuuuuuuuuz"],["NO"]],[["vkxvxkxvxxxkkvkxvkkxvvvvvvvvkkvkkxvvkkvkkvkkvxxvxvvvvkvkvvxvvxvxvvvkvxkkxkxxkxxkxvxvvxvkvvxvkvkvkxkxvxkvvkvxkxkvkxvxvxxxxxvxxvxxxkkvvvvkkvvvxxkxkvvkxvvxkkkvkvvkvvvvxxxkxxxvvvkxkxvkvxxkxkxkxkvvxxkkkkvxxkvkkxvxvxxvxxxxvvkvxkxkxvkkvxxvxkvvkxkkvxvkkkkkkxkxkvxkkkxxxxxxxvxkxkkvxkkxvkvkkvkkkxvkvkvkvvxkkkxxvxxxxxvkvvxkvvvxvxvkkvvvxkvkxkvxxkvvkxvvxkxxkxkkkvxkxxvkkkxxkxxxvxkxkkkvkkxxxvvkkvvkvkkkxkvxkxxxvkvxvxxkvkxkvkxvxvvxvxxkkkxxkkkkvvvv"],["NO"]],[["gggggggggggqggggggggnqggggggepgggeggggpggqeggggegggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghggqghgggggggggggggggggggggggqgqggggghgggnnggggggggggggggggqgggggpgggggggggggnggggpggggggggggggggggggggggggggggggggqgggqggggggggggeegggggggggggggggggggggngggggghqggggggggggggggggggggggggggggggepggggggggghgggggggggggggggggggggggggghggggggghgggnhgggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg"],["YES","egggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggegggegegggegggggegeggggggggggggggghggggghggggghghggggghggghghggggggggghgggggggggggggngggngngggngggggggggggggngggggngggggggggpgpgggpgggggpgggggggpgggggpgggggpgggqgggggqgggggggqgggqgggggggqgggggggggqgqgggggggggqgqgggggqggg"]],[["pynyyyyypyyyfyyyyyyyvoyyyyvyyyldyyyyyhyyvyyyyyyyyyyyyoyyppyyyyyyywyyysyyyyayyyayyyyyyyoyyyydyyyyyavyyygiyyhfyyyyyyyyyyzyyyysyyyyicyyyyyyycjyyhykyiyykkyylyyyyiyyyyyyyyifyyyyyyyzyyyyyiyyryykyyyhzyydryyyysyyyyyyyyyyyyyaybyyyoyyyykyyyyyyyyyyncyyyyvryyjyyyyqyyfbyyysyyqypyydyyyyyyyyyyyqyywjyyyyyayyyyyyyyyjyyyyyyyyyyyyaygyyypyyyyyayyyyyyyoyyyyiyyyyyiyyyyyjoyykyyyyyyyyyyyyyyyyyyyyyohyyyyvyykyybiyyyyyyyyyyyyyyyyyyyyyyyfyyyyyyyyyyyyyyyyvyyyyyyy"],["NO"]],[["bbbbbbbbbbbbzqbbbbibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbbbbbbjbbbbbbbbbbbbbbgbbbbbbbbbbzebbbbbvbbbbbbbbbbbbbbbbbbbbbbbbtbbbtbvbebbbbzvbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbqbqjbbpbbzbbbbbbbbbbbbbbbbbbbbbbbbbbbebbbbzbbcbbbbbbbqbbbvbbbbbbbbbbbbbbbbbbbbpbbbbbbbbbbbgbbbbzbbbbbbbbbbbbjbbbbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbbebqbbbbjbbbbbbbbbbbbbbbbbbbbbbbbtbbbbbbbbbbbbbbbbbbbbbbbbbbbbqbbbbbbbbbbbbbbbibbbbbbbbbbbbbbbbbzb"],["YES","cbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbcbbbbbebebbbbbbbbbebbbbbebbbbbgbbbbbgbibbbbbibbbibibbbbbbbbbjbbbbbbbbbbbbbjbbbjbjbbbpbbbbbbbbbbbbbpbbbbbqbbbbbbbbbqbqbbbqbbbbbqbbbbbbbqbbbbbtbbbbbtbbbtbbbbbvbbbbbbbvbbbvbbbbbbbvbbbbbbbbbzbzbbbbbbbbbzbzbbbbbzbbbzbbbbbzbbbbb"]],[["tsssshssusssssssssssusssspssssssssssssssssssssssssssssssvsssssssssssssssossssvssssssssssysssssscsssssssussfsssssssszssssssssfssssssssssssssssssssssswssssssssdsssssssssssussssssessmssssssssssjsssssvsssssssssssssssssssssssssssssssssssssssssssssssstssssssssrsssssshssssssssssssssssssssssssssssusssssssssssssssssssssssssssssssessscssrssssssessssssslwwsssssssssssusssscsssssssssssssswssssssssssssssessssstssssssstsshsssssssssssssssssssssisssssssssssssssssssssssosssssswsss"],["NO"]],[["fkfffffffvfkfoffffqoqqffaftftvfuffjffffffffoflftvfffgffffffzfrvfocfmfkmjfftfmfwafzfffajsfffalguvjdfftfndfcnfjfgfffoofoflnffffffofdiczffajffdifrffffffrffffnifofffifdffvgffvoffwbfkfqfsfwfmwcfrkzuzokufmffffffcfffqfzfoffonfnfffkfffkwqifffsfifffzfofofffrfffflftkkfvfffbffuwffjtffmfffaffdlznffjllfqgfffffffffdmlfwlabfblcfdfwffffbfvmfrifwvvffffzffbfafnsffantfrkffzffffffifffrwacfrffffsdfffkffffooaffqckqbnbqqofvafffrtgffwsmfngffbzfffgffofnflfffvrffffmjjkfvfcfccfqfjfnf"],["NO"]],[["xxxxxxxxxxfxxxxxxxxxxxxxxxxxxxxxxxxxxxrxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxexxxxmxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxexxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxaxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsxxxxxzxxxxxxxxxxxxxxxxxxxxxxxxxhrxxnxxxxxxxxxxxxxxxxtxxxxxxxxxx"],["YES","axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxbxxxxxexxxxxexfxxxxxhxxxixmxxxxxxxxxnxxxxxxxxxxxxxoxxxoxoxxxpxxxxxxxxxxxxxrxxxxxrxxxxxxxxxsxtxxxtxxxxxtxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzxxxx"]],[["vtvzvlvlzvrtevdvvvsvjyvwrwwjhovvtotvkvvvvvovvewlvrvvfsvvvvnvfcsvvvtcrmckvvvztvvlvvdyfvcylvhvvcvvvvrvhwvryvhmvvcnsozusvltocvvywvvsvvvdocoftvkvvzvvtnvcmevyvhvhvlovvvvlvvvvtdjcvvvyvvurvuovusvvwvrvtvvfvmvvvmnycnvmvovuzvzvvvjvvvvnvvdrvvcrrvfvzujvyvtmrucvvvcjuvrvvtukvvvlvrkhvvsvjvftvzvmvvunsweuzcvvvfrvrwhyvdjerltlvcvvzednvyvjkvktvvesovvvmkvvnvzvjvcvfwvzhfkvvvuvvduovvmevkvhvuvmnvnvvvvvuvvlfjtjmdvceslvmevvvjvvkvvkjnvfyseevmvlvzvvvvvfdvleuvvlvvyvmrmvvfsevovhzdrru"],["NO"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmummmmmummmmmmmmmmmmmmmsmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmrummmmmmmmmmmmmmmmmmmmmmmmmmmmmsmsmmmmmmmrmmmmmmmmmmmmmmmmmmrmmmmmmcmmsmmmmmmmmrmmmmmmmmmmmmmmmmmmmmmmummmmmmcmmmmmmmmmmmmmmmmmmmcmmmmmmmrmmmmmmmmmmcmmmmmrurmmmmmmmmmmmmmummmmmmmmmmmummmmmmsmmmmrmmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmummsmmmummmmmmmmmrmmmmmmmmmmmmummummrmmmmmmmmmmmmmmmmmmmrmrmmmmmmmmmmmmmmummmmmmmmmmmmmsmmmmmmmummmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmmmmmmm"],["YES","cmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmcmcmmmmmmmmmcmmmmmcmmmmmcmmmmmrmrmmmmmrmmmrmrmmmmmmmmmrmmmmmmmmmmmmmrmmmrmrmmmrmmmmmmmmmmmmmrmmmmmrmmmmmmmmmsmsmmmsmmmmmsmmmmmmmsmmmmmsmmmmmsmmmsmmmmmsmmmmmmmsmmmummmmmmmummmmmmmmmumummmmmmmmmumummmmmummmummmmmummmmmmmummmumummmummmmmmm"]],[["z"],["YES","z"]]]}} +{"instance_id":"pseudo_to_code_2k_187","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nmpu = map from character to character\nvec is vector of long longs of size 1000006\nlet b and a be empty integer arrays of size 1000006\nlet visit be empty boolean array of size 1000006\ndefine the main function\n declare string variable s\n read s\n n and sum are long longs with sum = 0\n n = size of s\n declare vector of long longs called v\n for i = 2 to n inclusive\n set boolean t to 0\n for integer j = 2 to i exclusive\n if i % j = 0\n assign value of 1 to the t\n stop the loop\n end of the block\n end of the block\n if t = 0, push i into v\n end of the block\n w is an empty array of integers with size 26\n for i = 0 to length of s exclusive\n integer t = s[i] - 'a' casted to int\n increase w[t]\n end of the block\n for integer i = 0 to length of v exclusive\n if v[i] * 2 is greater than n, break\n for k = v[i] to length of s inclusive incrementing by v[i]\n if visit[k - 1] = 1, continue\n increment sum\n visit[k - 1] = 1\n end of the block\n end of the block\n if sum = 0\n print \"YES\\n\", s and a new line\n return to indicate successful execution\n end of the block\n assign value -1 to the integer p\n for integer i = 0 to 26 exclusive\n if w[i] >= sum, set p to i\n end of the block\n if p = -1\n print \"NO\\n\"\n return to indicate successful execution\n end of the block\n print \"YES\\n\"\n for i = 0 to n exclusive\n if visit[i] = 1\n s[i] = char(p) + 'a'\n decrease w[p]\n end of the block\n end of the block\n for integer i = 0 to n exclusive\n if visit[i] = 1, continue\n for integer j = 0 to 26 exclusive\n if w[j] is greater than 0\n s[i] = char(j) + 'a'\n decrease w[j]\n stop the loop\n end of the block\n end of the block\n end of the block\n print s and a new line\nend of the block\n\n[CODE]:","reference_output":"map mpu;\nvector vec[1000006];\nint b[1000006] = {}, a[1000006] = {};\nbool visit[1000006] = {};\nint main() {\n string s;\n cin >> s;\n long long n, sum = 0;\n n = s.size();\n vector v;\n for (int i = 2; i <= n; i++) {\n bool t = 0;\n for (int j = 2; j < i; j++) {\n if (i % j == 0) {\n t = 1;\n break;\n }\n }\n if (t == 0) { v.push_back(i); }\n }\n int w[26] = {};\n for (int i = 0; i < s.size(); i++) {\n int t = int(s[i] - 'a');\n w[t]++;\n }\n for (int i = 0; i < v.size(); i++) {\n if (v[i] * 2 > n) break;\n for (int k = v[i]; k <= s.size(); k += v[i]) {\n if (visit[k - 1] == 1) continue;\n sum++;\n visit[k - 1] = 1;\n }\n }\n if (sum == 0) {\n cout << \"YES\\n\" << s << endl;\n return 0;\n }\n int p = -1;\n for (int i = 0; i < 26; i++) {\n if (w[i] >= sum) { p = i; }\n }\n if (p == -1) {\n cout << \"NO\\n\";\n return 0;\n }\n cout << \"YES\\n\";\n for (int i = 0; i < n; i++) {\n if (visit[i] == 1) {\n s[i] = char(p) + 'a';\n w[p]--;\n }\n }\n for (int i = 0; i < n; i++) {\n if (visit[i] == 1) continue;\n for (int j = 0; j < 26; j++) {\n if (w[j] > 0) {\n s[i] = char(j) + 'a';\n w[j]--;\n break;\n }\n }\n }\n cout << s << endl;\n}","item":{"problem_id":"123A","pseudocode":"mpu = map from character to character\nvec is vector of long longs of size 1000006\nlet b and a be empty integer arrays of size 1000006\nlet visit be empty boolean array of size 1000006\ndefine the main function\n declare string variable s\n read s\n n and sum are long longs with sum = 0\n n = size of s\n declare vector of long longs called v\n for i = 2 to n inclusive\n set boolean t to 0\n for integer j = 2 to i exclusive\n if i % j = 0\n assign value of 1 to the t\n stop the loop\n end of the block\n end of the block\n if t = 0, push i into v\n end of the block\n w is an empty array of integers with size 26\n for i = 0 to length of s exclusive\n integer t = s[i] - 'a' casted to int\n increase w[t]\n end of the block\n for integer i = 0 to length of v exclusive\n if v[i] * 2 is greater than n, break\n for k = v[i] to length of s inclusive incrementing by v[i]\n if visit[k - 1] = 1, continue\n increment sum\n visit[k - 1] = 1\n end of the block\n end of the block\n if sum = 0\n print \"YES\\n\", s and a new line\n return to indicate successful execution\n end of the block\n assign value -1 to the integer p\n for integer i = 0 to 26 exclusive\n if w[i] >= sum, set p to i\n end of the block\n if p = -1\n print \"NO\\n\"\n return to indicate successful execution\n end of the block\n print \"YES\\n\"\n for i = 0 to n exclusive\n if visit[i] = 1\n s[i] = char(p) + 'a'\n decrease w[p]\n end of the block\n end of the block\n for integer i = 0 to n exclusive\n if visit[i] = 1, continue\n for integer j = 0 to 26 exclusive\n if w[j] is greater than 0\n s[i] = char(j) + 'a'\n decrease w[j]\n stop the loop\n end of the block\n end of the block\n end of the block\n print s and a new line\nend of the block","testcases":[[["abc"],["YES","abc"]],[["abcd"],["NO"]],[["xxxyxxx"],["YES","xxxxxxy"]],[["xxxjddyxduquybxdxx"],["NO"]],[["jjjjjjjjjjzjjjjjjjjjjjjjjjj"],["YES","jjjjjjjjjjjjjjjjjjjjjjzjjjj"]],[["mggnngggnjgnggggngnggpnggumggpg"],["NO"]],[["hfihihhfh"],["NO"]],[["ppppppopppionpppppppppwppppppppppppppppppppppb"],["YES","bpppppppppppppppppppppppppppipnpppppopppopwppp"]],[["jntnnnnnnngnnnnntnnennannnnnnnnnnnnnnnnjnnnnngnnnnannnnnnnnnq"],["NO"]],[["dattqddidyddddmriftkdddddddddqvedwddfdrdiaddiokdddodyqqddddtdddvdddaodd"],["NO"]],[["qqqqqqqqqqqqqqqqqqqqzqqqzqqqqqqqqqqqqqzqqqqqqqqcqqzqqqqqzqqqqqqqqqqqq"],["YES","cqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqqqqqzqqqqqzqzqqqqqzqq"]],[["danmwkmkcekwkkekwugcqwfrkrkqowkakqinzkzksisekhmqtykkuhugknygvkkrhdhnuuf"],["NO"]],[["jjjjjjjjjjjjjjjjjjjnjjjjjjjujjjjjjjjjjjjjjjjjjjjmpjjjjjjjjjjpjmjmpjjjjpjujjjjjjjjpjjjjjjujjjjjjnjjjjjjj"],["YES","mjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjmjjjjjmjnjjjjjnjjjpjpjjjjjpjjjpjjjjjpjjjjjjjujjjuju"]],[["qqqqqqqqqqsqqqqqqqqqqqqgpqqqqqqqbqqqqqqqqqqqqqqqqqqqqpqqqbqqqqqqqqqqqqqqqqqwqqqqsqqzqzqoqqqqqqqqqqwqqpqqqpq"],["NO"]],[["uupwbpqnpwpcpppewppdsppiplpppwidplpnqblppppppwsxpplxpxlppikpewxppnlbkpppqecbpeppqupsepppqpneqnpexpbqcpqpccnple"],["NO"]],[["nnnnnnnnnnnnjonnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnnnnjnnnnnnnnnnnnnnnnndfnnnnnnnnnnnnnnnnnnnnn"],["YES","dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnfnjnnnnnjnnnnnnnnnnnnnnnnnnnnnonnnnn"]],[["ssjjvshvssjdjnsdhvsjneehnnsshlldhjshdvsssshvsndsvsshlssvssvveslhllssshesssjsvvlsesssnselhjlljldlvnnshvsedllsennnnjssnsnsdsv"],["NO"]],[["cccccccccccxccgccccccccccgccciccccicccgccccccccccccccccxcccccccccccycccccccccctcccccccccccccccccccctccccaicccccgccccccccccccccccccccccaicccccccc"],["YES","acccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccacccccgcccgcccccgcccccccgccciciccciciccctccccccccccccctcccxcccccxcyccccc"]],[["httttfttttttttttthttttttttttthtttttutttttttttttsjttttttttutttttajdttttttytttttuttttttattttttttttttttttttttttdttttttttttttttttttttttttttattttttsttttttfttttttt"],["NO"]],[["wwwiuwujwijwwwwwwwwwwdwwwwhwwwwwiwwwwwwwwwuwwwhwwwjwwwwwwhwwwwwwwwniwwiwwwwwwwwwwwwwjwwwwwwwhwwwuhwwojwwwwjwwuwwwwwwwwwwiwwwwnwdwjwwwwwwwnwwwwh"],["NO"]],[["kkkkkkokkkkkkokkkkkokkkkkkkxkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkjkkkkekokkkkkkkkkkkkxkkkkokkkkkkkkkkkkkkkkkokkkkkkkkkbkkkkkkekkkxkkkkkkkkkkkkkkjkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkkekkkkk"],["YES","bkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkekkkekekkkjkjkkkkkkkkkkkkkkkkkkkkkokkkkkokokkkkkkkkkokokkkkkokkkkkxkkkxkkkkkxkkkkkxkx"]],[["ouscouyvvoooocvokcuoovoooyorjyocosackfocooaoosaucooaojhacoooooorsruocorokufcvyjokoooproaroocjooyrkoorojsocfooskxujoxxpokoopyookooysofooovuoroxraofokupcpjrcokoxucskovoaokoocyoyoovfrovouoocvsc"],["NO"]],[["ssssssssssssssssupsssssssqsssssssssssssssssssssssssssssssssssssassssssssssssssssssssssacssshsssssssscssssssssssspsssssslsgssssssslssssssdsasssessssssssssscssssbsszssssssssssssssssssossstsssssssssssssshs"],["YES","asssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssasssasbssscssssssssssssscssscsssssdsesssssssssgshssssshssssslssslsssssossssspspsssssssssqstsssuszsss"]],[["uuuuuuuuuuuuouuuuuuuuuuuuuuuuuuuuuuuucuuuuuuuuuuuuuuuuyuuuuuwuuuduuuuuuuuuutuuuuuuuuuuuuuuuuuuuuuuuuwuuuuquuuuuuuuuuuuuuuuuuuuuuuujumuuuuuutuuuuuuuhuuuuuuuauecuduuuuuuuuuuuuuuuuujusuuiuuuuuuuuuumuuyujuu"],["NO"]],[["hlchxdgrkdxglihydlyqdgxggvdhdgrgigkugrqhhgpgxhyhgkcgyqildrpcvdlpggikrxggculgyudrrgvkycvgklldxkgggxlxvqgrgygpigcudhidgcigyqqhyxkgdxixglpgdxuxhlyxkidglriglkvgyckqrqvguclryvpyvdggluggcgkillcghdxkrhdglgcxgxicrkgkpugvkhliqyii"],["NO"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhuhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhuhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhjhhhhhhhuhhuhhhhhhhhhhhhhhhhjhhhhhhhuhhhhuhhhhhhhhhhhhhjhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhjhhhhhjhjhhhhhhhhhjhjhhhjhuhhhhhhhhhhhuhhhhhhhhhhhuhhhuhuhhhuhh"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"]],[["uuuruuuuuuuuuuuuuuuuuuuuuuuiuuuuuuuuuuuuigzuuuuuuuuuuuguuuuuuouuuuuuuuuuuuuuuuuuuuuguuuuuuuzuueuuuuuuuuuuuuuufuuaouuuxuuuuutuuuuuuuuuuuuuuuuuuuuuuuuuuuulluuuutuuduuuuuuuujuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuupuruuouuuuuuuuuuuuuuuuuuuuqauu"],["YES","auuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuauuuduuuuueufuuuuuuuuuguguuuuuguuuuuiuuuiuuuuujuuuuululuuuuuuuuuououuuoupuuuuuuuuuuuquuuuuuuuuuuruuurutuuutuuuuuxuzuuuuuuuuuz"]],[["kkkmkkkkkkkymkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkdekkkkkkkkkkhrkkkkkkkkkkkkkkkkkkkkkxkkkkkokkkkikkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkfkkkkkkkkkkkkmkkkktykkkkkkkkkkkrkkkkkkrbekkkkkkkkkkkkkkkkkkfkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkykkkkkkkkkkkkkkzykkkkkkkkkkkmbkkkkkkkkk"],["NO"]],[["rrrvjurvrrsukrsrvxskrrrrbrapyrmrmvprmrseuakrmrnvokshwoawhnrbrrvrynwrynrxurrmprmmsryvkvronrmrprsrsrrrrrvwrarfrrrusrsvemwrevrarbwrmrrkhrryrhxornrorrrrrraphrvvhrrkrrfrprvorkkrsurpwvrkexpavbpnksafrrebxxyhsyrsywrrrrraryprunaxkbvrauokrrwrkpwwpwrrhakrxjrrxerefrrnxkwabrpbrrwmr"],["NO"]],[["mmmmqmmmmmmmmmmmmmmlmmmmmmmmammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmtmmmmmmmmmmimmmmmmmmmmmmmmmmmmammmmimmmmmmmmhmimmmomlmmmmmammmmmmmmmmmmmmmmmmimmmmlmmmmmmmimmmhmmmmmmmmmmmmmmmmmmmlmmmmmmmmmmmmmmhmmmmmmmmmmmmmmmtmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmotmmmmlmmmmmmmmmqmmmmmmmmmmmmmmmmmm"],["YES","ammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmamammmmmmmmmhmhmmmmmhmmmmmimmmimmmmmimmmmmimimmmmmmmmmlmlmmmlmlmmmmmmmmmmmlmmmmmmmmmmmmmmmmmmmmmmmmmmmomommmmmmmmmqmmmmmqmmmmmtmmmmmtmtm"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"],["YES","mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmm"]],[["zzzzzzzzzzzzzzrzzzzbmzzzezzzzzzgzzzzzzzzzzhzzzzgzzzxzzzznzzzzzyzzzzzzzzzzzxzzzzzzzzzzzzzzzizzzzzzzzzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmzzzzzzzzzzzzzzzzzzzzzhzzzzzyzzzzzzzzzmzzfzbzzuzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzyzzzzzzzzbzhzzzzzzzzzrzzzzzzyzzzzzzzzzzzzzzzzzzzzajzzzzz"],["YES","azzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzbzbzzzzzbzzzzzezzzfzzzzzgzzzzzgzhzzzzzzzzzhzhzzzizjzzzzzzzzzzzmzzzzzzzzzzzmzzzmznzzzozzzzzrzrzzzzzzzzzuzzzzzuzzzzzxzzzzzxzyzzzzzyzzzyzyzz"]],[["bbbbbbbbbcbbbbbbqbbbbbkbbbbbbbbbbbbbvbsbbbbbebbbbbbbbbbbbbbbbbbbbbbbcbbbkbvbbbbbbubbbbbbbfbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbekkbbbbbbbbbbbbbbbbfbqbbbbbbbbbfbbebbbbbbbbbbbbbbbbbbbbbbbbbeebbbbbbbbbbbbbbbeubbbbbbbbbbbqbbbbbbbbbbbbbbbbbbbbbbbbbbfbbbbbbbbbbbbbbbbkbebbbbbbbbbbbbuvbbbbbfbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbb"],["NO"]],[["wtwwttwttwwwwwwwwtwtwwwwwtwwtwwtwwwwwtwtwtwtwwtwwwtwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwtwwwwwwwwwwwtwwwwwtwttwwwwtwwwwwwwwwwwwwwwwwtwwwwtwwwwwwwwwwwwwttwtwwwwwtwwtwwwwwwwtwwttttwwwwwwwwwwwwwwwwwwwtwwwttwtwwtwwtwwtwwwwtwwtwtwwtwwwwwwwwwwtwwww"],["NO"]],[["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"],["YES","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]],[["koadaaaaarnaavmmavimdolavaaovkaaabalaavabaolarkewawaavaaaaiaaalaaeaaenaobaamaaikaiaabaavaeenlaaaaaadaoaaaaaaaiekaebavvwaaabiobaadavaiaaviaaaadaaaamarakmaaakaeavwlaaeanaaanaaaaaakllovwnenvlakaiomaaaaaaamaainebaeakaaaaaalraiaallaannammaaamaaaaeeaaiawaabvaaealaermaobaavreaaaaakavrvdaawaraedaaaaawiaeoaaaadaaaaavvadaaaoaaeewokbaaaeaaamaabdaaama"],["NO"]],[["oooooooocooocooooooooooooooooooooooooofoooooooooooooovoooozoooooooooqoooooooooooooooooooooooooooooooooxooovoooooooocoooooxooobooczoooooooooqooooooooooooooooocooooeooooooxoooooooooooooooooozooooooooooooooooooxoopooooocooobooooooooooooooooloooooooooooooooooooobooooelooooooooooooooooooooooooxooiooooooooooopooboooooooooooooooooooooolooooooooooooooooooooo"],["YES","booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooobobooooooooobocooococooooooooooocooooooooooocooocoeoooeooooofoiooooooooolooooolooooolooooopopoooooqoooqovooooooooovoooooooooooooxoooxoxoooxoooooooooooooxooooozooooooooozozooo"]],[["bbbbbbzbbbbbbbbbbgbbbbbbbbbbbpbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbmbbbbbbbobbbbbbbwubbbrbbbbbbbbbbbbbbbubbbbbbbqobbbbdbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbbbbbbbbbbbbbbbbbdbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbobbbbbbbbbibbbbbbbbbbgbbbbebbybbbbbbbbbbbbbbbabbbbbbbbbybiybbbbdbbbgbebbbbbkbbbbbbnbbbbbbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbtbbbbbbbbbpbbb"],["NO"]],[["llvlluelllllllllzllnndluelllhdunlnlllllhnbhldllelllllhllleulunvlldlllllbepellpzulbulllelllvblllulllllllllezpllhldellzldlllllllelllhlllehllvevlnullllvllllpudldlllvdbllllhnvlllllvllvllvlllplelzplpzllllulzlbllzldevlullelllhhzdeulllllllllnlzvllllllbllvllllllllluellnlllulnllllbdlevlhlvllllpenblvzlzlllblvhllllhllllpeblevelpllllnpbhlhllbllllndllblldvn"],["NO"]],[["zzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"],["YES","ozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"]],[["lsllllmllllslllxlvlxluyylllslllmlllvllxllslllvlslyulllullllllmlxulllyxlllmlllllvullllllslllsmlllxmllvvlslllllllllllulllvlllllllmllllsylylvluylllmullslllllvylmmlluyllvlylllllllllllvllllsmlxlslmlllxxslllmyluvylylllllxmxlulsslslmllulxllmllxuusllllumlllllmsssmxullllmsllllmlxxllmllllylvllmlluymxlllllslyxllvlllllllllllllllsllullmlllllslllsllullslllllllllllvyllllvlllylllsllvlvsmlvllllllulullllllslxlml"],["NO"]],[["cccjcchccccccjcccccccjlccccccccccccchccccwccctccccccccccccccccczccccccccccccccccccccccccccccccccccccccnwcccccccccccccccccccoccwcccccccccccwccccccccccccccncdccccbcctcccccccccccccccccccccccxccccccvcccnccccbccccccccccccccccccccccclccccccccczccvccccccvscccccccccxccccocccccccscccccccccccccxvccccccccccccccccccccccccccccccccccccccccccccccxccccccccccccwccccccchccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"],["YES","bcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbcccccccccccdccchchccchcccccjcjcccccccccjccccclccccclcccccncncccccncccococccccccccscccccccccccccsccctctcccvcccccccccccccvcccccvcccccccccvcwcccwcccccwcccccccwcccccwcccccxcccxcccccxcccccccxccczccccccczccccc"]],[["uuuuuuuuuuuuuuuuuuuuuuuuuuquuuuulquuuuuuuouuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuouuuuxouuuuuxuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuruuuuuuxuuuuuuuuuuuuuuuuuuuuuuuzuuuuuuuuuuuuuuupuuuuuuuuuuuuuuuuuuluuuuuuuuuuuuuuuuuuuuuuuuuuuuuurluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuruuuuuuouuuquuuluuuuuuuuupuuouuuuuuuuuuzuuuuuuuokuuluuuupuuukuuuuuruuuuuuupuuuuuuuuuuuuzuouuuuuuuuuuuuuuuz"],["NO"]],[["vkxvxkxvxxxkkvkxvkkxvvvvvvvvkkvkkxvvkkvkkvkkvxxvxvvvvkvkvvxvvxvxvvvkvxkkxkxxkxxkxvxvvxvkvvxvkvkvkxkxvxkvvkvxkxkvkxvxvxxxxxvxxvxxxkkvvvvkkvvvxxkxkvvkxvvxkkkvkvvkvvvvxxxkxxxvvvkxkxvkvxxkxkxkxkvvxxkkkkvxxkvkkxvxvxxvxxxxvvkvxkxkxvkkvxxvxkvvkxkkvxvkkkkkkxkxkvxkkkxxxxxxxvxkxkkvxkkxvkvkkvkkkxvkvkvkvvxkkkxxvxxxxxvkvvxkvvvxvxvkkvvvxkvkxkvxxkvvkxvvxkxxkxkkkvxkxxvkkkxxkxxxvxkxkkkvkkxxxvvkkvvkvkkkxkvxkxxxvkvxvxxkvkxkvkxvxvvxvxxkkkxxkkkkvvvv"],["NO"]],[["gggggggggggqggggggggnqggggggepgggeggggpggqeggggegggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghggqghgggggggggggggggggggggggqgqggggghgggnnggggggggggggggggqgggggpgggggggggggnggggpggggggggggggggggggggggggggggggggqgggqggggggggggeegggggggggggggggggggggngggggghqggggggggggggggggggggggggggggggepggggggggghgggggggggggggggggggggggggghggggggghgggnhgggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg"],["YES","egggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggegggegegggegggggegeggggggggggggggghggggghggggghghggggghggghghggggggggghgggggggggggggngggngngggngggggggggggggngggggngggggggggpgpgggpgggggpgggggggpgggggpgggggpgggqgggggqgggggggqgggqgggggggqgggggggggqgqgggggggggqgqgggggqggg"]],[["pynyyyyypyyyfyyyyyyyvoyyyyvyyyldyyyyyhyyvyyyyyyyyyyyyoyyppyyyyyyywyyysyyyyayyyayyyyyyyoyyyydyyyyyavyyygiyyhfyyyyyyyyyyzyyyysyyyyicyyyyyyycjyyhykyiyykkyylyyyyiyyyyyyyyifyyyyyyyzyyyyyiyyryykyyyhzyydryyyysyyyyyyyyyyyyyaybyyyoyyyykyyyyyyyyyyncyyyyvryyjyyyyqyyfbyyysyyqypyydyyyyyyyyyyyqyywjyyyyyayyyyyyyyyjyyyyyyyyyyyyaygyyypyyyyyayyyyyyyoyyyyiyyyyyiyyyyyjoyykyyyyyyyyyyyyyyyyyyyyyohyyyyvyykyybiyyyyyyyyyyyyyyyyyyyyyyyfyyyyyyyyyyyyyyyyvyyyyyyy"],["NO"]],[["bbbbbbbbbbbbzqbbbbibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbbbbbbjbbbbbbbbbbbbbbgbbbbbbbbbbzebbbbbvbbbbbbbbbbbbbbbbbbbbbbbbtbbbtbvbebbbbzvbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbqbqjbbpbbzbbbbbbbbbbbbbbbbbbbbbbbbbbbebbbbzbbcbbbbbbbqbbbvbbbbbbbbbbbbbbbbbbbbpbbbbbbbbbbbgbbbbzbbbbbbbbbbbbjbbbbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbbebqbbbbjbbbbbbbbbbbbbbbbbbbbbbbbtbbbbbbbbbbbbbbbbbbbbbbbbbbbbqbbbbbbbbbbbbbbbibbbbbbbbbbbbbbbbbzb"],["YES","cbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbcbbbbbebebbbbbbbbbebbbbbebbbbbgbbbbbgbibbbbbibbbibibbbbbbbbbjbbbbbbbbbbbbbjbbbjbjbbbpbbbbbbbbbbbbbpbbbbbqbbbbbbbbbqbqbbbqbbbbbqbbbbbbbqbbbbbtbbbbbtbbbtbbbbbvbbbbbbbvbbbvbbbbbbbvbbbbbbbbbzbzbbbbbbbbbzbzbbbbbzbbbzbbbbbzbbbbb"]],[["tsssshssusssssssssssusssspssssssssssssssssssssssssssssssvsssssssssssssssossssvssssssssssysssssscsssssssussfsssssssszssssssssfssssssssssssssssssssssswssssssssdsssssssssssussssssessmssssssssssjsssssvsssssssssssssssssssssssssssssssssssssssssssssssstssssssssrsssssshssssssssssssssssssssssssssssusssssssssssssssssssssssssssssssessscssrssssssessssssslwwsssssssssssusssscsssssssssssssswssssssssssssssessssstssssssstsshsssssssssssssssssssssisssssssssssssssssssssssosssssswsss"],["NO"]],[["fkfffffffvfkfoffffqoqqffaftftvfuffjffffffffoflftvfffgffffffzfrvfocfmfkmjfftfmfwafzfffajsfffalguvjdfftfndfcnfjfgfffoofoflnffffffofdiczffajffdifrffffffrffffnifofffifdffvgffvoffwbfkfqfsfwfmwcfrkzuzokufmffffffcfffqfzfoffonfnfffkfffkwqifffsfifffzfofofffrfffflftkkfvfffbffuwffjtffmfffaffdlznffjllfqgfffffffffdmlfwlabfblcfdfwffffbfvmfrifwvvffffzffbfafnsffantfrkffzffffffifffrwacfrffffsdfffkffffooaffqckqbnbqqofvafffrtgffwsmfngffbzfffgffofnflfffvrffffmjjkfvfcfccfqfjfnf"],["NO"]],[["xxxxxxxxxxfxxxxxxxxxxxxxxxxxxxxxxxxxxxrxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxexxxxmxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxexxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxaxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsxxxxxzxxxxxxxxxxxxxxxxxxxxxxxxxhrxxnxxxxxxxxxxxxxxxxtxxxxxxxxxx"],["YES","axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxbxxxxxexxxxxexfxxxxxhxxxixmxxxxxxxxxnxxxxxxxxxxxxxoxxxoxoxxxpxxxxxxxxxxxxxrxxxxxrxxxxxxxxxsxtxxxtxxxxxtxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzxxxx"]],[["vtvzvlvlzvrtevdvvvsvjyvwrwwjhovvtotvkvvvvvovvewlvrvvfsvvvvnvfcsvvvtcrmckvvvztvvlvvdyfvcylvhvvcvvvvrvhwvryvhmvvcnsozusvltocvvywvvsvvvdocoftvkvvzvvtnvcmevyvhvhvlovvvvlvvvvtdjcvvvyvvurvuovusvvwvrvtvvfvmvvvmnycnvmvovuzvzvvvjvvvvnvvdrvvcrrvfvzujvyvtmrucvvvcjuvrvvtukvvvlvrkhvvsvjvftvzvmvvunsweuzcvvvfrvrwhyvdjerltlvcvvzednvyvjkvktvvesovvvmkvvnvzvjvcvfwvzhfkvvvuvvduovvmevkvhvuvmnvnvvvvvuvvlfjtjmdvceslvmevvvjvvkvvkjnvfyseevmvlvzvvvvvfdvleuvvlvvyvmrmvvfsevovhzdrru"],["NO"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmummmmmummmmmmmmmmmmmmmsmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmrummmmmmmmmmmmmmmmmmmmmmmmmmmmmsmsmmmmmmmrmmmmmmmmmmmmmmmmmmrmmmmmmcmmsmmmmmmmmrmmmmmmmmmmmmmmmmmmmmmmummmmmmcmmmmmmmmmmmmmmmmmmmcmmmmmmmrmmmmmmmmmmcmmmmmrurmmmmmmmmmmmmmummmmmmmmmmmummmmmmsmmmmrmmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmummsmmmummmmmmmmmrmmmmmmmmmmmmummummrmmmmmmmmmmmmmmmmmmmrmrmmmmmmmmmmmmmmummmmmmmmmmmmmsmmmmmmmummmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmmmmmmm"],["YES","cmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmcmcmmmmmmmmmcmmmmmcmmmmmcmmmmmrmrmmmmmrmmmrmrmmmmmmmmmrmmmmmmmmmmmmmrmmmrmrmmmrmmmmmmmmmmmmmrmmmmmrmmmmmmmmmsmsmmmsmmmmmsmmmmmmmsmmmmmsmmmmmsmmmsmmmmmsmmmmmmmsmmmummmmmmmummmmmmmmmumummmmmmmmmumummmmmummmummmmmummmmmmmummmumummmummmmmmm"]],[["z"],["YES","z"]]]}} +{"instance_id":"pseudo_to_code_2k_188","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet pal be an array of characters of size 1100\ndeclare array of integers qtd with size 1100\ndeclare array of integers d with size 1100\nprimo is a boolean function with integer argument n\n return 0 if n = 1\n for i = 2 while i squared <= n\n return 0 if n % i = 0\n end of the block\n return 1\nend of the block\nres = array of characters of length 1100\ndefine the main function\n declare integer called i\n declare string called a\n read a\n declare integer variable called n = length of s\n for i = 0 to length of a exclusive increment qtd[a[i]]\n declare integer called dois = 0\n for i = 2 to length of a casted to integer inclusive\n if primo(i) && i * 2 is greater than n\n d[i] = 0\n else\n d[i] = 1\n increase dois by one\n end of the block\n end of the block\n assign value 0 to character l\n for i = 'a' to 'z' inclusive\n if qtd[i] >= dois\n set l to i\n decrease qtd[i] by dois\n break the loop\n end of the block\n end of the block\n declare integer called j = 'a'\n if l != 0\n print \"YES\" and a new line\n for i = 1 to n inclusive\n if d[i] = 1\n print l\n else\n increment j while qtd[j] = 0\n decrease qtd[j] by one\n print j casted to char\n end of the block\n end of the block\n print new line\n else\n print \"NO\" and a new line\n end of the block\nend of the block\n\n[CODE]:","reference_output":"char pal[1100];\nint qtd[1100];\nbool d[1100];\nbool primo(int n) {\n if (n == 1) return 0;\n for (int i = 2; i * i <= n; i++) {\n if (n % i == 0) return 0;\n }\n return 1;\n}\nchar res[1100];\nint main() {\n int i;\n string a;\n cin >> a;\n int n = (int)a.size();\n for (i = 0; i < (int)a.size(); i++) { qtd[(int)a[i]]++; }\n int dois = 0;\n for (i = 2; i <= (int)a.size(); i++) {\n if (primo(i) && i * 2 > n) {\n d[i] = 0;\n } else {\n d[i] = 1;\n dois++;\n }\n }\n char l = 0;\n for (i = 'a'; i <= 'z'; i++) {\n if (qtd[i] >= dois) {\n l = i;\n qtd[i] -= dois;\n break;\n }\n }\n int j = 'a';\n if (l != 0) {\n cout << \"YES\" << endl;\n for (i = 1; i <= n; i++) {\n if (d[i] == 1) {\n cout << l;\n } else {\n while (qtd[j] == 0) { j++; }\n qtd[j]--;\n cout << (char)j;\n }\n }\n cout << endl;\n } else {\n cout << \"NO\" << endl;\n }\n}","item":{"problem_id":"123A","pseudocode":"let pal be an array of characters of size 1100\ndeclare array of integers qtd with size 1100\ndeclare array of integers d with size 1100\nprimo is a boolean function with integer argument n\n return 0 if n = 1\n for i = 2 while i squared <= n\n return 0 if n % i = 0\n end of the block\n return 1\nend of the block\nres = array of characters of length 1100\ndefine the main function\n declare integer called i\n declare string called a\n read a\n declare integer variable called n = length of s\n for i = 0 to length of a exclusive increment qtd[a[i]]\n declare integer called dois = 0\n for i = 2 to length of a casted to integer inclusive\n if primo(i) && i * 2 is greater than n\n d[i] = 0\n else\n d[i] = 1\n increase dois by one\n end of the block\n end of the block\n assign value 0 to character l\n for i = 'a' to 'z' inclusive\n if qtd[i] >= dois\n set l to i\n decrease qtd[i] by dois\n break the loop\n end of the block\n end of the block\n declare integer called j = 'a'\n if l != 0\n print \"YES\" and a new line\n for i = 1 to n inclusive\n if d[i] = 1\n print l\n else\n increment j while qtd[j] = 0\n decrease qtd[j] by one\n print j casted to char\n end of the block\n end of the block\n print new line\n else\n print \"NO\" and a new line\n end of the block\nend of the block","testcases":[[["abc"],["YES","abc"]],[["abcd"],["NO"]],[["xxxyxxx"],["YES","xxxxxxy"]],[["xxxjddyxduquybxdxx"],["NO"]],[["jjjjjjjjjjzjjjjjjjjjjjjjjjj"],["YES","jjjjjjjjjjjjjjjjjjjjjjzjjjj"]],[["mggnngggnjgnggggngnggpnggumggpg"],["NO"]],[["hfihihhfh"],["NO"]],[["ppppppopppionpppppppppwppppppppppppppppppppppb"],["YES","bpppppppppppppppppppppppppppipnpppppopppopwppp"]],[["jntnnnnnnngnnnnntnnennannnnnnnnnnnnnnnnjnnnnngnnnnannnnnnnnnq"],["NO"]],[["dattqddidyddddmriftkdddddddddqvedwddfdrdiaddiokdddodyqqddddtdddvdddaodd"],["NO"]],[["qqqqqqqqqqqqqqqqqqqqzqqqzqqqqqqqqqqqqqzqqqqqqqqcqqzqqqqqzqqqqqqqqqqqq"],["YES","cqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqqqqqzqqqqqzqzqqqqqzqq"]],[["danmwkmkcekwkkekwugcqwfrkrkqowkakqinzkzksisekhmqtykkuhugknygvkkrhdhnuuf"],["NO"]],[["jjjjjjjjjjjjjjjjjjjnjjjjjjjujjjjjjjjjjjjjjjjjjjjmpjjjjjjjjjjpjmjmpjjjjpjujjjjjjjjpjjjjjjujjjjjjnjjjjjjj"],["YES","mjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjmjjjjjmjnjjjjjnjjjpjpjjjjjpjjjpjjjjjpjjjjjjjujjjuju"]],[["qqqqqqqqqqsqqqqqqqqqqqqgpqqqqqqqbqqqqqqqqqqqqqqqqqqqqpqqqbqqqqqqqqqqqqqqqqqwqqqqsqqzqzqoqqqqqqqqqqwqqpqqqpq"],["NO"]],[["uupwbpqnpwpcpppewppdsppiplpppwidplpnqblppppppwsxpplxpxlppikpewxppnlbkpppqecbpeppqupsepppqpneqnpexpbqcpqpccnple"],["NO"]],[["nnnnnnnnnnnnjonnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnnnnjnnnnnnnnnnnnnnnnndfnnnnnnnnnnnnnnnnnnnnn"],["YES","dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnfnjnnnnnjnnnnnnnnnnnnnnnnnnnnnonnnnn"]],[["ssjjvshvssjdjnsdhvsjneehnnsshlldhjshdvsssshvsndsvsshlssvssvveslhllssshesssjsvvlsesssnselhjlljldlvnnshvsedllsennnnjssnsnsdsv"],["NO"]],[["cccccccccccxccgccccccccccgccciccccicccgccccccccccccccccxcccccccccccycccccccccctcccccccccccccccccccctccccaicccccgccccccccccccccccccccccaicccccccc"],["YES","acccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccacccccgcccgcccccgcccccccgccciciccciciccctccccccccccccctcccxcccccxcyccccc"]],[["httttfttttttttttthttttttttttthtttttutttttttttttsjttttttttutttttajdttttttytttttuttttttattttttttttttttttttttttdttttttttttttttttttttttttttattttttsttttttfttttttt"],["NO"]],[["wwwiuwujwijwwwwwwwwwwdwwwwhwwwwwiwwwwwwwwwuwwwhwwwjwwwwwwhwwwwwwwwniwwiwwwwwwwwwwwwwjwwwwwwwhwwwuhwwojwwwwjwwuwwwwwwwwwwiwwwwnwdwjwwwwwwwnwwwwh"],["NO"]],[["kkkkkkokkkkkkokkkkkokkkkkkkxkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkjkkkkekokkkkkkkkkkkkxkkkkokkkkkkkkkkkkkkkkkokkkkkkkkkbkkkkkkekkkxkkkkkkkkkkkkkkjkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkkekkkkk"],["YES","bkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkekkkekekkkjkjkkkkkkkkkkkkkkkkkkkkkokkkkkokokkkkkkkkkokokkkkkokkkkkxkkkxkkkkkxkkkkkxkx"]],[["ouscouyvvoooocvokcuoovoooyorjyocosackfocooaoosaucooaojhacoooooorsruocorokufcvyjokoooproaroocjooyrkoorojsocfooskxujoxxpokoopyookooysofooovuoroxraofokupcpjrcokoxucskovoaokoocyoyoovfrovouoocvsc"],["NO"]],[["ssssssssssssssssupsssssssqsssssssssssssssssssssssssssssssssssssassssssssssssssssssssssacssshsssssssscssssssssssspsssssslsgssssssslssssssdsasssessssssssssscssssbsszssssssssssssssssssossstsssssssssssssshs"],["YES","asssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssasssasbssscssssssssssssscssscsssssdsesssssssssgshssssshssssslssslsssssossssspspsssssssssqstsssuszsss"]],[["uuuuuuuuuuuuouuuuuuuuuuuuuuuuuuuuuuuucuuuuuuuuuuuuuuuuyuuuuuwuuuduuuuuuuuuutuuuuuuuuuuuuuuuuuuuuuuuuwuuuuquuuuuuuuuuuuuuuuuuuuuuuujumuuuuuutuuuuuuuhuuuuuuuauecuduuuuuuuuuuuuuuuuujusuuiuuuuuuuuuumuuyujuu"],["NO"]],[["hlchxdgrkdxglihydlyqdgxggvdhdgrgigkugrqhhgpgxhyhgkcgyqildrpcvdlpggikrxggculgyudrrgvkycvgklldxkgggxlxvqgrgygpigcudhidgcigyqqhyxkgdxixglpgdxuxhlyxkidglriglkvgyckqrqvguclryvpyvdggluggcgkillcghdxkrhdglgcxgxicrkgkpugvkhliqyii"],["NO"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhuhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhuhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhjhhhhhhhuhhuhhhhhhhhhhhhhhhhjhhhhhhhuhhhhuhhhhhhhhhhhhhjhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhjhhhhhjhjhhhhhhhhhjhjhhhjhuhhhhhhhhhhhuhhhhhhhhhhhuhhhuhuhhhuhh"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"]],[["uuuruuuuuuuuuuuuuuuuuuuuuuuiuuuuuuuuuuuuigzuuuuuuuuuuuguuuuuuouuuuuuuuuuuuuuuuuuuuuguuuuuuuzuueuuuuuuuuuuuuuufuuaouuuxuuuuutuuuuuuuuuuuuuuuuuuuuuuuuuuuulluuuutuuduuuuuuuujuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuupuruuouuuuuuuuuuuuuuuuuuuuqauu"],["YES","auuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuauuuduuuuueufuuuuuuuuuguguuuuuguuuuuiuuuiuuuuujuuuuululuuuuuuuuuououuuoupuuuuuuuuuuuquuuuuuuuuuuruuurutuuutuuuuuxuzuuuuuuuuuz"]],[["kkkmkkkkkkkymkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkdekkkkkkkkkkhrkkkkkkkkkkkkkkkkkkkkkxkkkkkokkkkikkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkfkkkkkkkkkkkkmkkkktykkkkkkkkkkkrkkkkkkrbekkkkkkkkkkkkkkkkkkfkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkykkkkkkkkkkkkkkzykkkkkkkkkkkmbkkkkkkkkk"],["NO"]],[["rrrvjurvrrsukrsrvxskrrrrbrapyrmrmvprmrseuakrmrnvokshwoawhnrbrrvrynwrynrxurrmprmmsryvkvronrmrprsrsrrrrrvwrarfrrrusrsvemwrevrarbwrmrrkhrryrhxornrorrrrrraphrvvhrrkrrfrprvorkkrsurpwvrkexpavbpnksafrrebxxyhsyrsywrrrrraryprunaxkbvrauokrrwrkpwwpwrrhakrxjrrxerefrrnxkwabrpbrrwmr"],["NO"]],[["mmmmqmmmmmmmmmmmmmmlmmmmmmmmammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmtmmmmmmmmmmimmmmmmmmmmmmmmmmmmammmmimmmmmmmmhmimmmomlmmmmmammmmmmmmmmmmmmmmmmimmmmlmmmmmmmimmmhmmmmmmmmmmmmmmmmmmmlmmmmmmmmmmmmmmhmmmmmmmmmmmmmmmtmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmotmmmmlmmmmmmmmmqmmmmmmmmmmmmmmmmmm"],["YES","ammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmamammmmmmmmmhmhmmmmmhmmmmmimmmimmmmmimmmmmimimmmmmmmmmlmlmmmlmlmmmmmmmmmmmlmmmmmmmmmmmmmmmmmmmmmmmmmmmomommmmmmmmmqmmmmmqmmmmmtmmmmmtmtm"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"],["YES","mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmm"]],[["zzzzzzzzzzzzzzrzzzzbmzzzezzzzzzgzzzzzzzzzzhzzzzgzzzxzzzznzzzzzyzzzzzzzzzzzxzzzzzzzzzzzzzzzizzzzzzzzzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmzzzzzzzzzzzzzzzzzzzzzhzzzzzyzzzzzzzzzmzzfzbzzuzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzyzzzzzzzzbzhzzzzzzzzzrzzzzzzyzzzzzzzzzzzzzzzzzzzzajzzzzz"],["YES","azzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzbzbzzzzzbzzzzzezzzfzzzzzgzzzzzgzhzzzzzzzzzhzhzzzizjzzzzzzzzzzzmzzzzzzzzzzzmzzzmznzzzozzzzzrzrzzzzzzzzzuzzzzzuzzzzzxzzzzzxzyzzzzzyzzzyzyzz"]],[["bbbbbbbbbcbbbbbbqbbbbbkbbbbbbbbbbbbbvbsbbbbbebbbbbbbbbbbbbbbbbbbbbbbcbbbkbvbbbbbbubbbbbbbfbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbekkbbbbbbbbbbbbbbbbfbqbbbbbbbbbfbbebbbbbbbbbbbbbbbbbbbbbbbbbeebbbbbbbbbbbbbbbeubbbbbbbbbbbqbbbbbbbbbbbbbbbbbbbbbbbbbbfbbbbbbbbbbbbbbbbkbebbbbbbbbbbbbuvbbbbbfbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbb"],["NO"]],[["wtwwttwttwwwwwwwwtwtwwwwwtwwtwwtwwwwwtwtwtwtwwtwwwtwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwtwwwwwwwwwwwtwwwwwtwttwwwwtwwwwwwwwwwwwwwwwwtwwwwtwwwwwwwwwwwwwttwtwwwwwtwwtwwwwwwwtwwttttwwwwwwwwwwwwwwwwwwwtwwwttwtwwtwwtwwtwwwwtwwtwtwwtwwwwwwwwwwtwwww"],["NO"]],[["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"],["YES","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]],[["koadaaaaarnaavmmavimdolavaaovkaaabalaavabaolarkewawaavaaaaiaaalaaeaaenaobaamaaikaiaabaavaeenlaaaaaadaoaaaaaaaiekaebavvwaaabiobaadavaiaaviaaaadaaaamarakmaaakaeavwlaaeanaaanaaaaaakllovwnenvlakaiomaaaaaaamaainebaeakaaaaaalraiaallaannammaaamaaaaeeaaiawaabvaaealaermaobaavreaaaaakavrvdaawaraedaaaaawiaeoaaaadaaaaavvadaaaoaaeewokbaaaeaaamaabdaaama"],["NO"]],[["oooooooocooocooooooooooooooooooooooooofoooooooooooooovoooozoooooooooqoooooooooooooooooooooooooooooooooxooovoooooooocoooooxooobooczoooooooooqooooooooooooooooocooooeooooooxoooooooooooooooooozooooooooooooooooooxoopooooocooobooooooooooooooooloooooooooooooooooooobooooelooooooooooooooooooooooooxooiooooooooooopooboooooooooooooooooooooolooooooooooooooooooooo"],["YES","booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooobobooooooooobocooococooooooooooocooooooooooocooocoeoooeooooofoiooooooooolooooolooooolooooopopoooooqoooqovooooooooovoooooooooooooxoooxoxoooxoooooooooooooxooooozooooooooozozooo"]],[["bbbbbbzbbbbbbbbbbgbbbbbbbbbbbpbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbmbbbbbbbobbbbbbbwubbbrbbbbbbbbbbbbbbbubbbbbbbqobbbbdbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbbbbbbbbbbbbbbbbbdbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbobbbbbbbbbibbbbbbbbbbgbbbbebbybbbbbbbbbbbbbbbabbbbbbbbbybiybbbbdbbbgbebbbbbkbbbbbbnbbbbbbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbtbbbbbbbbbpbbb"],["NO"]],[["llvlluelllllllllzllnndluelllhdunlnlllllhnbhldllelllllhllleulunvlldlllllbepellpzulbulllelllvblllulllllllllezpllhldellzldlllllllelllhlllehllvevlnullllvllllpudldlllvdbllllhnvlllllvllvllvlllplelzplpzllllulzlbllzldevlullelllhhzdeulllllllllnlzvllllllbllvllllllllluellnlllulnllllbdlevlhlvllllpenblvzlzlllblvhllllhllllpeblevelpllllnpbhlhllbllllndllblldvn"],["NO"]],[["zzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"],["YES","ozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"]],[["lsllllmllllslllxlvlxluyylllslllmlllvllxllslllvlslyulllullllllmlxulllyxlllmlllllvullllllslllsmlllxmllvvlslllllllllllulllvlllllllmllllsylylvluylllmullslllllvylmmlluyllvlylllllllllllvllllsmlxlslmlllxxslllmyluvylylllllxmxlulsslslmllulxllmllxuusllllumlllllmsssmxullllmsllllmlxxllmllllylvllmlluymxlllllslyxllvlllllllllllllllsllullmlllllslllsllullslllllllllllvyllllvlllylllsllvlvsmlvllllllulullllllslxlml"],["NO"]],[["cccjcchccccccjcccccccjlccccccccccccchccccwccctccccccccccccccccczccccccccccccccccccccccccccccccccccccccnwcccccccccccccccccccoccwcccccccccccwccccccccccccccncdccccbcctcccccccccccccccccccccccxccccccvcccnccccbccccccccccccccccccccccclccccccccczccvccccccvscccccccccxccccocccccccscccccccccccccxvccccccccccccccccccccccccccccccccccccccccccccccxccccccccccccwccccccchccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"],["YES","bcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbcccccccccccdccchchccchcccccjcjcccccccccjccccclccccclcccccncncccccncccococccccccccscccccccccccccsccctctcccvcccccccccccccvcccccvcccccccccvcwcccwcccccwcccccccwcccccwcccccxcccxcccccxcccccccxccczccccccczccccc"]],[["uuuuuuuuuuuuuuuuuuuuuuuuuuquuuuulquuuuuuuouuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuouuuuxouuuuuxuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuruuuuuuxuuuuuuuuuuuuuuuuuuuuuuuzuuuuuuuuuuuuuuupuuuuuuuuuuuuuuuuuuluuuuuuuuuuuuuuuuuuuuuuuuuuuuuurluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuruuuuuuouuuquuuluuuuuuuuupuuouuuuuuuuuuzuuuuuuuokuuluuuupuuukuuuuuruuuuuuupuuuuuuuuuuuuzuouuuuuuuuuuuuuuuz"],["NO"]],[["vkxvxkxvxxxkkvkxvkkxvvvvvvvvkkvkkxvvkkvkkvkkvxxvxvvvvkvkvvxvvxvxvvvkvxkkxkxxkxxkxvxvvxvkvvxvkvkvkxkxvxkvvkvxkxkvkxvxvxxxxxvxxvxxxkkvvvvkkvvvxxkxkvvkxvvxkkkvkvvkvvvvxxxkxxxvvvkxkxvkvxxkxkxkxkvvxxkkkkvxxkvkkxvxvxxvxxxxvvkvxkxkxvkkvxxvxkvvkxkkvxvkkkkkkxkxkvxkkkxxxxxxxvxkxkkvxkkxvkvkkvkkkxvkvkvkvvxkkkxxvxxxxxvkvvxkvvvxvxvkkvvvxkvkxkvxxkvvkxvvxkxxkxkkkvxkxxvkkkxxkxxxvxkxkkkvkkxxxvvkkvvkvkkkxkvxkxxxvkvxvxxkvkxkvkxvxvvxvxxkkkxxkkkkvvvv"],["NO"]],[["gggggggggggqggggggggnqggggggepgggeggggpggqeggggegggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghggqghgggggggggggggggggggggggqgqggggghgggnnggggggggggggggggqgggggpgggggggggggnggggpggggggggggggggggggggggggggggggggqgggqggggggggggeegggggggggggggggggggggngggggghqggggggggggggggggggggggggggggggepggggggggghgggggggggggggggggggggggggghggggggghgggnhgggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg"],["YES","egggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggegggegegggegggggegeggggggggggggggghggggghggggghghggggghggghghggggggggghgggggggggggggngggngngggngggggggggggggngggggngggggggggpgpgggpgggggpgggggggpgggggpgggggpgggqgggggqgggggggqgggqgggggggqgggggggggqgqgggggggggqgqgggggqggg"]],[["pynyyyyypyyyfyyyyyyyvoyyyyvyyyldyyyyyhyyvyyyyyyyyyyyyoyyppyyyyyyywyyysyyyyayyyayyyyyyyoyyyydyyyyyavyyygiyyhfyyyyyyyyyyzyyyysyyyyicyyyyyyycjyyhykyiyykkyylyyyyiyyyyyyyyifyyyyyyyzyyyyyiyyryykyyyhzyydryyyysyyyyyyyyyyyyyaybyyyoyyyykyyyyyyyyyyncyyyyvryyjyyyyqyyfbyyysyyqypyydyyyyyyyyyyyqyywjyyyyyayyyyyyyyyjyyyyyyyyyyyyaygyyypyyyyyayyyyyyyoyyyyiyyyyyiyyyyyjoyykyyyyyyyyyyyyyyyyyyyyyohyyyyvyykyybiyyyyyyyyyyyyyyyyyyyyyyyfyyyyyyyyyyyyyyyyvyyyyyyy"],["NO"]],[["bbbbbbbbbbbbzqbbbbibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbbbbbbjbbbbbbbbbbbbbbgbbbbbbbbbbzebbbbbvbbbbbbbbbbbbbbbbbbbbbbbbtbbbtbvbebbbbzvbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbqbqjbbpbbzbbbbbbbbbbbbbbbbbbbbbbbbbbbebbbbzbbcbbbbbbbqbbbvbbbbbbbbbbbbbbbbbbbbpbbbbbbbbbbbgbbbbzbbbbbbbbbbbbjbbbbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbbebqbbbbjbbbbbbbbbbbbbbbbbbbbbbbbtbbbbbbbbbbbbbbbbbbbbbbbbbbbbqbbbbbbbbbbbbbbbibbbbbbbbbbbbbbbbbzb"],["YES","cbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbcbbbbbebebbbbbbbbbebbbbbebbbbbgbbbbbgbibbbbbibbbibibbbbbbbbbjbbbbbbbbbbbbbjbbbjbjbbbpbbbbbbbbbbbbbpbbbbbqbbbbbbbbbqbqbbbqbbbbbqbbbbbbbqbbbbbtbbbbbtbbbtbbbbbvbbbbbbbvbbbvbbbbbbbvbbbbbbbbbzbzbbbbbbbbbzbzbbbbbzbbbzbbbbbzbbbbb"]],[["tsssshssusssssssssssusssspssssssssssssssssssssssssssssssvsssssssssssssssossssvssssssssssysssssscsssssssussfsssssssszssssssssfssssssssssssssssssssssswssssssssdsssssssssssussssssessmssssssssssjsssssvsssssssssssssssssssssssssssssssssssssssssssssssstssssssssrsssssshssssssssssssssssssssssssssssusssssssssssssssssssssssssssssssessscssrssssssessssssslwwsssssssssssusssscsssssssssssssswssssssssssssssessssstssssssstsshsssssssssssssssssssssisssssssssssssssssssssssosssssswsss"],["NO"]],[["fkfffffffvfkfoffffqoqqffaftftvfuffjffffffffoflftvfffgffffffzfrvfocfmfkmjfftfmfwafzfffajsfffalguvjdfftfndfcnfjfgfffoofoflnffffffofdiczffajffdifrffffffrffffnifofffifdffvgffvoffwbfkfqfsfwfmwcfrkzuzokufmffffffcfffqfzfoffonfnfffkfffkwqifffsfifffzfofofffrfffflftkkfvfffbffuwffjtffmfffaffdlznffjllfqgfffffffffdmlfwlabfblcfdfwffffbfvmfrifwvvffffzffbfafnsffantfrkffzffffffifffrwacfrffffsdfffkffffooaffqckqbnbqqofvafffrtgffwsmfngffbzfffgffofnflfffvrffffmjjkfvfcfccfqfjfnf"],["NO"]],[["xxxxxxxxxxfxxxxxxxxxxxxxxxxxxxxxxxxxxxrxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxexxxxmxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxexxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxaxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsxxxxxzxxxxxxxxxxxxxxxxxxxxxxxxxhrxxnxxxxxxxxxxxxxxxxtxxxxxxxxxx"],["YES","axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxbxxxxxexxxxxexfxxxxxhxxxixmxxxxxxxxxnxxxxxxxxxxxxxoxxxoxoxxxpxxxxxxxxxxxxxrxxxxxrxxxxxxxxxsxtxxxtxxxxxtxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzxxxx"]],[["vtvzvlvlzvrtevdvvvsvjyvwrwwjhovvtotvkvvvvvovvewlvrvvfsvvvvnvfcsvvvtcrmckvvvztvvlvvdyfvcylvhvvcvvvvrvhwvryvhmvvcnsozusvltocvvywvvsvvvdocoftvkvvzvvtnvcmevyvhvhvlovvvvlvvvvtdjcvvvyvvurvuovusvvwvrvtvvfvmvvvmnycnvmvovuzvzvvvjvvvvnvvdrvvcrrvfvzujvyvtmrucvvvcjuvrvvtukvvvlvrkhvvsvjvftvzvmvvunsweuzcvvvfrvrwhyvdjerltlvcvvzednvyvjkvktvvesovvvmkvvnvzvjvcvfwvzhfkvvvuvvduovvmevkvhvuvmnvnvvvvvuvvlfjtjmdvceslvmevvvjvvkvvkjnvfyseevmvlvzvvvvvfdvleuvvlvvyvmrmvvfsevovhzdrru"],["NO"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmummmmmummmmmmmmmmmmmmmsmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmrummmmmmmmmmmmmmmmmmmmmmmmmmmmmsmsmmmmmmmrmmmmmmmmmmmmmmmmmmrmmmmmmcmmsmmmmmmmmrmmmmmmmmmmmmmmmmmmmmmmummmmmmcmmmmmmmmmmmmmmmmmmmcmmmmmmmrmmmmmmmmmmcmmmmmrurmmmmmmmmmmmmmummmmmmmmmmmummmmmmsmmmmrmmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmummsmmmummmmmmmmmrmmmmmmmmmmmmummummrmmmmmmmmmmmmmmmmmmmrmrmmmmmmmmmmmmmmummmmmmmmmmmmmsmmmmmmmummmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmmmmmmm"],["YES","cmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmcmcmmmmmmmmmcmmmmmcmmmmmcmmmmmrmrmmmmmrmmmrmrmmmmmmmmmrmmmmmmmmmmmmmrmmmrmrmmmrmmmmmmmmmmmmmrmmmmmrmmmmmmmmmsmsmmmsmmmmmsmmmmmmmsmmmmmsmmmmmsmmmsmmmmmsmmmmmmmsmmmummmmmmmummmmmmmmmumummmmmmmmmumummmmmummmummmmmummmmmmmummmumummmummmmmmm"]],[["z"],["YES","z"]]]}} +{"instance_id":"pseudo_to_code_2k_189","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate constant integer MAXN with value 1001\ndeclare integer called n\nlet s be an array of characters of length MAXN\nc is an array of integers with size 256 filled with 0\nf is an array of booleans with size MAXN\ndefine the main function\n read input to s\n assign length of s to n\n memset with arguments c, sizeof(c) and 0\n for i = 0 to n exclusive incremen c[s[i]]\n k is integer = 0\n for i = 0 to 256 exclusive\n if c[i] is greater than c[k] set k to i\n memset with arguments f, true and sizeof(f)\n for integer i = 2 to i * i <= n\n if f[i] is true\n for integer j = i * i to n inclusive with step of i, set f[j] to false\n set value of f[1] to true\n for integer i = 2 to i + i <= n, set f[j] to false\n for i = 1 to n inclusive\n if f[i] is false\n if c[k] = 0\n print \"NO\" and a new line\n return to indicate successful execution\n end of the block\n decrease c[s[i - 1] = k] by one\n end of the block\n assign value of 0 to k\n for integer i = 1 to n inclusive\n if f[i] is true\n increment k while c[k] = 0\n decrease c[s[i - 1] = k] by one\n end of the block\n print \"YES\" and a new line\n print s and a new line\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int MAXN = 1001;\nint n;\nchar s[MAXN];\nint c[256] = {0};\nbool f[MAXN];\nint main() {\n gets(s);\n n = strlen(s);\n memset(c, sizeof(c), 0);\n for (int i = 0; i < n; i++) c[s[i]]++;\n int k = 0;\n for (int i = 0; i < 256; i++)\n if (c[i] > c[k]) k = i;\n memset(f, true, sizeof(f));\n for (int i = 2; i * i <= n; i++)\n if (f[i])\n for (int j = i * i; j <= n; j += i) f[j] = false;\n f[1] = true;\n for (int i = 2; i + i <= n; i++) f[i] = false;\n for (int i = 1; i <= n; i++)\n if (!f[i]) {\n if (c[k] == 0) {\n cout << \"NO\" << endl;\n return 0;\n }\n c[s[i - 1] = k]--;\n }\n k = 0;\n for (int i = 1; i <= n; i++)\n if (f[i]) {\n while (c[k] == 0) k++;\n c[s[i - 1] = k]--;\n }\n cout << \"YES\" << endl;\n cout << s << endl;\n return 0;\n}","item":{"problem_id":"123A","pseudocode":"create constant integer MAXN with value 1001\ndeclare integer called n\nlet s be an array of characters of length MAXN\nc is an array of integers with size 256 filled with 0\nf is an array of booleans with size MAXN\ndefine the main function\n read input to s\n assign length of s to n\n memset with arguments c, sizeof(c) and 0\n for i = 0 to n exclusive incremen c[s[i]]\n k is integer = 0\n for i = 0 to 256 exclusive\n if c[i] is greater than c[k] set k to i\n memset with arguments f, true and sizeof(f)\n for integer i = 2 to i * i <= n\n if f[i] is true\n for integer j = i * i to n inclusive with step of i, set f[j] to false\n set value of f[1] to true\n for integer i = 2 to i + i <= n, set f[j] to false\n for i = 1 to n inclusive\n if f[i] is false\n if c[k] = 0\n print \"NO\" and a new line\n return to indicate successful execution\n end of the block\n decrease c[s[i - 1] = k] by one\n end of the block\n assign value of 0 to k\n for integer i = 1 to n inclusive\n if f[i] is true\n increment k while c[k] = 0\n decrease c[s[i - 1] = k] by one\n end of the block\n print \"YES\" and a new line\n print s and a new line\n return to indicate successful execution\nend of the block","testcases":[[["abc"],["YES","abc"]],[["abcd"],["NO"]],[["xxxyxxx"],["YES","xxxxxxy"]],[["xxxjddyxduquybxdxx"],["NO"]],[["jjjjjjjjjjzjjjjjjjjjjjjjjjj"],["YES","jjjjjjjjjjjjjjjjjjjjjjzjjjj"]],[["mggnngggnjgnggggngnggpnggumggpg"],["NO"]],[["hfihihhfh"],["NO"]],[["ppppppopppionpppppppppwppppppppppppppppppppppb"],["YES","bpppppppppppppppppppppppppppipnpppppopppopwppp"]],[["jntnnnnnnngnnnnntnnennannnnnnnnnnnnnnnnjnnnnngnnnnannnnnnnnnq"],["NO"]],[["dattqddidyddddmriftkdddddddddqvedwddfdrdiaddiokdddodyqqddddtdddvdddaodd"],["NO"]],[["qqqqqqqqqqqqqqqqqqqqzqqqzqqqqqqqqqqqqqzqqqqqqqqcqqzqqqqqzqqqqqqqqqqqq"],["YES","cqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqqqqqzqqqqqzqzqqqqqzqq"]],[["danmwkmkcekwkkekwugcqwfrkrkqowkakqinzkzksisekhmqtykkuhugknygvkkrhdhnuuf"],["NO"]],[["jjjjjjjjjjjjjjjjjjjnjjjjjjjujjjjjjjjjjjjjjjjjjjjmpjjjjjjjjjjpjmjmpjjjjpjujjjjjjjjpjjjjjjujjjjjjnjjjjjjj"],["YES","mjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjmjjjjjmjnjjjjjnjjjpjpjjjjjpjjjpjjjjjpjjjjjjjujjjuju"]],[["qqqqqqqqqqsqqqqqqqqqqqqgpqqqqqqqbqqqqqqqqqqqqqqqqqqqqpqqqbqqqqqqqqqqqqqqqqqwqqqqsqqzqzqoqqqqqqqqqqwqqpqqqpq"],["NO"]],[["uupwbpqnpwpcpppewppdsppiplpppwidplpnqblppppppwsxpplxpxlppikpewxppnlbkpppqecbpeppqupsepppqpneqnpexpbqcpqpccnple"],["NO"]],[["nnnnnnnnnnnnjonnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnnnnjnnnnnnnnnnnnnnnnndfnnnnnnnnnnnnnnnnnnnnn"],["YES","dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnfnjnnnnnjnnnnnnnnnnnnnnnnnnnnnonnnnn"]],[["ssjjvshvssjdjnsdhvsjneehnnsshlldhjshdvsssshvsndsvsshlssvssvveslhllssshesssjsvvlsesssnselhjlljldlvnnshvsedllsennnnjssnsnsdsv"],["NO"]],[["cccccccccccxccgccccccccccgccciccccicccgccccccccccccccccxcccccccccccycccccccccctcccccccccccccccccccctccccaicccccgccccccccccccccccccccccaicccccccc"],["YES","acccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccacccccgcccgcccccgcccccccgccciciccciciccctccccccccccccctcccxcccccxcyccccc"]],[["httttfttttttttttthttttttttttthtttttutttttttttttsjttttttttutttttajdttttttytttttuttttttattttttttttttttttttttttdttttttttttttttttttttttttttattttttsttttttfttttttt"],["NO"]],[["wwwiuwujwijwwwwwwwwwwdwwwwhwwwwwiwwwwwwwwwuwwwhwwwjwwwwwwhwwwwwwwwniwwiwwwwwwwwwwwwwjwwwwwwwhwwwuhwwojwwwwjwwuwwwwwwwwwwiwwwwnwdwjwwwwwwwnwwwwh"],["NO"]],[["kkkkkkokkkkkkokkkkkokkkkkkkxkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkjkkkkekokkkkkkkkkkkkxkkkkokkkkkkkkkkkkkkkkkokkkkkkkkkbkkkkkkekkkxkkkkkkkkkkkkkkjkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkkekkkkk"],["YES","bkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkekkkekekkkjkjkkkkkkkkkkkkkkkkkkkkkokkkkkokokkkkkkkkkokokkkkkokkkkkxkkkxkkkkkxkkkkkxkx"]],[["ouscouyvvoooocvokcuoovoooyorjyocosackfocooaoosaucooaojhacoooooorsruocorokufcvyjokoooproaroocjooyrkoorojsocfooskxujoxxpokoopyookooysofooovuoroxraofokupcpjrcokoxucskovoaokoocyoyoovfrovouoocvsc"],["NO"]],[["ssssssssssssssssupsssssssqsssssssssssssssssssssssssssssssssssssassssssssssssssssssssssacssshsssssssscssssssssssspsssssslsgssssssslssssssdsasssessssssssssscssssbsszssssssssssssssssssossstsssssssssssssshs"],["YES","asssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssasssasbssscssssssssssssscssscsssssdsesssssssssgshssssshssssslssslsssssossssspspsssssssssqstsssuszsss"]],[["uuuuuuuuuuuuouuuuuuuuuuuuuuuuuuuuuuuucuuuuuuuuuuuuuuuuyuuuuuwuuuduuuuuuuuuutuuuuuuuuuuuuuuuuuuuuuuuuwuuuuquuuuuuuuuuuuuuuuuuuuuuuujumuuuuuutuuuuuuuhuuuuuuuauecuduuuuuuuuuuuuuuuuujusuuiuuuuuuuuuumuuyujuu"],["NO"]],[["hlchxdgrkdxglihydlyqdgxggvdhdgrgigkugrqhhgpgxhyhgkcgyqildrpcvdlpggikrxggculgyudrrgvkycvgklldxkgggxlxvqgrgygpigcudhidgcigyqqhyxkgdxixglpgdxuxhlyxkidglriglkvgyckqrqvguclryvpyvdggluggcgkillcghdxkrhdglgcxgxicrkgkpugvkhliqyii"],["NO"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhuhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhuhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhjhhhhhhhuhhuhhhhhhhhhhhhhhhhjhhhhhhhuhhhhuhhhhhhhhhhhhhjhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhjhhhhhjhjhhhhhhhhhjhjhhhjhuhhhhhhhhhhhuhhhhhhhhhhhuhhhuhuhhhuhh"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"]],[["uuuruuuuuuuuuuuuuuuuuuuuuuuiuuuuuuuuuuuuigzuuuuuuuuuuuguuuuuuouuuuuuuuuuuuuuuuuuuuuguuuuuuuzuueuuuuuuuuuuuuuufuuaouuuxuuuuutuuuuuuuuuuuuuuuuuuuuuuuuuuuulluuuutuuduuuuuuuujuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuupuruuouuuuuuuuuuuuuuuuuuuuqauu"],["YES","auuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuauuuduuuuueufuuuuuuuuuguguuuuuguuuuuiuuuiuuuuujuuuuululuuuuuuuuuououuuoupuuuuuuuuuuuquuuuuuuuuuuruuurutuuutuuuuuxuzuuuuuuuuuz"]],[["kkkmkkkkkkkymkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkdekkkkkkkkkkhrkkkkkkkkkkkkkkkkkkkkkxkkkkkokkkkikkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkfkkkkkkkkkkkkmkkkktykkkkkkkkkkkrkkkkkkrbekkkkkkkkkkkkkkkkkkfkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkykkkkkkkkkkkkkkzykkkkkkkkkkkmbkkkkkkkkk"],["NO"]],[["rrrvjurvrrsukrsrvxskrrrrbrapyrmrmvprmrseuakrmrnvokshwoawhnrbrrvrynwrynrxurrmprmmsryvkvronrmrprsrsrrrrrvwrarfrrrusrsvemwrevrarbwrmrrkhrryrhxornrorrrrrraphrvvhrrkrrfrprvorkkrsurpwvrkexpavbpnksafrrebxxyhsyrsywrrrrraryprunaxkbvrauokrrwrkpwwpwrrhakrxjrrxerefrrnxkwabrpbrrwmr"],["NO"]],[["mmmmqmmmmmmmmmmmmmmlmmmmmmmmammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmtmmmmmmmmmmimmmmmmmmmmmmmmmmmmammmmimmmmmmmmhmimmmomlmmmmmammmmmmmmmmmmmmmmmmimmmmlmmmmmmmimmmhmmmmmmmmmmmmmmmmmmmlmmmmmmmmmmmmmmhmmmmmmmmmmmmmmmtmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmotmmmmlmmmmmmmmmqmmmmmmmmmmmmmmmmmm"],["YES","ammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmamammmmmmmmmhmhmmmmmhmmmmmimmmimmmmmimmmmmimimmmmmmmmmlmlmmmlmlmmmmmmmmmmmlmmmmmmmmmmmmmmmmmmmmmmmmmmmomommmmmmmmmqmmmmmqmmmmmtmmmmmtmtm"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"],["YES","mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmm"]],[["zzzzzzzzzzzzzzrzzzzbmzzzezzzzzzgzzzzzzzzzzhzzzzgzzzxzzzznzzzzzyzzzzzzzzzzzxzzzzzzzzzzzzzzzizzzzzzzzzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmzzzzzzzzzzzzzzzzzzzzzhzzzzzyzzzzzzzzzmzzfzbzzuzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzyzzzzzzzzbzhzzzzzzzzzrzzzzzzyzzzzzzzzzzzzzzzzzzzzajzzzzz"],["YES","azzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzbzbzzzzzbzzzzzezzzfzzzzzgzzzzzgzhzzzzzzzzzhzhzzzizjzzzzzzzzzzzmzzzzzzzzzzzmzzzmznzzzozzzzzrzrzzzzzzzzzuzzzzzuzzzzzxzzzzzxzyzzzzzyzzzyzyzz"]],[["bbbbbbbbbcbbbbbbqbbbbbkbbbbbbbbbbbbbvbsbbbbbebbbbbbbbbbbbbbbbbbbbbbbcbbbkbvbbbbbbubbbbbbbfbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbekkbbbbbbbbbbbbbbbbfbqbbbbbbbbbfbbebbbbbbbbbbbbbbbbbbbbbbbbbeebbbbbbbbbbbbbbbeubbbbbbbbbbbqbbbbbbbbbbbbbbbbbbbbbbbbbbfbbbbbbbbbbbbbbbbkbebbbbbbbbbbbbuvbbbbbfbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbb"],["NO"]],[["wtwwttwttwwwwwwwwtwtwwwwwtwwtwwtwwwwwtwtwtwtwwtwwwtwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwtwwwwwwwwwwwtwwwwwtwttwwwwtwwwwwwwwwwwwwwwwwtwwwwtwwwwwwwwwwwwwttwtwwwwwtwwtwwwwwwwtwwttttwwwwwwwwwwwwwwwwwwwtwwwttwtwwtwwtwwtwwwwtwwtwtwwtwwwwwwwwwwtwwww"],["NO"]],[["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"],["YES","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]],[["koadaaaaarnaavmmavimdolavaaovkaaabalaavabaolarkewawaavaaaaiaaalaaeaaenaobaamaaikaiaabaavaeenlaaaaaadaoaaaaaaaiekaebavvwaaabiobaadavaiaaviaaaadaaaamarakmaaakaeavwlaaeanaaanaaaaaakllovwnenvlakaiomaaaaaaamaainebaeakaaaaaalraiaallaannammaaamaaaaeeaaiawaabvaaealaermaobaavreaaaaakavrvdaawaraedaaaaawiaeoaaaadaaaaavvadaaaoaaeewokbaaaeaaamaabdaaama"],["NO"]],[["oooooooocooocooooooooooooooooooooooooofoooooooooooooovoooozoooooooooqoooooooooooooooooooooooooooooooooxooovoooooooocoooooxooobooczoooooooooqooooooooooooooooocooooeooooooxoooooooooooooooooozooooooooooooooooooxoopooooocooobooooooooooooooooloooooooooooooooooooobooooelooooooooooooooooooooooooxooiooooooooooopooboooooooooooooooooooooolooooooooooooooooooooo"],["YES","booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooobobooooooooobocooococooooooooooocooooooooooocooocoeoooeooooofoiooooooooolooooolooooolooooopopoooooqoooqovooooooooovoooooooooooooxoooxoxoooxoooooooooooooxooooozooooooooozozooo"]],[["bbbbbbzbbbbbbbbbbgbbbbbbbbbbbpbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbmbbbbbbbobbbbbbbwubbbrbbbbbbbbbbbbbbbubbbbbbbqobbbbdbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbbbbbbbbbbbbbbbbbdbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbobbbbbbbbbibbbbbbbbbbgbbbbebbybbbbbbbbbbbbbbbabbbbbbbbbybiybbbbdbbbgbebbbbbkbbbbbbnbbbbbbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbtbbbbbbbbbpbbb"],["NO"]],[["llvlluelllllllllzllnndluelllhdunlnlllllhnbhldllelllllhllleulunvlldlllllbepellpzulbulllelllvblllulllllllllezpllhldellzldlllllllelllhlllehllvevlnullllvllllpudldlllvdbllllhnvlllllvllvllvlllplelzplpzllllulzlbllzldevlullelllhhzdeulllllllllnlzvllllllbllvllllllllluellnlllulnllllbdlevlhlvllllpenblvzlzlllblvhllllhllllpeblevelpllllnpbhlhllbllllndllblldvn"],["NO"]],[["zzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"],["YES","ozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"]],[["lsllllmllllslllxlvlxluyylllslllmlllvllxllslllvlslyulllullllllmlxulllyxlllmlllllvullllllslllsmlllxmllvvlslllllllllllulllvlllllllmllllsylylvluylllmullslllllvylmmlluyllvlylllllllllllvllllsmlxlslmlllxxslllmyluvylylllllxmxlulsslslmllulxllmllxuusllllumlllllmsssmxullllmsllllmlxxllmllllylvllmlluymxlllllslyxllvlllllllllllllllsllullmlllllslllsllullslllllllllllvyllllvlllylllsllvlvsmlvllllllulullllllslxlml"],["NO"]],[["cccjcchccccccjcccccccjlccccccccccccchccccwccctccccccccccccccccczccccccccccccccccccccccccccccccccccccccnwcccccccccccccccccccoccwcccccccccccwccccccccccccccncdccccbcctcccccccccccccccccccccccxccccccvcccnccccbccccccccccccccccccccccclccccccccczccvccccccvscccccccccxccccocccccccscccccccccccccxvccccccccccccccccccccccccccccccccccccccccccccccxccccccccccccwccccccchccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"],["YES","bcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbcccccccccccdccchchccchcccccjcjcccccccccjccccclccccclcccccncncccccncccococccccccccscccccccccccccsccctctcccvcccccccccccccvcccccvcccccccccvcwcccwcccccwcccccccwcccccwcccccxcccxcccccxcccccccxccczccccccczccccc"]],[["uuuuuuuuuuuuuuuuuuuuuuuuuuquuuuulquuuuuuuouuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuouuuuxouuuuuxuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuruuuuuuxuuuuuuuuuuuuuuuuuuuuuuuzuuuuuuuuuuuuuuupuuuuuuuuuuuuuuuuuuluuuuuuuuuuuuuuuuuuuuuuuuuuuuuurluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuruuuuuuouuuquuuluuuuuuuuupuuouuuuuuuuuuzuuuuuuuokuuluuuupuuukuuuuuruuuuuuupuuuuuuuuuuuuzuouuuuuuuuuuuuuuuz"],["NO"]],[["vkxvxkxvxxxkkvkxvkkxvvvvvvvvkkvkkxvvkkvkkvkkvxxvxvvvvkvkvvxvvxvxvvvkvxkkxkxxkxxkxvxvvxvkvvxvkvkvkxkxvxkvvkvxkxkvkxvxvxxxxxvxxvxxxkkvvvvkkvvvxxkxkvvkxvvxkkkvkvvkvvvvxxxkxxxvvvkxkxvkvxxkxkxkxkvvxxkkkkvxxkvkkxvxvxxvxxxxvvkvxkxkxvkkvxxvxkvvkxkkvxvkkkkkkxkxkvxkkkxxxxxxxvxkxkkvxkkxvkvkkvkkkxvkvkvkvvxkkkxxvxxxxxvkvvxkvvvxvxvkkvvvxkvkxkvxxkvvkxvvxkxxkxkkkvxkxxvkkkxxkxxxvxkxkkkvkkxxxvvkkvvkvkkkxkvxkxxxvkvxvxxkvkxkvkxvxvvxvxxkkkxxkkkkvvvv"],["NO"]],[["gggggggggggqggggggggnqggggggepgggeggggpggqeggggegggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghggqghgggggggggggggggggggggggqgqggggghgggnnggggggggggggggggqgggggpgggggggggggnggggpggggggggggggggggggggggggggggggggqgggqggggggggggeegggggggggggggggggggggngggggghqggggggggggggggggggggggggggggggepggggggggghgggggggggggggggggggggggggghggggggghgggnhgggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg"],["YES","egggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggegggegegggegggggegeggggggggggggggghggggghggggghghggggghggghghggggggggghgggggggggggggngggngngggngggggggggggggngggggngggggggggpgpgggpgggggpgggggggpgggggpgggggpgggqgggggqgggggggqgggqgggggggqgggggggggqgqgggggggggqgqgggggqggg"]],[["pynyyyyypyyyfyyyyyyyvoyyyyvyyyldyyyyyhyyvyyyyyyyyyyyyoyyppyyyyyyywyyysyyyyayyyayyyyyyyoyyyydyyyyyavyyygiyyhfyyyyyyyyyyzyyyysyyyyicyyyyyyycjyyhykyiyykkyylyyyyiyyyyyyyyifyyyyyyyzyyyyyiyyryykyyyhzyydryyyysyyyyyyyyyyyyyaybyyyoyyyykyyyyyyyyyyncyyyyvryyjyyyyqyyfbyyysyyqypyydyyyyyyyyyyyqyywjyyyyyayyyyyyyyyjyyyyyyyyyyyyaygyyypyyyyyayyyyyyyoyyyyiyyyyyiyyyyyjoyykyyyyyyyyyyyyyyyyyyyyyohyyyyvyykyybiyyyyyyyyyyyyyyyyyyyyyyyfyyyyyyyyyyyyyyyyvyyyyyyy"],["NO"]],[["bbbbbbbbbbbbzqbbbbibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbbbbbbjbbbbbbbbbbbbbbgbbbbbbbbbbzebbbbbvbbbbbbbbbbbbbbbbbbbbbbbbtbbbtbvbebbbbzvbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbqbqjbbpbbzbbbbbbbbbbbbbbbbbbbbbbbbbbbebbbbzbbcbbbbbbbqbbbvbbbbbbbbbbbbbbbbbbbbpbbbbbbbbbbbgbbbbzbbbbbbbbbbbbjbbbbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbbebqbbbbjbbbbbbbbbbbbbbbbbbbbbbbbtbbbbbbbbbbbbbbbbbbbbbbbbbbbbqbbbbbbbbbbbbbbbibbbbbbbbbbbbbbbbbzb"],["YES","cbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbcbbbbbebebbbbbbbbbebbbbbebbbbbgbbbbbgbibbbbbibbbibibbbbbbbbbjbbbbbbbbbbbbbjbbbjbjbbbpbbbbbbbbbbbbbpbbbbbqbbbbbbbbbqbqbbbqbbbbbqbbbbbbbqbbbbbtbbbbbtbbbtbbbbbvbbbbbbbvbbbvbbbbbbbvbbbbbbbbbzbzbbbbbbbbbzbzbbbbbzbbbzbbbbbzbbbbb"]],[["tsssshssusssssssssssusssspssssssssssssssssssssssssssssssvsssssssssssssssossssvssssssssssysssssscsssssssussfsssssssszssssssssfssssssssssssssssssssssswssssssssdsssssssssssussssssessmssssssssssjsssssvsssssssssssssssssssssssssssssssssssssssssssssssstssssssssrsssssshssssssssssssssssssssssssssssusssssssssssssssssssssssssssssssessscssrssssssessssssslwwsssssssssssusssscsssssssssssssswssssssssssssssessssstssssssstsshsssssssssssssssssssssisssssssssssssssssssssssosssssswsss"],["NO"]],[["fkfffffffvfkfoffffqoqqffaftftvfuffjffffffffoflftvfffgffffffzfrvfocfmfkmjfftfmfwafzfffajsfffalguvjdfftfndfcnfjfgfffoofoflnffffffofdiczffajffdifrffffffrffffnifofffifdffvgffvoffwbfkfqfsfwfmwcfrkzuzokufmffffffcfffqfzfoffonfnfffkfffkwqifffsfifffzfofofffrfffflftkkfvfffbffuwffjtffmfffaffdlznffjllfqgfffffffffdmlfwlabfblcfdfwffffbfvmfrifwvvffffzffbfafnsffantfrkffzffffffifffrwacfrffffsdfffkffffooaffqckqbnbqqofvafffrtgffwsmfngffbzfffgffofnflfffvrffffmjjkfvfcfccfqfjfnf"],["NO"]],[["xxxxxxxxxxfxxxxxxxxxxxxxxxxxxxxxxxxxxxrxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxexxxxmxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxexxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxaxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsxxxxxzxxxxxxxxxxxxxxxxxxxxxxxxxhrxxnxxxxxxxxxxxxxxxxtxxxxxxxxxx"],["YES","axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxbxxxxxexxxxxexfxxxxxhxxxixmxxxxxxxxxnxxxxxxxxxxxxxoxxxoxoxxxpxxxxxxxxxxxxxrxxxxxrxxxxxxxxxsxtxxxtxxxxxtxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzxxxx"]],[["vtvzvlvlzvrtevdvvvsvjyvwrwwjhovvtotvkvvvvvovvewlvrvvfsvvvvnvfcsvvvtcrmckvvvztvvlvvdyfvcylvhvvcvvvvrvhwvryvhmvvcnsozusvltocvvywvvsvvvdocoftvkvvzvvtnvcmevyvhvhvlovvvvlvvvvtdjcvvvyvvurvuovusvvwvrvtvvfvmvvvmnycnvmvovuzvzvvvjvvvvnvvdrvvcrrvfvzujvyvtmrucvvvcjuvrvvtukvvvlvrkhvvsvjvftvzvmvvunsweuzcvvvfrvrwhyvdjerltlvcvvzednvyvjkvktvvesovvvmkvvnvzvjvcvfwvzhfkvvvuvvduovvmevkvhvuvmnvnvvvvvuvvlfjtjmdvceslvmevvvjvvkvvkjnvfyseevmvlvzvvvvvfdvleuvvlvvyvmrmvvfsevovhzdrru"],["NO"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmummmmmummmmmmmmmmmmmmmsmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmrummmmmmmmmmmmmmmmmmmmmmmmmmmmmsmsmmmmmmmrmmmmmmmmmmmmmmmmmmrmmmmmmcmmsmmmmmmmmrmmmmmmmmmmmmmmmmmmmmmmummmmmmcmmmmmmmmmmmmmmmmmmmcmmmmmmmrmmmmmmmmmmcmmmmmrurmmmmmmmmmmmmmummmmmmmmmmmummmmmmsmmmmrmmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmummsmmmummmmmmmmmrmmmmmmmmmmmmummummrmmmmmmmmmmmmmmmmmmmrmrmmmmmmmmmmmmmmummmmmmmmmmmmmsmmmmmmmummmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmmmmmmm"],["YES","cmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmcmcmmmmmmmmmcmmmmmcmmmmmcmmmmmrmrmmmmmrmmmrmrmmmmmmmmmrmmmmmmmmmmmmmrmmmrmrmmmrmmmmmmmmmmmmmrmmmmmrmmmmmmmmmsmsmmmsmmmmmsmmmmmmmsmmmmmsmmmmmsmmmsmmmmmsmmmmmmmsmmmummmmmmmummmmmmmmmumummmmmmmmmumummmmmummmummmmmummmmmmmummmumummmummmmmmm"]],[["z"],["YES","z"]]]}} +{"instance_id":"pseudo_to_code_2k_190","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nnum is an integer array with 30 elements and vis is an integer array with 1010 elements\nstr and ans are character arrays with size 1010\ndefine the main function\n declare integer variables t, q, i, j, k, len, t1 and mx, with mx = 0\n read str + 1\n len = length of (str + 1)\n for i = 1 to len inclusive\n t = str[i] - 'a' + 1\n increase num[t] by one\n if num[t] is greater than num[mx] set mx to t\n end of the block\n let cur = 1 and nf = 0 be integers\n for i = 2 to len inclusive\n continue the loop if vis[i] is not 0\n if i * 2 <= len\n for j = i to len inclusive incrementing j by i\n continue if vis[j] is not 0\n if num[mx] <= 0\n assign value of 1 to nf\n stop the loop\n end of the block\n ans[j] = mx - 1 + 'a'\n decrease num[mx]\n set vis[j] to 1\n end of the block\n end of the block\n if nf is not 0, break\n end of the block\n for i = 1 to len while - <= len and !nf\n continue if vis[i] is not 0\n while num[cur] <= 0 && cur <= 26 increment cur\n if cur is greater than 26\n assign value of 1 to nf\n stop the loop\n end of the block\n ans[i] = cur - 1 + 'a'\n decrease num[cur] by one\n end of the block\n if nf is not 0\n print \"NO\\n\"\n else\n print \"YES\\n\", ans + 1 and a new line\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int num[30], vis[1010];\nchar str[1010], ans[1010];\nint main() {\n int t, q, i, j, k, len, t1, mx = 0;\n cin >> str + 1;\n len = strlen(str + 1);\n for (i = 1; i <= len; i++) {\n t = str[i] - 'a' + 1;\n num[t]++;\n if (num[t] > num[mx]) mx = t;\n }\n int cur = 1, nf = 0;\n for (i = 2; i <= len; i++) {\n if (vis[i]) continue;\n if (i * 2 <= len) {\n for (j = i; j <= len; j += i) {\n if (vis[j]) continue;\n if (num[mx] <= 0) {\n nf = 1;\n break;\n }\n ans[j] = mx - 1 + 'a';\n num[mx]--;\n vis[j] = 1;\n }\n }\n if (nf) break;\n }\n for (i = 1; i <= len && !nf; i++) {\n if (vis[i]) continue;\n while (num[cur] <= 0 && cur <= 26) cur++;\n if (cur > 26) {\n nf = 1;\n break;\n }\n ans[i] = cur - 1 + 'a';\n num[cur]--;\n }\n if (nf)\n cout << \"NO\\n\";\n else\n cout << \"YES\\n\" << ans + 1 << endl;\n return 0;\n}","item":{"problem_id":"123A","pseudocode":"num is an integer array with 30 elements and vis is an integer array with 1010 elements\nstr and ans are character arrays with size 1010\ndefine the main function\n declare integer variables t, q, i, j, k, len, t1 and mx, with mx = 0\n read str + 1\n len = length of (str + 1)\n for i = 1 to len inclusive\n t = str[i] - 'a' + 1\n increase num[t] by one\n if num[t] is greater than num[mx] set mx to t\n end of the block\n let cur = 1 and nf = 0 be integers\n for i = 2 to len inclusive\n continue the loop if vis[i] is not 0\n if i * 2 <= len\n for j = i to len inclusive incrementing j by i\n continue if vis[j] is not 0\n if num[mx] <= 0\n assign value of 1 to nf\n stop the loop\n end of the block\n ans[j] = mx - 1 + 'a'\n decrease num[mx]\n set vis[j] to 1\n end of the block\n end of the block\n if nf is not 0, break\n end of the block\n for i = 1 to len while - <= len and !nf\n continue if vis[i] is not 0\n while num[cur] <= 0 && cur <= 26 increment cur\n if cur is greater than 26\n assign value of 1 to nf\n stop the loop\n end of the block\n ans[i] = cur - 1 + 'a'\n decrease num[cur] by one\n end of the block\n if nf is not 0\n print \"NO\\n\"\n else\n print \"YES\\n\", ans + 1 and a new line\n return to indicate successful execution\nend of the block","testcases":[[["abc"],["YES","abc"]],[["abcd"],["NO"]],[["xxxyxxx"],["YES","xxxxxxy"]],[["xxxjddyxduquybxdxx"],["NO"]],[["jjjjjjjjjjzjjjjjjjjjjjjjjjj"],["YES","jjjjjjjjjjjjjjjjjjjjjjzjjjj"]],[["mggnngggnjgnggggngnggpnggumggpg"],["NO"]],[["hfihihhfh"],["NO"]],[["ppppppopppionpppppppppwppppppppppppppppppppppb"],["YES","bpppppppppppppppppppppppppppipnpppppopppopwppp"]],[["jntnnnnnnngnnnnntnnennannnnnnnnnnnnnnnnjnnnnngnnnnannnnnnnnnq"],["NO"]],[["dattqddidyddddmriftkdddddddddqvedwddfdrdiaddiokdddodyqqddddtdddvdddaodd"],["NO"]],[["qqqqqqqqqqqqqqqqqqqqzqqqzqqqqqqqqqqqqqzqqqqqqqqcqqzqqqqqzqqqqqqqqqqqq"],["YES","cqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqqqqqzqqqqqzqzqqqqqzqq"]],[["danmwkmkcekwkkekwugcqwfrkrkqowkakqinzkzksisekhmqtykkuhugknygvkkrhdhnuuf"],["NO"]],[["jjjjjjjjjjjjjjjjjjjnjjjjjjjujjjjjjjjjjjjjjjjjjjjmpjjjjjjjjjjpjmjmpjjjjpjujjjjjjjjpjjjjjjujjjjjjnjjjjjjj"],["YES","mjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjmjjjjjmjnjjjjjnjjjpjpjjjjjpjjjpjjjjjpjjjjjjjujjjuju"]],[["qqqqqqqqqqsqqqqqqqqqqqqgpqqqqqqqbqqqqqqqqqqqqqqqqqqqqpqqqbqqqqqqqqqqqqqqqqqwqqqqsqqzqzqoqqqqqqqqqqwqqpqqqpq"],["NO"]],[["uupwbpqnpwpcpppewppdsppiplpppwidplpnqblppppppwsxpplxpxlppikpewxppnlbkpppqecbpeppqupsepppqpneqnpexpbqcpqpccnple"],["NO"]],[["nnnnnnnnnnnnjonnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnnnnjnnnnnnnnnnnnnnnnndfnnnnnnnnnnnnnnnnnnnnn"],["YES","dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnfnjnnnnnjnnnnnnnnnnnnnnnnnnnnnonnnnn"]],[["ssjjvshvssjdjnsdhvsjneehnnsshlldhjshdvsssshvsndsvsshlssvssvveslhllssshesssjsvvlsesssnselhjlljldlvnnshvsedllsennnnjssnsnsdsv"],["NO"]],[["cccccccccccxccgccccccccccgccciccccicccgccccccccccccccccxcccccccccccycccccccccctcccccccccccccccccccctccccaicccccgccccccccccccccccccccccaicccccccc"],["YES","acccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccacccccgcccgcccccgcccccccgccciciccciciccctccccccccccccctcccxcccccxcyccccc"]],[["httttfttttttttttthttttttttttthtttttutttttttttttsjttttttttutttttajdttttttytttttuttttttattttttttttttttttttttttdttttttttttttttttttttttttttattttttsttttttfttttttt"],["NO"]],[["wwwiuwujwijwwwwwwwwwwdwwwwhwwwwwiwwwwwwwwwuwwwhwwwjwwwwwwhwwwwwwwwniwwiwwwwwwwwwwwwwjwwwwwwwhwwwuhwwojwwwwjwwuwwwwwwwwwwiwwwwnwdwjwwwwwwwnwwwwh"],["NO"]],[["kkkkkkokkkkkkokkkkkokkkkkkkxkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkjkkkkekokkkkkkkkkkkkxkkkkokkkkkkkkkkkkkkkkkokkkkkkkkkbkkkkkkekkkxkkkkkkkkkkkkkkjkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkkekkkkk"],["YES","bkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkekkkekekkkjkjkkkkkkkkkkkkkkkkkkkkkokkkkkokokkkkkkkkkokokkkkkokkkkkxkkkxkkkkkxkkkkkxkx"]],[["ouscouyvvoooocvokcuoovoooyorjyocosackfocooaoosaucooaojhacoooooorsruocorokufcvyjokoooproaroocjooyrkoorojsocfooskxujoxxpokoopyookooysofooovuoroxraofokupcpjrcokoxucskovoaokoocyoyoovfrovouoocvsc"],["NO"]],[["ssssssssssssssssupsssssssqsssssssssssssssssssssssssssssssssssssassssssssssssssssssssssacssshsssssssscssssssssssspsssssslsgssssssslssssssdsasssessssssssssscssssbsszssssssssssssssssssossstsssssssssssssshs"],["YES","asssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssasssasbssscssssssssssssscssscsssssdsesssssssssgshssssshssssslssslsssssossssspspsssssssssqstsssuszsss"]],[["uuuuuuuuuuuuouuuuuuuuuuuuuuuuuuuuuuuucuuuuuuuuuuuuuuuuyuuuuuwuuuduuuuuuuuuutuuuuuuuuuuuuuuuuuuuuuuuuwuuuuquuuuuuuuuuuuuuuuuuuuuuuujumuuuuuutuuuuuuuhuuuuuuuauecuduuuuuuuuuuuuuuuuujusuuiuuuuuuuuuumuuyujuu"],["NO"]],[["hlchxdgrkdxglihydlyqdgxggvdhdgrgigkugrqhhgpgxhyhgkcgyqildrpcvdlpggikrxggculgyudrrgvkycvgklldxkgggxlxvqgrgygpigcudhidgcigyqqhyxkgdxixglpgdxuxhlyxkidglriglkvgyckqrqvguclryvpyvdggluggcgkillcghdxkrhdglgcxgxicrkgkpugvkhliqyii"],["NO"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhuhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhuhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhjhhhhhhhuhhuhhhhhhhhhhhhhhhhjhhhhhhhuhhhhuhhhhhhhhhhhhhjhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhjhhhhhjhjhhhhhhhhhjhjhhhjhuhhhhhhhhhhhuhhhhhhhhhhhuhhhuhuhhhuhh"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"]],[["uuuruuuuuuuuuuuuuuuuuuuuuuuiuuuuuuuuuuuuigzuuuuuuuuuuuguuuuuuouuuuuuuuuuuuuuuuuuuuuguuuuuuuzuueuuuuuuuuuuuuuufuuaouuuxuuuuutuuuuuuuuuuuuuuuuuuuuuuuuuuuulluuuutuuduuuuuuuujuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuupuruuouuuuuuuuuuuuuuuuuuuuqauu"],["YES","auuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuauuuduuuuueufuuuuuuuuuguguuuuuguuuuuiuuuiuuuuujuuuuululuuuuuuuuuououuuoupuuuuuuuuuuuquuuuuuuuuuuruuurutuuutuuuuuxuzuuuuuuuuuz"]],[["kkkmkkkkkkkymkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkdekkkkkkkkkkhrkkkkkkkkkkkkkkkkkkkkkxkkkkkokkkkikkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkfkkkkkkkkkkkkmkkkktykkkkkkkkkkkrkkkkkkrbekkkkkkkkkkkkkkkkkkfkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkykkkkkkkkkkkkkkzykkkkkkkkkkkmbkkkkkkkkk"],["NO"]],[["rrrvjurvrrsukrsrvxskrrrrbrapyrmrmvprmrseuakrmrnvokshwoawhnrbrrvrynwrynrxurrmprmmsryvkvronrmrprsrsrrrrrvwrarfrrrusrsvemwrevrarbwrmrrkhrryrhxornrorrrrrraphrvvhrrkrrfrprvorkkrsurpwvrkexpavbpnksafrrebxxyhsyrsywrrrrraryprunaxkbvrauokrrwrkpwwpwrrhakrxjrrxerefrrnxkwabrpbrrwmr"],["NO"]],[["mmmmqmmmmmmmmmmmmmmlmmmmmmmmammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmtmmmmmmmmmmimmmmmmmmmmmmmmmmmmammmmimmmmmmmmhmimmmomlmmmmmammmmmmmmmmmmmmmmmmimmmmlmmmmmmmimmmhmmmmmmmmmmmmmmmmmmmlmmmmmmmmmmmmmmhmmmmmmmmmmmmmmmtmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmotmmmmlmmmmmmmmmqmmmmmmmmmmmmmmmmmm"],["YES","ammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmamammmmmmmmmhmhmmmmmhmmmmmimmmimmmmmimmmmmimimmmmmmmmmlmlmmmlmlmmmmmmmmmmmlmmmmmmmmmmmmmmmmmmmmmmmmmmmomommmmmmmmmqmmmmmqmmmmmtmmmmmtmtm"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"],["YES","mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmm"]],[["zzzzzzzzzzzzzzrzzzzbmzzzezzzzzzgzzzzzzzzzzhzzzzgzzzxzzzznzzzzzyzzzzzzzzzzzxzzzzzzzzzzzzzzzizzzzzzzzzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmzzzzzzzzzzzzzzzzzzzzzhzzzzzyzzzzzzzzzmzzfzbzzuzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzyzzzzzzzzbzhzzzzzzzzzrzzzzzzyzzzzzzzzzzzzzzzzzzzzajzzzzz"],["YES","azzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzbzbzzzzzbzzzzzezzzfzzzzzgzzzzzgzhzzzzzzzzzhzhzzzizjzzzzzzzzzzzmzzzzzzzzzzzmzzzmznzzzozzzzzrzrzzzzzzzzzuzzzzzuzzzzzxzzzzzxzyzzzzzyzzzyzyzz"]],[["bbbbbbbbbcbbbbbbqbbbbbkbbbbbbbbbbbbbvbsbbbbbebbbbbbbbbbbbbbbbbbbbbbbcbbbkbvbbbbbbubbbbbbbfbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbekkbbbbbbbbbbbbbbbbfbqbbbbbbbbbfbbebbbbbbbbbbbbbbbbbbbbbbbbbeebbbbbbbbbbbbbbbeubbbbbbbbbbbqbbbbbbbbbbbbbbbbbbbbbbbbbbfbbbbbbbbbbbbbbbbkbebbbbbbbbbbbbuvbbbbbfbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbb"],["NO"]],[["wtwwttwttwwwwwwwwtwtwwwwwtwwtwwtwwwwwtwtwtwtwwtwwwtwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwtwwwwwwwwwwwtwwwwwtwttwwwwtwwwwwwwwwwwwwwwwwtwwwwtwwwwwwwwwwwwwttwtwwwwwtwwtwwwwwwwtwwttttwwwwwwwwwwwwwwwwwwwtwwwttwtwwtwwtwwtwwwwtwwtwtwwtwwwwwwwwwwtwwww"],["NO"]],[["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"],["YES","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]],[["koadaaaaarnaavmmavimdolavaaovkaaabalaavabaolarkewawaavaaaaiaaalaaeaaenaobaamaaikaiaabaavaeenlaaaaaadaoaaaaaaaiekaebavvwaaabiobaadavaiaaviaaaadaaaamarakmaaakaeavwlaaeanaaanaaaaaakllovwnenvlakaiomaaaaaaamaainebaeakaaaaaalraiaallaannammaaamaaaaeeaaiawaabvaaealaermaobaavreaaaaakavrvdaawaraedaaaaawiaeoaaaadaaaaavvadaaaoaaeewokbaaaeaaamaabdaaama"],["NO"]],[["oooooooocooocooooooooooooooooooooooooofoooooooooooooovoooozoooooooooqoooooooooooooooooooooooooooooooooxooovoooooooocoooooxooobooczoooooooooqooooooooooooooooocooooeooooooxoooooooooooooooooozooooooooooooooooooxoopooooocooobooooooooooooooooloooooooooooooooooooobooooelooooooooooooooooooooooooxooiooooooooooopooboooooooooooooooooooooolooooooooooooooooooooo"],["YES","booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooobobooooooooobocooococooooooooooocooooooooooocooocoeoooeooooofoiooooooooolooooolooooolooooopopoooooqoooqovooooooooovoooooooooooooxoooxoxoooxoooooooooooooxooooozooooooooozozooo"]],[["bbbbbbzbbbbbbbbbbgbbbbbbbbbbbpbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbmbbbbbbbobbbbbbbwubbbrbbbbbbbbbbbbbbbubbbbbbbqobbbbdbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbbbbbbbbbbbbbbbbbdbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbobbbbbbbbbibbbbbbbbbbgbbbbebbybbbbbbbbbbbbbbbabbbbbbbbbybiybbbbdbbbgbebbbbbkbbbbbbnbbbbbbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbtbbbbbbbbbpbbb"],["NO"]],[["llvlluelllllllllzllnndluelllhdunlnlllllhnbhldllelllllhllleulunvlldlllllbepellpzulbulllelllvblllulllllllllezpllhldellzldlllllllelllhlllehllvevlnullllvllllpudldlllvdbllllhnvlllllvllvllvlllplelzplpzllllulzlbllzldevlullelllhhzdeulllllllllnlzvllllllbllvllllllllluellnlllulnllllbdlevlhlvllllpenblvzlzlllblvhllllhllllpeblevelpllllnpbhlhllbllllndllblldvn"],["NO"]],[["zzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"],["YES","ozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"]],[["lsllllmllllslllxlvlxluyylllslllmlllvllxllslllvlslyulllullllllmlxulllyxlllmlllllvullllllslllsmlllxmllvvlslllllllllllulllvlllllllmllllsylylvluylllmullslllllvylmmlluyllvlylllllllllllvllllsmlxlslmlllxxslllmyluvylylllllxmxlulsslslmllulxllmllxuusllllumlllllmsssmxullllmsllllmlxxllmllllylvllmlluymxlllllslyxllvlllllllllllllllsllullmlllllslllsllullslllllllllllvyllllvlllylllsllvlvsmlvllllllulullllllslxlml"],["NO"]],[["cccjcchccccccjcccccccjlccccccccccccchccccwccctccccccccccccccccczccccccccccccccccccccccccccccccccccccccnwcccccccccccccccccccoccwcccccccccccwccccccccccccccncdccccbcctcccccccccccccccccccccccxccccccvcccnccccbccccccccccccccccccccccclccccccccczccvccccccvscccccccccxccccocccccccscccccccccccccxvccccccccccccccccccccccccccccccccccccccccccccccxccccccccccccwccccccchccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"],["YES","bcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbcccccccccccdccchchccchcccccjcjcccccccccjccccclccccclcccccncncccccncccococccccccccscccccccccccccsccctctcccvcccccccccccccvcccccvcccccccccvcwcccwcccccwcccccccwcccccwcccccxcccxcccccxcccccccxccczccccccczccccc"]],[["uuuuuuuuuuuuuuuuuuuuuuuuuuquuuuulquuuuuuuouuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuouuuuxouuuuuxuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuruuuuuuxuuuuuuuuuuuuuuuuuuuuuuuzuuuuuuuuuuuuuuupuuuuuuuuuuuuuuuuuuluuuuuuuuuuuuuuuuuuuuuuuuuuuuuurluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuruuuuuuouuuquuuluuuuuuuuupuuouuuuuuuuuuzuuuuuuuokuuluuuupuuukuuuuuruuuuuuupuuuuuuuuuuuuzuouuuuuuuuuuuuuuuz"],["NO"]],[["vkxvxkxvxxxkkvkxvkkxvvvvvvvvkkvkkxvvkkvkkvkkvxxvxvvvvkvkvvxvvxvxvvvkvxkkxkxxkxxkxvxvvxvkvvxvkvkvkxkxvxkvvkvxkxkvkxvxvxxxxxvxxvxxxkkvvvvkkvvvxxkxkvvkxvvxkkkvkvvkvvvvxxxkxxxvvvkxkxvkvxxkxkxkxkvvxxkkkkvxxkvkkxvxvxxvxxxxvvkvxkxkxvkkvxxvxkvvkxkkvxvkkkkkkxkxkvxkkkxxxxxxxvxkxkkvxkkxvkvkkvkkkxvkvkvkvvxkkkxxvxxxxxvkvvxkvvvxvxvkkvvvxkvkxkvxxkvvkxvvxkxxkxkkkvxkxxvkkkxxkxxxvxkxkkkvkkxxxvvkkvvkvkkkxkvxkxxxvkvxvxxkvkxkvkxvxvvxvxxkkkxxkkkkvvvv"],["NO"]],[["gggggggggggqggggggggnqggggggepgggeggggpggqeggggegggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghggqghgggggggggggggggggggggggqgqggggghgggnnggggggggggggggggqgggggpgggggggggggnggggpggggggggggggggggggggggggggggggggqgggqggggggggggeegggggggggggggggggggggngggggghqggggggggggggggggggggggggggggggepggggggggghgggggggggggggggggggggggggghggggggghgggnhgggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg"],["YES","egggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggegggegegggegggggegeggggggggggggggghggggghggggghghggggghggghghggggggggghgggggggggggggngggngngggngggggggggggggngggggngggggggggpgpgggpgggggpgggggggpgggggpgggggpgggqgggggqgggggggqgggqgggggggqgggggggggqgqgggggggggqgqgggggqggg"]],[["pynyyyyypyyyfyyyyyyyvoyyyyvyyyldyyyyyhyyvyyyyyyyyyyyyoyyppyyyyyyywyyysyyyyayyyayyyyyyyoyyyydyyyyyavyyygiyyhfyyyyyyyyyyzyyyysyyyyicyyyyyyycjyyhykyiyykkyylyyyyiyyyyyyyyifyyyyyyyzyyyyyiyyryykyyyhzyydryyyysyyyyyyyyyyyyyaybyyyoyyyykyyyyyyyyyyncyyyyvryyjyyyyqyyfbyyysyyqypyydyyyyyyyyyyyqyywjyyyyyayyyyyyyyyjyyyyyyyyyyyyaygyyypyyyyyayyyyyyyoyyyyiyyyyyiyyyyyjoyykyyyyyyyyyyyyyyyyyyyyyohyyyyvyykyybiyyyyyyyyyyyyyyyyyyyyyyyfyyyyyyyyyyyyyyyyvyyyyyyy"],["NO"]],[["bbbbbbbbbbbbzqbbbbibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbbbbbbjbbbbbbbbbbbbbbgbbbbbbbbbbzebbbbbvbbbbbbbbbbbbbbbbbbbbbbbbtbbbtbvbebbbbzvbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbqbqjbbpbbzbbbbbbbbbbbbbbbbbbbbbbbbbbbebbbbzbbcbbbbbbbqbbbvbbbbbbbbbbbbbbbbbbbbpbbbbbbbbbbbgbbbbzbbbbbbbbbbbbjbbbbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbbebqbbbbjbbbbbbbbbbbbbbbbbbbbbbbbtbbbbbbbbbbbbbbbbbbbbbbbbbbbbqbbbbbbbbbbbbbbbibbbbbbbbbbbbbbbbbzb"],["YES","cbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbcbbbbbebebbbbbbbbbebbbbbebbbbbgbbbbbgbibbbbbibbbibibbbbbbbbbjbbbbbbbbbbbbbjbbbjbjbbbpbbbbbbbbbbbbbpbbbbbqbbbbbbbbbqbqbbbqbbbbbqbbbbbbbqbbbbbtbbbbbtbbbtbbbbbvbbbbbbbvbbbvbbbbbbbvbbbbbbbbbzbzbbbbbbbbbzbzbbbbbzbbbzbbbbbzbbbbb"]],[["tsssshssusssssssssssusssspssssssssssssssssssssssssssssssvsssssssssssssssossssvssssssssssysssssscsssssssussfsssssssszssssssssfssssssssssssssssssssssswssssssssdsssssssssssussssssessmssssssssssjsssssvsssssssssssssssssssssssssssssssssssssssssssssssstssssssssrsssssshssssssssssssssssssssssssssssusssssssssssssssssssssssssssssssessscssrssssssessssssslwwsssssssssssusssscsssssssssssssswssssssssssssssessssstssssssstsshsssssssssssssssssssssisssssssssssssssssssssssosssssswsss"],["NO"]],[["fkfffffffvfkfoffffqoqqffaftftvfuffjffffffffoflftvfffgffffffzfrvfocfmfkmjfftfmfwafzfffajsfffalguvjdfftfndfcnfjfgfffoofoflnffffffofdiczffajffdifrffffffrffffnifofffifdffvgffvoffwbfkfqfsfwfmwcfrkzuzokufmffffffcfffqfzfoffonfnfffkfffkwqifffsfifffzfofofffrfffflftkkfvfffbffuwffjtffmfffaffdlznffjllfqgfffffffffdmlfwlabfblcfdfwffffbfvmfrifwvvffffzffbfafnsffantfrkffzffffffifffrwacfrffffsdfffkffffooaffqckqbnbqqofvafffrtgffwsmfngffbzfffgffofnflfffvrffffmjjkfvfcfccfqfjfnf"],["NO"]],[["xxxxxxxxxxfxxxxxxxxxxxxxxxxxxxxxxxxxxxrxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxexxxxmxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxexxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxaxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsxxxxxzxxxxxxxxxxxxxxxxxxxxxxxxxhrxxnxxxxxxxxxxxxxxxxtxxxxxxxxxx"],["YES","axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxbxxxxxexxxxxexfxxxxxhxxxixmxxxxxxxxxnxxxxxxxxxxxxxoxxxoxoxxxpxxxxxxxxxxxxxrxxxxxrxxxxxxxxxsxtxxxtxxxxxtxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzxxxx"]],[["vtvzvlvlzvrtevdvvvsvjyvwrwwjhovvtotvkvvvvvovvewlvrvvfsvvvvnvfcsvvvtcrmckvvvztvvlvvdyfvcylvhvvcvvvvrvhwvryvhmvvcnsozusvltocvvywvvsvvvdocoftvkvvzvvtnvcmevyvhvhvlovvvvlvvvvtdjcvvvyvvurvuovusvvwvrvtvvfvmvvvmnycnvmvovuzvzvvvjvvvvnvvdrvvcrrvfvzujvyvtmrucvvvcjuvrvvtukvvvlvrkhvvsvjvftvzvmvvunsweuzcvvvfrvrwhyvdjerltlvcvvzednvyvjkvktvvesovvvmkvvnvzvjvcvfwvzhfkvvvuvvduovvmevkvhvuvmnvnvvvvvuvvlfjtjmdvceslvmevvvjvvkvvkjnvfyseevmvlvzvvvvvfdvleuvvlvvyvmrmvvfsevovhzdrru"],["NO"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmummmmmummmmmmmmmmmmmmmsmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmrummmmmmmmmmmmmmmmmmmmmmmmmmmmmsmsmmmmmmmrmmmmmmmmmmmmmmmmmmrmmmmmmcmmsmmmmmmmmrmmmmmmmmmmmmmmmmmmmmmmummmmmmcmmmmmmmmmmmmmmmmmmmcmmmmmmmrmmmmmmmmmmcmmmmmrurmmmmmmmmmmmmmummmmmmmmmmmummmmmmsmmmmrmmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmummsmmmummmmmmmmmrmmmmmmmmmmmmummummrmmmmmmmmmmmmmmmmmmmrmrmmmmmmmmmmmmmmummmmmmmmmmmmmsmmmmmmmummmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmmmmmmm"],["YES","cmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmcmcmmmmmmmmmcmmmmmcmmmmmcmmmmmrmrmmmmmrmmmrmrmmmmmmmmmrmmmmmmmmmmmmmrmmmrmrmmmrmmmmmmmmmmmmmrmmmmmrmmmmmmmmmsmsmmmsmmmmmsmmmmmmmsmmmmmsmmmmmsmmmsmmmmmsmmmmmmmsmmmummmmmmmummmmmmmmmumummmmmmmmmumummmmmummmummmmmummmmmmmummmumummmummmmmmm"]],[["z"],["YES","z"]]]}} +{"instance_id":"pseudo_to_code_2k_191","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate constant integer MAXN with MAXN = 1001\ncreate integer n\ncreate character array s with size MAXN\ncreate integer array c with size 256\ndeclare boolean array f with size MAXN\ndefine the main function\n read string into s\n set n to string length of s\n for i = 0 to n exclusive, increment c[s[i]]\n create integer k with k = 0\n for i = 0 to 256 exclusive\n if c[i] is greater than c[k], set k to i\n set bytes from f to size of f to true\n for i = 2 to i * i is less than or equal to n, incrementing i\n if f[i] is true\n for j = i * i to n inclusive, incrementing j by i, set f[j] to false\n set f[1] to true\n for i = 2 to i + i is less than or equal to n, incrementing i, set f[i] to false\n for i = 1 to n inclusive\n if not f[i]\n if c[k] is 0\n print \"NO\"\n return to indicate successful execution\n end of the block\n decrement c[set s[i-1] to k]\n end of the block\n set k to 0\n for i = 1 to n inclusive\n if f[i] is true\n while c[k] is 0, increment k\n decrement c[set s[i-1] to k]\n end of the block\n print \"YES\"\n print s\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int MAXN = 1001;\nint n;\nchar s[MAXN];\nint c[256];\nbool f[MAXN];\nint main() {\n gets(s);\n n = strlen(s);\n for (int i = 0; i < n; ++i) c[s[i]]++;\n int k = 0;\n for (int i = 0; i < 256; ++i)\n if (c[i] > c[k]) k = i;\n memset(f, true, sizeof(f));\n for (int i = 2; i * i <= n; i++)\n if (f[i])\n for (int j = i * i; j <= n; j += i) f[j] = false;\n f[1] = true;\n for (int i = 2; i + i <= n; i++) f[i] = false;\n for (int i = (1); i <= (n); ++i)\n if (!f[i]) {\n if (c[k] == 0) {\n puts(\"NO\");\n return 0;\n }\n c[s[i - 1] = k]--;\n }\n k = 0;\n for (int i = (1); i <= (n); ++i)\n if (f[i]) {\n while (c[k] == 0) k++;\n c[s[i - 1] = k]--;\n }\n puts(\"YES\");\n puts(s);\n return 0;\n}","item":{"problem_id":"123A","pseudocode":"create constant integer MAXN with MAXN = 1001\ncreate integer n\ncreate character array s with size MAXN\ncreate integer array c with size 256\ndeclare boolean array f with size MAXN\ndefine the main function\n read string into s\n set n to string length of s\n for i = 0 to n exclusive, increment c[s[i]]\n create integer k with k = 0\n for i = 0 to 256 exclusive\n if c[i] is greater than c[k], set k to i\n set bytes from f to size of f to true\n for i = 2 to i * i is less than or equal to n, incrementing i\n if f[i] is true\n for j = i * i to n inclusive, incrementing j by i, set f[j] to false\n set f[1] to true\n for i = 2 to i + i is less than or equal to n, incrementing i, set f[i] to false\n for i = 1 to n inclusive\n if not f[i]\n if c[k] is 0\n print \"NO\"\n return to indicate successful execution\n end of the block\n decrement c[set s[i-1] to k]\n end of the block\n set k to 0\n for i = 1 to n inclusive\n if f[i] is true\n while c[k] is 0, increment k\n decrement c[set s[i-1] to k]\n end of the block\n print \"YES\"\n print s\n return to indicate successful execution\nend of the block","testcases":[[["abc"],["YES","abc"]],[["abcd"],["NO"]],[["xxxyxxx"],["YES","xxxxxxy"]],[["xxxjddyxduquybxdxx"],["NO"]],[["jjjjjjjjjjzjjjjjjjjjjjjjjjj"],["YES","jjjjjjjjjjjjjjjjjjjjjjzjjjj"]],[["mggnngggnjgnggggngnggpnggumggpg"],["NO"]],[["hfihihhfh"],["NO"]],[["ppppppopppionpppppppppwppppppppppppppppppppppb"],["YES","bpppppppppppppppppppppppppppipnpppppopppopwppp"]],[["jntnnnnnnngnnnnntnnennannnnnnnnnnnnnnnnjnnnnngnnnnannnnnnnnnq"],["NO"]],[["dattqddidyddddmriftkdddddddddqvedwddfdrdiaddiokdddodyqqddddtdddvdddaodd"],["NO"]],[["qqqqqqqqqqqqqqqqqqqqzqqqzqqqqqqqqqqqqqzqqqqqqqqcqqzqqqqqzqqqqqqqqqqqq"],["YES","cqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqqqqqzqqqqqzqzqqqqqzqq"]],[["danmwkmkcekwkkekwugcqwfrkrkqowkakqinzkzksisekhmqtykkuhugknygvkkrhdhnuuf"],["NO"]],[["jjjjjjjjjjjjjjjjjjjnjjjjjjjujjjjjjjjjjjjjjjjjjjjmpjjjjjjjjjjpjmjmpjjjjpjujjjjjjjjpjjjjjjujjjjjjnjjjjjjj"],["YES","mjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjmjjjjjmjnjjjjjnjjjpjpjjjjjpjjjpjjjjjpjjjjjjjujjjuju"]],[["qqqqqqqqqqsqqqqqqqqqqqqgpqqqqqqqbqqqqqqqqqqqqqqqqqqqqpqqqbqqqqqqqqqqqqqqqqqwqqqqsqqzqzqoqqqqqqqqqqwqqpqqqpq"],["NO"]],[["uupwbpqnpwpcpppewppdsppiplpppwidplpnqblppppppwsxpplxpxlppikpewxppnlbkpppqecbpeppqupsepppqpneqnpexpbqcpqpccnple"],["NO"]],[["nnnnnnnnnnnnjonnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnnnnjnnnnnnnnnnnnnnnnndfnnnnnnnnnnnnnnnnnnnnn"],["YES","dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnfnjnnnnnjnnnnnnnnnnnnnnnnnnnnnonnnnn"]],[["ssjjvshvssjdjnsdhvsjneehnnsshlldhjshdvsssshvsndsvsshlssvssvveslhllssshesssjsvvlsesssnselhjlljldlvnnshvsedllsennnnjssnsnsdsv"],["NO"]],[["cccccccccccxccgccccccccccgccciccccicccgccccccccccccccccxcccccccccccycccccccccctcccccccccccccccccccctccccaicccccgccccccccccccccccccccccaicccccccc"],["YES","acccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccacccccgcccgcccccgcccccccgccciciccciciccctccccccccccccctcccxcccccxcyccccc"]],[["httttfttttttttttthttttttttttthtttttutttttttttttsjttttttttutttttajdttttttytttttuttttttattttttttttttttttttttttdttttttttttttttttttttttttttattttttsttttttfttttttt"],["NO"]],[["wwwiuwujwijwwwwwwwwwwdwwwwhwwwwwiwwwwwwwwwuwwwhwwwjwwwwwwhwwwwwwwwniwwiwwwwwwwwwwwwwjwwwwwwwhwwwuhwwojwwwwjwwuwwwwwwwwwwiwwwwnwdwjwwwwwwwnwwwwh"],["NO"]],[["kkkkkkokkkkkkokkkkkokkkkkkkxkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkjkkkkekokkkkkkkkkkkkxkkkkokkkkkkkkkkkkkkkkkokkkkkkkkkbkkkkkkekkkxkkkkkkkkkkkkkkjkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkkekkkkk"],["YES","bkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkekkkekekkkjkjkkkkkkkkkkkkkkkkkkkkkokkkkkokokkkkkkkkkokokkkkkokkkkkxkkkxkkkkkxkkkkkxkx"]],[["ouscouyvvoooocvokcuoovoooyorjyocosackfocooaoosaucooaojhacoooooorsruocorokufcvyjokoooproaroocjooyrkoorojsocfooskxujoxxpokoopyookooysofooovuoroxraofokupcpjrcokoxucskovoaokoocyoyoovfrovouoocvsc"],["NO"]],[["ssssssssssssssssupsssssssqsssssssssssssssssssssssssssssssssssssassssssssssssssssssssssacssshsssssssscssssssssssspsssssslsgssssssslssssssdsasssessssssssssscssssbsszssssssssssssssssssossstsssssssssssssshs"],["YES","asssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssasssasbssscssssssssssssscssscsssssdsesssssssssgshssssshssssslssslsssssossssspspsssssssssqstsssuszsss"]],[["uuuuuuuuuuuuouuuuuuuuuuuuuuuuuuuuuuuucuuuuuuuuuuuuuuuuyuuuuuwuuuduuuuuuuuuutuuuuuuuuuuuuuuuuuuuuuuuuwuuuuquuuuuuuuuuuuuuuuuuuuuuuujumuuuuuutuuuuuuuhuuuuuuuauecuduuuuuuuuuuuuuuuuujusuuiuuuuuuuuuumuuyujuu"],["NO"]],[["hlchxdgrkdxglihydlyqdgxggvdhdgrgigkugrqhhgpgxhyhgkcgyqildrpcvdlpggikrxggculgyudrrgvkycvgklldxkgggxlxvqgrgygpigcudhidgcigyqqhyxkgdxixglpgdxuxhlyxkidglriglkvgyckqrqvguclryvpyvdggluggcgkillcghdxkrhdglgcxgxicrkgkpugvkhliqyii"],["NO"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhuhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhuhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhjhhhhhhhuhhuhhhhhhhhhhhhhhhhjhhhhhhhuhhhhuhhhhhhhhhhhhhjhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhjhhhhhjhjhhhhhhhhhjhjhhhjhuhhhhhhhhhhhuhhhhhhhhhhhuhhhuhuhhhuhh"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"]],[["uuuruuuuuuuuuuuuuuuuuuuuuuuiuuuuuuuuuuuuigzuuuuuuuuuuuguuuuuuouuuuuuuuuuuuuuuuuuuuuguuuuuuuzuueuuuuuuuuuuuuuufuuaouuuxuuuuutuuuuuuuuuuuuuuuuuuuuuuuuuuuulluuuutuuduuuuuuuujuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuupuruuouuuuuuuuuuuuuuuuuuuuqauu"],["YES","auuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuauuuduuuuueufuuuuuuuuuguguuuuuguuuuuiuuuiuuuuujuuuuululuuuuuuuuuououuuoupuuuuuuuuuuuquuuuuuuuuuuruuurutuuutuuuuuxuzuuuuuuuuuz"]],[["kkkmkkkkkkkymkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkdekkkkkkkkkkhrkkkkkkkkkkkkkkkkkkkkkxkkkkkokkkkikkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkfkkkkkkkkkkkkmkkkktykkkkkkkkkkkrkkkkkkrbekkkkkkkkkkkkkkkkkkfkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkykkkkkkkkkkkkkkzykkkkkkkkkkkmbkkkkkkkkk"],["NO"]],[["rrrvjurvrrsukrsrvxskrrrrbrapyrmrmvprmrseuakrmrnvokshwoawhnrbrrvrynwrynrxurrmprmmsryvkvronrmrprsrsrrrrrvwrarfrrrusrsvemwrevrarbwrmrrkhrryrhxornrorrrrrraphrvvhrrkrrfrprvorkkrsurpwvrkexpavbpnksafrrebxxyhsyrsywrrrrraryprunaxkbvrauokrrwrkpwwpwrrhakrxjrrxerefrrnxkwabrpbrrwmr"],["NO"]],[["mmmmqmmmmmmmmmmmmmmlmmmmmmmmammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmtmmmmmmmmmmimmmmmmmmmmmmmmmmmmammmmimmmmmmmmhmimmmomlmmmmmammmmmmmmmmmmmmmmmmimmmmlmmmmmmmimmmhmmmmmmmmmmmmmmmmmmmlmmmmmmmmmmmmmmhmmmmmmmmmmmmmmmtmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmotmmmmlmmmmmmmmmqmmmmmmmmmmmmmmmmmm"],["YES","ammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmamammmmmmmmmhmhmmmmmhmmmmmimmmimmmmmimmmmmimimmmmmmmmmlmlmmmlmlmmmmmmmmmmmlmmmmmmmmmmmmmmmmmmmmmmmmmmmomommmmmmmmmqmmmmmqmmmmmtmmmmmtmtm"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"],["YES","mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmm"]],[["zzzzzzzzzzzzzzrzzzzbmzzzezzzzzzgzzzzzzzzzzhzzzzgzzzxzzzznzzzzzyzzzzzzzzzzzxzzzzzzzzzzzzzzzizzzzzzzzzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmzzzzzzzzzzzzzzzzzzzzzhzzzzzyzzzzzzzzzmzzfzbzzuzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzyzzzzzzzzbzhzzzzzzzzzrzzzzzzyzzzzzzzzzzzzzzzzzzzzajzzzzz"],["YES","azzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzbzbzzzzzbzzzzzezzzfzzzzzgzzzzzgzhzzzzzzzzzhzhzzzizjzzzzzzzzzzzmzzzzzzzzzzzmzzzmznzzzozzzzzrzrzzzzzzzzzuzzzzzuzzzzzxzzzzzxzyzzzzzyzzzyzyzz"]],[["bbbbbbbbbcbbbbbbqbbbbbkbbbbbbbbbbbbbvbsbbbbbebbbbbbbbbbbbbbbbbbbbbbbcbbbkbvbbbbbbubbbbbbbfbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbekkbbbbbbbbbbbbbbbbfbqbbbbbbbbbfbbebbbbbbbbbbbbbbbbbbbbbbbbbeebbbbbbbbbbbbbbbeubbbbbbbbbbbqbbbbbbbbbbbbbbbbbbbbbbbbbbfbbbbbbbbbbbbbbbbkbebbbbbbbbbbbbuvbbbbbfbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbb"],["NO"]],[["wtwwttwttwwwwwwwwtwtwwwwwtwwtwwtwwwwwtwtwtwtwwtwwwtwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwtwwwwwwwwwwwtwwwwwtwttwwwwtwwwwwwwwwwwwwwwwwtwwwwtwwwwwwwwwwwwwttwtwwwwwtwwtwwwwwwwtwwttttwwwwwwwwwwwwwwwwwwwtwwwttwtwwtwwtwwtwwwwtwwtwtwwtwwwwwwwwwwtwwww"],["NO"]],[["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"],["YES","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]],[["koadaaaaarnaavmmavimdolavaaovkaaabalaavabaolarkewawaavaaaaiaaalaaeaaenaobaamaaikaiaabaavaeenlaaaaaadaoaaaaaaaiekaebavvwaaabiobaadavaiaaviaaaadaaaamarakmaaakaeavwlaaeanaaanaaaaaakllovwnenvlakaiomaaaaaaamaainebaeakaaaaaalraiaallaannammaaamaaaaeeaaiawaabvaaealaermaobaavreaaaaakavrvdaawaraedaaaaawiaeoaaaadaaaaavvadaaaoaaeewokbaaaeaaamaabdaaama"],["NO"]],[["oooooooocooocooooooooooooooooooooooooofoooooooooooooovoooozoooooooooqoooooooooooooooooooooooooooooooooxooovoooooooocoooooxooobooczoooooooooqooooooooooooooooocooooeooooooxoooooooooooooooooozooooooooooooooooooxoopooooocooobooooooooooooooooloooooooooooooooooooobooooelooooooooooooooooooooooooxooiooooooooooopooboooooooooooooooooooooolooooooooooooooooooooo"],["YES","booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooobobooooooooobocooococooooooooooocooooooooooocooocoeoooeooooofoiooooooooolooooolooooolooooopopoooooqoooqovooooooooovoooooooooooooxoooxoxoooxoooooooooooooxooooozooooooooozozooo"]],[["bbbbbbzbbbbbbbbbbgbbbbbbbbbbbpbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbmbbbbbbbobbbbbbbwubbbrbbbbbbbbbbbbbbbubbbbbbbqobbbbdbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbbbbbbbbbbbbbbbbbdbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbobbbbbbbbbibbbbbbbbbbgbbbbebbybbbbbbbbbbbbbbbabbbbbbbbbybiybbbbdbbbgbebbbbbkbbbbbbnbbbbbbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbtbbbbbbbbbpbbb"],["NO"]],[["llvlluelllllllllzllnndluelllhdunlnlllllhnbhldllelllllhllleulunvlldlllllbepellpzulbulllelllvblllulllllllllezpllhldellzldlllllllelllhlllehllvevlnullllvllllpudldlllvdbllllhnvlllllvllvllvlllplelzplpzllllulzlbllzldevlullelllhhzdeulllllllllnlzvllllllbllvllllllllluellnlllulnllllbdlevlhlvllllpenblvzlzlllblvhllllhllllpeblevelpllllnpbhlhllbllllndllblldvn"],["NO"]],[["zzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"],["YES","ozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"]],[["lsllllmllllslllxlvlxluyylllslllmlllvllxllslllvlslyulllullllllmlxulllyxlllmlllllvullllllslllsmlllxmllvvlslllllllllllulllvlllllllmllllsylylvluylllmullslllllvylmmlluyllvlylllllllllllvllllsmlxlslmlllxxslllmyluvylylllllxmxlulsslslmllulxllmllxuusllllumlllllmsssmxullllmsllllmlxxllmllllylvllmlluymxlllllslyxllvlllllllllllllllsllullmlllllslllsllullslllllllllllvyllllvlllylllsllvlvsmlvllllllulullllllslxlml"],["NO"]],[["cccjcchccccccjcccccccjlccccccccccccchccccwccctccccccccccccccccczccccccccccccccccccccccccccccccccccccccnwcccccccccccccccccccoccwcccccccccccwccccccccccccccncdccccbcctcccccccccccccccccccccccxccccccvcccnccccbccccccccccccccccccccccclccccccccczccvccccccvscccccccccxccccocccccccscccccccccccccxvccccccccccccccccccccccccccccccccccccccccccccccxccccccccccccwccccccchccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"],["YES","bcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbcccccccccccdccchchccchcccccjcjcccccccccjccccclccccclcccccncncccccncccococccccccccscccccccccccccsccctctcccvcccccccccccccvcccccvcccccccccvcwcccwcccccwcccccccwcccccwcccccxcccxcccccxcccccccxccczccccccczccccc"]],[["uuuuuuuuuuuuuuuuuuuuuuuuuuquuuuulquuuuuuuouuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuouuuuxouuuuuxuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuruuuuuuxuuuuuuuuuuuuuuuuuuuuuuuzuuuuuuuuuuuuuuupuuuuuuuuuuuuuuuuuuluuuuuuuuuuuuuuuuuuuuuuuuuuuuuurluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuruuuuuuouuuquuuluuuuuuuuupuuouuuuuuuuuuzuuuuuuuokuuluuuupuuukuuuuuruuuuuuupuuuuuuuuuuuuzuouuuuuuuuuuuuuuuz"],["NO"]],[["vkxvxkxvxxxkkvkxvkkxvvvvvvvvkkvkkxvvkkvkkvkkvxxvxvvvvkvkvvxvvxvxvvvkvxkkxkxxkxxkxvxvvxvkvvxvkvkvkxkxvxkvvkvxkxkvkxvxvxxxxxvxxvxxxkkvvvvkkvvvxxkxkvvkxvvxkkkvkvvkvvvvxxxkxxxvvvkxkxvkvxxkxkxkxkvvxxkkkkvxxkvkkxvxvxxvxxxxvvkvxkxkxvkkvxxvxkvvkxkkvxvkkkkkkxkxkvxkkkxxxxxxxvxkxkkvxkkxvkvkkvkkkxvkvkvkvvxkkkxxvxxxxxvkvvxkvvvxvxvkkvvvxkvkxkvxxkvvkxvvxkxxkxkkkvxkxxvkkkxxkxxxvxkxkkkvkkxxxvvkkvvkvkkkxkvxkxxxvkvxvxxkvkxkvkxvxvvxvxxkkkxxkkkkvvvv"],["NO"]],[["gggggggggggqggggggggnqggggggepgggeggggpggqeggggegggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghggqghgggggggggggggggggggggggqgqggggghgggnnggggggggggggggggqgggggpgggggggggggnggggpggggggggggggggggggggggggggggggggqgggqggggggggggeegggggggggggggggggggggngggggghqggggggggggggggggggggggggggggggepggggggggghgggggggggggggggggggggggggghggggggghgggnhgggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg"],["YES","egggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggegggegegggegggggegeggggggggggggggghggggghggggghghggggghggghghggggggggghgggggggggggggngggngngggngggggggggggggngggggngggggggggpgpgggpgggggpgggggggpgggggpgggggpgggqgggggqgggggggqgggqgggggggqgggggggggqgqgggggggggqgqgggggqggg"]],[["pynyyyyypyyyfyyyyyyyvoyyyyvyyyldyyyyyhyyvyyyyyyyyyyyyoyyppyyyyyyywyyysyyyyayyyayyyyyyyoyyyydyyyyyavyyygiyyhfyyyyyyyyyyzyyyysyyyyicyyyyyyycjyyhykyiyykkyylyyyyiyyyyyyyyifyyyyyyyzyyyyyiyyryykyyyhzyydryyyysyyyyyyyyyyyyyaybyyyoyyyykyyyyyyyyyyncyyyyvryyjyyyyqyyfbyyysyyqypyydyyyyyyyyyyyqyywjyyyyyayyyyyyyyyjyyyyyyyyyyyyaygyyypyyyyyayyyyyyyoyyyyiyyyyyiyyyyyjoyykyyyyyyyyyyyyyyyyyyyyyohyyyyvyykyybiyyyyyyyyyyyyyyyyyyyyyyyfyyyyyyyyyyyyyyyyvyyyyyyy"],["NO"]],[["bbbbbbbbbbbbzqbbbbibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbbbbbbjbbbbbbbbbbbbbbgbbbbbbbbbbzebbbbbvbbbbbbbbbbbbbbbbbbbbbbbbtbbbtbvbebbbbzvbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbqbqjbbpbbzbbbbbbbbbbbbbbbbbbbbbbbbbbbebbbbzbbcbbbbbbbqbbbvbbbbbbbbbbbbbbbbbbbbpbbbbbbbbbbbgbbbbzbbbbbbbbbbbbjbbbbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbbebqbbbbjbbbbbbbbbbbbbbbbbbbbbbbbtbbbbbbbbbbbbbbbbbbbbbbbbbbbbqbbbbbbbbbbbbbbbibbbbbbbbbbbbbbbbbzb"],["YES","cbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbcbbbbbebebbbbbbbbbebbbbbebbbbbgbbbbbgbibbbbbibbbibibbbbbbbbbjbbbbbbbbbbbbbjbbbjbjbbbpbbbbbbbbbbbbbpbbbbbqbbbbbbbbbqbqbbbqbbbbbqbbbbbbbqbbbbbtbbbbbtbbbtbbbbbvbbbbbbbvbbbvbbbbbbbvbbbbbbbbbzbzbbbbbbbbbzbzbbbbbzbbbzbbbbbzbbbbb"]],[["tsssshssusssssssssssusssspssssssssssssssssssssssssssssssvsssssssssssssssossssvssssssssssysssssscsssssssussfsssssssszssssssssfssssssssssssssssssssssswssssssssdsssssssssssussssssessmssssssssssjsssssvsssssssssssssssssssssssssssssssssssssssssssssssstssssssssrsssssshssssssssssssssssssssssssssssusssssssssssssssssssssssssssssssessscssrssssssessssssslwwsssssssssssusssscsssssssssssssswssssssssssssssessssstssssssstsshsssssssssssssssssssssisssssssssssssssssssssssosssssswsss"],["NO"]],[["fkfffffffvfkfoffffqoqqffaftftvfuffjffffffffoflftvfffgffffffzfrvfocfmfkmjfftfmfwafzfffajsfffalguvjdfftfndfcnfjfgfffoofoflnffffffofdiczffajffdifrffffffrffffnifofffifdffvgffvoffwbfkfqfsfwfmwcfrkzuzokufmffffffcfffqfzfoffonfnfffkfffkwqifffsfifffzfofofffrfffflftkkfvfffbffuwffjtffmfffaffdlznffjllfqgfffffffffdmlfwlabfblcfdfwffffbfvmfrifwvvffffzffbfafnsffantfrkffzffffffifffrwacfrffffsdfffkffffooaffqckqbnbqqofvafffrtgffwsmfngffbzfffgffofnflfffvrffffmjjkfvfcfccfqfjfnf"],["NO"]],[["xxxxxxxxxxfxxxxxxxxxxxxxxxxxxxxxxxxxxxrxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxexxxxmxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxexxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxaxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsxxxxxzxxxxxxxxxxxxxxxxxxxxxxxxxhrxxnxxxxxxxxxxxxxxxxtxxxxxxxxxx"],["YES","axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxbxxxxxexxxxxexfxxxxxhxxxixmxxxxxxxxxnxxxxxxxxxxxxxoxxxoxoxxxpxxxxxxxxxxxxxrxxxxxrxxxxxxxxxsxtxxxtxxxxxtxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzxxxx"]],[["vtvzvlvlzvrtevdvvvsvjyvwrwwjhovvtotvkvvvvvovvewlvrvvfsvvvvnvfcsvvvtcrmckvvvztvvlvvdyfvcylvhvvcvvvvrvhwvryvhmvvcnsozusvltocvvywvvsvvvdocoftvkvvzvvtnvcmevyvhvhvlovvvvlvvvvtdjcvvvyvvurvuovusvvwvrvtvvfvmvvvmnycnvmvovuzvzvvvjvvvvnvvdrvvcrrvfvzujvyvtmrucvvvcjuvrvvtukvvvlvrkhvvsvjvftvzvmvvunsweuzcvvvfrvrwhyvdjerltlvcvvzednvyvjkvktvvesovvvmkvvnvzvjvcvfwvzhfkvvvuvvduovvmevkvhvuvmnvnvvvvvuvvlfjtjmdvceslvmevvvjvvkvvkjnvfyseevmvlvzvvvvvfdvleuvvlvvyvmrmvvfsevovhzdrru"],["NO"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmummmmmummmmmmmmmmmmmmmsmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmrummmmmmmmmmmmmmmmmmmmmmmmmmmmmsmsmmmmmmmrmmmmmmmmmmmmmmmmmmrmmmmmmcmmsmmmmmmmmrmmmmmmmmmmmmmmmmmmmmmmummmmmmcmmmmmmmmmmmmmmmmmmmcmmmmmmmrmmmmmmmmmmcmmmmmrurmmmmmmmmmmmmmummmmmmmmmmmummmmmmsmmmmrmmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmummsmmmummmmmmmmmrmmmmmmmmmmmmummummrmmmmmmmmmmmmmmmmmmmrmrmmmmmmmmmmmmmmummmmmmmmmmmmmsmmmmmmmummmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmmmmmmm"],["YES","cmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmcmcmmmmmmmmmcmmmmmcmmmmmcmmmmmrmrmmmmmrmmmrmrmmmmmmmmmrmmmmmmmmmmmmmrmmmrmrmmmrmmmmmmmmmmmmmrmmmmmrmmmmmmmmmsmsmmmsmmmmmsmmmmmmmsmmmmmsmmmmmsmmmsmmmmmsmmmmmmmsmmmummmmmmmummmmmmmmmumummmmmmmmmumummmmmummmummmmmummmmmmmummmumummmummmmmmm"]],[["z"],["YES","z"]]]}} +{"instance_id":"pseudo_to_code_2k_192","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndeclare prime with integer x as argument, returning integer\n for i = 2 to x exclusive\n if x % i is 0, return false from function\n end of the block\n return true from function\nend of the block\ndefine the main function\n create string s\n read s\n create integer comp with comp = length of s - 1\n for i = 2 to length of s inclusive\n if 2 * i is greater than length of s and result of run prime with i as argument, decrement comp\n end of the block\n create integer vector letters initialized with 26, 0\n for i = 0 to length of s exclusive, increment letter[s[i] - 'a' ]\n create boolean ok with ok = false\n create integer let\n for i = 0 to 26 exclusive\n if letters[i] is greater than or equal to comp\n set let to i, set ok to true\n break loop\n end of the block\n end of the block\n create integer cur with cur = 0\n if not ok\n print \"NO\\n\"\n return to indicate successful execution\n end of the block\n decrement letters[let] by comp\n print \"YES\\n\"\n create string t with t = \"\"\n for i = 1 to length of s inclusive\n if i is 1 or ( 2 * i is greater than length of s and result of run prime with i as argument )\n while letters[cur] is 0, increment cur\n increment to by character casted ( 'a' + cur )\n decrement letters[cur]\n else\n increment t by character casted ( 'a' + let )\n end of the block\n end of the block\n print t print newline\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int prime(int x) {\n for (int i = 2; i < x; i++) {\n if (x % i == 0) return false;\n }\n return true;\n}\nint main() {\n string s;\n cin >> s;\n int comp = s.length() - 1;\n for (int i = 2; i <= s.length(); i++) {\n if (2 * i > s.length() && prime(i)) comp--;\n }\n vector letters(26, 0);\n for (size_t i = 0; i < s.length(); i++) { ++letters[s[i] - 'a']; }\n bool ok = false;\n int let;\n for (int i = 0; i < 26; i++) {\n if (letters[i] >= comp) {\n let = i, ok = true;\n break;\n }\n }\n int cur = 0;\n if (!ok) {\n cout << \"NO\\n\";\n return 0;\n }\n letters[let] -= comp;\n cout << \"YES\\n\";\n string t = \"\";\n for (int i = 1; i <= s.length(); i++) {\n if (i == 1 || (2 * i > s.length() && prime(i))) {\n while (letters[cur] == 0) cur++;\n t += (char)('a' + cur);\n --letters[cur];\n } else {\n t += (char)('a' + let);\n }\n }\n cout << t << endl;\n return 0;\n}","item":{"problem_id":"123A","pseudocode":"declare prime with integer x as argument, returning integer\n for i = 2 to x exclusive\n if x % i is 0, return false from function\n end of the block\n return true from function\nend of the block\ndefine the main function\n create string s\n read s\n create integer comp with comp = length of s - 1\n for i = 2 to length of s inclusive\n if 2 * i is greater than length of s and result of run prime with i as argument, decrement comp\n end of the block\n create integer vector letters initialized with 26, 0\n for i = 0 to length of s exclusive, increment letter[s[i] - 'a' ]\n create boolean ok with ok = false\n create integer let\n for i = 0 to 26 exclusive\n if letters[i] is greater than or equal to comp\n set let to i, set ok to true\n break loop\n end of the block\n end of the block\n create integer cur with cur = 0\n if not ok\n print \"NO\\n\"\n return to indicate successful execution\n end of the block\n decrement letters[let] by comp\n print \"YES\\n\"\n create string t with t = \"\"\n for i = 1 to length of s inclusive\n if i is 1 or ( 2 * i is greater than length of s and result of run prime with i as argument )\n while letters[cur] is 0, increment cur\n increment to by character casted ( 'a' + cur )\n decrement letters[cur]\n else\n increment t by character casted ( 'a' + let )\n end of the block\n end of the block\n print t print newline\n return to indicate successful execution\nend of the block","testcases":[[["abc"],["YES","abc"]],[["abcd"],["NO"]],[["xxxyxxx"],["YES","xxxxxxy"]],[["xxxjddyxduquybxdxx"],["NO"]],[["jjjjjjjjjjzjjjjjjjjjjjjjjjj"],["YES","jjjjjjjjjjjjjjjjjjjjjjzjjjj"]],[["mggnngggnjgnggggngnggpnggumggpg"],["NO"]],[["hfihihhfh"],["NO"]],[["ppppppopppionpppppppppwppppppppppppppppppppppb"],["YES","bpppppppppppppppppppppppppppipnpppppopppopwppp"]],[["jntnnnnnnngnnnnntnnennannnnnnnnnnnnnnnnjnnnnngnnnnannnnnnnnnq"],["NO"]],[["dattqddidyddddmriftkdddddddddqvedwddfdrdiaddiokdddodyqqddddtdddvdddaodd"],["NO"]],[["qqqqqqqqqqqqqqqqqqqqzqqqzqqqqqqqqqqqqqzqqqqqqqqcqqzqqqqqzqqqqqqqqqqqq"],["YES","cqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqqqqqzqqqqqzqzqqqqqzqq"]],[["danmwkmkcekwkkekwugcqwfrkrkqowkakqinzkzksisekhmqtykkuhugknygvkkrhdhnuuf"],["NO"]],[["jjjjjjjjjjjjjjjjjjjnjjjjjjjujjjjjjjjjjjjjjjjjjjjmpjjjjjjjjjjpjmjmpjjjjpjujjjjjjjjpjjjjjjujjjjjjnjjjjjjj"],["YES","mjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjmjjjjjmjnjjjjjnjjjpjpjjjjjpjjjpjjjjjpjjjjjjjujjjuju"]],[["qqqqqqqqqqsqqqqqqqqqqqqgpqqqqqqqbqqqqqqqqqqqqqqqqqqqqpqqqbqqqqqqqqqqqqqqqqqwqqqqsqqzqzqoqqqqqqqqqqwqqpqqqpq"],["NO"]],[["uupwbpqnpwpcpppewppdsppiplpppwidplpnqblppppppwsxpplxpxlppikpewxppnlbkpppqecbpeppqupsepppqpneqnpexpbqcpqpccnple"],["NO"]],[["nnnnnnnnnnnnjonnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnnnnjnnnnnnnnnnnnnnnnndfnnnnnnnnnnnnnnnnnnnnn"],["YES","dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnfnjnnnnnjnnnnnnnnnnnnnnnnnnnnnonnnnn"]],[["ssjjvshvssjdjnsdhvsjneehnnsshlldhjshdvsssshvsndsvsshlssvssvveslhllssshesssjsvvlsesssnselhjlljldlvnnshvsedllsennnnjssnsnsdsv"],["NO"]],[["cccccccccccxccgccccccccccgccciccccicccgccccccccccccccccxcccccccccccycccccccccctcccccccccccccccccccctccccaicccccgccccccccccccccccccccccaicccccccc"],["YES","acccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccacccccgcccgcccccgcccccccgccciciccciciccctccccccccccccctcccxcccccxcyccccc"]],[["httttfttttttttttthttttttttttthtttttutttttttttttsjttttttttutttttajdttttttytttttuttttttattttttttttttttttttttttdttttttttttttttttttttttttttattttttsttttttfttttttt"],["NO"]],[["wwwiuwujwijwwwwwwwwwwdwwwwhwwwwwiwwwwwwwwwuwwwhwwwjwwwwwwhwwwwwwwwniwwiwwwwwwwwwwwwwjwwwwwwwhwwwuhwwojwwwwjwwuwwwwwwwwwwiwwwwnwdwjwwwwwwwnwwwwh"],["NO"]],[["kkkkkkokkkkkkokkkkkokkkkkkkxkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkjkkkkekokkkkkkkkkkkkxkkkkokkkkkkkkkkkkkkkkkokkkkkkkkkbkkkkkkekkkxkkkkkkkkkkkkkkjkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkkekkkkk"],["YES","bkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkekkkekekkkjkjkkkkkkkkkkkkkkkkkkkkkokkkkkokokkkkkkkkkokokkkkkokkkkkxkkkxkkkkkxkkkkkxkx"]],[["ouscouyvvoooocvokcuoovoooyorjyocosackfocooaoosaucooaojhacoooooorsruocorokufcvyjokoooproaroocjooyrkoorojsocfooskxujoxxpokoopyookooysofooovuoroxraofokupcpjrcokoxucskovoaokoocyoyoovfrovouoocvsc"],["NO"]],[["ssssssssssssssssupsssssssqsssssssssssssssssssssssssssssssssssssassssssssssssssssssssssacssshsssssssscssssssssssspsssssslsgssssssslssssssdsasssessssssssssscssssbsszssssssssssssssssssossstsssssssssssssshs"],["YES","asssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssasssasbssscssssssssssssscssscsssssdsesssssssssgshssssshssssslssslsssssossssspspsssssssssqstsssuszsss"]],[["uuuuuuuuuuuuouuuuuuuuuuuuuuuuuuuuuuuucuuuuuuuuuuuuuuuuyuuuuuwuuuduuuuuuuuuutuuuuuuuuuuuuuuuuuuuuuuuuwuuuuquuuuuuuuuuuuuuuuuuuuuuuujumuuuuuutuuuuuuuhuuuuuuuauecuduuuuuuuuuuuuuuuuujusuuiuuuuuuuuuumuuyujuu"],["NO"]],[["hlchxdgrkdxglihydlyqdgxggvdhdgrgigkugrqhhgpgxhyhgkcgyqildrpcvdlpggikrxggculgyudrrgvkycvgklldxkgggxlxvqgrgygpigcudhidgcigyqqhyxkgdxixglpgdxuxhlyxkidglriglkvgyckqrqvguclryvpyvdggluggcgkillcghdxkrhdglgcxgxicrkgkpugvkhliqyii"],["NO"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhuhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhuhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhjhhhhhhhuhhuhhhhhhhhhhhhhhhhjhhhhhhhuhhhhuhhhhhhhhhhhhhjhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhjhhhhhjhjhhhhhhhhhjhjhhhjhuhhhhhhhhhhhuhhhhhhhhhhhuhhhuhuhhhuhh"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"]],[["uuuruuuuuuuuuuuuuuuuuuuuuuuiuuuuuuuuuuuuigzuuuuuuuuuuuguuuuuuouuuuuuuuuuuuuuuuuuuuuguuuuuuuzuueuuuuuuuuuuuuuufuuaouuuxuuuuutuuuuuuuuuuuuuuuuuuuuuuuuuuuulluuuutuuduuuuuuuujuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuupuruuouuuuuuuuuuuuuuuuuuuuqauu"],["YES","auuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuauuuduuuuueufuuuuuuuuuguguuuuuguuuuuiuuuiuuuuujuuuuululuuuuuuuuuououuuoupuuuuuuuuuuuquuuuuuuuuuuruuurutuuutuuuuuxuzuuuuuuuuuz"]],[["kkkmkkkkkkkymkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkdekkkkkkkkkkhrkkkkkkkkkkkkkkkkkkkkkxkkkkkokkkkikkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkfkkkkkkkkkkkkmkkkktykkkkkkkkkkkrkkkkkkrbekkkkkkkkkkkkkkkkkkfkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkykkkkkkkkkkkkkkzykkkkkkkkkkkmbkkkkkkkkk"],["NO"]],[["rrrvjurvrrsukrsrvxskrrrrbrapyrmrmvprmrseuakrmrnvokshwoawhnrbrrvrynwrynrxurrmprmmsryvkvronrmrprsrsrrrrrvwrarfrrrusrsvemwrevrarbwrmrrkhrryrhxornrorrrrrraphrvvhrrkrrfrprvorkkrsurpwvrkexpavbpnksafrrebxxyhsyrsywrrrrraryprunaxkbvrauokrrwrkpwwpwrrhakrxjrrxerefrrnxkwabrpbrrwmr"],["NO"]],[["mmmmqmmmmmmmmmmmmmmlmmmmmmmmammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmtmmmmmmmmmmimmmmmmmmmmmmmmmmmmammmmimmmmmmmmhmimmmomlmmmmmammmmmmmmmmmmmmmmmmimmmmlmmmmmmmimmmhmmmmmmmmmmmmmmmmmmmlmmmmmmmmmmmmmmhmmmmmmmmmmmmmmmtmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmotmmmmlmmmmmmmmmqmmmmmmmmmmmmmmmmmm"],["YES","ammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmamammmmmmmmmhmhmmmmmhmmmmmimmmimmmmmimmmmmimimmmmmmmmmlmlmmmlmlmmmmmmmmmmmlmmmmmmmmmmmmmmmmmmmmmmmmmmmomommmmmmmmmqmmmmmqmmmmmtmmmmmtmtm"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"],["YES","mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmm"]],[["zzzzzzzzzzzzzzrzzzzbmzzzezzzzzzgzzzzzzzzzzhzzzzgzzzxzzzznzzzzzyzzzzzzzzzzzxzzzzzzzzzzzzzzzizzzzzzzzzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmzzzzzzzzzzzzzzzzzzzzzhzzzzzyzzzzzzzzzmzzfzbzzuzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzyzzzzzzzzbzhzzzzzzzzzrzzzzzzyzzzzzzzzzzzzzzzzzzzzajzzzzz"],["YES","azzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzbzbzzzzzbzzzzzezzzfzzzzzgzzzzzgzhzzzzzzzzzhzhzzzizjzzzzzzzzzzzmzzzzzzzzzzzmzzzmznzzzozzzzzrzrzzzzzzzzzuzzzzzuzzzzzxzzzzzxzyzzzzzyzzzyzyzz"]],[["bbbbbbbbbcbbbbbbqbbbbbkbbbbbbbbbbbbbvbsbbbbbebbbbbbbbbbbbbbbbbbbbbbbcbbbkbvbbbbbbubbbbbbbfbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbekkbbbbbbbbbbbbbbbbfbqbbbbbbbbbfbbebbbbbbbbbbbbbbbbbbbbbbbbbeebbbbbbbbbbbbbbbeubbbbbbbbbbbqbbbbbbbbbbbbbbbbbbbbbbbbbbfbbbbbbbbbbbbbbbbkbebbbbbbbbbbbbuvbbbbbfbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbb"],["NO"]],[["wtwwttwttwwwwwwwwtwtwwwwwtwwtwwtwwwwwtwtwtwtwwtwwwtwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwtwwwwwwwwwwwtwwwwwtwttwwwwtwwwwwwwwwwwwwwwwwtwwwwtwwwwwwwwwwwwwttwtwwwwwtwwtwwwwwwwtwwttttwwwwwwwwwwwwwwwwwwwtwwwttwtwwtwwtwwtwwwwtwwtwtwwtwwwwwwwwwwtwwww"],["NO"]],[["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"],["YES","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]],[["koadaaaaarnaavmmavimdolavaaovkaaabalaavabaolarkewawaavaaaaiaaalaaeaaenaobaamaaikaiaabaavaeenlaaaaaadaoaaaaaaaiekaebavvwaaabiobaadavaiaaviaaaadaaaamarakmaaakaeavwlaaeanaaanaaaaaakllovwnenvlakaiomaaaaaaamaainebaeakaaaaaalraiaallaannammaaamaaaaeeaaiawaabvaaealaermaobaavreaaaaakavrvdaawaraedaaaaawiaeoaaaadaaaaavvadaaaoaaeewokbaaaeaaamaabdaaama"],["NO"]],[["oooooooocooocooooooooooooooooooooooooofoooooooooooooovoooozoooooooooqoooooooooooooooooooooooooooooooooxooovoooooooocoooooxooobooczoooooooooqooooooooooooooooocooooeooooooxoooooooooooooooooozooooooooooooooooooxoopooooocooobooooooooooooooooloooooooooooooooooooobooooelooooooooooooooooooooooooxooiooooooooooopooboooooooooooooooooooooolooooooooooooooooooooo"],["YES","booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooobobooooooooobocooococooooooooooocooooooooooocooocoeoooeooooofoiooooooooolooooolooooolooooopopoooooqoooqovooooooooovoooooooooooooxoooxoxoooxoooooooooooooxooooozooooooooozozooo"]],[["bbbbbbzbbbbbbbbbbgbbbbbbbbbbbpbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbmbbbbbbbobbbbbbbwubbbrbbbbbbbbbbbbbbbubbbbbbbqobbbbdbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbbbbbbbbbbbbbbbbbdbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbobbbbbbbbbibbbbbbbbbbgbbbbebbybbbbbbbbbbbbbbbabbbbbbbbbybiybbbbdbbbgbebbbbbkbbbbbbnbbbbbbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbtbbbbbbbbbpbbb"],["NO"]],[["llvlluelllllllllzllnndluelllhdunlnlllllhnbhldllelllllhllleulunvlldlllllbepellpzulbulllelllvblllulllllllllezpllhldellzldlllllllelllhlllehllvevlnullllvllllpudldlllvdbllllhnvlllllvllvllvlllplelzplpzllllulzlbllzldevlullelllhhzdeulllllllllnlzvllllllbllvllllllllluellnlllulnllllbdlevlhlvllllpenblvzlzlllblvhllllhllllpeblevelpllllnpbhlhllbllllndllblldvn"],["NO"]],[["zzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"],["YES","ozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"]],[["lsllllmllllslllxlvlxluyylllslllmlllvllxllslllvlslyulllullllllmlxulllyxlllmlllllvullllllslllsmlllxmllvvlslllllllllllulllvlllllllmllllsylylvluylllmullslllllvylmmlluyllvlylllllllllllvllllsmlxlslmlllxxslllmyluvylylllllxmxlulsslslmllulxllmllxuusllllumlllllmsssmxullllmsllllmlxxllmllllylvllmlluymxlllllslyxllvlllllllllllllllsllullmlllllslllsllullslllllllllllvyllllvlllylllsllvlvsmlvllllllulullllllslxlml"],["NO"]],[["cccjcchccccccjcccccccjlccccccccccccchccccwccctccccccccccccccccczccccccccccccccccccccccccccccccccccccccnwcccccccccccccccccccoccwcccccccccccwccccccccccccccncdccccbcctcccccccccccccccccccccccxccccccvcccnccccbccccccccccccccccccccccclccccccccczccvccccccvscccccccccxccccocccccccscccccccccccccxvccccccccccccccccccccccccccccccccccccccccccccccxccccccccccccwccccccchccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"],["YES","bcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbcccccccccccdccchchccchcccccjcjcccccccccjccccclccccclcccccncncccccncccococccccccccscccccccccccccsccctctcccvcccccccccccccvcccccvcccccccccvcwcccwcccccwcccccccwcccccwcccccxcccxcccccxcccccccxccczccccccczccccc"]],[["uuuuuuuuuuuuuuuuuuuuuuuuuuquuuuulquuuuuuuouuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuouuuuxouuuuuxuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuruuuuuuxuuuuuuuuuuuuuuuuuuuuuuuzuuuuuuuuuuuuuuupuuuuuuuuuuuuuuuuuuluuuuuuuuuuuuuuuuuuuuuuuuuuuuuurluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuruuuuuuouuuquuuluuuuuuuuupuuouuuuuuuuuuzuuuuuuuokuuluuuupuuukuuuuuruuuuuuupuuuuuuuuuuuuzuouuuuuuuuuuuuuuuz"],["NO"]],[["vkxvxkxvxxxkkvkxvkkxvvvvvvvvkkvkkxvvkkvkkvkkvxxvxvvvvkvkvvxvvxvxvvvkvxkkxkxxkxxkxvxvvxvkvvxvkvkvkxkxvxkvvkvxkxkvkxvxvxxxxxvxxvxxxkkvvvvkkvvvxxkxkvvkxvvxkkkvkvvkvvvvxxxkxxxvvvkxkxvkvxxkxkxkxkvvxxkkkkvxxkvkkxvxvxxvxxxxvvkvxkxkxvkkvxxvxkvvkxkkvxvkkkkkkxkxkvxkkkxxxxxxxvxkxkkvxkkxvkvkkvkkkxvkvkvkvvxkkkxxvxxxxxvkvvxkvvvxvxvkkvvvxkvkxkvxxkvvkxvvxkxxkxkkkvxkxxvkkkxxkxxxvxkxkkkvkkxxxvvkkvvkvkkkxkvxkxxxvkvxvxxkvkxkvkxvxvvxvxxkkkxxkkkkvvvv"],["NO"]],[["gggggggggggqggggggggnqggggggepgggeggggpggqeggggegggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghggqghgggggggggggggggggggggggqgqggggghgggnnggggggggggggggggqgggggpgggggggggggnggggpggggggggggggggggggggggggggggggggqgggqggggggggggeegggggggggggggggggggggngggggghqggggggggggggggggggggggggggggggepggggggggghgggggggggggggggggggggggggghggggggghgggnhgggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg"],["YES","egggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggegggegegggegggggegeggggggggggggggghggggghggggghghggggghggghghggggggggghgggggggggggggngggngngggngggggggggggggngggggngggggggggpgpgggpgggggpgggggggpgggggpgggggpgggqgggggqgggggggqgggqgggggggqgggggggggqgqgggggggggqgqgggggqggg"]],[["pynyyyyypyyyfyyyyyyyvoyyyyvyyyldyyyyyhyyvyyyyyyyyyyyyoyyppyyyyyyywyyysyyyyayyyayyyyyyyoyyyydyyyyyavyyygiyyhfyyyyyyyyyyzyyyysyyyyicyyyyyyycjyyhykyiyykkyylyyyyiyyyyyyyyifyyyyyyyzyyyyyiyyryykyyyhzyydryyyysyyyyyyyyyyyyyaybyyyoyyyykyyyyyyyyyyncyyyyvryyjyyyyqyyfbyyysyyqypyydyyyyyyyyyyyqyywjyyyyyayyyyyyyyyjyyyyyyyyyyyyaygyyypyyyyyayyyyyyyoyyyyiyyyyyiyyyyyjoyykyyyyyyyyyyyyyyyyyyyyyohyyyyvyykyybiyyyyyyyyyyyyyyyyyyyyyyyfyyyyyyyyyyyyyyyyvyyyyyyy"],["NO"]],[["bbbbbbbbbbbbzqbbbbibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbbbbbbjbbbbbbbbbbbbbbgbbbbbbbbbbzebbbbbvbbbbbbbbbbbbbbbbbbbbbbbbtbbbtbvbebbbbzvbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbqbqjbbpbbzbbbbbbbbbbbbbbbbbbbbbbbbbbbebbbbzbbcbbbbbbbqbbbvbbbbbbbbbbbbbbbbbbbbpbbbbbbbbbbbgbbbbzbbbbbbbbbbbbjbbbbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbbebqbbbbjbbbbbbbbbbbbbbbbbbbbbbbbtbbbbbbbbbbbbbbbbbbbbbbbbbbbbqbbbbbbbbbbbbbbbibbbbbbbbbbbbbbbbbzb"],["YES","cbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbcbbbbbebebbbbbbbbbebbbbbebbbbbgbbbbbgbibbbbbibbbibibbbbbbbbbjbbbbbbbbbbbbbjbbbjbjbbbpbbbbbbbbbbbbbpbbbbbqbbbbbbbbbqbqbbbqbbbbbqbbbbbbbqbbbbbtbbbbbtbbbtbbbbbvbbbbbbbvbbbvbbbbbbbvbbbbbbbbbzbzbbbbbbbbbzbzbbbbbzbbbzbbbbbzbbbbb"]],[["tsssshssusssssssssssusssspssssssssssssssssssssssssssssssvsssssssssssssssossssvssssssssssysssssscsssssssussfsssssssszssssssssfssssssssssssssssssssssswssssssssdsssssssssssussssssessmssssssssssjsssssvsssssssssssssssssssssssssssssssssssssssssssssssstssssssssrsssssshssssssssssssssssssssssssssssusssssssssssssssssssssssssssssssessscssrssssssessssssslwwsssssssssssusssscsssssssssssssswssssssssssssssessssstssssssstsshsssssssssssssssssssssisssssssssssssssssssssssosssssswsss"],["NO"]],[["fkfffffffvfkfoffffqoqqffaftftvfuffjffffffffoflftvfffgffffffzfrvfocfmfkmjfftfmfwafzfffajsfffalguvjdfftfndfcnfjfgfffoofoflnffffffofdiczffajffdifrffffffrffffnifofffifdffvgffvoffwbfkfqfsfwfmwcfrkzuzokufmffffffcfffqfzfoffonfnfffkfffkwqifffsfifffzfofofffrfffflftkkfvfffbffuwffjtffmfffaffdlznffjllfqgfffffffffdmlfwlabfblcfdfwffffbfvmfrifwvvffffzffbfafnsffantfrkffzffffffifffrwacfrffffsdfffkffffooaffqckqbnbqqofvafffrtgffwsmfngffbzfffgffofnflfffvrffffmjjkfvfcfccfqfjfnf"],["NO"]],[["xxxxxxxxxxfxxxxxxxxxxxxxxxxxxxxxxxxxxxrxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxexxxxmxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxexxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxaxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsxxxxxzxxxxxxxxxxxxxxxxxxxxxxxxxhrxxnxxxxxxxxxxxxxxxxtxxxxxxxxxx"],["YES","axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxbxxxxxexxxxxexfxxxxxhxxxixmxxxxxxxxxnxxxxxxxxxxxxxoxxxoxoxxxpxxxxxxxxxxxxxrxxxxxrxxxxxxxxxsxtxxxtxxxxxtxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzxxxx"]],[["vtvzvlvlzvrtevdvvvsvjyvwrwwjhovvtotvkvvvvvovvewlvrvvfsvvvvnvfcsvvvtcrmckvvvztvvlvvdyfvcylvhvvcvvvvrvhwvryvhmvvcnsozusvltocvvywvvsvvvdocoftvkvvzvvtnvcmevyvhvhvlovvvvlvvvvtdjcvvvyvvurvuovusvvwvrvtvvfvmvvvmnycnvmvovuzvzvvvjvvvvnvvdrvvcrrvfvzujvyvtmrucvvvcjuvrvvtukvvvlvrkhvvsvjvftvzvmvvunsweuzcvvvfrvrwhyvdjerltlvcvvzednvyvjkvktvvesovvvmkvvnvzvjvcvfwvzhfkvvvuvvduovvmevkvhvuvmnvnvvvvvuvvlfjtjmdvceslvmevvvjvvkvvkjnvfyseevmvlvzvvvvvfdvleuvvlvvyvmrmvvfsevovhzdrru"],["NO"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmummmmmummmmmmmmmmmmmmmsmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmrummmmmmmmmmmmmmmmmmmmmmmmmmmmmsmsmmmmmmmrmmmmmmmmmmmmmmmmmmrmmmmmmcmmsmmmmmmmmrmmmmmmmmmmmmmmmmmmmmmmummmmmmcmmmmmmmmmmmmmmmmmmmcmmmmmmmrmmmmmmmmmmcmmmmmrurmmmmmmmmmmmmmummmmmmmmmmmummmmmmsmmmmrmmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmummsmmmummmmmmmmmrmmmmmmmmmmmmummummrmmmmmmmmmmmmmmmmmmmrmrmmmmmmmmmmmmmmummmmmmmmmmmmmsmmmmmmmummmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmmmmmmm"],["YES","cmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmcmcmmmmmmmmmcmmmmmcmmmmmcmmmmmrmrmmmmmrmmmrmrmmmmmmmmmrmmmmmmmmmmmmmrmmmrmrmmmrmmmmmmmmmmmmmrmmmmmrmmmmmmmmmsmsmmmsmmmmmsmmmmmmmsmmmmmsmmmmmsmmmsmmmmmsmmmmmmmsmmmummmmmmmummmmmmmmmumummmmmmmmmumummmmmummmummmmmummmmmmmummmumummmummmmmmm"]],[["z"],["YES","z"]]]}} +{"instance_id":"pseudo_to_code_2k_193","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create string a\n read a\n create integer n with n = integer casted size of a\n if n is less than or equal to 3\n print \"YES\" print '\\n'\n print a print '\\n'\n return to indicate successful execution\n end of the block\n create integer vector f initialized with 26\n for i = 0 to n exclusive, increment f[a[i] - 'a']\n create character vector ans initialized with n + 1\n create boolean vector flags initialized with n + 1\n for i = 2 to n inclusive, incrementing i by 2, set flags[i] to true\n for i = 3 to n inclusive\n if not flags[i] and i * 2 is less than or equal to n\n for j = i to n inclusive, incrementing j by i, set flags[j] to true\n end of the block\n end of the block\n create integer cont with cont = 0\n for i = 1 to n inclusive, increment cont by flags[i]\n create integers most, pos with most = -1, pos = -1\n for i = 0 to 26 exclusive\n if f[i] is greater than most\n set most to f[i]\n set pos to i\n end of the block\n if most is less than cont\n print \"NO\" print '\\n'\n return to indicate successful execution\n end of the block\n decrement f[pos] by cont\n for i = 1 to n inclusive\n if flags[i] is true, set ans[i] to character casted ( pos + 'a' )\n for i = 1 to n inclusive\n if flags[i] is false\n for j = 0 to 26 exclusive\n if f[j] is greater than 0\n decrement f[j]\n set ans[i] to character casted ( j + 'a' )\n set flags[i] to true\n break loop\n end of the block\n end of the block\n end of the block\n end of the block\n for i = 1 to n inclusive\n if flags[i] is false\n print \"NO\" print '\\n'\n return to indicate successful execution\n end of the block\n end of the block\n print \"YES\" print '\\n'\n for i = 1 to n inclusive, print ans[i]\n print '\\n'\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int main() {\n string a;\n cin >> a;\n int n = (int)a.size();\n if (n <= 3) {\n cout << \"YES\" << '\\n';\n cout << a << '\\n';\n return 0;\n }\n vector f(26);\n for (int i = 0; i < n; i++) f[a[i] - 'a']++;\n vector ans(n + 1);\n vector flags(n + 1);\n for (int i = 2; i <= n; i += 2) flags[i] = true;\n for (int i = 3; i <= n; i++) {\n if (!flags[i] && i * 2 <= n) {\n for (int j = i; j <= n; j += i) flags[j] = true;\n }\n }\n int cont = 0;\n for (int i = 1; i <= n; i++) cont += flags[i];\n int most = -1, pos = -1;\n for (int i = 0; i < 26; i++)\n if (f[i] > most) {\n most = f[i];\n pos = i;\n }\n if (most < cont) {\n cout << \"NO\" << '\\n';\n return 0;\n }\n f[pos] -= cont;\n for (int i = 1; i <= n; i++)\n if (flags[i]) ans[i] = (char)(pos + 'a');\n for (int i = 1; i <= n; i++) {\n if (!flags[i]) {\n for (int j = 0; j < 26; j++) {\n if (f[j] > 0) {\n f[j]--;\n ans[i] = (char)(j + 'a');\n flags[i] = true;\n break;\n }\n }\n }\n }\n for (int i = 1; i <= n; i++) {\n if (!flags[i]) {\n cout << \"NO\" << '\\n';\n return 0;\n }\n }\n cout << \"YES\" << '\\n';\n for (int i = 1; i <= n; i++) cout << ans[i];\n cout << '\\n';\n return 0;\n}","item":{"problem_id":"123A","pseudocode":"define the main function\n create string a\n read a\n create integer n with n = integer casted size of a\n if n is less than or equal to 3\n print \"YES\" print '\\n'\n print a print '\\n'\n return to indicate successful execution\n end of the block\n create integer vector f initialized with 26\n for i = 0 to n exclusive, increment f[a[i] - 'a']\n create character vector ans initialized with n + 1\n create boolean vector flags initialized with n + 1\n for i = 2 to n inclusive, incrementing i by 2, set flags[i] to true\n for i = 3 to n inclusive\n if not flags[i] and i * 2 is less than or equal to n\n for j = i to n inclusive, incrementing j by i, set flags[j] to true\n end of the block\n end of the block\n create integer cont with cont = 0\n for i = 1 to n inclusive, increment cont by flags[i]\n create integers most, pos with most = -1, pos = -1\n for i = 0 to 26 exclusive\n if f[i] is greater than most\n set most to f[i]\n set pos to i\n end of the block\n if most is less than cont\n print \"NO\" print '\\n'\n return to indicate successful execution\n end of the block\n decrement f[pos] by cont\n for i = 1 to n inclusive\n if flags[i] is true, set ans[i] to character casted ( pos + 'a' )\n for i = 1 to n inclusive\n if flags[i] is false\n for j = 0 to 26 exclusive\n if f[j] is greater than 0\n decrement f[j]\n set ans[i] to character casted ( j + 'a' )\n set flags[i] to true\n break loop\n end of the block\n end of the block\n end of the block\n end of the block\n for i = 1 to n inclusive\n if flags[i] is false\n print \"NO\" print '\\n'\n return to indicate successful execution\n end of the block\n end of the block\n print \"YES\" print '\\n'\n for i = 1 to n inclusive, print ans[i]\n print '\\n'\n return to indicate successful execution\nend of the block","testcases":[[["abc"],["YES","abc"]],[["abcd"],["NO"]],[["xxxyxxx"],["YES","xxxxxxy"]],[["xxxjddyxduquybxdxx"],["NO"]],[["jjjjjjjjjjzjjjjjjjjjjjjjjjj"],["YES","jjjjjjjjjjjjjjjjjjjjjjzjjjj"]],[["mggnngggnjgnggggngnggpnggumggpg"],["NO"]],[["hfihihhfh"],["NO"]],[["ppppppopppionpppppppppwppppppppppppppppppppppb"],["YES","bpppppppppppppppppppppppppppipnpppppopppopwppp"]],[["jntnnnnnnngnnnnntnnennannnnnnnnnnnnnnnnjnnnnngnnnnannnnnnnnnq"],["NO"]],[["dattqddidyddddmriftkdddddddddqvedwddfdrdiaddiokdddodyqqddddtdddvdddaodd"],["NO"]],[["qqqqqqqqqqqqqqqqqqqqzqqqzqqqqqqqqqqqqqzqqqqqqqqcqqzqqqqqzqqqqqqqqqqqq"],["YES","cqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqqqqqzqqqqqzqzqqqqqzqq"]],[["danmwkmkcekwkkekwugcqwfrkrkqowkakqinzkzksisekhmqtykkuhugknygvkkrhdhnuuf"],["NO"]],[["jjjjjjjjjjjjjjjjjjjnjjjjjjjujjjjjjjjjjjjjjjjjjjjmpjjjjjjjjjjpjmjmpjjjjpjujjjjjjjjpjjjjjjujjjjjjnjjjjjjj"],["YES","mjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjmjjjjjmjnjjjjjnjjjpjpjjjjjpjjjpjjjjjpjjjjjjjujjjuju"]],[["qqqqqqqqqqsqqqqqqqqqqqqgpqqqqqqqbqqqqqqqqqqqqqqqqqqqqpqqqbqqqqqqqqqqqqqqqqqwqqqqsqqzqzqoqqqqqqqqqqwqqpqqqpq"],["NO"]],[["uupwbpqnpwpcpppewppdsppiplpppwidplpnqblppppppwsxpplxpxlppikpewxppnlbkpppqecbpeppqupsepppqpneqnpexpbqcpqpccnple"],["NO"]],[["nnnnnnnnnnnnjonnnnnnnnnnnnnnnnnnnnnnnndnnnnnnnnnnnnnnjnnnnnnnnnnnnnnnnndfnnnnnnnnnnnnnnnnnnnnn"],["YES","dnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnndnnnnnfnjnnnnnjnnnnnnnnnnnnnnnnnnnnnonnnnn"]],[["ssjjvshvssjdjnsdhvsjneehnnsshlldhjshdvsssshvsndsvsshlssvssvveslhllssshesssjsvvlsesssnselhjlljldlvnnshvsedllsennnnjssnsnsdsv"],["NO"]],[["cccccccccccxccgccccccccccgccciccccicccgccccccccccccccccxcccccccccccycccccccccctcccccccccccccccccccctccccaicccccgccccccccccccccccccccccaicccccccc"],["YES","acccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccacccccgcccgcccccgcccccccgccciciccciciccctccccccccccccctcccxcccccxcyccccc"]],[["httttfttttttttttthttttttttttthtttttutttttttttttsjttttttttutttttajdttttttytttttuttttttattttttttttttttttttttttdttttttttttttttttttttttttttattttttsttttttfttttttt"],["NO"]],[["wwwiuwujwijwwwwwwwwwwdwwwwhwwwwwiwwwwwwwwwuwwwhwwwjwwwwwwhwwwwwwwwniwwiwwwwwwwwwwwwwjwwwwwwwhwwwuhwwojwwwwjwwuwwwwwwwwwwiwwwwnwdwjwwwwwwwnwwwwh"],["NO"]],[["kkkkkkokkkkkkokkkkkokkkkkkkxkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkjkkkkekokkkkkkkkkkkkxkkkkokkkkkkkkkkkkkkkkkokkkkkkkkkbkkkkkkekkkxkkkkkkkkkkkkkkjkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkkekkkkk"],["YES","bkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkekkkekekkkjkjkkkkkkkkkkkkkkkkkkkkkokkkkkokokkkkkkkkkokokkkkkokkkkkxkkkxkkkkkxkkkkkxkx"]],[["ouscouyvvoooocvokcuoovoooyorjyocosackfocooaoosaucooaojhacoooooorsruocorokufcvyjokoooproaroocjooyrkoorojsocfooskxujoxxpokoopyookooysofooovuoroxraofokupcpjrcokoxucskovoaokoocyoyoovfrovouoocvsc"],["NO"]],[["ssssssssssssssssupsssssssqsssssssssssssssssssssssssssssssssssssassssssssssssssssssssssacssshsssssssscssssssssssspsssssslsgssssssslssssssdsasssessssssssssscssssbsszssssssssssssssssssossstsssssssssssssshs"],["YES","asssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssasssasbssscssssssssssssscssscsssssdsesssssssssgshssssshssssslssslsssssossssspspsssssssssqstsssuszsss"]],[["uuuuuuuuuuuuouuuuuuuuuuuuuuuuuuuuuuuucuuuuuuuuuuuuuuuuyuuuuuwuuuduuuuuuuuuutuuuuuuuuuuuuuuuuuuuuuuuuwuuuuquuuuuuuuuuuuuuuuuuuuuuuujumuuuuuutuuuuuuuhuuuuuuuauecuduuuuuuuuuuuuuuuuujusuuiuuuuuuuuuumuuyujuu"],["NO"]],[["hlchxdgrkdxglihydlyqdgxggvdhdgrgigkugrqhhgpgxhyhgkcgyqildrpcvdlpggikrxggculgyudrrgvkycvgklldxkgggxlxvqgrgygpigcudhidgcigyqqhyxkgdxixglpgdxuxhlyxkidglriglkvgyckqrqvguclryvpyvdggluggcgkillcghdxkrhdglgcxgxicrkgkpugvkhliqyii"],["NO"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhuhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhuhhhhhhhhhhhhhhhjhhhhhhhhhhhhhhhhjhhhhhhhuhhuhhhhhhhhhhhhhhhhjhhhhhhhuhhhhuhhhhhhhhhhhhhjhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhhhhhjhhhhhjhjhhhhhhhhhjhjhhhjhuhhhhhhhhhhhuhhhhhhhhhhhuhhhuhuhhhuhh"]],[["hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"],["YES","hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"]],[["uuuruuuuuuuuuuuuuuuuuuuuuuuiuuuuuuuuuuuuigzuuuuuuuuuuuguuuuuuouuuuuuuuuuuuuuuuuuuuuguuuuuuuzuueuuuuuuuuuuuuuufuuaouuuxuuuuutuuuuuuuuuuuuuuuuuuuuuuuuuuuulluuuutuuduuuuuuuujuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuupuruuouuuuuuuuuuuuuuuuuuuuqauu"],["YES","auuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuauuuduuuuueufuuuuuuuuuguguuuuuguuuuuiuuuiuuuuujuuuuululuuuuuuuuuououuuoupuuuuuuuuuuuquuuuuuuuuuuruuurutuuutuuuuuxuzuuuuuuuuuz"]],[["kkkmkkkkkkkymkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkdekkkkkkkkkkhrkkkkkkkkkkkkkkkkkkkkkxkkkkkokkkkikkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkfkkkkkkkkkkkkmkkkktykkkkkkkkkkkrkkkkkkrbekkkkkkkkkkkkkkkkkkfkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkykkkkkkkkkkkkkkzykkkkkkkkkkkmbkkkkkkkkk"],["NO"]],[["rrrvjurvrrsukrsrvxskrrrrbrapyrmrmvprmrseuakrmrnvokshwoawhnrbrrvrynwrynrxurrmprmmsryvkvronrmrprsrsrrrrrvwrarfrrrusrsvemwrevrarbwrmrrkhrryrhxornrorrrrrraphrvvhrrkrrfrprvorkkrsurpwvrkexpavbpnksafrrebxxyhsyrsywrrrrraryprunaxkbvrauokrrwrkpwwpwrrhakrxjrrxerefrrnxkwabrpbrrwmr"],["NO"]],[["mmmmqmmmmmmmmmmmmmmlmmmmmmmmammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmtmmmmmmmmmmimmmmmmmmmmmmmmmmmmammmmimmmmmmmmhmimmmomlmmmmmammmmmmmmmmmmmmmmmmimmmmlmmmmmmmimmmhmmmmmmmmmmmmmmmmmmmlmmmmmmmmmmmmmmhmmmmmmmmmmmmmmmtmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmotmmmmlmmmmmmmmmqmmmmmmmmmmmmmmmmmm"],["YES","ammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmamammmmmmmmmhmhmmmmmhmmmmmimmmimmmmmimmmmmimimmmmmmmmmlmlmmmlmlmmmmmmmmmmmlmmmmmmmmmmmmmmmmmmmmmmmmmmmomommmmmmmmmqmmmmmqmmmmmtmmmmmtmtm"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"],["YES","mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmymmm"]],[["zzzzzzzzzzzzzzrzzzzbmzzzezzzzzzgzzzzzzzzzzhzzzzgzzzxzzzznzzzzzyzzzzzzzzzzzxzzzzzzzzzzzzzzzizzzzzzzzzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmzzzzzzzzzzzzzzzzzzzzzhzzzzzyzzzzzzzzzmzzfzbzzuzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzyzzzzzzzzbzhzzzzzzzzzrzzzzzzyzzzzzzzzzzzzzzzzzzzzajzzzzz"],["YES","azzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzbzbzzzzzbzzzzzezzzfzzzzzgzzzzzgzhzzzzzzzzzhzhzzzizjzzzzzzzzzzzmzzzzzzzzzzzmzzzmznzzzozzzzzrzrzzzzzzzzzuzzzzzuzzzzzxzzzzzxzyzzzzzyzzzyzyzz"]],[["bbbbbbbbbcbbbbbbqbbbbbkbbbbbbbbbbbbbvbsbbbbbebbbbbbbbbbbbbbbbbbbbbbbcbbbkbvbbbbbbubbbbbbbfbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbekkbbbbbbbbbbbbbbbbfbqbbbbbbbbbfbbebbbbbbbbbbbbbbbbbbbbbbbbbeebbbbbbbbbbbbbbbeubbbbbbbbbbbqbbbbbbbbbbbbbbbbbbbbbbbbbbfbbbbbbbbbbbbbbbbkbebbbbbbbbbbbbuvbbbbbfbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbb"],["NO"]],[["wtwwttwttwwwwwwwwtwtwwwwwtwwtwwtwwwwwtwtwtwtwwtwwwtwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwtwwwwwwwwwwwtwwwwwtwttwwwwtwwwwwwwwwwwwwwwwwtwwwwtwwwwwwwwwwwwwttwtwwwwwtwwtwwwwwwwtwwttttwwwwwwwwwwwwwwwwwwwtwwwttwtwwtwwtwwtwwwwtwwtwtwwtwwwwwwwwwwtwwww"],["NO"]],[["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"],["YES","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]],[["koadaaaaarnaavmmavimdolavaaovkaaabalaavabaolarkewawaavaaaaiaaalaaeaaenaobaamaaikaiaabaavaeenlaaaaaadaoaaaaaaaiekaebavvwaaabiobaadavaiaaviaaaadaaaamarakmaaakaeavwlaaeanaaanaaaaaakllovwnenvlakaiomaaaaaaamaainebaeakaaaaaalraiaallaannammaaamaaaaeeaaiawaabvaaealaermaobaavreaaaaakavrvdaawaraedaaaaawiaeoaaaadaaaaavvadaaaoaaeewokbaaaeaaamaabdaaama"],["NO"]],[["oooooooocooocooooooooooooooooooooooooofoooooooooooooovoooozoooooooooqoooooooooooooooooooooooooooooooooxooovoooooooocoooooxooobooczoooooooooqooooooooooooooooocooooeooooooxoooooooooooooooooozooooooooooooooooooxoopooooocooobooooooooooooooooloooooooooooooooooooobooooelooooooooooooooooooooooooxooiooooooooooopooboooooooooooooooooooooolooooooooooooooooooooo"],["YES","booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooobobooooooooobocooococooooooooooocooooooooooocooocoeoooeooooofoiooooooooolooooolooooolooooopopoooooqoooqovooooooooovoooooooooooooxoooxoxoooxoooooooooooooxooooozooooooooozozooo"]],[["bbbbbbzbbbbbbbbbbgbbbbbbbbbbbpbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbmbbbbbbbobbbbbbbwubbbrbbbbbbbbbbbbbbbubbbbbbbqobbbbdbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbbbbbbbxbbbbbbbbbbbbbbbbbbdbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbobbbbbbbbbibbbbbbbbbbgbbbbebbybbbbbbbbbbbbbbbabbbbbbbbbybiybbbbdbbbgbebbbbbkbbbbbbnbbbbbbbbbbbbbbbbbbbbbbbsbbbbbbbbbbbbbbbtbbbbbbbbbpbbb"],["NO"]],[["llvlluelllllllllzllnndluelllhdunlnlllllhnbhldllelllllhllleulunvlldlllllbepellpzulbulllelllvblllulllllllllezpllhldellzldlllllllelllhlllehllvevlnullllvllllpudldlllvdbllllhnvlllllvllvllvlllplelzplpzllllulzlbllzldevlullelllhhzdeulllllllllnlzvllllllbllvllllllllluellnlllulnllllbdlevlhlvllllpenblvzlzlllblvhllllhllllpeblevelpllllnpbhlhllbllllndllblldvn"],["NO"]],[["zzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"],["YES","ozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzozozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"]],[["lsllllmllllslllxlvlxluyylllslllmlllvllxllslllvlslyulllullllllmlxulllyxlllmlllllvullllllslllsmlllxmllvvlslllllllllllulllvlllllllmllllsylylvluylllmullslllllvylmmlluyllvlylllllllllllvllllsmlxlslmlllxxslllmyluvylylllllxmxlulsslslmllulxllmllxuusllllumlllllmsssmxullllmsllllmlxxllmllllylvllmlluymxlllllslyxllvlllllllllllllllsllullmlllllslllsllullslllllllllllvyllllvlllylllsllvlvsmlvllllllulullllllslxlml"],["NO"]],[["cccjcchccccccjcccccccjlccccccccccccchccccwccctccccccccccccccccczccccccccccccccccccccccccccccccccccccccnwcccccccccccccccccccoccwcccccccccccwccccccccccccccncdccccbcctcccccccccccccccccccccccxccccccvcccnccccbccccccccccccccccccccccclccccccccczccvccccccvscccccccccxccccocccccccscccccccccccccxvccccccccccccccccccccccccccccccccccccccccccccccxccccccccccccwccccccchccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"],["YES","bcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbcccccccccccdccchchccchcccccjcjcccccccccjccccclccccclcccccncncccccncccococccccccccscccccccccccccsccctctcccvcccccccccccccvcccccvcccccccccvcwcccwcccccwcccccccwcccccwcccccxcccxcccccxcccccccxccczccccccczccccc"]],[["uuuuuuuuuuuuuuuuuuuuuuuuuuquuuuulquuuuuuuouuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuouuuuxouuuuuxuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuruuuuuuxuuuuuuuuuuuuuuuuuuuuuuuzuuuuuuuuuuuuuuupuuuuuuuuuuuuuuuuuuluuuuuuuuuuuuuuuuuuuuuuuuuuuuuurluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuxuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuruuuuuuouuuquuuluuuuuuuuupuuouuuuuuuuuuzuuuuuuuokuuluuuupuuukuuuuuruuuuuuupuuuuuuuuuuuuzuouuuuuuuuuuuuuuuz"],["NO"]],[["vkxvxkxvxxxkkvkxvkkxvvvvvvvvkkvkkxvvkkvkkvkkvxxvxvvvvkvkvvxvvxvxvvvkvxkkxkxxkxxkxvxvvxvkvvxvkvkvkxkxvxkvvkvxkxkvkxvxvxxxxxvxxvxxxkkvvvvkkvvvxxkxkvvkxvvxkkkvkvvkvvvvxxxkxxxvvvkxkxvkvxxkxkxkxkvvxxkkkkvxxkvkkxvxvxxvxxxxvvkvxkxkxvkkvxxvxkvvkxkkvxvkkkkkkxkxkvxkkkxxxxxxxvxkxkkvxkkxvkvkkvkkkxvkvkvkvvxkkkxxvxxxxxvkvvxkvvvxvxvkkvvvxkvkxkvxxkvvkxvvxkxxkxkkkvxkxxvkkkxxkxxxvxkxkkkvkkxxxvvkkvvkvkkkxkvxkxxxvkvxvxxkvkxkvkxvxvvxvxxkkkxxkkkkvvvv"],["NO"]],[["gggggggggggqggggggggnqggggggepgggeggggpggqeggggegggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghggqghgggggggggggggggggggggggqgqggggghgggnnggggggggggggggggqgggggpgggggggggggnggggpggggggggggggggggggggggggggggggggqgggqggggggggggeegggggggggggggggggggggngggggghqggggggggggggggggggggggggggggggepggggggggghgggggggggggggggggggggggggghggggggghgggnhgggggggggpggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg"],["YES","egggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggegggegegggegggggegeggggggggggggggghggggghggggghghggggghggghghggggggggghgggggggggggggngggngngggngggggggggggggngggggngggggggggpgpgggpgggggpgggggggpgggggpgggggpgggqgggggqgggggggqgggqgggggggqgggggggggqgqgggggggggqgqgggggqggg"]],[["pynyyyyypyyyfyyyyyyyvoyyyyvyyyldyyyyyhyyvyyyyyyyyyyyyoyyppyyyyyyywyyysyyyyayyyayyyyyyyoyyyydyyyyyavyyygiyyhfyyyyyyyyyyzyyyysyyyyicyyyyyyycjyyhykyiyykkyylyyyyiyyyyyyyyifyyyyyyyzyyyyyiyyryykyyyhzyydryyyysyyyyyyyyyyyyyaybyyyoyyyykyyyyyyyyyyncyyyyvryyjyyyyqyyfbyyysyyqypyydyyyyyyyyyyyqyywjyyyyyayyyyyyyyyjyyyyyyyyyyyyaygyyypyyyyyayyyyyyyoyyyyiyyyyyiyyyyyjoyykyyyyyyyyyyyyyyyyyyyyyohyyyyvyykyybiyyyyyyyyyyyyyyyyyyyyyyyfyyyyyyyyyyyyyyyyvyyyyyyy"],["NO"]],[["bbbbbbbbbbbbzqbbbbibbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbbbbbbjbbbbbbbbbbbbbbgbbbbbbbbbbzebbbbbvbbbbbbbbbbbbbbbbbbbbbbbbtbbbtbvbebbbbzvbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbibbbbbbqbqjbbpbbzbbbbbbbbbbbbbbbbbbbbbbbbbbbebbbbzbbcbbbbbbbqbbbvbbbbbbbbbbbbbbbbbbbbpbbbbbbbbbbbgbbbbzbbbbbbbbbbbbjbbbbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbbebqbbbbjbbbbbbbbbbbbbbbbbbbbbbbbtbbbbbbbbbbbbbbbbbbbbbbbbbbbbqbbbbbbbbbbbbbbbibbbbbbbbbbbbbbbbbzb"],["YES","cbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcbbbcbbbbbebebbbbbbbbbebbbbbebbbbbgbbbbbgbibbbbbibbbibibbbbbbbbbjbbbbbbbbbbbbbjbbbjbjbbbpbbbbbbbbbbbbbpbbbbbqbbbbbbbbbqbqbbbqbbbbbqbbbbbbbqbbbbbtbbbbbtbbbtbbbbbvbbbbbbbvbbbvbbbbbbbvbbbbbbbbbzbzbbbbbbbbbzbzbbbbbzbbbzbbbbbzbbbbb"]],[["tsssshssusssssssssssusssspssssssssssssssssssssssssssssssvsssssssssssssssossssvssssssssssysssssscsssssssussfsssssssszssssssssfssssssssssssssssssssssswssssssssdsssssssssssussssssessmssssssssssjsssssvsssssssssssssssssssssssssssssssssssssssssssssssstssssssssrsssssshssssssssssssssssssssssssssssusssssssssssssssssssssssssssssssessscssrssssssessssssslwwsssssssssssusssscsssssssssssssswssssssssssssssessssstssssssstsshsssssssssssssssssssssisssssssssssssssssssssssosssssswsss"],["NO"]],[["fkfffffffvfkfoffffqoqqffaftftvfuffjffffffffoflftvfffgffffffzfrvfocfmfkmjfftfmfwafzfffajsfffalguvjdfftfndfcnfjfgfffoofoflnffffffofdiczffajffdifrffffffrffffnifofffifdffvgffvoffwbfkfqfsfwfmwcfrkzuzokufmffffffcfffqfzfoffonfnfffkfffkwqifffsfifffzfofofffrfffflftkkfvfffbffuwffjtffmfffaffdlznffjllfqgfffffffffdmlfwlabfblcfdfwffffbfvmfrifwvvffffzffbfafnsffantfrkffzffffffifffrwacfrffffsdfffkffffooaffqckqbnbqqofvafffrtgffwsmfngffbzfffgffofnflfffvrffffmjjkfvfcfccfqfjfnf"],["NO"]],[["xxxxxxxxxxfxxxxxxxxxxxxxxxxxxxxxxxxxxxrxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxexxxxmxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxexxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxaxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsxxxxxzxxxxxxxxxxxxxxxxxxxxxxxxxhrxxnxxxxxxxxxxxxxxxxtxxxxxxxxxx"],["YES","axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbxxxxxbxxxxxexxxxxexfxxxxxhxxxixmxxxxxxxxxnxxxxxxxxxxxxxoxxxoxoxxxpxxxxxxxxxxxxxrxxxxxrxxxxxxxxxsxtxxxtxxxxxtxxxxxxxuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzxxxx"]],[["vtvzvlvlzvrtevdvvvsvjyvwrwwjhovvtotvkvvvvvovvewlvrvvfsvvvvnvfcsvvvtcrmckvvvztvvlvvdyfvcylvhvvcvvvvrvhwvryvhmvvcnsozusvltocvvywvvsvvvdocoftvkvvzvvtnvcmevyvhvhvlovvvvlvvvvtdjcvvvyvvurvuovusvvwvrvtvvfvmvvvmnycnvmvovuzvzvvvjvvvvnvvdrvvcrrvfvzujvyvtmrucvvvcjuvrvvtukvvvlvrkhvvsvjvftvzvmvvunsweuzcvvvfrvrwhyvdjerltlvcvvzednvyvjkvktvvesovvvmkvvnvzvjvcvfwvzhfkvvvuvvduovvmevkvhvuvmnvnvvvvvuvvlfjtjmdvceslvmevvvjvvkvvkjnvfyseevmvlvzvvvvvfdvleuvvlvvyvmrmvvfsevovhzdrru"],["NO"]],[["mmmmmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmummmmmummmmmmmmmmmmmmmsmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmmmmmmsmmmmmmmmmmmmmmmmrummmmmmmmmmmmmmmmmmmmmmmmmmmmmsmsmmmmmmmrmmmmmmmmmmmmmmmmmmrmmmmmmcmmsmmmmmmmmrmmmmmmmmmmmmmmmmmmmmmmummmmmmcmmmmmmmmmmmmmmmmmmmcmmmmmmmrmmmmmmmmmmcmmmmmrurmmmmmmmmmmmmmummmmmmmmmmmummmmmmsmmmmrmmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmummsmmmummmmmmmmmrmmmmmmmmmmmmummummrmmmmmmmmmmmmmmmmmmmrmrmmmmmmmmmmmmmmummmmmmmmmmmmmsmmmmmmmummmmmmmmmmmmmmmcmmmmmmmmmmmmmmmmmmmmmm"],["YES","cmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmcmcmmmmmmmmmcmmmmmcmmmmmcmmmmmrmrmmmmmrmmmrmrmmmmmmmmmrmmmmmmmmmmmmmrmmmrmrmmmrmmmmmmmmmmmmmrmmmmmrmmmmmmmmmsmsmmmsmmmmmsmmmmmmmsmmmmmsmmmmmsmmmsmmmmmsmmmmmmmsmmmummmmmmmummmmmmmmmumummmmmmmmmumummmmmummmummmmmummmmmmmummmumummmummmmmmm"]],[["z"],["YES","z"]]]}} +{"instance_id":"pseudo_to_code_2k_194","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nlet st be a string\nlet temp, bst be strings\ncreate a set of strings by name v\nlet rl be a function that accepts string st and returns a string value\n the character value of c is equal to st[0]\n st[0] is equal to st[1]\n st[1] is equal to st[2]\n st[2] is equal to st[3]\n st[3] is equal to c\n return the value of st\nend of the block\nlet ru be a function that accepts string st and returns a string value\n the character value of temp is equal to st[4]\n st[4] is equal to st[0]\n st[0] is equal to st[5]\n st[5] is equal to st[2]\n st[2] is equal to temp\n return the value of st\nend of the block\ndefine the main function\n read st\n sort the values of st from beginning to end\n do\n temp is equal to st\n bst is equal to temp\n for integer iter = 1 to 2000 inclusive\n if rand() modulo 2\n temp is equal to rl(temp)\n else do the following\n temp is equal to ru(temp)\n if bst is greater than temp , bst is equal to temp\n end of the block\n insert bst into v\n while next_permutation of st from beginning to end\n print length of v and newline\n read a character\n read a character\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"string st;\nstring temp, bst;\nset v;\nstring rl(string st) {\n char c = st[0];\n st[0] = st[1];\n st[1] = st[2];\n st[2] = st[3];\n st[3] = c;\n return st;\n}\nstring ru(string st) {\n char temp = st[4];\n st[4] = st[0];\n st[0] = st[5];\n st[5] = st[2];\n st[2] = temp;\n return st;\n}\nint main() {\n cin >> st;\n sort(st.begin(), st.end());\n do {\n temp = st;\n bst = temp;\n for (int iter = 1; iter <= 2000; iter++) {\n if (rand() % 2)\n temp = rl(temp);\n else\n temp = ru(temp);\n if (bst > temp) bst = temp;\n }\n v.insert(bst);\n } while (next_permutation(st.begin(), st.end()));\n cout << v.size() << endl;\n cin.get();\n cin.get();\n return 0;\n}","item":{"problem_id":"98A","pseudocode":"let st be a string\nlet temp, bst be strings\ncreate a set of strings by name v\nlet rl be a function that accepts string st and returns a string value\n the character value of c is equal to st[0]\n st[0] is equal to st[1]\n st[1] is equal to st[2]\n st[2] is equal to st[3]\n st[3] is equal to c\n return the value of st\nend of the block\nlet ru be a function that accepts string st and returns a string value\n the character value of temp is equal to st[4]\n st[4] is equal to st[0]\n st[0] is equal to st[5]\n st[5] is equal to st[2]\n st[2] is equal to temp\n return the value of st\nend of the block\ndefine the main function\n read st\n sort the values of st from beginning to end\n do\n temp is equal to st\n bst is equal to temp\n for integer iter = 1 to 2000 inclusive\n if rand() modulo 2\n temp is equal to rl(temp)\n else do the following\n temp is equal to ru(temp)\n if bst is greater than temp , bst is equal to temp\n end of the block\n insert bst into v\n while next_permutation of st from beginning to end\n print length of v and newline\n read a character\n read a character\n return to indicate successful execution\nend of the block","testcases":[[["YYYYYY"],["1"]],[["BOOOOB"],["2"]],[["ROYGBV"],["30"]],[["RRRRRR"],["1"]],[["BOOOOO"],["1"]],[["GOGGVG"],["2"]],[["GRBYVO"],["30"]],[["BYOVRR"],["15"]],[["VOVRBV"],["5"]],[["GVGBVO"],["8"]],[["BOBGBB"],["2"]],[["OOYYBY"],["3"]],[["VVRVVV"],["1"]],[["YBBVVY"],["6"]],[["GYYGGG"],["2"]],[["BRRBRB"],["2"]],[["OOOOOO"],["1"]],[["OVBRYG"],["30"]],[["VOBYGO"],["15"]],[["VRRYGR"],["5"]],[["VOBVYB"],["8"]],[["YYYYRB"],["2"]],[["RYYYVV"],["3"]],[["YYYYYG"],["1"]],[["OBORBR"],["6"]],[["RRRGRG"],["2"]],[["VYYYVV"],["2"]],[["YYYYYY"],["1"]],[["YROVBG"],["30"]],[["RYGOBG"],["15"]],[["BGRGGV"],["5"]],[["BVRYBV"],["8"]],[["RRBYRR"],["2"]],[["GGGYYB"],["3"]],[["BBBBBY"],["1"]],[["RRYYOO"],["6"]],[["YYYRRY"],["2"]],[["OGGOOG"],["2"]],[["GYYBRO"],["15"]],[["VORBOR"],["8"]],[["RRRGGB"],["3"]],[["BBOOYY"],["6"]],[["YYBBOO"],["6"]],[["OBRRYY"],["8"]],[["ROYYGG"],["8"]],[["RRGGYY"],["6"]],[["RROOYY"],["6"]],[["RRYOGB"],["15"]]]}} +{"instance_id":"pseudo_to_code_2k_195","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate const int MAXN = 5005\ndeclare izq taking in string c and returning string\n create string temp = c\n set temp[0] to c[3]\n set temp[1] to c[5]\n set temp[3] to c[1]\n set temp[5] to c[0]\n return temp\nend of the block\ndeclare abajo taking in string c and returning string\n make string temp = c\n for i = 2 to 5 exclusive, swap values of temp[i] and temp[i + 1]\n return temp\nend of the block\ndeclare last taking in string c and returning string\n make string ans = c\n for i = 0 to 4 exclusive\n for j = 0 to 4 exclusive\n for k = 0 to 4 exclusive\n set ans to max of ans and c\n set c to izq(c)\n end of the block\n set c to abajo(c)\n end of the block\n set c to izq(c)\n end of the block\n return ans\nend of the block\ndefine the main function\n make string color\n read color\n sort color\n make string set ans\n do insert last(color) into ans while next_permutation(color.begin(), color.end()) returns true\n show ans.size()\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int const MAXN = 5005;\nstring izq(string c) {\n string temp = c;\n temp[0] = c[3];\n temp[1] = c[5];\n temp[3] = c[1];\n temp[5] = c[0];\n return temp;\n}\nstring abajo(string c) {\n string temp = c;\n for (int i = 2; i < 5; ++i) swap(temp[i], temp[i + 1]);\n return temp;\n}\nstring last(string c) {\n string ans = c;\n for (int i = 0; i < 4; ++i) {\n for (int j = 0; j < 4; ++j) {\n for (int k = 0; k < 4; ++k) {\n ans = max(ans, c);\n c = izq(c);\n }\n c = abajo(c);\n }\n c = izq(c);\n }\n return ans;\n}\nint main() {\n string color;\n cin >> color;\n sort(color.begin(), color.end());\n set ans;\n do { ans.insert(last(color)); } while (next_permutation(color.begin(), color.end()));\n cout << ans.size() << '\\n';\n return 0;\n}","item":{"problem_id":"98A","pseudocode":"create const int MAXN = 5005\ndeclare izq taking in string c and returning string\n create string temp = c\n set temp[0] to c[3]\n set temp[1] to c[5]\n set temp[3] to c[1]\n set temp[5] to c[0]\n return temp\nend of the block\ndeclare abajo taking in string c and returning string\n make string temp = c\n for i = 2 to 5 exclusive, swap values of temp[i] and temp[i + 1]\n return temp\nend of the block\ndeclare last taking in string c and returning string\n make string ans = c\n for i = 0 to 4 exclusive\n for j = 0 to 4 exclusive\n for k = 0 to 4 exclusive\n set ans to max of ans and c\n set c to izq(c)\n end of the block\n set c to abajo(c)\n end of the block\n set c to izq(c)\n end of the block\n return ans\nend of the block\ndefine the main function\n make string color\n read color\n sort color\n make string set ans\n do insert last(color) into ans while next_permutation(color.begin(), color.end()) returns true\n show ans.size()\n return to indicate successful execution\nend of the block","testcases":[[["YYYYYY"],["1"]],[["BOOOOB"],["2"]],[["ROYGBV"],["30"]],[["RRRRRR"],["1"]],[["BOOOOO"],["1"]],[["GOGGVG"],["2"]],[["GRBYVO"],["30"]],[["BYOVRR"],["15"]],[["VOVRBV"],["5"]],[["GVGBVO"],["8"]],[["BOBGBB"],["2"]],[["OOYYBY"],["3"]],[["VVRVVV"],["1"]],[["YBBVVY"],["6"]],[["GYYGGG"],["2"]],[["BRRBRB"],["2"]],[["OOOOOO"],["1"]],[["OVBRYG"],["30"]],[["VOBYGO"],["15"]],[["VRRYGR"],["5"]],[["VOBVYB"],["8"]],[["YYYYRB"],["2"]],[["RYYYVV"],["3"]],[["YYYYYG"],["1"]],[["OBORBR"],["6"]],[["RRRGRG"],["2"]],[["VYYYVV"],["2"]],[["YYYYYY"],["1"]],[["YROVBG"],["30"]],[["RYGOBG"],["15"]],[["BGRGGV"],["5"]],[["BVRYBV"],["8"]],[["RRBYRR"],["2"]],[["GGGYYB"],["3"]],[["BBBBBY"],["1"]],[["RRYYOO"],["6"]],[["YYYRRY"],["2"]],[["OGGOOG"],["2"]],[["GYYBRO"],["15"]],[["VORBOR"],["8"]],[["RRRGGB"],["3"]],[["BBOOYY"],["6"]],[["YYBBOO"],["6"]],[["OBRRYY"],["8"]],[["ROYYGG"],["8"]],[["RRGGYY"],["6"]],[["RROOYY"],["6"]],[["RRYOGB"],["15"]]]}} +{"instance_id":"pseudo_to_code_2k_196","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ndefine the main function\n create string s\n read s\n create set ss\n sort s\n do\n create string m = s\n create vector v\n for i = 0 to 3 exclusive do push s.substr(2 * i, 2) onto v\n for i = 0 to 4 exclusive\n for i = 0 to 4 exclusive\n for i = 0 to 4 exclusive\n create string str = v[0] + v[1] + v[2]\n set m to min of m and str\n swap v[1] and v[2]\n swap v[2][0] and v[2][1]\n end of the block\n swap v[0] and v[1]\n swap v[0][0] and v[0][1]\n end of the block\n swap v[0] and v[2]\n swap v[2][0] and v[2][1]\n end of the block\n insert m into ss\n while next_permutation(s.begin(), s.end())\n print ss size\nend of the block\n\n[CODE]:","reference_output":"int main() {\n string s;\n cin >> s;\n set ss;\n sort(s.begin(), s.end());\n do {\n string m = s;\n vector v;\n for (int i = 0; i < 3; i++) { v.push_back(s.substr(2 * i, 2)); }\n for (int i = 0; i < 4; i++) {\n for (int i = 0; i < 4; i++) {\n for (int i = 0; i < 4; i++) {\n string str = v[0] + v[1] + v[2];\n m = min(m, str);\n swap(v[1], v[2]);\n swap(v[2][0], v[2][1]);\n }\n swap(v[0], v[1]);\n swap(v[0][0], v[0][1]);\n }\n swap(v[0], v[2]);\n swap(v[2][0], v[2][1]);\n }\n ss.insert(m);\n } while (next_permutation(s.begin(), s.end()));\n cout << ss.size() << \"\\n\";\n}","item":{"problem_id":"98A","pseudocode":"define the main function\n create string s\n read s\n create set ss\n sort s\n do\n create string m = s\n create vector v\n for i = 0 to 3 exclusive do push s.substr(2 * i, 2) onto v\n for i = 0 to 4 exclusive\n for i = 0 to 4 exclusive\n for i = 0 to 4 exclusive\n create string str = v[0] + v[1] + v[2]\n set m to min of m and str\n swap v[1] and v[2]\n swap v[2][0] and v[2][1]\n end of the block\n swap v[0] and v[1]\n swap v[0][0] and v[0][1]\n end of the block\n swap v[0] and v[2]\n swap v[2][0] and v[2][1]\n end of the block\n insert m into ss\n while next_permutation(s.begin(), s.end())\n print ss size\nend of the block","testcases":[[["YYYYYY"],["1"]],[["BOOOOB"],["2"]],[["ROYGBV"],["30"]],[["RRRRRR"],["1"]],[["BOOOOO"],["1"]],[["GOGGVG"],["2"]],[["GRBYVO"],["30"]],[["BYOVRR"],["15"]],[["VOVRBV"],["5"]],[["GVGBVO"],["8"]],[["BOBGBB"],["2"]],[["OOYYBY"],["3"]],[["VVRVVV"],["1"]],[["YBBVVY"],["6"]],[["GYYGGG"],["2"]],[["BRRBRB"],["2"]],[["OOOOOO"],["1"]],[["OVBRYG"],["30"]],[["VOBYGO"],["15"]],[["VRRYGR"],["5"]],[["VOBVYB"],["8"]],[["YYYYRB"],["2"]],[["RYYYVV"],["3"]],[["YYYYYG"],["1"]],[["OBORBR"],["6"]],[["RRRGRG"],["2"]],[["VYYYVV"],["2"]],[["YYYYYY"],["1"]],[["YROVBG"],["30"]],[["RYGOBG"],["15"]],[["BGRGGV"],["5"]],[["BVRYBV"],["8"]],[["RRBYRR"],["2"]],[["GGGYYB"],["3"]],[["BBBBBY"],["1"]],[["RRYYOO"],["6"]],[["YYYRRY"],["2"]],[["OGGOOG"],["2"]],[["GYYBRO"],["15"]],[["VORBOR"],["8"]],[["RRRGGB"],["3"]],[["BBOOYY"],["6"]],[["YYBBOO"],["6"]],[["OBRRYY"],["8"]],[["ROYYGG"],["8"]],[["RRGGYY"],["6"]],[["RROOYY"],["6"]],[["RRYOGB"],["15"]]]}} +{"instance_id":"pseudo_to_code_2k_197","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\ncreate constant int N = 2e5 + 5\ncreate string s\ncreate queue q\ncreate map mp of string to int\nin function bfs taking string s\n mp[s] = true\n push s onto q\n while q is not empty\n create string u = front of q, v1, v2, v3\n pop q\n v1 = v2 = v3 = u\n v1[0] = u[3], v1[1] = u[0], v1[2] = u[1], v1[3] = u[2]\n v2[0] = u[4], v2[5] = u[0], v2[2] = u[5], v2[4] = u[2]\n v3[5] = u[1], v3[3] = u[5], v3[4] = u[3], v3[1] = u[4]\n if not mp[v1] then mp[v1] = true, push v1 onto q\n if not mp[v2] then mp[v2] = true, push v2 onto q\n if not mp[v3] then mp[v3] = true, push v3 onto q\n end of the block\nend of the block\ndefine the main function\n read s\n create int res = 0\n sort s\n do\n if mp[s] then continue\n add 1 to res\n call bfs on s\n while next_permutation(s.begin(), s.end())\n print res\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"const int N = 2e5 + 5;\nstring s;\nqueue q;\nmap mp;\nvoid bfs(string s) {\n mp[s] = true;\n q.push(s);\n while (!q.empty()) {\n string u = q.front(), v1, v2, v3;\n q.pop();\n v1 = v2 = v3 = u;\n v1[0] = u[3], v1[1] = u[0], v1[2] = u[1], v1[3] = u[2];\n v2[0] = u[4], v2[5] = u[0], v2[2] = u[5], v2[4] = u[2];\n v3[5] = u[1], v3[3] = u[5], v3[4] = u[3], v3[1] = u[4];\n if (!mp[v1]) mp[v1] = true, q.push(v1);\n if (!mp[v2]) mp[v2] = true, q.push(v2);\n if (!mp[v3]) mp[v3] = true, q.push(v3);\n }\n}\nint main() {\n cin >> s;\n int res = 0;\n sort(s.begin(), s.end());\n do {\n if (mp[s]) continue;\n res++;\n bfs(s);\n } while (next_permutation(s.begin(), s.end()));\n cout << res << '\\n';\n return 0;\n}","item":{"problem_id":"98A","pseudocode":"create constant int N = 2e5 + 5\ncreate string s\ncreate queue q\ncreate map mp of string to int\nin function bfs taking string s\n mp[s] = true\n push s onto q\n while q is not empty\n create string u = front of q, v1, v2, v3\n pop q\n v1 = v2 = v3 = u\n v1[0] = u[3], v1[1] = u[0], v1[2] = u[1], v1[3] = u[2]\n v2[0] = u[4], v2[5] = u[0], v2[2] = u[5], v2[4] = u[2]\n v3[5] = u[1], v3[3] = u[5], v3[4] = u[3], v3[1] = u[4]\n if not mp[v1] then mp[v1] = true, push v1 onto q\n if not mp[v2] then mp[v2] = true, push v2 onto q\n if not mp[v3] then mp[v3] = true, push v3 onto q\n end of the block\nend of the block\ndefine the main function\n read s\n create int res = 0\n sort s\n do\n if mp[s] then continue\n add 1 to res\n call bfs on s\n while next_permutation(s.begin(), s.end())\n print res\n return to indicate successful execution\nend of the block","testcases":[[["YYYYYY"],["1"]],[["BOOOOB"],["2"]],[["ROYGBV"],["30"]],[["RRRRRR"],["1"]],[["BOOOOO"],["1"]],[["GOGGVG"],["2"]],[["GRBYVO"],["30"]],[["BYOVRR"],["15"]],[["VOVRBV"],["5"]],[["GVGBVO"],["8"]],[["BOBGBB"],["2"]],[["OOYYBY"],["3"]],[["VVRVVV"],["1"]],[["YBBVVY"],["6"]],[["GYYGGG"],["2"]],[["BRRBRB"],["2"]],[["OOOOOO"],["1"]],[["OVBRYG"],["30"]],[["VOBYGO"],["15"]],[["VRRYGR"],["5"]],[["VOBVYB"],["8"]],[["YYYYRB"],["2"]],[["RYYYVV"],["3"]],[["YYYYYG"],["1"]],[["OBORBR"],["6"]],[["RRRGRG"],["2"]],[["VYYYVV"],["2"]],[["YYYYYY"],["1"]],[["YROVBG"],["30"]],[["RYGOBG"],["15"]],[["BGRGGV"],["5"]],[["BVRYBV"],["8"]],[["RRBYRR"],["2"]],[["GGGYYB"],["3"]],[["BBBBBY"],["1"]],[["RRYYOO"],["6"]],[["YYYRRY"],["2"]],[["OGGOOG"],["2"]],[["GYYBRO"],["15"]],[["VORBOR"],["8"]],[["RRRGGB"],["3"]],[["BBOOYY"],["6"]],[["YYBBOO"],["6"]],[["OBRRYY"],["8"]],[["ROYYGG"],["8"]],[["RRGGYY"],["6"]],[["RROOYY"],["6"]],[["RRYOGB"],["15"]]]}} +{"instance_id":"pseudo_to_code_2k_198","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nx,res=int\nt=map from string to bool\ns,r=string\ndefine the main function\n read s\n sort s\n do\n if not t[s]\n increment res\n r=s[0]\n append s[1] to r\n append s[2] to r\n append s[3] to r\n append s[4] to r\n append s[5] to r\n t[r]=true\n r=s[0]\n append s[2] to r\n append s[3] to r\n append s[4] to r\n append s[1] to r\n append s[5] to r\n t[r]=true\n r=s[0]\n append s[3] to r\n append s[4] to r\n append s[1] to r\n append s[2] to r\n append s[5] to r\n t[r]=true\n r=s[0]\n append s[4] to r\n append s[1] to r\n append s[2] to r\n append s[3] to r\n append s[5] to r\n t[r]=true\n r=s[5]\n append s[4] to r\n append s[3] to r\n append s[2] to r\n append s[1] to r\n append s[0] to r\n t[r]=true\n r=s[5]\n append s[1] to r\n append s[4] to r\n append s[3] to r\n append s[2] to r\n append s[0] to r\n t[r]=true\n r=s[5]\n append s[2] to r\n append s[1] to r\n append s[4] to r\n append s[3] to r\n append s[0] to r\n t[r]=true\n r=s[5]\n append s[3] to r\n append s[2] to r\n append s[1] to r\n append s[4] to r\n append s[0] to r\n t[r]=true\n r=s[1]\n append s[5] to r\n append s[2] to r\n append s[0] to r\n append s[4] to r\n append s[3] to r\n t[r]=true\n r=s[1]\n append s[2] to r\n append s[0] to r\n append s[4] to r\n append s[5] to r\n append s[3] to r\n t[r]=true\n r=s[1]\n append s[0] to r\n append s[4] to r\n append s[5] to r\n append s[2] to r\n append s[3] to r\n t[r]=true\n r=s[1]\n append s[4] to r\n append s[5] to r\n append s[2] to r\n append s[0] to r\n append s[3] to r\n t[r]=true\n r=s[3]\n append s[4] to r\n append s[0] to r\n append s[2] to r\n append s[5] to r\n append s[1] to r\n t[r]=true\n r=s[3]\n append s[5] to r\n append s[4] to r\n append s[0] to r\n append s[2] to r\n append s[1] to r\n t[r]=true\n r=s[3]\n append s[2] to r\n append s[5] to r\n append s[4] to r\n append s[0] to r\n append s[1] to r\n t[r]=true\n r=s[3]\n append s[0] to r\n append s[2] to r\n append s[5] to r\n append s[4] to r\n append s[1] to r\n t[r]=true\n r=s[2]\n append s[3] to r\n append s[0] to r\n append s[1] to r\n append s[5] to r\n append s[4] to r\n t[r]=true\n r=s[2]\n append s[5] to r\n append s[3] to r\n append s[0] to r\n append s[1] to r\n append s[4] to r\n t[r]=true\n r=s[2]\n append s[1] to r\n append s[5] to r\n append s[3] to r\n append s[0] to r\n append s[4] to r\n t[r]=true\n r=s[2]\n append s[0] to r\n append s[1] to r\n append s[5] to r\n append s[3] to r\n append s[4] to r\n t[r]=true\n r=s[4]\n append s[5] to r\n append s[1] to r\n append s[0] to r\n append s[3] to r\n append s[2] to r\n t[r]=true\n r=s[4]\n append s[3] to r\n append s[5] to r\n append s[1] to r\n append s[0] to r\n append s[2] to r\n t[r]=true\n r=s[4]\n append s[0] to r\n append s[3] to r\n append s[5] to r\n append s[1] to r\n append s[2] to r\n t[r]=true\n r=s[4]\n append s[1] to r\n append s[0] to r\n append s[3] to r\n append s[5] to r\n append s[2] to r\n t[r]=true\n end of the block\n while next permutation of s\n print res\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"int x, res;\nmap t;\nstring s, r;\nint main() {\n cin >> s;\n sort(s.begin(), s.end());\n do {\n if (!t[s]) {\n res++;\n r = s[0];\n r += s[1];\n r += s[2];\n r += s[3];\n r += s[4];\n r += s[5];\n t[r] = true;\n r = s[0];\n r += s[2];\n r += s[3];\n r += s[4];\n r += s[1];\n r += s[5];\n t[r] = true;\n r = s[0];\n r += s[3];\n r += s[4];\n r += s[1];\n r += s[2];\n r += s[5];\n t[r] = true;\n r = s[0];\n r += s[4];\n r += s[1];\n r += s[2];\n r += s[3];\n r += s[5];\n t[r] = true;\n r = s[5];\n r += s[4];\n r += s[3];\n r += s[2];\n r += s[1];\n r += s[0];\n t[r] = true;\n r = s[5];\n r += s[1];\n r += s[4];\n r += s[3];\n r += s[2];\n r += s[0];\n t[r] = true;\n r = s[5];\n r += s[2];\n r += s[1];\n r += s[4];\n r += s[3];\n r += s[0];\n t[r] = true;\n r = s[5];\n r += s[3];\n r += s[2];\n r += s[1];\n r += s[4];\n r += s[0];\n t[r] = true;\n r = s[1];\n r += s[5];\n r += s[2];\n r += s[0];\n r += s[4];\n r += s[3];\n t[r] = true;\n r = s[1];\n r += s[2];\n r += s[0];\n r += s[4];\n r += s[5];\n r += s[3];\n t[r] = true;\n r = s[1];\n r += s[0];\n r += s[4];\n r += s[5];\n r += s[2];\n r += s[3];\n t[r] = true;\n r = s[1];\n r += s[4];\n r += s[5];\n r += s[2];\n r += s[0];\n r += s[3];\n t[r] = true;\n r = s[3];\n r += s[4];\n r += s[0];\n r += s[2];\n r += s[5];\n r += s[1];\n t[r] = true;\n r = s[3];\n r += s[5];\n r += s[4];\n r += s[0];\n r += s[2];\n r += s[1];\n t[r] = true;\n r = s[3];\n r += s[2];\n r += s[5];\n r += s[4];\n r += s[0];\n r += s[1];\n t[r] = true;\n r = s[3];\n r += s[0];\n r += s[2];\n r += s[5];\n r += s[4];\n r += s[1];\n t[r] = true;\n r = s[2];\n r += s[3];\n r += s[0];\n r += s[1];\n r += s[5];\n r += s[4];\n t[r] = true;\n r = s[2];\n r += s[5];\n r += s[3];\n r += s[0];\n r += s[1];\n r += s[4];\n t[r] = true;\n r = s[2];\n r += s[1];\n r += s[5];\n r += s[3];\n r += s[0];\n r += s[4];\n t[r] = true;\n r = s[2];\n r += s[0];\n r += s[1];\n r += s[5];\n r += s[3];\n r += s[4];\n t[r] = true;\n r = s[4];\n r += s[5];\n r += s[1];\n r += s[0];\n r += s[3];\n r += s[2];\n t[r] = true;\n r = s[4];\n r += s[3];\n r += s[5];\n r += s[1];\n r += s[0];\n r += s[2];\n t[r] = true;\n r = s[4];\n r += s[0];\n r += s[3];\n r += s[5];\n r += s[1];\n r += s[2];\n t[r] = true;\n r = s[4];\n r += s[1];\n r += s[0];\n r += s[3];\n r += s[5];\n r += s[2];\n t[r] = true;\n }\n } while (next_permutation(s.begin(), s.end()));\n cout << res << endl;\n return 0;\n}","item":{"problem_id":"98A","pseudocode":"x,res=int\nt=map from string to bool\ns,r=string\ndefine the main function\n read s\n sort s\n do\n if not t[s]\n increment res\n r=s[0]\n append s[1] to r\n append s[2] to r\n append s[3] to r\n append s[4] to r\n append s[5] to r\n t[r]=true\n r=s[0]\n append s[2] to r\n append s[3] to r\n append s[4] to r\n append s[1] to r\n append s[5] to r\n t[r]=true\n r=s[0]\n append s[3] to r\n append s[4] to r\n append s[1] to r\n append s[2] to r\n append s[5] to r\n t[r]=true\n r=s[0]\n append s[4] to r\n append s[1] to r\n append s[2] to r\n append s[3] to r\n append s[5] to r\n t[r]=true\n r=s[5]\n append s[4] to r\n append s[3] to r\n append s[2] to r\n append s[1] to r\n append s[0] to r\n t[r]=true\n r=s[5]\n append s[1] to r\n append s[4] to r\n append s[3] to r\n append s[2] to r\n append s[0] to r\n t[r]=true\n r=s[5]\n append s[2] to r\n append s[1] to r\n append s[4] to r\n append s[3] to r\n append s[0] to r\n t[r]=true\n r=s[5]\n append s[3] to r\n append s[2] to r\n append s[1] to r\n append s[4] to r\n append s[0] to r\n t[r]=true\n r=s[1]\n append s[5] to r\n append s[2] to r\n append s[0] to r\n append s[4] to r\n append s[3] to r\n t[r]=true\n r=s[1]\n append s[2] to r\n append s[0] to r\n append s[4] to r\n append s[5] to r\n append s[3] to r\n t[r]=true\n r=s[1]\n append s[0] to r\n append s[4] to r\n append s[5] to r\n append s[2] to r\n append s[3] to r\n t[r]=true\n r=s[1]\n append s[4] to r\n append s[5] to r\n append s[2] to r\n append s[0] to r\n append s[3] to r\n t[r]=true\n r=s[3]\n append s[4] to r\n append s[0] to r\n append s[2] to r\n append s[5] to r\n append s[1] to r\n t[r]=true\n r=s[3]\n append s[5] to r\n append s[4] to r\n append s[0] to r\n append s[2] to r\n append s[1] to r\n t[r]=true\n r=s[3]\n append s[2] to r\n append s[5] to r\n append s[4] to r\n append s[0] to r\n append s[1] to r\n t[r]=true\n r=s[3]\n append s[0] to r\n append s[2] to r\n append s[5] to r\n append s[4] to r\n append s[1] to r\n t[r]=true\n r=s[2]\n append s[3] to r\n append s[0] to r\n append s[1] to r\n append s[5] to r\n append s[4] to r\n t[r]=true\n r=s[2]\n append s[5] to r\n append s[3] to r\n append s[0] to r\n append s[1] to r\n append s[4] to r\n t[r]=true\n r=s[2]\n append s[1] to r\n append s[5] to r\n append s[3] to r\n append s[0] to r\n append s[4] to r\n t[r]=true\n r=s[2]\n append s[0] to r\n append s[1] to r\n append s[5] to r\n append s[3] to r\n append s[4] to r\n t[r]=true\n r=s[4]\n append s[5] to r\n append s[1] to r\n append s[0] to r\n append s[3] to r\n append s[2] to r\n t[r]=true\n r=s[4]\n append s[3] to r\n append s[5] to r\n append s[1] to r\n append s[0] to r\n append s[2] to r\n t[r]=true\n r=s[4]\n append s[0] to r\n append s[3] to r\n append s[5] to r\n append s[1] to r\n append s[2] to r\n t[r]=true\n r=s[4]\n append s[1] to r\n append s[0] to r\n append s[3] to r\n append s[5] to r\n append s[2] to r\n t[r]=true\n end of the block\n while next permutation of s\n print res\n return to indicate successful execution\nend of the block","testcases":[[["YYYYYY"],["1"]],[["BOOOOB"],["2"]],[["ROYGBV"],["30"]],[["RRRRRR"],["1"]],[["BOOOOO"],["1"]],[["GOGGVG"],["2"]],[["GRBYVO"],["30"]],[["BYOVRR"],["15"]],[["VOVRBV"],["5"]],[["GVGBVO"],["8"]],[["BOBGBB"],["2"]],[["OOYYBY"],["3"]],[["VVRVVV"],["1"]],[["YBBVVY"],["6"]],[["GYYGGG"],["2"]],[["BRRBRB"],["2"]],[["OOOOOO"],["1"]],[["OVBRYG"],["30"]],[["VOBYGO"],["15"]],[["VRRYGR"],["5"]],[["VOBVYB"],["8"]],[["YYYYRB"],["2"]],[["RYYYVV"],["3"]],[["YYYYYG"],["1"]],[["OBORBR"],["6"]],[["RRRGRG"],["2"]],[["VYYYVV"],["2"]],[["YYYYYY"],["1"]],[["YROVBG"],["30"]],[["RYGOBG"],["15"]],[["BGRGGV"],["5"]],[["BVRYBV"],["8"]],[["RRBYRR"],["2"]],[["GGGYYB"],["3"]],[["BBBBBY"],["1"]],[["RRYYOO"],["6"]],[["YYYRRY"],["2"]],[["OGGOOG"],["2"]],[["GYYBRO"],["15"]],[["VORBOR"],["8"]],[["RRRGGB"],["3"]],[["BBOOYY"],["6"]],[["YYBBOO"],["6"]],[["OBRRYY"],["8"]],[["ROYYGG"],["8"]],[["RRGGYY"],["6"]],[["RROOYY"],["6"]],[["RRYOGB"],["15"]]]}} +{"instance_id":"pseudo_to_code_2k_199","input_prompt":"[TASK]:\nYou will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.\n\n[INSTRUCTION]:\nThe following libraries are already included in the code.\n```cpp\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n```\nDo not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.\n\n[PSEUDOCODE]:\nnew char array called colors filled with 'R', 'O', 'Y', 'G', 'B', 'V'\ndeclare vector of integers called v\ndeclare new array of integers tedad with size 300\ndefine the main function\n declare string variable with name s\n read s from the user input\n for integer i = 0 to length of s exclusive, increment tedad[s[i]]\n create new vector of integers v\n for i from 0 to 6 exclusive\n if tedad[color[i]] != 0, add tedad[color[i]] after the last element of v\n sort v\n if length of v = 1\n print 1\n else if length of v = 2\n if v[0] is equal to 1\n print 1\n else\n print 2 to the standard output\n else if length of v is equal to 3\n if v[0] = 1\n if v[1] is equal to 1\n print 2\n else\n print 3\n else\n print 6 to the stdout\n else if length of v is equal to 4\n if v[3] = 3\n print 5 to the standard output\n else if v[3] = 2\n print 8 to the output\n else if length of v = 5\n print 15\n else if length of v is equal to 6\n print 30\n return to indicate successful execution\nend of the block\n\n[CODE]:","reference_output":"char color[6] = {'R', 'O', 'Y', 'G', 'B', 'V'};\nvector v;\nint tedad[300];\nint main() {\n string s;\n cin >> s;\n for (int i = 0; i < s.length(); i++) tedad[s[i]]++;\n vector v;\n for (int i = 0; i < 6; i++)\n if (tedad[color[i]]) v.push_back(tedad[color[i]]);\n sort(v.begin(), v.end());\n if (v.size() == 1)\n cout << 1 << endl;\n else if (v.size() == 2) {\n if (v[0] == 1)\n cout << 1 << endl;\n else\n cout << 2 << endl;\n } else if (v.size() == 3) {\n if (v[0] == 1) {\n if (v[1] == 1)\n cout << 2 << endl;\n else\n cout << 3 << endl;\n } else\n cout << 6 << endl;\n } else if (v.size() == 4) {\n if (v[3] == 3)\n cout << 5 << endl;\n else if (v[3] == 2)\n cout << 8 << endl;\n } else if (v.size() == 5)\n cout << 15 << endl;\n else if (v.size() == 6)\n cout << 30 << endl;\n return 0;\n}","item":{"problem_id":"98A","pseudocode":"new char array called colors filled with 'R', 'O', 'Y', 'G', 'B', 'V'\ndeclare vector of integers called v\ndeclare new array of integers tedad with size 300\ndefine the main function\n declare string variable with name s\n read s from the user input\n for integer i = 0 to length of s exclusive, increment tedad[s[i]]\n create new vector of integers v\n for i from 0 to 6 exclusive\n if tedad[color[i]] != 0, add tedad[color[i]] after the last element of v\n sort v\n if length of v = 1\n print 1\n else if length of v = 2\n if v[0] is equal to 1\n print 1\n else\n print 2 to the standard output\n else if length of v is equal to 3\n if v[0] = 1\n if v[1] is equal to 1\n print 2\n else\n print 3\n else\n print 6 to the stdout\n else if length of v is equal to 4\n if v[3] = 3\n print 5 to the standard output\n else if v[3] = 2\n print 8 to the output\n else if length of v = 5\n print 15\n else if length of v is equal to 6\n print 30\n return to indicate successful execution\nend of the block","testcases":[[["YYYYYY"],["1"]],[["BOOOOB"],["2"]],[["ROYGBV"],["30"]],[["RRRRRR"],["1"]],[["BOOOOO"],["1"]],[["GOGGVG"],["2"]],[["GRBYVO"],["30"]],[["BYOVRR"],["15"]],[["VOVRBV"],["5"]],[["GVGBVO"],["8"]],[["BOBGBB"],["2"]],[["OOYYBY"],["3"]],[["VVRVVV"],["1"]],[["YBBVVY"],["6"]],[["GYYGGG"],["2"]],[["BRRBRB"],["2"]],[["OOOOOO"],["1"]],[["OVBRYG"],["30"]],[["VOBYGO"],["15"]],[["VRRYGR"],["5"]],[["VOBVYB"],["8"]],[["YYYYRB"],["2"]],[["RYYYVV"],["3"]],[["YYYYYG"],["1"]],[["OBORBR"],["6"]],[["RRRGRG"],["2"]],[["VYYYVV"],["2"]],[["YYYYYY"],["1"]],[["YROVBG"],["30"]],[["RYGOBG"],["15"]],[["BGRGGV"],["5"]],[["BVRYBV"],["8"]],[["RRBYRR"],["2"]],[["GGGYYB"],["3"]],[["BBBBBY"],["1"]],[["RRYYOO"],["6"]],[["YYYRRY"],["2"]],[["OGGOOG"],["2"]],[["GYYBRO"],["15"]],[["VORBOR"],["8"]],[["RRRGGB"],["3"]],[["BBOOYY"],["6"]],[["YYBBOO"],["6"]],[["OBRRYY"],["8"]],[["ROYYGG"],["8"]],[["RRGGYY"],["6"]],[["RROOYY"],["6"]],[["RRYOGB"],["15"]]]}}